diff options
author | kchan | 2005-09-27 05:09:04 +0000 |
---|---|---|
committer | kchan | 2005-09-27 05:09:04 +0000 |
commit | e256cdef626c6ebe10909f6ed318d264f05c5f55 (patch) | |
tree | ad9c645c9c71610062a1206044d4a5401080ac54 /bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption | |
parent | cb8c8f06121c49e77c5980ce4f7b6a5cee03cb78 (diff) | |
download | webtools.webservices-e256cdef626c6ebe10909f6ed318d264f05c5f55.tar.gz webtools.webservices-e256cdef626c6ebe10909f6ed318d264f05c5f55.tar.xz webtools.webservices-e256cdef626c6ebe10909f6ed318d264f05c5f55.zip |
[110362] Move commands over to using EnvironmentOperations.
Diffstat (limited to 'bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption')
76 files changed, 492 insertions, 4252 deletions
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/action/LaunchWSEAction.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/action/LaunchWSEAction.java index 672f9609d..e7b335718 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/action/LaunchWSEAction.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/action/LaunchWSEAction.java @@ -41,7 +41,8 @@ public class LaunchWSEAction implements IWorkbenchWindowActionDelegate new LaunchOption(LaunchOptions.DEFAULT_FAVORITES_LOCATION,defaultFavoritesLocation) }; cmd.setLaunchOptions(launchOptions); - cmd.execute( environment ); + cmd.setEnvironment( environment ); + cmd.execute( null, null ); } /* (non-Javadoc) 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 56f58a884..a036a81cc 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 @@ -10,13 +10,13 @@ *******************************************************************************/ package org.eclipse.jst.ws.internal.consumption.ui.command; -import java.util.Calendar; -import java.util.GregorianCalendar; - import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jem.util.emf.workbench.ProjectUtilities; import org.eclipse.jst.ws.internal.consumption.ui.common.ValidationUtils; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; 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; @@ -30,7 +30,7 @@ import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; * This command checks to see if the selected client project is the * service project. If so, the user is warned. */ -public class CheckForServiceProjectCommand extends SimpleCommand +public class CheckForServiceProjectCommand extends EnvironmentalOperation { MessageUtils msgUtils; SelectionListChoices runtime2ClientTypes; @@ -62,8 +62,9 @@ public class CheckForServiceProjectCommand extends SimpleCommand /* (non-Javadoc) * @see org.eclipse.wst.command.env.core.Command#execute(org.eclipse.wst.command.internal.provisional.env.core.common.Environment) */ - public Status execute(Environment environment) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { + Environment environment = getEnvironment(); Status status = new SimpleStatus(""); if (runtime2ClientTypes==null || wsdlURI==null || wsdlURI.length()==0 || webServicesParser==null) return status; @@ -74,7 +75,6 @@ public class CheckForServiceProjectCommand extends SimpleCommand IProject clientProject = ProjectUtilities.getProject(clientProjectName); ValidationUtils vu = new ValidationUtils(); - Calendar cal = new GregorianCalendar(); boolean isServiceProject = vu.isProjectServiceProject(clientProject, wsdlURI, webServicesParser); if (isServiceProject) { diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/GenerateHandlerSkeletonCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/GenerateHandlerSkeletonCommand.java index bb2622643..3d12ff98d 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/GenerateHandlerSkeletonCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/GenerateHandlerSkeletonCommand.java @@ -16,14 +16,16 @@ import java.io.OutputStream; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.List; - import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jst.ws.internal.common.EnvironmentUtils; import org.eclipse.jst.ws.internal.common.ResourceUtils; import org.eclipse.wst.command.internal.env.common.FileResourceUtils; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; 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; @@ -31,15 +33,10 @@ import org.eclipse.wst.command.internal.provisional.env.core.common.Status; -public class GenerateHandlerSkeletonCommand extends SimpleCommand +public class GenerateHandlerSkeletonCommand extends EnvironmentalOperation { - private IProject serviceProject_; private MessageUtils msgUtils_; - - private String LABEL = "TASK_LABEL_GEN_HANDLER_SKELETON"; - private String DESCRIPTION = "TASK_DESC_GEN_HANDLER_SKELETON"; - private IPath outputLocation_; private String[] handlerNames_; private boolean genSkeleton_; @@ -49,20 +46,18 @@ public class GenerateHandlerSkeletonCommand extends SimpleCommand { String pluginId = "org.eclipse.jst.ws.consumption.ui"; msgUtils_ = new MessageUtils( pluginId + ".plugin", this ); - setName (msgUtils_.getMessage(LABEL)); - setDescription( msgUtils_.getMessage(DESCRIPTION)); } - public Status execute (Environment env) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { + Environment env = getEnvironment(); if (!genSkeleton_) return new SimpleStatus(""); int i; boolean error = false; - boolean warning = false; SimpleStatus status = null; Status writeStatus; diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/OpenJavaEditorCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/OpenJavaEditorCommand.java index 77efef80c..b16def4b1 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/OpenJavaEditorCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/OpenJavaEditorCommand.java @@ -12,8 +12,8 @@ package org.eclipse.jst.ws.internal.consumption.ui.command; import java.util.Iterator; import java.util.List; - import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.jobs.Job; @@ -23,13 +23,11 @@ import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.ui.JavaUI; import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; import org.eclipse.ui.progress.UIJob; -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.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.common.SimpleStatus; -import org.eclipse.wst.command.internal.provisional.env.core.common.Status; -public class OpenJavaEditorCommand extends SimpleCommand +public class OpenJavaEditorCommand extends EnvironmentalOperation { private List classNames; private IProject project; @@ -38,7 +36,7 @@ public class OpenJavaEditorCommand extends SimpleCommand { } - public Status execute(Environment environment) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { OpenJavaEditorJob job = new OpenJavaEditorJob(classNames, project); job.setPriority(Job.LONG); diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/WSINonCompliantRuntimeCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/WSINonCompliantRuntimeCommand.java index 51d4f6f56..9d9d5da7e 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/WSINonCompliantRuntimeCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/WSINonCompliantRuntimeCommand.java @@ -12,9 +12,11 @@ package org.eclipse.jst.ws.internal.consumption.ui.command; import java.util.Vector; - import org.eclipse.core.resources.IProject; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; 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; @@ -26,26 +28,22 @@ import org.eclipse.wst.ws.internal.ui.wsi.preferences.WSIComplianceUtils; -public class WSINonCompliantRuntimeCommand extends SimpleCommand +public class WSINonCompliantRuntimeCommand extends EnvironmentalOperation { private IProject serviceProject_; private MessageUtils msgUtils_; - - private String LABEL = "TASK_LABEL_WSI_NONCOMPLIANT"; - private String DESCRIPTION = "TASK_DESC_WSI_NONCOMPLIANT"; public WSINonCompliantRuntimeCommand() { String pluginId = "org.eclipse.wst.ws.ui"; msgUtils_ = new MessageUtils( pluginId + ".plugin", this ); - setName (msgUtils_.getMessage(LABEL)); - setDescription( msgUtils_.getMessage(DESCRIPTION)); } - public Status execute (Environment environment) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { + Environment environment = getEnvironment(); PersistentWSISSBPContext wsiSSBPContext = WSUIPlugin.getInstance().getWSISSBPContext(); PersistentWSIAPContext wsiAPContext = WSUIPlugin.getInstance().getWSIAPContext(); diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ClientServerSelectionUtils.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ClientServerSelectionUtils.java deleted file mode 100644 index 4a6be0397..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ClientServerSelectionUtils.java +++ /dev/null @@ -1,510 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.common; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.j2ee.internal.servertarget.IServerTargetConstants; -import org.eclipse.jst.j2ee.internal.servertarget.ServerTargetHelper; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.common.ServerUtils; -import org.eclipse.jst.ws.internal.consumption.common.IServerDefaulter; -import org.eclipse.jst.ws.internal.consumption.common.ServerInfo; -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.wizard.WebServiceClientTypeRegistry; -import org.eclipse.wst.server.core.IRuntime; -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; - - -public class ClientServerSelectionUtils -{ - /* - * Returns reasonable defaults for server factory id and instance id based on - * an existing project - * index [0] contains factoryId, index[1] contains instance Id. - * @deprecated - */ - public static String[] getServerInfoFromExistingProject(IProject project, String typeId, boolean askExtenders) - { - String[] serverInfo = new String[2]; //serverInfp[0] contains factoryId, serverInfo[1] contains instance Id - - // If the project has been added to an existing server, pick that server - IServer[] configuredServers = ServerUtil.getServersByModule(ResourceUtils.getModule(project), null); - IServer firstSupportedServer = getFirstSupportedServer(configuredServers, typeId ); - if (firstSupportedServer != null) - { - serverInfo[0] = firstSupportedServer.getServerType().getId(); - serverInfo[1] = firstSupportedServer.getId(); - return serverInfo; - } - - //Does the project have a runtime-target? - IRuntime runtimeTarget = getRuntimeTarget(project.getName()); - if (runtimeTarget != null) - { - //Look for an existing server which is compatible with the runtime-target - IServer[] compatibleServers = getCompatibleExistingServers(runtimeTarget); - if (compatibleServers!=null && compatibleServers.length > 0) - { - IServer firstSupportedCompatServer = getFirstSupportedServer(compatibleServers, typeId); - if (firstSupportedCompatServer != null) - { - serverInfo[0] = firstSupportedCompatServer.getServerType().getId(); - serverInfo[1] = firstSupportedCompatServer.getId(); - return serverInfo; - - } - } - - //No existing compatible server was found. Choose a compatible server type. - - //If the preferred server is compatible with the project's runtime target, use it. - PersistentServerRuntimeContext ctx = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext(); - String pFactoryId = ctx.getServerFactoryId(); - IServerType serverType = ServerCore.findServerType(pFactoryId); - if (serverType!=null){ - String serverRuntimeId = serverType.getRuntimeType().getId(); - if (serverRuntimeId.equals(runtimeTarget.getRuntimeType().getId())) - { - serverInfo[0] = pFactoryId; - return serverInfo; - } - } - - //The preferred server was not compatible. Pick the first valid compatible server type. - String factoryId = getFirstSupportedServerType(runtimeTarget, typeId); - if (factoryId != null) serverInfo[0] = factoryId; - return serverInfo; - - } - - - if (askExtenders) - { - ServerInfo recommendedServerInfo = getExtenderRecommendation(project); - if (recommendedServerInfo!=null) - { - if (recommendedServerInfo.getServerFactoryId()!=null && recommendedServerInfo.getServerFactoryId().length()>0) - serverInfo[0] = recommendedServerInfo.getServerFactoryId(); - - if (recommendedServerInfo.getServerInstanceId()!=null && recommendedServerInfo.getServerInstanceId().length()>0) - serverInfo[1] = recommendedServerInfo.getServerInstanceId(); - - return serverInfo; - } - } - - //Use ServerTargetHelper to get a list of valid runtime-targets and use these to determine a default server type. - String[] projectAttrs = ServerTargetHelper.getProjectTypeAndJ2EELevel(project); - List runtimes = ServerTargetHelper.getServerTargets(projectAttrs[0], projectAttrs[1]); - String[] compatServerInfo = getCompatibleExistingServer(runtimes,typeId); - if ( compatServerInfo != null) - { - return compatServerInfo; - } - - //No existing compatible server, pick a type. - String factoryId = getFirstSupportedServerType(runtimes, typeId); - if (factoryId != null) serverInfo[0] = factoryId; - return serverInfo; - - } - - /* - * Returns reasonable defaults for server factory id and instance id based on - * an existing project - * index [0] contains factoryId, index[1] contains instance Id. - * @deprecated - */ - public static String[] getServerInfoFromExistingProject(IProject project, String typeId, String runtimeId, boolean askExtenders) - { - String[] serverInfo = new String[2]; //serverInfp[0] contains factoryId, serverInfo[1] contains instance Id - - // If the project has been added to an existing server, pick that server - IServer[] configuredServers = ServerUtil.getServersByModule(ResourceUtils.getModule(project), null); - IServer firstSupportedServer = getFirstSupportedServer(configuredServers, typeId ); - if (firstSupportedServer != null) - { - serverInfo[0] = firstSupportedServer.getServerType().getId(); - serverInfo[1] = firstSupportedServer.getId(); - return serverInfo; - } - - //Does the project have a runtime-target? - IRuntime runtimeTarget = getRuntimeTarget(project.getName()); - if (runtimeTarget != null) - { - //Look for an existing server which is compatible with the runtime-target - IServer[] compatibleServers = getCompatibleExistingServers(runtimeTarget); - if (compatibleServers!=null && compatibleServers.length > 0) - { - IServer firstSupportedCompatServer = getFirstSupportedServer(compatibleServers, typeId); - if (firstSupportedCompatServer != null) - { - serverInfo[0] = firstSupportedCompatServer.getServerType().getId(); - serverInfo[1] = firstSupportedCompatServer.getId(); - return serverInfo; - - } - } - - //No existing compatible server was found. Choose a compatible server type. - - //If the preferred server is compatible with the project's runtime target, use it. - PersistentServerRuntimeContext ctx = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext(); - String pFactoryId = ctx.getServerFactoryId(); - IServerType serverType = ServerCore.findServerType(pFactoryId); - if (serverType!=null){ - String serverRuntimeId = serverType.getRuntimeType().getId(); - if (serverRuntimeId.equals(runtimeTarget.getRuntimeType().getId())) - { - serverInfo[0] = pFactoryId; - return serverInfo; - } - } - - //The preferred server was not compatible. Pick the first valid compatible server type. - String factoryId = getFirstSupportedServerType(runtimeTarget, typeId); - if (factoryId != null) serverInfo[0] = factoryId; - return serverInfo; - - } - - - if (askExtenders) - { - ServerInfo recommendedServerInfo = getExtenderRecommendation(project); - if (recommendedServerInfo!=null) - { - if (recommendedServerInfo.getServerFactoryId()!=null && recommendedServerInfo.getServerFactoryId().length()>0) - serverInfo[0] = recommendedServerInfo.getServerFactoryId(); - - if (recommendedServerInfo.getServerInstanceId()!=null && recommendedServerInfo.getServerInstanceId().length()>0) - serverInfo[1] = recommendedServerInfo.getServerInstanceId(); - - return serverInfo; - } - } - - //Use ServerTargetHelper to get a list of valid runtime-targets and use these to determine a default server type. - String[] projectAttrs = ServerTargetHelper.getProjectTypeAndJ2EELevel(project); - List runtimes = ServerTargetHelper.getServerTargets(projectAttrs[0], projectAttrs[1]); - List suppRuntimes = getRuntimeTargetsSupportedByWSRuntime(runtimes, runtimeId); - String[] compatServerInfo = getCompatibleExistingServer(suppRuntimes,typeId); - if ( compatServerInfo != null) - { - return compatServerInfo; - } - - //No existing compatible server, pick a type. - String factoryId = getFirstSupportedServerType(suppRuntimes, typeId); - if (factoryId != null) serverInfo[0] = factoryId; - return serverInfo; - - } - - /* - * Given a list of existing servers, this returns the first one that is supported - * by the given Web service type id. - * Returns null of there are no supported servers in the array. - */ - public static IServer getFirstSupportedServer(IServer[] servers, String typeId) - { - WebServiceClientTypeRegistry wsctRegistry = WebServiceClientTypeRegistry.getInstance(); - if (servers != null && servers.length > 0) { - for (int i = 0; i < servers.length; i++) - { - String serverFactoryId = servers[i].getServerType().getId(); - if (wsctRegistry.isServerSupportedForChosenType(typeId, serverFactoryId)) - { - return servers[i]; - } - } - } - return null; - } - - /* - * Returns the factory id of a server type compatible with the Web service type and the runtime target. - * Returns null if there are none. - */ - public static String getFirstSupportedServerType(IRuntime runtimeTarget, String typeId) - { - String runtimeId = runtimeTarget.getRuntimeType().getId(); - WebServiceClientTypeRegistry wsctRegistry = WebServiceClientTypeRegistry.getInstance(); - String[] serverFactoryIds = wsctRegistry.getServerFactoryIdsByType(typeId); - - for (int i=0; i<serverFactoryIds.length; i++) - { - IServerType serverType = ServerCore.findServerType(serverFactoryIds[i]); - if (serverType!=null ){ - String serverRuntimeId = serverType.getRuntimeType().getId(); - if (serverRuntimeId.equals(runtimeId)) - { - return serverFactoryIds[i]; - } - } - } - return null; - } - - /* - * Return the factory id of the first server type compatible with the runtimeTargets and typeId. - * Returns null if there are none. - */ - public static String getFirstSupportedServerType(List runtimeTargets, String typeId) - { - for (int i=0; i<runtimeTargets.size(); i++ ) - { - IRuntime runtimeTarget = (IRuntime)runtimeTargets.get(i); - String factoryId = getFirstSupportedServerType(runtimeTarget, typeId); - if (factoryId != null && factoryId.length()>0) - return factoryId; - } - - return null; - } - - public static IRuntime getRuntimeTarget(String projectName) - { - if( projectName != null && projectName.length() > 0 ){ //$NON-NLS-1$ - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - if( project != null && project.exists() ){ - return ServerCore.getProjectProperties(project).getRuntimeTarget(); - } - } - return null; - } - - public static IServer[] getCompatibleExistingServers(IRuntime runtime) - { - if (runtime == null) - return null; - - IServer[] servers = ServerCore.getServers(); - if (servers==null || servers.length!=0) - return null; - - ArrayList compatibleServersList = new ArrayList(); - String runtimeId = runtime.getRuntimeType().getId(); - for (int i=0; i<servers.length; i++) - { - IServer server = (IServer)servers[i]; - String serverRuntimeId = server.getRuntime().getRuntimeType().getId(); - if (serverRuntimeId.equals(runtimeId)) - compatibleServersList.add(server); - - } - if (compatibleServersList.size()<1) - return null; - - - Object[] compatibleServersArray = compatibleServersList.toArray(); - IServer[] compatibleServers = new IServer[compatibleServersArray.length]; - for (int j=0; j<compatibleServersArray.length; j++) - { - compatibleServers[j] = (IServer)compatibleServersArray[j]; - } - - return compatibleServers; - } - /* - * Returns the factory Id and instance id of the first exiting server compatible - * with the runtime targets and typeId - * Returns null if there are none. - * The item at [0] is the factory id. - * The item at [1] is the instance id. - */ - public static String[] getCompatibleExistingServer(List runtimeTargets, String typeId) - { - String[] serverInfo = new String[2]; - for (int i=0; i<runtimeTargets.size(); i++ ) - { - IRuntime runtimeTarget = (IRuntime)runtimeTargets.get(i); - IServer[] existingCompatServers = getCompatibleExistingServers(runtimeTarget); - IServer compatServer = getFirstSupportedServer(existingCompatServers, typeId); - if (compatServer != null) - { - serverInfo[0] = compatServer.getServerType().getId(); - serverInfo[1] = compatServer.getId(); - return serverInfo; - } - } - return null; - } - - public static ServerInfo getExtenderRecommendation(IProject project) - { - try - { - IExtensionRegistry reg = Platform.getExtensionRegistry(); - IConfigurationElement[] elements = reg.getConfigurationElementsFor("org.eclipse.jst.ws.consumption", "serverDefaulter"); - for (int i=0; i<elements.length; i++) - { - Object serverDefaulterObject = elements[i].createExecutableExtension("class"); - if (serverDefaulterObject instanceof IServerDefaulter) - { - IServerDefaulter serverDefaulter = (IServerDefaulter)serverDefaulterObject; - ServerInfo serverInfo = serverDefaulter.recommendDefaultServer(project); - if (serverInfo != null) - return serverInfo; - } - - } - } catch (CoreException ce) - { - return null; - } - - return null; - } - - private static List getRuntimeTargetsSupportedByWSRuntime(List runtimeTargets, String webServiceRuntimeId) - { - ArrayList suppRuntimeTargets = new ArrayList(); - WebServiceClientTypeRegistry wsctReg = WebServiceClientTypeRegistry.getInstance(); - for (int i=0; i<runtimeTargets.size(); i++) - { - IRuntime runtimeTarget = (IRuntime)runtimeTargets.get(i); - String rtId = runtimeTarget.getRuntimeType().getId(); - if (wsctReg.doesRuntimeSupportServerTarget(rtId, webServiceRuntimeId)) - { - suppRuntimeTargets.add(runtimeTarget); - } - } - return suppRuntimeTargets; - } - - /** - * Use this method to get a server factory id and instance id that is compatible with the given Web - * service runtime. - * @param clientRuntimeId - * @param j2eeVersion String representation of the int values in J2EEVersionConstants i.e. "12", "13", "14" - * @return String[] index [0] contains factoryId, index[1] contains instance Id. - */ - public static String[] getServerFromClientRuntimeAndJ2EE(String clientRuntimeId, String j2eeVersion) - { - String[] serverInfo = new String[2]; - WebServiceClientTypeRegistry wsctReg = WebServiceClientTypeRegistry.getInstance(); - - //Get all possible valid servers. If there are none, we can't default intelligently, return null. - String[] validServerFactoryIds = wsctReg.getServerFactoryIdsByRuntimeId(clientRuntimeId); - if (validServerFactoryIds==null || validServerFactoryIds.length<1) - return null; - - //Get all existing servers - IServer[] servers = ServerCore.getServers(); //Get all existing servers - - //Get the preferred server. - PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext(); - String prefServerFactoryId = context.getServerFactoryId(); - - boolean preferredIsValid = containsString(validServerFactoryIds, prefServerFactoryId) - && isServerValid(prefServerFactoryId, j2eeVersion); - if (preferredIsValid) - { - for (int i=0; i<servers.length; i++) - { - IServer server = (IServer)servers[i]; - String thisFactoryId = server.getServerType().getId(); - - if (thisFactoryId.equals(prefServerFactoryId)) - { - serverInfo[0] = prefServerFactoryId; - serverInfo[1] = server.getId(); - return serverInfo; - } - } - } - - //Either the preferred server was not valid or it was valid but does not exist. - //Check the existing servers for validity - for (int i=0; i<servers.length; i++) - { - IServer server = (IServer)servers[i]; - String thisFactoryId = server.getServerType().getId(); - - boolean thisServerValid = containsString(validServerFactoryIds, thisFactoryId) - && isServerValid(thisFactoryId, j2eeVersion); - if (thisServerValid) - { - serverInfo[0] = thisFactoryId; - serverInfo[1] = server.getId(); - return serverInfo; - } - } - - //None of the existing servers is valid. Pick the preferred one if valid. Otherwise, pick the - //first valid server type. - if (preferredIsValid) - { - serverInfo[0] = prefServerFactoryId; - return serverInfo; - } - else - { - for (int i=0; i<validServerFactoryIds.length; i++ ) - { - boolean isValid = isServerValid(validServerFactoryIds[i], j2eeVersion); - if (isValid) - { - serverInfo[0] = validServerFactoryIds[0]; - return serverInfo; - } - } - } - - //We can't determine a valid server selection. Return null. - return null; - } - - private static boolean isServerValid(String serverFactoryId, String j2eeVersion) - { - if (serverFactoryId==null || serverFactoryId.length()==0 || j2eeVersion==null || j2eeVersion.length()==0) - return true; - - String runtimeTargetId = ServerUtils.getRuntimeTargetIdFromFactoryId(serverFactoryId); - if (runtimeTargetId == null || runtimeTargetId.length()==0) - return false; - String webModuleType = IServerTargetConstants.WEB_TYPE; - boolean isValid = ServerUtils.isTargetValidForProjectType(runtimeTargetId, j2eeVersion, webModuleType); - return isValid; - } - /* - * Returns true if a contains b, false otherwise. - */ - private static boolean containsString(String[] a, String b) - { - if (a==null || a.length<0 || b == null || b.length()==0 ) - return false; - - for (int i=0; i<a.length; i++) - { - String s = a[i]; - if (s.equals(b)) - { - return true; - } - } - return false; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ServerSelectionUtils.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ServerSelectionUtils.java index 2c14bda5f..26ff13fa3 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ServerSelectionUtils.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ServerSelectionUtils.java @@ -27,7 +27,6 @@ import org.eclipse.jst.ws.internal.consumption.common.IServerDefaulter; import org.eclipse.jst.ws.internal.consumption.common.ServerInfo; 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.wizard.WebServiceServerRuntimeTypeRegistry; import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils; import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeInfo; import org.eclipse.wst.server.core.IRuntime; @@ -251,29 +250,6 @@ public class ServerSelectionUtils return null; } - /* - * Given a list of existing servers, this returns the first one that is supported - * by the given Web service type id. - * Returns null of there are no supported servers in the array. - * @deprecated - */ - /* - public static IServer getFirstSupportedServer(IServer[] servers, String typeId) - { - WebServiceServerRuntimeTypeRegistry wssrtRegistry = WebServiceServerRuntimeTypeRegistry.getInstance(); - if (servers != null && servers.length > 0) { - for (int i = 0; i < servers.length; i++) - { - String serverFactoryId = servers[i].getServerType().getId(); - if (wssrtRegistry.isServerSupportedForChosenType(typeId, serverFactoryId)) - { - return servers[i]; - } - } - } - return null; - } - */ /* * Returns the factory id of a server type compatible with the Web service type and the runtime target. @@ -282,8 +258,6 @@ public class ServerSelectionUtils public static String getFirstSupportedServerType(IRuntime runtimeTarget, String webServiceRuntimeId) { String runtimeId = runtimeTarget.getRuntimeType().getId(); - //WebServiceServerRuntimeTypeRegistry wssrtRegistry = WebServiceServerRuntimeTypeRegistry.getInstance(); - //String[] serverFactoryIds = wssrtRegistry.getServerFactoryIdsByType(typeId); WebServiceRuntimeInfo wsrt = WebServiceRuntimeExtensionUtils.getWebServiceRuntimeById(webServiceRuntimeId); String[] serverFactoryIds = wsrt.getServerFactoryIds(); for (int i=0; i<serverFactoryIds.length; i++) @@ -300,31 +274,6 @@ public class ServerSelectionUtils return null; } - /* - * Returns the factory id of a server type compatible with the Web service type and the runtime target. - * Returns null if there are none. - * @deprecated - */ - /* - public static String getFirstSupportedServerType(IRuntime runtimeTarget, String typeId) - { - String runtimeId = runtimeTarget.getRuntimeType().getId(); - WebServiceServerRuntimeTypeRegistry wssrtRegistry = WebServiceServerRuntimeTypeRegistry.getInstance(); - String[] serverFactoryIds = wssrtRegistry.getServerFactoryIdsByType(typeId); - for (int i=0; i<serverFactoryIds.length; i++) - { - IServerType serverType = ServerCore.findServerType(serverFactoryIds[i]); - if (serverType!=null){ - String serverRuntimeId = serverType.getRuntimeType().getId(); - if (serverRuntimeId.equals(runtimeId)) - { - return serverFactoryIds[i]; - } - } - } - return null; - } - */ /* * Return the factory id of the first server type compatible with the runtimeTargets and webServiceRuntimeId. @@ -506,29 +455,6 @@ public class ServerSelectionUtils } /** - * - * @param runtimeTargets - * @param webServiceRuntimeId - * @return - * @deprecated - */ - private static List getRuntimeTargetsSupportedByWSRuntime(List runtimeTargets, String webServiceRuntimeId) - { - ArrayList suppRuntimeTargets = new ArrayList(); - WebServiceServerRuntimeTypeRegistry wssrtReg = WebServiceServerRuntimeTypeRegistry.getInstance(); - for (int i=0; i<runtimeTargets.size(); i++) - { - IRuntime runtimeTarget = (IRuntime)runtimeTargets.get(i); - String rtId = runtimeTarget.getRuntimeType().getId(); - if (wssrtReg.doesRuntimeSupportServerTarget(rtId, webServiceRuntimeId)); - { - suppRuntimeTargets.add(runtimeTarget); - } - } - return suppRuntimeTargets; - } - - /** * Use this method to get a server factory id and instance id that is compatible with the given Web * service runtime. * @param webServiceRuntimeId @@ -538,10 +464,9 @@ public class ServerSelectionUtils public static String[] getServerFromWebServceRuntimeAndJ2EE(String webServiceRuntimeId, String j2eeVersion) { String[] serverInfo = new String[2]; - //WebServiceServerRuntimeTypeRegistry wssrtReg = WebServiceServerRuntimeTypeRegistry.getInstance(); //Get all possible valid servers. If there are none, we can't default intelligently, return null. - //String[] validServerFactoryIds = wssrtReg.getServerFactoryIDByRuntimeID(webServiceRuntimeId); + WebServiceRuntimeInfo wsrt = WebServiceRuntimeExtensionUtils.getWebServiceRuntimeById(webServiceRuntimeId); String[] validServerFactoryIds = wsrt.getServerFactoryIds(); if (validServerFactoryIds==null || validServerFactoryIds.length<1) diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ValidationUtils.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ValidationUtils.java index 718059ffa..61ab08f89 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ValidationUtils.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ValidationUtils.java @@ -31,11 +31,11 @@ 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.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.jst.ws.internal.consumption.ui.wizard.ClientProjectTypeRegistry; 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.server.core.IRuntime; import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; @@ -175,14 +175,30 @@ public class ValidationUtils } + private String getClientTypeLabel( String type ) - { - ClientProjectTypeRegistry registry = ClientProjectTypeRegistry.getInstance(); - String clientTypeLabel = null; - - clientTypeLabel = registry.getElementById(type).getAttribute("label"); - - return clientTypeLabel; + { + if (type.equals(IModuleConstants.JST_WEB_MODULE)) + { + return msgUtils.getMessage("LABEL_CLIENT_COMP_TYPE_WEB"); + } + else if (type.equals(IModuleConstants.JST_EJB_MODULE)) + { + return msgUtils.getMessage("LABEL_CLIENT_COMP_TYPE_EJB"); + } + else if (type.equals(IModuleConstants.JST_APPCLIENT_MODULE)) + { + return msgUtils.getMessage("LABEL_CLIENT_COMP_TYPE_APP_CLIENT"); + } + else if (type.equals(IModuleConstants.JST_UTILITY_MODULE)) + { + return msgUtils.getMessage("LABEL_CLIENT_COMP_TYPE_CONTAINERLESS"); + } + else + { + //No known label, return the typeId itself. + return type; + } } /** diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientAssembleCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientAssembleCommand.java index 15e2af38f..663663549 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientAssembleCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientAssembleCommand.java @@ -11,15 +11,19 @@ package org.eclipse.jst.ws.internal.consumption.ui.extension; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jst.ws.internal.common.EnvironmentUtils; import org.eclipse.jst.ws.internal.consumption.command.common.AssociateModuleWithEARCommand; import org.eclipse.jst.ws.internal.consumption.command.common.CreateModuleCommand; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; 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.ws.internal.provisional.wsrt.IWebServiceClient; -public class PreClientAssembleCommand extends SimpleCommand +public class PreClientAssembleCommand extends EnvironmentalOperation { private IWebServiceClient webServiceClient_; private String project_; @@ -28,8 +32,10 @@ public class PreClientAssembleCommand extends SimpleCommand private String ear_; private String j2eeLevel_; - public Status execute(Environment environment) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { + Environment environment = getEnvironment(); + System.out.println("In Pre client assemble command."); // Check if EAR module is req'd, ie. !=null @@ -44,10 +50,11 @@ public class PreClientAssembleCommand extends SimpleCommand command.setServerFactoryId(webServiceClient_.getWebServiceClientInfo().getServerFactoryId()); command.setServerInstanceId( webServiceClient_.getWebServiceClientInfo().getServerInstanceId() ); command.setJ2eeLevel(j2eeLevel_); - Status status = command.execute(environment); + command.setEnvironment( environment ); + IStatus status = command.execute( null, null ); if (status.getSeverity()==Status.ERROR) { - environment.getStatusHandler().reportError(status); + environment.getStatusHandler().reportError( EnvironmentUtils.convertIStatusToStatus(status)); return status; } @@ -58,10 +65,11 @@ public class PreClientAssembleCommand extends SimpleCommand associateCommand.setModule(module_); associateCommand.setEARProject(earProject_); associateCommand.setEar(ear_); - status = associateCommand.execute(environment); + associateCommand.setEnvironment( environment ); + status = associateCommand.execute( null, null ); if (status.getSeverity()==Status.ERROR) { - environment.getStatusHandler().reportError(status); + environment.getStatusHandler().reportError( EnvironmentUtils.convertIStatusToStatus(status)); } return status; diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientDeployCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientDeployCommand.java index 9ed91ca8a..cc690217b 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientDeployCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientDeployCommand.java @@ -11,16 +11,16 @@ package org.eclipse.jst.ws.internal.consumption.ui.extension; -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.Status; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; -public class PreClientDeployCommand extends SimpleCommand +public class PreClientDeployCommand extends EnvironmentalOperation { - public Status execute(Environment environment) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { - System.out.println( "In Pre client deploy command." ); - - return super.execute(environment); + return Status.OK_STATUS; } } 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 e4eac74f3..7e6113ff1 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 @@ -11,10 +11,14 @@ package org.eclipse.jst.ws.internal.consumption.ui.extension; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jst.ws.internal.common.EnvironmentUtils; 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.data.TypeRuntimeServer; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; import org.eclipse.wst.command.internal.provisional.env.core.common.Status; import org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext; @@ -29,7 +33,7 @@ import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceScenario; import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceState; import org.eclipse.wst.ws.internal.wsrt.SimpleContext; -public class PreClientDevelopCommand extends SimpleCommand +public class PreClientDevelopCommand extends EnvironmentalOperation { /* private String ID_WEB = "org.eclipse.jst.ws.consumption.ui.clientProjectType.Web"; @@ -54,8 +58,10 @@ public class PreClientDevelopCommand extends SimpleCommand private String wsdlURI_; private Object dataObject_; - public Status execute(Environment environment) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { + Environment environment = getEnvironment(); + // Split up the project and module int index = module_.indexOf("/"); if (index!=-1){ @@ -103,7 +109,8 @@ public class PreClientDevelopCommand extends SimpleCommand command.setModuleType(intModuleType); command.setServerFactoryId(typeRuntimeServer_.getServerId()); command.setJ2eeLevel(j2eeLevel_); - Status status = command.execute(environment); + command.setEnvironment( environment ); + IStatus status = command.execute( null, null ); // rsk todo -- once the clientProjectType extension is gone, determination // of what type of module to create will have to be done. @@ -116,7 +123,7 @@ public class PreClientDevelopCommand extends SimpleCommand if (status.getSeverity() == Status.ERROR) { - environment.getStatusHandler().reportError(status); + environment.getStatusHandler().reportError(EnvironmentUtils.convertIStatusToStatus(status)); } return status; } @@ -165,11 +172,6 @@ public class PreClientDevelopCommand extends SimpleCommand return webServiceClient_; } - public Environment getEnvironment() - { - return environment_; - } - public IContext getContext() { return context_; diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientInstallCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientInstallCommand.java index 22c9e07a7..efe5dd9f4 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientInstallCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientInstallCommand.java @@ -11,14 +11,18 @@ package org.eclipse.jst.ws.internal.consumption.ui.extension; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jst.ws.internal.common.EnvironmentUtils; import org.eclipse.jst.ws.internal.consumption.command.common.AddModuleToServerCommand; import org.eclipse.jst.ws.internal.consumption.command.common.CreateServerCommand; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; import org.eclipse.wst.command.internal.provisional.env.core.common.Status; import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceClient; -public class PreClientInstallCommand extends SimpleCommand +public class PreClientInstallCommand extends EnvironmentalOperation { private IWebServiceClient webServiceClient_; private String project_; @@ -26,13 +30,16 @@ public class PreClientInstallCommand extends SimpleCommand private String earProject_; private String ear_; - public Status execute(Environment environment) - { + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) + { + Environment environment = getEnvironment(); + if (webServiceClient_.getWebServiceClientInfo().getServerInstanceId()==null) { CreateServerCommand createServerCommand = new CreateServerCommand(); createServerCommand.setServerFactoryid(webServiceClient_.getWebServiceClientInfo().getServerFactoryId()); - Status createServerStatus = createServerCommand.execute(environment); + createServerCommand.setEnvironment( environment ); + IStatus createServerStatus = createServerCommand.execute(null, null); if (createServerStatus.getSeverity()==Status.OK) { webServiceClient_.getWebServiceClientInfo().setServerInstanceId(createServerCommand.getServerInstanceId()); @@ -41,7 +48,7 @@ public class PreClientInstallCommand extends SimpleCommand { if (createServerStatus.getSeverity()==Status.ERROR) { - environment.getStatusHandler().reportError(createServerStatus); + environment.getStatusHandler().reportError(EnvironmentUtils.convertIStatusToStatus(createServerStatus)); } return createServerStatus; } @@ -62,10 +69,11 @@ public class PreClientInstallCommand extends SimpleCommand command.setModule(module_); } - Status status = command.execute(environment); + command.setEnvironment( environment ); + IStatus status = command.execute( null, null ); if (status.getSeverity()==Status.ERROR) { - environment.getStatusHandler().reportError(status); + environment.getStatusHandler().reportError( EnvironmentUtils.convertIStatusToStatus(status)); } return status; } diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientRunCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientRunCommand.java index 70ae56994..cf4067f88 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientRunCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientRunCommand.java @@ -11,25 +11,32 @@ package org.eclipse.jst.ws.internal.consumption.ui.extension; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jst.ws.internal.common.EnvironmentUtils; import org.eclipse.jst.ws.internal.consumption.command.common.StartServerCommand; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; import org.eclipse.wst.command.internal.provisional.env.core.common.Status; import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceClient; -public class PreClientRunCommand extends SimpleCommand +public class PreClientRunCommand extends EnvironmentalOperation { private IWebServiceClient webServiceClient_; - public Status execute(Environment environment) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { + Environment environment = getEnvironment(); + System.out.println("In Pre client run command."); StartServerCommand command = new StartServerCommand(); command.setServerInstanceId(webServiceClient_.getWebServiceClientInfo().getServerInstanceId()); - Status status = command.execute(environment); + command.setEnvironment( environment ); + IStatus status = command.execute( null, null ); if (status.getSeverity()==Status.ERROR) { - environment.getStatusHandler().reportError(status); + environment.getStatusHandler().reportError( EnvironmentUtils.convertIStatusToStatus(status)); } return status; } diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/server/StartServerWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/server/StartServerWidget.java index e339a22bc..74e850ebc 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/server/StartServerWidget.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/server/StartServerWidget.java @@ -19,6 +19,7 @@ import org.eclipse.core.runtime.jobs.IJobManager; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.core.runtime.jobs.JobChangeAdapter; import org.eclipse.jface.wizard.ProgressMonitorPart; +import org.eclipse.jst.ws.internal.common.EnvironmentUtils; import org.eclipse.jst.ws.internal.consumption.command.common.StartServerCommand; import org.eclipse.jst.ws.internal.ui.common.UIUtils; import org.eclipse.swt.SWT; @@ -299,10 +300,11 @@ public class StartServerWidget extends SimpleWidgetDataContributor StartServerCommand serverCommand = new StartServerCommand( false, false ); serverCommand.setServerInstanceId( server_.getId() ); + serverCommand.setEnvironment( environment ); try { - setStatus( serverCommand.execute( environment ) ); + setStatus( EnvironmentUtils.convertIStatusToStatus(serverCommand.execute( null, null ) ) ); } catch( Throwable exc ) { diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/AbstractHandlersWidgetDefaultingCmd.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/AbstractHandlersWidgetDefaultingCmd.java index fa328a13e..16576c229 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/AbstractHandlersWidgetDefaultingCmd.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/AbstractHandlersWidgetDefaultingCmd.java @@ -11,14 +11,16 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets; import java.util.List; - import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; 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; @@ -30,13 +32,14 @@ import org.eclipse.wst.command.internal.provisional.env.core.common.Status; * * Initialize and load the handlers data */ -public abstract class AbstractHandlersWidgetDefaultingCmd extends SimpleCommand { +public abstract class AbstractHandlersWidgetDefaultingCmd extends EnvironmentalOperation +{ private IStructuredSelection initialSelection_; - private IProject project_; - private String componentName_; - public Status execute(Environment env){ + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) + { + Environment env = getEnvironment(); String pluginId = "org.eclipse.jst.ws.consumption.ui"; MessageUtils msgUtils_ = new MessageUtils( pluginId + ".plugin", this ); Status status = new SimpleStatus(""); diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/CheckWSDLValidationCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/CheckWSDLValidationCommand.java index ec04608e6..d4ffbc13d 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/CheckWSDLValidationCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/CheckWSDLValidationCommand.java @@ -10,43 +10,35 @@ *******************************************************************************/ package org.eclipse.jst.ws.internal.consumption.ui.widgets; -import java.util.Map; - -import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.jobs.IJobManager; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.ValidateWSDLJob; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.common.Choice; 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.ws.internal.parser.discovery.WebServicesParserExt; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; import org.eclipse.wst.ws.internal.plugin.WSPlugin; import org.eclipse.wst.ws.internal.ui.plugin.WSUIPlugin; -import org.eclipse.wst.ws.internal.ui.wsi.preferences.PersistentWSIContext; - -public class CheckWSDLValidationCommand extends SimpleCommand -{ - private String LABEL = "TASK_LABEL_CHECK_WSDL_VALIDATION"; - private String DESCRIPTION = "TASK_DESC_CHECK_WSDL_VALIDATION"; - +public class CheckWSDLValidationCommand extends EnvironmentalOperation +{ private static MessageUtils msgUtils_; public CheckWSDLValidationCommand () { String pluginId = "org.eclipse.jst.ws.consumption.ui"; - msgUtils_ = new MessageUtils( pluginId + ".plugin", this ); - setName (msgUtils_.getMessage(LABEL)); - setDescription( msgUtils_.getMessage(DESCRIPTION)); + msgUtils_ = new MessageUtils( pluginId + ".plugin", this ); } - public Status execute(Environment env) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { + Environment env = getEnvironment(); IJobManager jobManager = Platform.getJobManager(); Job[] jobs = jobManager.find( ValidateWSDLJob.VALIDATE_WSDL_JOB_FAMILY ); diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetDefaultingCommand.java index de439aa69..99f792b9e 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetDefaultingCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetDefaultingCommand.java @@ -15,9 +15,11 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.util.Vector; - import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jem.util.emf.workbench.ProjectUtilities; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jst.j2ee.internal.webservice.WebServiceNavigatorGroupType; @@ -49,10 +51,6 @@ public class ClientHandlersWidgetDefaultingCommand extends AbstractHandlersWidge private MessageUtils msgUtils_; - private boolean isGenSkeletonEnabled_; - - private IPath sourceOutputLocation_; - private Hashtable wsRefsToHandlersTable_; private Hashtable refNameToServiceRefObj_; @@ -71,7 +69,9 @@ public class ClientHandlersWidgetDefaultingCommand extends AbstractHandlersWidge private Collection wsServiceRefs_; - public Status execute(Environment env) { + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) + { + Environment env = getEnvironment(); String pluginId = "org.eclipse.jst.ws.consumption.ui"; MessageUtils msgUtils_ = new MessageUtils(pluginId + ".plugin", this); Status status = new SimpleStatus(""); diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetOutputCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetOutputCommand.java index 23ff55a37..f19150b55 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetOutputCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetOutputCommand.java @@ -13,25 +13,23 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets; import java.util.ArrayList; import java.util.Collection; import java.util.Enumeration; -import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import java.util.List; - import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jem.internal.plugin.JavaEMFNature; import org.eclipse.jem.java.JavaClass; import org.eclipse.jem.java.impl.JavaClassImpl; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; import org.eclipse.jst.j2ee.webservice.wsclient.Handler; import org.eclipse.jst.j2ee.webservice.wsclient.ServiceRef; import org.eclipse.jst.j2ee.webservice.wsclient.WebServicesResource; import org.eclipse.jst.j2ee.webservice.wsclient.Webservice_clientFactory; import org.eclipse.jst.j2ee.webservice.wsclient.internal.impl.Webservice_clientFactoryImpl; -import org.eclipse.jst.ws.internal.common.J2EEUtils; import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.HandlerTableItem; -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.EnvironmentalOperation; 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; @@ -42,7 +40,8 @@ import org.eclipse.wst.common.internal.emfworkbench.integration.EditModel; * Provide a way to externalize the edited fields and create new handlers * */ -public class ClientHandlersWidgetOutputCommand extends SimpleCommand { +public class ClientHandlersWidgetOutputCommand extends EnvironmentalOperation +{ //private List handlerTableItems_; private Hashtable oldWSServiceRefsToHandlersTable_; @@ -55,15 +54,14 @@ public class ClientHandlersWidgetOutputCommand extends SimpleCommand { private IProject project_; - private WebServicesResource wsClientRes_; - private Collection wsServiceRefs_; private EditModel editModel_; private Object accessorKey_; - public Status execute(Environment env) { + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) + { String pluginId = "org.eclipse.jst.ws.consumption.ui"; MessageUtils msgUtils_ = new MessageUtils(pluginId + ".plugin", this); Status status = new SimpleStatus(""); @@ -153,7 +151,6 @@ public class ClientHandlersWidgetOutputCommand extends SimpleCommand { private void addHandlersToServiceRefs() { try { - int key = 0; Enumeration refsToHandlers = newWSServiceRefsToHandlersTable_.keys(); while (refsToHandlers.hasMoreElements()) { ServiceRef serviceRef = (ServiceRef) refsToHandlers.nextElement(); @@ -195,7 +192,6 @@ public class ClientHandlersWidgetOutputCommand extends SimpleCommand { } public void setWsClientResource(WebServicesResource wsRes) { - this.wsClientRes_ = wsRes; } public void setWsServiceRefs(Collection wsRefs) { 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 3129a7ea0..b17c2ea51 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 @@ -14,11 +14,11 @@ import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensio import org.eclipse.jst.ws.internal.context.ScenarioContext; import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; import org.eclipse.jst.ws.internal.plugin.WebServicePlugin; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext; -public class ClientWizardWidgetDefaultingCommand extends SimpleCommand +public class ClientWizardWidgetDefaultingCommand extends EnvironmentalOperation { public Boolean getTestService() { diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidgetOutputCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidgetOutputCommand.java index 69436a0ea..5bf20580f 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidgetOutputCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidgetOutputCommand.java @@ -11,11 +11,11 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets; 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.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext; -public class ClientWizardWidgetOutputCommand extends SimpleCommand +public class ClientWizardWidgetOutputCommand extends EnvironmentalOperation { private boolean testService_; private boolean monitorService; diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ConfigServiceHandlersTableWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ConfigServiceHandlersTableWidget.java index 78a6343f2..dd749b210 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ConfigServiceHandlersTableWidget.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ConfigServiceHandlersTableWidget.java @@ -63,7 +63,6 @@ public class ConfigServiceHandlersTableWidget extends SimpleWidgetDataContributo private String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; private MessageUtils msgUtils_ = null; - private Listener statusListener_; private Composite parent_; private boolean isGenSkeletonEnabled_; private String outputLocation_; @@ -75,9 +74,6 @@ public class ConfigServiceHandlersTableWidget extends SimpleWidgetDataContributo private Button removeButton_; private Button genSkeletonRadioButton_; private Combo sourceLocationCombo_; - private Text text_; // selected Text - - private HandlerTableItem[] handlers; private Hashtable pathsTable_ = new Hashtable(); private Hashtable wsDescToHandlers_; private Hashtable wsDescToPorts_; @@ -116,11 +112,10 @@ public class ConfigServiceHandlersTableWidget extends SimpleWidgetDataContributo UIUtils uiUtils = new UIUtils(msgUtils_, pluginId_); parent_ = parent; - statusListener_ = statusListener; // Web service reference combo Composite webServiceRefComp = uiUtils.createComposite(parent_, 2); - webServiceDescCombo_ = uiUtils.createCombo(webServiceRefComp, "LABEL_COMBO_WS_SERVICE_DESC", TOOLTIP_WS_SERVICE_DESC, TOOLTIP_WS_SERVICE_DESC, + webServiceDescCombo_ = uiUtils.createCombo(webServiceRefComp, "LABEL_COMBO_WS_SERVICE_DESC", TOOLTIP_WS_SERVICE_DESC, INFOPOP_WS_SERVICE_DESC, SWT.READ_ONLY); webServiceDescCombo_.addSelectionListener(new SelectionAdapter() { @@ -278,7 +273,6 @@ public class ConfigServiceHandlersTableWidget extends SimpleWidgetDataContributo try { int sizeOfHandlers = wsDescToHandlers_.size(); - String[] wsRefs = new String[sizeOfHandlers]; String[] wsRefNames = (String[]) wsDescToHandlers_.keySet().toArray(new String[0]); webServiceDescCombo_.setItems(wsRefNames); @@ -330,7 +324,6 @@ public class ConfigServiceHandlersTableWidget extends SimpleWidgetDataContributo * The handlers to set. */ public void setHandlers(HandlerTableItem[] handlers) { - this.handlers = handlers; populateHandlersTable(); } @@ -402,7 +395,6 @@ public class ConfigServiceHandlersTableWidget extends SimpleWidgetDataContributo private void handleMoveUpButtonSelected(SelectionEvent event) { int index = tableViewer_.getTable().getSelectionIndex(); - ISelection selected = tableViewer_.getSelection(); if (index != -1) { if (index > 0) { orderedHandlers_ = (Vector) wsDescToHandlers_.get(webServiceDescCombo_.getText()); @@ -417,7 +409,6 @@ public class ConfigServiceHandlersTableWidget extends SimpleWidgetDataContributo private void handleMoveDownButtonSelected(SelectionEvent event) { int index = tableViewer_.getTable().getSelectionIndex(); - ISelection selected = tableViewer_.getSelection(); if (index != -1) { if (index < orderedHandlers_.size() - 1) { orderedHandlers_ = (Vector) wsDescToHandlers_.get(webServiceDescCombo_.getText()); @@ -513,7 +504,6 @@ public class ConfigServiceHandlersTableWidget extends SimpleWidgetDataContributo ISelection selection = tableViewer_.getSelection(); if (selection != null && !selection.isEmpty() && (selection instanceof IStructuredSelection)) { int selectionIndex = handlersTable_.getSelectionIndex(); - int selectionCount = handlersTable_.getItemCount(); orderedHandlers_ = (Vector) wsDescToHandlers_.get(webServiceDescCombo_.getText()); orderedHandlers_.remove(selectionIndex); @@ -594,8 +584,6 @@ public class ConfigServiceHandlersTableWidget extends SimpleWidgetDataContributo try { if (wsDescToHandlersArray != null) { - int sizeOfHandlers = wsDescToHandlersArray.size(); - String[] wsRefs = new String[sizeOfHandlers]; // store the wsRefs Enumeration wsDesc = wsDescToHandlersArray.keys(); while (wsDesc.hasMoreElements()) { diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/HandlersDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/HandlersDefaultingCommand.java index 870ba7988..d1c36e6c2 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/HandlersDefaultingCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/HandlersDefaultingCommand.java @@ -10,13 +10,15 @@ *******************************************************************************/ package org.eclipse.jst.ws.internal.consumption.ui.widgets; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jst.j2ee.internal.webservice.WebServiceNavigatorGroupType; 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.wsdl.Service; /** @@ -24,14 +26,14 @@ import org.eclipse.wst.wsdl.Service; * * Determine if Handlers belongs to service or client side */ -public class HandlersDefaultingCommand extends AbstractHandlersWidgetDefaultingCmd { - - private MessageUtils msgUtils_; - +public class HandlersDefaultingCommand extends AbstractHandlersWidgetDefaultingCmd +{ private boolean isClientHandler_ = false; private boolean isServiceHandler_ = false; - public Status execute(Environment env) { + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) + { + Environment env = getEnvironment(); String pluginId = "org.eclipse.jst.ws.consumption.ui"; MessageUtils msgUtils_ = new MessageUtils(pluginId + ".plugin", this); Status status = new SimpleStatus(""); @@ -42,7 +44,6 @@ public class HandlersDefaultingCommand extends AbstractHandlersWidgetDefaultingC if (obj instanceof WebServiceNavigatorGroupType) { WebServiceNavigatorGroupType wsngt = (WebServiceNavigatorGroupType) obj; - Service service = (Service)wsngt.getWsdlService(); if (wsngt.getWsdlService()!=null){ isServiceHandler_ = true; } diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/PublishToPrivateUDDICommandFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/PublishToPrivateUDDICommandFragment.java index 27dfbe0c9..7312ef8a2 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/PublishToPrivateUDDICommandFragment.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/PublishToPrivateUDDICommandFragment.java @@ -16,7 +16,6 @@ import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment; import org.eclipse.wst.command.internal.env.ui.widgets.CanFinishRegistry; import org.eclipse.wst.command.internal.env.ui.widgets.CommandWidgetBinding; import org.eclipse.wst.command.internal.env.ui.widgets.WidgetRegistry; -import org.eclipse.wst.command.internal.provisional.env.core.CommandFactory; import org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry; @@ -30,7 +29,7 @@ public class PublishToPrivateUDDICommandFragment extends AbstractCommandFragment public PublishToPrivateUDDICommandFragment() { - super((CommandFactory)null, ""); + super(null, ""); privateUDDIBinding = PrivateUDDIRegistryTypeRegistry.getInstance().getPrivateUDDIRegistryType().getBinding(); } diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ServiceHandlersWidgetDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ServiceHandlersWidgetDefaultingCommand.java index 575027539..8bdbd01ce 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ServiceHandlersWidgetDefaultingCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ServiceHandlersWidgetDefaultingCommand.java @@ -15,7 +15,10 @@ import java.util.List; import java.util.Vector; import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jem.util.emf.workbench.ProjectUtilities; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jst.j2ee.internal.webservice.WebServiceNavigatorGroupType; @@ -44,8 +47,6 @@ public class ServiceHandlersWidgetDefaultingCommand extends AbstractHandlersWidg private HandlerTableItem[] handlers_; private MessageUtils msgUtils_; - private boolean isGenSkeletonEnabled_; - private IPath sourceOutputLocation_; private WebServiceDescription wsDescription_; private WsddResource wsddResource_; private WebServicesManager webServicesManager_; @@ -54,7 +55,9 @@ public class ServiceHandlersWidgetDefaultingCommand extends AbstractHandlersWidg private Hashtable serviceDescNameToDescObj_; private String descriptionName_ = null; - public Status execute(Environment env) { + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) + { + Environment env = getEnvironment(); String pluginId = "org.eclipse.jst.ws.consumption.ui"; msgUtils_ = new MessageUtils(pluginId + ".plugin", this); Status status = new SimpleStatus(""); diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ServiceHandlersWidgetOutputCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ServiceHandlersWidgetOutputCommand.java index 6f60683ff..dec976ff9 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ServiceHandlersWidgetOutputCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ServiceHandlersWidgetOutputCommand.java @@ -15,7 +15,9 @@ import java.util.Enumeration; import java.util.HashMap; import java.util.Hashtable; import java.util.List; - +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jst.j2ee.webservice.wsdd.Handler; import org.eclipse.jst.j2ee.webservice.wsdd.PortComponent; import org.eclipse.jst.j2ee.webservice.wsdd.WebServiceDescription; @@ -23,8 +25,7 @@ import org.eclipse.jst.j2ee.webservice.wsdd.WsddFactory; import org.eclipse.jst.j2ee.webservice.wsdd.WsddResource; import org.eclipse.jst.j2ee.webservice.wsdd.internal.impl.WsddFactoryImpl; import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.HandlerTableItem; -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.EnvironmentalOperation; 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.common.internal.emf.utilities.EtoolsCopyUtility; @@ -33,16 +34,15 @@ import org.eclipse.wst.common.internal.emf.utilities.EtoolsCopyUtility; * Provide a way to externalize the edited fields and create new handlers * */ -public class ServiceHandlersWidgetOutputCommand extends SimpleCommand { +public class ServiceHandlersWidgetOutputCommand extends EnvironmentalOperation +{ - private List handlerTableItems; - private WebServiceDescription wsDescription_; private WsddResource wsddResource_; private Hashtable wsDescToHandlers_; private Hashtable serviceDescNameToDescObj_; - public Status execute(Environment env) { - + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) + { Status status = new SimpleStatus(""); try { Enumeration e = wsDescToHandlers_.keys(); @@ -142,7 +142,6 @@ public class ServiceHandlersWidgetOutputCommand extends SimpleCommand { private void removeExistingHandlers(Hashtable portsTable, Hashtable portsToHandlersTable) { try { - int key = 0; Enumeration ports = portsToHandlersTable.keys(); while (ports.hasMoreElements()) { String portName = (String) ports.nextElement(); @@ -181,7 +180,6 @@ public class ServiceHandlersWidgetOutputCommand extends SimpleCommand { private void addHandlersToPorts(Hashtable portsTable, Hashtable portsToHandlersTable) { try { - int key = 0; Enumeration ports = portsToHandlersTable.keys(); while (ports.hasMoreElements()) { String portName = (String) ports.nextElement(); @@ -204,7 +202,6 @@ public class ServiceHandlersWidgetOutputCommand extends SimpleCommand { * The handlerTableItems to set. */ public void setHandlersList(List handlerTableItems) { - this.handlerTableItems = handlerTableItems; } public void setWsDescToHandlers(Hashtable wsDescToHandlers) { diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionConditionCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionConditionCommand.java index 4b501b6e0..4e9af0ff7 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionConditionCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionConditionCommand.java @@ -10,11 +10,13 @@ *******************************************************************************/ package org.eclipse.jst.ws.internal.consumption.ui.widgets; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jst.ws.internal.consumption.ui.wsil.DialogWWWAuthentication; import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.common.Condition; -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; @@ -24,7 +26,7 @@ import org.eclipse.wst.ws.internal.parser.wsil.WebServiceEntity; import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; -public class WSDLSelectionConditionCommand extends SimpleCommand implements Condition +public class WSDLSelectionConditionCommand extends EnvironmentalOperation implements Condition { private String pluginId_; private MessageUtils msgUtils_; @@ -52,7 +54,7 @@ public class WSDLSelectionConditionCommand extends SimpleCommand implements Cond return webServicesParser; } - public Status execute(Environment env) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { needWSDLSelectionTreeWidget = false; WebServicesParser parser = getWebServicesParser(); diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionOutputCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionOutputCommand.java index df255bfb7..981339abf 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionOutputCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionOutputCommand.java @@ -11,9 +11,11 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets; import java.util.Map; - import org.eclipse.core.resources.IProject; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; 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; @@ -22,7 +24,7 @@ import org.eclipse.wst.ws.internal.parser.discovery.WebServicesParserExt; import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; -public class WSDLSelectionOutputCommand extends SimpleCommand +public class WSDLSelectionOutputCommand extends EnvironmentalOperation { private WebServicesParser webServicesParser; private String wsdlURI; @@ -99,8 +101,10 @@ public class WSDLSelectionOutputCommand extends SimpleCommand this.webServicesParser = webServicesParser; } - public Status execute(Environment env) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { + Environment env = getEnvironment(); + MessageUtils msgUtils = new MessageUtils("org.eclipse.jst.ws.consumption.ui.plugin", this); if (wsdlURI != null && getWebServicesParser().getWSDLDefinition(wsdlURI) != null) { Status status = new SimpleStatus(""); diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetDefaultingCommand.java index 96dc1d544..33ae953e6 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetDefaultingCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetDefaultingCommand.java @@ -18,12 +18,12 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jst.j2ee.webservice.wsclient.ServiceRef; import org.eclipse.jst.ws.internal.common.J2EEActionAdapterFactory; import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; import org.eclipse.wst.wsdl.internal.impl.ServiceImpl; import org.eclipse.wst.wsdl.util.WSDLResourceImpl; -public class WSDLSelectionWidgetDefaultingCommand extends SimpleCommand +public class WSDLSelectionWidgetDefaultingCommand extends EnvironmentalOperation { private IStructuredSelection selection_; 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 5fa3997ba..83941f9ce 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 @@ -10,13 +10,10 @@ *******************************************************************************/ package org.eclipse.jst.ws.internal.consumption.ui.widgets.binding; -import org.eclipse.jst.ws.internal.common.StringToIProjectTransformer; -import org.eclipse.jst.ws.internal.consumption.command.common.ClientServerDeployableConfigCommand; import org.eclipse.jst.ws.internal.consumption.command.common.GetMonitorCommand; import org.eclipse.jst.ws.internal.consumption.common.ScenarioCleanupCommand; import org.eclipse.jst.ws.internal.consumption.ui.command.CheckForServiceProjectCommand; import org.eclipse.jst.ws.internal.consumption.ui.command.data.EclipseIPath2URLStringTransformer; -import org.eclipse.jst.ws.internal.consumption.ui.command.data.ServerInstToIServerTransformer; import org.eclipse.jst.ws.internal.consumption.ui.common.FinishFragment; import org.eclipse.jst.ws.internal.consumption.ui.extension.ClientRootFragment; import org.eclipse.jst.ws.internal.consumption.ui.extension.PreClientDevelopCommand; @@ -39,7 +36,6 @@ import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.FinishDefaultComm import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.FinishTestFragment; import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.TestDefaultingFragment; import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.WebServiceClientTestArrivalCommand; -import org.eclipse.jst.ws.internal.consumption.ui.wizard.WebServiceClientTypeRegistry; import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment; import org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentFactory; import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; @@ -50,11 +46,7 @@ import org.eclipse.wst.command.internal.env.ui.widgets.SelectionCommand; import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributor; import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributorFactory; import org.eclipse.wst.command.internal.env.ui.widgets.WidgetRegistry; -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.data.DataMappingRegistry; import org.eclipse.wst.ws.internal.extensions.AssembleClientFragment; import org.eclipse.wst.ws.internal.extensions.DeployClientFragment; @@ -64,11 +56,7 @@ import org.eclipse.wst.ws.internal.extensions.RunClientFragment; public class ClientWidgetBinding implements CommandWidgetBinding -{ - private CanFinishRegistry canFinishRegistry_; - private WidgetRegistry widgetRegistry_; - private DataMappingRegistry dataMappingRegistry_; - +{ /* (non-Javadoc) * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#create() */ @@ -88,16 +76,13 @@ public class ClientWidgetBinding implements CommandWidgetBinding */ public void registerCanFinish(CanFinishRegistry canFinishRegistry) { - canFinishRegistry_ = canFinishRegistry; } /* (non-Javadoc) * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerDataMappings(org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry) */ public void registerDataMappings(DataMappingRegistry dataRegistry) - { - dataMappingRegistry_ = dataRegistry; - + { // Before ClientWizardWidget dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "ClientTypeRuntimeServer", ClientWizardWidget.class); dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "TestService", ClientWizardWidget.class ); @@ -176,9 +161,7 @@ public class ClientWidgetBinding implements CommandWidgetBinding { String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; MessageUtils msgUtils = new MessageUtils( pluginId_ + ".plugin", this ); - - widgetRegistry_ = widgetRegistry; - + widgetRegistry.add( "ClientWizardWidget", msgUtils.getMessage("PAGE_TITLE_WS_PROJECT"), msgUtils.getMessage("PAGE_DESC_WS_PROJECT"), @@ -223,23 +206,6 @@ public class ClientWidgetBinding implements CommandWidgetBinding } }); } - - private class InitClientRegistry extends SimpleCommand - { - private WebServiceClientTypeRegistry clientRegistry_ = WebServiceClientTypeRegistry.getInstance(); - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.core.Command#execute(org.eclipse.wst.command.internal.provisional.env.core.common.Environment) - */ - public Status execute(Environment environment) - { - clientRegistry_.setDataMappingRegistry( dataMappingRegistry_ ); - clientRegistry_.setWidgetRegistry( widgetRegistry_ ); - clientRegistry_.setCanFinishRegistry( canFinishRegistry_ ); - - return new SimpleStatus( "" ); - } - } private class ClientRootCommandFragment extends SequenceFragment { @@ -249,7 +215,6 @@ public class ClientWidgetBinding implements CommandWidgetBinding //add( new SimpleFragment( new CheckForMissingFiles(), "" ) ); add( new SimpleFragment( new ClientWizardWidgetDefaultingCommand(), "" ) ); - add( new SimpleFragment( new InitClientRegistry(), "" )); add( new SimpleFragment( "ClientWizardWidget" ) ); //add( new TestCommandFactoryFragment() ); add( new SimpleFragment( new ClientWizardWidgetOutputCommand(), "" )); @@ -328,12 +293,6 @@ public class ClientWidgetBinding implements CommandWidgetBinding dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WebServicesParser", ClientRuntimeSelectionWidgetDefaultingCommand.class); dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WsdlURI", CheckForServiceProjectCommand.class); dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WebServicesParser", CheckForServiceProjectCommand.class); - - //ServerDeployableConfigurationCommand for client - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProject", ClientServerDeployableConfigCommand.class, "SampleProject", new StringToIProjectTransformer()); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientTypeRuntimeServer", ClientServerDeployableConfigCommand.class, "ClientTypeRuntimeServer", null); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientServerInstance", ClientServerDeployableConfigCommand.class,"SampleExistingServer", new ServerInstToIServerTransformer()); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientServer", ClientServerDeployableConfigCommand.class,"SampleServerTypeID", null); // Setup the PreClientDevelopCommand. // @@ -383,12 +342,6 @@ public class ClientWidgetBinding implements CommandWidgetBinding // MAP post server config call dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProjectEAR", ClientExtensionOutputCommand.class, "EarProjectName", null); dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientServerInstance", ClientExtensionOutputCommand.class, "ExistingServerId", null); - dataRegistry.addMapping(ClientServerDeployableConfigCommand.class, "SampleExistingServerInstId", ClientExtensionOutputCommand.class, "ExistingServerId", null); - - - // Map ClientServerDeployableConfigCommand - - dataRegistry.addMapping(ClientServerDeployableConfigCommand.class, "SampleExistingServerInstId", FinishDefaultCommand.class, "ExistingServerId", null); // Map WebServiceClientTestArrivalCommand command. dataRegistry.addMapping(TestDefaultingFragment.class, "TestFacility",ClientTestDelegateCommand.class); diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigClientHandlersWidgetBinding.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigClientHandlersWidgetBinding.java index c72ae8850..6e4b80779 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigClientHandlersWidgetBinding.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigClientHandlersWidgetBinding.java @@ -34,11 +34,9 @@ import org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingReg * Handler Configuration Window - Preferences - Java - Code Generation - Code * and Comments */ -public class ConfigClientHandlersWidgetBinding implements CommandWidgetBinding { +public class ConfigClientHandlersWidgetBinding implements CommandWidgetBinding +{ - private CanFinishRegistry canFinishRegistry_; - private WidgetRegistry widgetRegistry_; - private DataMappingRegistry dataMappingRegistry_; /* * (non-Javadoc) * @@ -48,7 +46,6 @@ public class ConfigClientHandlersWidgetBinding implements CommandWidgetBinding { String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; MessageUtils msgUtils = new MessageUtils(pluginId_ + ".plugin", this); - widgetRegistry_ = widgetRegistry; widgetRegistry.add("ConfigClientHandlersTableWidget", msgUtils.getMessage("PAGE_TITLE_CLIENT_HDLR_CONFIG"), @@ -68,7 +65,6 @@ public class ConfigClientHandlersWidgetBinding implements CommandWidgetBinding { * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerDataMappings(org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry) */ public void registerDataMappings(DataMappingRegistry dataRegistry) { - dataMappingRegistry_ = dataRegistry; // dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"AllHandlers", ConfigClientHandlersTableWidget.class); @@ -97,7 +93,6 @@ public class ConfigClientHandlersWidgetBinding implements CommandWidgetBinding { * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerCanFinish(org.eclipse.wst.command.env.ui.widgets.CanFinishRegistry) */ public void registerCanFinish(CanFinishRegistry canFinishRegistry) { - canFinishRegistry_ = canFinishRegistry; } diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigServiceHandlersWidgetBinding.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigServiceHandlersWidgetBinding.java index a0eebe22a..ecbbc351c 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigServiceHandlersWidgetBinding.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigServiceHandlersWidgetBinding.java @@ -36,9 +36,6 @@ import org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingReg */ public class ConfigServiceHandlersWidgetBinding implements CommandWidgetBinding { - private CanFinishRegistry canFinishRegistry_; - private WidgetRegistry widgetRegistry_; - private DataMappingRegistry dataMappingRegistry_; /* * (non-Javadoc) * @@ -48,7 +45,6 @@ public class ConfigServiceHandlersWidgetBinding implements CommandWidgetBinding String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; MessageUtils msgUtils = new MessageUtils(pluginId_ + ".plugin", this); - widgetRegistry_ = widgetRegistry; widgetRegistry.add("ConfigServiceHandlersTableWidget", msgUtils.getMessage("PAGE_TITLE_SERVICE_HDLR_CONFIG"), @@ -68,7 +64,6 @@ public class ConfigServiceHandlersWidgetBinding implements CommandWidgetBinding * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerDataMappings(org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry) */ public void registerDataMappings(DataMappingRegistry dataRegistry) { - dataMappingRegistry_ = dataRegistry; dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class,"WsRefsToHandlers", ConfigServiceHandlersTableWidget.class); dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class,"GenSkeletonEnabled", ConfigServiceHandlersTableWidget.class); @@ -97,7 +92,6 @@ public class ConfigServiceHandlersWidgetBinding implements CommandWidgetBinding * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerCanFinish(org.eclipse.wst.command.env.ui.widgets.CanFinishRegistry) */ public void registerCanFinish(CanFinishRegistry canFinishRegistry) { - canFinishRegistry_ = canFinishRegistry; } diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigureHandlersWidgetBinding.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigureHandlersWidgetBinding.java index 1a65d9404..ef14da7a8 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigureHandlersWidgetBinding.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigureHandlersWidgetBinding.java @@ -36,11 +36,6 @@ import org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingReg public class ConfigureHandlersWidgetBinding implements CommandWidgetBinding { - private CanFinishRegistry canFinishRegistry_; - - private WidgetRegistry widgetRegistry_; - - private DataMappingRegistry dataMappingRegistry_; public ConfigureHandlersWidgetBinding() { @@ -66,7 +61,6 @@ public class ConfigureHandlersWidgetBinding implements CommandWidgetBinding { * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerCanFinish(org.eclipse.wst.command.env.ui.widgets.CanFinishRegistry) */ public void registerCanFinish(CanFinishRegistry canFinishRegistry) { - canFinishRegistry_ = canFinishRegistry; } /* @@ -75,7 +69,6 @@ public class ConfigureHandlersWidgetBinding implements CommandWidgetBinding { * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerDataMappings(org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry) */ public void registerDataMappings(DataMappingRegistry dataRegistry) { - dataMappingRegistry_ = dataRegistry; // Map client-side widgets to commands dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class, "Handlers", ConfigClientHandlersTableWidget.class, "WsRefsToHandlers", null); @@ -162,7 +155,6 @@ public class ConfigureHandlersWidgetBinding implements CommandWidgetBinding { } public void registerCanFinish(CanFinishRegistry canFinishRegistry) { - canFinishRegistry_ = canFinishRegistry; } } 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 17d920fb4..64f4bd77b 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 @@ -12,7 +12,11 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets.binding; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jst.ws.internal.common.EnvironmentUtils; import org.eclipse.jst.ws.internal.common.ResourceUtils; import org.eclipse.jst.ws.internal.common.StringToIProjectTransformer; import org.eclipse.jst.ws.internal.consumption.command.common.AddModuleToServerCommand; @@ -34,7 +38,6 @@ import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.FinishTestFragmen import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.TestDefaultingFragment; import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.TestWebServiceClient; import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.WebServiceClientTestArrivalCommand; -import org.eclipse.jst.ws.internal.consumption.ui.wizard.WebServiceClientTypeRegistry; import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment; import org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentFactory; @@ -46,7 +49,7 @@ import org.eclipse.wst.command.internal.env.ui.widgets.SelectionCommand; import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributor; import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributorFactory; import org.eclipse.wst.command.internal.env.ui.widgets.WidgetRegistry; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; 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; @@ -54,18 +57,13 @@ 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.command.internal.provisional.env.core.data.DataMappingRegistry; import org.eclipse.wst.command.internal.provisional.env.core.data.Transformer; -import org.eclipse.wst.ws.internal.provisional.wsrt.IContext; import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceClient; import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceClientInfo; import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceState; public class GenSampleWidgetBinding implements CommandWidgetBinding -{ - private CanFinishRegistry canFinishRegistry_; - private WidgetRegistry widgetRegistry_; - private DataMappingRegistry dataMappingRegistry_; - +{ /* (non-Javadoc) * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#create() */ @@ -85,16 +83,13 @@ public class GenSampleWidgetBinding implements CommandWidgetBinding */ public void registerCanFinish(CanFinishRegistry canFinishRegistry) { - canFinishRegistry_ = canFinishRegistry; } /* (non-Javadoc) * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerDataMappings(org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry) */ public void registerDataMappings(DataMappingRegistry dataRegistry) - { - dataMappingRegistry_ = dataRegistry; - + { // Before Client Test widget. dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "TestService",FinishTestFragment.class); dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "TestService", ClientTestWidget.class ); @@ -128,9 +123,7 @@ public class GenSampleWidgetBinding implements CommandWidgetBinding { String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; MessageUtils msgUtils = new MessageUtils( pluginId_ + ".plugin", this ); - - widgetRegistry_ = widgetRegistry; - + widgetRegistry.add( "ClientTestWidget", msgUtils.getMessage("PAGE_TITLE_WS_SAMPLE"), msgUtils.getMessage("PAGE_DESC_WS_SAMPLE"), @@ -142,42 +135,23 @@ public class GenSampleWidgetBinding implements CommandWidgetBinding } }); } - - private class InitClientRegistry extends SimpleCommand - { - private WebServiceClientTypeRegistry clientRegistry_ = WebServiceClientTypeRegistry.getInstance(); - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.core.Command#execute(org.eclipse.wst.command.internal.provisional.env.core.common.Environment) - */ - public Status execute(Environment environment) - { - clientRegistry_.setDataMappingRegistry( dataMappingRegistry_ ); - clientRegistry_.setWidgetRegistry( widgetRegistry_ ); - clientRegistry_.setCanFinishRegistry( canFinishRegistry_ ); - - return new SimpleStatus( "" ); - } - } - private class InitializeProxyCommand extends SimpleCommand + private class InitializeProxyCommand extends EnvironmentalOperation { private IStructuredSelection selection_; private TypeRuntimeServer typeRuntimeServer_; - private IContext context_; private String project_; private String module_; - private String moduleType_; private String earProject_; private String ear_; private IWebServiceClient webServiceClient_; private String j2eeLevel_; - private ResourceContext resourceContext_; - private boolean test_; private String wsdlURI_; - public Status execute(Environment environment_){ - Status status = new SimpleStatus( "" ); + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) + { + Environment env = getEnvironment(); + Status status = new SimpleStatus( "" ); // Split up the project and module int index = module_.indexOf("/"); @@ -207,12 +181,13 @@ public class GenSampleWidgetBinding implements CommandWidgetBinding { CreateServerCommand createServerCommand = new CreateServerCommand(); createServerCommand.setServerFactoryid(clientInfo.getServerFactoryId()); - Status createServerStatus = createServerCommand.execute(environment_); + createServerCommand.setEnvironment( env ); + IStatus createServerStatus = createServerCommand.execute( null, null ); if (createServerStatus.getSeverity()==Status.OK){ clientInfo.setServerInstanceId(createServerCommand.getServerInstanceId()); } else if (createServerStatus.getSeverity()==Status.ERROR){ - environment_.getStatusHandler().reportError(createServerStatus); + env.getStatusHandler().reportError( EnvironmentUtils.convertIStatusToStatus(createServerStatus)); } } @@ -230,10 +205,11 @@ public class GenSampleWidgetBinding implements CommandWidgetBinding command.setModule(module_); } - status = command.execute(environment_); + command.setEnvironment( env ); + status = EnvironmentUtils.convertIStatusToStatus(command.execute( null, null )); if (status.getSeverity()==Status.ERROR) { - environment_.getStatusHandler().reportError(status); + env.getStatusHandler().reportError(status); } webServiceClient_ = new TestWebServiceClient(clientInfo); @@ -295,12 +271,10 @@ public class GenSampleWidgetBinding implements CommandWidgetBinding public void setModuleType( String moduleType) { - moduleType_ = moduleType; } public void setResourceContext( ResourceContext resourceContext ) { - resourceContext_ = resourceContext; } public void setInitialSelection( IStructuredSelection selection ) @@ -314,7 +288,6 @@ public class GenSampleWidgetBinding implements CommandWidgetBinding public GenSampleRootCommandFragment() { add( new SimpleFragment( new ClientWizardWidgetDefaultingCommand(), "" ) ); - add( new SimpleFragment( new InitClientRegistry(), "" )); add( new SimpleFragment( new ClientWizardWidgetOutputCommand(), "" )); add( new SimpleFragment( new WSDLSelectionWidgetDefaultingCommand(), "")); add( new SimpleFragment( new ClientRuntimeSelectionWidgetDefaultingCommand(), "")); diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ImportWSILWidgetBinding.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ImportWSILWidgetBinding.java index 837b0f3bb..5cf4625c7 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ImportWSILWidgetBinding.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ImportWSILWidgetBinding.java @@ -28,10 +28,6 @@ import org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingReg public class ImportWSILWidgetBinding implements CommandWidgetBinding { - private CanFinishRegistry canFinishRegistry; - private WidgetRegistry widgetRegistry; - private DataMappingRegistry dataMappingRegistry; - public ImportWSILWidgetBinding() { } @@ -57,16 +53,13 @@ public class ImportWSILWidgetBinding implements CommandWidgetBinding */ public void registerCanFinish(CanFinishRegistry canFinishRegistry) { - this.canFinishRegistry = canFinishRegistry; } /* (non-Javadoc) * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerDataMappings(org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry) */ public void registerDataMappings(DataMappingRegistry dataRegistry) - { - this.dataMappingRegistry = dataRegistry; - + { // ImportWSILWidget dataRegistry.addMapping(SelectionCommand.class, "InitialSelection", ImportWSILWidget.class); @@ -81,7 +74,6 @@ public class ImportWSILWidgetBinding implements CommandWidgetBinding { String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; MessageUtils msgUtils = new MessageUtils( pluginId_ + ".plugin", this ); - this.widgetRegistry = widgetRegistry; widgetRegistry.add("ImportWSILWidget", msgUtils.getMessage("TITLE_WSIL_IMPORT"), 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 c768b3422..f0751edf4 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 @@ -11,14 +11,14 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions; 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.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext; import org.eclipse.wst.command.internal.provisional.env.core.selection.SelectionListChoices; import org.eclipse.wst.ws.internal.parser.discovery.WebServicesParserExt; import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; -public class ClientExtensionDefaultingCommand extends SimpleCommand +public class ClientExtensionDefaultingCommand extends EnvironmentalOperation { // ClientWizardWidget private TypeRuntimeServer clientIds_; diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionFragment.java index c11956249..7fcd8b265 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionFragment.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionFragment.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions; -import org.eclipse.jst.ws.internal.consumption.ui.wizard.WebServiceClientTypeRegistry; import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; import org.eclipse.wst.command.internal.env.core.fragment.ExtensionFragment; @@ -19,7 +18,6 @@ public class ClientExtensionFragment extends ExtensionFragment { public ClientExtensionFragment() { - setExtensionRegistry( WebServiceClientTypeRegistry.getInstance() ); } protected ClientExtensionFragment( ClientExtensionFragment fragment ) diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionOutputCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionOutputCommand.java index 4e945230b..c0163cf37 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionOutputCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionOutputCommand.java @@ -12,10 +12,10 @@ */ package org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceClient; -public class ClientExtensionOutputCommand extends SimpleCommand +public class ClientExtensionOutputCommand extends EnvironmentalOperation { private IWebServiceClient webServiceClient_; 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 8ddff55a9..3ff49ea53 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 @@ -10,19 +10,14 @@ *******************************************************************************/ package org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.common.ResourceUtils; import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils; 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.EnvironmentalOperation; import org.eclipse.wst.ws.internal.parser.discovery.WebServicesParserExt; import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; -public class ServerExtensionDefaultingCommand extends SimpleCommand +public class ServerExtensionDefaultingCommand extends EnvironmentalOperation { private Boolean startService; private Boolean testService; @@ -109,23 +104,6 @@ public class ServerExtensionDefaultingCommand extends SimpleCommand return serviceProjectName_ + "/" + serviceComponentName_; } - private String getModuleProjectName( String projectName ) - { - - String result = ""; - - if( projectName != null && !projectName.equals("") ) - { - IPath projectPath = new Path( projectName ); - IProject project = (IProject)ResourceUtils.findResource( projectPath ); - String moduleName = J2EEUtils.getFirstWebModuleName( project ); - - result = projectName + "/" + moduleName; - } - - return result; - } - /** * @return Returns the serverProjectEAR. */ diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionFragment.java index 6f1829e19..101cddece 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionFragment.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionFragment.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions; -import org.eclipse.jst.ws.internal.consumption.ui.wizard.WebServiceServerRuntimeTypeRegistry; import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; import org.eclipse.wst.command.internal.env.core.fragment.ExtensionFragment; @@ -19,7 +18,7 @@ public class ServerExtensionFragment extends ExtensionFragment { public ServerExtensionFragment() { - setExtensionRegistry( WebServiceServerRuntimeTypeRegistry.getInstance() ); + } protected ServerExtensionFragment( ServerExtensionFragment fragment ) diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionOutputCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionOutputCommand.java index 53e018631..fa344f59f 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionOutputCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionOutputCommand.java @@ -12,27 +12,22 @@ */ package org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; 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.server.core.IServer; import org.eclipse.wst.ws.internal.parser.discovery.WebServicesParserExt; import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; import org.eclipse.wst.ws.internal.provisional.wsrt.IWebService; -public class ServerExtensionOutputCommand extends SimpleCommand +public class ServerExtensionOutputCommand extends EnvironmentalOperation { //private String wsdlURI_; private WebServicesParser wsdlParser_; private IWebService webService_; - private String existingServerId_; - private String earProjectName_; private boolean isWebProjectStartupRequested_ = false; - - private IServer fExistingServer = null; - + public boolean isUndoable(){ return true; } @@ -72,55 +67,7 @@ public class ServerExtensionOutputCommand extends SimpleCommand } */ return stat; - } - - public Status execute(Environment env){ - - Status status = new SimpleStatus(""); - // Commenting out all extraneous server startups - /* - IServer[] servers = ServerCore.getServers(); - IServer existingServer =null; - fExistingServer = null; - for (int i=0; i<servers.length; i++) - { - IServer thisServer = (IServer)servers[i]; - IServerWorkingCopy wc = null; - String thisServerId = null; - if (thisServer!=null) { - wc = thisServer.createWorkingCopy(); - thisServerId = (wc!=null ? wc.getId() : null); - } - - if (thisServerId.equals(existingServerId_)) - existingServer = thisServer; - } - try { - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IProject earProject = null; - if (earProjectName_!=null && earProjectName_.length()>0) - { - earProject = root.getProject(earProjectName_); - } - - AbstractStartServer startServerCommand = null; - WebServiceStartServerRegistry reg = WebServiceStartServerRegistry.getInstance(); - startServerCommand = (AbstractStartServer)reg.getServerStartByTypeId(existingServer.getServerType().getId()); - if (earProject!=null) { - startServerCommand.runPostServerConfig(existingServer, earProject); - fExistingServer = existingServer; - } - } - catch (CoreException ce ) { - IStatus embeddedStatus = ce.getStatus(); - status = EnvironmentUtils.convertIStatusToStatus(embeddedStatus); - env.getStatusHandler().reportError(status); - return status; - } - */ - return status; - } - + } /** * @return Returns the wsdlURI. @@ -169,13 +116,11 @@ public class ServerExtensionOutputCommand extends SimpleCommand * @param earProjectName The earProjectName to set. */ public void setEarProjectName(String earProjectName) { - this.earProjectName_ = earProjectName; } /** * @param existingServerId The existingServerId to set. */ public void setExistingServerId(String existingServerId) { - this.existingServerId_ = existingServerId; } /** 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 7f5d8729e..0b8e748e2 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 @@ -13,13 +13,16 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; 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.data.TypeRuntimeServer; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; import org.eclipse.wst.command.internal.provisional.env.core.common.SimpleStatus; import org.eclipse.wst.command.internal.provisional.env.core.common.Status; @@ -30,7 +33,7 @@ import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceScenario; -public class ObjectSelectionOutputCommand extends SimpleCommand +public class ObjectSelectionOutputCommand extends EnvironmentalOperation { private String objectSelectionWidgetId_; private IStructuredSelection objectSelection_; @@ -39,8 +42,10 @@ public class ObjectSelectionOutputCommand extends SimpleCommand private String componentName_; private WebServicesParser parser_; - public Status execute(Environment env) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { + Environment env = getEnvironment(); + // Transformation if (objectSelectionWidgetId_ != null && objectSelectionWidgetId_.length() > 0) { diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionWidget.java index 7e0817017..d850219ba 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionWidget.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionWidget.java @@ -12,7 +12,6 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; import java.io.File; import java.net.MalformedURLException; - import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; @@ -190,7 +189,7 @@ public class WSDLSelectionWidget extends AbstractObjectSelectionWidget implement WSDLSelectionConditionCommand cmd = new WSDLSelectionConditionCommand(); cmd.setWebServicesParser(webServicesParser); cmd.setWebServiceURI(wsURI); - cmd.execute(null); + cmd.execute(null, null); } WebServiceEntity entity = webServicesParser.getWebServiceEntityByURI(wsURI); if (entity != null && entity.getType() == WebServiceEntity.TYPE_WSDL) @@ -391,21 +390,6 @@ public class WSDLSelectionWidget extends AbstractObjectSelectionWidget implement return null; } - private String toAbsoluteWsdlURI(Object object) - { - if (object instanceof IFile) - { - try - { - return ((IFile)object).getLocation().toFile().toURL().toString(); - } - catch (MalformedURLException murle) - { - } - } - return toWsdlURI(object); - } - public IStructuredSelection getObjectSelection() { return new StructuredSelection( 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 0790f970b..9554ffd79 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 @@ -11,17 +11,18 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime; import java.util.Vector; - 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.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; 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; import org.eclipse.jst.ws.internal.common.ServerUtils; -import org.eclipse.jst.ws.internal.consumption.ui.common.ClientServerSelectionUtils; 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; @@ -29,7 +30,7 @@ import org.eclipse.jst.ws.internal.consumption.ui.preferences.PersistentServerRu 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.data.TypeRuntimeServer; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; 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; @@ -39,9 +40,6 @@ import org.eclipse.wst.command.internal.provisional.env.core.selection.Selection import org.eclipse.wst.command.internal.provisional.env.core.selection.SelectionListChoices; import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; import org.eclipse.wst.server.core.IRuntime; -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.ws.internal.parser.wsil.WebServicesParser; import org.eclipse.wst.ws.internal.provisional.wsrt.IContext; import org.eclipse.wst.ws.internal.provisional.wsrt.ISelection; @@ -52,7 +50,7 @@ import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceScenario; import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceState; import org.eclipse.wst.ws.internal.wsrt.SimpleContext; -public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand +public class ClientRuntimeSelectionWidgetDefaultingCommand extends EnvironmentalOperation { protected MessageUtils msgUtils_; // clientRuntimeJ2EEType contains the default client runtime and J2EE level based on the initial selection. @@ -65,7 +63,6 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand private String clientComponentName_; private String clientEarComponentName_; - private Environment environment_; private IContext context_; private ISelection selection_; private IWebServiceClient webServiceClient_; @@ -82,10 +79,8 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand //1. The containing project contains the Web service for which we are trying to create a client //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 IStructuredSelection clientInitialSelection_; private IProject clientInitialProject_; private String clientInitialComponentName_; - private IStructuredSelection initialInitialSelection_; private IProject initialInitialProject_; private String initialInitialComponentName_; @@ -157,12 +152,7 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand { return webServiceClient_; } - - public Environment getEnvironment() - { - return environment_; - } - + public IContext getContext() { return context_; @@ -176,8 +166,10 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand /* (non-Javadoc) * @see org.eclipse.wst.command.env.core.Command#execute(org.eclipse.wst.command.internal.provisional.env.core.common.Environment) */ - public Status execute(Environment environment) - { + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) + { + Environment env = getEnvironment(); + try { @@ -230,19 +222,19 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand Status serverStatus = setClientDefaultServer(); if (serverStatus.getSeverity()== Status.ERROR) { - environment.getStatusHandler().reportError(serverStatus); + env.getStatusHandler().reportError(serverStatus); return serverStatus; } updateClientEARs(); //Calculate default IWebServiceClient - setDefaultsForExtension(environment); + setDefaultsForExtension(env); return new SimpleStatus(""); } catch (Exception e) { //Catch all Exceptions in order to give some feedback to the user Status errorStatus = new SimpleStatus("", msgUtils_.getMessage("MSG_ERROR_TASK_EXCEPTED",new String[]{e.getMessage()}),Status.ERROR, e); - environment.getStatusHandler().reportError(errorStatus); + env.getStatusHandler().reportError(errorStatus); return errorStatus; } @@ -758,77 +750,7 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand //clientEarComponentName_ = ResourceUtils.getDefaultClientEARComponentName(); } } - - private void setClientDefaultServerNew() - { - String initialClientProjectName = runtimeClientTypes_.getChoice().getChoice().getList().getSelection(); - IRuntime runtimeTarget = ServerSelectionUtils.getRuntimeTarget(initialClientProjectName); - String runtimeTargetId = null; - if (runtimeTarget != null) - { - runtimeTargetId = runtimeTarget.getRuntimeType().getId(); - //Pick a compatible existing server if one exists. - IServer[] servers = ServerSelectionUtils.getCompatibleExistingServers(runtimeTarget); - if (servers!=null && servers.length>0) - { - for (int i=0; i<servers.length; i++) - { - String thisFactoryId = servers[0].getServerType().getId(); - //if (WebServiceRuntimeExtensionUtils.doesRuntimeSupportServer(clientIds_.getRuntimeId(), thisFactoryId)) - //{ - //Pick this server and return. - clientIds_.setServerId(thisFactoryId); - clientIds_.setServerInstanceId(servers[0].getId()); - return; - //} - } - } - - //No compatible existing server, set the factory id to something the runtime supports - String[] factoryIds = WebServiceRuntimeExtensionUtils.getWebServiceRuntimeById(clientIds_.getRuntimeId()).getServerFactoryIds(); - if (factoryIds!=null && factoryIds.length>0) - { - for (int i=0; i<factoryIds.length; i++) - { - IServerType serverType = ServerCore.findServerType(factoryIds[i]); - if (serverType != null) - { - String serverRuntimeTypeId = serverType.getRuntimeType().getId(); - if (serverRuntimeTypeId.equals(runtimeTargetId)) - { - //Found a match - clientIds_.setServerId(factoryIds[i]); - return; - } - } - } - } - else - { - //Runtime does not specify any server factory ids - IServerType[] serverTypes = ServerCore.getServerTypes(); - clientIds_.setServerId(serverTypes[0].getId()); - } - - } - else - { - // The project has no server target so pick a server factory id that is supported by the runtime - String[] fids = WebServiceRuntimeExtensionUtils.getWebServiceRuntimeById(clientIds_.getRuntimeId()).getServerFactoryIds(); - if (fids!=null && fids.length>0) - { - clientIds_.setServerId(fids[0]); - } - else - { - //Runtime does not specify any server factory ids - IServerType[] serverTypes = ServerCore.getServerTypes(); - clientIds_.setServerId(serverTypes[0].getId()); - } - - } - } - + private Status setClientDefaultServer() { Status status = new SimpleStatus(""); @@ -973,7 +895,7 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand if (clientProject != null && clientProject.exists()) { //Get the runtime target on the serviceProject - IRuntime clientTarget = ClientServerSelectionUtils.getRuntimeTarget(clientProjectName); + IRuntime clientTarget = ServerSelectionUtils.getRuntimeTarget(clientProjectName); String j2eeVersion = String.valueOf(J2EEUtils.getJ2EEVersion(clientProject, clientComponentName_)); if (clientTarget != null) { @@ -1022,7 +944,6 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand wsInfo.setWebServiceRuntimeId(clientIds_.getRuntimeId()); wsInfo.setWsdlURL(wsdlURI_); - environment_ = env; webServiceClient_ = wsrt.getWebServiceClient(wsInfo); WebServiceScenario scenario = WebServiceScenario.CLIENT_LITERAL; if (resourceContext_ != null) @@ -1036,7 +957,6 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand public void setClientInitialSelection(IStructuredSelection selection) { - clientInitialSelection_ = selection; if (clientInitialProject_ == null) { clientInitialProject_ = getProjectFromInitialSelection(selection); @@ -1059,7 +979,6 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand */ public void setInitialInitialSelection(IStructuredSelection initialInitialSelection) { - initialInitialSelection_ = initialInitialSelection; initialInitialProject_ = getProjectFromInitialSelection(initialInitialSelection); initialInitialComponentName_ = getComponentNameFromInitialSelection(initialInitialSelection); } diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestDelegateCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestDelegateCommand.java index 78a4e3220..119211d8e 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestDelegateCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestDelegateCommand.java @@ -13,14 +13,16 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; import java.util.List; import java.util.Vector; - +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jst.ws.internal.common.EnvironmentUtils; import org.eclipse.jst.ws.internal.context.ScenarioContext; import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; import org.eclipse.jst.ws.internal.ext.test.WebServiceTestExtension; import org.eclipse.jst.ws.internal.ext.test.WebServiceTestRegistry; -import org.eclipse.jst.ws.internal.plugin.WebServicePlugin; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.ICommandFactory; -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.SimpleStatus; import org.eclipse.wst.command.internal.provisional.env.core.common.Status; @@ -39,18 +41,12 @@ import org.eclipse.wst.ws.internal.provisional.wsrt.TestInfo; * * */ -public class ClientTestDelegateCommand extends SimpleCommand +public class ClientTestDelegateCommand extends EnvironmentalOperation { - private String LABEL = "JSPGenerationTask"; - private String DESCRIPTION = "Run the JSP Generation"; - - private ScenarioContext scenarioContext; private WebServiceTestRegistry testRegistry; private SelectionList testFacilities; - private String folder; private String jspFolder; private BooleanSelection[] methods; - private boolean runClientTest=true; private String sampleServerTypeID; private IServer sampleExistingServer; private String proxyBean; @@ -63,28 +59,22 @@ public class ClientTestDelegateCommand extends SimpleCommand private boolean clientNeedEAR; private String clientEarProjectName; private String clientEarComponentName; - private String clientServer; - private TypeRuntimeServer clientIds; private TypeRuntimeServer serverIds; private String serviceProject; private String serviceP; - private String serviceC; private String wsdlServiceURL; - private boolean generateProxy; private boolean isTestWidget = false; private String setEndpointMethod; private List endpoints; public ClientTestDelegateCommand () { - setDescription(DESCRIPTION); - setName(LABEL); - scenarioContext = WebServicePlugin.getInstance().getScenarioContext().copy(); testRegistry = WebServiceTestRegistry.getInstance(); } - public Status execute(Environment env) - { + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) + { + Environment env = getEnvironment(); Status status = new SimpleStatus( "" ); String clientTestID = testFacilities.getSelection(); @@ -110,8 +100,20 @@ public class ClientTestDelegateCommand extends SimpleCommand { Status status = new SimpleStatus( "" ); - while(commandFactory.hasNext()){ - status = commandFactory.getNextCommand().execute(env); + while(commandFactory.hasNext()) + { + EnvironmentalOperation operation = commandFactory.getNextCommand(); + operation.setEnvironment( env ); + + try + { + status = EnvironmentUtils.convertIStatusToStatus(operation.execute( null, null )); + } + catch( Exception exc ) + { + status = new SimpleStatus( "id", exc.getMessage(), Status.ERROR, exc ); + } + if(status.getSeverity() == Status.ERROR){ StatusHandler sHandler = env.getStatusHandler(); sHandler.reportError(status); @@ -198,7 +200,6 @@ public class ClientTestDelegateCommand extends SimpleCommand public void setFolder(String folder) { - this.folder = folder; } public void setJspFolder(String jspFolder) @@ -213,7 +214,6 @@ public class ClientTestDelegateCommand extends SimpleCommand public void setRunClientTest(boolean runClientTest) { - this.runClientTest = runClientTest; } public void setProxyBean(String proxyBean) @@ -233,7 +233,6 @@ public class ClientTestDelegateCommand extends SimpleCommand public void setScenarioContext(ScenarioContext scenarioContext) { - this.scenarioContext = scenarioContext; } public void setClientTestRegistry(WebServiceTestRegistry testRegistry) @@ -253,7 +252,6 @@ public class ClientTestDelegateCommand extends SimpleCommand public void setClientTypeRuntimeServer(TypeRuntimeServer ids) { - clientIds = ids; } public void setServiceTypeRuntimeServer(TypeRuntimeServer ids) @@ -273,7 +271,6 @@ public class ClientTestDelegateCommand extends SimpleCommand public void setClientServer(String clientServer) { - this.clientServer = clientServer; } public void setServerProject(String serviceProject) @@ -287,7 +284,6 @@ public class ClientTestDelegateCommand extends SimpleCommand int index = serviceProject.indexOf("/"); if (index!=-1) { serviceP = serviceProject.substring(0,index); - serviceC = serviceProject.substring(index + 1); return serviceP; } } @@ -302,7 +298,6 @@ public class ClientTestDelegateCommand extends SimpleCommand public void setGenerateProxy(boolean generateProxy) { - this.generateProxy = generateProxy; } public boolean getIsTestWidget() diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CopyWebServiceUtilsJarCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CopyWebServiceUtilsJarCommand.java index 8bedf5849..8e62f5e02 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CopyWebServiceUtilsJarCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CopyWebServiceUtilsJarCommand.java @@ -11,19 +11,20 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; -import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Plugin; import org.eclipse.jem.util.emf.workbench.ProjectUtilities; import org.eclipse.jst.ws.internal.common.J2EEUtils; import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.jst.ws.internal.plugin.WebServicePlugin; import org.eclipse.wst.command.internal.env.common.FileResourceUtils; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; 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; @@ -33,10 +34,8 @@ import org.eclipse.wst.command.internal.provisional.env.core.context.ResourceCon import org.eclipse.wst.command.internal.provisional.env.core.context.TransientResourceContext; -public class CopyWebServiceUtilsJarCommand extends SimpleCommand { - - private static java.lang.String DESCRIPTION = "Copy WebserviceUtils.jar"; - private static java.lang.String LABEL = "CopyWebServiceUtilsJarCommand"; +public class CopyWebServiceUtilsJarCommand extends EnvironmentalOperation +{ private String sampleProject; private String sampleC; private MessageUtils msgUtils; @@ -48,7 +47,6 @@ public class CopyWebServiceUtilsJarCommand extends SimpleCommand { public CopyWebServiceUtilsJarCommand() { - super(LABEL,DESCRIPTION); String pluginId = "org.eclipse.jst.ws.consumption"; msgUtils = new MessageUtils(pluginId + ".plugin", this); } @@ -56,8 +54,10 @@ public CopyWebServiceUtilsJarCommand() /** * Execute the command */ -public Status execute(Environment env) +public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { + Environment env = getEnvironment(); + try { env.getProgressMonitor().report( msgUtils.getMessage( "PROGRESS_INFO_COPY_WEBSERVICE_UTILS" ) ); @@ -88,14 +88,6 @@ public Status execute(Environment env) /** * */ -private Status copyIFile(String source, IPath targetPath, String targetFile,Environment env) -{ - return copyIFile(source, targetPath, targetFile, WebServicePlugin.getInstance(),env); -} - -/** - * - */ private Status copyIFile(String source, IPath targetPath, String targetFile, Plugin plugin,Environment env) { @@ -112,11 +104,11 @@ private Status copyIFile(String source, IPath targetPath, String targetFile, Plu context.setCheckoutFilesEnabled(true); IResource resource = FileResourceUtils.findResource(target); if(resource != null) return new SimpleStatus(""); - IFile file = FileResourceUtils.createFile(context, - target, - plugin.openStream(new Path(source)), - env.getProgressMonitor(), - env.getStatusHandler()); + FileResourceUtils.createFile(context, + target, + plugin.openStream(new Path(source)), + env.getProgressMonitor(), + env.getStatusHandler()); } catch (Exception e) { return new SimpleStatus(WebServiceConsumptionUIPlugin.ID,msgUtils.getMessage("MSG_ERROR_FILECOPY_WEBSERVICE_UTILS"),Status.ERROR,e); diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CreateSampleProjectCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CreateSampleProjectCommand.java index e3b7f5e6b..9cbe7b497 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CreateSampleProjectCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CreateSampleProjectCommand.java @@ -12,16 +12,20 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jst.ws.internal.common.EnvironmentUtils; import org.eclipse.jst.ws.internal.consumption.command.common.AddModuleToServerCommand; import org.eclipse.jst.ws.internal.consumption.command.common.AssociateModuleWithEARCommand; import org.eclipse.jst.ws.internal.consumption.command.common.CreateModuleCommand; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; 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.server.core.IServer; -public class CreateSampleProjectCommand extends SimpleCommand +public class CreateSampleProjectCommand extends EnvironmentalOperation { private String sampleProject; private String sampleProjectEar; @@ -33,11 +37,11 @@ public class CreateSampleProjectCommand extends SimpleCommand public CreateSampleProjectCommand() { - super("org.eclipse.jst.ws.internal.consumption.ui.wizard.client.common.CreateSampleProjectCommand","org.eclipse.jst.ws.internal.consumption.ui.wizard.client.common.CreateSampleProjectCommand"); } - public Status execute(Environment env) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { + Environment env = getEnvironment(); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); if (!root.getProject(sampleProject).exists() || !root.getProject(sampleProjectEar).exists()) { @@ -54,7 +58,8 @@ public class CreateSampleProjectCommand extends SimpleCommand command.setServerFactoryId(serverFactoryId); command.setServerInstanceId(existingServer.getId()); command.setJ2eeLevel(j2eeVersion); - Status status = command.execute(env); + command.setEnvironment( env ); + Status status = EnvironmentUtils.convertIStatusToStatus(command.execute( null, null ) ); if (status.getSeverity()==Status.ERROR) { env.getStatusHandler().reportError(status); @@ -72,7 +77,8 @@ public class CreateSampleProjectCommand extends SimpleCommand commandEAR.setServerFactoryId(serverFactoryId); commandEAR.setServerInstanceId(existingServer.getId()); commandEAR.setJ2eeLevel(j2eeVersion); - status = commandEAR.execute(env); + commandEAR.setEnvironment( env ); + status = EnvironmentUtils.convertIStatusToStatus(commandEAR.execute( null, null )); if (status.getSeverity()==Status.ERROR) { env.getStatusHandler().reportError(status); @@ -88,7 +94,8 @@ public class CreateSampleProjectCommand extends SimpleCommand //TODO The EAR component name is not necessarily the same as the project name //so the component name needs to somehow be piped into this command associateCommand.setEar(sampleProjectEar); - status = associateCommand.execute(env); + associateCommand.setEnvironment( env ); + status = EnvironmentUtils.convertIStatusToStatus(associateCommand.execute(null, null)); if (status.getSeverity()==Status.ERROR) { env.getStatusHandler().reportError(status); @@ -102,8 +109,8 @@ public class CreateSampleProjectCommand extends SimpleCommand //TODO The EAR component name is not necessarily the same as the project name //so the component name needs to somehow be piped into this command commandInstall.setModule(sampleProjectEar); - - status = commandInstall.execute(env); + commandInstall.setEnvironment( env ); + status = EnvironmentUtils.convertIStatusToStatus(commandInstall.execute( null, null )); if (status.getSeverity()==Status.ERROR) { env.getStatusHandler().reportError(status); @@ -117,8 +124,9 @@ public class CreateSampleProjectCommand extends SimpleCommand commandInstall.setServerInstanceId(existingServer.getId()); commandInstall.setProject(sampleProject); commandInstall.setModule(sampleProject); + commandInstall.setEnvironment( env ); - status = commandInstall.execute(env); + status = EnvironmentUtils.convertIStatusToStatus(commandInstall.execute( null, null )); if (status.getSeverity()==Status.ERROR) { env.getStatusHandler().reportError(status); diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishDefaultCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishDefaultCommand.java index 855c35f2c..6c9b38fb3 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishDefaultCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishDefaultCommand.java @@ -11,8 +11,10 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; 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.server.core.IServer; @@ -25,24 +27,18 @@ import org.eclipse.wst.server.core.ServerCore; * * */ -public class FinishDefaultCommand extends SimpleCommand +public class FinishDefaultCommand extends EnvironmentalOperation { - private String LABEL = "JSPGenerationTask"; - private String DESCRIPTION = "Run the JSP Generation"; - private String sampleServerTypeID; private IServer sampleExistingServer; - private String existingServerId_; private String sampleServerInstanceId; public FinishDefaultCommand () { - setDescription(DESCRIPTION); - setName(LABEL); } - public Status execute(Environment env) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { Status status = new SimpleStatus( "" ); if(sampleServerInstanceId != null){ @@ -73,7 +69,6 @@ public class FinishDefaultCommand extends SimpleCommand public void setExistingServerId(String existingServerId) { - existingServerId_ = existingServerId; } } diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestClientDepartureInitCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestClientDepartureInitCommand.java index 1df7d18db..1062019f8 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestClientDepartureInitCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestClientDepartureInitCommand.java @@ -16,7 +16,7 @@ */ package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; /** * @author gilberta @@ -24,7 +24,7 @@ import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; * To change the template for this generated type comment go to * Window - Preferences - Java - Code Generation - Code and Comments */ -public class TestClientDepartureInitCommand extends SimpleCommand +public class TestClientDepartureInitCommand extends EnvironmentalOperation { private boolean forceBuild; diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestDefaultingFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestDefaultingFragment.java index 6db63c8a3..f4a8e8917 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestDefaultingFragment.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestDefaultingFragment.java @@ -16,13 +16,13 @@ */ package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jst.ws.internal.context.ScenarioContext; -import org.eclipse.jst.ws.internal.ext.test.WebServiceTestRegistry; import org.eclipse.jst.ws.internal.plugin.WebServicePlugin; -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.EnvironmentalOperation; 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; @@ -32,16 +32,15 @@ import org.eclipse.wst.command.internal.provisional.env.core.selection.Selection * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ -public class TestDefaultingFragment extends SimpleCommand +public class TestDefaultingFragment extends EnvironmentalOperation { - private WebServiceTestRegistry testRegistry; private SelectionList testFacilities; private String launchedServiceTestName; private ScenarioContext scenarioContext; - public Status execute(Environment env) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { SimpleStatus status = new SimpleStatus(""); diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WSDLTestLaunchCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WSDLTestLaunchCommand.java index 9b9cd7a22..32855382e 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WSDLTestLaunchCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WSDLTestLaunchCommand.java @@ -16,13 +16,15 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; import java.util.List; - +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jst.ws.internal.common.EnvironmentUtils; import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; import org.eclipse.jst.ws.internal.ext.test.WebServiceTestExtension; import org.eclipse.jst.ws.internal.ext.test.WebServiceTestRegistry; -import org.eclipse.wst.command.internal.provisional.env.core.Command; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.ICommandFactory; -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; @@ -38,7 +40,7 @@ import org.eclipse.wst.ws.internal.provisional.wsrt.TestInfo; * * Window - Preferences - Java - Code Style - Code Templates */ -public class WSDLTestLaunchCommand extends SimpleCommand +public class WSDLTestLaunchCommand extends EnvironmentalOperation { private String testID; private String launchedServiceTestName; @@ -47,7 +49,6 @@ public class WSDLTestLaunchCommand extends SimpleCommand private String serverModule; private String wsdlURI; private MessageUtils msgUtils; - private boolean externalBrowser; private List endpoints; private IServer serviceExistingServer = null; private String serviceServerTypeID = null; @@ -59,8 +60,9 @@ public class WSDLTestLaunchCommand extends SimpleCommand msgUtils = new MessageUtils(pluginId + ".plugin", this); } - public Status execute(Environment env) - { + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) + { + Environment env = getEnvironment(); Status status = new SimpleStatus(""); WebServiceTestRegistry testRegistry = WebServiceTestRegistry.getInstance(); @@ -85,10 +87,23 @@ public class WSDLTestLaunchCommand extends SimpleCommand private Status commandFactoryExecution(ICommandFactory commandFactory,Environment env) { Status status = new SimpleStatus( "" ); - while(commandFactory.hasNext()){ - Command command = commandFactory.getNextCommand(); - if (command != null) - status = command.execute(env); + while(commandFactory.hasNext()) + { + EnvironmentalOperation operation = commandFactory.getNextCommand(); + + if (operation != null) + { + try + { + operation.setEnvironment( env ); + status = EnvironmentUtils.convertIStatusToStatus(operation.execute( null, null )); + } + catch( Exception exc ) + { + status = new SimpleStatus( "id", exc.getMessage(), Status.ERROR, exc ); + } + } + if(status.getSeverity() == Status.ERROR){ StatusHandler sHandler = env.getStatusHandler(); sHandler.reportError(status); @@ -152,7 +167,6 @@ public class WSDLTestLaunchCommand extends SimpleCommand public void setExternalBrowser(boolean externalBrowser) { - this.externalBrowser = externalBrowser; } public void setEndpoint(List endpoints) 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 0c669db41..8fb89ea33 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 @@ -12,19 +12,18 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; import java.util.List; import java.util.ListIterator; - import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jem.java.JavaClass; import org.eclipse.jem.java.JavaHelpers; import org.eclipse.jem.java.Method; import org.eclipse.jem.util.emf.workbench.ProjectUtilities; +import org.eclipse.jst.ws.internal.common.EnvironmentUtils; import org.eclipse.jst.ws.internal.common.J2EEUtils; import org.eclipse.jst.ws.internal.consumption.command.common.JavaMofReflectionCommand; -import org.eclipse.jst.ws.internal.context.ScenarioContext; -import org.eclipse.jst.ws.internal.ext.test.WebServiceTestRegistry; -import org.eclipse.jst.ws.internal.plugin.WebServicePlugin; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; 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; @@ -38,27 +37,19 @@ import org.eclipse.wst.command.internal.provisional.env.core.selection.BooleanSe * client page * */ -public class WebServiceClientTestArrivalCommand extends SimpleCommand +public class WebServiceClientTestArrivalCommand extends EnvironmentalOperation { public static final String DEFAULT_WEB_MODULE_ROOT = "WebContent"; public static final String DEFAULT_SAMPLE_WEB_PROJECT_EXT = "Sample"; - - private String LABEL = "WebServiceClientTestArrivalTask"; - private String DESCRIPTION = "default actions"; private MessageUtils msgUtils; public static String SAMPLE_DIR = "sample"; - private String PROXY = "Proxy"; - - private ScenarioContext scenarioContext; - private String clientProject; private String clientProjectEAR; private String clientP; private String clientC; private IProject clientIProject; - private WebServiceTestRegistry testRegistry; private String folder; private String jspFolder; private BooleanSelection[] methods; @@ -75,17 +66,13 @@ public class WebServiceClientTestArrivalCommand extends SimpleCommand */ public WebServiceClientTestArrivalCommand () { - setDescription(DESCRIPTION); - setName(LABEL); String pluginId = "org.eclipse.jst.ws.consumption.ui"; msgUtils = new MessageUtils(pluginId + ".plugin", this); - - scenarioContext = WebServicePlugin.getInstance().getScenarioContext().copy(); - testRegistry = WebServiceTestRegistry.getInstance(); } - public Status execute(Environment env) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { + Environment env = getEnvironment(); Status status = new SimpleStatus( "" ); @@ -93,7 +80,6 @@ public class WebServiceClientTestArrivalCommand extends SimpleCommand //Get the sample Folder ready StringBuffer sb = new StringBuffer(); - IPath path= null; sb.append("/").append(sampleC).append("/").append(DEFAULT_WEB_MODULE_ROOT).append("/"); folder = SAMPLE_DIR + getBean(); @@ -118,11 +104,12 @@ public class WebServiceClientTestArrivalCommand extends SimpleCommand JavaMofReflectionCommand javamofcommand = new JavaMofReflectionCommand(); javamofcommand.setProxyBean(proxyBean); javamofcommand.setClientProject(clientP); + javamofcommand.setEnvironment( env ); try{ - Status mofStatus = javamofcommand.execute(env); + Status mofStatus = EnvironmentUtils.convertIStatusToStatus(javamofcommand.execute( null, null)); if(mofStatus.getSeverity() == Status.ERROR) return mofStatus; }catch(Exception exc){ @@ -147,7 +134,6 @@ public class WebServiceClientTestArrivalCommand extends SimpleCommand { Method method = (Method)listIterator.next(); if(method.isConstructor()) continue; - String signature = method.getMethodElementSignature(); tempMethods[j] = new BooleanSelection( method.getMethodElementSignature(), true); j++; diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/ExplorerServiceTestCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/ExplorerServiceTestCommand.java index fcd2a2206..58adb2695 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/ExplorerServiceTestCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/ExplorerServiceTestCommand.java @@ -14,12 +14,15 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.explorer; import java.util.Iterator; import java.util.List; import java.util.Vector; - import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jst.ws.internal.common.EnvironmentUtils; import org.eclipse.jst.ws.internal.common.ResourceUtils; import org.eclipse.jst.ws.internal.consumption.command.common.StartProjectCommand; import org.eclipse.jst.ws.internal.ext.test.WSDLTestFinishCommand; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; import org.eclipse.wst.command.internal.provisional.env.core.common.SimpleStatus; import org.eclipse.wst.command.internal.provisional.env.core.common.Status; @@ -29,11 +32,9 @@ import org.eclipse.wst.ws.internal.explorer.LaunchOptions; import org.eclipse.wst.ws.internal.explorer.WSExplorerLauncherCommand; import org.eclipse.wst.ws.internal.explorer.plugin.ExplorerPlugin; -public class ExplorerServiceTestCommand extends SimpleCommand implements WSDLTestFinishCommand +public class ExplorerServiceTestCommand extends EnvironmentalOperation implements WSDLTestFinishCommand { - private String LABEL = "ExplorerServiceTestCommand"; - private String DESCRIPTION = "Launch the Explorer"; private boolean externalBrowser = true; private String wsdlServiceURL; private String serviceServerTypeID; @@ -46,12 +47,12 @@ public class ExplorerServiceTestCommand extends SimpleCommand implements WSDLTes */ public ExplorerServiceTestCommand () { - setDescription(DESCRIPTION); - setName(LABEL); } - public Status execute(Environment env) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { + Environment env = getEnvironment(); + Status status = new SimpleStatus( "" ); StartProjectCommand spc = new StartProjectCommand( true ); @@ -60,8 +61,9 @@ public class ExplorerServiceTestCommand extends SimpleCommand implements WSDLTes IProject project = (IProject) ResourceUtils.findResource(serviceProject); spc.setServiceProject(project); spc.setIsWebProjectStartupRequested(true); + spc.setEnvironment( env ); - status = spc.execute(env); + status = EnvironmentUtils.convertIStatusToStatus(spc.execute( null, null )); if (status.getSeverity() == Status.ERROR) return status; @@ -77,7 +79,8 @@ public class ExplorerServiceTestCommand extends SimpleCommand implements WSDLTes for (Iterator it = endpoints.iterator(); it.hasNext();) launchOptionVector.add(new LaunchOption(LaunchOptions.WEB_SERVICE_ENDPOINT, it.next().toString())); launchCommand.setLaunchOptions((LaunchOption[])launchOptionVector.toArray(new LaunchOption[0])); - status = launchCommand.execute(env); + launchCommand.setEnvironment( env ); + status = EnvironmentUtils.convertIStatusToStatus(launchCommand.execute( null, null )); return status; } diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WSEGenerateCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WSEGenerateCommand.java index be7603a19..cdbf17e2b 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WSEGenerateCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WSEGenerateCommand.java @@ -2,32 +2,36 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.explorer; import java.util.Iterator; import java.util.Vector; - import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jem.util.emf.workbench.ProjectUtilities; +import org.eclipse.jst.ws.internal.common.EnvironmentUtils; import org.eclipse.jst.ws.internal.consumption.command.common.StartProjectCommand; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; 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.ws.internal.datamodel.Model; import org.eclipse.wst.ws.internal.explorer.LaunchOption; import org.eclipse.wst.ws.internal.explorer.LaunchOptions; import org.eclipse.wst.ws.internal.explorer.WSExplorerLauncherCommand; import org.eclipse.wst.ws.internal.explorer.plugin.ExplorerPlugin; import org.eclipse.wst.ws.internal.provisional.wsrt.TestInfo; -public class WSEGenerateCommand extends SimpleCommand { +public class WSEGenerateCommand extends EnvironmentalOperation +{ private TestInfo testInfo; - private Model proxyModel; public WSEGenerateCommand(TestInfo testInfo){ this.testInfo = testInfo; } - public Status execute(Environment env) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { + Environment env = getEnvironment(); + Status status = new SimpleStatus( "" ); StartProjectCommand spc = new StartProjectCommand( true ); @@ -36,8 +40,9 @@ public class WSEGenerateCommand extends SimpleCommand { IProject project = (IProject) ProjectUtilities.getProject(testInfo.getServiceProject()); spc.setServiceProject(project); spc.setIsWebProjectStartupRequested(true); + spc.setEnvironment( env ); - status = spc.execute(env); + status = EnvironmentUtils.convertIStatusToStatus(spc.execute( null, null ) ); if (status.getSeverity() == Status.ERROR) return status; @@ -53,7 +58,8 @@ public class WSEGenerateCommand extends SimpleCommand { for (Iterator it = testInfo.getEndpoint().iterator(); it.hasNext();) launchOptionVector.add(new LaunchOption(LaunchOptions.WEB_SERVICE_ENDPOINT, it.next().toString())); launchCommand.setLaunchOptions((LaunchOption[])launchOptionVector.toArray(new LaunchOption[0])); - status = launchCommand.execute(env); + launchCommand.setEnvironment( env ); + status = EnvironmentUtils.convertIStatusToStatus(launchCommand.execute( null, null )); return status; } } diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WebServiceExplorerExecutable.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WebServiceExplorerExecutable.java index 22b35f62f..c1b61d03f 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WebServiceExplorerExecutable.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WebServiceExplorerExecutable.java @@ -12,7 +12,7 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.explorer; import org.eclipse.jst.ws.internal.ext.WebServiceExecutable; -import org.eclipse.jst.ws.internal.ext.WebServiceFinishCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; /** * This is the interface for objects that represent a kind of @@ -25,7 +25,7 @@ public class WebServiceExplorerExecutable implements WebServiceExecutable public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - public WebServiceFinishCommand getFinishCommand() + public EnvironmentalOperation getFinishCommand() { return new ExplorerServiceTestCommand(); } diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/AddModuleDependenciesCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/AddModuleDependenciesCommand.java index da50317e8..39ed4da45 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/AddModuleDependenciesCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/AddModuleDependenciesCommand.java @@ -11,9 +11,11 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.wssample; import java.io.IOException; - 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; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jdt.core.IClasspathEntry; import org.eclipse.jdt.core.IJavaProject; @@ -22,18 +24,19 @@ import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jem.util.emf.workbench.ProjectUtilities; import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest; import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; +import org.eclipse.jst.ws.internal.common.EnvironmentUtils; import org.eclipse.jst.ws.internal.common.J2EEUtils; import org.eclipse.jst.ws.internal.consumption.command.common.AddModuleToServerCommand; import org.eclipse.jst.ws.internal.consumption.command.common.AssociateModuleWithEARCommand; import org.eclipse.jst.ws.internal.consumption.command.common.CreateModuleCommand; import org.eclipse.jst.ws.internal.consumption.command.common.StartServerCommand; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; 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.ws.internal.provisional.wsrt.TestInfo; -public class AddModuleDependenciesCommand extends SimpleCommand +public class AddModuleDependenciesCommand extends EnvironmentalOperation { private TestInfo testInfo; @@ -53,8 +56,9 @@ public class AddModuleDependenciesCommand extends SimpleCommand * Execute WebServerDefaultingTask Set the default server name and id given a * deployable. */ - public Status execute(Environment env) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { + Environment env = getEnvironment(); try { createSampleProjects(env); @@ -122,7 +126,8 @@ public class AddModuleDependenciesCommand extends SimpleCommand createEAR.setServerFactoryId(testInfo.getClientServerTypeID()); createEAR.setModuleType(CreateModuleCommand.EAR); createEAR.setJ2eeLevel(J2EEUtils.getJ2EEVersionAsString(clientIProject,testInfo.getClientModule())); - Status status = createEAR.execute(env); + createEAR.setEnvironment( env ); + Status status = EnvironmentUtils.convertIStatusToStatus(createEAR.execute( null, null ) ); if (status.getSeverity()==Status.ERROR) { env.getStatusHandler().reportError(status); @@ -132,7 +137,8 @@ public class AddModuleDependenciesCommand extends SimpleCommand modToServer.setModule(sampleEARModule); modToServer.setProject(sampleEARProject); modToServer.setServerInstanceId(testInfo.getClientExistingServer().getId()); - status = modToServer.execute(env); + modToServer.setEnvironment( env ); + status = EnvironmentUtils.convertIStatusToStatus(modToServer.execute( null, null )); if (status.getSeverity()==Status.ERROR) { env.getStatusHandler().reportError(status); @@ -150,7 +156,8 @@ public class AddModuleDependenciesCommand extends SimpleCommand createSample.setServerInstanceId(testInfo.getClientExistingServer().getId()); createSample.setServerFactoryId(testInfo.getClientServerTypeID()); createSample.setJ2eeLevel(J2EEUtils.getJ2EEVersionAsString(clientIProject,testInfo.getClientModule())); - Status status = createSample.execute(env); + createSample.setEnvironment( env ); + Status status = EnvironmentUtils.convertIStatusToStatus(createSample.execute( null, null )); if (testInfo.getClientNeedEAR()) { // Associate the client module and service EAR @@ -159,7 +166,8 @@ public class AddModuleDependenciesCommand extends SimpleCommand associateCommand.setModule(testInfo.getGenerationModule()); associateCommand.setEARProject(sampleEARProject); associateCommand.setEar(sampleEARModule); - status = associateCommand.execute(env); + associateCommand.setEnvironment( env ); + status = EnvironmentUtils.convertIStatusToStatus(associateCommand.execute( null, null )); if (status.getSeverity()==Status.ERROR) { env.getStatusHandler().reportError(status); @@ -168,7 +176,8 @@ public class AddModuleDependenciesCommand extends SimpleCommand StartServerCommand startServer = new StartServerCommand(false, true); startServer.setServerInstanceId(testInfo.getClientExistingServer().getId()); - status = startServer.execute(env); + startServer.setEnvironment( env ); + status = EnvironmentUtils.convertIStatusToStatus(startServer.execute( null, null )); if (status.getSeverity()==Status.ERROR) { env.getStatusHandler().reportError(status); diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCGenerateCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCGenerateCommand.java index ec9295c0a..c10e861b9 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCGenerateCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCGenerateCommand.java @@ -4,7 +4,10 @@ import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; import org.eclipse.jem.util.emf.workbench.ProjectUtilities; import org.eclipse.jst.ws.internal.common.EnvironmentUtils; @@ -16,14 +19,15 @@ import org.eclipse.jst.ws.internal.consumption.sampleapp.codegen.TestClientFileG import org.eclipse.jst.ws.internal.consumption.sampleapp.command.GeneratePageCommand; import org.eclipse.jst.ws.internal.consumption.sampleapp.command.JavaToModelCommand; import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.CopyWebServiceUtilsJarCommand; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; 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.ws.internal.datamodel.Model; import org.eclipse.wst.ws.internal.provisional.wsrt.TestInfo; -public class GSTCGenerateCommand extends SimpleCommand { +public class GSTCGenerateCommand extends EnvironmentalOperation +{ public static String INPUT = "Input.jsp"; public static String TEST_CLIENT = "TestClient.jsp"; @@ -38,13 +42,15 @@ public class GSTCGenerateCommand extends SimpleCommand { this.testInfo = testInfo; } - public Status execute(Environment env) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { - Status status = new SimpleStatus( "" ); + Environment env = getEnvironment(); + IStatus status = new SimpleStatus( "" ); CopyWebServiceUtilsJarCommand copy = new CopyWebServiceUtilsJarCommand(); copy.setSampleProject(testInfo.getGenerationProject()); copy.setSampleComponent(testInfo.getGenerationModule()); - status = copy.execute(env); + copy.setEnvironment( env ); + status = copy.execute( null, null); if (status.getSeverity() == Status.ERROR) return status; setJSPFolder(); status = createModel(env); @@ -81,9 +87,10 @@ public class GSTCGenerateCommand extends SimpleCommand { jtmc.setMethods(testInfo.getMethods()); jtmc.setClientProject(testInfo.getClientProject()); jtmc.setProxyBean(testInfo.getProxyBean()); - Status status = jtmc.execute(env); + jtmc.setEnvironment( env ); + Status status = EnvironmentUtils.convertIStatusToStatus(jtmc.execute( null, null)); if (status.getSeverity() == Status.ERROR) return status; - proxyModel = jtmc.getDataModel(); + proxyModel = jtmc.getJavaDataModel(); return status; } @@ -91,10 +98,9 @@ public class GSTCGenerateCommand extends SimpleCommand { * Generate the four jsps that make up this * sample app. */ - private Status generatePages(Environment env) + private IStatus generatePages(Environment env) { - Status status = new SimpleStatus( "" ); - IProject sampleIProject = ProjectUtilities.getProject(testInfo.getClientProject()); + IStatus status = new SimpleStatus( "" ); IPath fDestinationFolderPath = new Path(jspfolder); fDestinationFolderPath = fDestinationFolderPath.makeAbsolute(); IWorkspaceRoot fWorkspace = ResourcesPlugin.getWorkspace().getRoot(); @@ -104,7 +110,8 @@ public class GSTCGenerateCommand extends SimpleCommand { GeneratePageCommand gpcTest = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, new TestClientFileGenerator(INPUT,METHOD,RESULT),fileTest); //gpcTest.setStatusMonitor(getStatusMonitor()); - status = gpcTest.execute(env); + gpcTest.setEnvironment( env ); + status = gpcTest.execute( null, null ); if (status.getSeverity() == Status.ERROR ) return status; @@ -116,7 +123,8 @@ public class GSTCGenerateCommand extends SimpleCommand { GeneratePageCommand gpcInput = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, inputGenerator,fileInput); //gpcInput.setStatusMonitor(getStatusMonitor()); - status = gpcInput.execute(env); + gpcInput.setEnvironment( env ); + status = gpcInput.execute( null, null ); if (status.getSeverity() == Status.ERROR ) return status; @@ -128,7 +136,8 @@ public class GSTCGenerateCommand extends SimpleCommand { GeneratePageCommand gpcMethod = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, methodGenerator,fileMethod); //gpcMethod.setStatusMonitor(getStatusMonitor()); - status = gpcMethod.execute(env); + gpcMethod.setEnvironment( env ); + status = gpcMethod.execute( null, null ); if (status.getSeverity() == Status.ERROR ) return status; @@ -141,7 +150,8 @@ public class GSTCGenerateCommand extends SimpleCommand { rfg.setSetEndpointMethod(testInfo.getSetEndpointMethod()); GeneratePageCommand gpcResult = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, rfg,fileResult); - status = gpcResult.execute(env); + gpcResult.setEnvironment( env ); + status = gpcResult.execute( null, null ); return status; } diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCLaunchCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCLaunchCommand.java index ccf84469e..695013533 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCLaunchCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCLaunchCommand.java @@ -3,11 +3,14 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.wssample; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; - import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; import org.eclipse.jem.util.emf.workbench.ProjectUtilities; +import org.eclipse.jst.ws.internal.common.EnvironmentUtils; import org.eclipse.jst.ws.internal.common.J2EEUtils; import org.eclipse.jst.ws.internal.common.ServerUtils; import org.eclipse.jst.ws.internal.consumption.command.common.PublishProjectCommand; @@ -16,7 +19,7 @@ import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUI import org.eclipse.ui.PartInitException; import org.eclipse.ui.browser.IWebBrowser; import org.eclipse.ui.browser.IWorkbenchBrowserSupport; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; import org.eclipse.wst.command.internal.provisional.env.core.common.Log; import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; @@ -25,7 +28,8 @@ import org.eclipse.wst.command.internal.provisional.env.core.common.Status; import org.eclipse.wst.command.internal.provisional.env.core.common.StatusException; import org.eclipse.wst.ws.internal.provisional.wsrt.TestInfo; -public class GSTCLaunchCommand extends SimpleCommand { +public class GSTCLaunchCommand extends EnvironmentalOperation +{ public static String INPUT = "Input.jsp"; public static String TEST_CLIENT = "TestClient.jsp"; @@ -42,9 +46,12 @@ public class GSTCLaunchCommand extends SimpleCommand { msgUtils = new MessageUtils(pluginId + ".plugin", this); } - public Status execute(Environment env) - { - setJSPFolder(); + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) + { + Environment env = getEnvironment(); + + setJSPFolder(); + return launchSample(env); } private void setJSPFolder(){ @@ -76,12 +83,14 @@ public class GSTCLaunchCommand extends SimpleCommand { ppc.setServerTypeID(testInfo.getClientServerTypeID()); ppc.setExistingServer(testInfo.getClientExistingServer()); ppc.setProject(testInfo.getGenerationProject()); - status = ppc.execute(env); + ppc.setEnvironment( env ); + status = EnvironmentUtils.convertIStatusToStatus(ppc.execute( null, null )); StartServerCommand serverCommand = new StartServerCommand( true, true ); serverCommand.setServerInstanceId( testInfo.getClientExistingServer().getId() ); + serverCommand.setEnvironment( env ); - status = serverCommand.execute(env); + status = EnvironmentUtils.convertIStatusToStatus(serverCommand.execute(null, null)); if (status.getSeverity() == Status.ERROR) return status; IProject sampleProject = ProjectUtilities.getProject(testInfo.getGenerationProject()); diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/WSSampleFinishCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/WSSampleFinishCommand.java index c5f115111..3879329e4 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/WSSampleFinishCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/WSSampleFinishCommand.java @@ -15,12 +15,14 @@ import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.List; - import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; import org.eclipse.jst.ws.internal.common.EnvironmentUtils; import org.eclipse.jst.ws.internal.common.ResourceUtils; @@ -38,7 +40,7 @@ import org.eclipse.jst.ws.internal.ext.test.JavaProxyTestCommand; import org.eclipse.ui.PartInitException; import org.eclipse.ui.browser.IWebBrowser; import org.eclipse.ui.browser.IWorkbenchBrowserSupport; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; import org.eclipse.wst.command.internal.provisional.env.core.common.Log; import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; @@ -49,7 +51,7 @@ import org.eclipse.wst.command.internal.provisional.env.core.selection.BooleanSe import org.eclipse.wst.server.core.IServer; import org.eclipse.wst.ws.internal.datamodel.Model; -public class WSSampleFinishCommand extends SimpleCommand implements JavaProxyTestCommand +public class WSSampleFinishCommand extends EnvironmentalOperation implements JavaProxyTestCommand { public static String INPUT = "Input.jsp"; @@ -57,8 +59,6 @@ public class WSSampleFinishCommand extends SimpleCommand implements JavaProxyTes public static String RESULT = "Result.jsp"; public static String METHOD = "Method.jsp"; - private static String LABEL = "JavaBeanToSampleActiveTask"; - private static String DESCRIPTION = "default actions"; private MessageUtils msgUtils; private Model proxyModel; @@ -67,7 +67,6 @@ public class WSSampleFinishCommand extends SimpleCommand implements JavaProxyTes private String clientProject; - private String qname; private String jspFolder; private boolean runClientTest; private String sampleProject; @@ -83,17 +82,18 @@ public class WSSampleFinishCommand extends SimpleCommand implements JavaProxyTes { String pluginId = "org.eclipse.jst.ws.consumption.ui"; msgUtils = new MessageUtils(pluginId + ".plugin", this); - setDescription(DESCRIPTION); - setName(LABEL); } - public Status execute(Environment env) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { + Environment env = getEnvironment(); + Status status = new SimpleStatus( "" ); //setters and getters to be removed CopyWebServiceUtilsJarCommand copy = new CopyWebServiceUtilsJarCommand(); copy.setSampleProject(sampleProject); - status = copy.execute(env); + copy.setEnvironment( env ); + status = EnvironmentUtils.convertIStatusToStatus(copy.execute( null, null ) ); if (status.getSeverity() == Status.ERROR) return status; status = createModel(env); if (status.getSeverity() == Status.ERROR) return status; @@ -121,7 +121,8 @@ public class WSSampleFinishCommand extends SimpleCommand implements JavaProxyTes GeneratePageCommand gpcTest = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, new TestClientFileGenerator(INPUT,METHOD,RESULT),fileTest); //gpcTest.setStatusMonitor(getStatusMonitor()); - status = gpcTest.execute(env); + gpcTest.setEnvironment( env ); + status = EnvironmentUtils.convertIStatusToStatus(gpcTest.execute( null, null ) ); if (status.getSeverity() == Status.ERROR ) return status; @@ -133,7 +134,8 @@ public class WSSampleFinishCommand extends SimpleCommand implements JavaProxyTes GeneratePageCommand gpcInput = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, inputGenerator,fileInput); //gpcInput.setStatusMonitor(getStatusMonitor()); - status = gpcInput.execute(env); + gpcInput.setEnvironment( env ); + status = EnvironmentUtils.convertIStatusToStatus(gpcInput.execute( null, null )); if (status.getSeverity() == Status.ERROR ) return status; @@ -145,7 +147,8 @@ public class WSSampleFinishCommand extends SimpleCommand implements JavaProxyTes GeneratePageCommand gpcMethod = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, methodGenerator,fileMethod); //gpcMethod.setStatusMonitor(getStatusMonitor()); - status = gpcMethod.execute(env); + gpcMethod.setEnvironment( env ); + status = EnvironmentUtils.convertIStatusToStatus(gpcMethod.execute( null, null )); if (status.getSeverity() == Status.ERROR ) return status; @@ -159,7 +162,8 @@ public class WSSampleFinishCommand extends SimpleCommand implements JavaProxyTes GeneratePageCommand gpcResult = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, rfg,fileResult); //gpcResult.setStatusMonitor(getStatusMonitor()); - status = gpcResult.execute(env); + gpcResult.setEnvironment( env ); + status = EnvironmentUtils.convertIStatusToStatus(gpcResult.execute( null, null )); return status; } @@ -178,7 +182,8 @@ public class WSSampleFinishCommand extends SimpleCommand implements JavaProxyTes ppc.setServerTypeID(sampleServerTypeID); ppc.setExistingServer(sampleExistingServer); ppc.setProject(sampleProject); - status = ppc.execute(env); + ppc.setEnvironment( env ); + status = EnvironmentUtils.convertIStatusToStatus(ppc.execute( null, null )); StartProjectCommand spc = new StartProjectCommand(false ); spc.setServiceServerTypeID(sampleServerTypeID); @@ -186,8 +191,9 @@ public class WSSampleFinishCommand extends SimpleCommand implements JavaProxyTes IProject project = (IProject) ResourceUtils.findResource(sampleProject); spc.setSampleProject(project); spc.setIsWebProjectStartupRequested(true); + spc.setEnvironment( env ); - status = spc.execute(env); + status = EnvironmentUtils.convertIStatusToStatus(spc.execute( null, null )); if (status.getSeverity() == Status.ERROR) return status; IPath newPath = new Path(ResourceUtils.getWebProjectURL(ResourceUtils.getProjectOf(fDestinationFolderPath),sampleServerTypeID,sampleExistingServer)); @@ -260,11 +266,12 @@ public class WSSampleFinishCommand extends SimpleCommand implements JavaProxyTes jtmc.setMethods(methods); jtmc.setClientProject(clientProject); jtmc.setProxyBean(proxyBean); + jtmc.setEnvironment( env ); //jtmc.setStatusMonitor(getStatusMonitor()); - Status status = jtmc.execute(env); + Status status = EnvironmentUtils.convertIStatusToStatus(jtmc.execute(null, null)); if (status.getSeverity() == Status.ERROR) return status; - proxyModel = jtmc.getDataModel(); + proxyModel = jtmc.getJavaDataModel(); return status; } diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/WebServiceWSSampleExecutable.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/WebServiceWSSampleExecutable.java index bec34011c..9d067403a 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/WebServiceWSSampleExecutable.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/WebServiceWSSampleExecutable.java @@ -12,7 +12,7 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.wssample; import org.eclipse.jst.ws.internal.ext.WebServiceExecutable; -import org.eclipse.jst.ws.internal.ext.WebServiceFinishCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; /** * This is the interface for objects that represent a kind of @@ -23,7 +23,7 @@ public class WebServiceWSSampleExecutable implements WebServiceExecutable { - public WebServiceFinishCommand getFinishCommand() + public EnvironmentalOperation getFinishCommand() { return new WSSampleFinishCommand(); } diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/ClientProjectTypeRegistry.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/ClientProjectTypeRegistry.java deleted file mode 100644 index daf6c46ef..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/ClientProjectTypeRegistry.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.StringTokenizer; -import java.util.Vector; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; - -public class ClientProjectTypeRegistry -{ - private static ClientProjectTypeRegistry instance_; - private IConfigurationElement[] configElements_; - - private ClientProjectTypeRegistry() - { - init(); - } - - /** - * Returns a singleton instance of this class. - * @return A singleton ClientProjectTypeRegistry object. - */ - public static ClientProjectTypeRegistry getInstance() - { - if (instance_ == null) - instance_ = new ClientProjectTypeRegistry(); - return instance_; - } - - public void init() - { - IExtensionRegistry reg = Platform.getExtensionRegistry(); - configElements_ = reg.getConfigurationElementsFor("org.eclipse.jst.ws.consumption.ui", "clientProjectType"); - } - - public IConfigurationElement getDefaultElement() - { - return getElementById("org.eclipse.jst.ws.consumption.ui.clientProjectType.Web"); - } - - public IConfigurationElement getElementById(String id) - { - return getElementByAttribute("id", id); - } - - public IConfigurationElement getElementByLabel(String label) - { - return getElementByAttribute("label", label); - } - - public IConfigurationElement getElementByProject(IProject project) - { - for (int i = 0; i < configElements_.length; i++) - if (include(project, configElements_[i].getAttribute("include")) && exclude(project, configElements_[i].getAttribute("exclude"))) - return configElements_[i]; - return null; - } - - private IConfigurationElement getElementByAttribute(String name, String value) - { - for (int i = 0; i < configElements_.length; i++) - if (configElements_[i].getAttribute(name).equals(value)) - return configElements_[i]; - return null; - } - - public IProject[] getProjects(String id) - { - Vector v = new Vector(); - IConfigurationElement element = getElementById(id); - if (element != null) - { - IProject[] workspaceProjs = ResourceUtils.getWorkspaceRoot().getProjects(); - IVirtualComponent[] comps = J2EEUtils.getAllComponents(); - for (int i = 0; i < comps.length; i++) { - // TODO: Needs to be refactored to work with project/module topology described in XP - //if (include(workspaceProjs[i], element.getAttribute("include")) && exclude(workspaceProjs[i], element.getAttribute("exclude"))) - // Note: Adding a project if the project contains a web or ejb module. - if (J2EEUtils.isWebComponent(comps[i].getProject(), comps[i].getName()) - || J2EEUtils.isEJBComponent(comps[i].getProject(), comps[i].getName())) { - v.add(comps[i].getProject()); - } - } - } - IProject[] projects = new IProject[v.size()]; - v.copyInto(projects); - return projects; - } - - private boolean include(IProject project, String include) - { - StringTokenizer st = new StringTokenizer(include); - while(st.hasMoreTokens()) - { - try - { - if (project.hasNature(st.nextToken())) - return true; - } - catch (CoreException ce) - { - } - } - return false; - } - - private boolean exclude(IProject project, String exclude) - { - StringTokenizer st = new StringTokenizer(exclude); - while(st.hasMoreTokens()) - { - try - { - if (project.hasNature(st.nextToken())) - return false; - } - catch (CoreException ce) - { - } - } - return true; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/IWebServiceRuntime.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/IWebServiceRuntime.java deleted file mode 100644 index 23c7d93f8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/IWebServiceRuntime.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * 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 org.eclipse.core.runtime.IConfigurationElement; - -/** -* This is the interface for objects that represent a kind of -* Web Service artifact. -*/ -public interface IWebServiceRuntime -{ - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - /** - * Returns the id of this Web Service runtime. - * @return id of this Web Service runtime. - */ - public String getId (); - - /** - * Returns a locale specific description of this Web Service runtime. - * @return A locale specific description of this Web Service runtime. - */ - public String getDescription (); - - /** - * Returns a short, locale specific Label of this Web Service runtime. - * @return A short, locale specific Label of this Web Service runtime. - */ - public String getLabel (); - - /** - * Returns a String, J2EE version - * @return - */ - public String[] getJ2EEVersions(); - - /** - * Returns the configuration element associated with - * this runtime. - * - * @return org.eclipse.core.runtime.IConfigurationElement - */ - public IConfigurationElement getConfigurationElement(); - -} - diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/IWebServiceServer.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/IWebServiceServer.java deleted file mode 100644 index 580d96036..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/IWebServiceServer.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * 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 org.eclipse.core.runtime.IConfigurationElement; - -/** -* This is the interface for objects that represent a kind of -* Web Service artifact. The primary purpose of a WebServiceType -* object is to manufacture the wizard pages that support the type. -*/ -public interface IWebServiceServer -{ - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - /** - * Returns the id of this Web Service type. - * @return id of this Web Service type. - */ - public String getId (); - /** - * Returns a short, locale specific name of this Web Service type. - * @return A short, locale specific name of this Web Service type. - */ - public String getFactoryId (); - - /** - * Returns a short, locale specific name of this Web Service type. - * @return A short, locale specific name of this Web Service type. - */ - public String getLabel (); - - /** - * Returns true if set true in plugin.xml - * @return boolean - */ - public boolean getIsDefault(); - - /** - * Returns runtime target Id - * @return String - */ - public String getRuntimeTypeId(); - - /** - * Returns the configuration element associated with - * this runtime. - * - * @return org.eclipse.core.runtime.IConfigurationElement - */ - public IConfigurationElement getConfigurationElement(); - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/IWebServiceType.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/IWebServiceType.java deleted file mode 100644 index b149698b2..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/IWebServiceType.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * 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 org.eclipse.core.runtime.IConfigurationElement; - -/** -* This is the interface for objects that represent a kind of -* Web Service artifact. The primary purpose of a WebServiceType -* object is to manufacture the wizard pages that support the type. -*/ -public interface IWebServiceType -{ - /** - * Returns the id of this Web Service type. - * @return id of this Web Service type. - */ - public String getId (); - /** - * Returns a short, locale specific name of this Web Service type. - * @return A short, locale specific name of this Web Service type. - */ - public String getLabel (); - - /** - * Returns a locale specific description of this Web Service type's extension metadata. - * @return A locale specific description of this Web Service type's extension metadata. - */ - public String[] getExtensionMetadata (); - - /** - * Returns a locale specific description of this Web Service type's resource metadata. - * @return A locale specific description of this Web Service type's resource metadata. - */ - public String[] getResourceTypeMetadata (); - - /** - * Returns true if the plugin.xml contains an attribute of "canFinish" with a value of true. Otherwise, - * false is returned. Note: if the "canFinish" attribute is not specified true is returned by default. - * @return Returns whether or not the user can finish on the pages before the web service type pages. - */ - public boolean getCanFinish(); - - /** - * Returns the configuration element associated with - * this runtime. - * - * @return org.eclipse.core.runtime.IConfigurationElement - */ - public IConfigurationElement getConfigurationElement(); - - public String getObjectSelectionWidget(); -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionFilter.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionFilter.java index 8bd1b5d5b..f73ad1eff 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionFilter.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionFilter.java @@ -33,83 +33,6 @@ public class TypeSelectionFilter private IStructuredSelection initSelection_; - /* - * @deprecated should be removed - */ - public String[] getWebServiceTypeByInitialSelection(IStructuredSelection initialSelection, HashMap webServiceTypes) - { - - HashSet supportedTypes = new HashSet(); - 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 = webServiceTypes.values().iterator(); - while (iter.hasNext()) - { - IWebServiceType wst = (IWebServiceType)iter.next(); - String typeId = (String)wst.getId(); - if (!supportedTypes.contains(typeId)) - { - String[] resourceTypes = wst.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 = wst.getExtensionMetadata(); - if (acceptsName(name, extensions)) - { - supportedTypes.add(typeId); - } - } - - } - } - } - } - - } - - if (supportedTypes.isEmpty()) - return null; - else - { - return (String[])supportedTypes.toArray(new String[0]); - } - } - public String[] getWebServiceTypeByInitialSelection(IStructuredSelection initialSelection, ArrayList webServiceTypeList) { diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceClientTypeRegistry.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceClientTypeRegistry.java deleted file mode 100644 index 670b4da07..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceClientTypeRegistry.java +++ /dev/null @@ -1,660 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Vector; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.ws.internal.consumption.fragments.ClientPreAssemblyFragment; -import org.eclipse.jst.ws.internal.consumption.fragments.ClientPreDeployFragment; -import org.eclipse.jst.ws.internal.consumption.fragments.ClientPreDevelopFragment; -import org.eclipse.jst.ws.internal.consumption.fragments.ClientPreInstallFragment; -import org.eclipse.jst.ws.internal.data.LabelsAndIds; -import org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentFactoryFactory; -import org.eclipse.wst.command.internal.env.core.registry.CommandRegistry; -import org.eclipse.wst.command.internal.env.ui.widgets.CanFinishRegistry; -import org.eclipse.wst.command.internal.env.ui.widgets.CommandWidgetBinding; -import org.eclipse.wst.command.internal.env.ui.widgets.CommandWidgetBindingList; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetRegistry; -import org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.IServerType; -import org.eclipse.wst.server.core.ServerCore; - -public class WebServiceClientTypeRegistry implements CommandRegistry -{ - private static WebServiceClientTypeRegistry instance_; - - private Vector configElems_; - private HashSet typeNames_; // no duplicate client type names - private HashMap types_; - private HashMap clientTypeAndIds_; - private HashMap clientIdToLabel_; - - private HashMap webServiceServers; - private HashMap webServiceRuntimes; - private HashMap webServiceClientTypes; - - private DataMappingRegistry dataMappingRegistry_; - private WidgetRegistry widgetRegistry_; - private CanFinishRegistry canFinishRegistry_; - private HashMap factoryCache_; - - private WebServiceClientTypeRegistry() - { - } - - // - // Loads WebServiceClientType objects into this registry. - // This is done by querying the plugin registry for all extensions - // hanging on the webServiceClientType extension point. Extensions - // must implement the org.eclipse.jst.ws.ui.wizard.WebServiceClientType - // interface. - // - private void loadTypes () - { - IExtensionRegistry reg = Platform.getExtensionRegistry(); - IConfigurationElement[] config = reg.getConfigurationElementsFor( - "org.eclipse.jst.ws.consumption.ui", - "webServiceClientType"); - - for(int idx=0; idx<config.length; idx++) - { - IConfigurationElement elem = config[idx]; - - if (elem.getName().equals("webServiceServer")) { - WebServiceServer wss = new WebServiceServer(elem); - webServiceServers.put(elem.getAttribute("id"), wss); - } - else if (elem.getName().equals("webServiceRuntime")) { - WebServiceRuntime rt = new WebServiceRuntime(elem); - webServiceRuntimes.put(elem.getAttribute("id"), rt); - } - else if (elem.getName().equals("webServiceClientType")) - { - - String name = elem.getAttribute( "name" ); - typeNames_.add( name ); - - String typeId = elem.getAttribute("clientType"); - if (typeId==null) { - typeId = name; - } - - String id = elem.getAttribute("id"); - clientTypeAndIds_.put(name, typeId); - String serverId = elem.getAttribute("server"); - String runtimeId = elem.getAttribute("runtime"); - WebServiceServerRuntimeClientType wst = new WebServiceServerRuntimeClientType(serverId, runtimeId, typeId, name, elem); - webServiceClientTypes.put(id, wst); - types_.put(id, null ); - clientIdToLabel_.put( typeId, name ); - } - configElems_.add( elem ); - - } - } - - - /** - * Loads WebServiceClientType objects into this registry. - * See method getInstance(). - */ - private void load () - { - typeNames_ = new HashSet(); - configElems_ = new Vector(); - types_ = new HashMap(); - clientTypeAndIds_ = new HashMap(); - webServiceClientTypes = new HashMap(); - webServiceRuntimes = new HashMap(); - webServiceServers = new HashMap(); - clientIdToLabel_ = new HashMap(); - loadTypes(); - } - - /** - * Returns a singleton instance of this class. - * @return A singleton WebServiceClientTypeRegistry object. - */ - public static WebServiceClientTypeRegistry getInstance() - { - if (instance_ == null) - { - instance_ = new WebServiceClientTypeRegistry(); - instance_.load(); - } - return instance_; - } - - public WebServiceRuntime getRuntimeById( String id ) - { - return (WebServiceRuntime)webServiceRuntimes.get( id ); - } - - public String[] getRuntimesByType(String typeId) - { - IConfigurationElement[] elems = getConfigurationElement(typeId); - Vector runtimesVector = new Vector(); - String[] runtimeIds = new String[elems.length]; - for (int i=0; i<elems.length; i++) - { - IConfigurationElement elem = (IConfigurationElement)elems[i]; - runtimeIds[i] = elem.getAttribute("runtime"); - } - return runtimeIds; - } - - public boolean doesRuntimeSupportJ2EELevel(String j2eeVersionId, String runtimeId) - { - IWebServiceRuntime wsr = (IWebServiceRuntime)webServiceRuntimes.get(runtimeId); - String[] j2eeVersions = wsr.getJ2EEVersions(); - if (j2eeVersions==null || j2eeVersions.length==0) - return true; - - for(int i=0; i<j2eeVersions.length; i++) - { - if (j2eeVersions[i].equals(j2eeVersionId)) - { - return true; - } - } - return false; - } - - public boolean doesRuntimeSupportServerTarget(String serverTargetId, String runtimeId) - { - //Vector serverFactoryIds = new Vector(); - Iterator it = webServiceClientTypes.values().iterator(); - while (it.hasNext()) { - WebServiceServerRuntimeClientType wssrt = (WebServiceServerRuntimeClientType)it.next(); - if (wssrt.runtimeId_!=null) { - if ((wssrt.runtimeId_).equalsIgnoreCase(runtimeId)) { - WebServiceServer wss = (WebServiceServer)webServiceServers.get(wssrt.serverId_); - String thisFactoryId = wss.getFactoryId(); - IServerType serverType = ServerCore.findServerType(thisFactoryId); - if (serverType == null) - continue; - - String thisServerTargetId = serverType.getRuntimeType().getId(); - if (thisServerTargetId.equals(serverTargetId)) - return true; - } - } - } - return false; - } - - /** - * Returns the names of all registered <code>WebServiceClientType</code> - * objects. - * @return The names of all registered <code>WebServiceClientType</code> - * objects. - */ - public String[] getWebServiceClientTypeNames () - { - return (String[])typeNames_.toArray( new String[0] ); - } - - public LabelsAndIds getClientTypeLabels() - { - LabelsAndIds labelIds = new LabelsAndIds(); - Iterator iterator = clientIdToLabel_.entrySet().iterator(); - int size = clientIdToLabel_.size(); - String[] labels = new String[size]; - String[] ids = new String[size]; - int index = 0; - - labelIds.setLabels_( labels ); - labelIds.setIds_( ids ); - - while( iterator.hasNext() ) - { - Map.Entry entry = (Map.Entry)iterator.next(); - - ids[index] = (String)entry.getKey(); - labels[index] = (String)entry.getValue(); - index++; - } - - return labelIds; - } - - /** - * Returns the IConfigurationElement given the server, runtime, and type attributes - * The benefit of getting the IConfigurationElement is that the corresponding class - * file and plugin are not loaded immediately. - * @param server label - * @param runtime label - * @param type label - * @return IConfiguration element - */ - public IConfigurationElement getConfigurationElementFor(String serverId, String runtimeId, String typeId) - { - Iterator iter = webServiceClientTypes.values().iterator(); - while (iter.hasNext()) - { - WebServiceServerRuntimeClientType wssrt = (WebServiceServerRuntimeClientType)iter.next(); - if (wssrt.hasConfigurationElementFor(serverId, runtimeId, typeId)) { - return wssrt.element_; - } - } - return null; - } - - public IConfigurationElement getConfigElementFor(String factoryId, String runtimeId, String typeId) - { - Iterator iter = webServiceClientTypes.values().iterator(); - while (iter.hasNext()) - { - WebServiceServerRuntimeClientType wssrt = (WebServiceServerRuntimeClientType)iter.next(); - if (wssrt.hasConfigElementFor(factoryId, runtimeId, typeId)) { - return wssrt.element_; - } - } - return null; - } - - public String getClientExtensionIdFor(String serverId, String runtimeId, String typeId) { - IConfigurationElement element = getConfigurationElementFor(serverId, runtimeId, typeId); - return element.getAttribute("id"); - } - - public IConfigurationElement getConfigurationElementById(String id) { - - WebServiceServerRuntimeClientType wsrt = (WebServiceServerRuntimeClientType)webServiceClientTypes.get(id); - return (IConfigurationElement)wsrt.element_; - - } - - public IConfigurationElement[] getConfigurationElement(String clientTypeId) - { - Vector v = new Vector(); - for (Iterator it = configElems_.iterator(); it.hasNext();) - { - IConfigurationElement element = (IConfigurationElement)it.next(); - String clientType = element.getAttribute("clientType"); - if (clientType != null && clientType.equals(clientTypeId)) - v.add(element); - } - return (IConfigurationElement[])v.toArray(new IConfigurationElement[0]); - } - - public IConfigurationElement[] getConfigurationElement(String clientTypeId, String runtimeId) - { - Vector v = new Vector(); - for (Iterator it = configElems_.iterator(); it.hasNext();) - { - IConfigurationElement element = (IConfigurationElement)it.next(); - String clientType = element.getAttribute("clientType"); - String runtime = element.getAttribute("runtime"); - if (clientType != null && runtime != null && clientType.equals(clientTypeId) && runtime.equals(runtimeId)) - v.add(element); - } - return (IConfigurationElement[])v.toArray(new IConfigurationElement[0]); - } - - - - public String getServerIdForFactoryId(String factoryId) { - - Iterator iter = webServiceServers.values().iterator(); - while (iter.hasNext()) { - WebServiceServer wss = (WebServiceServer)iter.next(); - if (wss.getFactoryId().equals(factoryId)) { - return wss.getId(); - } - } - return null; - - } - - public String getServerFactoryIdByServerLabel(String label) { - Iterator iter = webServiceServers.values().iterator(); - while (iter.hasNext()) { - WebServiceServer wss = (WebServiceServer)iter.next(); - if (wss.getLabel().equals(label)) { - return wss.getFactoryId(); - } - } - return null; - } - - public WebServiceRuntime getWebServiceRuntimeByName(String runtimeName) { - Iterator iter = webServiceRuntimes.values().iterator(); - while (iter.hasNext()) { - WebServiceRuntime wsr = (WebServiceRuntime)iter.next(); - if (wsr.getLabel().equals(runtimeName)) { - return wsr; - } - } - return null; - } - - public WebServiceServer getWebServiceServerByFactoryId(String factoryId) { - Iterator iter = webServiceServers.values().iterator(); - while (iter.hasNext()) { - WebServiceServer wss = (WebServiceServer)iter.next(); - if (wss.getFactoryId().equals(factoryId)) { - return wss; - } - } - return null; - } - - public String getServerInstanceLabelFromInstanceId( String instanceId ) - { - IServer server = ServerCore.findServer( instanceId ); - - return server.getName(); - } - - public String[] getAllClientServerFactoryIds() { - String[] serverFactoryIds = new String[webServiceServers.size()]; - int i=0; - Iterator iter = webServiceServers.values().iterator(); - while (iter.hasNext()) { - WebServiceServer wss = (WebServiceServer)iter.next(); - if (wss.getFactoryId()!=null) { - serverFactoryIds[i]=wss.getFactoryId(); - i++; - } - } - return serverFactoryIds; - } - - public String[] getAllClientRuntimes() { - String[] runtimes = new String[webServiceRuntimes.size()]; - int i=0; - Iterator iter = webServiceRuntimes.values().iterator(); - while (iter.hasNext()) { - WebServiceRuntime wsr = (WebServiceRuntime)iter.next(); - if (wsr.getId() != null) { - runtimes[i]=wsr.getId(); - i++; - } - } - return runtimes; - } - - public String getRuntimeLabelById(String runtimeId) { - WebServiceRuntime wsRuntime = (WebServiceRuntime)webServiceRuntimes.get(runtimeId); - if (wsRuntime!=null) { - return wsRuntime.getLabel(); - } - return null; - } - - public String getClientTypeIdByName(String name) { - return (String)clientTypeAndIds_.get(name); - } - - public IWebServiceRuntime getWebServiceRuntimeById(String runtimeId) - { - return (IWebServiceRuntime)webServiceRuntimes.get(runtimeId); - } - - - /** - * Gets the runtime IDs of all web service server runtime type - * with an server factory ID equals to the input - * @param server factory ID - * @return array of runtime IDs - */ - public String[] getRuntimeIdsByServerFactoryId(String serverFactoryID) { - Vector runtimeIds = new Vector(); - Iterator it = webServiceClientTypes.values().iterator(); - while (it.hasNext()) { - WebServiceServerRuntimeClientType wssrt = (WebServiceServerRuntimeClientType)it.next(); - if (wssrt.serverId_!=null) { - String serverId = wssrt.serverId_; - WebServiceServer wss = (WebServiceServer)webServiceServers.get(serverId); - String wssfId = wss.getFactoryId(); - if (wssfId.equals(serverFactoryID)) - runtimeIds.add(wssrt.runtimeId_); - /* - String wssFactoryId = ((WebServiceServer)webServiceServers.get(wssrt.serverId_)).getFactoryId(); - if (wssFactoryId.equalsIgnoreCase(serverFactoryID)) { - runtimeIds.add(wssrt.runtimeId_); - } - */ - } - } - return (String[])runtimeIds.toArray(new String[0]); - } - - public String[] getServerFactoryIdsByClientType(String clientTypeName) { - - Vector factoryIds = new Vector(); - String clientTypeId = getClientTypeIdByName(clientTypeName); - Iterator iter = webServiceClientTypes.values().iterator(); - while (iter.hasNext()) - { - WebServiceServerRuntimeClientType wssrt = (WebServiceServerRuntimeClientType)iter.next(); - if ((wssrt.typeId_).equalsIgnoreCase(clientTypeId)) { - WebServiceServer wss = (WebServiceServer)webServiceServers.get(wssrt.serverId_); - factoryIds.add(wss.getFactoryId()); - } - - } - return (String[])factoryIds.toArray(new String[0]); - - } - - /** - * Gets the server factoryIds of all web service server runtime type - * with an runtime Id equals to the input - * @param runtime Id - * @return array of factory Ids - */ - public String[] getServerFactoryIdsByRuntimeId(String runtimeID) { - Vector serverFactoryIds = new Vector(); - Iterator it = webServiceClientTypes.values().iterator(); - while (it.hasNext()) { - WebServiceServerRuntimeClientType wssrt = (WebServiceServerRuntimeClientType)it.next(); - if (wssrt.runtimeId_!=null) { - if ((wssrt.runtimeId_).equalsIgnoreCase(runtimeID)) { - WebServiceServer wss = (WebServiceServer)webServiceServers.get(wssrt.serverId_); - serverFactoryIds.add(wss.getFactoryId()); - } - } - } - return (String[])serverFactoryIds.toArray(new String[0]); - } - - public boolean webServiceClientRuntimeTypeExists(String serverId, String runtimeId, String typeId) { - if (getConfigurationElementFor(serverId, runtimeId, typeId)==null) - return false; - return true; - - } - - public String[] getServerFactoryIdsByType(String clientTypeId) - { - String clientTypeName = (String)clientIdToLabel_.get(clientTypeId); - return getServerFactoryIdsByClientType(clientTypeName); - } - - public boolean isServerSupportedForChosenType(String clientTypeId, String serverFactoryID) - { - String[] supportedServerFactoryIds = getServerFactoryIdsByType(clientTypeId); - if (supportedServerFactoryIds!=null && supportedServerFactoryIds.length>0) - { - for (int i=0; i<supportedServerFactoryIds.length; i++) - { - if (supportedServerFactoryIds[i].equals(serverFactoryID)) - return true; - } - } - return false; - } - - /** - * WebServiceServerRuntimeClientType is the cached metadata including the IConfiguration - */ - public final class WebServiceServerRuntimeClientType - { - - private String typeId_ = null; - private String serverId_ = null; - private String runtimeId_ = null; - private IConfigurationElement element_; - private boolean requiresServerRuntime_ = false; - private String label_; - - protected WebServiceServerRuntimeClientType(String serverId, String runtimeId,String typeId, String label, IConfigurationElement elem) - { - typeId_ = new String(typeId.trim()); - if (serverId!=null) - serverId_ = new String(serverId.trim()); - if (runtimeId!=null) - runtimeId_ = new String(runtimeId.trim()); - element_ = elem; - if (serverId_!=null && runtimeId_!=null) { - requiresServerRuntime_ = true; - } - - label_ = label; - } - - public boolean hasConfigurationElementFor(String serverID, String runtimeID, String typeID) { - if (typeId_.equalsIgnoreCase(typeID) && !requiresServerRuntime_) - return true; - - if (requiresServerRuntime_) { - if (typeId_.equalsIgnoreCase(typeID) && - serverId_.equalsIgnoreCase(serverID) && - runtimeId_.equalsIgnoreCase(runtimeID)) - return true; - } - return false; - } - - public boolean hasConfigElementFor(String factoryID, String runtimeID, String typeID) { - if (typeId_.equalsIgnoreCase(typeID) && !requiresServerRuntime_) - return true; - - if (requiresServerRuntime_) - { - String serverID = getServerIdForFactoryId( factoryID ); - - if (typeId_.equalsIgnoreCase(typeID) && - serverId_.equalsIgnoreCase(serverID) && - runtimeId_.equalsIgnoreCase(runtimeID)) - return true; - } - return false; - } - - public IConfigurationElement getClientTypeConfigurationElementFor(String serverID, String runtimeID, String typeID) - { - if (this.typeId_.equalsIgnoreCase(typeID) && serverID==null && runtimeID==null) - return this.element_; - - if (this.typeId_.equalsIgnoreCase(typeID) && - this.serverId_.equalsIgnoreCase(serverID) && - this.runtimeId_.equalsIgnoreCase(runtimeID)) - return this.element_; - return null; - } - } - - public CommandFragmentFactoryFactory getFactoryFactory( String[] ids ) - { - String hashKey = ids[2] + "#" + ids[1] + "#" + ids[0]; - CommandWidgetBinding binding = (CommandWidgetBinding)factoryCache_.get( hashKey ); - - if( binding == null ) - { - IConfigurationElement element = getConfigElementFor( ids[2], ids[1], ids[0] ); - - if( element == null ) return null; - - binding = createBinding( element ); - - factoryCache_.put( hashKey, binding ); - - binding.registerDataMappings( dataMappingRegistry_ ); - - if( widgetRegistry_ != null ) - { - binding.registerWidgetMappings( widgetRegistry_ ); - binding.registerCanFinish( canFinishRegistry_ ); - } - } - - return binding; - } - - private CommandWidgetBinding createBinding(IConfigurationElement element ) - { - Vector bindings = new Vector(4); - Vector fragments = new Vector(4); - - addBinding( element, "developBinding", bindings ); - addBinding( element, "assemblyBinding", bindings ); - addBinding( element, "deployBinding", bindings ); - addBinding( element, "installBinding", bindings ); - - fragments.add( new ClientPreDevelopFragment() ); - fragments.add( new ClientPreAssemblyFragment() ); - fragments.add( new ClientPreDeployFragment() ); - fragments.add( new ClientPreInstallFragment() ); - - return new CommandWidgetBindingList( bindings, fragments ); - } - - private void addBinding( IConfigurationElement element, String bindingName, Vector list ) - { - Object binding = null; - - if( element.getAttribute( bindingName ) != null ) - { - try - { - binding = element.createExecutableExtension( bindingName ); - } - catch( CoreException exc ) - { - } - } - - list.add( binding ); - } - - public void setDataMappingRegistry( DataMappingRegistry registry ) - { - dataMappingRegistry_ = registry; - - // We need to rebuild the factory cache each time we start the client - // wizard. - factoryCache_ = new HashMap(); - } - - public void setWidgetRegistry( WidgetRegistry registry ) - { - widgetRegistry_ = registry;; - } - - public void setCanFinishRegistry( CanFinishRegistry registry ) - { - canFinishRegistry_ = registry; - } - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceRuntime.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceRuntime.java deleted file mode 100644 index 3b9eef606..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceRuntime.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * 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.StringTokenizer; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; - - -/** -* This is the interface for objects that represent a kind of -* Web Service artifact. -*/ -public class WebServiceRuntime implements IWebServiceRuntime -{ - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - private IConfigurationElement element_; - public String runtimeId_; - public String runtimeLabel_; - public String runtimeDescription_; - public String[] j2eeVersions; - - - public WebServiceRuntime(IConfigurationElement elem) - { - super(); - this.element_ = elem; - } - - /** - * Returns the id of this Web Service runtime. - * @return id of this Web Service runtime. - */ - public String getId () - { - if (runtimeId_ == null) - runtimeId_ = element_.getAttribute("id"); - return runtimeId_; - } - - - /** - * Returns a locale specific description of this Web Service runtime. - * @return A locale specific description of this Web Service runtime. - */ - public String getDescription () - { - if (runtimeDescription_ == null) - runtimeDescription_ = element_.getAttribute("description"); - return runtimeDescription_; - } - - /** - * Returns a short, locale specific Label of this Web Service runtime. - * @return A short, locale specific Label of this Web Service runtime. - */ - public String getLabel () - { - if (runtimeLabel_==null) - runtimeLabel_ = WebServiceConsumptionUIPlugin.getMessage((String)element_.getAttribute("label")); - return runtimeLabel_; - } - - /** - * Returns a True if this runtime has been set as default - * @return a boolean - */ - public boolean getIsDefault() - { - return Boolean.valueOf(element_.getAttribute("isDefault")).booleanValue(); - } - - /** - * Returns a String, J2EE version - * @return - */ - public String[] getJ2EEVersions() - { - if (j2eeVersions == null) - { - String attr = element_.getAttribute("j2eeversion"); - if (attr != null) - { - StringTokenizer st = new StringTokenizer(attr, " "); - int size = st.countTokens(); - j2eeVersions = new String[size]; - for (int i = 0; i < j2eeVersions.length; i++) - j2eeVersions[i] = st.nextToken(); - } - } - return j2eeVersions; - } - - /** - * Returns the configuration element associated with - * this runtime. - * - * @return org.eclipse.core.runtime.IConfigurationElement - */ - public IConfigurationElement getConfigurationElement() - { - return element_; - } - -} - - diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceServer.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceServer.java deleted file mode 100644 index b42e47ad9..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceServer.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * 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 org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.wst.server.core.IServerType; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.server.ui.ServerUICore; - -/** -* This is the interface for objects that represent a kind of -* Web Service artifact. The primary purpose of a WebServiceType -* object is to manufacture the wizard pages that support the type. -*/ -public class WebServiceServer implements IWebServiceServer -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - public IConfigurationElement element_; - public String serverId_; - public String factoryId_; - public String serverLabel_; - - public WebServiceServer(IConfigurationElement elem) - { - super(); - this.element_ = elem; - } - /** - * Returns the id of this Web Service type. - * @return id of this Web Service type. - */ - public String getId () - { - if (serverId_==null) - serverId_ = element_.getAttribute("id"); - return serverId_; - } - /** - * Returns a short, locale specific name of this Web Service type. - * @return A short, locale specific name of this Web Service type. - */ - public String getFactoryId () - { - if (factoryId_==null) - factoryId_ = element_.getAttribute("factoryId"); - return factoryId_; - } - - /** - * Returns a short, locale specific name of this Web Service type. - * @return A short, locale specific name of this Web Service type. - */ - public String getLabel () - { - if (serverLabel_ == null) - { - IServerType serverType = ServerCore.findServerType(getFactoryId()); - serverLabel_ = ServerUICore.getLabelProvider().getText(serverType); - } - return serverLabel_; - } - - /** - * Returns a True if this server has been set as default - * @return a boolean - */ - public boolean getIsDefault() - { - - return Boolean.valueOf(element_.getAttribute("isDefault")).booleanValue(); - } - - /** - * Returns runtime target Id - * @return String - */ - public String getRuntimeTypeId() - { - return element_.getAttribute("runtimeTypeIds"); - } - - /** - * Returns the configuration element associated with - * this type. - * - * @return org.eclipse.core.runtime.IConfigurationElement - */ - public IConfigurationElement getConfigurationElement() - { - return this.element_; - } - - } diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceServerRuntimeType.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceServerRuntimeType.java deleted file mode 100644 index df6e1d76b..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceServerRuntimeType.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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; - - -/** -* This is the interface for objects that represent a kind of -* Web Service-Server-Runtime artifact. The primary purpose of a WebServiceServerRuntimeType -* object is to manufacture the wizard pages that support the type, server, and runtime configuration. -*/ -public interface WebServiceServerRuntimeType -{ - /** - * Returns a short, locale specific name of this Web Service Server-Runtime type. - * @return A short, locale specific name of this Web Service Server-Runtime type. - */ - public String getName (); - - /** - * Returns a locale specific description of this Web Service Server-Runtime type. - * @return A locale specific description of this Web Service Server-Runtime type. - */ - public String getDescription (); - - /** - * Returns a label for the Server supported by this Web Service Server-Runtime type - * @return A server label from server plugins - */ - public String getServerLabel(); - - /** - * Sets a label for the Server supported by this Web Service Server-Runtime type - * @param A server label from server plugins - */ - public void setServerLabel(String serverLabel); - - /** - * Returns a label for the deployment runtime of this Web Service Server-Runtime type - * @return A label for the deployment runtime - */ - public String getRuntimeLabel(); - - /** - * Sets a label for the deployment runtime of this Web Service Server-Runtime type - * @param A label for the deployment runtime - */ - public void setRuntimeLabel(String runtimeLabel); - - /** - * Returns a label for the Web Service type associated with this WebServiceServerRuntimeType - * @return A label for the Web Service type - */ - public String getWebServiceTypeLabel(); - - /** - * Returns whether or not a Web Module is required for this WebServiceServerRuntimeType - * @return true if requireWebModule - */ - public boolean isWebModuleRequired(); - - /** - * Sets the boolean value at runtime according to requireWebModule attribute from the manifest file - * @param requireWebModule - */ - public void setWebModuleRequired(boolean requireWebModule); - - /** - * Returns whether or not an EJB Module is required for this WebServiceServerRuntimeType - * @return true is requireEJBModule is true - */ - public boolean isEJBModuleRequired(); - - /** - * Sets the boolean value at runtime according to requireEJBModule attribute from the manifest file - * @param requireEJBModule - */ - public void setEJBModuleRequired(boolean requireEJBModule); -} - - diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceServerRuntimeTypeRegistry.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceServerRuntimeTypeRegistry.java deleted file mode 100644 index ab46c7b88..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceServerRuntimeTypeRegistry.java +++ /dev/null @@ -1,1199 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.HashMap; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.StringTokenizer; -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.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.fragments.ServicePreAssemblyFragment; -import org.eclipse.jst.ws.internal.consumption.fragments.ServicePreDeployFragment; -import org.eclipse.jst.ws.internal.consumption.fragments.ServicePreDevelopFragment; -import org.eclipse.jst.ws.internal.consumption.fragments.ServicePreInstallFragment; -import org.eclipse.jst.ws.internal.data.LabelsAndIds; -import org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentFactoryFactory; -import org.eclipse.wst.command.internal.env.core.registry.CommandRegistry; -import org.eclipse.wst.command.internal.env.eclipse.EclipseLog; -import org.eclipse.wst.command.internal.env.ui.widgets.CanFinishRegistry; -import org.eclipse.wst.command.internal.env.ui.widgets.CommandWidgetBinding; -import org.eclipse.wst.command.internal.env.ui.widgets.CommandWidgetBindingList; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetRegistry; -import org.eclipse.wst.command.internal.provisional.env.core.common.Log; -import org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry; -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.server.core.IServerType; -import org.eclipse.wst.server.core.ServerCore; - -public class WebServiceServerRuntimeTypeRegistry implements CommandRegistry -{ - - private static WebServiceServerRuntimeTypeRegistry instance_; - - private IConfigurationElement[] indexedConfigElems_; - - private HashMap webServiceServers; - private HashMap webServiceRuntimes; - private HashMap webServiceTypes; - private HashMap webServiceServerRuntimeTypes; - - private Hashtable runtimesByType_; - private Hashtable runtimeLabelById_; - private Hashtable runtimeIdByLabel_; - private Hashtable serversByType_; - private Hashtable serverLabelByFactoryId_; - private Hashtable serverFactoryIdByLabel_; - - private Hashtable configElemsById_; - - private DataMappingRegistry dataMappingRegistry_; - private WidgetRegistry widgetRegistry_; - private CanFinishRegistry canFinishRegistry_; - private HashMap factoryCache_; - - private SelectionListChoices serverToRuntimeToJ2EE_; - private Log log_; - - public WebServiceServerRuntimeTypeRegistry() { - log_ = new EclipseLog(); - } - // - // Loads WebServiceServerRuntimeType objects into this registry. - // This is done by querying the plugin registry for all extensions - // hanging on the WebServiceServerRuntimeType extension point. Extensions - // must implement the org.eclipse.jst.ws.ui.wizard.WebServiceServerRuntimeType - // interface. - // - private void loadTypes () - { - IExtensionRegistry reg = Platform.getExtensionRegistry(); - IConfigurationElement[] config = reg.getConfigurationElementsFor( - "org.eclipse.jst.ws.consumption.ui", - "webServiceServerRuntimeType"); - - for(int idx=0; idx<config.length; idx++) - { - IConfigurationElement elem = config[idx]; - try - { - if (elem.getName().equals("webServiceServer")) - { - WebServiceServer wss = new WebServiceServer(elem); - webServiceServers.put(elem.getAttribute("id"), wss); - String serverLabel = wss.getLabel(); - if (serverLabel != null && serverLabel.length()>0) - { - if (!serverLabelByFactoryId_.containsKey(wss.getFactoryId())); - serverLabelByFactoryId_.put(wss.getFactoryId(), serverLabel); - if (!serverFactoryIdByLabel_.containsKey(serverLabel)); - serverFactoryIdByLabel_.put(serverLabel, wss.getFactoryId()); - } - - } - else if (elem.getName().equals("webServiceRuntime")) - { - WebServiceRuntime rt = new WebServiceRuntime(elem); - webServiceRuntimes.put(elem.getAttribute("id"), rt); - if(!runtimeLabelById_.containsKey(rt.getId())) - runtimeLabelById_.put(rt.getId(), rt.getLabel()); - if(!runtimeIdByLabel_.containsKey(rt.getLabel())) - runtimeIdByLabel_.put(rt.getLabel(), rt.getId()); - - } - else if (elem.getName().equals("webServiceType")) - { - WebServiceTypeImpl wst = new WebServiceTypeImpl(elem); - webServiceTypes.put(elem.getAttribute("id"), wst); - } - else if (elem.getName().equals("webServiceServerRuntimeType")) - { - configElemsById_.put(elem.getAttribute("id"), elem); - - String typeId = elem.getAttribute("type"); - String serverId = elem.getAttribute("server"); - String runtimeId = elem.getAttribute("runtime"); - WebServiceServerRuntimeType_ wssrt = new WebServiceServerRuntimeType_(serverId, runtimeId, typeId, elem); - webServiceServerRuntimeTypes.put(elem.getAttribute("id"), wssrt); - - setRuntimesByType(typeId,runtimeId); - setServersByType(typeId, serverId); - - } - - } - catch (Exception e) - { - log_.log(Log.ERROR, 5058, this, "loadTypes", e); - } - - } - } - - - /** - * Sets the Web service runtimes and type from each extension - * in a Hashtable. The type is the key, and value is a Vector containing - * each runtime supported in that Web service type. - * @param runtime name - * @param type name - */ - private void setRuntimesByType(String typeId, String runtime) - { - if(runtimesByType_.get(typeId)!=null) - { - Vector v = (Vector)runtimesByType_.get(typeId); - if (!v.contains(runtime.trim())) { - v.add(runtime.trim()); - } - } - else - { - Vector vect = new Vector(); - vect.add(runtime.trim()); - runtimesByType_.put(typeId,vect); - } - } - - public WebServiceRuntime getRuntimeById( String id ) - { - return (WebServiceRuntime)webServiceRuntimes.get( id ); - } - - /** - * Gets the Web sevice runtimes vector given a type - * @param Web service type - * @return array of runtime labels - */ - public String[] getRuntimesByType(String webServiceType) - { - String[] runtimes; - if (runtimesByType_.containsKey(webServiceType)) - { - Vector vect =(Vector)runtimesByType_.get(webServiceType); - runtimes = new String[vect.size()]; - for (int i=0; i<vect.size(); i++) - { - String runtimeId = (String)vect.elementAt(i); - WebServiceRuntime wsr = (WebServiceRuntime)webServiceRuntimes.get(runtimeId); - if (wsr!=null) { - runtimes[i] = (String)wsr.getId(); - } - } - return runtimes; - - } - else - { - log_.log(Log.ERROR, 5059, this, "getRuntimesByType", "runtimes not found for Web service type "+webServiceType); - return null; - } - - } - - public boolean isRuntimeSupportedForType(String webServiceTypeId, String runtimeId) - { - String[] runtimes = getRuntimesByType(webServiceTypeId); - for(int i=0;i<runtimes.length;i++) - { - if (runtimes[i].equals(runtimeId)) - return true; - } - return false; - } - - public boolean doesRuntimeSupportJ2EELevel(String j2eeVersionId, String runtimeId) - { - IWebServiceRuntime wsr = (IWebServiceRuntime)webServiceRuntimes.get(runtimeId); - String[] j2eeVersions = wsr.getJ2EEVersions(); - if (j2eeVersions==null || j2eeVersions.length==0) - return true; - - for(int i=0; i<j2eeVersions.length; i++) - { - if (j2eeVersions[i].equals(j2eeVersionId)) - { - return true; - } - } - return false; - } - - public boolean doesRuntimeSupportServerTarget(String serverTargetId, String runtimeId) - { - Iterator it = webServiceServerRuntimeTypes.values().iterator(); - while (it.hasNext()) - { - WebServiceServerRuntimeType_ wssrt = (WebServiceServerRuntimeType_)it.next(); - if (wssrt!=null) { - if (wssrt.runtimeId_.equals(runtimeId)) - { - IWebServiceServer wsserver = getWebServiceServerById(wssrt.serverId_); - String thisFactoryId = wsserver.getFactoryId(); - IServerType serverType = ServerCore.findServerType(thisFactoryId); - if (serverType == null) - continue; - - String thisServerTargetId = serverType.getRuntimeType().getId(); - if (thisServerTargetId.equals(serverTargetId)) - return true; - } - } - } - return false; - } - - /** - * Gets the server factoryIDs of all web service server runtime type - * with an runtime ID equals to the input - * @param runtime ID - * @return array of factory IDs - */ - public String[] getServerFactoryIDByRuntimeID(String runtimeID) { - Vector v = new Vector(); - Iterator it = webServiceServerRuntimeTypes.values().iterator(); - while (it.hasNext()) { - WebServiceServerRuntimeType_ wssrt = (WebServiceServerRuntimeType_)it.next(); - if (wssrt!=null) { - if (wssrt.runtimeId_.equals(runtimeID)) - v.add(getWebServiceServerById(wssrt.serverId_).getFactoryId()); - - } - } - String[] serverFactoryIDs = new String[v.size()]; - for (int i = 0; i < v.size(); i++) { - serverFactoryIDs[i] = (String)v.get(i); - } - return serverFactoryIDs; - } - - /** - * Gets the runtime IDs of all web service server runtime type - * with an server factory ID equals to the input - * @param server factory ID - * @return array of runtime IDs - */ - public String[] getRuntimeIDsByServerFactoryID(String serverFactoryID) { - Vector v = new Vector(); - Iterator it = webServiceServerRuntimeTypes.values().iterator(); - while (it.hasNext()) { - WebServiceServerRuntimeType_ wssrt = (WebServiceServerRuntimeType_)it.next(); - if (wssrt!=null) { - IWebServiceServer wss = getWebServiceServerById(wssrt.serverId_); - String wssfId = wss.getFactoryId(); - if (wssfId.equals(serverFactoryID)) - { - if (!v.contains(wssrt.runtimeId_)) - { - v.add(wssrt.runtimeId_); - } - } - /*if (getWebServiceServerById(wssrt.serverId_).getFactoryId().equals(serverFactoryID)) - v.add(getWebServiceRuntimeById(wssrt.runtimeId_).getId());*/ - } - } - String[] runtimeIDs = new String[v.size()]; - for (int i = 0; i < v.size(); i++) { - runtimeIDs[i] = (String)v.get(i); - } - return runtimeIDs; - } - - /** - * Sets the Web service servers and type from each extension - * in a Hashtable. The type is the key, and value is a Vector containing - * each runtime supported in that Web service type. - * @param server name - * @param type name - */ - private void setServersByType(String typeId, String server) - { - if(serversByType_.get(typeId)!=null) - { - Vector v = (Vector)serversByType_.get(typeId); - if (!v.contains(server.trim())) - { - v.add(server.trim()); - } - } - else - { - Vector vect = new Vector(); - vect.add(server.trim()); - serversByType_.put(typeId, vect); - } - - } - - /** - * Gets the Web service servers vector given a type - * @param Web service type - * @return array of server factory Ids - */ - public String[] getServerFactoryIdsByType(String webServiceType) - { - String[] servers; - if (serversByType_.containsKey(webServiceType)) - { - Vector vect = (Vector)serversByType_.get(webServiceType); - servers = new String[vect.size()]; - for (int i=0; i<vect.size(); i++) - { - String serverId = (String)vect.elementAt(i); - WebServiceServer wss = (WebServiceServer)webServiceServers.get(serverId); - if (wss!=null) { - servers[i] = (String)wss.getFactoryId(); //Note: returning server factory Ids - } - } - return servers; - } - else - { - log_.log(Log.ERROR, 5060, this, "getServerByType", "Web service server not found for Web service type "+webServiceType); - return null; - } - - } - - public IWebServiceRuntime getWebServiceRuntimeByLabel(String runtimeLabel) - { - Iterator iter = webServiceRuntimes.values().iterator(); - while (iter.hasNext()) - { - WebServiceRuntime wsr = (WebServiceRuntime)iter.next(); - if (wsr!=null) { - if (runtimeLabel.equals(wsr.getLabel())) - return wsr; - } - } - return null; - } - - public IWebServiceRuntime getWebServiceRuntimeById(String runtimeId) - { - return (IWebServiceRuntime)webServiceRuntimes.get(runtimeId); - } - - public IWebServiceServer getWebServiceServerByFactoryId(String serverFactoryId) - { - if (serverFactoryId==null) - return null; - - Iterator iter = webServiceServers.values().iterator(); - while (iter.hasNext()) - { - WebServiceServer wss = (WebServiceServer)iter.next(); - if (wss!=null && wss.getFactoryId()!=null) { - if (serverFactoryId.equals(wss.getFactoryId())) { - return wss; - } - } - } - return null; - - } - - public IWebServiceServer getWebServiceServerByLabel(String serverLabel) - { - if (serverLabel==null) - return null; - - Iterator iter = webServiceServers.values().iterator(); - while (iter.hasNext()) - { - WebServiceServer wss = (WebServiceServer)iter.next(); - if (wss!=null) { - if (serverLabel.equals(wss.getLabel())) - return wss; - } - } - return null; - - } - - public IWebServiceServer getWebServiceServerById(String serverId) - { - return (IWebServiceServer)webServiceServers.get(serverId); - } - - public IWebServiceType getWebServiceTypeByLabel(String typeLabel) - { - Iterator iter = webServiceTypes.values().iterator(); - while (iter.hasNext()) - { - WebServiceTypeImpl wst = (WebServiceTypeImpl)iter.next(); - if (wst!=null) { - if (typeLabel.equals(wst.getLabel())) - return wst; - } - } - return null; - } - - public IWebServiceType getWebServiceTypeById(String typeId) - { - if (webServiceTypes.get(typeId)!= null) - return (WebServiceTypeImpl)webServiceTypes.get(typeId); - return null; - } - - /** - * Returns true if an EJB project is needed to host a Web service - * of the type identified by typeId. If multiple natureIds are specified in the - * "includeNatures" attribute, only the first one is checked. If no natureIds are specified, - * false is returned. - * - * @deprecated - * Should be refactored in future - */ -// public boolean requiresEJBProject(String typeId) -// { -// IWebServiceType wst = WebServiceServerRuntimeTypeRegistry.getInstance().getWebServiceTypeById(typeId); -// if (wst != null) -// { -// IConfigurationElement elem = wst.getConfigurationElement(); -// String includedNatures = elem.getAttribute("includeNatures"); -// if (includedNatures==null || includedNatures.length()==0) -// { -// return false; -// } -// else -// { -// StringTokenizer st = new StringTokenizer(includedNatures); -// if(st.hasMoreTokens()) -// { -// String firstIncludedNature = st.nextToken(); -// if (firstIncludedNature.equals(IEJBNatureConstants.NATURE_ID)) -// return true; -// } -// } -// } -// return false; -// } - - /** - * Returns a list of valid projects for the Web service type with an id of typeId. - * In the case where the Web service type extension does not specify which project - * natures are included, a array of all Web and EJB projects in the workspace will - * be returned. - * @param typeId - * @return IProject[] an array of valid projects - */ - public IProject[] getProjectsByWebServiceType(String typeId) - { - IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); - ArrayList validProjects = new ArrayList(); -// IWebServiceType wst = WebServiceServerRuntimeTypeRegistry.getInstance().getWebServiceTypeById(typeId); -// if (wst != null) -// { - - //TODO: This section needs to be refactored to filter ArtifactEdits - // and uphold project topology described in the extension - -// IConfigurationElement elem = wst.getConfigurationElement(); -// String includedNatures = elem.getAttribute("includeNatures"); -// String excludedNatures = elem.getAttribute("excludeNatures"); -// if (includedNatures!=null && includedNatures.length()>0) -// { -// for (int i = 0; i < projects.length; i++) -// { -// if (include(projects[i], includedNatures) && exclude(projects[i], excludedNatures)) -// validProjects.add(projects[i]); -// } -// return (IProject[])validProjects.toArray(new IProject[0]); -// } -// } - - //If wst was null or the extension didn't specify which project natures are - // to be included, revert to the old behaviour - for (int j = 0; j < projects.length; j++) - { - if (ResourceUtils.isWebProject(projects[j]) || ResourceUtils.isEJBProject(projects[j])) - validProjects.add(projects[j]); - } - return (IProject[])validProjects.toArray(new IProject[0]); - } - - private boolean include(IProject project, String include) - { - StringTokenizer st = new StringTokenizer(include); - while(st.hasMoreTokens()) - { - try - { - if (project.hasNature(st.nextToken())) - return true; - } - catch (CoreException ce) - { - } - } - return false; - } - - private boolean exclude(IProject project, String exclude) - { - StringTokenizer st = new StringTokenizer(exclude); - while(st.hasMoreTokens()) - { - try - { - if (project.hasNature(st.nextToken())) - return false; - } - catch (CoreException ce) - { - } - } - return true; - } - - // - // Loads WebServiceServerRuntimeType objects into this registry. - // See method getInstance(). - // - private void load () - { - runtimesByType_ = new Hashtable(); - serversByType_ = new Hashtable(); - configElemsById_ = new Hashtable(); - runtimeIdByLabel_ = new Hashtable(); - runtimeLabelById_ = new Hashtable(); - serverFactoryIdByLabel_ = new Hashtable(); - serverLabelByFactoryId_ = new Hashtable(); - - webServiceServers = new HashMap(); - webServiceRuntimes = new HashMap(); - webServiceTypes = new HashMap(); - - webServiceServerRuntimeTypes = new HashMap(); - - loadTypes(); - } - - /** - * Returns a singleton instance of this class. - * @return A singleton WebServiceServerRuntimeTypeRegistry object. - */ - public static WebServiceServerRuntimeTypeRegistry getInstance () - { - if (instance_ == null) - { - instance_ = new WebServiceServerRuntimeTypeRegistry(); - instance_.load(); - } - return instance_; - } - - /** - * Returns the Web Service type names of all registered <code>WebServiceServerRuntimeType</code> - * objects. - * @return The Web Service type names of all registered <code>WebServiceServerRuntimeType</code> - * objects. - */ - public String[] getWebServiceTypeNames() - { - - String[] types = new String[webServiceTypes.size()]; - - int i=0; - Iterator iter = webServiceTypes.values().iterator(); - while (iter.hasNext()) - { - WebServiceTypeImpl wst = (WebServiceTypeImpl)iter.next(); - if (wst!=null) { - types[i] = wst.getLabel(); - i++; - } - } - return types; - } - - public LabelsAndIds getServiceTypeLabels() - { - LabelsAndIds labelIds = new LabelsAndIds(); - Iterator iterator = webServiceTypes.values().iterator(); - int size = webServiceTypes.size(); - String[] labels = new String[size]; - String[] ids = new String[size]; - int index = 0; - - labelIds.setLabels_( labels ); - labelIds.setIds_( ids ); - - while( iterator.hasNext() ) - { - WebServiceTypeImpl type = (WebServiceTypeImpl)iterator.next(); - - ids[index] = type.getId(); - labels[index] = type.getLabel(); - index++; - } - - return labelIds; - } - - /** - * Returns the IConfigurationElement given the server, runtime, and type attributes - * The benefit of getting the IConfigurationElement is that the corresponding class - * file and plugin are not loaded immediately. - * @param server label - * @param runtime label - * @param type label - * @return IConfiguration element - */ - public IConfigurationElement getConfigurationElementFor(String serverId, String runtimeId, String typeId) - { - if (serverId==null || runtimeId==null || typeId==null) - return null; - Iterator iter = webServiceServerRuntimeTypes.values().iterator(); - while (iter.hasNext()) - { - WebServiceServerRuntimeType_ wssrt = (WebServiceServerRuntimeType_)iter.next(); - if (wssrt!=null ) { - if (wssrt.getConfigurationElementFor(serverId, runtimeId, typeId)!=null) - return wssrt.getConfigurationElementFor(serverId, runtimeId,typeId); - } - } - return null; - } - - public IConfigurationElement getConfigElementFor(String factoryId, String runtimeId, String typeId) - { - Iterator iter = webServiceServerRuntimeTypes.values().iterator(); - while (iter.hasNext()) - { - WebServiceServerRuntimeType_ wssrt = (WebServiceServerRuntimeType_)iter.next(); - if (wssrt.hasConfigElementFor(factoryId, runtimeId, typeId)) { - return wssrt.element_; - } - } - return null; - } - - public boolean requiresWebModuleFor(String server, String runtime, String type) - { - IConfigurationElement elem = getConfigurationElementFor(server, runtime, type); - if (elem==null) - { - return false; // report error here instead - } - return Boolean.valueOf(elem.getAttribute("requireWebModule")).booleanValue(); - } - - public boolean requiresEJBModuleFor(String server, String runtime, String type) - { - IConfigurationElement elem = getConfigurationElementFor(server, runtime, type); - if (elem==null) - { - return false; - } - return Boolean.valueOf(elem.getAttribute("requireEJBModule")).booleanValue(); - } - - /** - * Returns the id of the <code>WebServiceServerRuntimeType</code> corresponding to the Server, - * Runtime, and Web Service Type. - */ - public boolean webServiceServerRuntimeTypeExists(String serverID, String runtimeID, String typeID) - { - return (getConfigurationElementFor(serverID, runtimeID, typeID) != null); - } - - /** - * Returns the id of the <code>WebServiceServerRuntimeType</code> corresponding to the Server, - * Runtime, and Web Service Type. - */ - public String getWebServiceServerRuntimeTypeName(String server, String runtime, String type) - { - IConfigurationElement elem = (IConfigurationElement)getConfigurationElementFor(server, runtime, type); - return (elem==null ? null : elem.getAttribute("id")); - } - - /** - * Returns the <code>WebServiceServerRuntimeType</code> corresponding to the Server, - * Runtime, and Web Service type. This will return the <code>WebServiceServerRuntimeType</code> - * object and set the properties found in the manifest file. i.e. isWebModuleRequired, isEJBModuleRequired - * @param server label - * @param runtime label - * @param Web service type - * @return WebServiceServerRuntimeType object - */ - public WebServiceServerRuntimeType getWebServiceServerRuntimeType(String server, String runtime, String type) - { - - WebServiceServerRuntimeType wssrt = null; - String serverId = getWebServiceServerByFactoryId(server).getId(); - IConfigurationElement elem = getConfigurationElementFor(server, runtime, type); - - if( elem == null ) - { - // We couldn't find the server and runtime specified so we will - // find the default server and runtime. - - server = getDefaultServerValueFor(type); - runtime = getDefaultRuntimeValueFor(type); - - elem = getConfigurationElementFor(server, runtime, type); - - } - - return wssrt; - - } - - - /** - * Returns the <code>WebServiceServerRuntimeType</code> given the type name. - * @param type name - * @retrun WebServiceServerRuntimeType object - */ - public WebServiceServerRuntimeType getWebServiceServerRuntimeTypeById(String id) - { - WebServiceServerRuntimeType wssrt = null; - if (configElemsById_.containsKey(id)) - { - try { - IConfigurationElement elem = (IConfigurationElement)configElemsById_.get(id); - Object webServiceType = elem.createExecutableExtension("class"); - if (webServiceType instanceof WebServiceServerRuntimeType) - { - wssrt = (WebServiceServerRuntimeType)webServiceType; - wssrt.setServerLabel(elem.getAttribute("server")); - wssrt.setRuntimeLabel(elem.getAttribute("runtime")); - wssrt.setWebModuleRequired( Boolean.valueOf(elem.getAttribute("requireWebModule")).booleanValue() ); - wssrt.setEJBModuleRequired( Boolean.valueOf(elem.getAttribute("requireEJBModule")).booleanValue() ); - } - else - { - String implementedInterface = "org.eclipse.jst.ws.ui.wizard.WebServiceServerRuntimeType "; - String errMsg = "Extensions of the WebServiceServerRuntimeTypes extension point must implement the "; - errMsg = errMsg + implementedInterface + "interface."; - log_.log(Log.ERROR, 5061, this, "getWebServiceServerRuntimeTypeById", errMsg); - } - } - catch (CoreException ce) - { - log_.log(Log.ERROR, 5062, this, "getWebServiceServerRuntimeTypeById", ce); - } - } - - return wssrt; - } - - public String[] getWebServiceTypeBySelection(IStructuredSelection selection) - { - - TypeSelectionFilter tsf = new TypeSelectionFilter(); - String[] wst = tsf.getWebServiceTypeByInitialSelection(selection, webServiceTypes); - return wst == null ? null : wst; - - } - - public IWebServiceType getWebServiceTypeByTypeLabel(String webServiceTypeLabel) - { - - Iterator iter = webServiceTypes.values().iterator(); - while (iter.hasNext()) - { - WebServiceTypeImpl wst = (WebServiceTypeImpl)iter.next(); - if (wst!=null) { - if (wst.getLabel().equals(webServiceTypeLabel)) { - return wst; - } - } - } - return null; - } - - public boolean isInitialSelectionValidForChosenType(IStructuredSelection selection, String typeName) - { - String[] supportedTypes = getWebServiceTypeBySelection(selection); - if (supportedTypes!=null) - { - for (int i=0; i<supportedTypes.length; i++) - { - if (supportedTypes[i].equals(typeName)) - return true; - } - } - return false; - - } - - public boolean isServerSupportedForChosenType(String typeId, String serverID) - { - if (serversByType_.containsKey(typeId)) - { - Vector vect = (Vector)serversByType_.get(typeId); - for (int i=0; i<vect.size(); i++) - { - WebServiceServer wss = (WebServiceServer)webServiceServers.get((String)vect.elementAt(i)); - if (serverID!=null) { - if (serverID.equalsIgnoreCase(wss.getFactoryId())) - return true; - } - } - } - return false; - } - - public boolean isServerRuntimeTypeSupported(String server, String runtime, String type) { - - WebServiceServerRuntimeType wssrt = null; - IConfigurationElement elem = getConfigurationElementFor(server, runtime, type); - return elem == null ? false : true; - - } - - public String getDefaultServerValueFor(String typeId) - { - String[] servers; - if (serversByType_.containsKey(typeId)) - { - Vector vect = (Vector)serversByType_.get(typeId); - servers = new String[vect.size()]; - for (int i=0; i<vect.size(); i++) - { - String serverId = (String)vect.elementAt(i); - WebServiceServer wss = (WebServiceServer)webServiceServers.get(serverId); - servers[i] = (String)wss.getId(); - } - return servers[0]; - } - else - { - log_.log(Log.ERROR, 5063, this, "getServerByType", "Unable to find default server for "+typeId); - return null; - } - - } - - public String getDefaultRuntimeValueFor(String typeId) - { - String[] runtimeName = getRuntimesByType(typeId); - for (int i=0; i<runtimeName.length; i++) - { - WebServiceRuntime wsr = (WebServiceRuntime)webServiceRuntimes.get(runtimeName[i]); - if (wsr.getIsDefault()) - return runtimeName[i]; - } - return runtimeName[0]; - } - - public String getServerIdForFactoryId(String factoryId) { - - Iterator iter = webServiceServers.values().iterator(); - while (iter.hasNext()) { - WebServiceServer wss = (WebServiceServer)iter.next(); - if (wss.getFactoryId().equals(factoryId)) { - return wss.getId(); - } - } - return null; - - } - - public final class WebServiceServerRuntimeType_ - { - - public String typeId_; - public String serverId_; - public String runtimeId_; - public IConfigurationElement element_; - - public WebServiceServerRuntimeType_(String serverId, String runtimeId,String typeId, IConfigurationElement elem) - { - this.typeId_ = typeId; - this.serverId_ = serverId; - this.runtimeId_ = runtimeId; - this.element_ = elem; - } - - public IConfigurationElement getConfigurationElementFor(String serverID, String runtimeID, String typeID) - { - if (this.typeId_.equals(typeID) && this.serverId_.equals(serverID) && this.runtimeId_.equals(runtimeID)) - return this.element_; - return null; - } - - public boolean hasConfigElementFor(String factoryID, String runtimeID, String typeID) - { - String serverID = getServerIdForFactoryId( factoryID ); - - if (typeId_.equalsIgnoreCase(typeID) && - serverId_.equalsIgnoreCase(serverID) && - runtimeId_.equalsIgnoreCase(runtimeID)) - { - return true; - } - - return false; - } - - - } - - public CommandFragmentFactoryFactory getFactoryFactory( String[] ids ) - { - String hashKey = ids[2] + "#" + ids[1] + "#" + ids[0]; - CommandWidgetBinding binding = (CommandWidgetBinding)factoryCache_.get( hashKey ); - - if( binding == null ) - { - IConfigurationElement element = getConfigElementFor( ids[2], ids[1], ids[0] ); - - if( element == null ) return null; - - binding = createBinding( element ); - - factoryCache_.put( hashKey, binding ); - - binding.registerDataMappings( dataMappingRegistry_ ); - - if( widgetRegistry_ != null ) - { - binding.registerWidgetMappings( widgetRegistry_ ); - binding.registerCanFinish( canFinishRegistry_ ); - } - } - - return binding; - } - - private CommandWidgetBinding createBinding(IConfigurationElement element ) - { - Vector bindings = new Vector(4); - Vector fragments = new Vector(4); - - addBinding( element, "developBinding", bindings ); - addBinding( element, "assemblyBinding", bindings ); - addBinding( element, "deployBinding", bindings ); - addBinding( element, "installBinding", bindings ); - - fragments.add( new ServicePreDevelopFragment() ); - fragments.add( new ServicePreAssemblyFragment() ); - fragments.add( new ServicePreDeployFragment() ); - fragments.add( new ServicePreInstallFragment() ); - - return new CommandWidgetBindingList( bindings, fragments ); - } - - private void addBinding( IConfigurationElement element, String bindingName, Vector list ) - { - Object binding = null; - - if( element.getAttribute( bindingName ) != null ) - { - try - { - binding = element.createExecutableExtension( bindingName ); - } - catch( CoreException exc ) - { - } - } - - list.add( binding ); - } - - public void setDataMappingRegistry( DataMappingRegistry registry ) - { - dataMappingRegistry_ = registry; - - // We need to rebuild the factory cache each time we start the server - // wizard. - factoryCache_ = new HashMap(); - } - - public void setWidgetRegistry( WidgetRegistry registry ) - { - widgetRegistry_ = registry;; - } - - public void setCanFinishRegistry( CanFinishRegistry registry ) - { - canFinishRegistry_ = registry; - } - - public String[] getAllServerFactoryIds() - { - Object[] servers = webServiceServers.values().toArray(); - String[] factoryIds = new String[servers.length]; - for (int i=0; i<servers.length; i++) - { - WebServiceServer wss = (WebServiceServer)servers[i]; - factoryIds[i] = wss.getFactoryId(); - } - return factoryIds; - } - - public String getServerFactoryIdFromServerId(String serverId) - { - Object[] servers = webServiceServers.values().toArray(); - for (int i=0; i<servers.length; i++) - { - WebServiceServer wss = (WebServiceServer)servers[i]; - if (serverId == wss.getId()) - { - return wss.getFactoryId(); - } - - } - return null; - } - - /* - * Returns a cascading list of valid choices for server, runtime, and J2EE levels. - * This is an intersection of what is available for service and client. - */ - public SelectionListChoices getServerToRuntimeToJ2EE() - { - if (serverToRuntimeToJ2EE_!=null) - { - return serverToRuntimeToJ2EE_; - } - - String[] servers = getStringArrayIntersection(getAllServerFactoryIds(), WebServiceClientTypeRegistry.getInstance().getAllClientServerFactoryIds()); - 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 SelectionListChoices getRuntimeChoices(String serverFactoryId) - { - String[] serviceRuntimes = getRuntimeIDsByServerFactoryID(serverFactoryId); - String[] clientRuntimes = WebServiceClientTypeRegistry.getInstance().getRuntimeIdsByServerFactoryId(serverFactoryId); - String[] runtimes = getStringArrayIntersection(serviceRuntimes, clientRuntimes); - SelectionList runtimesList = new SelectionList(runtimes, 0); - Vector choices = new Vector(); - for (int i=0; i<runtimes.length; i++) - { - choices.add(getJ2EEChoices(runtimes[i])); - } - return new SelectionListChoices(runtimesList, choices); - } - - private SelectionListChoices getJ2EEChoices(String runtimeId) - { - String[] serviceJ2EEVersions = getWebServiceRuntimeById(runtimeId).getJ2EEVersions(); - String[] clientJ2EEVersions = WebServiceClientTypeRegistry.getInstance().getWebServiceRuntimeById(runtimeId).getJ2EEVersions(); - String[] j2eeVersions = getStringArrayIntersection(serviceJ2EEVersions, clientJ2EEVersions); - SelectionList j2eeVersionsList = new SelectionList(j2eeVersions, 0); - return new SelectionListChoices(j2eeVersionsList, null); - } - - public String getServerLabel(String factoryId) - { - if (factoryId==null || factoryId.length()==0) - return null; - - if (serverLabelByFactoryId_.containsKey(factoryId)) - { - return (String)serverLabelByFactoryId_.get(factoryId); - } - else - { - return null; - } - } - - public String getServerFactoryId(String label) - { - if (label==null || label.length()==0) - return null; - - if (serverFactoryIdByLabel_.containsKey(label)) - { - return (String)serverFactoryIdByLabel_.get(label); - } - else - { - return null; - } - } - - public String getRuntimeLabel(String id) - { - if (id==null || id.length()==0) - return null; - - return (String) runtimeLabelById_.get(id); - } - - public String getRuntimeId(String label) - { - if (label==null || label.length()==0) - return null; - - return (String)runtimeIdByLabel_.get(label); - } - - private String[] getStringArrayIntersection(String[] a1, String[] a2) - { - Vector vf = new Vector(); - if (a1==null || a2==null) - { - return convertToStringArray(vf.toArray()); - } - - for (int i=0; i<a1.length; i++) - { - for (int j=0; j<a2.length; j++) - { - if (a1[i].equals(a2[j])) - { - vf.add(a1[i]); - break; - } - } - } - - return convertToStringArray(vf.toArray()); - } - - private String[] convertToStringArray(Object[] a) - { - if (a==null) return new String[0]; - - int length = a.length; - String[] sa = new String[length]; - for (int i=0; i<length; i++) - { - Object obj = a[i]; - if (obj instanceof String) - { - sa[i] = (String)obj; - } - } - return sa; - } -} - - - - diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceType.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceType.java deleted file mode 100644 index 3a8f4fb3d..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceType.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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; - - -/** -* This is the interface for objects that represent a kind of -* Web Service artifact. The primary purpose of a WebServiceType -* object is to manufacture the wizard pages that support the type. -*/ -public interface WebServiceType -{ - /** - * Returns a short, locale specific name of this Web Service type. - * @return A short, locale specific name of this Web Service type. - */ - public String getName (); - - /** - * Returns a locale specific description of this Web Service type. - * @return A locale specific description of this Web Service type. - */ - public String getDescription (); - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceTypeImpl.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceTypeImpl.java deleted file mode 100644 index 229de46a2..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceTypeImpl.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * 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.StringTokenizer; - -import org.eclipse.core.runtime.IConfigurationElement; - - -/** -* This is the interface for objects that represent a kind of -* Web Service artifact. The primary purpose of a WebServiceType -* object is to manufacture the wizard pages that support the type. -*/ -public class WebServiceTypeImpl implements IWebServiceType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - public IConfigurationElement element_; - public String typeId_; - public String typeLabel_; - public String[] extensionMetadata_; - public String[] resourceTypeMetadata_; - public Boolean canFinish_; - - public WebServiceTypeImpl(IConfigurationElement elem) - { - super(); - this.element_ = elem; - } - /** - * Returns the id of this Web Service type. - * @return id of this Web Service type. - */ - public String getId () - { - if (typeId_==null) - typeId_ = element_.getAttribute("id"); - return typeId_; - } - /** - * Returns a short, locale specific name of this Web Service type. - * @return A short, locale specific name of this Web Service type. - */ - public String getLabel () - { - if (typeLabel_ == null) - typeLabel_ = element_.getAttribute("label"); - return typeLabel_; - } - - /** - * Returns a locale specific description of this Web Service type's extension metadata. - * @return A locale specific description of this Web Service type's extension metadata. - */ - public String[] getExtensionMetadata () - { - if (extensionMetadata_ ==null) - { - StringTokenizer st = new StringTokenizer(element_.getAttribute("extensionMetadata")); - extensionMetadata_ = new String[st.countTokens()]; - int i=0; - while (st.hasMoreElements()) - { - String exten = (String)st.nextToken(); - if (exten!=null) - { - extensionMetadata_[i]=exten; - } - i++; - } - } - return this.extensionMetadata_; - } - - /** - * Returns a locale specific description of this Web Service type's resource metadata. - * @return A locale specific description of this Web Service type's resource metadata. - */ - public String[] getResourceTypeMetadata () - { - if (resourceTypeMetadata_ == null) - { - StringTokenizer st = new StringTokenizer(element_.getAttribute("resourceTypeMetadata")); - resourceTypeMetadata_ = new String[st.countTokens()]; - int i=0; - while (st.hasMoreElements()) - { - String resourceType = (String)st.nextToken(); - if (resourceType!=null) - { - resourceTypeMetadata_[i]=resourceType; - } - i++; - } - } - return resourceTypeMetadata_; - } - - /** - * Returns true if the plugin.xml contains an attribute of "canFinish" with a value of true. Otherwise, - * false is returned. Note: if the "canFinish" attribute is not specified true is returned by default. - * @return Returns whether or not the user can finish on the pages before the web service type pages. - */ - public boolean getCanFinish() - { - if( canFinish_ == null ) - { - String canFinishString = element_.getAttribute("canFinish"); - - canFinish_ = canFinishString == null ? new Boolean( true ) : Boolean.valueOf( canFinishString ); - } - - return canFinish_.booleanValue(); - } - - /** - * Returns the configuration element associated with - * this type. - * - * @return org.eclipse.core.runtime.IConfigurationElement - */ - public IConfigurationElement getConfigurationElement() - { - return this.element_; - } - - public String getObjectSelectionWidget() - { - return element_.getAttribute("objectSelectionWidget"); - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceTypeRegistry.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceTypeRegistry.java deleted file mode 100644 index e158231a6..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceTypeRegistry.java +++ /dev/null @@ -1,161 +0,0 @@ -/******************************************************************************* - * 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.Enumeration; -import java.util.Hashtable; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.wst.command.internal.env.eclipse.EclipseLog; -import org.eclipse.wst.command.internal.provisional.env.core.common.Log; - -public class WebServiceTypeRegistry -{ - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - private static WebServiceTypeRegistry instance_; - - private Hashtable typesByName_; - private String[] typeNames_; - - // - // Loads WebServiceType objects into this registry. - // This is done by querying the plugin registry for all extensions - // hanging on the webServiceType extension point. Extensions - // must implement the org.eclipse.jst.ws.ui.wizard.WebServiceType - // interface. - // - private void loadTypes () - { - Log log = new EclipseLog(); - IExtensionRegistry reg = Platform.getExtensionRegistry(); - IConfigurationElement[] config = reg.getConfigurationElementsFor( - "org.eclipse.jst.ws.consumption.ui", - "webServiceType"); - - for(int idx=0; idx<config.length; idx++) - { - IConfigurationElement elem = config[idx]; - try - { - Object webServiceType = elem.createExecutableExtension("class"); - if (webServiceType instanceof WebServiceType) - { - add((WebServiceType)webServiceType); - } - else - { - String implementedInterface = "org.eclipse.jst.ws.ui.wizard.WebServiceType "; - String errMsg = "Extensions of the webServiceTypes extension point must implement the "; - errMsg = errMsg + implementedInterface + "interface."; - log.log(Log.ERROR, 5056, this, "loadTypes", errMsg); - } - } catch (CoreException e) - { - log.log(Log.ERROR, 5057, this, "loadTypes", e); - } - } - } - - // - // Loads WebServiceType objects into this registry. - // See method getInstance(). - // - private void load () - { - typesByName_ = new Hashtable(); - loadTypes(); - indexTypesByName(); - } - - // - // Add the given WebServiceType to this registry. - // See method load(). - // - private void add ( WebServiceType wst ) - { - typesByName_.put(wst.getName(),wst); - } - - // - // Builds an index of WebServiceType objects by their names. - // See method load(). - // - private void indexTypesByName () - { - if (typeNames_ == null) - { - typeNames_ = new String[typesByName_.size()]; - Enumeration e = typesByName_.keys(); - for (int i=0; e.hasMoreElements(); i++) - { - typeNames_[i] = (String)e.nextElement(); - } - } - } - - /** - * Returns a singleton instance of this class. - * @return A singleton WebServiceTypeRegistry object. - */ - public static WebServiceTypeRegistry getInstance () - { - if (instance_ == null) - { - instance_ = new WebServiceTypeRegistry(); - instance_.load(); - } - return instance_; - } - - /** - * Returns all registered <code>WebServiceType</code> objects. - * @return All registered <code>WebServiceType</code> objects. - */ - public WebServiceType[] getWebServiceTypes () - { - WebServiceType[] wsts = new WebServiceType[typesByName_.size()]; - Enumeration e = typesByName_.elements(); - for (int i=0; e.hasMoreElements(); i++) - { - wsts[i] = (WebServiceType)e.nextElement(); - } - return wsts; - } - - /** - * Returns the names of all registered <code>WebServiceType</code> - * objects. - * @return The names of all registered <code>WebServiceType</code> - * objects. - */ - public String[] getWebServiceTypeNames () - { - return typeNames_; - } - - /** - * Returns the <code>WebServiceType</code> object of the given - * <code>name</code> or null if there is no such object. - * @param name The name of the <code>WebServiceType</code> to find. - * @return The <code>WebServiceType</code> or null if no such object - * was found. - */ - public WebServiceType getWebServiceTypeByName ( String name ) - { - return (name == null ? null : (WebServiceType)typesByName_.get(name)); - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsil/AddWSDLToWSILWrapperCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsil/AddWSDLToWSILWrapperCommand.java index 4e146a7e8..759f4a137 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsil/AddWSDLToWSILWrapperCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsil/AddWSDLToWSILWrapperCommand.java @@ -11,34 +11,38 @@ package org.eclipse.jst.ws.internal.consumption.ui.wsil; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; +import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; 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.ws.internal.wsil.AddWSDLToWSILCommand; -public class AddWSDLToWSILWrapperCommand extends SimpleCommand +public class AddWSDLToWSILWrapperCommand extends EnvironmentalOperation { private AddWSDLToWSILCommand command; private Arguments args; public AddWSDLToWSILWrapperCommand() { - super("org.eclipse.jst.ws.internal.consumption.ui.wsil.AddWSDLToWSILWrapperCommand", "org.eclipse.jst.ws.internal.consumption.ui.wsil.AddWSDLToWSILWrapperCommand"); } - public Status execute(Environment env) + public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { + Environment env = getEnvironment(); + if (command == null) command = new AddWSDLToWSILCommand(); if (!args.isEmpty()) { command.setArguments(args.getStringArguments()); command.setWWWAuthenticationHandler(new DialogWWWAuthentication(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell())); - return command.execute(env); + command.setEnvironment( env ); + return command.execute( null, null); } return new SimpleStatus(""); } diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceType.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceType.java index 28c6f50f5..ec311b949 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceType.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceType.java @@ -10,35 +10,31 @@ *******************************************************************************/ package org.eclipse.jst.ws.internal.consumption.ui.wsrt; -import java.util.HashMap; import java.util.Hashtable; import java.util.StringTokenizer; import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.jst.ws.internal.consumption.ui.wizard.IWebServiceType; import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceScenario; public class ServiceType { private IConfigurationElement elem_; private Hashtable webServiceImpls_; - private HashMap webServiceTypes_; - private String id; - private WebServiceImpl webServiceImpl; - private String[] bottomUpModuleTypesInclude; - private String[] topDownModuleTypesInclude; + private String id; + private WebServiceImpl webServiceImpl; + private String[] bottomUpModuleTypesInclude; + private String[] topDownModuleTypesInclude; private String[] bottomUpModuleTypesExclude; private String[] topDownModuleTypesExclude; - private IWebServiceType webServiceType; + - public ServiceType(IConfigurationElement elem_, Hashtable webServiceImpls_, HashMap webServiceTypes_) + public ServiceType(IConfigurationElement elem_, Hashtable webServiceImpls_) { super(); this.elem_ = elem_; this.webServiceImpls_ = webServiceImpls_; - this.webServiceTypes_ = webServiceTypes_; } public String[] getBottomUpModuleTypesExclude() @@ -143,23 +139,6 @@ public class ServiceType { this.topDownModuleTypesInclude = topDownModuleTypesInclude; } - /* - public IWebServiceType getWebSerivceType() - { - if (webServiceType==null) - { - String wsid = elem_.getAttribute("webServiceTypeId"); - webServiceType = (IWebServiceType)webServiceTypes_.get(wsid); - } - return webServiceType; - } - */ - - public void setWebServiceType(IWebServiceType webServiceType) - { - this.webServiceType = webServiceType; - } - public WebServiceImpl getWebServiceImpl() { if (webServiceImpl == null) diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionRegistry.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionRegistry.java index 3bbef1630..3347379db 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionRegistry.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionRegistry.java @@ -18,7 +18,6 @@ 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.jst.ws.internal.consumption.ui.wizard.WebServiceTypeImpl; import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceScenario; public class WebServiceRuntimeExtensionRegistry @@ -70,23 +69,7 @@ public class WebServiceRuntimeExtensionRegistry webServiceRuntimes_ = new Hashtable(); IExtensionRegistry reg = Platform.getExtensionRegistry(); - - //Load WebServiceTypes - IConfigurationElement[] config = reg.getConfigurationElementsFor( - "org.eclipse.jst.ws.consumption.ui", - "webServiceServerRuntimeType"); - for(int idx=0; idx<config.length; idx++) - { - IConfigurationElement elem = config[idx]; - - if (elem.getName().equals("webServiceType")) - { - WebServiceTypeImpl wst = new WebServiceTypeImpl(elem); - webServiceTypes_.put(elem.getAttribute("id"), wst); - } - } - //Load WebServiceImpls IConfigurationElement[] wsImplExts = reg.getConfigurationElementsFor( "org.eclipse.jst.ws.consumption.ui", "wsImpl"); @@ -127,7 +110,7 @@ public class WebServiceRuntimeExtensionRegistry if (elem.getName().equals("serviceType")) { - ServiceType st = new ServiceType(elem,webServiceImpls_,webServiceTypes_); + ServiceType st = new ServiceType(elem,webServiceImpls_); serviceTypes_.put(elem.getAttribute("id"), st); } } 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 8a30da2a2..c0a22a6ea 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 @@ -8,9 +8,7 @@ import java.util.Vector; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.ws.internal.consumption.ui.wizard.IWebServiceType; import org.eclipse.jst.ws.internal.consumption.ui.wizard.TypeSelectionFilter; -import org.eclipse.jst.ws.internal.consumption.ui.wizard.WebServiceTypeImpl; import org.eclipse.jst.ws.internal.data.LabelsAndIds; import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; import org.eclipse.wst.command.internal.provisional.env.core.selection.SelectionList; @@ -40,18 +38,7 @@ public class WebServiceRuntimeExtensionUtils } return webserviceRuntime; - } - - public static IWebServiceType getWebServiceTypeById(String id) - { - Object result = registry.webServiceTypes_.get(id); - - if (result!=null) - { - return (WebServiceTypeImpl)result; - } - return null; - } + } public static WebServiceImpl getWebServiceImplById(String id) { |