diff options
author | kchan | 2005-11-09 18:28:33 +0000 |
---|---|---|
committer | kchan | 2005-11-09 18:28:33 +0000 |
commit | 2bda2d20277ff0fe105a99cfc57152c742ac833f (patch) | |
tree | 7a683b39171bf5c1dcc0c68705e5eef57b62186b | |
parent | 67a5402059e46c39c519b2f3802c27b5ed32a4f2 (diff) | |
download | webtools.webservices-2bda2d20277ff0fe105a99cfc57152c742ac833f.tar.gz webtools.webservices-2bda2d20277ff0fe105a99cfc57152c742ac833f.tar.xz webtools.webservices-2bda2d20277ff0fe105a99cfc57152c742ac833f.zip |
[98921] Define ANT task and command line interfaces to scenarios.
32 files changed, 2621 insertions, 27 deletions
diff --git a/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/common/JavaWSDLParamModifier.java b/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/common/JavaWSDLParamModifier.java new file mode 100644 index 000000000..cb2fa9181 --- /dev/null +++ b/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/common/JavaWSDLParamModifier.java @@ -0,0 +1,81 @@ +package org.eclipse.jst.ws.internal.axis.consumption.core.common; + +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.Path; +import org.eclipse.wst.command.internal.env.core.data.BeanModifier; + +public class JavaWSDLParamModifier implements BeanModifier { + + public void modify(Object bean, Object propertyHolder) + { + JavaWSDLParameter javaWSDLParam; + if (bean != null) + { + javaWSDLParam = (JavaWSDLParameter)bean; + } + else + { + javaWSDLParam = new JavaWSDLParameter(); + } + + //look for each known key in the map & if there, convert the properties and set on javaWSDLParam + if (propertyHolder instanceof Map) + { + Map propertyMap = (Map)propertyHolder; + + if (propertyMap.containsKey("Use")) + { + javaWSDLParam.setUse((String)propertyMap.get("Use")); + } + if (propertyMap.containsKey("Style")) + { + javaWSDLParam.setStyle((String)propertyMap.get("Style")); + } + if (propertyMap.containsKey("JavaOutput")) + { + javaWSDLParam.setJavaOutput((String)propertyMap.get("JavaOutput")); + } + if (propertyMap.containsKey("Methods")) + { + //get Method list from the map + String methodList = (String)propertyMap.get("Methods"); + javaWSDLParam.setMethodString(methodList); + } + if (propertyMap.containsKey("Mappings")) + { + //get name of the file that has the mappings in it from the map + String filename = (String)propertyMap.get("Mappings"); + //get the list of mapping from the file + HashMap mappings = readMappingsFromFile(filename); + javaWSDLParam.setMappings(mappings); + } + } + } + + private HashMap readMappingsFromFile(String filename) + { + HashMap hashmap = new HashMap(); + IResource resource = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(filename)); + + if (resource != null && resource instanceof IFile) + { + try + { + Properties props = new Properties(); + props.load(((IFile)resource).getContents()); + hashmap.putAll(props); + } + catch (Exception e) + { + // TODO Report some error here. + } + } + return hashmap; + } +} diff --git a/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/common/JavaWSDLParameter.java b/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/common/JavaWSDLParameter.java index c3da781b3..3ee34ecdb 100644 --- a/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/common/JavaWSDLParameter.java +++ b/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/common/JavaWSDLParameter.java @@ -40,6 +40,8 @@ public class JavaWSDLParameter { // The input location of the WSDL file private String urlLocation = null; // The URL location of the web service private Hashtable methods = null; // The array of method names + private String methodString_ = ""; //$NON-NLS-1$ + //The string representation of the method array private String style = null; // The style (RPC | DOCUMENT | WRAPPED) attribute for the generated WSDL private String use = null; @@ -124,23 +126,33 @@ public class JavaWSDLParameter { * @return String */ public String getMethodString() { - String methodString = ""; //$NON-NLS-1$ - Enumeration e = methods.keys(); - for (int i=0; e.hasMoreElements(); i++) - { - - String signature = (String) e.nextElement(); - if (((Boolean) methods.get(signature)).booleanValue()){ - int index = signature.indexOf('('); - String name = signature.substring(0, index); - methodString += name; - } - if (i != methods.size() -1) // this is not the last array item - { - methodString += ","; + if (methodString_.equals("")) + { + Enumeration e = methods.keys(); + for (int i=0; e.hasMoreElements(); i++) + { + + String signature = (String) e.nextElement(); + if (((Boolean) methods.get(signature)).booleanValue()){ + int index = signature.indexOf('('); + String name = signature.substring(0, index); + methodString_ += name; + } + if (i != methods.size() -1) // this is not the last array item + { + methodString_ += ","; + } } } - return methodString; + return methodString_; + } + + /** + * Sets a comma separated string of methods * + */ + public void setMethodString(String methods) + { + methodString_ = methods; } /** diff --git a/bundles/org.eclipse.jst.ws.axis.consumption.ui/plugin.xml b/bundles/org.eclipse.jst.ws.axis.consumption.ui/plugin.xml index 197c57ee1..0c12e44ca 100644 --- a/bundles/org.eclipse.jst.ws.axis.consumption.ui/plugin.xml +++ b/bundles/org.eclipse.jst.ws.axis.consumption.ui/plugin.xml @@ -21,5 +21,54 @@ insertBeforeCommandId="org.eclipse.jst.ws.internal.axis.consumption.ui.task.DefaultsForHTTPBasicAuthCommand" class="org.eclipse.jst.ws.internal.axis.consumption.ui.wsrt.AxisClientConfigWidgetFactory"/> </extension> + <extension + point="org.eclipse.wst.command.env.antDataMapping"> + <map + key="ClientProject" + operation="org.eclipse.jst.ws.internal.axis.consumption.ui.command.AxisClientDefaultingCommand" + property="ClientProject" + transform="org.eclipse.jst.ws.internal.common.String2IProjectTransformer"/> + <map + key="WsdlURL" + operation="org.eclipse.jst.ws.internal.axis.consumption.ui.command.AxisClientDefaultingCommand" + property="WsdlURL"/> + <map + key="ClientServer" + operation="org.eclipse.jst.ws.internal.axis.consumption.ui.command.AxisClientDefaultingCommand" + property="ClientServer"/> + <map + key="GenerateProxy" + operation="org.eclipse.jst.ws.internal.axis.consumption.ui.command.AxisClientDefaultingCommand" + property="GenerateProxy"/> + <map + key="CustomizeClientMappings" + operation="org.eclipse.jst.ws.internal.axis.consumption.ui.command.AxisClientDefaultingCommand" + property="CustomizeClientMappings"/> + + <map + key="IsClientScenario" + operation="org.eclipse.jst.ws.internal.axis.consumption.ui.command.AxisClientDefaultingCommand" + property="IsClientScenario"/> + <map + key="Mappings" + operation="org.eclipse.jst.ws.internal.axis.consumption.ui.task.DefaultsForHTTPBasicAuthCommand" + property="JavaWSDLParam" + transform="org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParamModifier"/> + <map + key="Mappings" + operation="org.eclipse.jst.ws.internal.axis.consumption.ui.command.DefaultsForClientJavaWSDLCommand" + property="JavaWSDLParam" + transform="org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParamModifier"/> + <map + key="Mappings" + operation="org.eclipse.jst.ws.internal.axis.consumption.core.command.WSDL2JavaCommand" + property="JavaWSDLParam" + transform="org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParamModifier"/> + <map + key="Mappings" + operation="org.eclipse.jst.ws.internal.axis.consumption.ui.task.Stub2BeanCommand" + property="JavaWSDLParam" + transform="org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParamModifier"/> + </extension> </plugin>
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.jst.ws.axis.creation.ui/META-INF/MANIFEST.MF index 0aa4eacd3..f6393f3f9 100644 --- a/bundles/org.eclipse.jst.ws.axis.creation.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.jst.ws.axis.creation.ui/META-INF/MANIFEST.MF @@ -10,6 +10,8 @@ Export-Package: org.eclipse.jst.ws.internal.axis.creation.ui, org.eclipse.jst.ws.internal.axis.creation.ui.command, org.eclipse.jst.ws.internal.axis.creation.ui.plugin, org.eclipse.jst.ws.internal.axis.creation.ui.task, + org.eclipse.jst.ws.internal.axis.creation.ui.widgets.bean, + org.eclipse.jst.ws.internal.axis.creation.ui.widgets.skeleton, org.eclipse.jst.ws.internal.axis.creation.ui.wizard.beans, org.eclipse.jst.ws.internal.axis.creation.ui.wizard.wsdl, org.eclipse.jst.ws.internal.axis.creation.ui.wsrt diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/plugin.xml b/bundles/org.eclipse.jst.ws.axis.creation.ui/plugin.xml index bd5f93ae3..24a7c2bea 100644 --- a/bundles/org.eclipse.jst.ws.axis.creation.ui/plugin.xml +++ b/bundles/org.eclipse.jst.ws.axis.creation.ui/plugin.xml @@ -74,5 +74,72 @@ </clientRuntime> </extension> + + <extension + point="org.eclipse.wst.command.env.antDataMapping"> + <map + key="ObjectSelection" + operation="org.eclipse.jst.ws.internal.axis.creation.ui.task.DefaultsForServerJavaWSDLCommand" + property="ObjectSelection" + transform="org.eclipse.wst.command.env.ant.String2SelectionTransformer"/> + <map + key="ShowMapping" + operation="org.eclipse.jst.ws.internal.axis.consumption.ui.widgets.AxisMappingsFragment" + property="ShowMapping"/> + + <map + key="JavaOutput" + operation="org.eclipse.jst.ws.internal.axis.consumption.core.command.Java2WSDLCommand" + property="JavaWSDLParam" + transform="org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParamModifier"/> + <map + key="Mappings" + operation="org.eclipse.jst.ws.internal.axis.consumption.core.command.Java2WSDLCommand" + property="JavaWSDLParam" + transform="org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParamModifier"/> + <map + key="Methods" + operation="org.eclipse.jst.ws.internal.axis.consumption.core.command.Java2WSDLCommand" + property="JavaWSDLParam" + transform="org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParamModifier"/> + <map + key="Style" + operation="org.eclipse.jst.ws.internal.axis.consumption.core.command.Java2WSDLCommand" + property="JavaWSDLParam" + transform="org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParamModifier"/> + <map + key="Use" + operation="org.eclipse.jst.ws.internal.axis.consumption.core.command.Java2WSDLCommand" + property="JavaWSDLParam" + transform="org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParamModifier"/> + + <map + key="JavaOutput" + operation="org.eclipse.jst.ws.internal.axis.consumption.core.command.WSDL2JavaCommand" + property="JavaWSDLParam" + transform="org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParamModifier"/> + <map + key="Mappings" + operation="org.eclipse.jst.ws.internal.axis.consumption.core.command.WSDL2JavaCommand" + property="JavaWSDLParam" + transform="org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParamModifier"/> + <map + key="Methods" + operation="org.eclipse.jst.ws.internal.axis.consumption.core.command.WSDL2JavaCommand" + property="JavaWSDLParam" + transform="org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParamModifier"/> + <map + key="Style" + operation="org.eclipse.jst.ws.internal.axis.consumption.core.command.WSDL2JavaCommand" + property="JavaWSDLParam" + transform="org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParamModifier"/> + <map + key="Use" + operation="org.eclipse.jst.ws.internal.axis.consumption.core.command.WSDL2JavaCommand" + property="JavaWSDLParam" + transform="org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParamModifier"/> + + + </extension> </plugin>
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.jst.ws.consumption.ui/META-INF/MANIFEST.MF index bec3e9b5d..55616b3a2 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.jst.ws.consumption.ui/META-INF/MANIFEST.MF @@ -8,6 +8,7 @@ Bundle-Vendor: %PLUGIN_PROVIDER Bundle-Localization: plugin Export-Package: org.eclipse.jst.ws.internal.consumption.ui, org.eclipse.jst.ws.internal.consumption.ui.action, + org.eclipse.jst.ws.internal.consumption.ui.ant, org.eclipse.jst.ws.internal.consumption.ui.command, org.eclipse.jst.ws.internal.consumption.ui.command.data, org.eclipse.jst.ws.internal.consumption.ui.common, @@ -15,6 +16,7 @@ Export-Package: org.eclipse.jst.ws.internal.consumption.ui, org.eclipse.jst.ws.internal.consumption.ui.plugin, org.eclipse.jst.ws.internal.consumption.ui.preferences, org.eclipse.jst.ws.internal.consumption.ui.selection, + org.eclipse.jst.ws.internal.consumption.ui.server, org.eclipse.jst.ws.internal.consumption.ui.widgets, org.eclipse.jst.ws.internal.consumption.ui.widgets.binding, org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions, @@ -26,8 +28,7 @@ Export-Package: org.eclipse.jst.ws.internal.consumption.ui, org.eclipse.jst.ws.internal.consumption.ui.wizard, org.eclipse.jst.ws.internal.consumption.ui.wizard.uddi, org.eclipse.jst.ws.internal.consumption.ui.wsil, - org.eclipse.jst.ws.internal.consumption.ui.wsrt, - org.eclipse.jst.ws.internal.consumption.ui.server + org.eclipse.jst.ws.internal.consumption.ui.wsrt Require-Bundle: org.eclipse.wst.ws.parser, org.eclipse.wst.command.env, org.eclipse.wst.command.env.ui, diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/plugin.xml b/bundles/org.eclipse.jst.ws.consumption.ui/plugin.xml index e24fa0975..cf8bc5c49 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/plugin.xml +++ b/bundles/org.eclipse.jst.ws.consumption.ui/plugin.xml @@ -709,6 +709,164 @@ id="StartClientServer" insertBeforeCommandId="org.eclipse.jst.ws.internal.consumption.ui.extension.PreClientRunCommand" class="org.eclipse.jst.ws.internal.consumption.ui.server.StartClientWidgetFactory"/> - </extension> - + </extension> + + <extension point="org.eclipse.wst.command.env.antScenario"> + <antScenario + class="org.eclipse.jst.ws.internal.consumption.ui.ant.AntClientRootCommandFragment" + scenarioType="client"/> + </extension> + + <extension + point="org.eclipse.wst.command.env.antDataMapping"> + <map + key="InitialSelection" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime.ClientRuntimeSelectionWidgetDefaultingCommand" + property="InitialInitialSelection" + transform="org.eclipse.wst.command.env.ant.String2SelectionTransformer"/> + <map + key="InitialSelection" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.WSDLSelectionWidgetDefaultingCommand" + property="InitialSelection" + transform="org.eclipse.wst.command.env.ant.String2SelectionTransformer"/> + + <map + key="Client.RuntimeId" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.ClientWizardWidgetOutputCommand" + property="ClientTypeRuntimeServer" + transform="org.eclipse.jst.ws.internal.common.String2TypeRuntimeServerModifier"/> + + <map + key="Client.ServerId" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.ClientWizardWidgetOutputCommand" + property="ClientTypeRuntimeServer" + transform="org.eclipse.jst.ws.internal.common.String2TypeRuntimeServerModifier"/> + + <map + key="Client.TypeId" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.ClientWizardWidgetOutputCommand" + property="ClientTypeRuntimeServer" + transform="org.eclipse.jst.ws.internal.common.String2TypeRuntimeServerModifier"/> + <map + key="TestService" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ClientExtensionDefaultingCommand" + property="TestService"/> + + <map + key="MonitorService" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ClientExtensionDefaultingCommand" + property="MonitorService"/> + + <map + key="Client.RuntimeId" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ClientExtensionDefaultingCommand" + property="ClientTypeRuntimeServer" + transform="org.eclipse.jst.ws.internal.common.String2TypeRuntimeServerModifier"/> + <map + key="Client.ServerId" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ClientExtensionDefaultingCommand" + property="ClientTypeRuntimeServer" + transform="org.eclipse.jst.ws.internal.common.String2TypeRuntimeServerModifier"/> + <map + key="Client.TypeId" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ClientExtensionDefaultingCommand" + property="ClientTypeRuntimeServer" + transform="org.eclipse.jst.ws.internal.common.String2TypeRuntimeServerModifier"/> + <map + key="ClientProjectName" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ClientExtensionDefaultingCommand" + property="ClientProjectName"/> + <map + key="ClientEarProjectName" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ClientExtensionDefaultingCommand" + property="ClientEarProjectName"/> + <map + key="ClientComponentType" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ClientExtensionDefaultingCommand" + property="ClientComponentType"/> + <map + key="ClientNeedEAR" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ClientExtensionDefaultingCommand" + property="ClientNeedEAR"/> + <map + key="Client.RuntimeId" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ClientExtensionFragment" + property="ClientTypeRuntimeServer" + transform="org.eclipse.jst.ws.internal.common.String2TypeRuntimeServerModifier"/> + <map + key="Client.ServerId" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ClientExtensionFragment" + property="ClientTypeRuntimeServer" + transform="org.eclipse.jst.ws.internal.common.String2TypeRuntimeServerModifier"/> + <map + key="Client.TypeId" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ClientExtensionFragment" + property="ClientTypeRuntimeServer" + transform="org.eclipse.jst.ws.internal.common.String2TypeRuntimeServerModifier"/> + <map + key="TestFacility" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.test.ClientTestDelegateCommand" + property="TestFacility" + transform="org.eclipse.jst.ws.internal.common.String2TestFacilityListTransformer"/> + <map + key="Folder" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.test.ClientTestDelegateCommand" + property="Folder"/> + <map + key="JspFolder" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.test.ClientTestDelegateCommand" + property="JspFolder"/> + <map + key="RunClientTest" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.test.ClientTestDelegateCommand" + property="RunClientTest"/> + <map + key="WsdlURI" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.WSDLSelectionOutputCommand" + property="WsdlURI"/> + <map + key="ComponentName" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.WSDLSelectionOutputCommand" + property="ComponentName"/> + <map + key="Project" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.WSDLSelectionOutputCommand" + property="Project" + transform="org.eclipse.jst.ws.internal.common.String2IProjectTransformer"/> + <map + key="TestService" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.test.FinishTestFragment" + property="TestService"/> + <map + key="TestID" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.test.FinishTestFragment" + property="TestID"/> + <map + key="IsTestWidget" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.test.FinishTestFragment" + property="IsTestWidget"/> + + <map + key="WsRefsToHandlers" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.ClientHandlersWidgetOutputCommand" + property="HandlersTable" + transform="org.eclipse.wst.command.env.ant.String2HandlerTableTransformer"/> + + <map + key="SourceOutputLocation" + operation="org.eclipse.jst.ws.internal.consumption.ui.command.GenerateHandlerSkeletonCommand" + property="OutputLocation" + transform="org.eclipse.wst.command.env.ant.String2PathTransformer"/> + + <map + key="HandlerClassNames" + operation="org.eclipse.jst.ws.internal.consumption.ui.command.GenerateHandlerSkeletonCommand" + property="HandlerNames" + transform="org.eclipse.wst.command.env.ant.String2HandlerArrayTransformer"/> + + <map + key="GenSkeletonEnabled" + operation="org.eclipse.jst.ws.internal.consumption.ui.command.GenerateHandlerSkeletonCommand" + property="GenSkeletonEnabled"/> + </extension> </plugin> diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ant/AntClientRootCommandFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ant/AntClientRootCommandFragment.java new file mode 100644 index 000000000..8b5659739 --- /dev/null +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ant/AntClientRootCommandFragment.java @@ -0,0 +1,230 @@ +/******************************************************************************* + * Copyright (c) 2005 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.ws.internal.consumption.ui.ant; + +import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; +import org.eclipse.jst.ws.internal.consumption.command.common.GetMonitorCommand; +import org.eclipse.jst.ws.internal.consumption.common.ScenarioCleanupCommand; +import org.eclipse.jst.ws.internal.consumption.ui.command.CheckForServiceProjectCommand; +import org.eclipse.jst.ws.internal.consumption.ui.command.data.EclipseIPath2URLStringTransformer; +import org.eclipse.jst.ws.internal.consumption.ui.common.FinishFragment; +import org.eclipse.jst.ws.internal.consumption.ui.extension.ClientRootFragment; +import org.eclipse.jst.ws.internal.consumption.ui.extension.PreClientDevelopCommand; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.CheckWSDLValidationCommand; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.ClientWizardWidgetDefaultingCommand; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.ClientWizardWidgetOutputCommand; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.WSDLSelectionOutputCommand; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.WSDLSelectionWidgetDefaultingCommand; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ClientExtensionDefaultingCommand; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ClientExtensionFragment; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ClientExtensionOutputCommand; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime.ClientRuntimeSelectionWidgetDefaultingCommand; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.ClientTestDelegateCommand; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.ClientTestFragment; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.FinishDefaultCommand; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.FinishTestFragment; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.TestDefaultingFragment; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.WebServiceClientTestArrivalCommand; +import org.eclipse.wst.command.internal.env.core.fragment.SimpleFragment; +import org.eclipse.wst.command.internal.env.core.data.DataMappingRegistry; +import org.eclipse.wst.ws.internal.extensions.AssembleClientFragment; +import org.eclipse.wst.ws.internal.extensions.DeployClientFragment; +import org.eclipse.wst.ws.internal.extensions.DevelopClientFragment; +import org.eclipse.wst.ws.internal.extensions.InstallClientFragment; +import org.eclipse.wst.ws.internal.extensions.RunClientFragment; + +public class AntClientRootCommandFragment extends SequenceFragment{ + + + boolean genProxy_ = false; + + public AntClientRootCommandFragment() + { + + add( new SimpleFragment( new ScenarioCleanupCommand(), "" )); + + add( new SimpleFragment( new ClientWizardWidgetDefaultingCommand(), "" ) ); + add( new SimpleFragment( new ClientWizardWidgetOutputCommand(), "" )); + add( new SimpleFragment( new WSDLSelectionWidgetDefaultingCommand(), "")); + + add( new SimpleFragment( new WSDLSelectionOutputCommand(), "")); + add( new SimpleFragment( new CheckWSDLValidationCommand(), "")); + add( new SimpleFragment( new ClientRuntimeSelectionWidgetDefaultingCommand(), "")); + + add( new SimpleFragment( new ClientExtensionDefaultingCommand( true ), "")); + add( new ClientRootFragment() ); + add( new SimpleFragment( new ClientExtensionOutputCommand(), "" ) ); + + add( new SimpleFragment(new GetMonitorCommand(), "")); + add( new SimpleFragment(new TestDefaultingFragment(),"")); + add( new ClientTestFragment( "ClientTestWidget") ); + add(new FinishFragment()); + + add( new SimpleFragment( new ScenarioCleanupCommand(), "" )); + + } + + /* (non-Javadoc) + * @see org.eclipse.wst.command.internal.env.core.fragment.CommandFragment#registerDataMappings(org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry) + */ + public void registerDataMappings(DataMappingRegistry dataRegistry) + { + // Map ClientWizardWidgetDefaultingCommand command. + dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "ClientTypeRuntimeServer", ClientWizardWidgetOutputCommand.class); + dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "TestService", ClientWizardWidgetOutputCommand.class); + dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "MonitorService", ClientWizardWidgetOutputCommand.class); + dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "ResourceContext", ClientWizardWidgetOutputCommand.class); + + // Map ClientWizardWidgetOutputCommand command. + dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "ClientTypeRuntimeServer", ClientRuntimeSelectionWidgetDefaultingCommand.class); + dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "TestService", WSDLSelectionOutputCommand.class); + dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "TestService", ClientExtensionDefaultingCommand.class); + dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "TestService", ClientRuntimeSelectionWidgetDefaultingCommand.class); + dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "ResourceContext", ClientRuntimeSelectionWidgetDefaultingCommand.class); + dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "ResourceContext", ClientExtensionDefaultingCommand.class); + dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "MonitorService", GetMonitorCommand.class); + + // Map ClientRuntimeSelectionWidgetDefaultingCommand command + dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientTypeRuntimeServer", ClientExtensionDefaultingCommand.class); + dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientRuntimeId", ClientExtensionDefaultingCommand.class); + dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "Runtime2ClientTypes", ClientExtensionDefaultingCommand.class); + dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientProjectName", ClientExtensionDefaultingCommand.class); + dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", ClientExtensionDefaultingCommand.class); + dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarComponentName", ClientExtensionDefaultingCommand.class); + dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentName", ClientExtensionDefaultingCommand.class); + dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentType", ClientExtensionDefaultingCommand.class); + dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientJ2EEVersion", ClientExtensionDefaultingCommand.class); + dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientNeedEAR", ClientExtensionDefaultingCommand.class); + dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "Runtime2ClientTypes", CheckForServiceProjectCommand.class); + + // Map WSDLSelectionWidgetDefaultingCommand command. + dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "GenWSIL", ClientExtensionDefaultingCommand.class); + dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "WsilURI", ClientExtensionDefaultingCommand.class); + dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "WebServiceURI", WSDLSelectionOutputCommand.class, "WsdlURI", new EclipseIPath2URLStringTransformer()); + dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "Project", WSDLSelectionOutputCommand.class); + dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "ComponentName", WSDLSelectionOutputCommand.class); + + // WSDLSelectionOutputCommand + dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WsdlURI", ClientExtensionDefaultingCommand.class); + dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WebServicesParser", ClientExtensionDefaultingCommand.class); + dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WsdlURI", GetMonitorCommand.class); + dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WebServicesParser", GetMonitorCommand.class); + dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "Project", ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientInitialProject", null); + dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WsdlURI", ClientRuntimeSelectionWidgetDefaultingCommand.class); + dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "ComponentName", ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientInitialComponentName", null); + dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WebServicesParser", ClientRuntimeSelectionWidgetDefaultingCommand.class); + dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WsdlURI", CheckForServiceProjectCommand.class); + dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WebServicesParser", CheckForServiceProjectCommand.class); + + // Setup the PreClientDevelopCommand. + dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientRuntimeId", PreClientDevelopCommand.class ); + dataRegistry.addMapping( ClientWizardWidgetOutputCommand.class, "TestService", PreClientDevelopCommand.class); + dataRegistry.addMapping( ClientWizardWidgetOutputCommand.class, "ResourceContext", PreClientDevelopCommand.class); + dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientTypeRuntimeServer", PreClientDevelopCommand.class ); + dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientJ2EEVersion", PreClientDevelopCommand.class); + dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientProject", PreClientDevelopCommand.class, "Module", null ); + dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientProjectType", PreClientDevelopCommand.class, "ModuleType", null); + dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientProjectEAR", PreClientDevelopCommand.class, "Ear", null ); + dataRegistry.addMapping( ClientWizardWidgetOutputCommand.class, "ResourceContext", PreClientDevelopCommand.class); + dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "WsdlURI", PreClientDevelopCommand.class ); + + dataRegistry.addMapping( PreClientDevelopCommand.class, "WebService", ClientExtensionOutputCommand.class, "WebServiceClient", null ); + + // Map ClientExtensionDefaultingCommand command. + dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientTypeRuntimeServer", ClientExtensionFragment.class); + + dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProjectEAR", WebServiceClientTestArrivalCommand.class); + dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProject", WebServiceClientTestArrivalCommand.class); + + dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "GenerateProxy", ClientTestFragment.class); + dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "TestService", ClientTestFragment.class ); + + dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientNeedEAR", ClientTestDelegateCommand.class); + dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientEarProjectName", ClientTestDelegateCommand.class); + dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientEarComponentName", ClientTestDelegateCommand.class); + dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProject",ClientTestDelegateCommand.class); + dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientTypeRuntimeServer", ClientTestDelegateCommand.class); + dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientServer", ClientTestDelegateCommand.class); + dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "WsdlURI", ClientTestDelegateCommand.class); + + // Map ClientExtensionOutputCommand command. + dataRegistry.addMapping(ClientExtensionOutputCommand.class, "ProxyBean", WebServiceClientTestArrivalCommand.class); + dataRegistry.addMapping(ClientExtensionOutputCommand.class, "ProxyBean", ClientTestDelegateCommand.class); + dataRegistry.addMapping(ClientExtensionOutputCommand.class, "GenerateProxy", ClientTestFragment.class); + dataRegistry.addMapping(ClientExtensionOutputCommand.class, "GenerateProxy", FinishTestFragment.class); + dataRegistry.addMapping(ClientExtensionOutputCommand.class, "GenerateProxy", ClientTestDelegateCommand.class); + dataRegistry.addMapping(ClientExtensionOutputCommand.class, "SetEndpointMethod", ClientTestDelegateCommand.class); + dataRegistry.addMapping(ClientExtensionOutputCommand.class, "ServerInstanceId", FinishDefaultCommand.class); + + // GetMonitorCommand + dataRegistry.addMapping(GetMonitorCommand.class, "Endpoints", ClientTestDelegateCommand.class); + + // MAP post server config call + dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProjectEAR", ClientExtensionOutputCommand.class, "EarProjectName", null); + dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientServerInstance", ClientExtensionOutputCommand.class, "ExistingServerId", null); + + // Map WebServiceClientTestArrivalCommand command. + dataRegistry.addMapping(TestDefaultingFragment.class, "TestFacility",ClientTestDelegateCommand.class); + dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "TestFacility",ClientTestDelegateCommand.class); + dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "Folder",ClientTestDelegateCommand.class); + dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "JspFolder",ClientTestDelegateCommand.class); + dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "RunClientTest",ClientTestDelegateCommand.class); + dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "Methods",ClientTestDelegateCommand.class); + dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "SampleProject",ClientTestDelegateCommand.class); + dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "SampleProjectEAR",ClientTestDelegateCommand.class); + + //Mappings to enable peek-ahead for Page 3 of the client wizard + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "WebService", DevelopClientFragment.class ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Environment", DevelopClientFragment.class ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Context", DevelopClientFragment.class ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Selection", DevelopClientFragment.class ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientProjectName", DevelopClientFragment.class, "Project", null ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentName", DevelopClientFragment.class, "Module", null ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", DevelopClientFragment.class, "EarProject", null ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarComponentName", DevelopClientFragment.class, "Ear", null ); + + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "WebService", AssembleClientFragment.class ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Environment", AssembleClientFragment.class ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Context", AssembleClientFragment.class ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Selection", AssembleClientFragment.class ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientProjectName", AssembleClientFragment.class, "Project", null ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentName", AssembleClientFragment.class, "Module", null ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", AssembleClientFragment.class, "EarProject", null ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarComponentName", AssembleClientFragment.class, "Ear", null ); + + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "WebService", DeployClientFragment.class ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Environment", DeployClientFragment.class ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Context", DeployClientFragment.class ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Selection", DeployClientFragment.class ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientProjectName", DeployClientFragment.class, "Project", null ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentName", DeployClientFragment.class, "Module", null ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", DeployClientFragment.class, "EarProject", null ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarComponentName", DeployClientFragment.class, "Ear", null ); + + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "WebService", InstallClientFragment.class ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Environment", InstallClientFragment.class ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Context", InstallClientFragment.class ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Selection", InstallClientFragment.class ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientProjectName", InstallClientFragment.class, "Project", null ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentName", InstallClientFragment.class, "Module", null ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", InstallClientFragment.class, "EarProject", null ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarComponentName", InstallClientFragment.class, "Ear", null ); + + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "WebService", RunClientFragment.class ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Environment", RunClientFragment.class ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Context", RunClientFragment.class ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Selection", RunClientFragment.class ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientProjectName", RunClientFragment.class, "Project", null ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentName", RunClientFragment.class, "Module", null ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", RunClientFragment.class, "EarProject", null ); + dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarComponentName", RunClientFragment.class, "Ear", null ); + } +} diff --git a/bundles/org.eclipse.jst.ws.creation.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.jst.ws.creation.ui/META-INF/MANIFEST.MF index c41ddf898..ce1ce5ea6 100644 --- a/bundles/org.eclipse.jst.ws.creation.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.jst.ws.creation.ui/META-INF/MANIFEST.MF @@ -7,6 +7,7 @@ Bundle-Activator: org.eclipse.jst.ws.internal.creation.ui.plugin.WebServiceCreat Bundle-Vendor: %PLUGIN_PROVIDER Bundle-Localization: plugin Export-Package: org.eclipse.jst.ws.internal.creation.ui, + org.eclipse.jst.ws.internal.creation.ui.ant, org.eclipse.jst.ws.internal.creation.ui.extension, org.eclipse.jst.ws.internal.creation.ui.plugin, org.eclipse.jst.ws.internal.creation.ui.preferences, diff --git a/bundles/org.eclipse.jst.ws.creation.ui/plugin.xml b/bundles/org.eclipse.jst.ws.creation.ui/plugin.xml index 99bdf0177..09bc8921f 100644 --- a/bundles/org.eclipse.jst.ws.creation.ui/plugin.xml +++ b/bundles/org.eclipse.jst.ws.creation.ui/plugin.xml @@ -241,5 +241,189 @@ insertBeforeCommandId="org.eclipse.jst.ws.internal.creation.ui.extension.PreServiceRunCommand" class="org.eclipse.jst.ws.internal.creation.ui.server.StartServerWidgetFactory"/> </extension> + + <extension point="org.eclipse.wst.command.env.antScenario"> + <antScenario + class="org.eclipse.jst.ws.internal.creation.ui.ant.AntServiceRootCommandFragment" + scenarioType="service"/> + </extension> + + <extension + point="org.eclipse.wst.command.env.antDataMapping"> + <map + key="InitialSelection" + operation="org.eclipse.jst.ws.internal.creation.ui.widgets.ServerWizardWidgetDefaultingCommand" + property="InitialSelection" + transform="org.eclipse.wst.command.env.ant.String2SelectionTransformer"/> + <map + key="InitialSelection" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.object.ObjectSelectionOutputCommand" + property="ObjectSelection" + transform="org.eclipse.wst.command.env.ant.String2SelectionTransformer"/> + <map + key="Project" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.object.ObjectSelectionOutputCommand" + property="Project" + transform="org.eclipse.jst.ws.internal.common.String2IProjectTransformer"/> + <map + key="ComponentName" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.object.ObjectSelectionOutputCommand" + property="ComponentName"/> + <map + key="Service.RuntimeId" + operation="org.eclipse.jst.ws.internal.creation.ui.widgets.ServerWizardWidgetOutputCommand" + property="ServiceTypeRuntimeServer" + transform="org.eclipse.jst.ws.internal.common.String2TypeRuntimeServerModifier"/> + <map + key="Service.ServerId" + operation="org.eclipse.jst.ws.internal.creation.ui.widgets.ServerWizardWidgetOutputCommand" + property="ServiceTypeRuntimeServer" + transform="org.eclipse.jst.ws.internal.common.String2TypeRuntimeServerModifier"/> + <map + key="Service.TypeId" + operation="org.eclipse.jst.ws.internal.creation.ui.widgets.ServerWizardWidgetOutputCommand" + property="ServiceTypeRuntimeServer" + transform="org.eclipse.jst.ws.internal.common.String2TypeRuntimeServerModifier"/> + <map + key="StartService" + operation="org.eclipse.jst.ws.internal.creation.ui.widgets.ServerWizardWidgetOutputCommand" + property="StartService"/> + <map + key="TestService" + operation="org.eclipse.jst.ws.internal.creation.ui.widgets.ServerWizardWidgetOutputCommand" + property="TestService"/> + <map + key="PublishService" + operation="org.eclipse.jst.ws.internal.creation.ui.widgets.ServerWizardWidgetOutputCommand" + property="PublishService"/> + <map + key="GenerateProxy" + operation="org.eclipse.jst.ws.internal.creation.ui.widgets.ServerWizardWidgetOutputCommand" + property="GenerateProxy"/> + <map + key="MonitorService" + operation="org.eclipse.jst.ws.internal.consumption.command.common.CreateMonitorCommand" + property="MonitorService"/> + + <map + key="MonitorService" + operation="org.eclipse.jst.ws.internal.consumption.command.common.ComputeEndpointCommand" + property="MonitorService"/> + <map + key="Service.RuntimeId" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ServerExtensionDefaultingCommand" + property="ServiceTypeRuntimeServer" + transform="org.eclipse.jst.ws.internal.common.String2TypeRuntimeServerModifier"/> + <map + key="Service.ServerId" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ServerExtensionDefaultingCommand" + property="ServiceTypeRuntimeServer" + transform="org.eclipse.jst.ws.internal.common.String2TypeRuntimeServerModifier"/> + <map + key="Service.TypeId" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ServerExtensionDefaultingCommand" + property="ServiceTypeRuntimeServer" + transform="org.eclipse.jst.ws.internal.common.String2TypeRuntimeServerModifier"/> + <map + key="ServiceJ2EEVersion" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ServerExtensionDefaultingCommand" + property="ServiceJ2EEVersion"/> + + <map + key="ServiceProjectName" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ServerExtensionDefaultingCommand" + property="ServiceProjectName"/> + + <map + key="ServiceComponentName" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ServerExtensionDefaultingCommand" + property="ServiceComponentName"/> + + <map + key="ServiceEarProjectName" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ServerExtensionDefaultingCommand" + property="ServiceEarProjectName"/> + + <map + key="ServiceEarComponentName" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ServerExtensionDefaultingCommand" + property="ServiceEarComponentName"/> + + <map + key="ServiceNeedEAR" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ServerExtensionDefaultingCommand" + property="ServiceNeedEAR"/> + <map + key="Service.RuntimeId" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ServerExtensionFragment" + property="ServiceTypeRuntimeServer" + transform="org.eclipse.jst.ws.internal.common.String2TypeRuntimeServerModifier"/> + <map + key="Service.ServerId" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ServerExtensionFragment" + property="ServiceTypeRuntimeServer" + transform="org.eclipse.jst.ws.internal.common.String2TypeRuntimeServerModifier"/> + <map + key="Service.TypeId" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ServerExtensionFragment" + property="ServiceTypeRuntimeServer" + transform="org.eclipse.jst.ws.internal.common.String2TypeRuntimeServerModifier"/> + <map + key="LaunchedServiceTestName" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.test.FinishTestFragment" + property="LaunchedServiceTestName"/> + + <map + key="LaunchedServiceTestName" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.test.TestDefaultingFragment" + property="LaunchedServiceTestName"/> + + <map + key="TestService" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.test.FinishTestFragment" + property="TestService"/> + <map + key="TestID" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.test.FinishTestFragment" + property="TestID"/> + <map + key="PublishToPrivateUDDI" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.PublishToPrivateUDDICommandFragment" + property="PublishToPrivateUDDI"/> + + <map + key="PublishToPrivateUDDI" + operation="org.eclipse.jst.ws.internal.creation.ui.widgets.test.LaunchFragment.LaunchFragment" + property="PublishToPrivateUDDI"/> + <map + key="PublishToPublicUDDI" + operation="org.eclipse.jst.ws.internal.creation.ui.widgets.test.LaunchFragment.LaunchFragment" + property="PublishToPublicUDDI"/> + +<!--complex type. pointer to a file that can be processed by a command....--> + <map + key="WsDescToHandlers" + operation="org.eclipse.jst.ws.internal.consumption.ui.widgets.ServiceHandlersWidgetOutputCommand" + property="WsDescToHandlers" + transform="org.eclipse.wst.command.env.ant.String2HandlerTableTransformer"/> + + <map + key="SourceOutputLocation" + operation="org.eclipse.jst.ws.internal.consumption.ui.command.GenerateHandlerSkeletonCommand" + property="OutputLocation" + transform="org.eclipse.wst.command.env.ant.String2PathTransformer"/> + +<!--complex type. pointer to a file that can be processed by a command....--> + <map + key="HandlerClassNames" + operation="org.eclipse.jst.ws.internal.consumption.ui.command.GenerateHandlerSkeletonCommand" + property="HandlerNames" + transform="org.eclipse.wst.command.env.ant.String2HandlerArrayTransformer"/> + + <map + key="GenSkeletonEnabled" + operation="org.eclipse.jst.ws.internal.consumption.ui.command.GenerateHandlerSkeletonCommand" + property="GenSkeletonEnabled"/> + </extension> </plugin> diff --git a/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/ant/AntServiceRootCommandFragment.java b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/ant/AntServiceRootCommandFragment.java new file mode 100644 index 000000000..c52f0b45e --- /dev/null +++ b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/ant/AntServiceRootCommandFragment.java @@ -0,0 +1,167 @@ +/******************************************************************************* + * Copyright (c) 2005 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.ws.internal.creation.ui.ant; + +import org.eclipse.jst.ws.internal.common.StringToIProjectTransformer; +import org.eclipse.jst.ws.internal.consumption.command.common.ComputeEndpointCommand; +import org.eclipse.jst.ws.internal.consumption.command.common.CreateMonitorCommand; +import org.eclipse.jst.ws.internal.consumption.command.common.ManageServerStartUpCommand; +import org.eclipse.jst.ws.internal.consumption.common.ScenarioCleanupCommand; +import org.eclipse.jst.ws.internal.consumption.ui.common.FinishFragment; +import org.eclipse.jst.ws.internal.consumption.ui.selection.SelectionTransformer; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.CheckWSDLValidationCommand; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.PublishToPrivateUDDICommandFragment; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ServerExtensionDefaultingCommand; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ServerExtensionFragment; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ServerExtensionOutputCommand; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.ObjectSelectionFragment; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.ObjectSelectionOutputCommand; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.FinishTestFragment; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.TestDefaultingFragment; +import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.WSDLTestLaunchCommand; +import org.eclipse.jst.ws.internal.creation.ui.extension.PreServiceDevelopCommand; +import org.eclipse.jst.ws.internal.creation.ui.extension.ServiceRootFragment; +import org.eclipse.jst.ws.internal.creation.ui.widgets.ServerWizardWidgetDefaultingCommand; +import org.eclipse.jst.ws.internal.creation.ui.widgets.ServerWizardWidgetOutputCommand; +import org.eclipse.jst.ws.internal.creation.ui.widgets.runtime.ServerRuntimeSelectionWidgetDefaultingCommand; +import org.eclipse.jst.ws.internal.creation.ui.widgets.test.ServiceTestFragment; +import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; +import org.eclipse.wst.command.internal.env.core.fragment.SimpleFragment; +import org.eclipse.wst.command.internal.env.core.data.DataMappingRegistry; + +public class AntServiceRootCommandFragment extends SequenceFragment +{ + + private DataMappingRegistry dataMappingRegistry_; + private PublishToPrivateUDDICommandFragment publishToPrivateUDDICmdFrag; + + public AntServiceRootCommandFragment() + { + + add( new SimpleFragment( new ScenarioCleanupCommand(), "" )); //ok + add( new SimpleFragment( new ServerWizardWidgetDefaultingCommand(), "")); //somewhere to hold initial data/calc defaults + + add( new SimpleFragment( new ServerWizardWidgetOutputCommand(), "" )); //data holder + add( new ObjectSelectionFragment() ); //data holder + + add( new SimpleFragment( new CheckWSDLValidationCommand(), "")); //need? + + add( new SimpleFragment( new ServerRuntimeSelectionWidgetDefaultingCommand(), "")); + add( new SimpleFragment( new ServerExtensionDefaultingCommand(), "")); + + add( new ServiceRootFragment() ); //*** + + add( new SimpleFragment( new ServerExtensionOutputCommand(), "" )); + add(new SimpleFragment(new CreateMonitorCommand(), "")); //need? + add(new SimpleFragment(new ComputeEndpointCommand(), "")); + add( new ServiceTestFragment( "TestService") ); + add( new SimpleFragment(new TestDefaultingFragment(),"")); + add( new SimpleFragment( "Publish") ); + + publishToPrivateUDDICmdFrag = new PublishToPrivateUDDICommandFragment(); //need? + add(publishToPrivateUDDICmdFrag); + + //?? jvh - no class def found.... add(new LaunchFragment()); + + add(new FinishFragment()); + add( new SimpleFragment( new ScenarioCleanupCommand(), "" )); + } + + public void registerDataMappings(DataMappingRegistry dataRegistry) + { + publishToPrivateUDDICmdFrag.registerDataMappings(dataMappingRegistry_); + + dataRegistry.addMapping(ObjectSelectionOutputCommand.class, "ObjectSelection", ServerRuntimeSelectionWidgetDefaultingCommand.class, "InitialSelection", null); + dataRegistry.addMapping(ObjectSelectionOutputCommand.class, "ObjectSelection", ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientInitialSelection", null); + dataRegistry.addMapping(ObjectSelectionOutputCommand.class, "Project", ServerRuntimeSelectionWidgetDefaultingCommand.class, "InitialProject", null); + dataRegistry.addMapping(ObjectSelectionOutputCommand.class, "Project", ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientInitialProject", null); + dataRegistry.addMapping(ObjectSelectionOutputCommand.class, "ComponentName", ServerRuntimeSelectionWidgetDefaultingCommand.class, "InitialComponentName", null); + dataRegistry.addMapping(ObjectSelectionOutputCommand.class, "ComponentName", ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientInitialComponentName", null); + dataRegistry.addMapping(ObjectSelectionOutputCommand.class, "WebServicesParser", ServerExtensionDefaultingCommand.class ); + + dataRegistry.addMapping(ServerWizardWidgetDefaultingCommand.class, "ClientTypeRuntimeServer", ServerWizardWidgetOutputCommand.class); + dataRegistry.addMapping(ServerWizardWidgetDefaultingCommand.class, "ServiceTypeRuntimeServer", ServerWizardWidgetOutputCommand.class); + dataRegistry.addMapping(ServerWizardWidgetDefaultingCommand.class, "GenerateProxy", ServerWizardWidgetOutputCommand.class); + dataRegistry.addMapping(ServerWizardWidgetDefaultingCommand.class, "StartService", ServerWizardWidgetOutputCommand.class); + dataRegistry.addMapping(ServerWizardWidgetDefaultingCommand.class, "TestService", ServerWizardWidgetOutputCommand.class); + dataRegistry.addMapping(ServerWizardWidgetDefaultingCommand.class, "PublishService", ServerWizardWidgetOutputCommand.class); + dataRegistry.addMapping(ServerWizardWidgetDefaultingCommand.class, "GenerateProxy", ServerWizardWidgetOutputCommand.class); + dataRegistry.addMapping(ServerWizardWidgetDefaultingCommand.class, "ResourceContext", ServerWizardWidgetOutputCommand.class); + + // Map ServerWizardWidgetOutputCommand. + dataRegistry.addMapping(ServerWizardWidgetOutputCommand.class, "ServiceTypeRuntimeServer", ObjectSelectionFragment.class, "TypeRuntimeServer", null); + dataRegistry.addMapping(ServerWizardWidgetOutputCommand.class, "ClientTypeRuntimeServer", ServerRuntimeSelectionWidgetDefaultingCommand.class); + dataRegistry.addMapping(ServerWizardWidgetOutputCommand.class, "ServiceTypeRuntimeServer", ServerRuntimeSelectionWidgetDefaultingCommand.class); + dataRegistry.addMapping(ServerWizardWidgetOutputCommand.class, "StartService", ServerExtensionDefaultingCommand.class); + dataRegistry.addMapping(ServerWizardWidgetOutputCommand.class, "TestService", ServerExtensionDefaultingCommand.class); + dataRegistry.addMapping(ServerWizardWidgetOutputCommand.class, "PublishService", ServerExtensionDefaultingCommand.class); + dataRegistry.addMapping(ServerWizardWidgetOutputCommand.class, "GenerateProxy", ServerRuntimeSelectionWidgetDefaultingCommand.class); + + //to the test wizard + dataRegistry.addMapping(ServerWizardWidgetOutputCommand.class, "GenerateProxy", ServiceTestFragment.class); + dataRegistry.addMapping(ServerExtensionOutputCommand.class, "WsdlURI", WSDLTestLaunchCommand.class); + dataRegistry.addMapping(ServerExtensionDefaultingCommand.class, "ServerProject", WSDLTestLaunchCommand.class); + + // Map ServerRuntimeSelectionWidgetDefaultingCommand + dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceTypeRuntimeServer", ServerExtensionDefaultingCommand.class); + dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceProjectName", ServerExtensionDefaultingCommand.class); + dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceEarProjectName", ServerExtensionDefaultingCommand.class); + dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceComponentName", ServerExtensionDefaultingCommand.class); + dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceEarComponentName", ServerExtensionDefaultingCommand.class); + dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceJ2EEVersion", ServerExtensionDefaultingCommand.class); + dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceNeedEAR", ServerExtensionDefaultingCommand.class); + + // Map ServerExtensionDefaultingCommand + dataRegistry.addMapping(ServerExtensionDefaultingCommand.class, "ServiceTypeRuntimeServer", ServerExtensionFragment.class); + dataRegistry.addMapping(ServerExtensionDefaultingCommand.class, "TestService", ServiceTestFragment.class); + dataRegistry.addMapping(ServerExtensionDefaultingCommand.class, "Publish", PublishToPrivateUDDICommandFragment.class); + dataRegistry.addMapping(ServerExtensionDefaultingCommand.class, "ServiceTypeRuntimeServer",WSDLTestLaunchCommand.class); + + // Setup the PreServiceDevelopCommand. + dataRegistry.addMapping( ServerWizardWidgetOutputCommand.class, "StartService", PreServiceDevelopCommand.class); + dataRegistry.addMapping( ServerWizardWidgetOutputCommand.class, "TestService", PreServiceDevelopCommand.class); + dataRegistry.addMapping( ServerWizardWidgetOutputCommand.class, "PublishService", PreServiceDevelopCommand.class); + dataRegistry.addMapping( ServerWizardWidgetOutputCommand.class, "GenerateProxy", PreServiceDevelopCommand.class); + dataRegistry.addMapping( ServerWizardWidgetOutputCommand.class, "ResourceContext", PreServiceDevelopCommand.class); + + dataRegistry.addMapping( ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceComponentType", PreServiceDevelopCommand.class, "ModuleType", null); + dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceRuntimeId", ServerExtensionDefaultingCommand.class); + dataRegistry.addMapping( ServerExtensionDefaultingCommand.class, "ServiceTypeRuntimeServer", PreServiceDevelopCommand.class ); + dataRegistry.addMapping( ServerExtensionDefaultingCommand.class, "ServiceRuntimeId", PreServiceDevelopCommand.class ); + dataRegistry.addMapping( ServerExtensionDefaultingCommand.class, "ServiceJ2EEVersion", PreServiceDevelopCommand.class); + dataRegistry.addMapping( ServerExtensionDefaultingCommand.class, "ServerProject", PreServiceDevelopCommand.class, "Module", null ); + dataRegistry.addMapping( ServerExtensionDefaultingCommand.class, "ServerProjectEAR", PreServiceDevelopCommand.class, "Ear", null ); + + dataRegistry.addMapping( ObjectSelectionOutputCommand.class, "ObjectSelection", PreServiceDevelopCommand.class, "Selection", new SelectionTransformer() ); + dataRegistry.addMapping( PreServiceDevelopCommand.class, "WebService", ServerExtensionOutputCommand.class ); + dataRegistry.addMapping(ServerExtensionOutputCommand.class, "ServiceServerInstanceId", CreateMonitorCommand.class); + + // Map ServerExtensionOutputCommand for ServerStart() + dataRegistry.addMapping(ServerExtensionDefaultingCommand.class, "ServerProjectEAR", ServerExtensionOutputCommand.class, "EarProjectName", null); + + // Map ManageServerStartUpCommand + dataRegistry.addMapping(ServerExtensionOutputCommand.class, "IsWebProjectStartupRequested", ManageServerStartUpCommand.class); + + dataRegistry.addMapping(ServerWizardWidgetOutputCommand.class, "StartService", ManageServerStartUpCommand.class); + dataRegistry.addMapping(ServerWizardWidgetOutputCommand.class, "TestService", ManageServerStartUpCommand.class); + dataRegistry.addMapping(ServerExtensionDefaultingCommand.class, "ServerProject", ManageServerStartUpCommand.class, "ServiceProject", new StringToIProjectTransformer()); + dataRegistry.addMapping(ServerExtensionDefaultingCommand.class, "ServerServer", ManageServerStartUpCommand.class,"ServiceServerTypeId", null); + + //jvh - added - strays from widget bindings etc. + dataRegistry.addMapping(ServerWizardWidgetOutputCommand.class, "TestService",FinishTestFragment.class); + dataRegistry.addMapping(CreateMonitorCommand.class, "MonitoredPort", ComputeEndpointCommand.class); + dataRegistry.addMapping(ServerExtensionDefaultingCommand.class, "ServiceTypeRuntimeServer", CreateMonitorCommand.class); + dataRegistry.addMapping(ServerExtensionOutputCommand.class, "WsdlURI", ComputeEndpointCommand.class); + dataRegistry.addMapping(ServerExtensionOutputCommand.class, "WebServicesParser", ComputeEndpointCommand.class); + + } + +} diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2TestFacilityListTransformer.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2TestFacilityListTransformer.java new file mode 100644 index 000000000..b8596054b --- /dev/null +++ b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2TestFacilityListTransformer.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * Copyright (c) 2005 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.ws.internal.common; + +import org.eclipse.jst.ws.internal.plugin.WebServicePlugin; +import org.eclipse.wst.command.internal.env.core.data.Transformer; +import org.eclipse.wst.command.internal.env.core.selection.SelectionList; + +public class String2TestFacilityListTransformer implements Transformer { + + public Object transform(Object value) { + String testFacility = (String)value; + //value represents name of a test facility + //pick up list of test facilities + String[] testTypes = WebServicePlugin.getInstance().getScenarioContext().getWebServiceTestTypes(); + + int index = 0; + //match value to name of test facility and set index accordingly + for (int i = 0; i < testTypes.length; i++) { + if (testTypes[i].equals(testFacility)) + { + break; + } + index++; + } + + SelectionList selectionList = new SelectionList(testTypes, index); + return selectionList; + } +} + + diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2TypeRuntimeServerModifier.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2TypeRuntimeServerModifier.java new file mode 100644 index 000000000..0b28d1c1a --- /dev/null +++ b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2TypeRuntimeServerModifier.java @@ -0,0 +1,58 @@ +/******************************************************************************* + * Copyright (c) 2005 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.ws.internal.common; + +import java.util.Map; + +import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; +import org.eclipse.wst.command.internal.env.core.data.BeanModifier; + +public class String2TypeRuntimeServerModifier implements BeanModifier { + + /** + * Modifies the supplied TypeRuntimeServer bean with properties in holder. + * If the bean is null, construct a new one and set its properties. + * @param bean TypeRuntimeServer bean to be modified + * @param holder Map containing values for TypeRuntimeServer properties + * @return TypeRuntimeServer with properties set + */ + public void modify(Object bean, Object holder) { + + TypeRuntimeServer types = null; + if (bean == null || !(bean instanceof TypeRuntimeServer)) + { + types = new TypeRuntimeServer(); + } + else + { + types = (TypeRuntimeServer)bean; + } + + if (holder instanceof Map) + { + Map typesMap = (Map)holder; + String prefix = ""; + + if (typesMap.containsKey("Service.TypeId")||typesMap.containsKey("Service.RuntimeId")|| + typesMap.containsKey("Service.ServerId")) + prefix = "Service."; + else + prefix = "Client."; + + types.setTypeId((String)typesMap.get(prefix+"TypeId")); + types.setRuntimeId((String)typesMap.get(prefix+"RuntimeId")); + types.setServerId((String)typesMap.get(prefix+"ServerId")); + } + } + + +} + diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/env/core/data/BeanModifier.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/env/core/data/BeanModifier.java new file mode 100644 index 000000000..d56fc66c0 --- /dev/null +++ b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/env/core/data/BeanModifier.java @@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2005 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.command.internal.env.core.data; + +public interface BeanModifier { + + /** + * Performs modification on bean properties using data provided + * @param bean The bean to be modified + * @param propertyHolder The data to use to make the modification + */ + public void modify(Object bean, Object propertyHolder); + +} diff --git a/bundles/org.eclipse.wst.command.env/.classpath b/bundles/org.eclipse.wst.command.env/.classpath index 751c8f2e5..70d4ebca6 100644 --- a/bundles/org.eclipse.wst.command.env/.classpath +++ b/bundles/org.eclipse.wst.command.env/.classpath @@ -3,5 +3,6 @@ <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="ant-src"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/bundles/org.eclipse.wst.command.env/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.command.env/META-INF/MANIFEST.MF index 0769e5a50..f0c0f0f98 100644 --- a/bundles/org.eclipse.wst.command.env/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.wst.command.env/META-INF/MANIFEST.MF @@ -1,4 +1,5 @@ Manifest-Version: 1.0 +Bundle-ClassPath: env.jar Bundle-ManifestVersion: 2 Bundle-Name: %PLUGIN_NAME Bundle-SymbolicName: org.eclipse.wst.command.env; singleton:=true @@ -6,7 +7,9 @@ Bundle-Version: 1.0.0 Bundle-Activator: org.eclipse.wst.command.internal.env.plugin.EnvPlugin Bundle-Vendor: %PLUGIN_PROVIDER Bundle-Localization: plugin -Export-Package: org.eclipse.wst.command.internal.env.commandline, +Export-Package: org.eclipse.wst.command.env.ant, + org.eclipse.wst.command.internal.env, + org.eclipse.wst.command.internal.env.commandline, org.eclipse.wst.command.internal.env.common, org.eclipse.wst.command.internal.env.context, org.eclipse.wst.command.internal.env.eclipse, @@ -17,5 +20,8 @@ Require-Bundle: org.eclipse.wst.command.env.core, org.eclipse.core.resources, org.eclipse.wst.common.frameworks, org.eclipse.core.commands, - org.eclipse.wst.common.environment + org.eclipse.wst.common.environment, + org.apache.ant, + org.eclipse.ant.core, + org.eclipse.jface Eclipse-AutoStart: true diff --git a/bundles/org.eclipse.wst.command.env/ant-lib/anttasks.jar b/bundles/org.eclipse.wst.command.env/ant-lib/anttasks.jar Binary files differnew file mode 100644 index 000000000..a3514b8a5 --- /dev/null +++ b/bundles/org.eclipse.wst.command.env/ant-lib/anttasks.jar diff --git a/bundles/org.eclipse.wst.command.env/ant-src/ws/ant/task/WebServiceGenerationAntTask.java b/bundles/org.eclipse.wst.command.env/ant-src/ws/ant/task/WebServiceGenerationAntTask.java new file mode 100644 index 000000000..42e183338 --- /dev/null +++ b/bundles/org.eclipse.wst.command.env/ant-src/ws/ant/task/WebServiceGenerationAntTask.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2005 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package ws.ant.task; + +import org.apache.tools.ant.Project; +import org.apache.tools.ant.Task; +import org.eclipse.wst.command.env.ant.AntController; + +public class WebServiceGenerationAntTask extends Task { + + public void execute() + { + //get properties set in the Ant file + Project proj = getProject(); + + // call the AntController to kick off generation + new AntController(proj.getProperties()); + } + } + + diff --git a/bundles/org.eclipse.wst.command.env/ant/axisclient.properties b/bundles/org.eclipse.wst.command.env/ant/axisclient.properties new file mode 100644 index 000000000..0bbd76010 --- /dev/null +++ b/bundles/org.eclipse.wst.command.env/ant/axisclient.properties @@ -0,0 +1,52 @@ +scenarioType=service +!--ClientWizardWidgetOutputCommand +!-- type:boolean +MonitorService=false + +ClientProjectName +ClientEarProjectName +ClientComponentType +!--type:boolean +ClientNeedEAR +!-- jvh - the following prop is for combined scenario - leave out? +LaunchedServiceTestName + +!-- ClientTypeRuntimeServer - m:1 property to bean mapping +!-- jvh - fix the extension for this... +Client.RuntimeId(String) +Client.ServerId(String) +Client.TypeId(String) + +TestFacility - pass in a valid string: +JspFolder +!--type:boolean +RunClientTest + +WSDLSelectionOutputCommand +WsdlURI - String +Project - IProject +ComponentName - String + +FinishTestFragment +TestService - boolean +TestID - String +IsTestWidget- boolean + +ClientHandlersWidgetOutputCommand +WsRefsToHandlers (HandlersTable) - Hashtable + +GenerateHandlerSkeletonCommand +SourceOutputLocation (OutputLocation) - IPath +HandlerClassNames (HandlerNames) - String[] +GenSkeletonEnabled - boolean + +!-- AXIS CLIENT +AxisClientDefaultingCommand +ClientProject - StringToIProjectTransformer() +WsdlURL (String) +ClientServer (String) +GenerateProxy (boolean) +CustomizeClientMappings (boolean) +IsClientScenario (boolean) + +Mappings(HashMap)- have to come from file (provide workspace relative URI) - same format as currently used in Wizard Import... see: TableViewerWidget diff --git a/bundles/org.eclipse.wst.command.env/ant/axisservice.properties b/bundles/org.eclipse.wst.command.env/ant/axisservice.properties new file mode 100644 index 000000000..fab380d5e --- /dev/null +++ b/bundles/org.eclipse.wst.command.env/ant/axisservice.properties @@ -0,0 +1,68 @@ +!-- REQUIRED. Differentiates from "client" scenario. +scenarioType=service + +!-- REQUIRED. Workspace relative URI to the input WSDL or Java. +InitialSelection + +Project +ComponentName + +ServerWizardWidgetOutputCommand +!--ServiceTypeRuntimeServer +Server.RuntimeId(String) +Server.ServerId(String) +Server.TypeId(String) +StartService +TestService +PublishService +GenerateProxy +!--ClientTypeRuntimeServer +!-- do I need these without a combined scenario?? +Client.RuntimeId(String) +Client.ServerId(String) +Client.TypeId(String) + +CreateMonitorCommand +MonitorService +ComputeEndpointCommand +MonitorService + +ServerExtensionDefaultingCommand +ServiceJ2EEVersion +ServiceProjectName +ServiceComponentName +ServiceEarProjectName +ServiceEarComponentName +ServiceNeedEAR + +FinishTestFragment +LaunchedServiceTestName + +TestDefaultingFragment +LaunchedServiceTestName + +FinishTestFragment +TestService +TestID + +PublishToPrivateUDDICommandFragment +PublishToPrivateUDDI + +LaunchFragment +PublishToPrivateUDDI +PublishToPublicUDDI + +!-- AXIS SERVICE ---- +!-- <jvh - need this in addition to initialselection??> +ObjectSelection + +!-- All scenarios. String: workspace relative URI to property file containing mappings - same format as currently used in Wizard Import... +Mappings +!-- Top down - String: the workspace relative URI for a Java source folder for the generated Java code - must be existing workspace source folder +JavaOutput +!-- Bottom up - comma delimited string of method names to be exposed in output WSDL +Methods +!-- Bottom up - String: one of: RPC, DOCUMENT, WRAPPED +Style +!-- Bottom up - String: one of: LITERAL, ENCODED +Use diff --git a/bundles/org.eclipse.wst.command.env/ant/wsant.bat b/bundles/org.eclipse.wst.command.env/ant/wsant.bat new file mode 100644 index 000000000..681397f65 --- /dev/null +++ b/bundles/org.eclipse.wst.command.env/ant/wsant.bat @@ -0,0 +1,28 @@ +echo off +setlocal + +REM *********** Local envars *************************** + +REM The JRE java.exe to be used +set JAVAEXE="C:\j2sdk1.4.2_07\jre\bin\java.exe" + +REM The Eclipse startup.jar - target workspace/wtp workspace +set STARTUPJAR="D:\wtp0929\eclipse\startup.jar" + +REM The location of your workspace (does not need to exist) +set WORKSPACE=D:\workspaces\ant_task + +REM **************************************************** + +if not exist %JAVAEXE% echo ERROR: incorrect java.exe=%JAVAEXE%, edit this file and correct the JAVAEXE envar +if not exist %JAVAEXE% goto done + +if not exist %STARTUPJAR% echo ERROR: incorrect startup.jar=%STARTUPJAR%, edit this file and correct the STARTUPJAR envar +if not exist %STARTUPJAR% goto done + +:run +@echo on +%JAVAEXE% -cp %STARTUPJAR% org.eclipse.core.launcher.Main -noupdate -application org.eclipse.ant.core.antRunner -data %WORKSPACE% -file wsgen.xml %* >wsgen.txt 2>&1 + +:done +pause diff --git a/bundles/org.eclipse.wst.command.env/ant/wsgen.xml b/bundles/org.eclipse.wst.command.env/ant/wsgen.xml new file mode 100644 index 000000000..6fa936cc9 --- /dev/null +++ b/bundles/org.eclipse.wst.command.env/ant/wsgen.xml @@ -0,0 +1,13 @@ +<?xml version="1.0"?> + +<project default="main" basedir="."> + +<echo message="pulling in property file"/> +<property file="test.properties"/> + +<echo message="calling the ant task class"/> + <target name="main" > + <wsgen/> + </target> + +</project> diff --git a/bundles/org.eclipse.wst.command.env/build.properties b/bundles/org.eclipse.wst.command.env/build.properties index de223926a..c771e614a 100644 --- a/bundles/org.eclipse.wst.command.env/build.properties +++ b/bundles/org.eclipse.wst.command.env/build.properties @@ -1,9 +1,13 @@ bin.includes = plugin.xml,\ - *.jar,\ plugin.properties,\ - .,\ + env.jar,\ META-INF/,\ - about.html -source.. = src/ -output.. = bin/ - + about.html,\ + ant/,\ + ant-lib/anttasks.jar +source.env.jar = src/ +output.env.jar = bin/ +jars.compile.order = env.jar,\ + ant-lib/anttasks.jar +source.ant-lib/anttasks.jar = ant-src/ +output.ant-lib/anttasks.jar = bin/ diff --git a/bundles/org.eclipse.wst.command.env/plugin.xml b/bundles/org.eclipse.wst.command.env/plugin.xml index e03a537d8..18ee71fa0 100644 --- a/bundles/org.eclipse.wst.command.env/plugin.xml +++ b/bundles/org.eclipse.wst.command.env/plugin.xml @@ -11,4 +11,23 @@ id="actionDialogPreferenceType" name="%PLUGIN_XP_POPUP_DIALOGS"/> + <extension-point id="antDataMapping" name="antDataMapping" schema="schema/antdatamapping.exsd"/> + <extension-point id="antScenario" name="antScenario" schema="schema/antScenario.exsd"/> + + <extension + id="wsgen" + name="wsgen" + point="org.eclipse.ant.core.antTasks"> + <antTask + class="ws.ant.task.WebServiceGenerationAntTask" + eclipseRuntime="true" + headless="true" + library="ant-lib/anttasks.jar" + name="wsgen"/> + </extension> + <extension + point="org.eclipse.ant.core.extraClasspathEntries"> + <extraClasspathEntry library="ant-lib/anttasks.jar"/> + </extension> + </plugin> diff --git a/bundles/org.eclipse.wst.command.env/schema/antScenario.exsd b/bundles/org.eclipse.wst.command.env/schema/antScenario.exsd new file mode 100644 index 000000000..846a510e2 --- /dev/null +++ b/bundles/org.eclipse.wst.command.env/schema/antScenario.exsd @@ -0,0 +1,99 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- Schema file written by PDE --> +<schema targetNamespace="org.eclipse.wst.command.env.ui"> +<annotation> + <appInfo> + <meta.schema plugin="org.eclipse.wst.command.env.ui" id="antScenario" name="antScenario"/> + </appInfo> + <documentation> + [Enter description of this extension point.] + </documentation> + </annotation> + + <element name="extension"> + <complexType> + <sequence> + <element ref="antScenario"/> + </sequence> + <attribute name="point" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="id" type="string"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + </complexType> + </element> + + <element name="antScenario"> + <complexType> + <attribute name="scenarioType" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="class" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + </complexType> + </element> + + <annotation> + <appInfo> + <meta.section type="since"/> + </appInfo> + <documentation> + [Enter the first release in which this extension point appears.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="examples"/> + </appInfo> + <documentation> + [Enter extension point usage example here.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="apiInfo"/> + </appInfo> + <documentation> + [Enter API information here.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="implementation"/> + </appInfo> + <documentation> + [Enter information about supplied implementation of this extension point.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="copyright"/> + </appInfo> + <documentation> + + </documentation> + </annotation> + +</schema> diff --git a/bundles/org.eclipse.wst.command.env/schema/antdatamapping.exsd b/bundles/org.eclipse.wst.command.env/schema/antdatamapping.exsd new file mode 100644 index 000000000..623b1b2fa --- /dev/null +++ b/bundles/org.eclipse.wst.command.env/schema/antdatamapping.exsd @@ -0,0 +1,113 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- Schema file written by PDE --> +<schema targetNamespace="org.eclipse.wst.command.env.ui"> +<annotation> + <appInfo> + <meta.schema plugin="org.eclipse.wst.command.env.ui" id="wsmapping" name="wsmapping"/> + </appInfo> + <documentation> + [Enter description of this extension point.] + </documentation> + </annotation> + + <element name="extension"> + <complexType> + <sequence> + <element ref="map"/> + </sequence> + <attribute name="point" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="id" type="string"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + </complexType> + </element> + + <element name="map"> + <complexType> + <attribute name="key" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="operation" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="property" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="transform" type="string"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + </complexType> + </element> + + <annotation> + <appInfo> + <meta.section type="since"/> + </appInfo> + <documentation> + [Enter the first release in which this extension point appears.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="examples"/> + </appInfo> + <documentation> + [Enter extension point usage example here.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="apiInfo"/> + </appInfo> + <documentation> + [Enter API information here.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="implementation"/> + </appInfo> + <documentation> + [Enter information about supplied implementation of this extension point.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="copyright"/> + </appInfo> + <documentation> + + </documentation> + </annotation> + +</schema>
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/env/ant/AntController.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/env/ant/AntController.java new file mode 100644 index 000000000..6acbe47a6 --- /dev/null +++ b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/env/ant/AntController.java @@ -0,0 +1,137 @@ +/******************************************************************************* + * Copyright (c) 2005 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.command.env.ant; + +import java.util.Hashtable; + +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.wst.command.internal.env.context.PersistentResourceContext; +import org.eclipse.wst.command.internal.env.core.CommandManager; +import org.eclipse.wst.command.internal.env.core.data.DataFlowManager; +import org.eclipse.wst.command.internal.env.core.data.DataMappingRegistryImpl; +import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment; +import org.eclipse.wst.command.internal.env.core.fragment.FragmentListener; +import org.eclipse.wst.common.environment.NullStatusHandler; + + +public class AntController { + + + private AntOperationManager operationManager_; + + public AntController(Hashtable properties) + { + // construct the environment - passing in the property table + // --maintains link to property table plus any other environment properties + // --code to access extension point mappings for operations to retrieve data from property table + PersistentResourceContext resourceContext = PersistentResourceContext.getInstance(); + NullStatusHandler handler = new NullStatusHandler(); + AntEnvironment environment = new AntEnvironment(this, resourceContext, handler, properties); + + // construct data manager for maintaining state across operations + DataFlowManager dataManager = new DataFlowManager( new DataMappingRegistryImpl(), environment); + + // set up operation fragments - conditional on options by user... service or client + // also need to initialize the "selection" or input file (WSDL, Java) here + CommandFragment rootFragment = environment.getRootCommandFragment(); + + // construct the engine - manages execution of operations + createOperationManager(rootFragment, dataManager, environment); + + DataMappingRegistryImpl dataRegistry_ = new DataMappingRegistryImpl(); + rootFragment.registerDataMappings(dataRegistry_); + + //ready to start running operations + ((AntOperationManager)getOperationManager()).moveForwardToNextStop(new NullProgressMonitor()); + } + + private void createOperationManager(CommandFragment frag, DataFlowManager mgr, AntEnvironment env) + { + operationManager_ = new AntOperationManager(frag, mgr, env); + + operationManager_.setPeekFragmentListener( + new FragmentListener() + { + public boolean notify( CommandFragment fragment ) + { + return peekFragment( fragment ); + } + } ); + + operationManager_.setNextFragmentListener( + new FragmentListener() + { + public boolean notify( CommandFragment fragment ) + { + return nextFragment( fragment ); + } + } ); + + operationManager_.setUndoFragmentListener( + new FragmentListener() + { + public boolean notify( CommandFragment fragment ) + { + return undoFragment( fragment ); + } + } ); + } + + protected CommandManager getOperationManager() + { + return operationManager_; + } + + /** + * The CommandFragmentEngine calls this method when it is peeking forward + * in the fragments. When peeking forward the command stack state in the + * engine is not changes. + * + * + * @param fragment the fragment that it is peeking at. + * @return Indicates whether peeking should stop or not. + */ + protected boolean peekFragment( CommandFragment fragment ) + { + return true; + } + + /** + * The CommandFragmentEngine calls this method when it is moving forward + * in the fragments. When moving forward the command stack state is saved + * at each fragment is traversed. + * + * @param fragment the fragment that is being traversed. + * @return indicates if the forward traversal should continue. + */ + protected boolean nextFragment( CommandFragment fragment ) + { + return true; + } + + /** + * This method is called for each fragment when the command engine is unwinding + * its stack during an undo operation. + * + * @param fragment the fragment being undone. + * @return returns true if the undo process should continue. + */ + protected boolean undoFragment( CommandFragment fragment ) + { + return true; + } + + + + + + } diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/env/ant/AntEnvironment.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/env/ant/AntEnvironment.java new file mode 100644 index 000000000..a99068231 --- /dev/null +++ b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/env/ant/AntEnvironment.java @@ -0,0 +1,475 @@ +/******************************************************************************* + * Copyright (c) 2005 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.command.env.ant; + +import java.lang.reflect.*; +import java.util.*; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.Platform; +import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment; +import org.eclipse.wst.command.internal.env.eclipse.EclipseEnvironment; +import org.eclipse.wst.command.internal.env.core.CommandManager; +import org.eclipse.wst.command.internal.env.core.context.ResourceContext; +import org.eclipse.wst.command.internal.env.core.data.BeanModifier; +import org.eclipse.wst.command.internal.env.core.data.ClassEntry; +import org.eclipse.wst.command.internal.env.core.data.Transformer; +import org.eclipse.wst.common.environment.IStatusHandler; +import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; + + +public class AntEnvironment extends EclipseEnvironment{ + + private Hashtable antProperties_; + private Hashtable operationDataRecord_ = new Hashtable(); + private boolean mappingComplete_; + private ClassEntry classEntry; + + public static int INIT_OPERATION_DATA_SUCCESS = 1; + public static int INIT_OPERATION_DATA_FAIL = -1; + + // extensionPoint names and namespace + private static String MAPPER_EXT_PT = "antDataMapping"; //$NON-NLS-1$ + private static String SCENARIO_EXT_PT = "antScenario"; //$NON-NLS-1$ + private static String EXT_PT_NAMESPACE = "org.eclipse.wst.command.env"; ////$NON-NLS-1$ + + // antDataMapping extension point attributes + private static final String MAPPER_OPERATION_ATTRIBUTE= "operation"; //$NON-NLS-1$ + private static final String MAPPER_KEY_ATTRIBUTE= "key"; //$NON-NLS-1$ + private static final String MAPPER_PROPERTY_ATTRIBUTE= "property"; //$NON-NLS-1$ + private static final String MAPPER_TRANSFORM_ATTRIBUTE= "transform"; //$NON-NLS-1$ + + // antScenario extension point attributes + private static final String SCENARIO_TYPE_ATTRIBUTE = "scenarioType"; //$NON-NLS-1$ + private static final String SCENARIO_CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$ + + private AntController controller_; + + public AntEnvironment(AntController controller, ResourceContext context, IStatusHandler handler, Hashtable properties) + { + super(controller.getOperationManager(), context, handler); + antProperties_ = properties; + controller_ = controller; + } + + // returns String since the property table built by Ant is property value pairs where the value is a String + private String getProperty(String key) + { + Object property = antProperties_.get(key); + if (property != null) + return property.toString(); + return null; + } + + // call from engine prior to executing the operation + public int initOperationData(AbstractDataModelOperation op) + { + //check to see if data has already been primed for this operation + String qualifiedClassName = op.getClass().getName(); + if (operationDataRecord_.get(qualifiedClassName) == null) + { + classEntry = new ClassEntry(); + try { + + //extension lookup for the bean - may be more than one property for it + Enumeration operationData = getMappingExtensions(op); + classEntry.setterList_= getSetterList(op); + while (operationData.hasMoreElements()) + { + PropertyDataHolder mapping = (PropertyDataHolder)operationData.nextElement(); + + mappingComplete_ = false; + String property = mapping.property_; + String setterMethodName = createSetterName(property); + + int step = 1; + while (!mappingComplete_) + { + switch (step) { + case 1: + mappingComplete_ = transformAndSet(mapping, setterMethodName); + break; + case 2: + mappingComplete_ = callSetter(mapping.operation_, mapping.value_, setterMethodName); + break; + + case 3: + mappingComplete_ = callPrimitiveSetter(mapping); + break; + + case 4: + mappingComplete_ = callSetterConstructor(mapping); + break; + + default: + //jvh: fail out here...write message to the log - no mapping for operation.prop pair + return INIT_OPERATION_DATA_FAIL; + } + step++; + } + } + //add operation to the record - no need to initialize again... + operationDataRecord_.put(qualifiedClassName, ""); + } + catch (Exception e) + { + //jvh: add message to the log + return INIT_OPERATION_DATA_FAIL; + } + + } + return INIT_OPERATION_DATA_SUCCESS; + } + + /** + * Creates setter name based on the property passed in. If the + * property has any leading qualifiers they are stripped off. + * The property is capitalized and set is prepended. + * @param property The name of the property that requires a setter. + * @return + */ + private String createSetterName(String property) + { + while (property.indexOf(".")>=0) + { + property=property.substring(property.indexOf(".")+1); + } + String firstChar = property.substring(0,1); + firstChar = firstChar.toUpperCase(); + property = firstChar + property.substring(1); + String setterName = "set" + property; + return setterName; + } + + /** + * Retrieves extensions for the org.eclipse.wst.command.env antDataMapping + * extension point. Extracts those that with class attribute values that match operationName. + * All mappings are converted to PropertyDataHolder objects. + * Any m:1 Ant key to property mappings are collected into a key-value map within + * a single PropertyDataHolder. + * @param operationName The name of the operation that is being initialized. + * @return A collection of PropertyDataHolder objects. Returns null if there are no extensions matching the operationName. + */ + private Enumeration getMappingExtensions(AbstractDataModelOperation operation) + { + String operationName = operation.getClass().getName(); + //go to ext registry and get all antMapping extensions + IExtensionRegistry reg = Platform.getExtensionRegistry(); + IExtensionPoint extPt = reg.getExtensionPoint(EXT_PT_NAMESPACE, MAPPER_EXT_PT); + Hashtable dataTable = new Hashtable(); + + IConfigurationElement[] elements = extPt.getConfigurationElements(); + + for (int i = 0; i < elements.length; i++) { + + IConfigurationElement ce = elements[i]; + Object obj = ce.getAttribute(MAPPER_OPERATION_ATTRIBUTE); + // look for mappings for this operation + if (obj.equals(operationName)) + { + String property = ce.getAttribute(MAPPER_PROPERTY_ATTRIBUTE); + String key = ce.getAttribute(MAPPER_KEY_ATTRIBUTE); + String transform = ce.getAttribute(MAPPER_TRANSFORM_ATTRIBUTE); + String value = getProperty(key); + + //check to see if the property for this extension is already in the data table + // if so, there is a m:1 mapping + if (dataTable.containsKey(property)) + { + //get the PropertyDataHolder from the table + PropertyDataHolder holder = (PropertyDataHolder)dataTable.get(property); + //if already have a map - add the current key, value pair + if (holder.map_ != null) + { + holder.map_.put(key, value); + } + // add a new map to the data holder and put first & current key, values into the map + else + { + holder.map_ = new HashMap(); + holder.map_.put(holder.key_, holder.value_); + holder.key_ = ""; + holder.value_ = ""; + holder.map_.put(key, value); + } + } + else //add the extension info to the data table + { + PropertyDataHolder holder = new PropertyDataHolder(); + holder.operation_ = operation; + holder.key_ = key; + holder.property_ = property; + holder.transform_ = transform; + holder.value_ = value; + dataTable.put(property, holder); + } + } + } + return dataTable.elements(); + } + + private boolean transformAndSet(PropertyDataHolder mapping, String setterMethodName) + { + String transform = mapping.transform_; + if (transform != null) + { + // get transform class & create setter parameters + try + { + Object classObject = Class.forName(transform).newInstance(); + Object param = new Object(); + if (classObject instanceof Transformer) + { + Transformer transformer = (Transformer)classObject; + // transform the property value + param = transformer.transform(mapping.value_); + } + else if (mapping.map_ != null && classObject instanceof BeanModifier) + { + BeanModifier modifier = (BeanModifier)classObject; + Method getter = getGetterMethod(mapping); + param = getter.invoke(mapping.operation_, new Object[]{}); + modifier.modify(mapping.map_, param); + } + return callSetter(mapping.operation_, param, setterMethodName); + + } + catch (Exception exc) + { + return false; + // jvh: write data mapping transformation not found error to the log... + } + } + return false; + } + + private Vector getSetterList(Object op) + { + Vector result = new Vector(); + Method[] methods = op.getClass().getMethods(); + for( int index = 0; index < methods.length; index++ ) + { + Method method = methods[index]; + boolean isPublic = Modifier.isPublic( method.getModifiers() ); + Class returnType = method.getReturnType(); + + if( isPublic && + returnType == Void.TYPE && + method.getParameterTypes().length == 1 && + method.getName().startsWith( "set" )) + { + method.setAccessible( true ); + result.add( method ); + } + } + + return result; + } + + private Method getGetterMethod(PropertyDataHolder mapping) + { + Method getterFound = null; + + if (classEntry.getterList_ == null) + { + classEntry.getterList_ = getGetterList(mapping.operation_); + } + + for( int index = 0; index < classEntry.getterList_.size(); index++ ) + { + Method getter = (Method)classEntry.getterList_.elementAt( index ); + + if( getter.getName().equals( "get" + mapping.property_ )) + { + getterFound = getter; + break; + } + } + return getterFound; + } + + private Vector getGetterList( Object object ) + { + Vector result = new Vector(); + Method[] methods = object.getClass().getMethods(); + + for( int index = 0; index < methods.length; index++ ) + { + Method method = methods[index]; + boolean isPublic = Modifier.isPublic( method.getModifiers() ); + Class returnType = method.getReturnType(); + + if( isPublic && + returnType != Void.TYPE && + method.getParameterTypes().length == 0 && + method.getName().startsWith( "get" )) + { + method.setAccessible( true ); + result.add( method ); + } + } + + return result; + } + + private boolean callSetter(AbstractDataModelOperation op, Object param, String setterMethodName) + { + for (Iterator iterator = classEntry.setterList_.iterator(); iterator.hasNext();) + { + Method method = (Method) iterator.next(); + if (method.getName().equals(setterMethodName)) + { + Class[] paramTypes = method.getParameterTypes(); + if (paramTypes.length == 1) + { + if (paramTypes[0].isAssignableFrom(param.getClass())) + { + try{ + method.invoke(op, new Object[]{param}); + return true; + } + catch(Exception cex){ + //jvh: add message to the log + } + } + } + } + } + return false; + } + + + // look for setter with primitive type parameter - if find one, convert String propertyValue and call it + private boolean callPrimitiveSetter(PropertyDataHolder mapping) + { + for (Iterator iterator = classEntry.setterList_.iterator(); iterator.hasNext();) { + Method element = (Method) iterator.next(); + Class[] parmTypes = element.getParameterTypes(); + if (parmTypes.length==1 && parmTypes[0].isPrimitive()) + { + Class parmType = parmTypes[0].getClass(); + Object setterParm = null; + if (parmType.equals(Integer.class)) + { + setterParm = Integer.valueOf(mapping.value_); + } + else if (parmType.equals(Boolean.class)) + { + setterParm = Boolean.valueOf(mapping.value_); + } + else if (parmType.equals(Character.class) && mapping.value_.length() == 1) + { + setterParm = new Character(mapping.value_.charAt(0)); + } + else if (parmType.equals(Byte.class)) + { + setterParm = Byte.valueOf(mapping.value_); + } + else if (parmType.equals(Short.class)) + { + setterParm = Short.valueOf(mapping.value_); + } + else if (parmType.equals(Long.class)) + { + setterParm = Long.valueOf(mapping.value_); + } + else if (parmType.equals(Float.class)) + { + setterParm = Float.valueOf(mapping.value_); + } + else if (parmType.equals(Double.class)) + { + setterParm = Double.valueOf(mapping.value_); + } + + if (setterParm != null) + { + try + { + element.invoke(mapping.operation_, new Object[]{setterParm}); + return true; + } + catch(Exception e){} + } + } + } + return false; + } + + //check for setter with parameter type that takes a String to construct + // construct the parameter using String & call the setter + private boolean callSetterConstructor(PropertyDataHolder mapping) + { + for (Iterator iterator = classEntry.setterList_.iterator(); iterator.hasNext();) { + Method element = (Method) iterator.next(); + Class[] parmTypes = element.getParameterTypes(); + Class[] stringParm = new Class[]{String.class}; + if (parmTypes.length==1) + { + try + { + Constructor ctor = parmTypes.getClass().getConstructor(stringParm); + Object parameter = ctor.newInstance(new Object[]{mapping.value_}); + element.invoke(mapping.operation_, new Object[]{parameter}); + } + catch (Exception exc) + { + //jvh: write msg to log + return false; + } + } + } + return false; + } + + /** + * Returns an object that helps manage execution/undoing of Commands. + */ + public CommandManager getCommandManager (){ + return controller_.getOperationManager(); + } + + public CommandFragment getRootCommandFragment() + { + + //look up the commandFragment in the scenarioRegistry extension point with an ID corresponding to the scenario property in the propertytable + String scenarioProperty = (String)getProperty(SCENARIO_TYPE_ATTRIBUTE); + IExtensionRegistry reg = Platform.getExtensionRegistry(); + IExtensionPoint extPt = reg.getExtensionPoint(EXT_PT_NAMESPACE, SCENARIO_EXT_PT); + + IConfigurationElement[] elements = extPt.getConfigurationElements(); + + for (int i = 0; i < elements.length; i++) { + + IConfigurationElement configElement = elements[i]; + if (configElement.getAttribute(SCENARIO_TYPE_ATTRIBUTE).equals(scenarioProperty)) + { + try + { + Object obj = configElement.createExecutableExtension(SCENARIO_CLASS_ATTRIBUTE); + + if (obj instanceof org.eclipse.wst.command.internal.env.core.fragment.CommandFragment) + { + System.out.println("have command fragment " + obj.toString()); + return (org.eclipse.wst.command.internal.env.core.fragment.CommandFragment)obj; + } + } + catch (Exception exception) + { + System.out.println("exception creating scenario class from extension " + exception.toString()); + } + } + } + return null; + } + } diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/env/ant/AntOperationManager.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/env/ant/AntOperationManager.java new file mode 100644 index 000000000..2ad3ae0db --- /dev/null +++ b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/env/ant/AntOperationManager.java @@ -0,0 +1,402 @@ +/******************************************************************************* + * Copyright (c) 2005 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.command.env.ant; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.wst.command.internal.env.core.data.DataFlowManager; +import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment; + +import org.eclipse.wst.command.internal.env.core.fragment.FragmentListener; +import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; +import java.util.Stack; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.Status; + +import org.eclipse.wst.command.internal.env.core.CommandFactory; +import org.eclipse.wst.command.internal.env.core.CommandManager; +import org.eclipse.wst.command.internal.env.core.common.MessageUtils; +import org.eclipse.wst.command.internal.env.core.common.StatusUtils; +import org.eclipse.wst.command.internal.env.core.data.DataMappingRegistry; +import org.eclipse.wst.common.environment.ILog; +import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; + + +//jvh - this class is almost identical to the CommandFragmentEngine +// problem for re-use - I want to override the runCommand method so I can initialize the +// data from the Ant task & unfortunately it's private in the CommandFragmentEngine... + + public class AntOperationManager implements CommandManager { + + private Stack commandStack_; + private FragmentListener undoFragmentListener_; + private FragmentListener nextFragmentListener_; + private FragmentListener peekFragmentListener_; + private DataFlowManager dataManager_; + private AntEnvironment environment_; + private IStatus lastStatus_; + + /** + * Creates a CommandFragmentEngine. + * + * @param startFragment the root fragment where traversal will begin. + * @param dataManager the data manager containing all of the data mappings. + * @param environment the environment. + */ + public AntOperationManager( CommandFragment startFragment, DataFlowManager dataManager, AntEnvironment environment ) + { + SequenceFragment root = new SequenceFragment(); + root.add( startFragment ); + + commandStack_ = new Stack(); + + addToStack( root, -1 ); + addToStack( startFragment, 0 ); + + dataManager_ = dataManager; + environment_ = environment; + } + + /** + * @return returns the Data mapping registry. + */ + public DataMappingRegistry getMappingRegistry() + { + return dataManager_.getMappingRegistry(); + } + + /** + * + * @return the Status from the last Command executed. + */ + public IStatus getLastStatus() + { + return lastStatus_; + } + + /** + */ + public boolean isUndoEnabled() + { + return true; + } + + /** + * Sets the next fragment listener for this engine. This listener will be + * called for each fragment that is traversed in moveForwardToNextStop operation. + * + * @param listener the fragment listener. + */ + public void setNextFragmentListener( FragmentListener listener ) + { + nextFragmentListener_ = listener; + } + + /** + * Sets the next fragment listener for this engine. This listener will be + * called for each fragment that is traversed in peekForwardToNextStop operation. + * + * @param listener the fragment listener. + */ + public void setPeekFragmentListener( FragmentListener listener ) + { + peekFragmentListener_ = listener; + } + + /** + * Sets the peek fragment listener for this engine. This listener will be + * called for each fragment that is traversed in undoToLastStop operation. + * + * @param listener the fragment listener. + */ + public void setUndoFragmentListener( FragmentListener listener ) + { + undoFragmentListener_ = listener; + } + + /** + * Traverse the CommandFragments starting with the CommandFragment on the + * top of the command fragment stack. The operation does NOT change the + * command fragment stack and does not execute any command associated with + * a CommandFragment. + */ + public void peekForwardToNextStop() + { + CommandListEntry topEntry = (CommandListEntry)commandStack_.lastElement(); + int parentIndex = topEntry.parentIndex_; + CommandFragment childFragment = topEntry.fragment_; + boolean continueLoop = navigateChildFragments( childFragment, false ); + + while( parentIndex != -1 && continueLoop ) + { + CommandListEntry parentEntry = (CommandListEntry)commandStack_.elementAt( parentIndex ); + CommandFragment parentFragment = parentEntry.fragment_; + CommandFragment nextFragment = parentFragment.getNextSubFragment( childFragment ); + + if( nextFragment == null ) + { + // There are no more sibling fragments to navigate so we will pop up to the parent + // an continue navigation there. + parentIndex = parentEntry.parentIndex_; + childFragment = parentFragment; + } + else + { + if( navigateChildFragments( nextFragment, true ) ) + { + // We are continuing to navigate. This time we want to traverse the sibling + // of nextFragment. + childFragment = nextFragment; + } + else + { + // We are stopping our navigation. + continueLoop = false; + } + } + } + } + + + /** + * Traverse the CommandFragments starting with the CommandFragment on the + * top of the command fragment stack. This operation does change the + * command fragment stack and does execute any command associated with + * a CommandFragment. + */ + public void moveForwardToNextStop( IProgressMonitor monitor ) + { + CommandListEntry topEntry = (CommandListEntry)commandStack_.lastElement(); + int parentIndex = topEntry.parentIndex_; + CommandFragment currentFragment = topEntry.fragment_; + boolean continueExecute = visitTop( monitor ); + CommandFragment childFragment = currentFragment.getFirstSubFragment(); + + // If the current fragment has child fragments we need to traverse these children. + while( childFragment != null && continueExecute ) + { + parentIndex = commandStack_.size() - 1; + addToStack( childFragment, parentIndex ); + continueExecute = visitTop( monitor ); + currentFragment = childFragment; + childFragment = currentFragment.getFirstSubFragment(); + } + + // The previous while loop has guaranteed that currentFragment has no + // child fragments. This while loop assumes this to be the case. + while( parentIndex != -1 && continueExecute ) + { + CommandListEntry parentEntry = (CommandListEntry)commandStack_.elementAt( parentIndex ); + CommandFragment parentFragment = parentEntry.fragment_; + CommandFragment nextFragment = null; + + if( currentFragment == null ) + { + nextFragment = parentFragment.getFirstSubFragment(); + } + else + { + nextFragment = parentFragment.getNextSubFragment( currentFragment ); + } + + if( nextFragment == null ) + { + // There are no more sibling fragments to navigate so we will pop up to the parent + // and continue navigation there. + parentIndex = parentEntry.parentIndex_; + currentFragment = parentFragment; + } + else + { + // We have a new fragment that we need to add to the top of the stack. + addToStack( nextFragment, parentIndex ); + parentIndex = commandStack_.size() - 1; + continueExecute = visitTop( monitor ); + currentFragment = null; + } + } + } + + /** + * + * @return returns true if the there is not longer any elements on the stack. Note: + * that last two entries are always left on the stack. + */ + public boolean undoToLastStop() + { + CommandListEntry topEntry = (CommandListEntry)commandStack_.lastElement(); + + // Always undo the top element. + performUndo( topEntry ); + + while( topEntry.parentIndex_ != 0 ) + { + commandStack_.pop(); + topEntry = (CommandListEntry)commandStack_.lastElement(); + + performUndo( topEntry ); + + if( topEntry.fragmentStopped_ ) + { + break; + } + } + + return topEntry.parentIndex_ == 0; + } + + private void performUndo( CommandListEntry entry ) + { + if( entry.parentIndex_ == 0 ) return; + + AbstractDataModelOperation cmd = entry.command_; + + if( cmd != null && cmd.canUndo() && !entry.beforeExecute_ ) + { + try + { + cmd.undo( null, null ); + } + catch( Exception exc ) + { + exc.printStackTrace(); + } + + entry.beforeExecute_ = true; + } + + undoFragmentListener_.notify( entry.fragment_ ); + } + + private boolean navigateChildFragments( CommandFragment fragment, boolean visitCurrent ) + { + boolean continueNavigate = true; + CommandFragment childFrag = null; + + if( visitCurrent ) + { + continueNavigate = peekFragmentListener_.notify( fragment ); + dataManager_.process( fragment ); + } + + childFrag = fragment.getFirstSubFragment(); + + while( childFrag != null && continueNavigate ) + { + continueNavigate = navigateChildFragments( childFrag, true ); + childFrag = fragment.getNextSubFragment( childFrag ); + } + + return continueNavigate; + } + + private boolean visitTop( IProgressMonitor monitor ) + { + CommandListEntry entry = (CommandListEntry)commandStack_.lastElement(); + boolean continueNavigate = nextFragmentListener_.notify( entry.fragment_ ); + + if( continueNavigate ) + { + // Call the setters for this fragment. + dataManager_.process( entry.fragment_ ); + + // Add any rules to the mapping registry before we execute the command. + entry.fragment_.registerDataMappings( dataManager_.getMappingRegistry() ); + + lastStatus_ = runCommand( entry, monitor ); + + if( lastStatus_.getSeverity() == IStatus.ERROR ) continueNavigate = false; + } + + if( !continueNavigate ) entry.fragmentStopped_ = true; + + return continueNavigate; + } + + private void addToStack( CommandFragment fragment, int parentIndex ) + { + CommandListEntry entry = new CommandListEntry( fragment, parentIndex ); + commandStack_.push( entry ); + } + + private IStatus runCommand( CommandListEntry entry, IProgressMonitor monitor ) + { + CommandFactory factory = entry.fragment_.getCommandFactory(); + IStatus status = Status.OK_STATUS; + + if( factory != null ) + { + AbstractDataModelOperation cmd = factory.create(); + + entry.command_ = cmd; + + if( cmd != null ) + { + System.out.println("-------------dataManager_process() for " + cmd.getClass() ); + dataManager_.process( cmd ); + System.out.println("calling init data for " + cmd.getClass() ); + environment_.initOperationData(cmd); + + try + { + environment_.getLog().log(ILog.INFO, "command", 5001, this, "runCommand", "Executing: " + cmd.getClass().getName()); + + cmd.setEnvironment( environment_ ); + System.out.println("calling execute for " + cmd.getClass() ); + status = cmd.execute( monitor, null ); + System.out.println("-------------execute complete for " + cmd.getClass() ); + entry.beforeExecute_ = false; + } + catch( Throwable exc ) + { + MessageUtils utils = new MessageUtils( "org.eclipse.wst.command.env.core.environment", this ); + IStatus unexpectedError = StatusUtils.errorStatus( exc ); + MultiStatus parentStatus = new MultiStatus( "id", 0, new IStatus[]{unexpectedError}, + utils.getMessage( "MSG_ERROR_UNEXPECTED_ERROR" ), null ); + environment_.getStatusHandler().reportError( parentStatus ); + } + finally + { + String message = "Ok"; + + if( status.getSeverity() == Status.ERROR ) + { + message = "Error: " + status.getMessage(); + } + + environment_.getLog().log(ILog.INFO, "command", 5001, this, "runCommand", "Execution status: " + message ); + } + } + } + + return status; + } + + private class CommandListEntry + { + public CommandListEntry( CommandFragment fragment, int parentIndex ) + { + fragment_ = fragment; + parentIndex_ = parentIndex; + fragmentStopped_ = false; + beforeExecute_ = true; + } + + public AbstractDataModelOperation command_; + public CommandFragment fragment_; + public int parentIndex_; + public boolean fragmentStopped_; + public boolean beforeExecute_; + } + } + + + diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/env/ant/PropertyDataHolder.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/env/ant/PropertyDataHolder.java new file mode 100644 index 000000000..07dbb1d98 --- /dev/null +++ b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/env/ant/PropertyDataHolder.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2005 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.command.env.ant; + +import java.util.Map; + +import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; + +public class PropertyDataHolder { + public AbstractDataModelOperation operation_; + public String transform_; + public String key_; + public String property_; + public String value_; + public Map map_; +} + diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/env/ant/String2PathTransformer.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/env/ant/String2PathTransformer.java new file mode 100644 index 000000000..75369c14c --- /dev/null +++ b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/env/ant/String2PathTransformer.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2005 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.command.env.ant; + +import org.eclipse.core.runtime.Path; +import org.eclipse.wst.command.internal.env.core.data.Transformer; + +public class String2PathTransformer implements Transformer { + + public Object transform(Object value) { + Path path = new Path(value.toString()); + return path; + } + +} + diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/env/ant/String2SelectionTransformer.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/env/ant/String2SelectionTransformer.java new file mode 100644 index 000000000..e28229f73 --- /dev/null +++ b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/env/ant/String2SelectionTransformer.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2005 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.command.env.ant; + +import org.eclipse.wst.command.internal.env.common.FileResourceUtils; +import org.eclipse.wst.command.internal.env.core.data.Transformer; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.viewers.StructuredSelection; + +public class String2SelectionTransformer implements Transformer { + + public Object transform(Object value) { + IResource resource = FileResourceUtils.getWorkspaceRoot().findMember(new Path(value.toString())); + StructuredSelection selection = new StructuredSelection(resource); + return selection; + } + +} |