[124143] Populate EAR combo and validate. [121605] server not started. [124408] Allow stub RT.
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ConsumptionUI.properties b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ConsumptionUI.properties
index 31eaa81..2b2387b 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ConsumptionUI.properties
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ConsumptionUI.properties
@@ -7,6 +7,10 @@
#
# Contributors:
# IBM Corporation - initial API and implementation
+# yyyymmdd bug Email and other contact information
+# -------- -------- -----------------------------------------------------------
+# 20060204 124143 rsinha@ca.ibm.com - Rupam Kuehner
+# 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner
###############################################################################
#
@@ -142,7 +146,8 @@
MSG_INVALID_SRT_SELECTIONS={0} does not support the {1} Web service runtime. Choose a different server or runtime to proceed through the Web services wizard.
MSG_NO_RUNTIME=No runtime specified for the {0} scenario.
MSG_NO_SERVER=No server specified for the {0} scenario.
-MSG_ERROR_STUB_ONLY={0} has only stub runtimes associated with it. Choose a different server or configure a non-stub runtime in the server preferences.
+MSG_ERROR_STUB_ONLY={0} has only stub runtimes associated with it. Choose a different server or configure a non-stub runtime in the server preferences.
+MSG_WARN_STUB_ONLY={0} has only stub runtimes associated with it so the server will not be created or started.
MSG_SERVER_TARGET_MISMATCH=The project, {0}, has a server target which is not compatible with the selected server type
MSG_J2EE_MISMATCH=The project, {0}, has a different J2EE level from the selected J2EE level
@@ -181,6 +186,9 @@
MSG_EAR_WILL_BE_CREATED=The {0} EAR project will be created and associated with the project.
MSG_PROJECT_AND_EAR_CREATED=The {0} project and EAR project will be created and associated with one another.
+MSG_CLIENT_CANNOT_ASSOCIATE=The client project, {0}, cannot be associated with the EAR, {1}. Choose an EAR with a J2EE level of {2} or higher.
+MSG_SERVICE_CANNOT_ASSOCIATE=The service project, {0}, cannot be associated with the EAR, {1}. Choose an EAR with a J2EE level of {2} or higher.
+
# WebServiceClientRuntimeSelectionPage
PAGE_TITLE_WS_CLIENT_RUNTIME_SELECTION=Client Environment Configuration
PAGE_DESC_WS_CLIENT_RUNTIME_SELECTION=Choose from the list of supported runtimes and servers for the client environment, or use the default settings.
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ConsumptionUIMessages.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ConsumptionUIMessages.java
index 22fc125..8a37549 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ConsumptionUIMessages.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ConsumptionUIMessages.java
@@ -7,6 +7,10 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060204 124143 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner
*******************************************************************************/
package org.eclipse.jst.ws.internal.consumption.ui;
@@ -80,6 +84,7 @@
public static String MSG_NO_RUNTIME;
public static String MSG_NO_SERVER;
public static String MSG_ERROR_STUB_ONLY;
+ public static String MSG_WARN_STUB_ONLY;
public static String MSG_SERVER_TARGET_MISMATCH;
public static String MSG_J2EE_MISMATCH;
public static String MSG_SERVICE_PROJECT_EMPTY;
@@ -320,6 +325,8 @@
public static String MSG_ERROR_WEB_SERVICE_CLIENTS_NOT_FOUND;
public static String MSG_ERROR_WEB_SERVICES_NOT_FOUND;
public static String MSG_ERROR_WSDD_NOT_FOUND;
+ public static String MSG_CLIENT_CANNOT_ASSOCIATE;
+ public static String MSG_SERVICE_CANNOT_ASSOCIATE;
static {
NLS.initializeMessages(BUNDLE_NAME, ConsumptionUIMessages.class);
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 03faca1..bc2eada 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
@@ -7,6 +7,10 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060204 121605 rsinha@ca.ibm.com - Rupam Kuehner
*******************************************************************************/
package org.eclipse.jst.ws.internal.consumption.ui.widgets.binding;
@@ -98,6 +102,7 @@
dataRegistry.addMapping(ClientWizardWidget.class, "ResourceContext", ClientWizardWidgetOutputCommand.class);
// Before ClientRuntimeSelectionWidget
+ dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "InstallClient", ClientRuntimeSelectionWidget.class);
dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientTypeRuntimeServer", ClientRuntimeSelectionWidget.class);
dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientRuntimeId", ClientRuntimeSelectionWidget.class);
dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientProjectName", ClientRuntimeSelectionWidget.class);
@@ -306,12 +311,14 @@
dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WebServicesParser", CheckForServiceProjectCommand.class);
// Setup the PreClientDevelopCommand.
- //
- dataRegistry.addMapping( ClientWizardWidgetOutputCommand.class, "InstallClient", PreClientDevelopCommand.class);
- dataRegistry.addMapping( ClientWizardWidgetOutputCommand.class, "TestService", PreClientDevelopCommand.class);
+ dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "InstallClient", PreClientDevelopCommand.class);
+
+ //Always start the client if it is installed.
+ dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "InstallClient", PreClientDevelopCommand.class, "StartService", null);
+
+ dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "TestService", PreClientDevelopCommand.class);
dataRegistry.addMapping( ClientWizardWidgetOutputCommand.class, "ResourceContext", PreClientDevelopCommand.class);
- //
- dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientTypeRuntimeServer", PreClientDevelopCommand.class );
+ dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientTypeRuntimeServer", PreClientDevelopCommand.class );
dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientJ2EEVersion", PreClientDevelopCommand.class);
dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientProject", PreClientDevelopCommand.class, "Module", null );
dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientProjectType", PreClientDevelopCommand.class, "ModuleType", null);
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 bd18b00..536ddb9 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
@@ -7,6 +7,9 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner
*******************************************************************************/
package org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions;
@@ -15,6 +18,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.common.ServerUtils;
import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages;
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
@@ -23,6 +27,7 @@
import org.eclipse.wst.command.internal.env.core.context.ResourceContext;
import org.eclipse.wst.common.environment.IEnvironment;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.ws.internal.parser.discovery.WebServicesParserExt;
import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser;
@@ -492,6 +497,15 @@
env.getStatusHandler().reportError(status);
}
+ //Determine if the selected server type has only stub runtimes associated with it.
+ //If so, set install and test to false in the context.
+ IRuntime nonStubRuntime = ServerUtils.getNonStubRuntime(serverId);
+ if (nonStubRuntime == null)
+ {
+ installClient = Boolean.FALSE;
+ testService = Boolean.FALSE;
+ }
+
return status;
}
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 9a2ab97..e30ae4f 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
@@ -7,6 +7,9 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner
*******************************************************************************/
package org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions;
@@ -15,6 +18,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.common.ServerUtils;
import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages;
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
@@ -22,6 +26,7 @@
import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
import org.eclipse.wst.common.environment.IEnvironment;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.ws.internal.parser.discovery.WebServicesParserExt;
import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser;
@@ -319,6 +324,15 @@
env.getStatusHandler().reportError(status);
}
+ //Determine if the selected server type has only stub runtimes associated with it.
+ //If so, set install, run, and test to false in the context.
+ IRuntime nonStubRuntime = ServerUtils.getNonStubRuntime(serverId);
+ if (nonStubRuntime == null)
+ {
+ installService = Boolean.FALSE;
+ startService = Boolean.FALSE;
+ testService = Boolean.FALSE;
+ }
return status;
}
}
\ No newline at end of file
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 070494c..3d4ee20 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
@@ -7,6 +7,9 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner
*******************************************************************************/
package org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime;
@@ -143,6 +146,11 @@
{
projectWidget_.setComponentType( type );
}
+
+ public void setInstallClient(boolean b)
+ {
+ runtimeWidget_.setInstall(b);
+ }
private void handleUpdateProjectWidget()
{
@@ -179,7 +187,7 @@
finalStatus = projectStatus;
}
else
- {
+ {
String projectName = projectWidget_.getProjectName();
if (projectName != null && projectName.length()>0)
{
@@ -244,8 +252,17 @@
}
}
+
+ //If finalStatus is still OK, check if there are any warnings.
+ if (finalStatus.getSeverity()!=Status.ERROR)
+ {
+ if( runtimeStatus.getSeverity() == Status.WARNING )
+ {
+ finalStatus = runtimeStatus;
+ }
+ }
}
-
+
return finalStatus;
}
}
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 1ba81e3..e47c1a4 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
@@ -7,6 +7,9 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060204 124143 rsinha@ca.ibm.com - Rupam Kuehner
*******************************************************************************/
package org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime;
@@ -598,30 +601,27 @@
{
earProject_.removeAll();
String projectName = moduleProject_.getText();
+ setEarProjectItems();
if (projectName != null && projectName.length() > 0)
{
IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+
if (proj.exists())
{
+
IVirtualComponent[] ears = J2EEUtils.getReferencingEARComponents(proj);
if (ears != null && ears.length > 0)
{
- for (int i = 0; i < ears.length; i++)
- {
- earProject_.add(ears[i].getName());
- }
- earProject_.select(0);
+ earProject_.setText(ears[0].getName());
return;
}
+
}
+
String earName = projectName + "EAR";
earProject_.setText(earName);
}
- else
- {
- setEarProjectItems();
- }
}
private boolean projectNeedsEAR(String projectName)
@@ -720,9 +720,39 @@
if (needEAR_ && (earText==null || earText.length()==0))
{
if (isClient_)
+ {
return StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_CLIENT_EAR_EMPTY, new String[]{""} ) );
+ }
else
- return StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_SERVICE_EAR_EMPTY, new String[]{""} ) );
+ {
+ return StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_SERVICE_EAR_EMPTY, new String[]{""} ) );
+ }
+ }
+
+ //If the project and EAR both exist and the project is not already associated with the EAR, ensure
+ //they can be associated.
+ if (needEAR_)
+ {
+ IProject p = ProjectUtilities.getProject(projectText.trim());
+ IProject ep = ProjectUtilities.getProject(earText.trim());
+ if (p.exists() && ep.exists())
+ {
+ if (!J2EEUtils.isComponentAssociated(ep,p))
+ {
+ IStatus associateStatus = J2EEUtils.canAssociateProjectToEAR(p, ep);
+ if (associateStatus.getSeverity() == IStatus.ERROR)
+ {
+ if (isClient_)
+ {
+ return StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_CLIENT_CANNOT_ASSOCIATE, new String[]{p.getName(), ep.getName(), associateStatus.getMessage()} ) );
+ }
+ else
+ {
+ return StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_SERVICE_CANNOT_ASSOCIATE, new String[]{p.getName(), ep.getName(), associateStatus.getMessage()} ) );
+ }
+ }
+ }
+ }
}
return finalStatus;
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 1dc214f..e1f6567 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
@@ -7,12 +7,16 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner
*******************************************************************************/
package org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.window.Window;
+import org.eclipse.jst.ws.internal.common.ServerUtils;
import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages;
import org.eclipse.jst.ws.internal.consumption.ui.wizard.RuntimeServerSelectionDialog;
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
@@ -34,7 +38,6 @@
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServerType;
import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.ServerUtil;
@@ -47,6 +50,7 @@
private Composite parent_;
private boolean isClientContext_;
private TypeRuntimeServer ids_;
+ private boolean install_;
private Listener statusListener_;
@@ -108,6 +112,11 @@
setLabels();
}
+ public void setInstall(boolean b)
+ {
+ install_ = b;
+ }
+
private void setLabels()
{
String runtimeLabel = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById( ids_.getRuntimeId() );
@@ -190,35 +199,6 @@
{
status = StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_NO_SERVER, new String[]{ scenario } ) );
}
-
- //Check if only stub runtime is available for the selected server type
-
- String serverFactoryId = ids_.getServerId();
- //
- IServerType serverType = ServerCore.findServerType(serverFactoryId);
- if (serverType!=null) {
-
- //Find a Runtime which is not a stub
- //IRuntime nonStubRuntime = null;
- boolean foundNonStubRuntime = false;
- 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
- foundNonStubRuntime=true;
- break;
- }
- }
-
- if (!foundNonStubRuntime)
- {
- String servertypeLabel = WebServiceRuntimeExtensionUtils2.getServerLabelById(serverFactoryId);
- status = StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_ERROR_STUB_ONLY,new String[]{servertypeLabel}) );
- }
- }
//
@@ -242,9 +222,28 @@
}
}
-
-
-
+
+ if (status.getSeverity() != Status.ERROR)
+ {
+ // Check if only stub runtime is available for the selected server type
+
+ String serverFactoryId = ids_.getServerId();
+ //
+ IServerType serverType = ServerCore.findServerType(serverFactoryId);
+ if (serverType != null)
+ {
+
+ // Find a Runtime which is not a stub
+ IRuntime nonStubRuntime = ServerUtils.getNonStubRuntime(serverFactoryId);
+ if (install_ && nonStubRuntime == null)
+ {
+ String servertypeLabel = WebServiceRuntimeExtensionUtils2.getServerLabelById(serverFactoryId);
+ status = StatusUtils.warningStatus(NLS
+ .bind(ConsumptionUIMessages.MSG_WARN_STUB_ONLY, new String[] { servertypeLabel }));
+ }
+ }
+ }
+
return status;
}
}
diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateFacetedProjectCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateFacetedProjectCommand.java
index 163f37e..e707c98 100644
--- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateFacetedProjectCommand.java
+++ b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/CreateFacetedProjectCommand.java
@@ -10,6 +10,7 @@
* yyyymmdd bug Email and other contact information
* -------- -------- -----------------------------------------------------------
* 20060131 121071 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner
*******************************************************************************/
package org.eclipse.jst.ws.internal.consumption.command.common;
@@ -26,6 +27,7 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
import org.eclipse.jst.server.core.FacetUtil;
+import org.eclipse.jst.ws.internal.common.ServerUtils;
import org.eclipse.jst.ws.internal.consumption.ConsumptionMessages;
import org.eclipse.jst.ws.internal.consumption.common.FacetMatcher;
import org.eclipse.jst.ws.internal.consumption.common.FacetSetsByTemplateCache;
@@ -186,17 +188,27 @@
}
else
{
- IServerType st = ServerCore.findServerType(serverFactoryId);
- String runtimeTypeId = st.getRuntimeType().getId();
- //Find the facet runtime
- IRuntime[] runtimes = ServerCore.getRuntimes();
- for (int i=0; i<runtimes.length; i++)
+ //Find a non Stub runtime that matches this server type
+ IRuntime serverRuntime = ServerUtils.getNonStubRuntime(serverFactoryId);
+ if (serverRuntime != null)
{
- IRuntime sRuntime = runtimes[i];
- if ( !sRuntime.isStub() && sRuntime.getRuntimeType().getId().equals(runtimeTypeId))
+ facetRuntime = FacetUtil.getRuntime(serverRuntime);
+ }
+ else
+ {
+ //Accept stub runtime.
+ IServerType st = ServerCore.findServerType(serverFactoryId);
+ String runtimeTypeId = st.getRuntimeType().getId();
+ //Find the facet runtime
+ IRuntime[] runtimes = ServerCore.getRuntimes();
+ for (int i=0; i<runtimes.length; i++)
{
- facetRuntime = FacetUtil.getRuntime(sRuntime);
- }
+ IRuntime sRuntime = runtimes[i];
+ if (sRuntime.getRuntimeType().getId().equals(runtimeTypeId))
+ {
+ facetRuntime = FacetUtil.getRuntime(sRuntime);
+ }
+ }
}
}
}
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 d73851b..5097a5e 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
@@ -7,6 +7,9 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner *
*******************************************************************************/
package org.eclipse.jst.ws.internal.consumption.command.common;
@@ -567,17 +570,27 @@
}
else
{
- IServerType st = ServerCore.findServerType(serverFactoryId);
- String runtimeTypeId = st.getRuntimeType().getId();
- //Find the facet runtime
- IRuntime[] runtimes = ServerCore.getRuntimes();
- for (int i=0; i<runtimes.length; i++)
+ //Find a non Stub runtime that matches this server type
+ IRuntime serverRuntime = ServerUtils.getNonStubRuntime(serverFactoryId);
+ if (serverRuntime != null)
{
- IRuntime sRuntime = runtimes[i];
- if ( !sRuntime.isStub() && sRuntime.getRuntimeType().getId().equals(runtimeTypeId))
+ facetRuntime = FacetUtil.getRuntime(serverRuntime);
+ }
+ else
+ {
+ //Accept stub runtime.
+ IServerType st = ServerCore.findServerType(serverFactoryId);
+ String runtimeTypeId = st.getRuntimeType().getId();
+ //Find the facet runtime
+ IRuntime[] runtimes = ServerCore.getRuntimes();
+ for (int i=0; i<runtimes.length; i++)
{
- facetRuntime = FacetUtil.getRuntime(sRuntime);
- }
+ IRuntime sRuntime = runtimes[i];
+ if (sRuntime.getRuntimeType().getId().equals(runtimeTypeId))
+ {
+ facetRuntime = FacetUtil.getRuntime(sRuntime);
+ }
+ }
}
}
}
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 10b8f1c..9dd1600 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
@@ -7,6 +7,10 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20060204 121605 rsinha@ca.ibm.com - Rupam Kuehner
*******************************************************************************/
package org.eclipse.jst.ws.internal.creation.ui.widgets.binding;
@@ -138,10 +142,13 @@
dataRegistry.addMapping(ServerWizardWidget.class, "ResourceContext", ServerWizardWidgetOutputCommand.class);
// Before ObjectSelectionWidget
- dataRegistry.addMapping(ServerWizardWidgetOutputCommand.class, "TestService", ClientTestWidget.class );
- dataRegistry.addMapping(ServerWizardWidgetOutputCommand.class, "TestService",FinishTestFragment.class);
+ dataRegistry.addMapping(ServerExtensionDefaultingCommand.class, "TestService", ClientTestWidget.class );
+ dataRegistry.addMapping(ServerExtensionDefaultingCommand.class, "TestService",FinishTestFragment.class);
+
dataRegistry.addMapping(ServerWizardWidgetOutputCommand.class, "GenerateProxy", TestDefaultingFragment.class);
// Before ServerRuntimeSelectionWidget
+ dataRegistry.addMapping(ServerWizardWidgetOutputCommand.class, "InstallService", ServerRuntimeSelectionWidget.class);
+ dataRegistry.addMapping(ServerWizardWidgetOutputCommand.class, "InstallClient", ServerRuntimeSelectionWidget.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "GenerateProxy", ServerRuntimeSelectionWidget.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceProjectName", ServerRuntimeSelectionWidget.class);
dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceEarProjectName", ServerRuntimeSelectionWidget.class);
@@ -371,10 +378,11 @@
// Setup the PreClientDevelopCommand.
- dataRegistry.addMapping( ServerWizardWidgetOutputCommand.class, "InstallClient", PreClientDevelopCommand.class);
- dataRegistry.addMapping( ServerWizardWidgetOutputCommand.class, "TestService", PreClientDevelopCommand.class);
+ dataRegistry.addMapping( ServerExtensionDefaultingCommand.class, "TestService", PreClientDevelopCommand.class);
+
dataRegistry.addMapping( ServerWizardWidgetOutputCommand.class, "ResourceContext", PreClientDevelopCommand.class);
dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "InstallClient", PreClientDevelopCommand.class );
+ dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "InstallClient", PreClientDevelopCommand.class, "StartService", null);
dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientTypeRuntimeServer", PreClientDevelopCommand.class );
dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientRuntimeId", PreClientDevelopCommand.class );
dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientJ2EEVersion", PreClientDevelopCommand.class);
@@ -504,10 +512,10 @@
dataRegistry.addMapping(ServerExtensionDefaultingCommand.class, "ServiceTypeRuntimeServer", ClientTestDelegateCommand.class);
// Setup the PreServiceDevelopCommand.
- //
- dataRegistry.addMapping( ServerWizardWidgetOutputCommand.class, "InstallService", PreServiceDevelopCommand.class);
- dataRegistry.addMapping( ServerWizardWidgetOutputCommand.class, "StartService", PreServiceDevelopCommand.class);
- dataRegistry.addMapping( ServerWizardWidgetOutputCommand.class, "TestService", PreServiceDevelopCommand.class);
+ dataRegistry.addMapping( ServerExtensionDefaultingCommand.class, "InstallService", PreServiceDevelopCommand.class);
+ dataRegistry.addMapping( ServerExtensionDefaultingCommand.class, "StartService", PreServiceDevelopCommand.class);
+ dataRegistry.addMapping( ServerExtensionDefaultingCommand.class, "TestService", PreServiceDevelopCommand.class);
+
dataRegistry.addMapping( ServerWizardWidgetOutputCommand.class, "PublishService", PreServiceDevelopCommand.class);
dataRegistry.addMapping( ServerWizardWidgetOutputCommand.class, "GenerateProxy", PreServiceDevelopCommand.class);
dataRegistry.addMapping( ServerWizardWidgetOutputCommand.class, "ResourceContext", PreServiceDevelopCommand.class);
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 463d82f..0ad7f22 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
@@ -7,6 +7,9 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner
*******************************************************************************/
package org.eclipse.jst.ws.internal.creation.ui.widgets.runtime;
@@ -238,6 +241,16 @@
clientWidget_.setClientEarProjectName(name);
}
+ public void setInstallService(boolean b)
+ {
+ runtimeWidget_.setInstall(b);
+ }
+
+ public void setInstallClient(boolean b)
+ {
+ clientWidget_.setInstallClient(b);
+ }
+
private class TextModifyListener implements ModifyListener
{
public void modifyText(ModifyEvent e)
@@ -285,7 +298,7 @@
}
else if ( projectStatus.getSeverity()== Status.ERROR) {
finalStatus = projectStatus;
- }
+ }
String projectName = projectWidget_.getProjectName();
if (projectName != null && projectName.length()>0)
@@ -351,40 +364,7 @@
}
}
- /*
- //Validate service side server target and J2EE level
- ValidationUtils valUtils = new ValidationUtils();
- String serviceEARName = projectWidget_.getEarProjectName();
- String serviceProjName = projectWidget_.getProjectName();
- String serviceServerFactoryId = runtimeWidget_.getTypeRuntimeServer().getServerId();
- String serviceJ2EElevel = runtimeWidget_.getJ2EEVersion();
- String serviceComponentName = projectWidget_.getComponentName();
- String serviceEARComponentName = projectWidget_.getEarComponentName();
- IStatus serviceProjectStatus = valUtils.validateProjectTargetAndJ2EE(serviceProjName,serviceComponentName, serviceEARName, serviceEARComponentName, serviceServerFactoryId, serviceJ2EElevel);
- if(serviceProjectStatus.getSeverity()==Status.ERROR)
- {
- finalStatus = serviceProjectStatus;
- }
-
- //Ensure the service project type (Web/EJB) is valid
- if (serviceProjName!=null && serviceProjName.length()>0)
- {
- IProject serviceProj = ProjectUtilities.getProject(serviceProjName);
- if (serviceProj.exists())
- {
- if (serviceComponentName!=null && serviceComponentName.length()>0)
- {
- String compTypeId = J2EEUtils.getComponentTypeId(serviceProj);
- if (!compTypeId.equals(projectWidget_.getComponentType()))
- {
- //Construct the error message
- String compTypeLabel = getCompTypeLabel(projectWidget_.getComponentType());
- finalStatus = StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_INVALID_PROJECT_TYPE,new String[]{serviceProjName, compTypeLabel}) );
- }
- }
- }
- }
- */
+
if (isClientWidgetVisible_)
{
String clientEARName = clientWidget_.getClientEarProjectName();
@@ -415,7 +395,20 @@
}
}
-
+
+ //If finalStatus is still OK, check if there are any warnings.
+ if (finalStatus.getSeverity()!=Status.ERROR)
+ {
+ if( serviceStatus.getSeverity() == Status.WARNING )
+ {
+ finalStatus = serviceStatus;
+ }
+ else if (clientStatus.getSeverity() == Status.WARNING)
+ {
+ finalStatus = serviceStatus;
+ }
+ }
+
return finalStatus;
}
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 d661b50..447eeea 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
@@ -7,6 +7,9 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060204 124143 rsinha@ca.ibm.com - Rupam Kuehner
*******************************************************************************/
package org.eclipse.jst.ws.internal.common;
@@ -15,6 +18,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import java.util.StringTokenizer;
import java.util.Vector;
import org.eclipse.core.commands.ExecutionException;
@@ -24,8 +28,10 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
@@ -39,7 +45,9 @@
import org.eclipse.jst.j2ee.ejb.componentcore.util.EJBArtifactEdit;
import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
+import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.ModuleCoreNature;
import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
@@ -52,6 +60,7 @@
import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+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.server.core.IModule;
@@ -925,14 +934,150 @@
}
}
+
+ /*
+ * Determines whether project can be associated with earProject.
+ * @returns IStatus of OK if the project is a Web project, EJB project, or AppClient
+ * project that can be associated with the EAR project.
+ * Returns IStatus with an ERROR severity if the project is a Web project,
+ * EJB project, or AppClient project that cannot be associated with the EAR project.
+ * When an IStatus of severity ERROR is returned, the IStatus' message will contain the
+ * lowest J2EE level that this project requires on an EAR.
+ * Returns an IStatus with severity OK if project is not recognized as a Web, EJB, or
+ * AppClient project or if earProject is not recognized as an EAR project.
+ */
+ public static IStatus canAssociateProjectToEAR(IProject project, IProject earProject)
+ {
+ //If project contains the web, ejb, or appclient facet, and earProject contains the
+ //ear facet, return whether or not the facet versions are such that the project
+ //can be added to the ear.
+
+ IStatus status = Status.OK_STATUS;
+ boolean isWeb = isWebComponent(project);
+ boolean isEJB = isEJBComponent(project);
+ boolean isAppClient = isAppClientComponent(project);
+ boolean isEAR = isEARComponent(earProject);
+ if ((isWeb || isEJB || isAppClient) && isEAR)
+ {
+ try
+ {
+ IFacetedProject fProject = ProjectFacetsManager.create(project);
+ IFacetedProject fEarProject = ProjectFacetsManager.create(earProject);
+
+ IProjectFacet earPf = ProjectFacetsManager.getProjectFacet(IJ2EEModuleConstants.JST_EAR_MODULE);
+ IProjectFacetVersion earPfv = fEarProject.getInstalledVersion(earPf);
+ String earVersion = earPfv.getVersionString();
+
+ String webVersion = null;
+ String ejbVersion = null;
+ String acVersion = null;
+
+ if (isWeb)
+ {
+ IProjectFacet webPf = ProjectFacetsManager.getProjectFacet(IJ2EEModuleConstants.JST_WEB_MODULE);
+ IProjectFacetVersion webPfv = fProject.getInstalledVersion(webPf);
+ webVersion = webPfv.getVersionString();
+ }
+ else if (isEJB)
+ {
+ IProjectFacet ejbPf = ProjectFacetsManager.getProjectFacet(IJ2EEModuleConstants.JST_EJB_MODULE);
+ IProjectFacetVersion ejbPfv = fProject.getInstalledVersion(ejbPf);
+ ejbVersion = ejbPfv.getVersionString();
+ }
+ else if (isAppClient)
+ {
+ IProjectFacet acPf = ProjectFacetsManager.getProjectFacet(IJ2EEModuleConstants.JST_APPCLIENT_MODULE);
+ IProjectFacetVersion acPfv = fProject.getInstalledVersion(acPf);
+ acVersion = acPfv.getVersionString();
+ }
+
+ if ((isWeb && webVersion.equals(J2EEVersionConstants.VERSION_2_2_TEXT)) ||
+ (isEJB && ejbVersion.equals(J2EEVersionConstants.VERSION_1_1_TEXT)) ||
+ (isAppClient && acVersion.equals(J2EEVersionConstants.VERSION_1_2_TEXT))
+ )
+ {
+ if (!greaterThanOrEqualTo(earVersion, J2EEVersionConstants.VERSION_1_2_TEXT))
+ {
+ status = StatusUtils.errorStatus(J2EEVersionConstants.VERSION_1_2_TEXT);
+ }
+ }
+ else if ((isWeb && webVersion.equals(J2EEVersionConstants.VERSION_2_3_TEXT)) ||
+ (isEJB && ejbVersion.equals(J2EEVersionConstants.VERSION_2_0_TEXT)) ||
+ (isAppClient && acVersion.equals(J2EEVersionConstants.VERSION_1_3_TEXT))
+ )
+ {
+ if (!greaterThanOrEqualTo(earVersion, J2EEVersionConstants.VERSION_1_3_TEXT))
+ {
+ status = StatusUtils.errorStatus(J2EEVersionConstants.VERSION_1_3_TEXT);
+ }
+ }
+ else if ((isWeb && webVersion.equals(J2EEVersionConstants.VERSION_2_4_TEXT)) ||
+ (isEJB && ejbVersion.equals(J2EEVersionConstants.VERSION_2_1_TEXT)) ||
+ (isAppClient && acVersion.equals(J2EEVersionConstants.VERSION_1_4_TEXT))
+ )
+ {
+ if (!greaterThanOrEqualTo(earVersion, J2EEVersionConstants.VERSION_1_4_TEXT))
+ {
+ status = StatusUtils.errorStatus(J2EEVersionConstants.VERSION_1_4_TEXT);
+ }
+ }
+ } catch (CoreException ce)
+ {
+ //If facet API throws a CoreException when trying to create an IFacetedProject from
+ //an IProject, an OK Status will be returned and clients of this utility method
+ //won't raise a validation error.
+ }
+ }
+
+ return status;
+ }
+ /*
+ * @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 or equal to versionB
+ */
+ private static boolean greaterThanOrEqualTo(String versionA, String versionB)
+ {
+ if (versionA.equals(versionB))
+ {
+ return true;
+ }
+ else
+ {
+ 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;
+ }
+ }
/**
- * @param project
- * @return
- */
+ * @param project
+ * @return
+ */
public static IPath getWebInfPath(IProject project){
IVirtualComponent component = ComponentCore.createComponent(project);
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 06f5b03..cdbd636 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
@@ -7,6 +7,9 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner
*******************************************************************************/
package org.eclipse.jst.ws.internal.common;
@@ -743,4 +746,37 @@
}
}
+
+ /*
+ * Returns a non-stub runtime if one is available for the the given server type.
+ * @param serverFactoryId - server type id
+ * @returns IRuntime Returns a non-stub runtime if one is available for the the given server type.
+ * Returns null otherwise.
+ */
+ public static IRuntime getNonStubRuntime(String serverFactoryId)
+ {
+ //Find a Runtime which is not a stub
+ IServerType serverType = ServerCore.findServerType(serverFactoryId);
+ IRuntime nonStubRuntime = null;
+ if (serverType != null)
+ {
+ //boolean foundNonStubRuntime = false;
+ 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
+ //foundNonStubRuntime = true;
+ nonStubRuntime = runtime;
+ break;
+ }
+ }
+ }
+
+ return nonStubRuntime;
+ }
}