[108595] Design facets into the Web services framework.
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 6f82010..bd5f93a 100644
--- a/bundles/org.eclipse.jst.ws.axis.creation.ui/plugin.xml
+++ b/bundles/org.eclipse.jst.ws.axis.creation.ui/plugin.xml
@@ -11,6 +11,7 @@
</serverDefaulter>
</extension>
+ <!--
<extension point="org.eclipse.jst.ws.consumption.ui.webServiceRuntime">
<webServiceRuntime
id="org.eclipse.jst.ws.axis.creation.axisWebServiceRT"
@@ -23,7 +24,8 @@
class="org.eclipse.jst.ws.internal.axis.creation.ui.wsrt.AxisWebServiceRuntime">
</webServiceRuntime>
</extension>
-
+ -->
+
<extension point="org.eclipse.wst.command.env.ui.widgetRegistry">
<widgetFactory
id="AxisBeanConfig"
@@ -37,5 +39,40 @@
insertBeforeCommandId="org.eclipse.jst.ws.internal.axis.creation.ui.task.TDCheckAxisDeploymentDescriptors"
class="org.eclipse.jst.ws.internal.axis.creation.ui.wsrt.AxisSkeletonConfigWidgetFactory"/>
</extension>
+
+ <!-- M9 extensions -->
+ <extension point="org.eclipse.jst.ws.consumption.ui.runtimes">
+ <runtime
+ id="org.eclipse.jst.ws.axis.creation.axisWebServiceRT"
+ label="%LABEL_RUNTIME_AXIS_11"/>
+ </extension>
+
+ <!-- define support for Axis Java bean bottom up and top-down support in web projects -->
+ <extension point="org.eclipse.jst.ws.consumption.ui.serviceRuntimes">
+ <serviceRuntime
+ id="org.eclipse.jst.ws.axis.creation.java"
+ serviceImplementationTypeId="org.eclipse.jst.ws.wsImpl.java"
+ runtimeId="org.eclipse.jst.ws.axis.creation.axisWebServiceRT"
+ bottomUp="true"
+ topDown="true"
+ class="org.eclipse.jst.ws.internal.axis.creation.ui.wsrt.AxisWebServiceRuntime">
+
+ <required-facet-version facet="jst.web" version="2.3" allow-newer="true"/>
+
+ </serviceRuntime>
+ </extension>
+
+ <!-- define support for Axis Java clients in Java projects -->
+ <extension point="org.eclipse.jst.ws.consumption.ui.clientRuntimes">
+ <clientRuntime
+ id="org.eclipse.jst.ws.axis.consumption.java"
+ clientImplementationTypeId="org.eclipse.jst.ws.client.type.java"
+ runtimeId="org.eclipse.jst.ws.axis.creation.axisWebServiceRT"
+ class="org.eclipse.jst.ws.internal.axis.creation.ui.wsrt.AxisWebServiceRuntime">
+
+ <required-facet-version facet="jst.java" version="1.3" allow-newer="true"/>
+
+ </clientRuntime>
+ </extension>
</plugin>
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/TDAxisInputCommand.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/TDAxisInputCommand.java
index 4ce4cf3..4110eb0 100644
--- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/TDAxisInputCommand.java
+++ b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/TDAxisInputCommand.java
@@ -25,6 +25,7 @@
private String serverProject_;
private String serverServer_;
+ private String serviceServerTypeID_;
private String wsdlURI_;
/**
@@ -40,7 +41,8 @@
public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable )
{
- serverServer_ = ws_.getWebServiceInfo().getServerInstanceId();
+ serverServer_ = ws_.getWebServiceInfo().getServerInstanceId();
+ serviceServerTypeID_ = ws_.getWebServiceInfo().getServerFactoryId();
wsdlURI_ = ws_.getWebServiceInfo().getWsdlURL();
return Status.OK_STATUS;
@@ -58,6 +60,11 @@
{
return serverServer_;
}
+
+ public String getServiceServerTypeID()
+ {
+ return serviceServerTypeID_;
+ }
public String getWsdlURI() {
return wsdlURI_;
diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/task/DefaultsForServerJavaWSDLCommand.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/task/DefaultsForServerJavaWSDLCommand.java
index 9840b92..f63ae0e 100644
--- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/task/DefaultsForServerJavaWSDLCommand.java
+++ b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/task/DefaultsForServerJavaWSDLCommand.java
@@ -50,6 +50,7 @@
private String WSDLServiceURL_;
private String WSDLServicePathname_;
private WebServicesParser WSParser_;
+ private String serviceServerTypeID_;
private final String WSDL_FOLDER = "wsdl"; //$NON-NLS-1$
public final String SERVICE_EXT = "/services/"; //$NON-NLS-1$
@@ -175,7 +176,7 @@
javaWSDLParam_.setStyle(JavaWSDLParameter.STYLE_WRAPPED);
javaWSDLParam_.setUse(JavaWSDLParameter.USE_LITERAL);
- String projectURL = ServerUtils.getEncodedWebComponentURL(serviceProject_);
+ String projectURL = ServerUtils.getEncodedWebComponentURL(serviceProject_, serviceServerTypeID_);
if (projectURL == null) {
status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_PROJECT_URL"));
environment.getStatusHandler().reportError(status);
@@ -259,5 +260,10 @@
if (object instanceof String)
setJavaBeanName((String)object);
}
- }
+ }
+
+ public void setServiceServerTypeID(String id)
+ {
+ serviceServerTypeID_ = id;
+ }
}
diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/task/MoveDeploymentFilesTask.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/task/MoveDeploymentFilesTask.java
index 3670616..e008c90 100644
--- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/task/MoveDeploymentFilesTask.java
+++ b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/task/MoveDeploymentFilesTask.java
@@ -33,6 +33,7 @@
private MessageUtils msgUtils_;
private MessageUtils coreMsgUtils_;
private IProject serverProject;
+ private String serviceServerTypeID_;
private JavaWSDLParameter javaWSDLParam_;
@@ -58,7 +59,7 @@
IProject project = serverProject;
//String projectURL = ResourceUtils.getEncodedWebProjectURL(project);
- String projectURL = ServerUtils.getEncodedWebComponentURL(project);
+ String projectURL = ServerUtils.getEncodedWebComponentURL(project, serviceServerTypeID_);
if (projectURL == null) {
status = StatusUtils.errorStatus(msgUtils_.getMessage("MSG_ERROR_PROJECT_URL",new String[] { project.toString()}));
@@ -112,4 +113,9 @@
{
this.serverProject = serverProject;
}
+
+ public void setServiceServerTypeID(String id)
+ {
+ serviceServerTypeID_ = id;
+ }
}
diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/task/MoveJavaFilesTask.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/task/MoveJavaFilesTask.java
index de75da8..172a426 100644
--- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/task/MoveJavaFilesTask.java
+++ b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/task/MoveJavaFilesTask.java
@@ -31,6 +31,7 @@
private MessageUtils msgUtils_;
private MessageUtils coreMsgUtils_;
private IProject serviceProject_;
+ private String serviceServerTypeID_;
// rm private Model model_;
@@ -64,7 +65,7 @@
IProject project = serviceProject_;
//String projectURL = ResourceUtils.getEncodedWebProjectURL(project);
- String projectURL = ServerUtils.getEncodedWebComponentURL(project);
+ String projectURL = ServerUtils.getEncodedWebComponentURL(project, serviceServerTypeID_);
if (projectURL == null) {
status = StatusUtils.errorStatus(msgUtils_.getMessage("MSG_ERROR_PROJECT_URL",new String[] {project.toString()}));
environment.getStatusHandler().reportError(status);
@@ -126,4 +127,9 @@
model_ = model;
}
*/
+
+ public void setServiceServerTypeID(String id)
+ {
+ serviceServerTypeID_ = id;
+ }
}
diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/task/Skeleton2WSDLCommand.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/task/Skeleton2WSDLCommand.java
index 669f77a..a4e160e 100644
--- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/task/Skeleton2WSDLCommand.java
+++ b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/task/Skeleton2WSDLCommand.java
@@ -57,6 +57,7 @@
private WebServicesParser webServicesParser;
private JavaWSDLParameter javaWSDLParam;
private IProject serverProject;
+ private String serviceServerTypeID_;
private MessageUtils msgUtils_;
public Skeleton2WSDLCommand( ) {
@@ -218,7 +219,7 @@
if (soapAddress != null)
{
// String projectURL = ResourceUtils.getEncodedWebProjectURL(serverProject);
- String projectURL = ServerUtils.getEncodedWebComponentURL(serverProject);
+ String projectURL = ServerUtils.getEncodedWebComponentURL(serverProject, serviceServerTypeID_);
if (projectURL == null)
return StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_PROJECT_URL", new String[] {serverProject.toString()}));
StringBuffer serviceURL = new StringBuffer(projectURL);
@@ -276,5 +277,10 @@
catch(MalformedURLException mue){}
return url;
}
+
+ public void setServiceServerTypeID(String id)
+ {
+ serviceServerTypeID_ = id;
+ }
}
diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/task/UpdateAxisWSDDFileTask.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/task/UpdateAxisWSDDFileTask.java
index 8b44e49..18bb333 100644
--- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/task/UpdateAxisWSDDFileTask.java
+++ b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/task/UpdateAxisWSDDFileTask.java
@@ -48,6 +48,7 @@
private MessageUtils coreMsgUtils_;
private JavaWSDLParameter javaWSDLParam_;
private IProject serviceProject_;
+ private String serviceServerTypeID_;
public UpdateAxisWSDDFileTask()
{
@@ -79,7 +80,7 @@
IProject project = serviceProject_;
//String projectURL = ResourceUtils.getEncodedWebProjectURL(project);
- String projectURL = ServerUtils.getEncodedWebComponentURL(project);
+ String projectURL = ServerUtils.getEncodedWebComponentURL(project, serviceServerTypeID_);
if (projectURL == null) {
status = StatusUtils.errorStatus(msgUtils_.getMessage("MSG_ERROR_PROJECT_URL",new String[] {project.toString()}));
environment.getStatusHandler().reportError(status);
@@ -198,5 +199,9 @@
{
model_ = model;
}
- */
+ */
+ public void setServiceServerTypeID(String id)
+ {
+ serviceServerTypeID_ = id;
+ }
}
diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/wsrt/AxisWebService.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/wsrt/AxisWebService.java
index 852909f..1c2c23d 100644
--- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/wsrt/AxisWebService.java
+++ b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/wsrt/AxisWebService.java
@@ -174,6 +174,7 @@
//DefaultsForServerJavaWSDLCommand
registry.addMapping(BUAxisDefaultingCommand.class, "JavaWSDLParam", DefaultsForServerJavaWSDLCommand.class);
registry.addMapping(BUAxisInputCommand.class, "ServerProject", DefaultsForServerJavaWSDLCommand.class, "ServiceProject", new StringToIProjectTransformer());
+ registry.addMapping(BUAxisInputCommand.class, "ServiceServerTypeID", DefaultsForServerJavaWSDLCommand.class);
registry.addMapping(BUAxisDefaultingCommand.class, "JavaBeanName", DefaultsForServerJavaWSDLCommand.class);
registry.addMapping(BUAxisDefaultingCommand.class, "Parser", DefaultsForServerJavaWSDLCommand.class);
@@ -203,10 +204,12 @@
//MoveJavaFilesTask
registry.addMapping(WSDL2JavaCommand.class, "JavaWSDLParam", MoveJavaFilesTask.class);
registry.addMapping(BUAxisInputCommand.class, "ServerProject", MoveJavaFilesTask.class, "ServiceProject", new StringToIProjectTransformer());
+ registry.addMapping(BUAxisInputCommand.class, "ServiceServerTypeID", MoveJavaFilesTask.class);
//UpdateAxisWSDDFileTask
registry.addMapping(MoveJavaFilesTask.class, "JavaWSDLParam", UpdateAxisWSDDFileTask.class);
registry.addMapping(BUAxisInputCommand.class, "ServerProject", UpdateAxisWSDDFileTask.class, "ServiceProject", new StringToIProjectTransformer());
+ registry.addMapping(BUAxisInputCommand.class, "ServiceServerTypeID", UpdateAxisWSDDFileTask.class);
//UpdateWEBXMLCommand
registry.addMapping(BUAxisInputCommand.class, "ServerProject", UpdateWEBXMLCommand.class, "ServerProject", new StringToIProjectTransformer());
@@ -277,6 +280,7 @@
// MoveDeploymentFilesTask
dataRegistry.addMapping(TDAxisInputCommand.class, "ServerProject", MoveDeploymentFilesTask.class, "ServerProject", projectTransformer);
+ dataRegistry.addMapping(TDAxisInputCommand.class, "ServiceServerTypeID", MoveDeploymentFilesTask.class);
dataRegistry.addMapping(WSDL2JavaCommand.class, "JavaWSDLParam", MoveDeploymentFilesTask.class);
// CopyAxisJarCommand
@@ -285,6 +289,7 @@
// Skeleton2WSDLCommand
dataRegistry.addMapping(AxisSkeletonDefaultingCommand.class, "WebServicesParser", Skeleton2WSDLCommand.class);
dataRegistry.addMapping(TDAxisInputCommand.class, "ServerProject", Skeleton2WSDLCommand.class, "ServerProject", projectTransformer);
+ dataRegistry.addMapping(TDAxisInputCommand.class, "ServiceServerTypeID", Skeleton2WSDLCommand.class);
dataRegistry.addMapping(WSDL2JavaCommand.class, "JavaWSDLParam", Skeleton2WSDLCommand.class);
// UpdateWEBXMLCommand
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 2e5bcdf..51386b2 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
@@ -67,5 +67,6 @@
org.eclipse.jem.util,
org.eclipse.wst.wsdl.validation,
org.eclipse.wst.common.frameworks.ui,
- org.eclipse.wst.common.environment
+ org.eclipse.wst.common.environment,
+ org.eclipse.wst.common.project.facet.core
Eclipse-AutoStart: true
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/plugin.xml b/bundles/org.eclipse.jst.ws.consumption.ui/plugin.xml
index 84a767c..e24fa09 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/plugin.xml
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/plugin.xml
@@ -584,7 +584,6 @@
id="wsilimport">
</action>
</objectContribution>
-
</extension>
<!-- Object Selection Widgets -->
@@ -616,15 +615,23 @@
</objectSelectionWidget>
</extension>
- <!-- New extension points for WTP M4 -->
+
<extension-point id="wsImpl" name="Web service implementations"/>
<extension-point id="wsClientImpl" name="Web service client implementations"/>
+
+ <!-- serviceType, clientType, and webServiceRuntime are to be deleted in WTP 1.0 M9 -->
<extension-point id="serviceType" name="Extensions that provide unique combinations of service implementations, scenarios, and module types "/>
<extension-point id="clientType" name="Extensions that provide unique combinations of client implementations and module types"/>
<extension-point id="webServiceRuntime" name="Web service runtimes"/>
+
+
+ <extension-point id="runtimes" name="Web service runtimes" />
+ <extension-point id="serviceRuntimes" name="Combination of a Web service runime, service implementation type, and required facets" />
+ <extension-point id="clientRuntimes" name="Combination of a Web service runime, client implementation type, and required facets" />
+
<extension-point id="tester" name="Web service test facilities"/>
-<!-- M4 Extensions to the new extension points -->
+
<!-- Test Extensions beginning -->
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/consumption/ui/plugin.properties b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/consumption/ui/plugin.properties
index 376ed9f..e3855f8 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/consumption/ui/plugin.properties
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/consumption/ui/plugin.properties
@@ -193,7 +193,8 @@
PAGE_DESC_WS_CLIENT_RUNTIME_SELECTION=Choose from the list of supported runtimes and servers for the client environment, or use the default settings.
LABEL_CLIENT_SELECTION_VIEW_TITLE=Client-Side Environment Selection:
-LABEL_CLIENT_TYPE=Client type:
+LABEL_CLIENT_TYPE=Client Project type:
+LABEL_SERVICE_TYPE=Service Project type:
LABEL_WEB=Web
LABEL_EJB=EJB
LABEL_NO_LABEL=
@@ -362,7 +363,8 @@
#
# Tooltips for WebServiceClientRuntimeSelectionPage
#
-TOOLTIP_PWCR_COMBO_CLIENT_TYPE=Client type.
+TOOLTIP_PWCR_COMBO_CLIENT_TYPE=Client project type.
+TOOLTIP_PWCR_COMBO_SERVICE_TYPE=Service project type.
#
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/CheckForServiceProjectCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/CheckForServiceProjectCommand.java
index 08da92c..9b4f995 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/CheckForServiceProjectCommand.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/CheckForServiceProjectCommand.java
@@ -33,7 +33,8 @@
public class CheckForServiceProjectCommand extends AbstractDataModelOperation
{
MessageUtils msgUtils;
- SelectionListChoices runtime2ClientTypes;
+ //SelectionListChoices runtime2ClientTypes;
+ String clientProjectName;
String wsdlURI;
WebServicesParser webServicesParser;
@@ -43,9 +44,10 @@
msgUtils = new MessageUtils(pluginId + ".plugin", this);
}
- public void setRuntime2ClientTypes( SelectionListChoices runtime2ClientTypes )
+
+ public void setClientProjectName(String name)
{
- this.runtime2ClientTypes = runtime2ClientTypes;
+ clientProjectName = name;
}
public void setWsdlURI(String wsdlURI)
@@ -66,10 +68,9 @@
{
Environment environment = getEnvironment();
IStatus status = Status.OK_STATUS;
- if (runtime2ClientTypes==null || wsdlURI==null || wsdlURI.length()==0 || webServicesParser==null)
+ if (clientProjectName==null || wsdlURI==null || wsdlURI.length()==0 || webServicesParser==null)
return status;
- String clientProjectName = runtime2ClientTypes.getChoice().getChoice().getList().getSelection();
if (clientProjectName==null || clientProjectName.length()==0)
return status;
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/FacetMatcher.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/FacetMatcher.java
new file mode 100644
index 0000000..0ddcefb
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/FacetMatcher.java
@@ -0,0 +1,42 @@
+package org.eclipse.jst.ws.internal.consumption.ui.common;
+
+import java.util.Set;
+
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+public class FacetMatcher
+{
+ private boolean match;
+ private Set facetsThatMatched;
+ private Set facetsToAdd;
+
+ public Set getFacetsThatMatched()
+ {
+ return facetsThatMatched;
+ }
+ public void setFacetsThatMatched(Set facetsThatMatched)
+ {
+ this.facetsThatMatched = facetsThatMatched;
+ }
+ public Set getFacetsToAdd()
+ {
+ return facetsToAdd;
+ }
+ public void setFacetsToAdd(Set facetsToAdd)
+ {
+ this.facetsToAdd = facetsToAdd;
+ }
+ public boolean isMatch()
+ {
+ return match;
+ }
+ public void setMatch(boolean match)
+ {
+ this.match = match;
+ }
+
+
+
+
+
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/FacetUtils.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/FacetUtils.java
new file mode 100644
index 0000000..c03684e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/FacetUtils.java
@@ -0,0 +1,253 @@
+package org.eclipse.jst.ws.internal.consumption.ui.common;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.RequiredFacetVersion;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action.Type;
+
+public class FacetUtils
+{
+
+ /**
+ * Returns a list of valid projects. Valid projects include projects with the facets nature or
+ * projects with the Java nature.
+ * @return IProject[] an array of valid projects
+ */
+ public static IProject[] getAllProjects()
+ {
+ //Return all projects in the workspace that have the project facet nature or that do not have the project
+ //facet nature but have the Java nature.
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ ArrayList validProjects = new ArrayList();
+ for (int i = 0; i < projects.length; i++)
+ {
+ try
+ {
+ IFacetedProject facProject = ProjectFacetsManager.create(projects[i]);
+ if (facProject != null)
+ {
+ //Add it to the list
+ validProjects.add(projects[i]);
+ }
+ else
+ {
+ //Check if it's a Java project
+ IJavaProject javaProject = null;
+ javaProject = JavaCore.create(projects[i]);
+ if (javaProject != null)
+ {
+ //Add it to the list
+ validProjects.add(projects[i]);
+ }
+ }
+ }
+ catch (CoreException ce)
+ {
+ }
+ }
+ return (IProject[])validProjects.toArray(new IProject[]{});
+ }
+
+ public static Set getTemplates(RequiredFacetVersion[] requiredFacetVersions)
+ {
+
+ //Get the templates that support the actions
+ Set templates = new HashSet();
+
+ for( Iterator itr = ProjectFacetsManager.getTemplates().iterator(); itr.hasNext(); )
+ {
+ final IFacetedProjectTemplate template = (IFacetedProjectTemplate) itr.next();
+ //TODO final Set initial = template.getInitialProjectFacets();
+ Set fixedFacets = template.getFixedProjectFacets();
+ HashSet initial = new HashSet();
+ for (Iterator itr2 = fixedFacets.iterator(); itr2.hasNext(); )
+ {
+ IProjectFacet facet = (IProjectFacet) itr2.next();
+ IProjectFacetVersion highestFacetVersion = facet.getLatestVersion();
+ initial.add(highestFacetVersion);
+ }
+
+ FacetMatcher fm = match(requiredFacetVersions, initial);
+ if (fm.isMatch())
+ {
+ templates.add(template);
+ }
+ }
+
+ return templates;
+
+ }
+
+ public static String[] getTemplateLabels(String[] templateIds)
+ {
+ String[] labels = new String[templateIds.length];
+ for (int i=0; i<templateIds.length; i++)
+ {
+ IFacetedProjectTemplate template = ProjectFacetsManager.getTemplate(templateIds[i]);
+ labels[i] = template.getLabel();
+ }
+ return labels;
+
+ }
+
+ public static String getTemplateIdByLabel(String templateLabel)
+ {
+ for( Iterator itr = ProjectFacetsManager.getTemplates().iterator(); itr.hasNext(); )
+ {
+ final IFacetedProjectTemplate template = (IFacetedProjectTemplate) itr.next();
+ if (template.getLabel().equals(templateLabel))
+ {
+ return template.getId();
+
+ }
+ }
+
+ return "";
+ }
+
+ public static Set getInstallActions(Set projectFacetVersions)
+ {
+ HashSet actions = new HashSet();
+
+ Iterator facets = projectFacetVersions.iterator();
+
+ while(facets.hasNext())
+ {
+ IProjectFacetVersion fv = (IProjectFacetVersion)facets.next();
+ Action action = new Action(Type.INSTALL, fv, null);
+ actions.add(action);
+ }
+
+ return actions;
+ }
+
+ public static FacetMatcher match(RequiredFacetVersion[] requiredFacetVersions, Set projectFacetVersions)
+ {
+ FacetMatcher fm = new FacetMatcher();
+ HashSet facetsToAdd = new HashSet();
+ HashSet facetsThatMatched = new HashSet();
+ for (int i=0; i<requiredFacetVersions.length; i++)
+ {
+ RequiredFacetVersion rfv = requiredFacetVersions[i];
+ IProjectFacetVersion rpfv = rfv.getProjectFacetVersion();
+ String rid = rpfv.getProjectFacet().getId();
+ String rv = rpfv.getVersionString();
+ boolean facetPresent = false;
+
+ //Is the project facet present? or a later version of applicable.
+ Iterator itr = projectFacetVersions.iterator();
+ while(itr.hasNext())
+ {
+ IProjectFacetVersion pfv = (IProjectFacetVersion)itr.next();
+ String id = pfv.getProjectFacet().getId();
+ String version = pfv.getVersionString();
+ if (rid.equals(id))
+ {
+ if (rv.equals(version))
+ {
+ //found an exact match
+ facetPresent = true;
+ facetsThatMatched.add(pfv);
+ }
+ else
+ {
+ if (rfv.getAllowNewer())
+ {
+ if (greaterThan(version, rv))
+ {
+ //found a match
+ facetPresent = true;
+ facetsThatMatched.add(pfv);
+ }
+ }
+ }
+ //No need to keep iterating since we hit a facet with the same id;
+ break;
+ }
+ }
+
+ //if not present, put it in the list to check if it can be added.
+ if (!facetPresent)
+ {
+ facetsToAdd.add(rpfv);
+ }
+
+ }
+
+ //Check if the facetsToAdd can be added
+ if (facetsToAdd.size() > 0)
+ {
+ Set actions = getInstallActions(facetsToAdd);
+ if( ProjectFacetsManager.check( projectFacetVersions, actions ).getSeverity() == IStatus.OK )
+ {
+ //Facets can be added so there is a match
+ fm.setMatch(true);
+ fm.setFacetsThatMatched(facetsThatMatched);
+ fm.setFacetsToAdd(facetsToAdd);
+ }
+ else
+ {
+ fm.setMatch(false);
+ }
+ }
+ else
+ {
+ //Facets can be added so there is a match
+ fm.setMatch(true);
+ fm.setFacetsThatMatched(facetsThatMatched);
+ fm.setFacetsToAdd(facetsToAdd);
+ }
+
+ return fm;
+ }
+
+ /*
+ * @param versionA version number of the form 1.2.3
+ * @param versionA version number of the form 1.2.3
+ * @return boolean returns whether versionA is greater than versionB
+ */
+ private static boolean greaterThan(String versionA, String versionB)
+ {
+ StringTokenizer stA = new StringTokenizer(versionA, ".");
+ StringTokenizer stB = new StringTokenizer(versionB, ".");
+
+ int sizeA = stA.countTokens();
+ int sizeB = stB.countTokens();
+
+ int size;
+ if (sizeA < sizeB)
+ {
+ size = sizeA;
+ }
+ else
+ size = sizeB;
+
+ for (int i=0; i<size; i++)
+ {
+ int a = Integer.parseInt(stA.nextToken());
+ int b = Integer.parseInt(stB.nextToken());
+ if (a!=b)
+ {
+ return a > b;
+ }
+ }
+
+ return sizeA > sizeB;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientDevelopCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientDevelopCommand.java
index 468d2bb..7936b45 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientDevelopCommand.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientDevelopCommand.java
@@ -16,7 +16,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jst.ws.internal.consumption.command.common.CreateModuleCommand;
-import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
import org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext;
import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
@@ -42,6 +42,7 @@
*/
private TypeRuntimeServer typeRuntimeServer_;
+ private String clientRuntimeId_;
private IContext context_;
private ISelection selection_;
private String project_;
@@ -76,8 +77,8 @@
}
}
- IWebServiceRuntime wsrt = WebServiceRuntimeExtensionUtils
- .getWebServiceRuntime(typeRuntimeServer_.getRuntimeId());
+ IWebServiceRuntime wsrt = WebServiceRuntimeExtensionUtils2
+ .getClientRuntime(clientRuntimeId_);
WebServiceClientInfo wsInfo = new WebServiceClientInfo();
System.out.println("In Pre client develop command.");
@@ -154,6 +155,11 @@
typeRuntimeServer_ = typeRuntimeServer;
}
+ public void setClientRuntimeId( String id)
+ {
+ clientRuntimeId_ = id;
+ }
+
public void setClientJ2EEVersion( String j2eeLevel )
{
j2eeLevel_ = j2eeLevel;
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ServerRuntimePreferencePage.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ServerRuntimePreferencePage.java
index b2abb86..dc8fa1a 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ServerRuntimePreferencePage.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ServerRuntimePreferencePage.java
@@ -15,7 +15,7 @@
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jst.ws.internal.common.J2EEUtils;
import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin;
-import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
import org.eclipse.jst.ws.internal.ui.common.UIUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -93,8 +93,7 @@
private void initializeValues()
{
PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext();
- //serverToRuntimeToJ2EE_ = WebServiceServerRuntimeTypeRegistry.getInstance().getServerToRuntimeToJ2EE();
- serverToRuntimeToJ2EE_ = WebServiceRuntimeExtensionUtils.getServerToRuntimeToJ2EE();
+ serverToRuntimeToJ2EE_ = WebServiceRuntimeExtensionUtils2.getServerToRuntimeToJ2EE();
setServerItems(serverToRuntimeToJ2EE_.getList().getList());
@@ -268,7 +267,7 @@
for (int i=0;i<factoryIds.length;i++)
{
//String thisServerLabel = WebServiceServerRuntimeTypeRegistry.getInstance().getServerLabel(factoryIds[i]);
- String thisServerLabel = WebServiceRuntimeExtensionUtils.getServerLabelById(factoryIds[i]);
+ String thisServerLabel = WebServiceRuntimeExtensionUtils2.getServerLabelById(factoryIds[i]);
if (thisServerLabel!=null && thisServerLabel.length()>0)
{
serverLabelsList.add(thisServerLabel);
@@ -289,7 +288,7 @@
for (int i=0;i<ids.length;i++)
{
//runtimeLabels[i] = WebServiceServerRuntimeTypeRegistry.getInstance().getRuntimeLabel(ids[i]);
- runtimeLabels[i] = WebServiceRuntimeExtensionUtils.getRuntimeLabelById(ids[i]);
+ runtimeLabels[i] = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(ids[i]);
}
runtime_.setItems(runtimeLabels);
}
@@ -324,14 +323,14 @@
{
String serverLabel = server_.getText();
//return WebServiceServerRuntimeTypeRegistry.getInstance().getServerFactoryId(serverLabel);
- return WebServiceRuntimeExtensionUtils.getServerFactoryId(serverLabel);
+ return WebServiceRuntimeExtensionUtils2.getServerFactoryId(serverLabel);
}
private String getRuntimeSelection()
{
String runtimeLabel = runtime_.getText();
//return WebServiceServerRuntimeTypeRegistry.getInstance().getRuntimeId(runtimeLabel);
- return WebServiceRuntimeExtensionUtils.getRuntimeId(runtimeLabel);
+ return WebServiceRuntimeExtensionUtils2.getRuntimeId(runtimeLabel);
}
private String getJ2EESelection()
@@ -343,14 +342,14 @@
private void setServerSelection(String factoryId)
{
//String label = WebServiceServerRuntimeTypeRegistry.getInstance().getServerLabel(factoryId);
- String label = WebServiceRuntimeExtensionUtils.getServerLabelById(factoryId);
+ String label = WebServiceRuntimeExtensionUtils2.getServerLabelById(factoryId);
setSelection(server_,label);
}
private void setRuntimeSelection(String id)
{
//String label = WebServiceServerRuntimeTypeRegistry.getInstance().getRuntimeLabel(id);
- String label = WebServiceRuntimeExtensionUtils.getRuntimeLabelById(id);
+ String label = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(id);
setSelection(runtime_,label);
}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidgetDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidgetDefaultingCommand.java
index 29b4885..56bf0ae 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidgetDefaultingCommand.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidgetDefaultingCommand.java
@@ -15,7 +15,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
import org.eclipse.jst.ws.internal.context.ScenarioContext;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
import org.eclipse.jst.ws.internal.plugin.WebServicePlugin;
@@ -55,9 +55,9 @@
//WebServiceClientTypeRegistry registry = WebServiceClientTypeRegistry.getInstance();
String type = getScenarioContext().getClientWebServiceType();
//String runtime = registry.getAllClientRuntimes()[0];
- String runtime = WebServiceRuntimeExtensionUtils.getAllClientRuntimes()[0];
+ String runtime = WebServiceRuntimeExtensionUtils2.getAllRuntimesForClientSide()[0];
//String server = registry.getAllClientServerFactoryIds()[0];
- String server = WebServiceRuntimeExtensionUtils.getAllClientServerFactoryIds()[0];
+ String server = WebServiceRuntimeExtensionUtils2.getAllClientServerFactoryIds()[0];
TypeRuntimeServer result = new TypeRuntimeServer();
// rskreg
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WebServiceClientTypeWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WebServiceClientTypeWidget.java
index d0e1d20..6b149bf 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WebServiceClientTypeWidget.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WebServiceClientTypeWidget.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.jst.ws.internal.consumption.ui.widgets;
-import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
import org.eclipse.jst.ws.internal.data.LabelsAndIds;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
import org.eclipse.jst.ws.internal.ui.common.UIUtils;
@@ -74,7 +74,7 @@
// rskreg
//WebServiceClientTypeRegistry registry = WebServiceClientTypeRegistry.getInstance();
//LabelsAndIds labelIds = registry.getClientTypeLabels();
- LabelsAndIds labelIds = WebServiceRuntimeExtensionUtils.getClientTypeLabels();
+ LabelsAndIds labelIds = WebServiceRuntimeExtensionUtils2.getClientTypeLabels();
int selection = 0;
String[] clientIds = labelIds.getIds_();
String selectedId = ids.getTypeId();
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ClientWidgetBinding.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ClientWidgetBinding.java
index 83941f9..0625116 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ClientWidgetBinding.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ClientWidgetBinding.java
@@ -97,20 +97,25 @@
// Before ClientRuntimeSelectionWidget
dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientTypeRuntimeServer", ClientRuntimeSelectionWidget.class);
- dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientJ2EEVersion", ClientRuntimeSelectionWidget.class, "J2EEVersion", null);
- dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "Runtime2ClientTypes", ClientRuntimeSelectionWidget.class);
- dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentName", ClientRuntimeSelectionWidget.class);
- dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarComponentName", ClientRuntimeSelectionWidget.class);
+ dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientRuntimeId", ClientRuntimeSelectionWidget.class);
+ dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientProjectName", ClientRuntimeSelectionWidget.class);
+ dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", ClientRuntimeSelectionWidget.class);
+ dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentType", ClientRuntimeSelectionWidget.class);
+ //dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientJ2EEVersion", ClientRuntimeSelectionWidget.class, "J2EEVersion", null);
+ //dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "Runtime2ClientTypes", ClientRuntimeSelectionWidget.class);
+ //dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentName", ClientRuntimeSelectionWidget.class);
+ //dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarComponentName", ClientRuntimeSelectionWidget.class);
dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientNeedEAR", ClientRuntimeSelectionWidget.class,"NeedEAR",null);
// After ClientRuntimeSelectionWidget
dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "ClientTypeRuntimeServer", ClientExtensionDefaultingCommand.class);
- dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "J2EEVersion", ClientExtensionDefaultingCommand.class, "ClientJ2EEVersion", null);
- dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "Runtime2ClientTypes", ClientExtensionDefaultingCommand.class);
+ dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "ClientRuntimeId", ClientExtensionDefaultingCommand.class);
+ //dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "J2EEVersion", ClientExtensionDefaultingCommand.class, "ClientJ2EEVersion", null);
+ //dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "Runtime2ClientTypes", ClientExtensionDefaultingCommand.class);
dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "ClientProjectName", ClientExtensionDefaultingCommand.class);
dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "ClientEarProjectName", ClientExtensionDefaultingCommand.class);
- dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "ClientComponentName", ClientExtensionDefaultingCommand.class);
- dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "ClientEarComponentName", ClientExtensionDefaultingCommand.class);
+ //dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "ClientComponentName", ClientExtensionDefaultingCommand.class);
+ //dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "ClientEarComponentName", ClientExtensionDefaultingCommand.class);
dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "ClientComponentType", ClientExtensionDefaultingCommand.class);
dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "ClientNeedEAR", ClientExtensionDefaultingCommand.class);
@@ -264,15 +269,16 @@
// Map ClientRuntimeSelectionWidgetDefaultingCommand command
dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientTypeRuntimeServer", ClientExtensionDefaultingCommand.class);
- dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "Runtime2ClientTypes", 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, "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, "ClientJ2EEVersion", ClientExtensionDefaultingCommand.class);
dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientNeedEAR", ClientExtensionDefaultingCommand.class);
- dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "Runtime2ClientTypes", CheckForServiceProjectCommand.class);
+ dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientProjectName", CheckForServiceProjectCommand.class);
// Map WSDLSelectionWidgetDefaultingCommand command.
dataRegistry.addMapping(SelectionCommand.class, "InitialSelection", WSDLSelectionWidgetDefaultingCommand.class );
@@ -289,7 +295,7 @@
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, "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);
@@ -306,6 +312,7 @@
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( ClientExtensionDefaultingCommand.class, "ClientRuntimeId", PreClientDevelopCommand.class );
dataRegistry.addMapping( PreClientDevelopCommand.class, "WebService", ClientExtensionOutputCommand.class, "WebServiceClient", null );
@@ -320,7 +327,7 @@
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, "ClientEarProjectName", ClientTestDelegateCommand.class,"ClientEarComponentName", null);
dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProject",ClientTestDelegateCommand.class);
dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientTypeRuntimeServer", ClientTestDelegateCommand.class);
dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientServer", ClientTestDelegateCommand.class);
@@ -360,45 +367,45 @@
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, "ClientProjectName", 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, "ClientEarProjectName", 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, "ClientProjectName", 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, "ClientEarProjectName", 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, "ClientProjectName", 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, "ClientEarProjectName", 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, "ClientProjectName", 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, "ClientEarProjectName", 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, "ClientProjectName", RunClientFragment.class, "Module", null );
dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", RunClientFragment.class, "EarProject", null );
- dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarComponentName", RunClientFragment.class, "Ear", null );
+ dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", RunClientFragment.class, "Ear", null );
}
}
}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/GenSampleWidgetBinding.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/GenSampleWidgetBinding.java
index 5ced295..7629826 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/GenSampleWidgetBinding.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/GenSampleWidgetBinding.java
@@ -318,13 +318,13 @@
// Map ClientRuntimeSelectionWidgetDefaultingCommand command
dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientTypeRuntimeServer", ClientExtensionDefaultingCommand.class);
- dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "Runtime2ClientTypes", 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, "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, "ClientJ2EEVersion", ClientExtensionDefaultingCommand.class);
// Map WSDLSelectionWidgetDefaultingCommand command.
dataRegistry.addMapping(SelectionCommand.class, "InitialSelection", WSDLSelectionWidgetDefaultingCommand.class );
@@ -344,7 +344,7 @@
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, "ClientEarProjectName", ClientTestDelegateCommand.class,"ClientEarComponentName",null);
dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProject",ClientTestDelegateCommand.class);
dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientTypeRuntimeServer", ClientTestDelegateCommand.class);
dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ServiceServerInstanceId", FinishDefaultCommand.class);
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionDefaultingCommand.java
index 1f46b5f..4915b37 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionDefaultingCommand.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionDefaultingCommand.java
@@ -27,17 +27,18 @@
{
// ClientWizardWidget
private TypeRuntimeServer clientIds_;
+ private String clientRuntimeId_;
private Boolean testService;
private ResourceContext resourceContext;
// ClientRuntimeSelectionWidget
- private SelectionListChoices clientChoices_;
+ //private SelectionListChoices clientChoices_;
private String clientProjectName_;
private String clientEarProjectName_;
- private String clientComponentName_;
- private String clientEarComponentName_;
+ //private String clientComponentName_;
+ //private String clientEarComponentName_;
private String clientComponentType_;
- private String j2eeVersion;
+ //private String j2eeVersion;
private boolean clientNeedEAR_;
private String serviceServerFactoryId_;
@@ -75,17 +76,18 @@
return isClientScenario_;
}
-
+ /*
public void setRuntime2ClientTypes( SelectionListChoices choices )
{
clientChoices_ = choices;
}
+
public SelectionListChoices getRuntime2ClientTypes()
{
return clientChoices_;
}
-
+ */
public void setClientTypeRuntimeServer(TypeRuntimeServer ids)
{
@@ -111,6 +113,16 @@
return clientIds_;
}
+ public void setClientRuntimeId(String id)
+ {
+ clientRuntimeId_ = id;
+ }
+
+ public String getClientRuntimeId()
+ {
+ return clientRuntimeId_;
+ }
+
public void setServiceExistingServerInstId(String serverInstId) {
this.serverInstId_ = serverInstId;
}
@@ -132,7 +144,8 @@
*/
public String getClientProject()
{
- return clientProjectName_ + "/" + clientComponentName_;
+ //return clientProjectName_ + "/" + clientComponentName_;
+ return clientProjectName_ + "/" + clientProjectName_;
}
/**
@@ -140,10 +153,10 @@
*/
public String getClientProjectEAR()
{
- if (clientEarProjectName_!=null && clientEarProjectName_.length()>0
- && clientEarComponentName_!=null && clientEarComponentName_.length()>0)
+ if (clientEarProjectName_!=null && clientEarProjectName_.length()>0)
{
- return clientEarProjectName_ + "/" + clientEarComponentName_;
+ //return clientEarProjectName_ + "/" + clientEarComponentName_;
+ return clientEarProjectName_ + "/" + clientEarProjectName_;
}
else
{
@@ -315,17 +328,18 @@
*/
public String getClientJ2EEVersion()
{
- return j2eeVersion;
+ return "14"; //rm j2ee
}
/**
* @param version The j2eeVersion to set.
*/
+ /*
public void setClientJ2EEVersion(String version)
{
j2eeVersion = version;
}
-
+ */
/**
*
* @return returns true if a proxy should be generated and false otherwise.
@@ -379,30 +393,36 @@
this.clientProjectName_ = clientProjectName;
}
+ /*
public void setClientComponentName(String clientComponentName)
{
this.clientComponentName_ = clientComponentName;
}
-
+ */
+
public void setClientEarProjectName(String clientEarProjectName)
{
this.clientEarProjectName_ = clientEarProjectName;
}
+ /*
public void setClientEarComponentName(String clientEarComponentName)
{
this.clientEarComponentName_ = clientEarComponentName;
}
+ */
public String getClientEarProjectName()
{
return clientEarProjectName_;
}
+ /*
public String getClientEarComponentName()
{
return clientEarComponentName_;
}
+ */
public void setServiceServerFactoryId(String id)
{
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionDefaultingCommand.java
index 4eda82c..bc10815 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionDefaultingCommand.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionDefaultingCommand.java
@@ -15,7 +15,6 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.eclipse.wst.ws.internal.parser.discovery.WebServicesParserExt;
@@ -28,12 +27,13 @@
private Boolean testService;
private Boolean publishService;
private TypeRuntimeServer serviceIds_;
+ private String serviceRuntimeId_;
//private SelectionListChoices serviceChoices_;
private String serviceProjectName_;
private String serviceEarProjectName_;
- private String serviceComponentName_;
- private String serviceEarComponentName_;
- private String j2eeVersion;
+ //private String serviceComponentName_;
+ //private String serviceEarComponentName_;
+ //private String j2eeVersion;
private boolean serviceNeedEAR_;
private WebServicesParser wsdlParser_;
@@ -59,6 +59,16 @@
{
return serviceIds_;
}
+
+ public void setServiceRuntimeId(String id)
+ {
+ serviceRuntimeId_ = id;
+ }
+
+ public String getServiceRuntimeId()
+ {
+ return serviceRuntimeId_;
+ }
/*
public void setServiceProject2EARProject(SelectionListChoices choices)
@@ -106,7 +116,7 @@
*/
public String getServerProject()
{
- return serviceProjectName_ + "/" + serviceComponentName_;
+ return serviceProjectName_ + "/" + serviceProjectName_;
}
/**
@@ -114,10 +124,9 @@
*/
public String getServerProjectEAR()
{
- if (serviceEarProjectName_!=null && serviceEarProjectName_.length()>0 &&
- serviceEarComponentName_!=null && serviceEarComponentName_.length()>0)
+ if (serviceEarProjectName_!=null && serviceEarProjectName_.length()>0)
{
- return serviceEarProjectName_ + "/" + serviceEarComponentName_;
+ return serviceEarProjectName_ + "/" + serviceEarProjectName_;
}
else
{
@@ -193,15 +202,7 @@
*/
public String getServiceJ2EEVersion()
{
- return j2eeVersion;
- }
-
- /**
- * @param version The j2eeVersion to set.
- */
- public void setServiceJ2EEVersion(String version)
- {
- j2eeVersion = version;
+ return "14"; //rm j2ee
}
/**
@@ -216,33 +217,7 @@
public void setServiceNeedEAR(boolean serviceNeedEAR)
{
serviceNeedEAR_ = serviceNeedEAR;
- }
-
- /**
- *
- * @return returns true if the web service project is an EJB project.
- */
- public boolean getIsServiceProjectEJB()
- {
- //If the type/server/runtime suggests that an EJB project
- //is required, return true.
- boolean ejbRequired = false;
- boolean ejbRequired2 = false;
- // rskreg
- //WebServiceServerRuntimeTypeRegistry wssrtRegistry = WebServiceServerRuntimeTypeRegistry.getInstance();
- if (serviceIds_ != null)
- {
- //String serverTypeId = wssrtRegistry.getWebServiceServerByFactoryId(serviceIds_.getServerId()).getId();
- //String serverTypeId = wssrtRegistry.getWebServiceServerByFactoryId(serviceIds_.getServerId()).getId();
- //ejbRequired = wssrtRegistry.requiresEJBModuleFor(serverTypeId, serviceIds_.getRuntimeId(), serviceIds_.getTypeId());
- ejbRequired = WebServiceRuntimeExtensionUtils.requiresEJBModuleFor(serviceIds_.getServerId(), serviceIds_.getRuntimeId(), serviceIds_.getTypeId());
- //ejbRequired2 = wssrtRegistry.requiresEJBProject(serviceIds_.getTypeId());
- ejbRequired2 = WebServiceRuntimeExtensionUtils.requiresEJBProject(serviceIds_.getRuntimeId(), serviceIds_.getTypeId());
- }
-
- // rskreg
- return (ejbRequired || ejbRequired2);
- }
+ }
/**
* @return Returns the wsdlParser_.
@@ -270,20 +245,10 @@
this.serviceProjectName_ = serviceProjectName;
}
- public void setServiceComponentName(String s)
- {
- serviceComponentName_ = s;
- }
-
public void setServiceEarProjectName(String serviceEarProjectName)
{
this.serviceEarProjectName_ = serviceEarProjectName;
}
-
- public void setServiceEarComponentName(String s)
- {
- serviceEarComponentName_ = s;
- }
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
{
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionFragment.java
index 87b31d7..dfa0b13 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionFragment.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionFragment.java
@@ -11,7 +11,7 @@
package org.eclipse.jst.ws.internal.consumption.ui.widgets.object;
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceImpl;
-import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
import org.eclipse.wst.command.internal.env.core.fragment.BooleanFragment;
import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment;
@@ -71,8 +71,8 @@
{
String wst = typeRuntimeServer.getTypeId();
- int scenario = WebServiceRuntimeExtensionUtils.getScenarioFromTypeId(wst);
- String implId = WebServiceRuntimeExtensionUtils.getImplIdFromTypeId(wst);
+ int scenario = WebServiceRuntimeExtensionUtils2.getScenarioFromTypeId(wst);
+ String implId = WebServiceRuntimeExtensionUtils2.getWebServiceImplIdFromTypeId(wst);
if (scenario == WebServiceScenario.TOPDOWN)
{
//Must have WSDL object selection. No choice.
@@ -80,7 +80,7 @@
}
else
{
- WebServiceImpl wsimpl = WebServiceRuntimeExtensionUtils.getWebServiceImplById(implId);
+ WebServiceImpl wsimpl = WebServiceRuntimeExtensionUtils2.getWebServiceImplById(implId);
if (wsimpl!=null)
{
String objectSelectionWidgetId = wsimpl.getObjectSelectionWidget();
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionOutputCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionOutputCommand.java
index 3cb6a96..4c50d4d 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionOutputCommand.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionOutputCommand.java
@@ -21,7 +21,7 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jst.ws.internal.common.ResourceUtils;
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceImpl;
-import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
import org.eclipse.wst.command.internal.provisional.env.core.data.Transformer;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
@@ -99,11 +99,11 @@
{
String wst = typeRuntimeServer.getTypeId();
- int scenario = WebServiceRuntimeExtensionUtils.getScenarioFromTypeId(wst);
- String implId = WebServiceRuntimeExtensionUtils.getImplIdFromTypeId(wst);
+ int scenario = WebServiceRuntimeExtensionUtils2.getScenarioFromTypeId(wst);
+ String implId = WebServiceRuntimeExtensionUtils2.getWebServiceImplIdFromTypeId(wst);
- WebServiceImpl wsimpl = WebServiceRuntimeExtensionUtils.getWebServiceImplById(implId);
- //IWebServiceType wst = WebServiceRuntimeExtensionUtils.getWebServiceTypeById(typeRuntimeServer.getTypeId());
+ WebServiceImpl wsimpl = WebServiceRuntimeExtensionUtils2.getWebServiceImplById(implId);
+ //IWebServiceType wst = WebServiceRuntimeExtensionUtils2.getWebServiceTypeById(typeRuntimeServer.getTypeId());
if (wsimpl != null)
{
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionWidget.java
index 779de1e..13fa081 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionWidget.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionWidget.java
@@ -19,7 +19,7 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jst.ws.internal.common.ResourceUtils;
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceImpl;
-import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -65,9 +65,9 @@
if (typeRuntimeServer != null)
{
String wst = typeRuntimeServer.getTypeId();
- int scenario = WebServiceRuntimeExtensionUtils.getScenarioFromTypeId(wst);
- String implId = WebServiceRuntimeExtensionUtils.getImplIdFromTypeId(wst);
- WebServiceImpl wsimpl = WebServiceRuntimeExtensionUtils.getWebServiceImplById(implId);
+ int scenario = WebServiceRuntimeExtensionUtils2.getScenarioFromTypeId(wst);
+ String implId = WebServiceRuntimeExtensionUtils2.getWebServiceImplIdFromTypeId(wst);
+ WebServiceImpl wsimpl = WebServiceRuntimeExtensionUtils2.getWebServiceImplById(implId);
//IWebServiceType wst = WebServiceRuntimeExtensionUtils.getWebServiceTypeById(typeRuntimeServer.getTypeId());
if (wsimpl != null)
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidget.java
index f9adcab..1149139 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidget.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidget.java
@@ -13,6 +13,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jst.ws.internal.consumption.ui.common.ValidationUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
import org.eclipse.jst.ws.internal.ui.common.UIUtils;
import org.eclipse.swt.SWT;
@@ -42,10 +43,11 @@
private Group clientGroup_;
private RuntimeServerSelectionWidget runtimeWidget_;
private SelectionListChoices runtime2ClientTypes_;
- private Combo clientType_;
+ //private Combo clientType_;
private SelectionAdapter clientTypeSelListener;
private ProjectSelectionWidget projectWidget_;
private boolean isVisible_;
+ private String clientRuntimeId_;
public WidgetDataEvents addControls( Composite parent, final Listener statusListener )
@@ -58,39 +60,37 @@
runtimeWidget_ = new RuntimeServerSelectionWidget( true );
runtimeWidget_.addControls( clientGroup_, statusListener );
+
+
runtimeWidget_.addModifyListener( new ModifyListener()
{
public void modifyText(ModifyEvent e)
{
- handleRuntime2ClientTypesEvent();
+ //handleRuntime2ClientTypesEvent();
handleUpdateProjectWidget();
}
});
-
- clientType_ = uiUtils.createCombo( clientGroup_, "LABEL_CLIENT_TYPE",
- "TOOLTIP_PWCR_COMBO_CLIENT_TYPE",
- INFOPOP_PWRS_GROUP_CLIENT,
- SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY );
-
- clientTypeSelListener = new SelectionAdapter()
- {
- public void widgetSelected( SelectionEvent evt )
- {
- handleSetProjects( clientType_.getSelectionIndex() );
- statusListener.handleEvent(null);
- }
- };
-
- clientType_.addSelectionListener(clientTypeSelListener);
+
projectWidget_ = new ProjectSelectionWidget(true);
projectWidget_.addControls( clientGroup_, statusListener );
- //projectWidget_.addModifyListener(new ModifyListener(){
- // public void modifyText(ModifyEvent e){
- // getProjectSelections();
- // }
- // });
+ //clientType_ = uiUtils.createCombo(clientGroup_, "LABEL_CLIENT_TYPE", "TOOLTIP_PWCR_COMBO_CLIENT_TYPE",
+ // INFOPOP_PWRS_GROUP_CLIENT, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
+
+ //Temporarily remove the listeners
+ /*
+ clientTypeSelListener = new SelectionAdapter()
+ {
+ public void widgetSelected(SelectionEvent evt)
+ {
+ handleSetProjects(clientType_.getSelectionIndex());
+ statusListener.handleEvent(null);
+ }
+ };
+
+ clientType_.addSelectionListener(clientTypeSelListener);
+ */
return this;
}
@@ -118,16 +118,20 @@
return runtimeWidget_.getTypeRuntimeServer();
}
- public String getJ2EEVersion()
+ public void setClientRuntimeId(String id)
{
- return runtimeWidget_.getJ2EEVersion();
+ clientRuntimeId_ = id;
}
- public void setJ2EEVersion(String j2eeVersion)
+ public String getClientRuntimeId()
{
- runtimeWidget_.setJ2EEVersion(j2eeVersion);
- projectWidget_.setJ2EEVersion(j2eeVersion);
- }
+ //calculate the most appropriate clientRuntimeId based on current settings.
+ String projectName = projectWidget_.getProjectName();
+ String templateId = projectWidget_.getComponentType();
+
+ //Find the client runtime that fits this profile best.
+ return WebServiceRuntimeExtensionUtils2.getClientRuntimeId(runtimeWidget_.getTypeRuntimeServer(), projectName, templateId);
+ }
public boolean getClientNeedEAR()
{
@@ -139,31 +143,29 @@
projectWidget_.setNeedEAR(b);
}
- public String getClientComponentName()
+ public String getClientProjectName()
{
- return projectWidget_.getComponentName();
+ return projectWidget_.getProjectName();
}
- public void setClientComponentName( String name )
+ public void setClientProjectName( String name )
{
- projectWidget_.setComponentName( name );
+ projectWidget_.setProjectName( name );
}
- public String getClientEarComponentName()
+ public String getClientEarProjectName()
{
- return projectWidget_.getEarComponentName();
+ return projectWidget_.getEarProjectName();
}
- public void setClientEarComponentName( String name )
+ public void setClientEarProjectName( String name )
{
- projectWidget_.setEarComponentName( name );
+ projectWidget_.setEarProjectName( name );
}
public String getClientComponentType()
{
- SelectionList projTypeList = runtime2ClientTypes_.getChoice().getList();
- projTypeList.setIndex( clientType_.getSelectionIndex() );
- return projTypeList.getSelection();
+ return projectWidget_.getComponentType();
}
public void setClientComponentType( String type )
@@ -171,48 +173,7 @@
projectWidget_.setComponentType( type );
}
- public String getClientProjectName()
- {
- return projectWidget_.getProjectName();
- }
-
- public String getClientEarProjectName()
- {
- return projectWidget_.getEarProjectName();
- }
-
- /**
- * @param runtime2ClientTypes The runtime2ClientTypes to set.
- */
- public void setRuntime2ClientTypes(SelectionListChoices runtime2ClientTypes)
- {
- runtime2ClientTypes_ = runtime2ClientTypes;
- handleRuntime2ClientTypesEvent();
- }
-
- public SelectionListChoices getRuntime2ClientTypes()
- {
-
- String runtime = runtimeWidget_.getTypeRuntimeServer().getRuntimeId();
- String clientProject = projectWidget_.getProjectChoices().getList().getSelection();
- String earProject = projectWidget_.getProjectChoices().getChoice().getList().getSelection();
-
- SelectionList runtimeList = runtime2ClientTypes_.getList();
- runtimeList.setSelectionValue( runtime );
-
- SelectionList projTypeList = runtime2ClientTypes_.getChoice().getList();
- projTypeList.setIndex( clientType_.getSelectionIndex() );
-
- SelectionListChoices clientProjChoice = runtime2ClientTypes_.getChoice().getChoice();
- SelectionList clientProjList = clientProjChoice.getList();
- clientProjList.setSelectionValue( clientProject );
-
- SelectionList earProjList = clientProjChoice.getChoice().getList();
- earProjList.setSelectionValue( earProject );
-
- return runtime2ClientTypes_;
- }
-
+ /*
private void handleRuntime2ClientTypesEvent()
{
if (runtime2ClientTypes_ != null)
@@ -234,19 +195,24 @@
clientType_.setItems( getClientTypeLabels( clientTypeIds ));
clientType_.select(selectedClientTypeIdx);
clientType_.addSelectionListener(clientTypeSelListener);
- handleSetProjects(selectedClientTypeIdx);
+ // Temp remove listeners and event handling
+ //handleSetProjects(selectedClientTypeIdx);
}
}
+ */
private void handleUpdateProjectWidget()
{
- projectWidget_.setTypeRuntimeServer(runtimeWidget_.getTypeRuntimeServer());
- projectWidget_.setJ2EEVersion(runtimeWidget_.getJ2EEVersion());
+ projectWidget_.setTypeRuntimeServer(runtimeWidget_.getTypeRuntimeServer());
+
+ //Update the list of projects shown to the user.
+ projectWidget_.refreshProjectItems();
}
+ /*
private void handleSetProjects( int clientTypeIndex )
{
SelectionListChoices clientType2Projects = runtime2ClientTypes_.getChoice();
@@ -273,6 +239,7 @@
projectWidget_.setComponentType(clientType2Projects.getList().getSelection());
projectWidget_.setProjectChoices( clientType2Projects.getChoice() );
}
+ */
private String[] getClientTypeLabels( String[] types )
{
@@ -318,7 +285,10 @@
*/
public IStatus getStatus()
{
+ //Return OK all the time for now.
IStatus finalStatus = Status.OK_STATUS;
+
+ /*
IStatus projectStatus = projectWidget_.getStatus();
IStatus runtimeStatus = runtimeWidget_.getStatus();
@@ -357,7 +327,8 @@
//Validate client side server targets and J2EE levels
String clientServerFactoryId = getClientTypeRuntimeServer().getServerId();
- String clientJ2EElevel = getJ2EEVersion();
+ // rm j2ee
+ String clientJ2EElevel = "14";
IStatus clientProjectStatus = valUtils.validateProjectTargetAndJ2EE(clientProjName, clientCompName, clientEARName, clientEARCompName, clientServerFactoryId,
clientJ2EElevel);
if (clientProjectStatus.getSeverity() == Status.ERROR)
@@ -366,6 +337,7 @@
}
}
}
+ */
return finalStatus;
}
}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java
index 2ebfd11..9cb2ea3 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime;
+import java.util.Set;
import java.util.Vector;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -24,11 +25,16 @@
import org.eclipse.jst.ws.internal.common.J2EEUtils;
import org.eclipse.jst.ws.internal.common.ResourceUtils;
import org.eclipse.jst.ws.internal.common.ServerUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.common.FacetMatcher;
+import org.eclipse.jst.ws.internal.consumption.ui.common.FacetUtils;
import org.eclipse.jst.ws.internal.consumption.ui.common.ServerSelectionUtils;
import org.eclipse.jst.ws.internal.consumption.ui.common.ValidationUtils;
import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin;
import org.eclipse.jst.ws.internal.consumption.ui.preferences.PersistentServerRuntimeContext;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.ClientRuntimeDescriptor;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.RequiredFacetVersion;
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeInfo;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils;
@@ -39,7 +45,12 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.environment.Environment;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.core.ServerUtil;
import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser;
import org.eclipse.wst.ws.internal.provisional.wsrt.IContext;
import org.eclipse.wst.ws.internal.provisional.wsrt.ISelection;
@@ -56,12 +67,15 @@
// clientRuntimeJ2EEType contains the default client runtime and J2EE level based on the initial selection.
// If the initialSeleciton does not result in a valid client runtime and J2EE level, clientRuntimeJ2EEType
// should remain null for the life of this instance.
- private WSRuntimeJ2EEType clientRuntimeJ2EEType_;
+ private WSRuntimeJ2EEType clientRuntimeJ2EEType_; //usage is internal to this class
private TypeRuntimeServer clientIds_;
- private SelectionListChoices runtimeClientTypes_;
- private String clientComponentName_;
- private String clientEarComponentName_;
+ private String clientRuntimeId_;
+ private String clientProjectName_;
+ private String clientEarProjectName_;
+ protected boolean clientNeedEAR_ = true;
+ private String clientComponentType_;
+ private FacetMatcher clientFacetMatcher_;
private IContext context_;
private ISelection selection_;
@@ -80,12 +94,9 @@
//2. The containing project has a J2EE level, server target, and project type combination which
// is not supported by any of the registered Web service runtimes.
private IProject clientInitialProject_;
- private String clientInitialComponentName_;
private IProject initialInitialProject_;
- private String initialInitialComponentName_;
- private String clientJ2EEVersion_;
- protected boolean clientNeedEAR_ = true;
+
private String wsdlURI_;
private WebServicesParser parser_;
@@ -108,44 +119,24 @@
return clientIds_;
}
- public SelectionListChoices getRuntime2ClientTypes()
+ public String getClientRuntimeId()
{
- return runtimeClientTypes_;
+ return clientRuntimeId_;
}
public String getClientProjectName()
{
- return getRuntime2ClientTypes().getChoice().getChoice().getList().getSelection();
+ return clientProjectName_;
}
public String getClientEarProjectName()
{
- return getRuntime2ClientTypes().getChoice().getChoice().getChoice().getList().getSelection();
- }
-
- public String getClientComponentName()
- {
- return clientComponentName_;
- }
-
- public String getClientEarComponentName()
- {
- return clientEarComponentName_;
- }
-
- protected void setClientEARComponentName(String name)
- {
- clientEarComponentName_ = name;
+ return clientEarProjectName_;
}
public String getClientComponentType()
{
- return getRuntime2ClientTypes().getChoice().getList().getSelection();
- }
-
- public String getClientJ2EEVersion()
- {
- return clientJ2EEVersion_;
+ return clientComponentType_;
}
public IWebServiceClient getWebService()
@@ -163,9 +154,228 @@
return selection_;
}
+ public IStatus execute(IProgressMonitor monitor, IAdaptable adaptable)
+ {
+
+ Environment env = getEnvironment();
+
+ try
+ {
+ // Set the runtime based on the initial selection
+ clientRuntimeId_ = getDefaultClientRuntime(clientInitialProject_);
+ if (clientRuntimeId_ == null)
+ {
+ // return and error.
+ }
+ clientIds_.setRuntimeId(WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimeId_).getRuntime()
+ .getId());
+
+ // Set the project
+ if (clientProjectName_ == null)
+ {
+ // Project name did not get set when the runtime was set, so set it now
+ clientProjectName_ = getDefaultClientProjectName();
+ }
+
+ IProject clientProject = ProjectUtilities.getProject(clientProjectName_);
+ if (!clientProject.exists())
+ {
+ // Set the project template
+ clientComponentType_ = getDefaultClientProjectTemplate();
+ }
+ else
+ {
+ //Set it to an empty String
+ clientComponentType_ = "";
+ }
+
+ // Set the EAR
+ clientEarProjectName_ = ""; // TODO fix this!
+ clientNeedEAR_ = false;
+
+ // Set the server
+ IStatus serverStatus = setClientDefaultServer();
+ if (serverStatus.getSeverity() == Status.ERROR)
+ {
+ env.getStatusHandler().reportError(serverStatus);
+ return serverStatus;
+ }
+
+ // Calculate default IWebServiceClient
+ setDefaultsForExtension(env);
+
+ return Status.OK_STATUS;
+
+ } catch (Exception e)
+ {
+ // Catch all Exceptions in order to give some feedback to the user
+ IStatus errorStatus = StatusUtils.errorStatus(msgUtils_.getMessage("MSG_ERROR_TASK_EXCEPTED",
+ new String[] { e.getMessage() }), e);
+ env.getStatusHandler().reportError(errorStatus);
+ return errorStatus;
+ }
+ }
+
+ private IStatus setClientDefaultServer()
+ {
+ //Choose an existing server the module is already associated with if possible
+ IProject clientProject = ProjectUtilities.getProject(clientProjectName_);
+ IServer[] configuredServers = ServerUtil.getServersByModule(ServerUtils.getModule(clientProject), null);
+ IServer firstSupportedServer = getFirstSupportedServer(configuredServers, clientRuntimeId_, clientProject);
+ if (firstSupportedServer != null)
+ {
+ clientIds_.setServerId(firstSupportedServer.getServerType().getId());
+ clientIds_.setServerInstanceId(firstSupportedServer.getId());
+ return Status.OK_STATUS;
+ }
+
+
+ //Choose any suitable existing server
+ IServer[] servers = ServerCore.getServers();
+ IServer supportedServer = getFirstSupportedServer(servers, clientRuntimeId_, clientProject);
+ if (supportedServer != null)
+ {
+ clientIds_.setServerId(supportedServer.getServerType().getId());
+ clientIds_.setServerInstanceId(supportedServer.getId());
+ return Status.OK_STATUS;
+ }
+
+ //No suitable existing server was found. Choose a suitable server type
+ String[] serverTypes = WebServiceRuntimeExtensionUtils2.getServerFactoryIdsByClientRuntime(clientRuntimeId_);
+ if (serverTypes!=null && serverTypes.length>0)
+ {
+ //TODO give priority to a server type that corresponds to the runtime associated with
+ //this project, if any.
+ clientIds_.setServerId(serverTypes[0]);
+ return Status.OK_STATUS;
+ }
+
+ //No suitable server was found. Popup an error.
+ String runtimeLabel = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(clientIds_.getRuntimeId());
+ String serverLabels = getServerLabels(clientIds_.getRuntimeId());
+ IStatus status = StatusUtils.errorStatus(msgUtils_.getMessage("MSG_ERROR_NO_SERVER_RUNTIME", new String[]{runtimeLabel, serverLabels}) );
+ return status;
+ }
+
+ private IServer getFirstSupportedServer(IServer[] servers, String clientRuntimeId, IProject clientProject)
+ {
+ if (servers != null && servers.length > 0) {
+ for (int i = 0; i < servers.length; i++)
+ {
+ String serverFactoryId = servers[i].getServerType().getId();
+ if (WebServiceRuntimeExtensionUtils2.doesClientRuntimeSupportServer(clientRuntimeId, serverFactoryId))
+ {
+ //TODO check if the server type supports the project before returning.
+ return servers[i];
+ }
+ }
+ }
+ return null;
+ }
+
+ private String getDefaultClientProjectTemplate()
+ {
+ String[] templates = WebServiceRuntimeExtensionUtils2.getClientProjectTemplates(clientIds_.getTypeId(), clientIds_.getRuntimeId());
+ return templates[0];
+ }
+
+ private String getDefaultClientProjectName()
+ {
+ IProject[] projects = FacetUtils.getAllProjects();
+ ClientRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimeId_);
+ RequiredFacetVersion[] rfvs = desc.getRequiredFacetVersions();
+
+ //Check each project for compatibility with the clientRuntime
+ for (int i=0; i<projects.length; i++)
+ {
+ try
+ {
+ IFacetedProject fproject = ProjectFacetsManager.create(projects[i]);
+ if (fproject != null)
+ {
+ Set facetVersions = fproject.getProjectFacets();
+ FacetMatcher fm = FacetUtils.match(rfvs, facetVersions);
+ if (fm.isMatch())
+ {
+ clientFacetMatcher_ = fm;
+ return projects[i].getName();
+ }
+ }
+ else
+ {
+ //TODO Handle the plain-old Java projects
+ }
+ } catch (CoreException ce)
+ {
+
+ }
+ }
+
+ //No project was suitable, return a new project name
+ return ResourceUtils.getDefaultWebProjectName();
+
+ }
+
+ private String getDefaultClientRuntime(IProject project)
+ {
+ //If possible, pick a Web service runtime that works with the initially selected project.
+ //If the initially selected project does not work with any of the Web service runtimes, pick the
+ //preferred Web service runtime.
+
+ String[] clientRuntimes = WebServiceRuntimeExtensionUtils2.getClientRuntimesByType(clientIds_.getTypeId());
+ if (project != null && project.exists())
+ {
+ for (int i=0; i<clientRuntimes.length; i++)
+ {
+ RequiredFacetVersion[] rfv = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimes[i]).getRequiredFacetVersions();
+ try
+ {
+ IFacetedProject fproject = ProjectFacetsManager.create(project);
+ if (fproject != null)
+ {
+ Set facetVersions = fproject.getProjectFacets();
+ FacetMatcher fm = FacetUtils.match(rfv, facetVersions);
+ if (fm.isMatch())
+ {
+ clientFacetMatcher_ = fm;
+ clientProjectName_ = project.getName();
+ return clientRuntimes[i];
+ }
+ }
+ else
+ {
+ //TODO Handle the plain-old Java projects
+ }
+ } catch (CoreException ce)
+ {
+
+ }
+ }
+ }
+
+ //Haven't returned yet so this means that the intitially selected project cannot be used
+ //to influence the selection of the runtime. Pick the preferred Web service runtime.
+ PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext();
+ String runtimeId = context.getRuntimeId();
+ for (int j=0; j<clientRuntimes.length; j++ )
+ {
+ ClientRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimes[j]);
+ if (desc.getRuntime().getId().equals(runtimeId))
+ {
+ return desc.getId();
+ }
+ }
+
+ if (clientRuntimes.length > 0)
+ return WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimes[0]).getId();
+ else
+ return null;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.wst.command.env.core.Command#execute(org.eclipse.wst.command.internal.provisional.env.core.common.Environment)
*/
+ /*
public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable )
{
Environment env = getEnvironment();
@@ -191,14 +401,10 @@
setClientProjectType(clientRuntimeJ2EEType_.getClientProjectTypeId());
}
- //setClientRuntimeId((WebServiceRuntimeExtensionUtils.getRuntimesByClientType(clientIds_.getTypeId()))[0]);
- //setClientComponentType();
- //clientJ2EEVersion_ = (WebServiceRuntimeExtensionUtils.getWebServiceRuntimeById(clientIds_.getRuntimeId()).getJ2eeLevels())[0];
//If clientInitialProject is the service project, check the initialInitialProject
- //to see if it is valid.
- ///*
+ //to see if it is valid.
ValidationUtils vu = new ValidationUtils();
if (vu.isProjectServiceProject(clientInitialProject_, wsdlURI_, parser_))
{
@@ -215,7 +421,6 @@
clientInitialComponentName_ = initialInitialComponentName_;
}
}
- //*/
setClientDefaultProject();
setClientDefaultEAR();
@@ -239,13 +444,14 @@
}
}
-
+ */
/**
*
* @param runtimeId
* @return
*/
+ /*
private SelectionListChoices getClientTypesChoice(String runtimeId)
{
String[] clientComponentTypes;
@@ -257,7 +463,7 @@
}
return new SelectionListChoices(list, choices);
}
-
+ */
/**
*
* @param clientType
@@ -326,7 +532,7 @@
*/
// rskreg
-
+ /*
private void setClientDefaultRuntimeFromPreference()
{
PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext();
@@ -335,8 +541,8 @@
//set the client runtime to be the preferred runtime if the client type allows.
setClientRuntimeId(pRuntimeId);
}
-
-
+ */
+ /*
private void setClientRuntimeId(String id)
{
String[] clientRuntimeIds = getRuntime2ClientTypes().getList().getList();
@@ -350,7 +556,8 @@
}
}
}
-
+ */
+ /*
private void setClientProjectType(String id)
{
String[] clientProjectTypeIds = getRuntime2ClientTypes().getChoice().getList().getList();
@@ -363,8 +570,8 @@
}
}
}
-
-
+ */
+ /*
protected void setClientDefaultJ2EEVersionFromPreference()
{
if (clientIds_ != null)
@@ -399,8 +606,9 @@
}
}
}
+ */
-
+ /*
private WSRuntimeJ2EEType getClientRuntimeAndJ2EEFromProject(IProject project, String componentName)
{
WSRuntimeJ2EEType cRJ2EE = null;
@@ -478,13 +686,14 @@
}
return cRJ2EE;
}
-
+ */
+ /*
private void setClientComponentType()
{
getRuntime2ClientTypes().getChoice().getList().setIndex(0);
}
-
+ */
/*
private void setClientDefaultProjectNew()
{
@@ -541,6 +750,7 @@
}
*/
+ /*
private void setClientDefaultProject()
{
//Handle the case where no valid initial selection exists
@@ -563,8 +773,9 @@
}
}
+ */
-
+ /*
private void setClientProjectToFirstValid()
{
//WebServiceClientTypeRegistry wsctReg = WebServiceClientTypeRegistry.getInstance();
@@ -615,7 +826,7 @@
getRuntime2ClientTypes().getChoice().getChoice().getList().setSelectionValue(ResourceUtils.getDefaultWebProjectName());
clientComponentName_ = ResourceUtils.getDefaultWebProjectName();
}
-
+ */
protected IResource getResourceFromInitialSelection(IStructuredSelection selection)
{
@@ -638,6 +849,7 @@
}
+ /*
private void setClientDefaultEAR()
{
//Client-side
@@ -649,7 +861,7 @@
getRuntime2ClientTypes().getChoice().getChoice().getChoice().getList().setSelectionValue(clientEARInfo[0]);
clientEarComponentName_ = clientEARInfo[1];
}
-
+ */
/*
private void setClientDefaultEARNew()
{
@@ -702,6 +914,7 @@
*
*/
+ /*
protected String[] getDefaultEARFromClientProject(IProject project, String componentName)
{
String[] projectAndComp = new String[2];
@@ -750,7 +963,9 @@
//clientEarComponentName_ = ResourceUtils.getDefaultClientEARComponentName();
}
}
+ */
+ /*
private IStatus setClientDefaultServer()
{
IStatus status = Status.OK_STATUS;
@@ -857,11 +1072,10 @@
return status;
}
-
- protected String getServerLabels(String runtimeId)
+ */
+ protected String getServerLabels(String clientRuntimeId)
{
- WebServiceRuntimeInfo wsrt = WebServiceRuntimeExtensionUtils.getWebServiceRuntimeById(runtimeId);
- String[] validServerFactoryIds = wsrt.getServerFactoryIds();
+ String[] validServerFactoryIds = WebServiceRuntimeExtensionUtils2.getServerFactoryIdsByClientRuntime(clientRuntimeId);
//String[] validServerLabels = new String[validServerFactoryIds.length];
StringBuffer validServerLabels = new StringBuffer();
for (int i=0; i<validServerFactoryIds.length; i++)
@@ -876,17 +1090,19 @@
return validServerLabels.toString();
}
- protected void updateClientProject(String projectName, String componentName, String serviceTypeId)
+
+ protected void updateClientProject(String projectName, String serviceTypeId)
{
boolean isEJB = false;
- String implId = WebServiceRuntimeExtensionUtils.getImplIdFromTypeId(serviceTypeId);
+ String implId = WebServiceRuntimeExtensionUtils2.getWebServiceImplIdFromTypeId(serviceTypeId);
isEJB = (implId.equals("org.eclipse.jst.ws.wsImpl.ejb"));
- String[] updatedNames = ResourceUtils.getClientProjectComponentName(projectName, componentName, isEJB);
- getRuntime2ClientTypes().getChoice().getChoice().getList().setSelectionValue(updatedNames[0]);
- clientComponentName_ = updatedNames[1];
+ String[] updatedNames = ResourceUtils.getClientProjectComponentName(projectName, projectName, isEJB);
+ clientProjectName_ = updatedNames[0];
}
+
+ /*
protected void updateClientEARs()
{
//Set EAR selection to null if the project/server defaults imply an EAR should not be created
@@ -929,15 +1145,16 @@
}
}
}
+ */
private void setDefaultsForExtension(Environment env)
{
- IWebServiceRuntime wsrt = WebServiceRuntimeExtensionUtils.getWebServiceRuntime(clientIds_.getRuntimeId());
+ IWebServiceRuntime wsrt = WebServiceRuntimeExtensionUtils2.getClientRuntime(clientRuntimeId_);
if (wsrt != null)
{
WebServiceClientInfo wsInfo = new WebServiceClientInfo();
- wsInfo.setJ2eeLevel(clientJ2EEVersion_);
+ wsInfo.setJ2eeLevel("14"); //rm j2ee
wsInfo.setServerFactoryId(clientIds_.getServerId());
wsInfo.setServerInstanceId(clientIds_.getServerInstanceId());
wsInfo.setState(WebServiceState.UNKNOWN_LITERAL);
@@ -960,7 +1177,6 @@
if (clientInitialProject_ == null)
{
clientInitialProject_ = getProjectFromInitialSelection(selection);
- clientInitialComponentName_ = getComponentNameFromInitialSelection(selection);
}
}
@@ -969,18 +1185,12 @@
clientInitialProject_ = clientInitialProject;
}
- public void setClientInitialComponentName(String name)
- {
- clientInitialComponentName_ = name;
- }
-
/**
* @param initialInitialSelection_ The initialInitialSelection_ to set.
*/
public void setInitialInitialSelection(IStructuredSelection initialInitialSelection)
{
initialInitialProject_ = getProjectFromInitialSelection(initialInitialSelection);
- initialInitialComponentName_ = getComponentNameFromInitialSelection(initialInitialSelection);
}
public boolean getClientNeedEAR()
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java
index 66ba203..130881f 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java
@@ -19,7 +19,9 @@
import org.eclipse.jst.ws.internal.common.J2EEUtils;
import org.eclipse.jst.ws.internal.common.ResourceUtils;
import org.eclipse.jst.ws.internal.common.ServerUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.common.FacetUtils;
import org.eclipse.jst.ws.internal.consumption.ui.common.ServerSelectionUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
import org.eclipse.jst.ws.internal.ui.common.UIUtils;
import org.eclipse.swt.SWT;
@@ -40,18 +42,20 @@
public class ProjectSelectionWidget extends SimpleWidgetDataContributor {
+
+
private final String EAR_PERMITTED_PROJECT_TYPE = "EAR_PERMITTED_PROJECT_TYPE";
//private final String JAVA_PROJECT_TYPE_ID = "org.eclipse.jst.ws.consumption.ui.clientProjectType.Containerless";
private String pluginId_ = "org.eclipse.jst.ws.consumption.ui";
-
- private SelectionListChoices projects_;
+
+ //private SelectionListChoices projects_;
private boolean needEAR_;
private TypeRuntimeServer trsIds_;
-
- private String j2eeVersion_;
+
+ //private String j2eeVersion_;
private String projectTypeId_ = EAR_PERMITTED_PROJECT_TYPE;
@@ -71,7 +75,9 @@
private Combo moduleProject_;
private Combo earProject_;
- private String componentType_;
+ private Combo projectType_;
+
+ //private String componentType_;
private ModifyListener moduleProjectListener_;
private ModifyListener moduleListener_;
@@ -80,18 +86,26 @@
private String initialModuleName_;
+
+
/*
* CONTEXT_ID PWRS0006 for the service-side Web project combo box of the
* runtime selection Page
*/
private String INFOPOP_PWRS_COMBO_PROJECT = pluginId_ + ".PWRS0006";
- private Combo module_;
+ //private Combo module_;
/* CONTEXT_ID PWRS0012 for the EAR combo box of the runtime selection Page */
private String INFOPOP_PWRS_COMBO_EAR = pluginId_ + ".PWRS0012";
+
+ /* CONTEXT_ID PWRS0018 for the client project type combo box of the runtime selection Page */
+ private String INFOPOP_PWRS_COMBO_CLIENT_PROJECT_TYPE = pluginId_ + ".PWRS0018";
+
+ /* CONTEXT_ID PWRS0024 for the service project type combo box of the runtime selection Page */
+ private String INFOPOP_PWRS_COMBO_SERVICE_PROJECT_TYPE = pluginId_ + ".PWRS0018";
- private Combo earModule_;
+ //private Combo earModule_;
/*
* Default Constructor
@@ -114,33 +128,32 @@
if (isClient_)
{
- moduleProject_ = uiUtils.createCombo(parent, "LABEL_CLIENT_PROJECT", "LABEL_CLIENT_PROJECT", INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER );
- module_ = uiUtils.createCombo(parent, "LABEL_CLIENT_MODULE", "LABEL_CLIENT_MODULE", INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER );
+ projectType_ = uiUtils.createCombo(parent, "LABEL_CLIENT_TYPE", "TOOLTIP_PWCR_COMBO_CLIENT_TYPE", INFOPOP_PWRS_COMBO_CLIENT_PROJECT_TYPE, SWT.SINGLE | SWT.BORDER);
+ moduleProject_ = uiUtils.createCombo(parent, "LABEL_CLIENT_PROJECT", "LABEL_CLIENT_PROJECT", INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER );
+ //module_ = uiUtils.createCombo(parent, "LABEL_CLIENT_MODULE", "LABEL_CLIENT_MODULE", INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER );
earProject_ = uiUtils.createCombo(parent, "LABEL_CLIENT_EAR_PROJECT", "LABEL_CLIENT_EAR_PROJECT", INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER );
- earModule_ = uiUtils.createCombo(parent, "LABEL_CLIENT_EAR_MODULE", "LABEL_CLIENT_EAR_MODULE", INFOPOP_PWRS_COMBO_EAR, SWT.SINGLE | SWT.BORDER );
+ //earModule_ = uiUtils.createCombo(parent, "LABEL_CLIENT_EAR_MODULE", "LABEL_CLIENT_EAR_MODULE", INFOPOP_PWRS_COMBO_EAR, SWT.SINGLE | SWT.BORDER );
}
else
{
+ projectType_ = uiUtils.createCombo(parent, "LABEL_SERVICE_TYPE", "TOOLTIP_PWCR_COMBO_SERVICE_TYPE", INFOPOP_PWRS_COMBO_SERVICE_PROJECT_TYPE, SWT.SINGLE | SWT.BORDER);
moduleProject_ = uiUtils.createCombo(parent, "LABEL_SERVICE_PROJECT", "LABEL_SERVICE_PROJECT", INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER );
- module_ = uiUtils.createCombo(parent, "LABEL_SERVICE_MODULE", "LABEL_SERVICE_MODULE", INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER );
+ //module_ = uiUtils.createCombo(parent, "LABEL_SERVICE_MODULE", "LABEL_SERVICE_MODULE", INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER );
earProject_ = uiUtils.createCombo(parent, "LABEL_SERVICE_EAR_PROJECT", "LABEL_SERVICE_EAR_PROJECT", INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER );
- earModule_ = uiUtils.createCombo(parent, "LABEL_SERVICE_EAR_MODULE", "LABEL_SERVICE_EAR_MODULE", INFOPOP_PWRS_COMBO_EAR, SWT.SINGLE | SWT.BORDER );
+ //earModule_ = uiUtils.createCombo(parent, "LABEL_SERVICE_EAR_MODULE", "LABEL_SERVICE_EAR_MODULE", INFOPOP_PWRS_COMBO_EAR, SWT.SINGLE | SWT.BORDER );
}
-
- //module_.addModifyListener(projectListener_);
-
- //earModule_.addModifyListener(earListener_);
- //earModule_.addListener(SWT.Modify, statusListener);
-
+
+ //Temporarily remove the listeners
+
moduleProjectListener_ = new ModifyListener()
{
public void modifyText(ModifyEvent evt)
{
- handleModuleProjectChanged(null);
+ handleProjectChanged();
statusListener_.handleEvent( null );
}
};
-
+ /*
moduleListener_ = new ModifyListener()
{
public void modifyText(ModifyEvent evt)
@@ -158,7 +171,7 @@
statusListener_.handleEvent( null );
}
};
-
+
earModuleListener_ = new ModifyListener()
{
public void modifyText(ModifyEvent evt)
@@ -166,29 +179,27 @@
statusListener_.handleEvent( null );
}
};
-
+ */
// message area
messageText_ = uiUtils.createText(parent, "LABEL_NO_LABEL", "LABEL_NO_LABEL", null, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
+ setEarProjectItems();
return this;
}
private void listenersOn()
{
- module_.addModifyListener( moduleListener_ );
moduleProject_.addModifyListener( moduleProjectListener_ );
- earProject_.addModifyListener( earProjectListener_ );
- earModule_.addModifyListener( earModuleListener_ );
+ //earProject_.addModifyListener( earModuleListener_ );
}
private void listenersOff()
{
- module_.removeModifyListener( moduleListener_ );
- moduleProject_.removeModifyListener( moduleProjectListener_ );
- earProject_.removeModifyListener( earProjectListener_ );
- earModule_.removeModifyListener( earModuleListener_ );
+ moduleProject_.removeModifyListener( moduleProjectListener_ );
+ //earModule_.removeModifyListener( earModuleListener_ );
}
+ /*
private void handleModuleProjectChanged(String moduleName)
{
String projectName = moduleProject_.getText();
@@ -232,7 +243,9 @@
}
}
+ */
+ /*
private void handleModuleChanged()
{
IVirtualComponent component = getEarModuleForModule();
@@ -254,7 +267,9 @@
updateEAREnabledState();
}
+ */
+ /*
private void handleEarProjectChanged()
{
@@ -288,7 +303,9 @@
earModule_.setItems( new String[0] );
}
}
+ */
+ /*
private IVirtualComponent getEarModuleForModule()
{
String projectName = moduleProject_.getText();
@@ -304,7 +321,9 @@
return components.length == 0 ? null : components[0];
}
-
+ */
+
+ /*
public void setProjectChoices(SelectionListChoices projects)
{
listenersOff();
@@ -325,45 +344,53 @@
updateEAREnabledState();
listenersOn();
}
+ */
+
+
+ /*
public SelectionListChoices getProjectChoices()
{
return projects_;
}
+ */
- public String getComponentName()
+ public String getProjectName()
{
- return module_.getText();
+ return moduleProject_.getText();
}
- public void setComponentName( String name )
+ public void setProjectName( String name )
{
listenersOff();
- module_.setText( name );
+ moduleProject_.setText( name );
initialModuleName_ = name;
+ handleProjectChanged();
listenersOn();
}
- public String getEarComponentName()
+ public String getEarProjectName()
{
- return earModule_.getText();
+ return earProject_.getText();
}
- public void setEarComponentName( String name )
+ public void setEarProjectName( String name )
{
listenersOff();
- earModule_.setText( name );
+ earProject_.setText( name );
listenersOn();
}
public void setComponentType( String type )
{
- componentType_ = type;
+ projectType_.setText(type);
}
- public String getComponentType( )
+ public String getComponentType()
{
- return componentType_;
+ String templateLabel = projectType_.getText();
+ String templateId = FacetUtils.getTemplateIdByLabel(templateLabel);
+ return templateId;
}
public boolean getNeedEAR()
@@ -371,37 +398,29 @@
return needEAR_;
}
- public String getProjectName()
- {
- return moduleProject_.getText();
- }
-
- public String getEarProjectName()
- {
- return earProject_.getText();
- }
-
public void setNeedEAR(boolean b)
{
needEAR_ = b;
+ if (needEAR_)
+ {
+ earProject_.setEnabled(true);
+ populateEARCombos();
+ }
+ else
+ {
+ earProject_.setEnabled(false);
+ earProject_.setText("");
+ }
}
public void setTypeRuntimeServer(TypeRuntimeServer trs)
{
trsIds_ = trs;
listenersOff();
- updateEAREnabledState();
+ updateEARState();
listenersOn();
}
- public void setJ2EEVersion(String j2eeVersion)
- {
- j2eeVersion_ = j2eeVersion;
- listenersOff();
- updateEAREnabledState();
- listenersOn();
- }
-
public void setProjectTypeId(String id)
{
projectTypeId_ = id;
@@ -419,102 +438,151 @@
return projectNames;
}
-
- private void updateEAREnabledState()
+
+ public void refreshProjectItems()
{
- if (projects_ != null)
+ listenersOff();
+ String selectedModuleProject = moduleProject_.getText();
+ String runtimeId = trsIds_.getRuntimeId();
+ String typeId = trsIds_.getTypeId();
+
+ //Get all the projects that are compatible with the type and runtime
+ String[] projectNames = null;
+ if (isClient_)
{
- if(!projectNeedsEAR(moduleProject_.getText(), module_.getText()))
+ projectNames = WebServiceRuntimeExtensionUtils2.getProjectsForClientTypeAndRuntime(typeId, runtimeId);
+ }
+ else
+ {
+ projectNames = WebServiceRuntimeExtensionUtils2.getProjectsForServiceTypeAndRuntime(typeId, runtimeId);
+ }
+
+ moduleProject_.setItems(projectNames);
+ moduleProject_.setText(selectedModuleProject);
+ System.out.println("moduleProject_ = "+moduleProject_.getText()+"..");
+ handleProjectChanged();
+ listenersOn();
+ }
+
+ public void setEarProjectItems()
+ {
+ IVirtualComponent[] ears = J2EEUtils.getAllEARComponents();
+ String[] earProjectNames = new String[ears.length];
+ for (int i=0; i<earProjectNames.length; i++)
+ {
+ earProjectNames[i]=ears[i].getProject().getName();
+ }
+ earProject_.setItems(earProjectNames);
+
+ if (earProjectNames.length > 0)
+ earProject_.select(0);
+ }
+
+ private void handleProjectChanged()
+ {
+ updateEARState();
+ updateTemplates();
+ }
+
+ private void updateTemplates()
+ {
+ String projectName = moduleProject_.getText();
+ if (projectName != null && projectName.length()>0)
+ {
+ IProject project = ProjectUtilities.getProject(projectName);
+ if (project.exists())
{
- earModule_.setEnabled(false);
- earProject_.setEnabled(false);
- earModule_.setText("");
- earProject_.setText("");
+ projectType_.setEnabled(false);
+ projectType_.setText("");
+ }
+ else
+ {
+ populateProjectTypeCombo();
+ projectType_.setEnabled(true);
+ }
+ }
+ }
+
+ private void populateProjectTypeCombo()
+ {
+ String[] templates = null;
+ if (isClient_)
+ {
+ templates = WebServiceRuntimeExtensionUtils2.getClientProjectTemplates(trsIds_.getTypeId(), trsIds_.getRuntimeId());
+ }
+ else
+ {
+ templates = WebServiceRuntimeExtensionUtils2.getServiceProjectTemplates(trsIds_.getTypeId(), trsIds_.getRuntimeId());
+ }
+
+ String[] templateLabels = FacetUtils.getTemplateLabels(templates);
+ projectType_.setItems(templateLabels);
+
+ if (templates.length > 0)
+ projectType_.select(0);
+ }
+
+ private void updateEARState()
+ {
+ if(!projectNeedsEAR(moduleProject_.getText()))
+ {
+ earProject_.setEnabled(false);
+ earProject_.setText("");
needEAR_ = false;
}
else
{
needEAR_ = true;
- earModule_.setEnabled(true);
- earProject_.setEnabled(true);
+ earProject_.setEnabled(true);
populateEARCombos();
}
- }
+
}
private void populateEARCombos()
{
- earModule_.removeAll();
earProject_.removeAll();
- String moduleName = module_.getText();
- IProject moduleProj = ResourcesPlugin.getWorkspace().getRoot().getProject(moduleProject_.getText());
- if (moduleProj.exists())
+ String projectName = moduleProject_.getText();
+ if (projectName != null && projectName.length() > 0)
{
- IVirtualComponent[] ears = J2EEUtils.getReferencingEARComponents(moduleProj);
- if (ears != null && ears.length > 0)
+ IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if (proj.exists())
{
- for (int i = 0; i < ears.length; i++)
+ IVirtualComponent[] ears = J2EEUtils.getReferencingEARComponents(proj);
+ if (ears != null && ears.length > 0)
{
- earModule_.add(ears[i].getName());
- earProject_.add(ears[i].getProject().getName());
+ for (int i = 0; i < ears.length; i++)
+ {
+ earProject_.add(ears[i].getName());
+ }
+ earProject_.select(0);
+ return;
}
- earModule_.select(0);
- earProject_.select(0);
- return;
}
+
+ String earName = projectName + "EAR";
+ earProject_.setText(earName);
}
- String earName = moduleName + "EAR";
- earModule_.setText(earName);
- earProject_.setText(earName);
+ else
+ {
+ setEarProjectItems();
+ }
}
- private boolean projectNeedsEAR(String projectName, String componentName)
+ private boolean projectNeedsEAR(String projectName)
{
- if (projectTypeId_.equals(IModuleConstants.JST_UTILITY_MODULE))
- return false;
-
- if (projectName == null || projectName.length()==0)
- return true;
-
- if (componentName == null || componentName.length()==0)
- return true;
-
-
- //IProject project = (IProject)((new StringToIProjectTransformer()).transform(projectName));
- IProject project = ResourceUtils.getWorkspaceRoot().getProject(projectName);
- if (project != null && project.exists())
- {
- //Get the runtime target on the project
- IRuntime target = ServerSelectionUtils.getRuntimeTarget(projectName);
- String j2eeVersion = String.valueOf(J2EEVersionConstants.J2EE_1_4_ID);
- if (J2EEUtils.exists(project))
- j2eeVersion = String.valueOf(J2EEUtils.getJ2EEVersion(project));
-
-
- if (target != null)
+ //Use the server type
+ if (trsIds_ != null && trsIds_.getServerId() != null)
+ {
+ String targetId = ServerUtils.getRuntimeTargetIdFromFactoryId(trsIds_.getServerId());
+ if (targetId!=null && targetId.length()>0)
{
- if (!ServerUtils.isTargetValidForEAR(target.getRuntimeType().getId(),j2eeVersion))
- {
- return false;
- }
-
- }
- }
- else
- {
- //Use the server type
- if (trsIds_ != null && trsIds_.getServerId() != null)
+ if (!ServerUtils.isTargetValidForEAR(targetId,"13")) //rm j2ee
{
- String targetId = ServerUtils.getRuntimeTargetIdFromFactoryId(trsIds_.getServerId());
- if (targetId!=null && targetId.length()>0)
- {
- if (!ServerUtils.isTargetValidForEAR(targetId,j2eeVersion_))
- {
- return false;
- }
- }
+ return false;
}
- }
+ }
+ }
return true;
}
@@ -523,7 +591,7 @@
IStatus status = Status.OK_STATUS;
try {
byte result = (byte) 0;
- if (module_.getText().length() != 0 && earModule_.getText().length() != 0) {
+ if (moduleProject_.getText().length() != 0 && earProject_.getText().length() != 0) {
String projectText = moduleProject_.getText();
String earText = earProject_.getText();
IProject project = ResourceUtils.getWorkspaceRoot().getProject(projectText);
@@ -602,30 +670,6 @@
return StatusUtils.errorStatus( msgUtils.getMessage("MSG_SERVICE_EAR_EMPTY", new String[]{""} ) );
}
- if( module_ == null || module_.getText().length() == 0 )
- {
- if( isClient_ )
- {
- return StatusUtils.errorStatus( msgUtils.getMessage("MSG_CLIENT_PROJECT_EMPTY", new String[]{moduleText} ) );
- }
- else
- {
- return StatusUtils.errorStatus( msgUtils.getMessage("MSG_CLIENT_EAR_EMPTY", new String[]{moduleText} ) );
- }
- }
-
- if( needEAR_ && ( earModule_ == null || earModule_.getText().length() == 0 ) )
- {
- if( isClient_ )
- {
- return StatusUtils.errorStatus( msgUtils.getMessage("MSG_CLIENT_EAR_EMPTY", new String[]{moduleText} ) );
- }
- else
- {
- return StatusUtils.errorStatus( msgUtils.getMessage("MSG_SERVICE_EAR_EMPTY", new String[]{moduleText} ) );
- }
- }
-
// TODO: Defect 107997 - Revisit prject and module creation logic
// if( !FlexibleJavaProjectPreferenceUtil.getMultipleModulesPerProjectProp() )
// {
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/RuntimeServerSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/RuntimeServerSelectionWidget.java
index 6b4db2b..0d528df 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/RuntimeServerSelectionWidget.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/RuntimeServerSelectionWidget.java
@@ -15,7 +15,7 @@
import org.eclipse.jface.window.Window;
import org.eclipse.jst.ws.internal.common.J2EEUtils;
import org.eclipse.jst.ws.internal.consumption.ui.wizard.RuntimeServerSelectionDialog;
-import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
import org.eclipse.jst.ws.internal.ui.common.UIUtils;
import org.eclipse.swt.SWT;
@@ -43,11 +43,11 @@
private String pluginId_ = "org.eclipse.jst.ws.consumption.ui";
private Text runtime_;
private Text server_;
- private Text j2eeVersionText;
+ //private Text j2eeVersionText;
private Composite parent_;
private boolean isClientContext_;
private TypeRuntimeServer ids_;
- private String j2eeVersion_;
+ //private String j2eeVersion_;
private MessageUtils msgUtils_;
private Listener statusListener_;
@@ -86,8 +86,6 @@
"TOOLTIP_PWRS_TEXT_SERVER",
INFOPOP_PWRS_GROUP_SERVICE_SERVER, SWT.READ_ONLY );
- j2eeVersionText = uiUtils.createText(parent, "LABEL_J2EE_VERSION", "TOOLTIP_PWRS_J2EE_VERSION", INFOPOP_PWRS_J2EE_VERSION, SWT.READ_ONLY);
-
Button editButton = new Button( parent, SWT.NONE );
editButton.setText( msgUtils_.getMessage("LABEL_EDIT_BUTTON"));
editButton.addSelectionListener( new SelectionAdapter()
@@ -115,24 +113,9 @@
setLabels();
}
- public String getJ2EEVersion()
- {
- return j2eeVersion_;
- }
-
- public void setJ2EEVersion(String j2eeVersion)
- {
- this.j2eeVersion_ = j2eeVersion;
- j2eeVersionText.setText((j2eeVersion_ != null) ? J2EEUtils.getLabelFromJ2EEVersion(j2eeVersion_) : msgUtils_.getMessage("LABEL_NA"));
- //setLabels();
- }
-
private void setLabels()
{
- // rskreg
- //WebServiceClientTypeRegistry registry = WebServiceClientTypeRegistry.getInstance();
- //String runtimeLabel = registry.getRuntimeLabelById( ids_.getRuntimeId() );
- String runtimeLabel = WebServiceRuntimeExtensionUtils.getRuntimeLabelById( ids_.getRuntimeId() );
+ String runtimeLabel = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById( ids_.getRuntimeId() );
String serverLabel = null;
if( ids_.getServerInstanceId() == null )
@@ -142,7 +125,7 @@
//serverLabel = server == null ? "" : server.getLabel();
String serverId = ids_.getServerId();
if (serverId != null)
- serverLabel = WebServiceRuntimeExtensionUtils.getServerLabelById(serverId);
+ serverLabel = WebServiceRuntimeExtensionUtils2.getServerLabelById(serverId);
}
else
{
@@ -150,7 +133,7 @@
//serverLabel = registry.getServerInstanceLabelFromInstanceId( ids_.getServerInstanceId() );
String serverInstanceId = ids_.getServerInstanceId();
if (serverInstanceId != null)
- serverLabel = WebServiceRuntimeExtensionUtils.getServerInstanceLabelFromInstanceId(serverInstanceId);
+ serverLabel = WebServiceRuntimeExtensionUtils2.getServerInstanceLabelFromInstanceId(serverInstanceId);
}
// rskreg
runtimeLabel = runtimeLabel == null ? "" : runtimeLabel;
@@ -158,7 +141,7 @@
runtime_.setText( runtimeLabel );
if (serverLabel != null)
server_.setText( serverLabel );
- j2eeVersionText.setText((j2eeVersion_ != null) ? J2EEUtils.getLabelFromJ2EEVersion(j2eeVersion_) : msgUtils_.getMessage("LABEL_NA"));
+
}
public void handleEditButton()
@@ -166,7 +149,7 @@
byte mode = isClientContext_ ? (byte)1 : (byte)0;
RuntimeServerSelectionDialog dialog
- = dialog = new RuntimeServerSelectionDialog( parent_.getShell(), mode, ids_, j2eeVersion_ );
+ = dialog = new RuntimeServerSelectionDialog( parent_.getShell(), mode, ids_, "14" ); //rm j2ee
dialog.create();
dialog.handleServerViewSelectionEvent();
int result = dialog.open();
@@ -174,7 +157,6 @@
if (result == Window.OK)
{
ids_ = dialog.getTypeRuntimeServer();
- j2eeVersion_ = dialog.getJ2EEVersion();
setLabels();
statusListener_.handleEvent(null);
}
@@ -201,8 +183,8 @@
String scenario = isClientContext_ ? msgUtils_.getMessage( "MSG_CLIENT_SUB" )
: msgUtils_.getMessage( "MSG_SERVICE_SUB" );
- String runtimeLabel = WebServiceRuntimeExtensionUtils.getRuntimeLabelById( ids_.getRuntimeId() );
- String serverLabel = ids_.getServerId() == null ? "" : WebServiceRuntimeExtensionUtils.getServerLabelById(ids_.getServerId());
+ String runtimeLabel = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById( ids_.getRuntimeId() );
+ String serverLabel = ids_.getServerId() == null ? "" : WebServiceRuntimeExtensionUtils2.getServerLabelById(ids_.getServerId());
if( ids_.getRuntimeId() == null || runtimeLabel == null || runtimeLabel.equals("" ))
@@ -238,7 +220,7 @@
if (!foundNonStubRuntime)
{
- String servertypeLabel = WebServiceRuntimeExtensionUtils.getServerLabelById(serverFactoryId);
+ String servertypeLabel = WebServiceRuntimeExtensionUtils2.getServerLabelById(serverFactoryId);
status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_STUB_ONLY",new String[]{servertypeLabel}) );
}
}
@@ -249,7 +231,7 @@
if (!(ids_.getServerId() == null) && !(ids_.getRuntimeId() == null) && isClientContext_)
{
- if (!WebServiceRuntimeExtensionUtils.webServiceClientRuntimeTypeExists( ids_.getServerId(), ids_.getRuntimeId(), ids_.getTypeId()))
+ if (!WebServiceRuntimeExtensionUtils2.isServerClientRuntimeTypeSupported( ids_.getServerId(), ids_.getRuntimeId(), ids_.getTypeId()))
{
status = StatusUtils.errorStatus( msgUtils_.getMessage( "MSG_INVALID_SRT_SELECTIONS", new String[]{ scenario } ) );
}
@@ -260,7 +242,7 @@
if (!(ids_.getServerId() == null) && !(ids_.getRuntimeId() == null) && !isClientContext_)
{
- if (!WebServiceRuntimeExtensionUtils.isServerRuntimeTypeSupported(ids_.getServerId(), ids_.getRuntimeId(), ids_.getTypeId())) {
+ if (!WebServiceRuntimeExtensionUtils2.isServerRuntimeTypeSupported(ids_.getServerId(), ids_.getRuntimeId(), ids_.getTypeId())) {
status = StatusUtils.errorStatus( msgUtils_.getMessage( "MSG_INVALID_SRT_SELECTIONS", new String[]{ scenario } ) );
}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/RuntimeServerSelectionDialog.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/RuntimeServerSelectionDialog.java
index 778828d..ce4d40b 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/RuntimeServerSelectionDialog.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/RuntimeServerSelectionDialog.java
@@ -18,8 +18,8 @@
import org.eclipse.jst.ws.internal.common.J2EEUtils;
import org.eclipse.jst.ws.internal.common.ServerUtils;
import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin;
-import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils;
-import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeInfo;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.RuntimeDescriptor;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
@@ -107,7 +107,8 @@
private String typeId_;
// rskreg
//private IWebServiceRuntime selectedRuntime_;
- private WebServiceRuntimeInfo selectedRuntime_;
+ //private WebServiceRuntimeInfo selectedRuntime_;
+ private RuntimeDescriptor selectedRuntime_;
// rskreg
private IServer selectedServer_;
private String selectedServerLabel_;
@@ -408,12 +409,12 @@
// {
//rskreg
- boolean wssrtSupported = WebServiceRuntimeExtensionUtils.isServerRuntimeTypeSupported(selectedServerFactoryID_,selectedRuntime_.getId(),typeId_);
+ boolean wssrtSupported = WebServiceRuntimeExtensionUtils2.isServerRuntimeTypeSupported(selectedServerFactoryID_,selectedRuntime_.getId(),typeId_);
//if (wssrt != null && wssrtRegistry.isServerSupportedForChosenType(typeId_, selectedServerFactoryID_)) {
//setOKStatusMessage();
//}
- if (wssrtSupported && WebServiceRuntimeExtensionUtils.isServerSupportedForChosenType(typeId_, selectedServerFactoryID_)) {
+ if (wssrtSupported && WebServiceRuntimeExtensionUtils2.isServerSupportedForChosenServiceType(typeId_, selectedServerFactoryID_)) {
setOKStatusMessage();
}
// rskreg
@@ -435,7 +436,7 @@
//if (wss == null || selectedRuntime_ == null || !wsctRegistry.webServiceClientRuntimeTypeExists(wss.getId(), selectedRuntime_.getId(), clientId)) {
//setERRORStatusMessage("%MSG_INVALID_SRT_SELECTIONS");
//}
- if (selectedServerFactoryID_==null || selectedRuntime_ == null || !WebServiceRuntimeExtensionUtils.webServiceClientRuntimeTypeExists(selectedServerFactoryID_, selectedRuntime_.getId(), clientId)) {
+ if (selectedServerFactoryID_==null || selectedRuntime_ == null || !WebServiceRuntimeExtensionUtils2.isServerClientRuntimeTypeSupported(selectedServerFactoryID_, selectedRuntime_.getId(), clientId)) {
setERRORStatusMessage("%MSG_INVALID_SRT_SELECTIONS");
}
// rskreg
@@ -603,16 +604,13 @@
}
private void processRuntimeListSelection(String runtimeName) {
- // rskreg
+
if (selectionMode_ == MODE_SERVICE) {
- //selectedRuntime_ = wssrtRegistry.getWebServiceRuntimeByLabel(runtimeName);
- selectedRuntime_ = WebServiceRuntimeExtensionUtils.getWebServiceRuntimeByLabel(runtimeName);
+ selectedRuntime_ = WebServiceRuntimeExtensionUtils2.getRuntimeByLabel(runtimeName);
}
else {
- //selectedRuntime_ = wsctRegistry.getWebServiceRuntimeByName(runtimeName);
- selectedRuntime_ = WebServiceRuntimeExtensionUtils.getWebServiceRuntimeByLabel(runtimeName);
+ selectedRuntime_ = WebServiceRuntimeExtensionUtils2.getRuntimeByLabel(runtimeName);
}
- // rskreg
}
private void processServerListSelection() {
@@ -663,14 +661,10 @@
String[] runtimes = null;
if (selectionMode_ == MODE_SERVICE) {
- // rskreg
- //runtimes = wssrtRegistry.getRuntimesByType(typeId_);
- runtimes = WebServiceRuntimeExtensionUtils.getRuntimesByType(typeId_);
+ runtimes = WebServiceRuntimeExtensionUtils2.getRuntimesByServiceType(typeId_);
}
else {
- //runtimes = wsctRegistry.getAllClientRuntimes();
- runtimes = WebServiceRuntimeExtensionUtils.getAllClientRuntimes();
- // rskreg
+ runtimes = WebServiceRuntimeExtensionUtils2.getAllRuntimesForClientSide();
}
TreeItem[] runtimeName = new TreeItem[runtimes.length];
@@ -693,18 +687,14 @@
return getRuntime(type).getLabel();
}
- // rskreg
- private WebServiceRuntimeInfo getRuntime(String type) {
+ private RuntimeDescriptor getRuntime(String type) {
if (selectionMode_ == MODE_SERVICE) {
- //return wssrtRegistry.getRuntimeById(type);
- return WebServiceRuntimeExtensionUtils.getWebServiceRuntimeById(type);
+ return WebServiceRuntimeExtensionUtils2.getRuntimeById(type);
}
else {
- //return wsctRegistry.getRuntimeById(type);
- return WebServiceRuntimeExtensionUtils.getWebServiceRuntimeById(type);
+ return WebServiceRuntimeExtensionUtils2.getRuntimeById(type);
}
}
- // rskreg
/**
*
@@ -763,18 +753,10 @@
String[] serverIds = null;
// rm String wst = wse.getWebServiceType();
if (selectionMode_ == MODE_SERVICE) {
- // rskreg
- //serverIds = wssrtRegistry.getServerFactoryIdsByType(typeId_);
- serverIds = WebServiceRuntimeExtensionUtils.getServerFactoryIdsByType(typeId_);
- // rskreg
+ serverIds = WebServiceRuntimeExtensionUtils2.getServerFactoryIdsByServiceType(typeId_);
}
else {
- //serverIds = wsctRegistry.getServerFactoryIdsByClientType(typeId_);
- // rskreg
- //serverIds = wsctRegistry.getAllClientServerFactoryIds();
- serverIds = WebServiceRuntimeExtensionUtils.getAllClientServerFactoryIds();
- // rskreg
-
+ serverIds = WebServiceRuntimeExtensionUtils2.getAllClientServerFactoryIds();
}
// rm serverId =
// wssrtRegistry.getServerFactoryIdsByType(wse.getWebServiceType());
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionFilter2.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionFilter2.java
new file mode 100644
index 0000000..8ae6bec
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionFilter2.java
@@ -0,0 +1,193 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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.wizard;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.ws.internal.common.ResourceUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceImpl;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
+import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceScenario;
+
+
+public class TypeSelectionFilter2
+{
+ // Copyright
+ public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002.";
+
+ public String[] getWebServiceTypeByInitialSelection(IStructuredSelection initialSelection, ArrayList webServiceTypeList)
+ {
+
+ ArrayList supportedTypes = new ArrayList();
+ if (initialSelection != null && initialSelection.size() == 1)
+ {
+
+ // Check for null initial selection
+ Object initialObject = initialSelection.getFirstElement();
+ if (initialObject == null)
+ {
+ return null;
+ }
+ // Match up resource type metadata with initial selection
+ Iterator iter = webServiceTypeList.iterator();
+ while (iter.hasNext())
+ {
+ String wst = (String)iter.next();
+ String scenario = wst.substring(0,wst.indexOf("/"));
+ String implId = wst.substring(wst.indexOf("/")+1);
+ //IWebServiceType wst = (IWebServiceType)iter.next();
+ //String typeId = (String)wst.getId();
+ if (scenario.equals(String.valueOf(WebServiceScenario.BOTTOMUP)) && !supportedTypes.contains(wst))
+ {
+
+
+ WebServiceImpl wsimpl = WebServiceRuntimeExtensionUtils2.getWebServiceImplById(implId);
+ String[] resourceTypes = wsimpl.getResourceTypeMetadata();
+ for (int i=0; i<resourceTypes.length; i++)
+ {
+ if (resourceTypes[i]!=null)
+ {
+ if ((initialObject.getClass().getName()).endsWith(resourceTypes[i]))
+ {
+ String name = null;
+ IResource resource = null;
+
+ try
+ {
+ resource = ResourceUtils.getResourceFromSelection(initialObject);
+ }
+ catch( CoreException exc )
+ {
+ resource = null;
+ }
+
+ if (resource instanceof IContainer)
+ {
+ name = initialObject.getClass().getName();
+ }
+ else if( resource != null )
+ {
+ name = resource.getFullPath().toString();
+ }
+ else
+ {
+ name = initialObject.getClass().getName();
+ }
+ String[] extensions = wsimpl.getExtensionMetadata();
+ if (acceptsName(name, extensions))
+ {
+ supportedTypes.add(wst);
+ }
+ }
+
+ }
+ }
+ }
+ }
+
+ //If no wsImpls have accepted this selection, check if this is WSDL. If it is,
+ //add the top-down Java service type to the list.
+ if (supportedTypes.isEmpty())
+ {
+ String[] resourceTypes = {"File", "IResource", "String", "ServiceImpl", "ServiceRefImpl", "WSDLResourceImpl"};
+ for (int i=0; i<resourceTypes.length; i++)
+ {
+ if (resourceTypes[i]!=null)
+ {
+ if ((initialObject.getClass().getName()).endsWith(resourceTypes[i]))
+ {
+ String name = null;
+ IResource resource = null;
+
+ try
+ {
+ resource = ResourceUtils.getResourceFromSelection(initialObject);
+ }
+ catch( CoreException exc )
+ {
+ resource = null;
+ }
+
+ if (resource instanceof IContainer)
+ {
+ name = initialObject.getClass().getName();
+ }
+ else if( resource != null )
+ {
+ name = resource.getFullPath().toString();
+ }
+ else
+ {
+ name = initialObject.getClass().getName();
+ }
+ String[] extensions = {".wsdl", ".wsil", ".html", ".ServiceImpl", ".ServiceRefImpl", ".WSDLResourceImpl"};
+ if (acceptsName(name, extensions))
+ {
+ StringBuffer entrybuff = new StringBuffer();
+ entrybuff.append(String.valueOf(WebServiceScenario.TOPDOWN));
+ entrybuff.append("/");
+ entrybuff.append("org.eclipse.jst.ws.wsImpl.java");
+ String entry = entrybuff.toString();
+ supportedTypes.add(entry);
+ }
+ }
+
+ }
+ }
+ }
+
+ }
+
+
+
+ if (supportedTypes.isEmpty())
+ {
+ //It's not a registered implementation and its not WSDL so return null;
+ return null;
+ }
+ else
+ {
+ return (String[])supportedTypes.toArray(new String[0]);
+ }
+ }
+ //
+ // Checks if the given name is acceptable based upon its extension
+ //
+ private boolean acceptsName ( String name, String[] extensions)
+ {
+ //Return true if "all" extensions are supported.
+
+ if (extensions[0]!=null)
+ {
+ if (extensions[0].equals("all"))
+ {
+ return true;
+ }
+ }
+
+ for (int i=0; i<extensions.length; i++)
+ {
+ if (extensions[i]!=null)
+ {
+ if (name.endsWith(extensions[i]))
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ClientRuntimeDescriptor.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ClientRuntimeDescriptor.java
new file mode 100644
index 0000000..14bd601
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ClientRuntimeDescriptor.java
@@ -0,0 +1,135 @@
+package org.eclipse.jst.ws.internal.consumption.ui.wsrt;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceRuntime;
+
+public class ClientRuntimeDescriptor
+{
+ private IConfigurationElement elem;
+ private Hashtable allWebServiceClientImpls;
+ private Hashtable allRuntimes;
+ private String id;
+ private WebServiceClientImpl clientImplementationType;
+ private RuntimeDescriptor runtime;
+ private String clientRuntimeClassName;
+ private IWebServiceRuntime webServiceRuntime;
+ private RequiredFacetVersion[] requiredFacetVersions;
+ private Set projectFacetVersions;
+
+ public ClientRuntimeDescriptor(IConfigurationElement elem, Hashtable allWebServiceClientImpls, Hashtable allRuntimes)
+ {
+ this.elem = elem;
+ this.allWebServiceClientImpls = allWebServiceClientImpls;
+ this.allRuntimes = allRuntimes;
+ }
+
+ public WebServiceClientImpl getClientImplementationType()
+ {
+ if (clientImplementationType == null)
+ {
+ String clientImplementationTypeId = elem.getAttribute("clientImplementationTypeId");
+ clientImplementationType = (WebServiceClientImpl)allWebServiceClientImpls.get(clientImplementationTypeId);
+ }
+ return clientImplementationType;
+ }
+
+ public String getClientRuntimeClassName()
+ {
+ if (clientRuntimeClassName == null)
+ {
+ clientRuntimeClassName = elem.getAttribute("class");
+ }
+ return clientRuntimeClassName;
+ }
+
+ public String getId()
+ {
+ if (id == null)
+ {
+ id = elem.getAttribute("id");
+ }
+ return id;
+ }
+
+ public RequiredFacetVersion[] getRequiredFacetVersions()
+ {
+ if (requiredFacetVersions == null)
+ {
+ ArrayList requiredFacetVersionList = new ArrayList();
+ IConfigurationElement[] facetElems = elem.getChildren("required-facet-version");
+ for (int i = 0; i < facetElems.length; i++)
+ {
+ RequiredFacetVersion rfv = new RequiredFacetVersion();
+ IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(facetElems[i].getAttribute("facet"));
+ IProjectFacetVersion projectFacetVersion = projectFacet.getVersion(facetElems[i].getAttribute("version"));
+ rfv.setProjectFacetVersion(projectFacetVersion);
+ String allowNewerValue = facetElems[i].getAttribute("allow-newer");
+ if (allowNewerValue == null)
+ {
+ rfv.setAllowNewer(false);
+ }
+ else
+ {
+ rfv.setAllowNewer(Boolean.valueOf(allowNewerValue).booleanValue());
+ }
+
+ requiredFacetVersionList.add(rfv);
+ }
+
+ requiredFacetVersions = (RequiredFacetVersion[])requiredFacetVersionList.toArray(new RequiredFacetVersion[]{});
+ }
+
+ return requiredFacetVersions;
+ }
+
+ public Set getProjectFacetVersions()
+ {
+ if (projectFacetVersions == null)
+ {
+ projectFacetVersions = new HashSet();
+ RequiredFacetVersion[] rfv = getRequiredFacetVersions();
+ for (int i=0; i<rfv.length; i++)
+ {
+ projectFacetVersions.add(rfv[i].getProjectFacetVersion());
+ }
+ }
+
+ return projectFacetVersions;
+ }
+
+ public RuntimeDescriptor getRuntime()
+ {
+ if (runtime == null)
+ {
+ String runtimeId = elem.getAttribute("runtimeId");
+ runtime = (RuntimeDescriptor)allRuntimes.get(runtimeId);
+ }
+ return runtime;
+ }
+
+ public IWebServiceRuntime getWebServiceRuntime()
+ {
+ if (webServiceRuntime == null)
+ {
+ try
+ {
+ webServiceRuntime = (IWebServiceRuntime)elem.createExecutableExtension("class");
+ }
+ catch(CoreException ce)
+ {
+
+ }
+ }
+
+ return webServiceRuntime;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/RequiredFacetVersion.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/RequiredFacetVersion.java
new file mode 100644
index 0000000..82214c3
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/RequiredFacetVersion.java
@@ -0,0 +1,28 @@
+package org.eclipse.jst.ws.internal.consumption.ui.wsrt;
+
+
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+public class RequiredFacetVersion
+{
+ private IProjectFacetVersion projectFacetVersion;
+ private boolean allowNewer;
+
+ public boolean getAllowNewer()
+ {
+ return allowNewer;
+ }
+ public void setAllowNewer(boolean allowNewer)
+ {
+ this.allowNewer = allowNewer;
+ }
+ public IProjectFacetVersion getProjectFacetVersion()
+ {
+ return projectFacetVersion;
+ }
+ public void setProjectFacetVersion(IProjectFacetVersion projectFacetVersion)
+ {
+ this.projectFacetVersion = projectFacetVersion;
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/RuntimeDescriptor.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/RuntimeDescriptor.java
new file mode 100644
index 0000000..73b3584
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/RuntimeDescriptor.java
@@ -0,0 +1,43 @@
+package org.eclipse.jst.ws.internal.consumption.ui.wsrt;
+
+import java.util.StringTokenizer;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+
+public class RuntimeDescriptor
+{
+
+ private IConfigurationElement elem;
+ private String id;
+ private String label;
+
+
+ public RuntimeDescriptor(IConfigurationElement elem)
+ {
+ this.elem = elem;
+ }
+
+ public String getId()
+ {
+ if (id == null)
+ {
+ id = elem.getAttribute("id");
+ }
+ return id;
+ }
+
+ public String getLabel()
+ {
+ if (label == null)
+ {
+ label = elem.getAttribute("label");
+ }
+ return label;
+ }
+
+ public String[] getJ2eeLevels()
+ {
+ return new String[]{"13", "14"};
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceRuntimeDescriptor.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceRuntimeDescriptor.java
new file mode 100644
index 0000000..7e64bcd
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceRuntimeDescriptor.java
@@ -0,0 +1,154 @@
+package org.eclipse.jst.ws.internal.consumption.ui.wsrt;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceRuntime;
+
+
+public class ServiceRuntimeDescriptor
+{
+ private IConfigurationElement elem;
+ private Hashtable allWebServiceImpls;
+ private Hashtable allRuntimes;
+ private String id;
+ private WebServiceImpl serviceImplementationType;
+ private RuntimeDescriptor runtime;
+ private boolean bottomUp = false;
+ private boolean topDown = false;
+ private String serviceRuntimeClassName;
+ private IWebServiceRuntime webServiceRuntime;
+ private RequiredFacetVersion[] requiredFacetVersions;
+ private Set projectFacetVersions;
+
+ public ServiceRuntimeDescriptor(IConfigurationElement elem, Hashtable allWebServiceImpls, Hashtable allRuntimes)
+ {
+ this.elem = elem;
+ this.allWebServiceImpls = allWebServiceImpls;
+ this.allRuntimes = allRuntimes;
+
+ System.out.println("bottomUp = "+elem.getAttribute("bottomUp"));
+ System.out.println("bottomUp = "+elem.getAttribute("topDown"));
+
+ bottomUp = (Boolean.valueOf(elem.getAttribute("bottomUp"))).booleanValue();
+ topDown = (Boolean.valueOf(elem.getAttribute("topDown"))).booleanValue();
+ }
+
+ public boolean getBottomUp()
+ {
+ return bottomUp;
+ }
+
+ public String getId()
+ {
+ if (id == null)
+ {
+ id = elem.getAttribute("id");
+ }
+ return id;
+ }
+
+
+ public RequiredFacetVersion[] getRequiredFacetVersions()
+ {
+ if (requiredFacetVersions == null)
+ {
+ ArrayList requiredFacetVersionList = new ArrayList();
+ IConfigurationElement[] facetElems = elem.getChildren("required-facet-version");
+ for (int i = 0; i < facetElems.length; i++)
+ {
+ RequiredFacetVersion rfv = new RequiredFacetVersion();
+ IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(facetElems[i].getAttribute("facet"));
+ IProjectFacetVersion projectFacetVersion = projectFacet.getVersion(facetElems[i].getAttribute("version"));
+ rfv.setProjectFacetVersion(projectFacetVersion);
+ String allowNewerValue = facetElems[i].getAttribute("allow-newer");
+ if (allowNewerValue == null)
+ {
+ rfv.setAllowNewer(false);
+ }
+ else
+ {
+ rfv.setAllowNewer(Boolean.valueOf(allowNewerValue).booleanValue());
+ }
+
+ requiredFacetVersionList.add(rfv);
+ }
+
+ requiredFacetVersions = (RequiredFacetVersion[])requiredFacetVersionList.toArray(new RequiredFacetVersion[]{});
+ }
+
+ return requiredFacetVersions;
+ }
+
+ public Set getProjectFacetVersions()
+ {
+ if (projectFacetVersions == null)
+ {
+ projectFacetVersions = new HashSet();
+ RequiredFacetVersion[] rfv = getRequiredFacetVersions();
+ for (int i=0; i<rfv.length; i++)
+ {
+ projectFacetVersions.add(rfv[i].getProjectFacetVersion());
+ }
+ }
+
+ return projectFacetVersions;
+ }
+
+ public RuntimeDescriptor getRuntime()
+ {
+ if (runtime == null)
+ {
+ String runtimeId = elem.getAttribute("runtimeId");
+ runtime = (RuntimeDescriptor)allRuntimes.get(runtimeId);
+ }
+ return runtime;
+ }
+
+ public WebServiceImpl getServiceImplementationType()
+ {
+ if (serviceImplementationType == null)
+ {
+ String serviceImplementationTypeId = elem.getAttribute("serviceImplementationTypeId");
+ serviceImplementationType = (WebServiceImpl)allWebServiceImpls.get(serviceImplementationTypeId);
+ }
+ return serviceImplementationType;
+ }
+
+ public String getServiceRuntimeClassName()
+ {
+ if (serviceRuntimeClassName == null)
+ {
+ serviceRuntimeClassName = elem.getAttribute("class");
+ }
+ return serviceRuntimeClassName;
+ }
+
+ public boolean getTopDown()
+ {
+ return topDown;
+ }
+
+ public IWebServiceRuntime getWebServiceRuntime()
+ {
+ if (webServiceRuntime == null)
+ {
+ try
+ {
+ webServiceRuntime = (IWebServiceRuntime)elem.createExecutableExtension("class");
+ }
+ catch(CoreException ce)
+ {
+
+ }
+ }
+
+ return webServiceRuntime;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionRegistry2.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionRegistry2.java
new file mode 100644
index 0000000..00e90d2
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionRegistry2.java
@@ -0,0 +1,187 @@
+package org.eclipse.jst.ws.internal.consumption.ui.wsrt;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceScenario;
+
+public class WebServiceRuntimeExtensionRegistry2
+{
+
+ private static WebServiceRuntimeExtensionRegistry2 instance_;
+
+
+ Hashtable webServiceImpls_;
+
+ Hashtable webServiceClientImpls_;
+
+ Hashtable runtimes_;
+
+ Hashtable serviceRuntimes_;
+
+ Hashtable clientRuntimes_;
+
+ ArrayList webServiceTypesList_;
+
+ ArrayList webServiceClientTypesList_;
+
+
+ /**
+ * Returns a singleton instance of this class.
+ *
+ * @return A singleton WebServiceRuntimeExtensionRegistry2 object.
+ */
+ public static WebServiceRuntimeExtensionRegistry2 getInstance()
+ {
+ if (instance_ == null)
+ {
+ instance_ = new WebServiceRuntimeExtensionRegistry2();
+ instance_.load();
+ }
+ return instance_;
+ }
+
+ private void load()
+ {
+ webServiceImpls_ = new Hashtable();
+ webServiceClientImpls_ = new Hashtable();
+ runtimes_ = new Hashtable();
+ serviceRuntimes_ = new Hashtable();
+ clientRuntimes_ = new Hashtable();
+ webServiceTypesList_ = new ArrayList();
+ webServiceClientTypesList_ = new ArrayList();
+
+
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+
+ //Load WebServiceImpls
+ IConfigurationElement[] wsImplExts = reg.getConfigurationElementsFor(
+ "org.eclipse.jst.ws.consumption.ui", "wsImpl");
+
+ for(int idx=0; idx<wsImplExts.length; idx++)
+ {
+ IConfigurationElement elem = wsImplExts[idx];
+ System.out.println("element name = "+elem.getName());
+ if (elem.getName().equals("webServiceImpl"))
+ {
+ WebServiceImpl wsimpl = new WebServiceImpl(elem);
+ System.out.println(elem.getAttribute("id"));
+ webServiceImpls_.put(elem.getAttribute("id"), wsimpl);
+ }
+ }
+
+ //Load WebServiceClientImpls
+ IConfigurationElement[] wsClientImplExts = reg.getConfigurationElementsFor(
+ "org.eclipse.jst.ws.consumption.ui", "wsClientImpl");
+
+ for(int idx=0; idx<wsClientImplExts.length; idx++)
+ {
+ IConfigurationElement elem = wsClientImplExts[idx];
+
+ if (elem.getName().equals("webServiceClientImpl"))
+ {
+ WebServiceClientImpl wsClientImpl = new WebServiceClientImpl(elem);
+ webServiceClientImpls_.put(elem.getAttribute("id"), wsClientImpl);
+ }
+ }
+
+ //Load runtimes
+ IConfigurationElement[] runtimeExts = reg.getConfigurationElementsFor(
+ "org.eclipse.jst.ws.consumption.ui", "runtimes");
+
+ for(int idx=0; idx<runtimeExts.length; idx++)
+ {
+ IConfigurationElement elem = runtimeExts[idx];
+
+ if (elem.getName().equals("runtime"))
+ {
+ RuntimeDescriptor rd = new RuntimeDescriptor(elem);
+ runtimes_.put(elem.getAttribute("id"), rd);
+ }
+ }
+
+ //Load serviceRuntimes
+ IConfigurationElement[] serviceRuntimeExts = reg.getConfigurationElementsFor(
+ "org.eclipse.jst.ws.consumption.ui", "serviceRuntimes");
+
+ for(int idx=0; idx<serviceRuntimeExts.length; idx++)
+ {
+ IConfigurationElement elem = serviceRuntimeExts[idx];
+
+ if (elem.getName().equals("serviceRuntime"))
+ {
+ ServiceRuntimeDescriptor rd = new ServiceRuntimeDescriptor(elem, webServiceImpls_, runtimes_);
+ serviceRuntimes_.put(elem.getAttribute("id"), rd);
+ updateWebServiceTypeList(rd);
+ }
+ }
+
+ //Load serviceRuntimes
+ IConfigurationElement[] clientRuntimeExts = reg.getConfigurationElementsFor(
+ "org.eclipse.jst.ws.consumption.ui", "clientRuntimes");
+
+ for(int idx=0; idx<clientRuntimeExts.length; idx++)
+ {
+ IConfigurationElement elem = clientRuntimeExts[idx];
+
+ if (elem.getName().equals("clientRuntime"))
+ {
+ ClientRuntimeDescriptor rd = new ClientRuntimeDescriptor(elem, webServiceClientImpls_, runtimes_);
+ clientRuntimes_.put(elem.getAttribute("id"), rd);
+ updateWebServiceClientTypeList(rd);
+
+ }
+ }
+ }
+
+ private void updateWebServiceTypeList(ServiceRuntimeDescriptor descriptor)
+ {
+ String serviceImplId = descriptor.getServiceImplementationType().getId();
+ boolean bottomUp = descriptor.getBottomUp();
+ boolean topDown = descriptor.getTopDown();
+ if (bottomUp)
+ {
+ StringBuffer entrybuff = new StringBuffer();
+ entrybuff.append(String.valueOf(WebServiceScenario.BOTTOMUP));
+ entrybuff.append("/");
+ entrybuff.append(serviceImplId);
+ String entry = entrybuff.toString();
+ if (!webServiceTypesList_.contains(entry))
+ {
+ webServiceTypesList_.add(entry);
+ }
+ }
+
+ if (topDown)
+ {
+ StringBuffer entrybuff = new StringBuffer();
+ entrybuff.append(String.valueOf(WebServiceScenario.TOPDOWN));
+ entrybuff.append("/");
+ entrybuff.append(serviceImplId);
+ String entry = entrybuff.toString();
+ if (!webServiceTypesList_.contains(entry))
+ {
+ webServiceTypesList_.add(entry);
+ }
+ }
+ }
+
+ private void updateWebServiceClientTypeList(ClientRuntimeDescriptor descriptor)
+ {
+ String clientImplId = descriptor.getClientImplementationType().getId();
+ StringBuffer entrybuff = new StringBuffer();
+ entrybuff.append(String.valueOf(WebServiceScenario.CLIENT));
+ entrybuff.append("/");
+ entrybuff.append(clientImplId);
+ String entry = entrybuff.toString();
+ if (!webServiceClientTypesList_.contains(entry))
+ {
+ webServiceClientTypesList_.add(entry);
+ }
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils.java
index 5fc1bd9..8db7fa7 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils.java
@@ -13,6 +13,7 @@
import org.eclipse.wst.command.internal.provisional.env.core.selection.SelectionList;
import org.eclipse.wst.command.internal.provisional.env.core.selection.SelectionListChoices;
import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerType;
import org.eclipse.wst.server.core.ServerCore;
@@ -952,5 +953,4 @@
return (String)runtimeIdByLabel_.get(label);
}
-
}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java
new file mode 100644
index 0000000..28801ec
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java
@@ -0,0 +1,1401 @@
+package org.eclipse.jst.ws.internal.consumption.ui.wsrt;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.Vector;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.ws.internal.consumption.ui.common.FacetMatcher;
+import org.eclipse.jst.ws.internal.consumption.ui.common.FacetUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.wizard.TypeSelectionFilter2;
+import org.eclipse.jst.ws.internal.data.LabelsAndIds;
+import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
+import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils;
+import org.eclipse.wst.command.internal.provisional.env.core.selection.SelectionList;
+import org.eclipse.wst.command.internal.provisional.env.core.selection.SelectionListChoices;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action.Type;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerType;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.wst.server.ui.ServerUICore;
+import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceRuntime;
+import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceScenario;
+
+public class WebServiceRuntimeExtensionUtils2
+{
+ private static WebServiceRuntimeExtensionRegistry2 registry = WebServiceRuntimeExtensionRegistry2.getInstance();
+
+ public static RuntimeDescriptor getRuntimeById(String id)
+ {
+ Object result = registry.runtimes_.get(id);
+ if (result!=null)
+ {
+ return (RuntimeDescriptor)result;
+ }
+ return null;
+ }
+
+ public static String getRuntimeLabelById(String runtimeId)
+ {
+ RuntimeDescriptor desc = getRuntimeById(runtimeId);
+ if (desc == null)
+ return null;
+
+ return desc.getLabel();
+ }
+
+ public static RuntimeDescriptor getRuntimeByLabel(String label)
+ {
+ Iterator iter = registry.runtimes_.values().iterator();
+ while (iter.hasNext())
+ {
+ RuntimeDescriptor descriptor = (RuntimeDescriptor)iter.next();
+ if (descriptor!=null) {
+ if (label.equals(descriptor.getLabel()))
+ return descriptor;
+ }
+ }
+ return null;
+ }
+
+ public static String getServerLabelById(String serverFactoryId)
+ {
+ IServerType serverType = ServerCore.findServerType(serverFactoryId);
+ if (serverType == null)
+ return null;
+
+ String serverLabel = ServerUICore.getLabelProvider().getText(serverType);
+ return serverLabel;
+ }
+
+ public static String getServerInstanceLabelFromInstanceId( String instanceId )
+ {
+ IServer server = ServerCore.findServer( instanceId );
+ return server.getName();
+ }
+
+ //Service-side utilities
+ public static WebServiceImpl getWebServiceImplById(String id)
+ {
+ Object result = registry.webServiceImpls_.get(id);
+ if (result!=null)
+ {
+ return (WebServiceImpl)result;
+ }
+ return null;
+ }
+
+ public static ServiceRuntimeDescriptor getServiceRuntimeDescriptorById(String id)
+ {
+ Object result = registry.serviceRuntimes_.get(id);
+ if (result!=null)
+ {
+ return (ServiceRuntimeDescriptor)result;
+ }
+ return null;
+ }
+
+ public static IWebServiceRuntime getServiceRuntime( String serviceRuntimeId )
+ {
+ ServiceRuntimeDescriptor descriptor = getServiceRuntimeDescriptorById(serviceRuntimeId);
+ IWebServiceRuntime webserviceRuntime = null;
+ if (descriptor != null)
+ {
+ webserviceRuntime = descriptor.getWebServiceRuntime();
+ }
+
+ return webserviceRuntime;
+ }
+
+ public static String getServiceRuntimeId(TypeRuntimeServer trs, String projectName, String templateId)
+ {
+ //Find the first client runtime that supports the implementation type, runtime, server, and project
+ String[] descs = getServiceRuntimesByServiceType(trs.getTypeId());
+ for (int i=0; i<descs.length; i++)
+ {
+ ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(descs[i]);
+ if (desc.getRuntime().getId().equals(trs.getRuntimeId()))
+ {
+ boolean supportsServer = doesServiceRuntimeSupportServer(desc.getId(), trs.getServerId());
+ if (!supportsServer)
+ {
+ continue;
+ }
+
+ IProject project = ProjectUtilities.getProject(projectName);
+ if (project.exists())
+ {
+ if (doesServiceRuntimeSupportProject(desc.getId(), projectName))
+ {
+ return desc.getId();
+ }
+ }
+ else
+ {
+ //Check if template is supported
+ if (doesServiceRuntimeSupportTemplate(desc.getId(), templateId))
+ {
+ return desc.getId();
+ }
+ }
+ }
+ }
+
+ return "";
+
+ }
+
+ /*
+ * @param typeId will be a String of the format "0/implId"
+ * where the digit before the "/" represents the scenario
+ * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the id
+ * of the WebServiceImpl
+ */
+ public static int getScenarioFromTypeId(String typeId)
+ {
+ return Integer.parseInt(typeId.substring(0,typeId.indexOf("/")));
+ }
+
+ /*
+ * @param typeId will be a String of the format "0/implId"
+ * where the digit before the "/" represents the scenario
+ * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the id
+ * of the WebServiceImpl
+ */
+ public static String getWebServiceImplIdFromTypeId(String typeId)
+ {
+ return typeId.substring(typeId.indexOf("/")+1);
+ }
+
+ /*
+ * @param typeId will be a String of the format "0/implId"
+ * where the digit before the "/" represents the scenario
+ * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the id
+ * of the WebServiceImpl
+ *
+ * @returns String[] containing the ids of all runtimes that
+ * support this type.
+ */
+ public static String[] getRuntimesByServiceType(String typeId)
+ {
+ int scenario = getScenarioFromTypeId(typeId);
+ String implId = getWebServiceImplIdFromTypeId(typeId);
+ ArrayList ids = new ArrayList();
+ Iterator iter = registry.serviceRuntimes_.values().iterator();
+ while (iter.hasNext())
+ {
+ ServiceRuntimeDescriptor desc = (ServiceRuntimeDescriptor)iter.next();
+ //Check if this serviceRuntime supports the implementation type
+ if (desc.getServiceImplementationType().getId().equals(implId))
+ {
+ switch (scenario)
+ {
+ case WebServiceScenario.BOTTOMUP:
+ if (desc.getBottomUp())
+ {
+ String runtimeId = desc.getRuntime().getId();
+ if (!ids.contains(runtimeId))
+ {
+ ids.add(runtimeId);
+ }
+ }
+ break;
+ case WebServiceScenario.TOPDOWN:
+ if (desc.getTopDown())
+ {
+ String runtimeId = desc.getRuntime().getId();
+ if (!ids.contains(runtimeId))
+ {
+ ids.add(runtimeId);
+ }
+ }
+ break;
+ default:
+ }
+ }
+ }
+
+ return (String[])ids.toArray(new String[]{});
+ }
+
+ /*
+ * @param typeId will be a String of the format "0/implId"
+ * where the digit before the "/" represents the scenario
+ * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the id
+ * of the WebServiceImpl
+ *
+ * @returns String[] containing the ids of all service runtimes that
+ * support this type.
+ */
+ public static String[] getServiceRuntimesByServiceType(String typeId)
+ {
+ int scenario = getScenarioFromTypeId(typeId);
+ String implId = getWebServiceImplIdFromTypeId(typeId);
+ ArrayList ids = new ArrayList();
+ Iterator iter = registry.serviceRuntimes_.values().iterator();
+ while (iter.hasNext())
+ {
+ ServiceRuntimeDescriptor desc = (ServiceRuntimeDescriptor)iter.next();
+ //Check if this serviceRuntime supports the implementation type
+ if (desc.getServiceImplementationType().getId().equals(implId))
+ {
+ switch (scenario)
+ {
+ case WebServiceScenario.BOTTOMUP:
+ if (desc.getBottomUp())
+ {
+ String serviceRuntimeId = desc.getId();
+ ids.add(serviceRuntimeId);
+ }
+ break;
+ case WebServiceScenario.TOPDOWN:
+ if (desc.getTopDown())
+ {
+ String serviceRuntimeId = desc.getId();
+ ids.add(serviceRuntimeId);
+ }
+ break;
+ default:
+ }
+ }
+ }
+
+ return (String[])ids.toArray(new String[]{});
+ }
+ /*
+ * @param typeId will be a String of the format "0/implId"
+ * where the digit before the "/" represents the scenario
+ * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the id
+ * of the WebServiceImpl
+ * @param runtimeId id of a Web service runtime (RuntimeDescriptor)
+ */
+ public static boolean isRuntimeSupportedForServiceType(String typeId, String runtimeId)
+ {
+ String[] serviceRuntimeIds = getServiceRuntimesByServiceType(typeId);
+ if (serviceRuntimeIds!=null)
+ {
+ for (int i=0; i < serviceRuntimeIds.length; i++)
+ {
+ ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(serviceRuntimeIds[i]);
+ if (desc.getRuntime().getId().equals(runtimeId))
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ public static String[] getServerFactoryIdsByServiceType(String typeId)
+ {
+ ArrayList serverFactoryIds = new ArrayList();
+ String[] srts = getServiceRuntimesByServiceType(typeId);
+ if (srts != null)
+ {
+ for (int i = 0; i < srts.length; i++)
+ {
+ //Get the runtimes that work for the facets required for this service runtime
+ ServiceRuntimeDescriptor descriptor = getServiceRuntimeDescriptorById(srts[i]);
+ Set runtimes = getRuntimes(descriptor.getProjectFacetVersions());
+ IServerType[] allServerTypes = ServerCore.getServerTypes();
+ //TODO iterate over all the server types and see if their runtime types have an
+ //id that matches the runtime type of any of the runtimes.
+ }
+ }
+
+ //return (String[])serverFactoryIds.toArray(new String[]{});
+
+ //Temporarily return all server type ids.
+ return getAllServerFactoryIdsWithRuntimes();
+ }
+
+ /*
+ * @param typeId will be a String of the format "0/implId"
+ * where the digit before the "/" represents the scenario
+ * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the id
+ * of the WebServiceImpl
+ */
+ public static boolean isServerSupportedForChosenServiceType(String typeId, String serverFactoryId)
+ {
+ String[] fIds = getServerFactoryIdsByServiceType(typeId);
+ if (fIds == null)
+ {
+ return false;
+ }
+
+ for (int i=0;i<fIds.length;i++)
+ {
+ if (serverFactoryId.equals(fIds[i]))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public static String[] getServerFactoryIdsByServiceRuntime(String serviceRuntimeId)
+ {
+ ArrayList serverFactoryIds = new ArrayList();
+
+ ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(serviceRuntimeId);
+ Set facetRuntimes = getRuntimes(desc.getProjectFacetVersions());
+
+ //TODO iterate over all the server types and see if their runtime types have an
+ //id that matches the runtime type of any of the runtimes.
+
+ //return (String[])serverFactoryIds.toArray(new String[]{});
+ //Temporarily return all server types
+ return getAllServerFactoryIdsWithRuntimes();
+ }
+
+
+ public static boolean doesServiceRuntimeSupportServer(String serviceRuntimeId, String serverFactoryId)
+ {
+ String[] serverIds = getServerFactoryIdsByServiceRuntime(serviceRuntimeId);
+ for (int i=0; i<serverIds.length; i++)
+ {
+ if (serverIds[i].equals(serverFactoryId))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+
+ public static LabelsAndIds getServiceTypeLabels()
+ {
+ String pluginId = "org.eclipse.jst.ws.consumption.ui";
+ MessageUtils msgUtils = new MessageUtils( pluginId + ".plugin", registry );
+
+ LabelsAndIds labelIds = new LabelsAndIds();
+ Iterator iterator = registry.webServiceTypesList_.iterator();
+ int size = registry.webServiceTypesList_.size();
+ String[] labels = new String[size];
+ String[] ids = new String[size];
+ int index = 0;
+
+ labelIds.setLabels_( labels );
+ labelIds.setIds_( ids );
+
+ while( iterator.hasNext() )
+ {
+ String wst = (String)iterator.next();
+ int scenario = getScenarioFromTypeId(wst);
+ String implId = getWebServiceImplIdFromTypeId(wst);
+ WebServiceImpl wsimpl = getWebServiceImplById(implId);
+ String impllabel = wsimpl.getLabel();
+ ids[index] = wst;
+ String scenLabel = "";
+ switch(scenario)
+ {
+ case WebServiceScenario.BOTTOMUP:
+ scenLabel = msgUtils.getMessage(WebServiceScenario.BOTTOMUP_LABEL);
+ break;
+ case WebServiceScenario.TOPDOWN:
+ scenLabel = msgUtils.getMessage(WebServiceScenario.TOPDOWN_LABEL);
+ break;
+ default:
+ }
+ labels[index] = msgUtils.getMessage( "COMBINED_TYPE_AND_RUNTIME_LABEL", new String[]{ scenLabel, impllabel } );
+ index++;
+ }
+
+ return labelIds;
+ }
+
+ /*
+ * @param typeId will be a String of the format "0/implId"
+ * where the digit before the "/" represents the scenario
+ * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the id
+ * of the WebServiceImpl
+ */
+ public static String getDefaultRuntimeValueFor(String typeId)
+ {
+ String[] srIds = getServiceRuntimesByServiceType(typeId);
+ if (srIds == null)
+ {
+ return null;
+ }
+
+ ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(srIds[0]);
+ return desc.getRuntime().getId();
+ }
+
+ public static String getDefaultServerValueFor(String typeId)
+ {
+ String[] fIds = getServerFactoryIdsByServiceType(typeId);
+ if (fIds==null)
+ return null;
+
+ return fIds[0];
+ }
+
+ /*
+ * @param typeId will be a String of the format "0/implId"
+ * where the digit before the "/" represents the scenario
+ * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the id
+ * of the WebServiceImpl
+ * @param runtimeId is the id of a RuntimeDescriptor
+ * @param serverFactoryId server factory id
+ */
+ public static boolean isServerRuntimeTypeSupported(String serverFactoryId, String runtimeId, String typeId)
+ {
+ //Ensure there is at least one service runtime that supports the given type
+ String[] serviceRuntimes = getServiceRuntimesByServiceType(typeId);
+ if (serviceRuntimes!=null && serviceRuntimes.length>0)
+ {
+ //Ensure that at least one of these server runtimes supports the given server
+ for (int i=0; i<serviceRuntimes.length; i++)
+ {
+ ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(serviceRuntimes[i]);
+ Set runtimes = getRuntimes(desc.getProjectFacetVersions());
+ //TODO Iterate through the runtimes to see if there is a facet runtime that corresponds
+ //to a server runtime for this server type.
+
+ //Temporarily return true
+ return true;
+
+ }
+ }
+
+ return false;
+ }
+
+ public static String[] getWebServiceTypeBySelection(IStructuredSelection selection)
+ {
+ TypeSelectionFilter2 tsf = new TypeSelectionFilter2();
+ String[] wst = tsf.getWebServiceTypeByInitialSelection(selection, registry.webServiceTypesList_);
+ return wst == null ? null : wst;
+ }
+
+ /*
+ * @param runtimeId : id of a RuntimeDescriptor
+ * @param factoryId : id of a server type
+ */
+ public static boolean doesRuntimeSupportServerForServiceSide(String runtimeId, String factoryId)
+ {
+ //Get all the ServiceRuntimeDescriptors that point to this runtimeId
+ Iterator iter = registry.serviceRuntimes_.values().iterator();
+ while (iter.hasNext())
+ {
+ ServiceRuntimeDescriptor desc = (ServiceRuntimeDescriptor)iter.next();
+ //check if this service runtime points to runtimeId
+ String thisRuntimeId = desc.getRuntime().getId();
+ if (thisRuntimeId.equals(runtimeId))
+ {
+ Set facetRuntimes = getRuntimes(desc.getProjectFacetVersions());
+ //TODO Iterate over the facetRuntimes to see if any of them is a suitable server runtime for a
+ //server of the given type. If so, return true.
+
+ //Temporarily return true
+ return true;
+ }
+ }
+
+ //return false;
+
+ //Always return true temporarily
+ return true;
+ }
+
+ /*
+ * @param runtimeId: id of a RuntimeDescriptor
+ * @return: server factory id
+ */
+ public static String getFirstSupportedServerForServiceSide(String runtimeId)
+ {
+ //Get all the ServiceRuntimeDescriptors that point to this runtimeId
+ Iterator iter = registry.serviceRuntimes_.values().iterator();
+ while (iter.hasNext())
+ {
+ ServiceRuntimeDescriptor desc = (ServiceRuntimeDescriptor)iter.next();
+ //check if this service runtime points to runtimeId
+ String thisRuntimeId = desc.getRuntime().getId();
+ if (thisRuntimeId.equals(runtimeId))
+ {
+ Set facetRuntimes = getRuntimes(desc.getProjectFacetVersions());
+ IServerType[] allServerTypes = ServerCore.getServerTypes();
+ //TODO iterate over all the server types and return the first server type that
+ //has a server runtime corresponding to a supported facet runtime.
+ }
+ }
+
+ //Temporarliy return the first server type
+ String[] factoryIds = getAllServerFactoryIdsWithRuntimes();
+ if (factoryIds!=null && factoryIds.length >0)
+ {
+ return factoryIds[0];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static String[] getProjectsForServiceTypeAndRuntime(String typeId, String runtimeId)
+ {
+ String[] descs = getServiceRuntimesByServiceType(typeId);
+ IProject[] projects = FacetUtils.getAllProjects();
+ ArrayList validProjects = new ArrayList();
+
+ for (int i=0; i<projects.length;i++)
+ {
+ //check if this projects suits any of the service runtimes
+ for (int j=0; j<descs.length; j++)
+ {
+ ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(descs[j]);
+ RequiredFacetVersion[] rfvs = desc.getRequiredFacetVersions();
+ try
+ {
+ IFacetedProject fproject = ProjectFacetsManager.create(projects[i]);
+ if (fproject != null)
+ {
+ Set facetVersions = fproject.getProjectFacets();
+ FacetMatcher fm = FacetUtils.match(rfvs, facetVersions);
+ if (fm.isMatch())
+ {
+ validProjects.add(projects[i].getName());
+ break;
+ }
+ }
+ else
+ {
+ //TODO Handle the plain-old Java projects
+ }
+ } catch (CoreException ce)
+ {
+
+ }
+ }
+ }
+
+ return (String[])validProjects.toArray(new String[0]);
+
+ }
+
+ public static boolean doesServiceRuntimeSupportProject(String serviceRuntimeId, String projectName)
+ {
+ IProject project = ProjectUtilities.getProject(projectName);
+ if (project==null || !project.exists())
+ return false;
+
+ ServiceRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getServiceRuntimeDescriptorById(serviceRuntimeId);
+ RequiredFacetVersion[] rfvs = desc.getRequiredFacetVersions();
+
+ try
+ {
+ IFacetedProject fproject = ProjectFacetsManager.create(project);
+ if (fproject != null)
+ {
+ Set facetVersions = fproject.getProjectFacets();
+ FacetMatcher fm = FacetUtils.match(rfvs, facetVersions);
+ if (fm.isMatch())
+ {
+ return true;
+ }
+ }
+ else
+ {
+ //TODO Handle the plain-old Java projects
+ }
+ } catch (CoreException ce)
+ {
+
+ }
+
+ return false;
+ }
+
+ /*
+ * Returns a list of valid faceted project template ids
+ * @param typeId id of the form "0/implId" on the service side.
+ * @param runtimeId id of a RuntimeDescriptor
+ *
+ * @return String[] array of IFacetedProjectTemplate ids
+ */
+ public static String[] getServiceProjectTemplates(String typeId, String runtimeId)
+ {
+ String[] srIds = getServiceRuntimesByServiceType(typeId);
+ if (srIds == null)
+ {
+ return null;
+ }
+
+ ArrayList templateIdList = new ArrayList();
+ for (int i = 0; i < srIds.length; i++)
+ {
+ ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(srIds[i]);
+ String thisRuntimeId = desc.getRuntime().getId();
+ if (thisRuntimeId.equals(runtimeId))
+ {
+ //Get the templates for this client runtime
+ Set templateIds = FacetUtils.getTemplates(desc.getRequiredFacetVersions());
+
+ //Add the template ids to the list if they have not already been added
+ Iterator itr = templateIds.iterator();
+ while (itr.hasNext())
+ {
+ IFacetedProjectTemplate template = (IFacetedProjectTemplate)itr.next();
+ if (!templateIdList.contains(template.getId()))
+ {
+ templateIdList.add(template.getId());
+ }
+ }
+ }
+
+ }
+
+ return (String[])templateIdList.toArray(new String[]{});
+ }
+
+ public static boolean doesServiceRuntimeSupportTemplate(String serviceRuntimeId, String templateId)
+ {
+ ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(serviceRuntimeId);
+ //Get the templates for this client runtime
+ Set templateIds = FacetUtils.getTemplates(desc.getRequiredFacetVersions());
+ return templateIds.contains(templateId);
+ }
+
+ //Client-side utilities
+ public static WebServiceClientImpl getWebServiceClientImplById(String id)
+ {
+ Object result = registry.webServiceClientImpls_.get(id);
+ if (result!=null)
+ {
+ return (WebServiceClientImpl)result;
+ }
+ return null;
+ }
+
+ public static ClientRuntimeDescriptor getClientRuntimeDescriptorById(String id)
+ {
+ Object result = registry.clientRuntimes_.get(id);
+ if (result!=null)
+ {
+ return (ClientRuntimeDescriptor)result;
+ }
+ return null;
+ }
+
+ public static IWebServiceRuntime getClientRuntime( String clientRuntimeId )
+ {
+ ClientRuntimeDescriptor descriptor = getClientRuntimeDescriptorById(clientRuntimeId);
+ IWebServiceRuntime webserviceRuntime = null;
+ if (descriptor != null)
+ {
+ webserviceRuntime = descriptor.getWebServiceRuntime();
+ }
+
+ return webserviceRuntime;
+ }
+
+ public static String getClientRuntimeId(TypeRuntimeServer trs, String projectName, String templateId)
+ {
+ //Find the first client runtime that supports the implementation type, runtime, server, and project
+ String[] descs = getClientRuntimesByType(trs.getTypeId());
+ for (int i=0; i<descs.length; i++)
+ {
+ ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(descs[i]);
+ if (desc.getRuntime().getId().equals(trs.getRuntimeId()))
+ {
+ boolean supportsServer = doesClientRuntimeSupportServer(desc.getId(), trs.getServerId());
+ if (!supportsServer)
+ {
+ continue;
+ }
+
+ IProject project = ProjectUtilities.getProject(projectName);
+ if (project.exists())
+ {
+ if (doesClientRuntimeSupportProject(desc.getId(), projectName))
+ {
+ return desc.getId();
+ }
+ }
+ else
+ {
+ //Check if template is supported
+ if (doesClientRuntimeSupportTemplate(desc.getId(), templateId))
+ {
+ return desc.getId();
+ }
+ }
+ }
+ }
+
+ return "";
+
+ }
+
+ /*
+ * @return String[] array of ids of RuntimeDescriptors
+ */
+ public static String[] getAllRuntimesForClientSide()
+ {
+ ArrayList runtimeIds = new ArrayList();
+ Iterator iter = registry.clientRuntimes_.values().iterator();
+ while (iter.hasNext())
+ {
+ ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)iter.next();
+ runtimeIds.add(desc.getRuntime().getId());
+ }
+ return (String[])runtimeIds.toArray(new String[]{});
+ }
+
+ /*
+ * @param clientImpld The id of a client implementation type
+ *
+ * @returns String[] containing the ids of all clientRuntimes that
+ * support this client implementation type
+ */
+ public static String[] getClientRuntimesByType(String clientImplId)
+ {
+ ArrayList ids = new ArrayList();
+ Iterator iter = registry.clientRuntimes_.values().iterator();
+ while (iter.hasNext())
+ {
+ ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)iter.next();
+ //Check if this serviceRuntime supports the implementation type
+ if (desc.getClientImplementationType().getId().equals(clientImplId))
+ {
+ ids.add(desc.getId());
+ }
+ }
+
+ return (String[])ids.toArray(new String[]{});
+ }
+
+ /*
+ * @param clientImplId id of a WebServiceClientImpl
+ * @return String[] array of RuntimeDescriptor ids
+ */
+ public static String[] getRuntimesByClientType(String clientImplId)
+ {
+ ArrayList runtimeIds = new ArrayList();
+ Iterator iter = registry.clientRuntimes_.values().iterator();
+ while (iter.hasNext())
+ {
+ ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)iter.next();
+ //Check if this serviceRuntime supports the implementation type
+ if (desc.getClientImplementationType().getId().equals(clientImplId))
+ {
+ runtimeIds.add(desc.getRuntime().getId());
+ }
+ }
+
+ return (String[])runtimeIds.toArray(new String[]{});
+ }
+
+ /*
+ * @param clientImplId The id of a client implementation type
+ * @param runtimeId id of a runtime (RuntimeDescriptor)
+ */
+ public static boolean isRuntimeSupportedForClientType(String clientImplId, String runtimeId)
+ {
+ String[] clientRuntimeIds = getClientRuntimesByType(clientImplId);
+ if (clientRuntimeIds!=null)
+ {
+ for (int i=0; i < clientRuntimeIds.length; i++)
+ {
+ ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(clientRuntimeIds[i]);
+ if (desc.getRuntime().getId().equals(runtimeId))
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ public static String[] getAllClientServerFactoryIds()
+ {
+ ArrayList serverFactoryIds = new ArrayList();
+ Iterator iter = registry.clientRuntimes_.values().iterator();
+ while (iter.hasNext())
+ {
+ ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)iter.next();
+ Set runtimes = getRuntimes(desc.getProjectFacetVersions());
+ IServerType[] allServerTypes = ServerCore.getServerTypes();
+ //TODO iterate over all the server types and see if their runtime types have an
+ //id that matches the runtime type of any of the runtimes.
+ }
+
+ //return (String[])serverFactoryIds.toArray(new String[]{});
+ //Temporarily return all server types
+ return getAllServerFactoryIdsWithRuntimes();
+ }
+
+ public static String[] getServerFactoryIdsByClientType(String clientImplId)
+ {
+ ArrayList serverFactoryIds = new ArrayList();
+ String[] crts = getClientRuntimesByType(clientImplId);
+ if (crts != null)
+ {
+ for (int i = 0; i < crts.length; i++)
+ {
+ //Get the runtimes that work for the facets required for this client runtime
+ ClientRuntimeDescriptor descriptor = getClientRuntimeDescriptorById(crts[i]);
+ Set runtimes = getRuntimes(descriptor.getProjectFacetVersions());
+ IServerType[] allServerTypes = ServerCore.getServerTypes();
+ //TODO iterate over all the server types and see if their runtime types have an
+ //id that matches the runtime type of any of the runtimes.
+ }
+ }
+
+ //return (String[])serverFactoryIds.toArray(new String[]{});
+ //Temporarily return all server types
+ return getAllServerFactoryIdsWithRuntimes();
+ }
+
+ /*
+ *
+ */
+ public static boolean isServerSupportedForChosenClientType(String clientImplId, String serverFactoryId)
+ {
+ String[] fIds = getServerFactoryIdsByClientType(clientImplId);
+ if (fIds == null)
+ {
+ return false;
+ }
+
+ for (int i=0;i<fIds.length;i++)
+ {
+ if (serverFactoryId.equals(fIds[i]))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /*
+ * @prarm clientRuntimeId : id of a ClientRuntimeDescriptor
+ *
+ */
+ public static String[] getServerFactoryIdsByClientRuntime(String clientRuntimeId)
+ {
+ ArrayList serverFactoryIds = new ArrayList();
+
+ ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(clientRuntimeId);
+ Set facetRuntimes = getRuntimes(desc.getProjectFacetVersions());
+
+ //TODO iterate over all the server types and see if their runtime types have an
+ //id that matches the runtime type of any of the runtimes.
+
+ //return (String[])serverFactoryIds.toArray(new String[]{});
+ //Temporarily return all server types
+ return getAllServerFactoryIdsWithRuntimes();
+ }
+
+ /*
+ * @param clientRuntimeId id of a ClientRuntimeDescriptor
+ */
+ public static boolean doesClientRuntimeSupportServer(String clientRuntimeId, String serverFactoryId)
+ {
+ String[] serverIds = getServerFactoryIdsByClientRuntime(clientRuntimeId);
+ for (int i=0; i<serverIds.length; i++)
+ {
+ if (serverIds[i].equals(serverFactoryId))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /*
+ * @param runtimeId : id of a RuntimeDescriptor
+ * @param factoryId : id of a server type
+ */
+ public static boolean doesRuntimeSupportServerForClientSide(String runtimeId, String factoryId)
+ {
+ //Get all the ClientRuntimeDescriptors that point to this runtimeId
+ Iterator iter = registry.clientRuntimes_.values().iterator();
+ while (iter.hasNext())
+ {
+ ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)iter.next();
+ //check if this client runtime points to runtimeId
+ String thisRuntimeId = desc.getRuntime().getId();
+ if (thisRuntimeId.equals(runtimeId))
+ {
+ Set facetRuntimes = getRuntimes(desc.getProjectFacetVersions());
+ //TODO Iterate over the facetRuntimes to see if any of them is a suitable server runtime for a
+ //server of the given type. If so, return true.
+
+ //Temporarliy return true
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /*
+ * @param runtimeId: id of a RuntimeDescriptor
+ * @return: server factory id
+ */
+ public static String getFirstSupportedServerForClientSide(String runtimeId)
+ {
+ //Get all the ClientRuntimeDescriptors that point to this runtimeId
+ Iterator iter = registry.clientRuntimes_.values().iterator();
+ while (iter.hasNext())
+ {
+ ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)iter.next();
+ //check if this service runtime points to runtimeId
+ String thisRuntimeId = desc.getRuntime().getId();
+ if (thisRuntimeId.equals(runtimeId))
+ {
+ Set facetRuntimes = getRuntimes(desc.getProjectFacetVersions());
+ IServerType[] allServerTypes = ServerCore.getServerTypes();
+ //TODO iterate over all the server types and return the first server type that
+ //has a server runtime corresponding to a supported facet runtime.
+ }
+ }
+
+ //Temporarliy return the first server type
+ String[] factoryIds = getAllServerFactoryIdsWithRuntimes();
+ if (factoryIds!=null && factoryIds.length >0)
+ {
+ return factoryIds[0];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /*
+ * @param clientImplId is the id of a WebServiceClientImpl
+ * @param runtimeId is the id of a RuntimeDescriptor
+ * @param serverFactoryId server factory id
+ */
+ public static boolean isServerClientRuntimeTypeSupported(String serverFactoryId, String runtimeId, String clientImplId)
+ {
+ //Ensure there is at least one client runtime that supports the given type
+ String[] clientRuntimes = getClientRuntimesByType(clientImplId);
+ if (clientRuntimes!=null && clientRuntimes.length>0)
+ {
+ //Ensure that at least one of these server runtimes supports the given server
+ for (int i=0; i<clientRuntimes.length; i++)
+ {
+ ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(clientRuntimes[i]);
+ Set runtimes = getRuntimes(desc.getProjectFacetVersions());
+ //TODO Iterate through the runtimes to see if there is a facet runtime that corresponds
+ //to a server runtime for this server type.
+
+ //Temporarily return true
+ return true;
+
+ }
+ }
+
+ return false;
+ }
+
+ /*
+ * Returns a list of valid faceted project template ids
+ * @param clientImplId id of a WebServiceClientImpl
+ * @param runtimeId id of a RuntimeDescriptor
+ *
+ * @return String[] array of IFacetedProjectTemplate ids
+ */
+ public static String[] getClientProjectTemplates(String clientImplId, String runtimeId)
+ {
+ String[] crIds = getClientRuntimesByType(clientImplId);
+ if (crIds == null)
+ {
+ return null;
+ }
+
+ ArrayList templateIdList = new ArrayList();
+ for (int i = 0; i < crIds.length; i++)
+ {
+ ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(crIds[i]);
+ String thisRuntimeId = desc.getRuntime().getId();
+ if (thisRuntimeId.equals(runtimeId))
+ {
+ //Get the templates for this client runtime
+ Set templateIds = FacetUtils.getTemplates(desc.getRequiredFacetVersions());
+
+ //Add the template ids to the list if they have not already been added
+ Iterator itr = templateIds.iterator();
+ while (itr.hasNext())
+ {
+ IFacetedProjectTemplate template = (IFacetedProjectTemplate)itr.next();
+ if (!templateIdList.contains(template.getId()))
+ {
+ templateIdList.add(template.getId());
+ }
+ }
+ }
+
+ }
+
+ return (String[])templateIdList.toArray(new String[]{});
+ }
+
+ public static boolean doesClientTypeAndRuntimeSupportTemplate(String clientImplId, String runtimeId, String templateId)
+ {
+ String[] templateIds = getClientProjectTemplates(clientImplId, runtimeId);
+ if (templateIds!=null)
+ {
+ for (int i=0; i<templateIds.length; i++)
+ {
+ if (templateIds[i].equals(templateId))
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ public static boolean doesClientRuntimeSupportTemplate(String clientRuntimeId, String templateId)
+ {
+ ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(clientRuntimeId);
+ //Get the templates for this client runtime
+ Set templateIds = FacetUtils.getTemplates(desc.getRequiredFacetVersions());
+ return templateIds.contains(templateId);
+ }
+
+
+ public static LabelsAndIds getClientTypeLabels()
+ {
+
+ LabelsAndIds labelIds = new LabelsAndIds();
+ String[] idsArray = new String[0];
+ String[] labelsArray = new String[0];
+ labelIds.setIds_(idsArray);
+ labelIds.setLabels_(labelsArray);
+
+ ArrayList ids = new ArrayList();
+ ArrayList labels = new ArrayList();
+
+ Iterator itr = registry.clientRuntimes_.values().iterator();
+ while(itr.hasNext())
+ {
+ ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)itr.next();
+ WebServiceClientImpl thisClientImpl = desc.getClientImplementationType();
+ if (!ids.contains(thisClientImpl.getId()))
+ {
+ ids.add(thisClientImpl.getId());
+ labels.add(thisClientImpl.getLabel());
+ }
+ }
+
+ if (ids.size() > 0)
+ {
+ idsArray = (String[]) ids.toArray(new String[0]);
+ labelsArray = (String[]) labels.toArray(new String[0]);
+ labelIds.setIds_(idsArray);
+ labelIds.setLabels_(labelsArray);
+ }
+
+ return labelIds;
+
+ }
+
+ public static String[] getAllServerFactoryIdsWithRuntimes()
+ {
+ ArrayList fids = new ArrayList();
+ IServerType[] sts = ServerCore.getServerTypes();
+ org.eclipse.wst.server.core.IRuntime[] rts = ServerCore.getRuntimes();
+
+ for (int i=0; i<sts.length; i++)
+ {
+ IServerType st = sts[i];
+ for (int j=0; j<rts.length; j++)
+ {
+ org.eclipse.wst.server.core.IRuntime rt = rts[j];
+ // If the server type has the same runtime type as this runtime, add it to the list
+ String serverTypeRuntimeTypeId = st.getRuntimeType().getId();
+ String runtimeRuntimeTypeId = rt.getRuntimeType().getId();
+ if (serverTypeRuntimeTypeId.equals(runtimeRuntimeTypeId))
+ {
+ if (!fids.contains(st.getId()))
+ {
+ fids.add(st.getId());
+ }
+ }
+ }
+ }
+
+ return (String[])fids.toArray(new String[0]);
+ }
+
+ public static String[] getProjectsForClientTypeAndRuntime(String typeId, String runtimeId)
+ {
+ String[] descs = getClientRuntimesByType(typeId);
+ IProject[] projects = FacetUtils.getAllProjects();
+ ArrayList validProjects = new ArrayList();
+
+ for (int i=0; i<projects.length;i++)
+ {
+ //check if this projects suits any of the client runtimes
+ for (int j=0; j<descs.length; j++)
+ {
+ ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(descs[j]);
+ RequiredFacetVersion[] rfvs = desc.getRequiredFacetVersions();
+ try
+ {
+ IFacetedProject fproject = ProjectFacetsManager.create(projects[i]);
+ if (fproject != null)
+ {
+ Set facetVersions = fproject.getProjectFacets();
+ FacetMatcher fm = FacetUtils.match(rfvs, facetVersions);
+ if (fm.isMatch())
+ {
+ validProjects.add(projects[i].getName());
+ break;
+ }
+ }
+ else
+ {
+ //TODO Handle the plain-old Java projects
+ }
+ } catch (CoreException ce)
+ {
+
+ }
+ }
+ }
+
+ return (String[])validProjects.toArray(new String[0]);
+
+ }
+
+ public static boolean doesClientRuntimeSupportProject(String clientRuntimeId, String projectName)
+ {
+ IProject project = ProjectUtilities.getProject(projectName);
+ if (project==null || !project.exists())
+ return false;
+
+ ClientRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimeId);
+ RequiredFacetVersion[] rfvs = desc.getRequiredFacetVersions();
+
+ try
+ {
+ IFacetedProject fproject = ProjectFacetsManager.create(project);
+ if (fproject != null)
+ {
+ Set facetVersions = fproject.getProjectFacets();
+ FacetMatcher fm = FacetUtils.match(rfvs, facetVersions);
+ if (fm.isMatch())
+ {
+ return true;
+ }
+ }
+ else
+ {
+ //TODO Handle the plain-old Java projects
+ }
+ } catch (CoreException ce)
+ {
+
+ }
+
+ return false;
+ }
+
+ //Utilities used by the ServerRuntimePreferencePage
+
+ private static SelectionListChoices serverToRuntimeToJ2EE_;
+ private static Hashtable serverFactoryIdByLabel_;
+ private static Hashtable runtimeIdByLabel_;
+
+ public static SelectionListChoices getServerToRuntimeToJ2EE()
+ {
+ if (serverToRuntimeToJ2EE_!=null)
+ {
+ return serverToRuntimeToJ2EE_;
+ }
+
+ //String[] servers = getStringArrayIntersection(getAllServerFactoryIds(), WebServiceClientTypeRegistry.getInstance().getAllClientServerFactoryIds());
+ String[] servers = getAllServerFactoryIds();
+ SelectionList serversList = new SelectionList(servers, 0);
+ Vector choices = new Vector();
+ for (int i=0; i<servers.length; i++)
+ {
+ choices.add(getRuntimeChoices(servers[i]));
+ }
+ serverToRuntimeToJ2EE_ = new SelectionListChoices(serversList, choices);
+ return serverToRuntimeToJ2EE_;
+
+ }
+
+ private static SelectionListChoices getRuntimeChoices(String serverFactoryId)
+ {
+ //Return all the runtimes for now.
+ Set runtimes = registry.runtimes_.keySet();
+ Iterator itr = registry.runtimes_.keySet().iterator();
+ String[] runtimeIds = new String[runtimes.size()];
+ //TODO String[] runtimeIds = getRuntimeIDsByServerFactoryID(serverFactoryId);
+ int i = 0;
+ while (itr.hasNext())
+ {
+ String runtimeId = (String)itr.next();
+ runtimeIds[i] = runtimeId;
+ i++;
+
+ }
+
+ SelectionList runtimesList = new SelectionList(runtimeIds, 0);
+ Vector choices = new Vector();
+ for (int j=0; j<runtimeIds.length; j++)
+ {
+ choices.add(getJ2EEChoices(runtimeIds[j]));
+ }
+ return new SelectionListChoices(runtimesList, choices);
+ }
+
+ private static SelectionListChoices getJ2EEChoices(String runtimeId)
+ {
+ //J2EE levels will be removed from the Server Runtime preference page.
+ //Return some hard coded values for now.
+ String[] j2eeVersions = new String[]{"13", "14"};
+ SelectionList j2eeVersionsList = new SelectionList(j2eeVersions, 0);
+ return new SelectionListChoices(j2eeVersionsList, null);
+ }
+
+ private static String[] getAllServerFactoryIds()
+ {
+ //Return all server type ids for now.
+ //TODO Only the servers that are appropriate for the Web service runtimes should be displayed.
+ ArrayList ids = new ArrayList();
+ if (serverFactoryIdByLabel_ == null)
+ {
+ serverFactoryIdByLabel_ = new Hashtable();
+ IServerType[] serverTypes = ServerCore.getServerTypes();
+ for (int i=0; i<serverTypes.length; i++)
+ {
+ String id = serverTypes[i].getId();
+ String label = getServerLabelById(id);
+ serverFactoryIdByLabel_.put(label, id);
+ ids.add(id);
+ }
+ }
+ else
+ {
+ Iterator fids = serverFactoryIdByLabel_.values().iterator();
+ while (fids.hasNext())
+ {
+ String fid = (String)fids.next();
+ ids.add(fid);
+ }
+ }
+
+ if (ids.size() > 0)
+ {
+ String[] serverFactoryIds = (String[])ids.toArray(new String[0]);
+ return serverFactoryIds;
+ }
+
+ return null;
+ }
+
+ //TODO this needs to be implemented once facet runtime to server runtime bridge is available.
+ /*
+ private static String[] getRuntimeIDsByServerFactoryID(String serverFactoryID)
+ {
+ ArrayList ids = new ArrayList();
+ Iterator iter = registry.webServiceRuntimes_.values().iterator();
+ while (iter.hasNext())
+ {
+ WebServiceRuntimeInfo wsr = (WebServiceRuntimeInfo)iter.next();
+ if (doesRuntimeSupportServer(wsr.getId(), serverFactoryID))
+ {
+ ids.add(wsr.getId());
+ }
+
+ }
+
+ if (ids.size() > 0)
+ {
+ String[] runtimeIds = (String[])ids.toArray(new String[0]);
+ return runtimeIds;
+ }
+
+ return null;
+
+
+ }
+ */
+
+ public static String getServerFactoryId(String label)
+ {
+ if (label==null || label.length()==0)
+ return null;
+
+ if (serverFactoryIdByLabel_ == null)
+ {
+ getAllServerFactoryIds();
+ }
+
+ if (serverFactoryIdByLabel_.containsKey(label))
+ {
+ return (String)serverFactoryIdByLabel_.get(label);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static String getRuntimeId(String label)
+ {
+
+ if (label==null || label.length()==0)
+ return null;
+
+ if (runtimeIdByLabel_ == null)
+ {
+ runtimeIdByLabel_ = new Hashtable();
+ Iterator iter = registry.runtimes_.values().iterator();
+ while (iter.hasNext())
+ {
+ RuntimeDescriptor desc = (RuntimeDescriptor)iter.next();
+ runtimeIdByLabel_.put(desc.getLabel(), desc.getId());
+ }
+ }
+
+ return (String)runtimeIdByLabel_.get(label);
+ }
+
+
+
+ //Methods that facet API should provide but that are in here temporarily with dummy implementations
+
+ public static Set getRuntimes(Set facets)
+ {
+ //Return all the runtimes in the dummy implementation
+ return RuntimeManager.getRuntimes();
+ }
+}
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 6529b2f..38da0d1 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
@@ -39,5 +39,6 @@
org.eclipse.jst.j2ee.ejb,
org.wsdl4j,
org.eclipse.wst.common.frameworks,
- org.eclipse.wst.common.environment
+ org.eclipse.wst.common.environment,
+ org.eclipse.wst.common.project.facet.core
Eclipse-AutoStart: true
diff --git a/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/extension/PreServiceDevelopCommand.java b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/extension/PreServiceDevelopCommand.java
index dac94a5..2f810fa 100644
--- a/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/extension/PreServiceDevelopCommand.java
+++ b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/extension/PreServiceDevelopCommand.java
@@ -16,7 +16,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jst.ws.internal.consumption.command.common.CreateModuleCommand;
-import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
import org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext;
import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
@@ -34,6 +34,7 @@
public class PreServiceDevelopCommand extends AbstractDataModelOperation
{
private TypeRuntimeServer typeRuntimeServer_;
+ private String serviceRuntimeId_;
private IContext context_;
private ISelection selection_;
private String project_;
@@ -73,7 +74,7 @@
}
- IWebServiceRuntime wsrt = WebServiceRuntimeExtensionUtils.getWebServiceRuntime( typeRuntimeServer_.getRuntimeId() );
+ IWebServiceRuntime wsrt = WebServiceRuntimeExtensionUtils2.getServiceRuntime( serviceRuntimeId_ );
WebServiceInfo wsInfo = new WebServiceInfo();
System.out.println( "In Pre service develop command." );
@@ -88,7 +89,7 @@
//Set up the IContext
WebServiceScenario scenario = null;
- int scenarioInt = WebServiceRuntimeExtensionUtils.getScenarioFromTypeId(typeRuntimeServer_.getTypeId());
+ int scenarioInt = WebServiceRuntimeExtensionUtils2.getScenarioFromTypeId(typeRuntimeServer_.getTypeId());
if (scenarioInt == WebServiceScenario.BOTTOMUP)
{
scenario = WebServiceScenario.BOTTOMUP_LITERAL;
@@ -160,6 +161,11 @@
{
typeRuntimeServer_ = typeRuntimeServer;
}
+
+ public void setServiceRuntimeId(String id)
+ {
+ serviceRuntimeId_ = id;
+ }
public void setServiceJ2EEVersion( String j2eeLevel )
{
diff --git a/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/ServerWizardWidget.java b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/ServerWizardWidget.java
index 8b68cb8..1956860 100644
--- a/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/ServerWizardWidget.java
+++ b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/ServerWizardWidget.java
@@ -14,7 +14,7 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.jst.ws.internal.consumption.ui.widgets.PreferencesSelectionWidget;
import org.eclipse.jst.ws.internal.consumption.ui.widgets.WebServiceClientTypeWidget;
-import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
import org.eclipse.jst.ws.internal.data.LabelsAndIds;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
import org.eclipse.jst.ws.internal.ui.common.UIUtils;
@@ -188,7 +188,7 @@
public void setServiceTypeRuntimeServer( TypeRuntimeServer ids )
{
- LabelsAndIds labelIds = WebServiceRuntimeExtensionUtils.getServiceTypeLabels();
+ LabelsAndIds labelIds = WebServiceRuntimeExtensionUtils2.getServiceTypeLabels();
//rskreg
int selection = 0;
String[] serviceIds = labelIds.getIds_();
diff --git a/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/ServerWizardWidgetDefaultingCommand.java b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/ServerWizardWidgetDefaultingCommand.java
index f447504..95f0e3e 100644
--- a/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/ServerWizardWidgetDefaultingCommand.java
+++ b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/ServerWizardWidgetDefaultingCommand.java
@@ -16,7 +16,7 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jst.ws.internal.consumption.ui.widgets.ClientWizardWidgetDefaultingCommand;
-import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
public class ServerWizardWidgetDefaultingCommand extends ClientWizardWidgetDefaultingCommand
@@ -27,9 +27,9 @@
public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable )
{
String type = getScenarioContext().getWebServiceType();
- String runtime = WebServiceRuntimeExtensionUtils.getDefaultRuntimeValueFor( type );
+ String runtime = WebServiceRuntimeExtensionUtils2.getDefaultRuntimeValueFor( type );
- String factoryID = WebServiceRuntimeExtensionUtils.getDefaultServerValueFor(type);
+ String factoryID = WebServiceRuntimeExtensionUtils2.getDefaultServerValueFor(type);
typeRuntimeServer_ = new TypeRuntimeServer();
typeRuntimeServer_.setTypeId( type );
@@ -37,7 +37,7 @@
typeRuntimeServer_.setServerId( factoryID );
//Default the typeId from the initial selection
- String[] typeIds = WebServiceRuntimeExtensionUtils.getWebServiceTypeBySelection(initialSelection_);
+ String[] typeIds = WebServiceRuntimeExtensionUtils2.getWebServiceTypeBySelection(initialSelection_);
if (typeIds!=null && typeIds.length>0)
{
diff --git a/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/binding/ServerWidgetBinding.java b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/binding/ServerWidgetBinding.java
index 29615e7..ffaff16 100644
--- a/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/binding/ServerWidgetBinding.java
+++ b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/binding/ServerWidgetBinding.java
@@ -138,36 +138,44 @@
// Before ServerRuntimeSelectionWidget
dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "GenerateProxy", ServerRuntimeSelectionWidget.class);
- dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceProject2EARProject", ServerRuntimeSelectionWidget.class);
- dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceComponentName", ServerRuntimeSelectionWidget.class);
- dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceEarComponentName", ServerRuntimeSelectionWidget.class);
+ dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceProjectName", ServerRuntimeSelectionWidget.class);
+ dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceEarProjectName", ServerRuntimeSelectionWidget.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceProject2EARProject", ServerRuntimeSelectionWidget.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceComponentName", ServerRuntimeSelectionWidget.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceEarComponentName", ServerRuntimeSelectionWidget.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceComponentType", ServerRuntimeSelectionWidget.class);
- dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "Runtime2ClientTypes", ServerRuntimeSelectionWidget.class);
- dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentName", ServerRuntimeSelectionWidget.class);
- dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarComponentName", ServerRuntimeSelectionWidget.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "Runtime2ClientTypes", ServerRuntimeSelectionWidget.class);
+ dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientProjectName", ServerRuntimeSelectionWidget.class);
+ dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", ServerRuntimeSelectionWidget.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentName", ServerRuntimeSelectionWidget.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarComponentName", ServerRuntimeSelectionWidget.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceTypeRuntimeServer", ServerRuntimeSelectionWidget.class);
+ dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceRuntimeId", ServerRuntimeSelectionWidget.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientTypeRuntimeServer", ServerRuntimeSelectionWidget.class);
- dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceJ2EEVersion", ServerRuntimeSelectionWidget.class);
- dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientJ2EEVersion", ServerRuntimeSelectionWidget.class);
+ dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientRuntimeId", ServerRuntimeSelectionWidget.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceJ2EEVersion", ServerRuntimeSelectionWidget.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientJ2EEVersion", ServerRuntimeSelectionWidget.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceNeedEAR", ServerRuntimeSelectionWidget.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientNeedEAR", ServerRuntimeSelectionWidget.class);
// After ServerRuntimeSelectionWidget
dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ServiceTypeRuntimeServer", ServerExtensionDefaultingCommand.class);
- dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ServiceJ2EEVersion", ServerExtensionDefaultingCommand.class );
+ dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ServiceRuntimeId", ServerExtensionDefaultingCommand.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ServiceJ2EEVersion", ServerExtensionDefaultingCommand.class );
dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ClientTypeRuntimeServer", ClientExtensionDefaultingCommand.class);
- dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ClientJ2EEVersion", ClientExtensionDefaultingCommand.class );
+ dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ClientRuntimeId", ClientExtensionDefaultingCommand.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ClientJ2EEVersion", ClientExtensionDefaultingCommand.class );
//dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ServiceProject2EARProject", ServerExtensionDefaultingCommand.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ServiceProjectName", ServerExtensionDefaultingCommand.class);
- dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ServiceComponentName", ServerExtensionDefaultingCommand.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ServiceComponentName", ServerExtensionDefaultingCommand.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ServiceEarProjectName", ServerExtensionDefaultingCommand.class);
- dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ServiceEarComponentName", ServerExtensionDefaultingCommand.class);
- dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "Runtime2ClientTypes", ClientExtensionDefaultingCommand.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ServiceEarComponentName", ServerExtensionDefaultingCommand.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "Runtime2ClientTypes", ClientExtensionDefaultingCommand.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ClientProjectName", ClientExtensionDefaultingCommand.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ClientEarProjectName", ClientExtensionDefaultingCommand.class);
- dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ClientComponentName", ClientExtensionDefaultingCommand.class);
- dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ClientEarComponentName", ClientExtensionDefaultingCommand.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ClientComponentName", ClientExtensionDefaultingCommand.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ClientEarComponentName", ClientExtensionDefaultingCommand.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ClientComponentType", ClientExtensionDefaultingCommand.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ServiceNeedEAR", ServerExtensionDefaultingCommand.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidget.class, "ClientNeedEAR", ClientExtensionDefaultingCommand.class);
@@ -363,6 +371,7 @@
dataRegistry.addMapping( ServerWizardWidgetOutputCommand.class, "TestService", PreClientDevelopCommand.class);
dataRegistry.addMapping( ServerWizardWidgetOutputCommand.class, "ResourceContext", PreClientDevelopCommand.class);
dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientTypeRuntimeServer", PreClientDevelopCommand.class );
+ dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientRuntimeId", 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);
@@ -456,20 +465,22 @@
// Map ServerRuntimeSelectionWidgetDefaultingCommand
dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceTypeRuntimeServer", ServerExtensionDefaultingCommand.class);
+ dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceRuntimeId", ServerExtensionDefaultingCommand.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientTypeRuntimeServer", ClientExtensionDefaultingCommand.class);
+ dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientRuntimeId", ClientExtensionDefaultingCommand.class);
//dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceProject2EARProject", 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, "Runtime2ClientTypes", ClientExtensionDefaultingCommand.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceComponentName", ServerExtensionDefaultingCommand.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceEarComponentName", ServerExtensionDefaultingCommand.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "Runtime2ClientTypes", ClientExtensionDefaultingCommand.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientProjectName", ClientExtensionDefaultingCommand.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", ClientExtensionDefaultingCommand.class);
- dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarComponentName", ClientExtensionDefaultingCommand.class);
- dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentName", ClientExtensionDefaultingCommand.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarComponentName", ClientExtensionDefaultingCommand.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentName", ClientExtensionDefaultingCommand.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentType", ClientExtensionDefaultingCommand.class);
- dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceJ2EEVersion", ServerExtensionDefaultingCommand.class);
- dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientJ2EEVersion", ClientExtensionDefaultingCommand.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceJ2EEVersion", ServerExtensionDefaultingCommand.class);
+ //dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientJ2EEVersion", ClientExtensionDefaultingCommand.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "GenerateProxy", ClientFragment.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "GenerateProxy", ClientExtensionDefaultingCommand.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceNeedEAR", ServerExtensionDefaultingCommand.class);
@@ -493,6 +504,7 @@
//
dataRegistry.addMapping( ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceComponentType", PreServiceDevelopCommand.class, "ModuleType", null);
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 );
diff --git a/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/runtime/ServerRuntimeSelectionWidget.java b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/runtime/ServerRuntimeSelectionWidget.java
index 1ca3083..f1576d2 100644
--- a/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/runtime/ServerRuntimeSelectionWidget.java
+++ b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/runtime/ServerRuntimeSelectionWidget.java
@@ -19,6 +19,7 @@
import org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime.ClientRuntimeSelectionWidget;
import org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime.ProjectSelectionWidget;
import org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime.RuntimeServerSelectionWidget;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
import org.eclipse.jst.ws.internal.ui.common.UIUtils;
import org.eclipse.swt.SWT;
@@ -57,6 +58,7 @@
private ClientRuntimeSelectionWidget clientWidget_;
private TextModifyListener textListener_;
private MessageUtils msgUtils_;
+ private String serviceRuntimeId_;
private boolean isClientWidgetVisible_ = true;
@@ -132,46 +134,31 @@
clientWidget_.setClientTypeRuntimeServer( ids );
}
- public SelectionListChoices getServiceProject2EARProject()
+ public void setServiceRuntimeId(String id)
{
- return projectWidget_.getProjectChoices();
+ serviceRuntimeId_ = id;
}
- public void setServiceProject2EARProject(SelectionListChoices serviceProject2EARProject)
+ public String getServiceRuntimeId()
{
- projectWidget_.setProjectChoices(serviceProject2EARProject);
- }
-
- public SelectionListChoices getRuntime2ClientTypes()
- {
- return clientWidget_.getRuntime2ClientTypes();
+ //calculate the most appropriate clientRuntimeId based on current settings.
+ String projectName = projectWidget_.getProjectName();
+ String templateId = projectWidget_.getComponentType();
+
+ //Find the service runtime that fits this profile best.
+ return WebServiceRuntimeExtensionUtils2.getServiceRuntimeId(runtimeWidget_.getTypeRuntimeServer(), projectName, templateId);
}
- public void setRuntime2ClientTypes(SelectionListChoices runtime2ClientTypes)
+ public void setClientRuntimeId(String id)
{
- clientWidget_.setRuntime2ClientTypes(runtime2ClientTypes);
+ clientWidget_.setClientRuntimeId(id);
}
- public String getServiceJ2EEVersion()
+ public String getClientRuntimeId()
{
- return runtimeWidget_.getJ2EEVersion();
- }
-
- public void setServiceJ2EEVersion(String j2eeVersion)
- {
- runtimeWidget_.setJ2EEVersion(j2eeVersion);
- projectWidget_.setJ2EEVersion(j2eeVersion);
- }
-
- public String getClientJ2EEVersion()
- {
- return clientWidget_.getJ2EEVersion();
- }
-
- public void setClientJ2EEVersion(String j2eeVersion)
- {
- clientWidget_.setJ2EEVersion(j2eeVersion);
- }
+ //calculate the most appropriate clientRuntimeId based on current settings.
+ return clientWidget_.getClientRuntimeId();
+ }
public boolean getServiceNeedEAR()
{
@@ -193,57 +180,17 @@
clientWidget_.setClientNeedEAR(b);
}
- public String getServiceComponentName()
- {
- return projectWidget_.getComponentName();
- }
-
- public void setServiceComponentName( String name )
- {
- projectWidget_.setComponentName( name );
- }
-
- public String getServiceEarComponentName()
- {
- return projectWidget_.getEarComponentName();
- }
-
- public void setServiceEarComponentName( String name )
- {
- projectWidget_.setEarComponentName( name );
- }
-
public void setServiceComponentType( String type )
{
projectWidget_.setComponentType( type );
}
- public String getClientComponentName()
- {
- return clientWidget_.getClientComponentName();
- }
-
- public void setClientComponentName( String name )
- {
- clientWidget_.setClientComponentName( name );
- }
-
- public String getClientEarComponentName()
- {
- return clientWidget_.getClientEarComponentName();
- }
-
- public void setClientEarComponentName( String name )
- {
- clientWidget_.setClientEarComponentName( name );
- }
-
public String getClientComponentType()
{
return clientWidget_.getClientComponentType();
}
- public void setComponentType( String type )
+ public void setClientComponentType( String type )
{
clientWidget_.setClientComponentType( type );
}
@@ -253,21 +200,41 @@
return projectWidget_.getProjectName();
}
+ public void setServiceProjectName(String name)
+ {
+ projectWidget_.setProjectName(name);
+ }
+
public String getServiceEarProjectName()
{
return projectWidget_.getEarProjectName();
}
+ public void setServiceEarProjectName(String name)
+ {
+ projectWidget_.setEarProjectName(name);
+ }
+
public String getClientProjectName()
{
return clientWidget_.getClientProjectName();
}
+ public void setClientProjectName(String name)
+ {
+ clientWidget_.setClientProjectName(name);
+ }
+
public String getClientEarProjectName()
{
return clientWidget_.getClientEarProjectName();
}
+ public void setClientEarProjectName(String name)
+ {
+ clientWidget_.setClientEarProjectName(name);
+ }
+
private class TextModifyListener implements ModifyListener
{
public void modifyText(ModifyEvent e)
@@ -282,12 +249,11 @@
clientIds.setServerInstanceId( serviceIds.getServerInstanceId() );
clientWidget_.setClientTypeRuntimeServer( clientIds );
- clientWidget_.setJ2EEVersion(runtimeWidget_.getJ2EEVersion());
+ //clientWidget_.setJ2EEVersion(runtimeWidget_.getJ2EEVersion());
}
//Set the current server selection and J2EE level on the ProjectSelectionWidget
projectWidget_.setTypeRuntimeServer(runtimeWidget_.getTypeRuntimeServer());
- projectWidget_.setJ2EEVersion(runtimeWidget_.getJ2EEVersion());
}
}
@@ -301,6 +267,7 @@
IStatus projectStatus = projectWidget_.getStatus();
IStatus clientStatus = clientWidget_.getStatus();
IStatus finalStatus = Status.OK_STATUS;
+ /*
// call child widgets' getStatus()
if( serviceStatus.getSeverity() == Status.ERROR )
@@ -336,19 +303,6 @@
IProject serviceProj = ProjectUtilities.getProject(serviceProjName);
if (serviceProj.exists())
{
- // rskreg
- //WebServiceServerRuntimeTypeRegistry wssrtRegistry = WebServiceServerRuntimeTypeRegistry.getInstance();
- //String serverTypeId = wssrtRegistry.getWebServiceServerByFactoryId(serviceServerFactoryId).getId();
- //String serverTypeId = wssrtRegistry.getWebServiceServerByFactoryId(serviceServerFactoryId).getId();
- /* rskejb
- boolean isEJBRequired = WebServiceRuntimeExtensionUtils.requiresEJBModuleFor(serviceServerFactoryId, webServiceRuntimeId, webServiceTypeId);
- if (!isEJBRequired)
- {
- //Check the Web service type to see if an EJB project is required
- //isEJBRequired = wssrtRegistry.requiresEJBProject(webServiceTypeId);
- isEJBRequired = WebServiceRuntimeExtensionUtils.requiresEJBProject(webServiceTypeId);
- }
- rskejb */
if (serviceComponentName!=null && serviceComponentName.length()>0)
{
String compTypeId = J2EEUtils.getComponentTypeId(serviceProj);
@@ -359,19 +313,6 @@
finalStatus = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_INVALID_PROJECT_TYPE",new String[]{serviceProjName, compTypeLabel}) );
}
}
- // begin remove
- /*
- boolean isEJBRequired = WebServiceRuntimeExtensionUtils.requiresEJBProject(webServiceRuntimeId, webServiceTypeId);
- if (isEJBRequired && serviceComponentName!=null && serviceComponentName.length()>0 && !J2EEUtils.isEJBComponent(serviceProj, serviceComponentName))
- {
- finalStatus = new SimpleStatus("",msgUtils_.getMessage("MSG_INVALID_EJB_PROJECT",new String[]{serviceProjName}),Status.ERROR);
- }
- if (!isEJBRequired && serviceComponentName!=null && serviceComponentName.length()>0 && !J2EEUtils.isWebComponent(serviceProj, serviceComponentName))
- {
- finalStatus = new SimpleStatus("",msgUtils_.getMessage("MSG_INVALID_WEB_PROJECT",new String[]{serviceProjName}),Status.ERROR);
- }
- */
- // end remove
}
}
@@ -404,7 +345,7 @@
}
}
-
+ */
return finalStatus;
}
diff --git a/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/runtime/ServerRuntimeSelectionWidgetDefaultingCommand.java b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/runtime/ServerRuntimeSelectionWidgetDefaultingCommand.java
index ea814cb..d346172 100644
--- a/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/runtime/ServerRuntimeSelectionWidgetDefaultingCommand.java
+++ b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/runtime/ServerRuntimeSelectionWidgetDefaultingCommand.java
@@ -10,8 +10,10 @@
*******************************************************************************/
package org.eclipse.jst.ws.internal.creation.ui.widgets.runtime;
+import java.util.Set;
import java.util.Vector;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -21,12 +23,18 @@
import org.eclipse.jst.ws.internal.common.J2EEUtils;
import org.eclipse.jst.ws.internal.common.ResourceUtils;
import org.eclipse.jst.ws.internal.common.ServerUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.common.FacetMatcher;
+import org.eclipse.jst.ws.internal.consumption.ui.common.FacetUtils;
import org.eclipse.jst.ws.internal.consumption.ui.common.ServerSelectionUtils;
import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin;
import org.eclipse.jst.ws.internal.consumption.ui.preferences.PersistentServerRuntimeContext;
import org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime.ClientRuntimeSelectionWidgetDefaultingCommand;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.ClientRuntimeDescriptor;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.RequiredFacetVersion;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.ServiceRuntimeDescriptor;
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.ServiceType;
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils;
+import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeInfo;
import org.eclipse.jst.ws.internal.context.ProjectTopologyContext;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
@@ -38,7 +46,12 @@
import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.environment.Environment;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.core.ServerUtil;
import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceScenario;
public class ServerRuntimeSelectionWidgetDefaultingCommand extends ClientRuntimeSelectionWidgetDefaultingCommand
@@ -52,20 +65,25 @@
private WSRuntimeJ2EEType webServiceRuntimeJ2EEType = null;
private TypeRuntimeServer serviceIds_;
- private SelectionListChoices serviceProject2EARProject_;
- private String serviceComponentName_;
- private String serviceEarComponentName_;
+ private String serviceRuntimeId_;
+ private String serviceProjectName_;
+ private String serviceEarProjectName_;
+ //private SelectionListChoices serviceProject2EARProject_;
+ //private String serviceComponentName_;
+ //private String serviceEarComponentName_;
private String serviceComponentType_;
private IProject initialProject_;
private String initialComponentName_;
- private String serviceJ2EEVersion_;
+ //private String serviceJ2EEVersion_;
private boolean serviceNeedEAR_ = true;
+ private FacetMatcher serviceFacetMatcher_;
public ServerRuntimeSelectionWidgetDefaultingCommand()
{
super();
}
+
public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable )
{
Environment env = getEnvironment();
@@ -78,6 +96,229 @@
return clientSideStatus;
}
IStatus status = Status.OK_STATUS;
+
+ // Set the runtime based on the initial selection
+ serviceRuntimeId_ = getDefaultServiceRuntime(initialProject_);
+ if (serviceRuntimeId_ == null)
+ {
+ // return and error.
+ }
+ serviceIds_.setRuntimeId(WebServiceRuntimeExtensionUtils2.getServiceRuntimeDescriptorById(serviceRuntimeId_).getRuntime()
+ .getId());
+
+ // Set the project
+ if (serviceProjectName_ == null)
+ {
+ // Project name did not get set when the runtime was set, so set it now
+ serviceProjectName_ = getDefaultServiceProjectName();
+ }
+
+ IProject serviceProject = ProjectUtilities.getProject(serviceProjectName_);
+ if (!serviceProject.exists())
+ {
+ // Set the project template
+ serviceComponentType_ = getDefaultServiceProjectTemplate();
+ }
+ else
+ {
+ //Set it to an empty String
+ serviceComponentType_ = "";
+ }
+
+ updateClientProject(serviceProjectName_, serviceIds_.getTypeId());
+
+ // Set the EAR
+ serviceEarProjectName_ = ""; // TODO fix this!
+ serviceNeedEAR_ = false;
+
+ // Set the server
+ IStatus serverStatus = setServiceDefaultServer();
+ if (serverStatus.getSeverity() == Status.ERROR)
+ {
+ env.getStatusHandler().reportError(serverStatus);
+ return serverStatus;
+ }
+
+ return Status.OK_STATUS;
+
+ } catch (Exception e)
+ {
+ // Catch all Exceptions in order to give some feedback to the user
+ IStatus errorStatus = StatusUtils.errorStatus(msgUtils_.getMessage("MSG_ERROR_TASK_EXCEPTED",
+ new String[] { e.getMessage() }), e);
+ env.getStatusHandler().reportError(errorStatus);
+ return errorStatus;
+ }
+ }
+
+ private IStatus setServiceDefaultServer()
+ {
+ //Choose an existing server the module is already associated with if possible
+ IProject serviceProject = ProjectUtilities.getProject(serviceProjectName_);
+ IServer[] configuredServers = ServerUtil.getServersByModule(ServerUtils.getModule(serviceProject), null);
+ IServer firstSupportedServer = getFirstSupportedServer(configuredServers, serviceRuntimeId_, serviceProject);
+ if (firstSupportedServer != null)
+ {
+ serviceIds_.setServerId(firstSupportedServer.getServerType().getId());
+ serviceIds_.setServerInstanceId(firstSupportedServer.getId());
+ return Status.OK_STATUS;
+ }
+
+
+ //Choose any suitable existing server
+ IServer[] servers = ServerCore.getServers();
+ IServer supportedServer = getFirstSupportedServer(servers, serviceRuntimeId_, serviceProject);
+ if (supportedServer != null)
+ {
+ serviceIds_.setServerId(supportedServer.getServerType().getId());
+ serviceIds_.setServerInstanceId(supportedServer.getId());
+ return Status.OK_STATUS;
+ }
+
+ //No suitable existing server was found. Choose a suitable server type
+ String[] serverTypes = WebServiceRuntimeExtensionUtils2.getServerFactoryIdsByServiceRuntime(serviceRuntimeId_);
+ if (serverTypes!=null && serverTypes.length>0)
+ {
+ //TODO give priority to a server type that corresponds to the runtime associated with
+ //this project, if any.
+ serviceIds_.setServerId(serverTypes[0]);
+ return Status.OK_STATUS;
+ }
+
+ //No suitable server was found. Popup an error.
+ String runtimeLabel = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(serviceIds_.getRuntimeId());
+ String serverLabels = getServerLabels(serviceIds_.getRuntimeId());
+ IStatus status = StatusUtils.errorStatus(msgUtils_.getMessage("MSG_ERROR_NO_SERVER_RUNTIME", new String[]{runtimeLabel, serverLabels}) );
+ return status;
+ }
+
+ private IServer getFirstSupportedServer(IServer[] servers, String serviceRuntimeId, IProject serviceProject)
+ {
+ if (servers != null && servers.length > 0) {
+ for (int i = 0; i < servers.length; i++)
+ {
+ String serverFactoryId = servers[i].getServerType().getId();
+ if (WebServiceRuntimeExtensionUtils2.doesServiceRuntimeSupportServer(serviceRuntimeId, serverFactoryId))
+ {
+ //TODO check if the server type supports the project before returning.
+ return servers[i];
+ }
+ }
+ }
+ return null;
+ }
+
+ private String getDefaultServiceProjectTemplate()
+ {
+ String[] templates = WebServiceRuntimeExtensionUtils2.getServiceProjectTemplates(serviceIds_.getTypeId(), serviceIds_.getRuntimeId());
+ return templates[0];
+ }
+
+ private String getDefaultServiceProjectName()
+ {
+ IProject[] projects = FacetUtils.getAllProjects();
+ ServiceRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getServiceRuntimeDescriptorById(serviceRuntimeId_);
+ RequiredFacetVersion[] rfvs = desc.getRequiredFacetVersions();
+
+ //Check each project for compatibility with the serviceRuntime
+ for (int i=0; i<projects.length; i++)
+ {
+ try
+ {
+ IFacetedProject fproject = ProjectFacetsManager.create(projects[i]);
+ if (fproject != null)
+ {
+ Set facetVersions = fproject.getProjectFacets();
+ FacetMatcher fm = FacetUtils.match(rfvs, facetVersions);
+ if (fm.isMatch())
+ {
+ serviceFacetMatcher_ = fm;
+ return projects[i].getName();
+ }
+ }
+ else
+ {
+ //TODO Handle the plain-old Java projects
+ }
+ } catch (CoreException ce)
+ {
+
+ }
+ }
+
+ //No project was suitable, return a new project name
+ return ResourceUtils.getDefaultWebProjectName();
+
+ }
+
+ private String getDefaultServiceRuntime(IProject project)
+ {
+ //If possible, pick a Web service runtime that works with the initially selected project.
+ //If the initially selected project does not work with any of the Web service runtimes, pick the
+ //preferred Web service runtime.
+
+ String[] serviceRuntimes = WebServiceRuntimeExtensionUtils2.getServiceRuntimesByServiceType(serviceIds_.getTypeId());
+ if (project != null && project.exists())
+ {
+ for (int i=0; i<serviceRuntimes.length; i++)
+ {
+ RequiredFacetVersion[] rfv = WebServiceRuntimeExtensionUtils2.getServiceRuntimeDescriptorById(serviceRuntimes[i]).getRequiredFacetVersions();
+ try
+ {
+ IFacetedProject fproject = ProjectFacetsManager.create(project);
+ if (fproject != null)
+ {
+ Set facetVersions = fproject.getProjectFacets();
+ FacetMatcher fm = FacetUtils.match(rfv, facetVersions);
+ if (fm.isMatch())
+ {
+ serviceFacetMatcher_ = fm;
+ serviceProjectName_ = project.getName();
+ return serviceRuntimes[i];
+ }
+ }
+ else
+ {
+ //TODO Handle the plain-old Java projects
+ }
+ } catch (CoreException ce)
+ {
+
+ }
+ }
+ }
+
+ //Haven't returned yet so this means that the intitially selected project cannot be used
+ //to influence the selection of the runtime. Pick the preferred Web service runtime.
+ PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext();
+ String runtimeId = context.getRuntimeId();
+ for (int j=0; j<serviceRuntimes.length; j++ )
+ {
+ ServiceRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getServiceRuntimeDescriptorById(serviceRuntimes[j]);
+ if (desc.getRuntime().getId().equals(runtimeId))
+ {
+ return desc.getId();
+ }
+ }
+
+ if (serviceRuntimes.length > 0)
+ return WebServiceRuntimeExtensionUtils2.getServiceRuntimeDescriptorById(serviceRuntimes[0]).getId();
+ else
+ return null;
+ }
+ /*
+ public IStatus execuste( IProgressMonitor monitor, IAdaptable adaptable )
+ {
+ Environment env = getEnvironment();
+
+ try
+ {
+ IStatus clientSideStatus = super.execute(monitor, null);
+ if (clientSideStatus.getSeverity()==Status.ERROR)
+ {
+ return clientSideStatus;
+ }
+ IStatus status = Status.OK_STATUS;
setDefaultServiceRuntimeFromPreference();
@@ -91,7 +332,7 @@
setServiceComponentType();
// Default projects EARs and servers.
- setDefaultProjects();
+ //setDefaultProjects();
setDefaultEARs();
IStatus serverStatus = setDefaultServer();
if (serverStatus.getSeverity()== Status.ERROR)
@@ -101,7 +342,7 @@
}
updateServiceEARs();
//updateClientProject(getServiceProject2EARProject().getList().getSelection(), serviceComponentName_, serviceIds_.getTypeId());
- updateClientEARs();
+ //updateClientEARs();
return status;
} catch (Exception e)
@@ -112,7 +353,8 @@
return errorStatus;
}
- }
+ }
+ */
private void setServiceComponentType()
{
@@ -247,6 +489,7 @@
+ /*
private void setDefaultServiceJ2EEVersionFromPreference()
{
if (serviceIds_ != null)
@@ -284,7 +527,7 @@
}
}
}
-
+ */
/**
* This method needs a lot of work. It does not take into account the component types supported by the
@@ -360,6 +603,7 @@
*/
//
+ /*
private void setDefaultProjects()
{
@@ -371,7 +615,7 @@
String serviceProjectName = getServiceProject2EARProject().getList().getSelection();
//Select a client project with "client" added to the above project name.
- updateClientProject(serviceProjectName, serviceComponentName_, serviceIds_.getTypeId());
+ //updateClientProject(serviceProjectName, serviceComponentName_, serviceIds_.getTypeId());
//String clientProjectName = ResourceUtils.getClientWebProjectName(serviceProjectName, serviceIds_.getTypeId() );
//getRuntime2ClientTypes().getChoice().getChoice().getList().setSelectionValue(clientProjectName);
@@ -382,14 +626,16 @@
//Set the service project selection to this initialProject
getServiceProject2EARProject().getList().setSelectionValue(initialProject_.getName());
serviceComponentName_ = initialComponentName_;
- updateClientProject(initialProject_.getName(), serviceComponentName_, serviceIds_.getTypeId());
+ //updateClientProject(initialProject_.getName(), serviceComponentName_, serviceIds_.getTypeId());
//String clientProjectName = ResourceUtils.getClientWebProjectName(initialProject_.getName(), serviceIds_.getTypeId() );
//Set the client project selection to clientProject
//getRuntime2ClientTypes().getChoice().getChoice().getList().setSelectionValue(clientProjectName);
}
+ */
+ /*
private void setServiceProjectToFirstValid()
{
//WebServiceServerRuntimeTypeRegistry wssrtReg = WebServiceServerRuntimeTypeRegistry.getInstance();
@@ -420,9 +666,7 @@
((runtimeTarget!=null) && WebServiceRuntimeExtensionUtils.doesRuntimeSupportServerTarget(runtimeTargetId, serviceIds_.getRuntimeId())))
)
{
- getServiceProject2EARProject().getList().setSelectionValue(projectNames[i]);
- serviceComponentName_ = vcs[j].getName();
-
+ serviceProjectName_ = projectNames[i];
return;
}
}
@@ -435,21 +679,21 @@
//serviceComponentName_ = ResourceUtils.getDefaultWebProjectName();
if (serviceComponentType_.equals(IModuleConstants.JST_EJB_MODULE))
{
- getServiceProject2EARProject().getList().setSelectionValue(ResourceUtils.getDefaultEJBProjectName());
- serviceComponentName_ = ResourceUtils.getDefaultEJBComponentName();
+ serviceProjectName_ = ResourceUtils.getDefaultEJBProjectName();
}
else
{
- getServiceProject2EARProject().getList().setSelectionValue(ResourceUtils.getDefaultWebProjectName());
- serviceComponentName_ = ResourceUtils.getDefaultWebComponentName();
+ serviceProjectName_ = ResourceUtils.getDefaultWebProjectName();
}
}
+ */
+ /*
private void setDefaultEARs()
{
//Service side
- String initialProjectName = getServiceProject2EARProject().getList().getSelection();
+ String initialProjectName = serviceProjectName_;
IProject initialProject = FileResourceUtils.getWorkspaceRoot().getProject(initialProjectName);
boolean earIsSet = false;
if (initialProject != null && initialProject.exists())
@@ -461,8 +705,7 @@
IVirtualComponent earComp = earComps[0];
String earProjectName = earComp.getProject().getName();
String earComponentName = earComp.getName();
- getServiceProject2EARProject().getChoice().getList().setSelectionValue(earProjectName);
- serviceEarComponentName_ = earComponentName;
+ serviceEarProjectName_ = earProjectName;
earIsSet = true;
}
}
@@ -481,8 +724,7 @@
if (runtime != null && serviceIds_.getRuntimeId() != null && WebServiceRuntimeExtensionUtils.doesRuntimeSupportServerTarget(runtime.getRuntimeType().getId(), serviceIds_.getRuntimeId()) && serviceJ2EEVersion_.equals(String.valueOf(J2EEUtils.getJ2EEVersion(allEarComps[i]))))
{
String earProjectName = allEarComps[i].getProject().getName();
- getServiceProject2EARProject().getChoice().getList().setSelectionValue(earProjectName);
- serviceEarComponentName_ = allEarComps[i].getName();
+ serviceEarProjectName_ = earProjectName;
earIsSet = true;
}
@@ -493,12 +735,9 @@
if (!earIsSet)
{
// there are no suitable existing EARs
- getServiceProject2EARProject().getChoice().getList().setSelectionValue(ResourceUtils.getDefaultServiceEARProjectName());
- serviceEarComponentName_ = ResourceUtils.getDefaultServiceEARComponentName();
+ serviceEarProjectName_ = ResourceUtils.getDefaultServiceEARProjectName();
}
-
-
-
+
//Client side
String initialClientProjectName = getRuntime2ClientTypes().getChoice().getChoice().getList().getSelection();
IProject initialClientProject = ProjectUtilities.getProject(initialClientProjectName);
@@ -527,9 +766,9 @@
setClientEARComponentName(proxyEARProject.getName());
}
}
-
+
}
-
+ */
/*
private void setDefaultEARs() {
@@ -644,17 +883,17 @@
}
}
*/
-
+ /*
private IStatus setDefaultServer()
{
IStatus status = Status.OK_STATUS;
//Calculate reasonable default server based on the default project selection.
- String initialProjectName = getServiceProject2EARProject().getList().getSelection();
+ String initialProjectName = serviceProjectName_;
IProject initialProject = ProjectUtilities.getProject(initialProjectName);
if (initialProject.exists())
{
- String[] serverInfo = ServerSelectionUtils.getServerInfoFromExistingProject(initialProject, serviceComponentName_, serviceIds_.getRuntimeId(), true);
+ String[] serverInfo = ServerSelectionUtils.getServerInfoFromExistingProject(initialProject, initialProject.getName(), serviceIds_.getRuntimeId(), true);
if (serverInfo!=null)
{
if (serverInfo[0]!=null && serverInfo[0].length()>0)
@@ -670,11 +909,11 @@
else //the project does not exist.
{
//Does the EAR exist?
- String initialEARProjectName = getServiceProject2EARProject().getChoice().getList().getSelection();
+ String initialEARProjectName = serviceEarProjectName_;
IProject initialEARProject = ProjectUtilities.getProject(initialEARProjectName);
if (initialEARProject.exists())
{
- String[] serverInfo = ServerSelectionUtils.getServerInfoFromExistingProject(initialEARProject, serviceEarComponentName_, serviceIds_.getRuntimeId(), false);
+ String[] serverInfo = ServerSelectionUtils.getServerInfoFromExistingProject(initialEARProject, serviceEarProjectName_, serviceIds_.getRuntimeId(), false);
if (serverInfo!=null)
{
if (serverInfo[0]!=null && serverInfo[0].length()>0)
@@ -757,25 +996,24 @@
return status;
}
-
+ */
+ /*
private void updateServiceEARs()
{
//Set EAR selection to null if the project/server defaults imply an EAR should not be created
- String serviceProjectName = getServiceProject2EARProject().getList().getSelection();
- IProject serviceProject = FileResourceUtils.getWorkspaceRoot().getProject(serviceProjectName);
+ IProject serviceProject = FileResourceUtils.getWorkspaceRoot().getProject(serviceProjectName_);
if (serviceProject != null && serviceProject.exists())
{
//Get the runtime target on the serviceProject
- IRuntime serviceTarget = ServerSelectionUtils.getRuntimeTarget(serviceProjectName);
+ IRuntime serviceTarget = ServerSelectionUtils.getRuntimeTarget(serviceProjectName_);
String j2eeVersion = String.valueOf(J2EEUtils.getJ2EEVersion(serviceProject));
if (serviceTarget != null)
{
if (!ServerUtils.isTargetValidForEAR(serviceTarget.getRuntimeType().getId(),j2eeVersion))
{
//Default the EAR selection to be empty
- getServiceProject2EARProject().getChoice().getList().setIndex(-1);
- serviceEarComponentName_ = "";
+ serviceEarProjectName_="";
serviceNeedEAR_ = false;
}
@@ -793,8 +1031,7 @@
if (!ServerUtils.isTargetValidForEAR(serverTargetId,serviceJ2EEVersion_))
{
//Default the EAR selection to be empty
- getServiceProject2EARProject().getChoice().getList().setIndex(-1);
- serviceEarComponentName_ = "";
+ serviceEarProjectName_ = "";
serviceNeedEAR_ = false;
}
}
@@ -803,6 +1040,7 @@
}
+ */
public void setInitialSelection(IStructuredSelection selection)
{
}
@@ -827,6 +1065,11 @@
return serviceIds_;
}
+ public String getServiceRuntimeId()
+ {
+ return serviceRuntimeId_;
+ }
+ /*
public SelectionListChoices getServiceProject2EARProject()
{
if (serviceProject2EARProject_ == null)
@@ -846,7 +1089,7 @@
}
return serviceProject2EARProject_;
}
-
+ */
/**
* @return Returns the generateProxy_.
*/
@@ -861,30 +1104,15 @@
{
this.generateProxy_ = generateProxy_;
}
-
- public String getServiceJ2EEVersion()
- {
- return serviceJ2EEVersion_;
- }
public String getServiceProjectName()
{
- return getServiceProject2EARProject().getList().getSelection();
+ return serviceProjectName_;
}
public String getServiceEarProjectName()
{
- return getServiceProject2EARProject().getChoice().getList().getSelection();
- }
-
- public String getServiceComponentName()
- {
- return serviceComponentName_;
- }
-
- public String getServiceEarComponentName()
- {
- return serviceEarComponentName_;
+ return serviceEarProjectName_;
}
public String getServiceComponentType()
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/ServerUtils.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/ServerUtils.java
index d362d85..be8b034 100644
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/ServerUtils.java
+++ b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/ServerUtils.java
@@ -408,7 +408,7 @@
* @return The web server module root URL or null if the project has no Web
* nature or has no association to a server instance.
*/
- public static String getWebComponentURL(IProject project) {
+ public static String getWebComponentURL(IProject project, String serverFactoryId) {
String webProjectURL = null;
IModule module = getModule(project);
if (module != null) {
@@ -424,24 +424,38 @@
}
}
else {
- IRuntime projectTarget = ServerCore.getProjectProperties(project).getRuntimeTarget();
- if (projectTarget!=null)
+ //IRuntime projectTarget = ServerCore.getProjectProperties(project).getRuntimeTarget();
+ IServerType serverType = ServerCore.findServerType(serverFactoryId);
+ if (serverType!=null)
{
- String projectTargetId = projectTarget.getRuntimeType().getId();
- String serverFactoryId = getFactoryIdFromRuntimeTargetId(projectTargetId);
- IServerType serverType = ServerCore.findServerType(serverFactoryId);
try {
- if (serverType!=null) {
- IServerWorkingCopy serverWC = serverType.createServer(null, null, projectTarget, null);
- IURLProvider urlProvider = (IURLProvider) serverWC.loadAdapter(IURLProvider.class, null);
- if (urlProvider!=null) {
- URL url = urlProvider.getModuleRootURL(module);
- if (url != null) {
- String s = url.toString();
- webProjectURL = (s.endsWith("/") ? s.substring(0, s.length() - 1) : s);
- }
- }
- }
+ //Choose a Runtime which is not a stub
+ IRuntime nonStubRuntime = null;
+ IRuntime[] runtimes = ServerUtil.getRuntimes(null, null);
+ String serverRuntimeTypeId = serverType.getRuntimeType().getId();
+ for (int i = 0; i < runtimes.length; i++) {
+ IRuntime runtime = runtimes[i];
+ String thisRuntimeTypeId = runtime.getRuntimeType().getId();
+ if (thisRuntimeTypeId.equals(serverRuntimeTypeId) && !runtime.isStub()) {
+ //Found an appropriate IRuntime that is not a stub
+ nonStubRuntime = runtime;
+ break;
+ }
+ }
+
+ if (nonStubRuntime != null)
+ {
+ IServerWorkingCopy serverWC = serverType.createServer(null, null, nonStubRuntime, null);
+ IURLProvider urlProvider = (IURLProvider) serverWC.loadAdapter(IURLProvider.class, null);
+ if (urlProvider!=null) {
+ URL url = urlProvider.getModuleRootURL(module);
+ if (url != null) {
+ String s = url.toString();
+ webProjectURL = (s.endsWith("/") ? s.substring(0, s.length() - 1) : s);
+ }
+ }
+ }
+
} catch(CoreException ce){
Logger.getLogger().log(ce);
}
@@ -483,8 +497,8 @@
return webProjectURL;
}
- public static String getEncodedWebComponentURL(IProject project) {
- String url = getWebComponentURL(project);
+ public static String getEncodedWebComponentURL(IProject project, String serverFactoryId) {
+ String url = getWebComponentURL(project, serverFactoryId);
if (url != null) {
int index = url.lastIndexOf('/');
if (index != -1) {
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/ScenarioDefaults.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/ScenarioDefaults.java
index a7aeb25..ef9fe96 100644
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/ScenarioDefaults.java
+++ b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/context/ScenarioDefaults.java
@@ -57,7 +57,7 @@
public String webserviceTypeIdDefault()
{
- return "0/org.eclipse.jst.ws.type.java";
+ return "0/org.eclipse.jst.ws.wsImpl.java";
}
public boolean startWebserviceDefault()