Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkchan2005-06-10 18:05:19 +0000
committerkchan2005-06-10 18:05:19 +0000
commit9ca016ad90e397e8bffdb56ee1a241fddfd1882a (patch)
tree21aeb26324ad523822dd116c8ceea0c5a15df775
parentd4ad15415cfa5c29b8dae4003b3a5edcc0eeb9b6 (diff)
downloadwebtools.webservices-9ca016ad90e397e8bffdb56ee1a241fddfd1882a.tar.gz
webtools.webservices-9ca016ad90e397e8bffdb56ee1a241fddfd1882a.tar.xz
webtools.webservices-9ca016ad90e397e8bffdb56ee1a241fddfd1882a.zip
[96786] Web service/client wizards should filter components based on Web service runtime.
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/plugin.xml31
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/consumption/ui/plugin.properties10
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientDevelopCommand.java54
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidget.java32
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java76
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java10
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WebServiceClientTestArrivalCommand.java3
-rw-r--r--bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/consumption/plugin.properties1
-rw-r--r--bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateModuleCommand.java3
-rw-r--r--bundles/org.eclipse.jst.ws.creation.ejb.ui/plugin.xml4
-rw-r--r--bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/extension/PreServiceDevelopCommand.java56
-rw-r--r--bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/binding/ServerWidgetBinding.java1
-rw-r--r--bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/runtime/ServerRuntimeSelectionWidget.java8
-rw-r--r--bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/runtime/ServerRuntimeSelectionWidgetDefaultingCommand.java46
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/J2EEUtils.java52
15 files changed, 247 insertions, 140 deletions
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/plugin.xml b/bundles/org.eclipse.jst.ws.consumption.ui/plugin.xml
index 7d1a97b84..487194a3d 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/plugin.xml
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/plugin.xml
@@ -758,34 +758,29 @@
<serviceType
id="org.eclipse.jst.ws.serviceType.java"
implId="org.eclipse.jst.ws.wsImpl.java"
- buModuleTypesInclude="org.eclipse.jst.j2ee.web.WebNature"
+ buModuleTypesInclude="jst.web"
buModuleTypesExclude=""
- tdModuleTypesInclude="org.eclipse.jst.j2ee.web.WebNature"
+ tdModuleTypesInclude="jst.web"
tdModuleTypesExclude="">
</serviceType>
</extension>
-<!--
-<extension point="org.eclipse.jst.ws.consumption.ui.serviceType">
- <serviceType
- id="org.eclipse.jst.ws.serviceType.wsdl"
- implId="org.eclipse.jst.ws.wsImpl.java"
- buModuleTypesInclude="org.eclipse.jst.j2ee.web.WebNature"
- buModuleTypesExclude=""
- tdModuleTypesInclude="org.eclipse.jst.j2ee.web.WebNature"
- tdModuleTypesExclude=""
- webServiceTypeId="org.eclipse.jst.ws.type.wsdl">
- </serviceType>
-</extension>
--->
+
<extension point="org.eclipse.jst.ws.consumption.ui.clientType">
<clientType
id="org.eclipse.jst.ws.clientType.java.webOnly"
implId="org.eclipse.jst.ws.client.type.java"
- moduleTypesInclude="org.eclipse.jst.ws.consumption.ui.clientProjectType.Web"
+ moduleTypesInclude="jst.web"
moduleTypesExclude="">
</clientType>
</extension>
-
-
+<extension point="org.eclipse.jst.ws.consumption.ui.clientType">
+ <clientType
+ id="org.eclipse.jst.ws.clientType.java.j2ee"
+ implId="org.eclipse.jst.ws.client.type.java"
+ moduleTypesInclude="jst.web jst.ejb jst.appclient jst.utility"
+ moduleTypesExclude="">
+ </clientType>
+</extension>
+
</plugin>
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 529dcf308..a63b3056d 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
@@ -134,6 +134,15 @@ LABEL_SERVICE_PROJECT=Service project:
LABEL_CLIENT_EAR_PROJECT=Client EAR project:
LABEL_SERVICE_EAR_PROJECT=Service EAR project:
+#
+# Client component type labels
+#
+LABEL_CLIENT_COMP_TYPE_WEB=Web
+LABEL_CLIENT_COMP_TYPE_EJB=EJB
+LABEL_CLIENT_COMP_TYPE_APP_CLIENT=Application Client
+LABEL_CLIENT_COMP_TYPE_CONTAINERLESS=Java
+
+
TOOLTIP_PWRS_TEXT_RUNTIME=The runtime to be used.
TOOLTIP_PWRS_TEXT_SERVER=The server to be used.
TOOLTIP_PWRS_J2EE_VERSION=J2EE version to be used.
@@ -183,7 +192,6 @@ LABEL_WEB=Web
LABEL_EJB=EJB
LABEL_NO_LABEL=
-
#
# Items common to WebServiceMappingsPage, WebServiceMappingsPage (client), and WebServiceSOAPBindingPage
#
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 66829a8f2..4e601b186 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,8 +16,11 @@ import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensio
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand;
import org.eclipse.wst.command.internal.provisional.env.core.common.Environment;
+import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils;
+import org.eclipse.wst.command.internal.provisional.env.core.common.SimpleStatus;
import org.eclipse.wst.command.internal.provisional.env.core.common.Status;
import org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
import org.eclipse.wst.ws.internal.provisional.wsrt.IContext;
import org.eclipse.wst.ws.internal.provisional.wsrt.ISelection;
import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceClient;
@@ -29,10 +32,12 @@ import org.eclipse.wst.ws.internal.wsrt.SimpleContext;
public class PreClientDevelopCommand extends SimpleCommand
{
+ /*
private String ID_WEB = "org.eclipse.jst.ws.consumption.ui.clientProjectType.Web";
private String ID_EJB = "org.eclipse.jst.ws.consumption.ui.clientProjectType.EJB";
private String ID_APP_CLIENT = "org.eclipse.jst.ws.consumption.ui.clientProjectType.AppClient";
private String ID_JAVA = "org.eclipse.jst.ws.consumption.ui.clientProjectType.Containerless";
+ */
private TypeRuntimeServer typeRuntimeServer_;
private Environment environment_;
@@ -51,7 +56,6 @@ public class PreClientDevelopCommand extends SimpleCommand
public Status execute(Environment environment)
{
-
// Split up the project and module
int index = module_.indexOf("/");
if (index!=-1){
@@ -90,19 +94,25 @@ public class PreClientDevelopCommand extends SimpleCommand
.isCheckoutFilesEnabled());
// Create the client module
- CreateModuleCommand command = new CreateModuleCommand();
- command.setProjectName(project_);
- command.setModuleName(module_);
+
+ int intModuleType = convertModuleType(moduleType_);
+
+ CreateModuleCommand command = new CreateModuleCommand();
+ command.setProjectName(project_);
+ command.setModuleName(module_);
+ command.setModuleType(intModuleType);
+ command.setServerFactoryId(typeRuntimeServer_.getServerId());
+ command.setJ2eeLevel(j2eeLevel_);
+ Status status = command.execute(environment);
+
// rsk todo -- once the clientProjectType extension is gone, determination
// of what type of module to create will have to be done.
- if (moduleType_.equals(ID_WEB)) command.setModuleType(CreateModuleCommand.WEB);
- if (moduleType_.equals(ID_EJB)) command.setModuleType(CreateModuleCommand.EJB);
- if (moduleType_.equals(ID_APP_CLIENT)) command.setModuleType(CreateModuleCommand.APPCLIENT);
+ //if (moduleType_.equals(ID_WEB)) command.setModuleType(CreateModuleCommand.WEB);
+ //if (moduleType_.equals(ID_EJB)) command.setModuleType(CreateModuleCommand.EJB);
+ //if (moduleType_.equals(ID_APP_CLIENT)) command.setModuleType(CreateModuleCommand.APPCLIENT);
- command.setServerFactoryId(typeRuntimeServer_.getServerId());
command.setServerInstanceId( typeRuntimeServer_.getServerInstanceId() );
- command.setJ2eeLevel(j2eeLevel_);
- Status status = command.execute(environment);
+
if (status.getSeverity() == Status.ERROR)
{
@@ -111,6 +121,30 @@ public class PreClientDevelopCommand extends SimpleCommand
return status;
}
+ private int convertModuleType(String type)
+ {
+ if (type.equals(IModuleConstants.JST_WEB_MODULE))
+ {
+ return CreateModuleCommand.WEB;
+ }
+ else if (type.equals(IModuleConstants.JST_EJB_MODULE))
+ {
+ return CreateModuleCommand.EJB;
+ }
+ else if (type.equals(IModuleConstants.JST_APPCLIENT_MODULE))
+ {
+ return CreateModuleCommand.APPCLIENT;
+ }
+ else if (type.equals(IModuleConstants.JST_EAR_MODULE))
+ {
+ return CreateModuleCommand.EAR;
+ }
+ else
+ {
+ return -1;
+ }
+ }
+
public void setClientTypeRuntimeServer( TypeRuntimeServer typeRuntimeServer )
{
typeRuntimeServer_ = typeRuntimeServer;
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 2904a82ab..0e4ad0a16 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
@@ -30,6 +30,7 @@ import org.eclipse.wst.command.internal.provisional.env.core.common.SimpleStatus
import org.eclipse.wst.command.internal.provisional.env.core.common.Status;
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;
public class ClientRuntimeSelectionWidget extends SimpleWidgetDataContributor
@@ -172,7 +173,7 @@ public class ClientRuntimeSelectionWidget extends SimpleWidgetDataContributor
return projTypeList.getSelection();
}
- public void setClientComponentType( int type )
+ public void setClientComponentType( String type )
{
projectWidget_.setComponentType( type );
}
@@ -276,18 +277,41 @@ public class ClientRuntimeSelectionWidget extends SimpleWidgetDataContributor
clientType2Projects.getChoice().getChoice().getList().setSelectionValue( earName );
}
- projectWidget_.setProjectTypeId(clientType2Projects.getList().getSelection());
+ //projectWidget_.setProjectTypeId(clientType2Projects.getList().getSelection());
+ projectWidget_.setComponentType(clientType2Projects.getList().getSelection());
projectWidget_.setProjectChoices( clientType2Projects.getChoice() );
}
private String[] getClientTypeLabels( String[] types )
{
- ClientProjectTypeRegistry registry = ClientProjectTypeRegistry.getInstance();
+ MessageUtils msgUtils = new MessageUtils( pluginId_ + ".plugin", this );
+ //ClientProjectTypeRegistry registry = ClientProjectTypeRegistry.getInstance();
String[] clientTypeLabels = new String[types.length];
for( int index = 0; index < types.length; index++ )
{
- clientTypeLabels[index] = registry.getElementById(types[index]).getAttribute("label");
+ //clientTypeLabels[index] = registry.getElementById(types[index]).getAttribute("label");
+ String type = types[index];
+ if (type.equals(IModuleConstants.JST_WEB_MODULE))
+ {
+ clientTypeLabels[index] = msgUtils.getMessage("LABEL_CLIENT_COMP_TYPE_WEB");
+ }
+ else if (type.equals(IModuleConstants.JST_EJB_MODULE))
+ {
+ clientTypeLabels[index] = msgUtils.getMessage("LABEL_CLIENT_COMP_TYPE_EJB");
+ }
+ else if (type.equals(IModuleConstants.JST_APPCLIENT_MODULE))
+ {
+ clientTypeLabels[index] = msgUtils.getMessage("LABEL_CLIENT_COMP_TYPE_APP_CLIENT");
+ }
+ else if (type.equals(IModuleConstants.JST_UTILITY_MODULE))
+ {
+ clientTypeLabels[index] = msgUtils.getMessage("LABEL_CLIENT_COMP_TYPE_CONTAINERLESS");
+ }
+ else
+ {
+ clientTypeLabels[index] = type;
+ }
}
return clientTypeLabels;
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 3c69681df..331b776c9 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
@@ -16,6 +16,7 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jst.ws.internal.common.J2EEUtils;
import org.eclipse.jst.ws.internal.common.ResourceUtils;
@@ -171,12 +172,8 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand
{
try
{
- // rskreg
- //WebServiceClientTypeRegistry reg = WebServiceClientTypeRegistry.getInstance();
- //String[] runtimeIds = gatherAttributeValues(reg.getConfigurationElement(clientIds_.getTypeId()), "runtime");
String[] runtimeIds = WebServiceRuntimeExtensionUtils.getRuntimesByClientType(clientIds_.getTypeId());
- // rskreg
SelectionList list = new SelectionList(runtimeIds, 0);
Vector choices = new Vector();
for (int i = 0; i < runtimeIds.length; i++) {
@@ -193,8 +190,10 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand
//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.
/*
@@ -240,29 +239,12 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand
*/
private SelectionListChoices getClientTypesChoice(String runtimeId)
{
- //WebServiceClientTypeRegistry reg = WebServiceClientTypeRegistry.getInstance();
- ClientProjectTypeRegistry cptr = ClientProjectTypeRegistry.getInstance();
- String[] clientTypes;
- // rskreg
- //String[] clientProjectTypes = gatherAttributeValues(reg.getConfigurationElement(clientIds_.getTypeId(), runtimeId), "clientProjectType");
- clientTypes = WebServiceRuntimeExtensionUtils.getClientProjectTypes(clientIds_.getTypeId(), runtimeId);
- /*
- if (clientProjectTypes!=null && clientProjectTypes.length > 0)
- {
- StringTokenizer st = new StringTokenizer(clientProjectTypes[0]);
- clientTypes = new String[st.countTokens()];
- for (int i = 0; i < clientTypes.length; i++)
- clientTypes[i] = st.nextToken();
- }
- else
- clientTypes = new String[] {cptr.getDefaultElement().getAttribute("id")};
- */
- // rskreg
- // Seng's Note: Check flexible project structure non-support here!!!
- SelectionList list = new SelectionList(clientTypes, 0);
+ String[] clientComponentTypes;
+ clientComponentTypes = WebServiceRuntimeExtensionUtils.getClientProjectTypes(clientIds_.getTypeId(), runtimeId);
+ SelectionList list = new SelectionList(clientComponentTypes, 0);
Vector choices = new Vector();
- for (int i = 0; i < clientTypes.length; i++) {
- choices.add(getProjectChoice(clientTypes[i]));
+ for (int i = 0; i < clientComponentTypes.length; i++) {
+ choices.add(getProjectChoice(clientComponentTypes[i]));
}
return new SelectionListChoices(list, choices);
}
@@ -275,14 +257,18 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand
*/
private SelectionListChoices getProjectChoice(String clientType)
{
- IProject[] projects = ClientProjectTypeRegistry.getInstance().getProjects(clientType);
- String[] projectNames = new String[projects.length];
- for (int i = 0; i < projects.length; i++)
- projectNames[i] = projects[i].getName();
+ //IProject[] projects = ClientProjectTypeRegistry.getInstance().getProjects(clientType);
+ //String[] projectNames = new String[projects.length];
+ //for (int i = 0; i < projectNames.length; i++)
+ // projectNames[i] = projects[i].getName();
+ String[] projectNames = J2EEUtils.getProjectsContainingComponentOfType(clientType);
SelectionList list = new SelectionList(projectNames, 0);
Vector choices = new Vector();
- for (int i = 0; i < projects.length; i++)
- choices.add(getProjectEARChoice(projects[i]));
+ for (int i = 0; i < projectNames.length; i++)
+ {
+ IProject project = ProjectUtilities.getProject(projectNames[i]);
+ choices.add(getProjectEARChoice(project));
+ }
return new SelectionListChoices(list, choices, getEARProjects());
}
@@ -294,26 +280,6 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand
protected SelectionListChoices getProjectEARChoice(IProject project)
{
Vector v = new Vector();
- /*
- // TODO used to be J2EEUtils.getEARProjects(project) -- referenced EARs
- IProject[] earNatures = J2EEUtils.getEARProjects();
- if (earNatures != null){
- for(int i = 0; i < earNatures.length; i++){
- v.add(earNatures[i].getName());
- }
- }
- IProject[] earProjects = J2EEUtils.getEARProjects();
- if (earProjects != null)
- {
- for (int i = 0; i < earProjects.length; i++)
- {
- String earProjectName = earProjects[i].getName();
- if (!v.contains(earProjectName))
- v.add(earProjectName);
- }
- }
- */
-
String[] flexProjects = getAllFlexibleProjects();
SelectionList list = new SelectionList(flexProjects, 0);
return new SelectionListChoices(list, null);
@@ -500,6 +466,12 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand
}
*/
// rskreg
+
+ private void setClientComponentType()
+ {
+ getRuntime2ClientTypes().getChoice().getList().setIndex(0);
+ }
+
private void setClientDefaultProject()
{
if (clientInitialProject_ != null)
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 c3a3d76c9..f953899f8 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
@@ -31,13 +31,14 @@ import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils
import org.eclipse.wst.command.internal.provisional.env.core.common.SimpleStatus;
import org.eclipse.wst.command.internal.provisional.env.core.common.Status;
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.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.server.core.IRuntime;
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 final String JAVA_PROJECT_TYPE_ID = "org.eclipse.jst.ws.consumption.ui.clientProjectType.Containerless";
private String pluginId_ = "org.eclipse.jst.ws.consumption.ui";
@@ -67,7 +68,7 @@ public class ProjectSelectionWidget extends SimpleWidgetDataContributor {
private Combo moduleProject_;
private Combo earProject_;
- private int componentType_;
+ private String componentType_;
private ModifyListener moduleProjectListener_;
private ModifyListener moduleListener_;
@@ -178,7 +179,6 @@ public class ProjectSelectionWidget extends SimpleWidgetDataContributor {
String projectName = moduleProject_.getText();
IProject project = ProjectUtilities.getProject( projectName );
- componentType_ = J2EEUtils.WEB | J2EEUtils.EJB;
IVirtualComponent[] components = J2EEUtils.getComponentsByType( project, componentType_ );
String[] modules = new String[components.length];
@@ -321,7 +321,7 @@ public class ProjectSelectionWidget extends SimpleWidgetDataContributor {
earModule_.setText( name );
}
- public void setComponentType( int type )
+ public void setComponentType( String type )
{
componentType_ = type;
}
@@ -403,7 +403,7 @@ public class ProjectSelectionWidget extends SimpleWidgetDataContributor {
private boolean projectNeedsEAR(String projectName)
{
- if (projectTypeId_.equals(JAVA_PROJECT_TYPE_ID))
+ if (projectTypeId_.equals(IModuleConstants.JST_UTILITY_MODULE))
return false;
if (projectName == null || projectName.length()==0)
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WebServiceClientTestArrivalCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WebServiceClientTestArrivalCommand.java
index aa5a43737..5c8b4aa0b 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WebServiceClientTestArrivalCommand.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WebServiceClientTestArrivalCommand.java
@@ -33,6 +33,7 @@ import org.eclipse.wst.command.internal.provisional.env.core.common.StatusHandle
import org.eclipse.wst.command.internal.provisional.env.core.selection.BooleanSelection;
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.server.core.IServer;
@@ -184,7 +185,7 @@ public class WebServiceClientTestArrivalCommand extends SimpleCommand
//move to the web level
SelectionListChoices slc = runtime2ClientTypes.getChoice();
String projectType = slc.getList().getSelection();
- if(projectType.equals(WEBID)){
+ if(projectType.equals(IModuleConstants.JST_WEB_MODULE)){
sampleProject = clientProject;
}
else{
diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/consumption/plugin.properties b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/consumption/plugin.properties
index 2a9fbcf38..115f4afd5 100644
--- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/consumption/plugin.properties
+++ b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/consumption/plugin.properties
@@ -24,6 +24,7 @@ MSG_WARN_JTS_PROXY_METHODS_OMITTED=IWAB0189W The Sample JSP client omitted some
MSG_ERROR_SAMPLE_CREATION_CANCELED=IWAB0021E Sample creation was canceled
MSG_WARN_UNABLE_TO_FIND_PROXY=IWAB0022W The Proxy Resource cound not not be found.
+MSG_ERROR_CANNOT_CREATE_COMPONENT=The Web service wizard cannot automatically create component "{0}". Cancel the wizard and create the component manually.
#
# Filters
diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateModuleCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateModuleCommand.java
index 055236ea9..242e11d5a 100644
--- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateModuleCommand.java
+++ b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateModuleCommand.java
@@ -102,8 +102,7 @@ public class CreateModuleCommand extends SimpleCommand
break;
default:
- // determine an error status message?
- break;
+ return new SimpleStatus("",msgUtils.getMessage("MSG_ERROR_COMPONENT_CREATION", new String[]{moduleName}),Status.ERROR,null);
}
return status;
diff --git a/bundles/org.eclipse.jst.ws.creation.ejb.ui/plugin.xml b/bundles/org.eclipse.jst.ws.creation.ejb.ui/plugin.xml
index 207c411bc..7e58b492f 100644
--- a/bundles/org.eclipse.jst.ws.creation.ejb.ui/plugin.xml
+++ b/bundles/org.eclipse.jst.ws.creation.ejb.ui/plugin.xml
@@ -62,9 +62,9 @@
<serviceType
id="org.eclipse.jst.ws.serviceType.ejb"
implId="org.eclipse.jst.ws.wsImpl.ejb"
- buModuleTypesInclude="org.eclipse.jst.j2ee.ejb.EJBNature"
+ buModuleTypesInclude="jst.ejb"
buModuleTypesExclude=""
- tdModuleTypesInclude="org.eclipse.jst.j2ee.ejb.EJBNature"
+ tdModuleTypesInclude="jst.ejb"
tdModuleTypesExclude="">
</serviceType>
</extension>
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 796f0822f..cf4e7f87d 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,8 +16,11 @@ import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensio
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand;
import org.eclipse.wst.command.internal.provisional.env.core.common.Environment;
+import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils;
+import org.eclipse.wst.command.internal.provisional.env.core.common.SimpleStatus;
import org.eclipse.wst.command.internal.provisional.env.core.common.Status;
import org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
import org.eclipse.wst.ws.internal.provisional.wsrt.IContext;
import org.eclipse.wst.ws.internal.provisional.wsrt.ISelection;
import org.eclipse.wst.ws.internal.provisional.wsrt.IWebService;
@@ -35,6 +38,7 @@ public class PreServiceDevelopCommand extends SimpleCommand
private ISelection selection_;
private String project_;
private String module_;
+ private String moduleType_;
private String earProject_;
private String ear_;
@@ -46,9 +50,11 @@ public class PreServiceDevelopCommand extends SimpleCommand
private boolean client_;
private boolean test_;
private boolean publish_;
+
public Status execute(Environment environment)
{
+
// Split up the project and module
int index = module_.indexOf("/");
if (index!=-1){
@@ -104,15 +110,20 @@ public class PreServiceDevelopCommand extends SimpleCommand
resourceContext_.isCheckoutFilesEnabled());
//Create the service module
- CreateModuleCommand command = new CreateModuleCommand();
- command.setProjectName(project_);
- command.setModuleName(module_);
+
//rsk todo -- pick the correct module type based on the Web service type, it's hard coded to WEB for now.
- command.setModuleType(CreateModuleCommand.WEB);
- command.setServerFactoryId(typeRuntimeServer_.getServerId());
- command.setServerInstanceId( typeRuntimeServer_.getServerInstanceId() );
- command.setJ2eeLevel(j2eeLevel_);
- Status status = command.execute(environment);
+ int intModuleType = convertModuleType(moduleType_);
+
+
+ CreateModuleCommand command = new CreateModuleCommand();
+ command.setProjectName(project_);
+ command.setModuleName(module_);
+ command.setModuleType(intModuleType);
+ command.setServerFactoryId(typeRuntimeServer_.getServerId());
+ command.setServerInstanceId(typeRuntimeServer_.getServerInstanceId());
+ command.setJ2eeLevel(j2eeLevel_);
+ Status status = command.execute(environment);
+
if (status.getSeverity()==Status.ERROR)
{
@@ -121,6 +132,30 @@ public class PreServiceDevelopCommand extends SimpleCommand
return status;
}
+ private int convertModuleType(String type)
+ {
+ if (type.equals(IModuleConstants.JST_WEB_MODULE))
+ {
+ return CreateModuleCommand.WEB;
+ }
+ else if (type.equals(IModuleConstants.JST_EJB_MODULE))
+ {
+ return CreateModuleCommand.EJB;
+ }
+ else if (type.equals(IModuleConstants.JST_APPCLIENT_MODULE))
+ {
+ return CreateModuleCommand.APPCLIENT;
+ }
+ else if (type.equals(IModuleConstants.JST_EAR_MODULE))
+ {
+ return CreateModuleCommand.EAR;
+ }
+ else
+ {
+ return -1;
+ }
+ }
+
public void setServiceTypeRuntimeServer( TypeRuntimeServer typeRuntimeServer )
{
typeRuntimeServer_ = typeRuntimeServer;
@@ -180,6 +215,11 @@ public class PreServiceDevelopCommand extends SimpleCommand
{
module_ = module;
}
+
+ public void setModuleType(String type)
+ {
+ moduleType_ = type;
+ }
public String getEarProject()
{
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 9d83f6fb4..028c2548b 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
@@ -527,6 +527,7 @@ public class ServerWidgetBinding implements CommandWidgetBinding
dataRegistry.addMapping( ServerWizardWidgetOutputCommand.class, "GenerateProxy", PreServiceDevelopCommand.class);
dataRegistry.addMapping( ServerWizardWidgetOutputCommand.class, "ResourceContext", PreServiceDevelopCommand.class);
//
+ dataRegistry.addMapping( ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceComponentType", PreServiceDevelopCommand.class, "ModuleType", null);
dataRegistry.addMapping( ServerExtensionDefaultingCommand.class, "ServiceTypeRuntimeServer", PreServiceDevelopCommand.class );
dataRegistry.addMapping( ServerExtensionDefaultingCommand.class, "ServiceJ2EEVersion", PreServiceDevelopCommand.class);
dataRegistry.addMapping( ServerExtensionDefaultingCommand.class, "ServerProject", PreServiceDevelopCommand.class, "Module", 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 5ea8fc17a..9acff6ddd 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
@@ -207,7 +207,7 @@ public class ServerRuntimeSelectionWidget extends SimpleWidgetDataContributor
projectWidget_.setEarComponentName( name );
}
- public void setServiceComponentType( int type )
+ public void setServiceComponentType( String type )
{
projectWidget_.setComponentType( type );
}
@@ -237,7 +237,7 @@ public class ServerRuntimeSelectionWidget extends SimpleWidgetDataContributor
return clientWidget_.getClientComponentType();
}
- public void setComponentType( int type )
+ public void setComponentType( String type )
{
clientWidget_.setClientComponentType( type );
}
@@ -347,11 +347,11 @@ public class ServerRuntimeSelectionWidget extends SimpleWidgetDataContributor
}
rskejb */
boolean isEJBRequired = WebServiceRuntimeExtensionUtils.requiresEJBProject(webServiceRuntimeId, webServiceTypeId);
- if (isEJBRequired && !J2EEUtils.isEJBComponent(serviceProj, serviceComponentName))
+ 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 && !J2EEUtils.isWebComponent(serviceProj, serviceComponentName))
+ 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);
}
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 a366be321..5f7b59c97 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
@@ -30,6 +30,7 @@ import org.eclipse.wst.command.internal.provisional.env.core.common.SimpleStatus
import org.eclipse.wst.command.internal.provisional.env.core.common.Status;
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.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServer;
@@ -51,7 +52,7 @@ public class ServerRuntimeSelectionWidgetDefaultingCommand extends ClientRuntime
private SelectionListChoices serviceProject2EARProject_;
private String serviceComponentName_;
private String serviceEarComponentName_;
- private int serviceComponentType_;
+ private String serviceComponentType_;
private IStructuredSelection initialSelection_;
private IProject initialProject_;
private String initialComponentName_;
@@ -89,7 +90,7 @@ public class ServerRuntimeSelectionWidgetDefaultingCommand extends ClientRuntime
// Set the default client type to a web client type.
- setWebClientType();
+ // setWebClientType();
setServiceComponentType();
// Default projects EARs and servers.
@@ -116,49 +117,27 @@ public class ServerRuntimeSelectionWidgetDefaultingCommand extends ClientRuntime
{
ServiceType st = WebServiceRuntimeExtensionUtils.getServiceType(serviceIds_.getRuntimeId(), serviceIds_.getTypeId());
int scenario = WebServiceRuntimeExtensionUtils.getScenarioFromTypeId(serviceIds_.getTypeId());
- String[] includeNatures = null;
+ String[] includeComponentTypes = null;
switch (scenario)
{
case WebServiceScenario.BOTTOMUP:
- includeNatures = st.getBottomUpModuleTypesInclude();
+ includeComponentTypes = st.getBottomUpModuleTypesInclude();
break;
case WebServiceScenario.TOPDOWN:
- includeNatures = st.getTopDownModuleTypesInclude();
+ includeComponentTypes = st.getTopDownModuleTypesInclude();
}
- //IWebServiceType wst = WebServiceRuntimeExtensionUtils.getWebServiceTypeById(serviceIds_.getTypeId());
- //String includeNatures = wst.getConfigurationElement().getAttribute("includeNatures");
- if (includeNatures == null || includeNatures.length==0)
+ if (includeComponentTypes == null || includeComponentTypes.length==0)
{
- serviceComponentType_ = J2EEUtils.WEB | J2EEUtils.EJB;
+ serviceComponentType_ = IModuleConstants.JST_WEB_MODULE;
}
else
{
- //StringTokenizer st = new StringTokenizer(includeNatures, " ");
- //int size = st.countTokens();
- ArrayList natureList = new ArrayList();
- for (int i = 0; i < includeNatures.length; i++)
- {
- natureList.add(includeNatures[i]);
- }
-
- boolean containsWeb = natureList.contains("org.eclipse.jst.j2ee.web.WebNature");
- boolean containsEJB = natureList.contains("org.eclipse.jst.j2ee.ejb.EJBNature");
-
- serviceComponentType_ = 0;
- if (containsWeb)
- {
- serviceComponentType_ = J2EEUtils.WEB;
- }
-
- if (containsEJB)
- {
- serviceComponentType_ = serviceComponentType_ | J2EEUtils.EJB;
- }
-
+ serviceComponentType_ = includeComponentTypes[0];
}
}
+ /*
private void setWebClientType()
{
SelectionListChoices choices = getRuntime2ClientTypes();
@@ -169,6 +148,7 @@ public class ServerRuntimeSelectionWidgetDefaultingCommand extends ClientRuntime
choices.getChoice().getList().setSelectionValue( webId );
}
}
+ */
/**
* Returns an object with target Runtime and J2EE value
@@ -360,7 +340,7 @@ public class ServerRuntimeSelectionWidgetDefaultingCommand extends ClientRuntime
{
//there are no projects in the workspace. Pass the default names for new projects.
- if ((serviceComponentType_ & J2EEUtils.EJB) == J2EEUtils.EJB )
+ if (serviceComponentType_.equals(IModuleConstants.JST_EJB_MODULE))
{
getServiceProject2EARProject().getList().setSelectionValue(ResourceUtils.getDefaultEJBProjectName());
serviceComponentName_ = ResourceUtils.getDefaultEJBComponentName();
@@ -808,7 +788,7 @@ public class ServerRuntimeSelectionWidgetDefaultingCommand extends ClientRuntime
return serviceEarComponentName_;
}
- public int getServiceComponentType()
+ public String getServiceComponentType()
{
return serviceComponentType_;
}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/J2EEUtils.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/J2EEUtils.java
index 6347f2cd9..e25434d99 100644
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/J2EEUtils.java
+++ b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/J2EEUtils.java
@@ -433,6 +433,58 @@ public final class J2EEUtils {
}
/**
+ * Returns all components of type, componentType in the project.
+ * @param project
+ * @param componentTypeId as defined in IModuleConstants.
+ * @return
+ */
+ public static IVirtualComponent[] getComponentsByType(IProject project, String componentTypeId){
+
+ //get all components in the project of type componentTypeId
+ List v = new ArrayList();
+ try {
+ IFlexibleProject flex = ComponentCore.createFlexibleProject(project);
+ IVirtualComponent[] components = flex.getComponents();
+ for (int i=0;i<components.length;i++){
+ IVirtualComponent vc = ComponentCore.createComponent(project, components[i].getName());
+ if ( vc.getComponentTypeId().equals(componentTypeId))
+ {
+ v.add(components[i]);
+ }
+ //if (isWebComponent(project, components[i].getName())){
+ //v.add(components[i]);
+ //}
+ }
+
+ }
+ catch (Exception e){
+ //handle exception
+ }
+
+ return (IVirtualComponent[])v.toArray(new IVirtualComponent[0]);
+ }
+
+ public static String[] getProjectsContainingComponentOfType(String componentTypeId)
+ {
+ Vector v = new Vector();
+ IVirtualComponent[] comps = getAllComponents();
+ for (int i = 0; i < comps.length; i++) {
+ if (comps[i].getComponentTypeId().equals(componentTypeId))
+ {
+ //Add the project name to the vector if it has not been added already
+ String name = comps[i].getProject().getName();
+ if (!v.contains(name))
+ {
+ v.add(name);
+ }
+ }
+
+ }
+
+ return (String[])v.toArray(new String[0]);
+ }
+
+ /**
* Helper method for getComponentsByType
* @param vcs
* @param vect

Back to the top