geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From de...@apache.org
Subject svn commit: r952535 [20/26] - in /geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins: org.apache.geronimo.j2ee.v11.jaxbmodel/ org.apache.geronimo.j2ee.v11.jaxbmodel/META-INF/ org.apache.geronimo.j2ee.v11.jaxbmodel/src/main/java/org/apache/geronimo...
Date Tue, 08 Jun 2010 04:40:28 GMT
Added: geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoServerDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoServerDelegate.java?rev=952535&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoServerDelegate.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoServerDelegate.java Tue Jun  8 04:40:16 2010
@@ -0,0 +1,429 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.jar.Attributes;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+
+import org.apache.geronimo.st.core.GeronimoRuntimeDelegate;
+import org.apache.geronimo.st.core.internal.Trace;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jst.server.core.FacetUtil;
+import org.eclipse.jst.server.core.IEnterpriseApplication;
+import org.eclipse.jst.server.core.IWebModule;
+import org.eclipse.jst.server.core.internal.J2EEUtil;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IModuleType;
+import org.eclipse.wst.server.core.ServerPort;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.wst.server.core.internal.ServerMonitorManager;
+import org.eclipse.wst.server.core.model.ServerDelegate;
+
+/**
+ * @version $Rev: 797732 $ $Date: 2009-07-25 17:42:04 +0800 (Sat, 25 Jul 2009) $
+ */
+abstract public class GeronimoServerDelegate extends ServerDelegate implements IGeronimoServer {
+
+	public static final String PROPERTY_ADMIN_ID = "adminID";
+
+	public static final String PROPERTY_ADMIN_PW = "adminPassword";
+
+	public static final String PROPERTY_RMI_PORT = "RMIRegistry";
+
+	public static final String PROPERTY_HTTP_PORT = "WebConnector";
+
+	public static final String PROPERTY_LOG_LEVEL = "logLevel";
+	
+	public static final String PROPERTY_VM_ARGS = "VMArgs";
+	
+	public static final String PROPERTY_PING_DELAY = "pingDelay";
+	
+	public static final String PROPERTY_PING_INTERVAL = "pingInterval";
+	
+	public static final String PROPERTY_MAX_PINGS = "maxPings";
+	
+	public static final String PROPERTY_PUBLISH_TIMEOUT = "publishTimeout";
+	
+	public static final String PROPERTY_IN_PLACE_SHARED_LIB = "inPlaceSharedLib";
+    
+    public static final String PROPERTY_NOT_REDEPLOY_JSP_FILES = "notRedeployJSPFiles";
+    
+	public static final String PROPERTY_RUN_FROM_WORKSPACE = "runFromWorkspace";
+
+	public static final String PROPERTY_SELECT_CLASSPATH_CONTAINERS = "selectClasspathContainers";
+
+	public static final String PROPERTY_CLASSPATH_CONTAINERS = "classpathContainers";
+
+	public static final String CONSOLE_INFO = "--long";
+
+	public static final String CONSOLE_DEBUG = "-vv";
+
+    public abstract String getContextRoot(IModule module) throws Exception ;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.server.core.model.ServerDelegate#canModifyModules(org.eclipse.wst.server.core.IModule[],
+	 *      org.eclipse.wst.server.core.IModule[])
+	 */
+	public IStatus canModifyModules(IModule[] add, IModule[] remove) {
+		if (add != null) {
+			for (int i = 0; i < add.length; i++) {
+				IModule module = add[i];
+				if (module.getProject() != null) {
+					IStatus status = FacetUtil.verifyFacets(module.getProject(), getServer());
+					if (status != null && !status.isOK()) {
+						return status;
+					}
+				}
+			}
+		}
+		return Status.OK_STATUS;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.server.core.model.ServerDelegate#modifyModules(org.eclipse.wst.server.core.IModule[],
+	 *      org.eclipse.wst.server.core.IModule[],
+	 *      org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public void modifyModules(IModule[] add, IModule[] remove, IProgressMonitor monitor) throws CoreException {
+		// TODO servermodule.info should be pushed to here and set as instance
+		// property
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.server.core.model.ServerDelegate#getRootModules(org.eclipse.wst.server.core.IModule)
+	 */
+	public IModule[] getRootModules(IModule module) throws CoreException {
+		IStatus status = canModifyModules(new IModule[] { module }, null);
+		if (status != null && !status.isOK())
+			throw new CoreException(status);
+		IModule[] childs = doGetParentModules(module);
+		if (childs.length > 0)
+			return childs;
+		return new IModule[] { module };
+	}
+
+	private IModule[] doGetParentModules(IModule module) {
+		ArrayList<IModule> parents = new ArrayList<IModule>();
+		parents.addAll(getApplicationModules(module));
+
+		// also check to see if the module is a utility module for a stand-alone
+		// web module
+		IModule[] wars = J2EEUtil.getWebModules(module, null);
+		for (int i = 0; i < wars.length; i++) {
+			if (getApplicationModules(wars[i]).isEmpty()) {
+				parents.add(wars[i]);
+			}
+		}
+		return (IModule[]) parents.toArray(new IModule[parents.size()]);
+	}
+
+	private List<IModule> getApplicationModules(IModule module) {
+		IModule[] ears = ServerUtil.getModules(IModuleConstants.JST_EAR_MODULE);
+		ArrayList<IModule> list = new ArrayList<IModule>();
+		for (int i = 0; i < ears.length; i++) {
+			IEnterpriseApplication ear = (IEnterpriseApplication) ears[i].loadAdapter(IEnterpriseApplication.class, null);
+			IModule[] childs = ear.getModules();
+			for (int j = 0; j < childs.length; j++) {
+				if (childs[j].equals(module))
+					list.add(ears[i]);
+			}
+		}
+		return list;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.server.core.model.ServerDelegate#getChildModules(org.eclipse.wst.server.core.IModule[])
+	 */
+	public IModule[] getChildModules(IModule[] module) {
+		if (module == null)
+			return null;
+
+		if (module.length == 1 && module[0] != null) {
+			IModuleType moduleType = module[0].getModuleType();
+			if (moduleType != null) {
+				if (IModuleConstants.JST_EAR_MODULE.equals(moduleType.getId())) {
+					IEnterpriseApplication enterpriseApplication = (IEnterpriseApplication) module[0].loadAdapter(IEnterpriseApplication.class, null);
+					if (enterpriseApplication != null) {
+						IModule[] modules = enterpriseApplication.getModules();
+						if (modules != null)
+							return modules;
+					}
+				} else if (IModuleConstants.JST_WEB_MODULE.equals(moduleType.getId())) {
+					IWebModule webModule = (IWebModule) module[0].loadAdapter(IWebModule.class, null);
+					if (webModule != null) {
+						IModule[] modules = webModule.getModules();
+						if (modules != null)
+							return modules;
+					}
+				}
+			}
+		}
+
+		return new IModule[] {};
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.server.core.model.ServerDelegate#getServerPorts()
+	 */
+	public ServerPort[] getServerPorts() {
+		List<ServerPort> ports = new ArrayList<ServerPort>();
+		ports.add(new ServerPort(PROPERTY_HTTP_PORT, "Web Connector", Integer.parseInt(getHTTPPort()), "http"));
+		ports.add(new ServerPort(PROPERTY_RMI_PORT, "RMI Naming", Integer.parseInt(getRMINamingPort()), "rmi"));
+		return (ServerPort[]) ports.toArray(new ServerPort[ports.size()]);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.server.core.model.IURLProvider#getModuleRootURL(org.eclipse.wst.server.core.IModule)
+	 */
+	public URL getModuleRootURL(IModule module) {
+		try {
+			if (module == null
+					|| module.loadAdapter(IWebModule.class, null) == null)
+				return null;
+
+			String host = getServer().getHost();
+			String url = "http://" + host;
+			int port = 0;
+
+			port = Integer.parseInt(getHTTPPort());
+			port = ServerMonitorManager.getInstance().getMonitoredPort(getServer(), port, "web");
+			if (port != 80)
+				url += ":" + port;
+
+			String moduleId = getContextRoot(module);
+			if (!moduleId.startsWith("/"))
+				url += "/";
+			url += moduleId;
+
+			if (!url.endsWith("/"))
+				url += "/";
+
+			return new URL(url);
+		} catch (Exception e) {
+			Trace.trace(Trace.SEVERE, "Could not get root URL", e);
+			return null;
+		}
+
+	}
+
+	public String getAdminID() {
+		return getInstanceProperty(PROPERTY_ADMIN_ID);
+	}
+
+	public String getAdminPassword() {
+		return getInstanceProperty(PROPERTY_ADMIN_PW);
+	}
+
+	public String getRMINamingPort() {
+		return getInstanceProperty(PROPERTY_RMI_PORT);
+	}
+
+	public String getHTTPPort() {
+		return getInstanceProperty(PROPERTY_HTTP_PORT);
+	}
+
+	public String getConsoleLogLevel() {
+		return getInstanceProperty(PROPERTY_LOG_LEVEL);
+	}
+	
+	public String getVMArgs() {
+		return getInstanceProperty(PROPERTY_VM_ARGS);
+	}
+
+	public void setAdminID(String value) {
+		setInstanceProperty(PROPERTY_ADMIN_ID, value);
+	}
+
+	public void setAdminPassword(String value) {
+		setInstanceProperty(PROPERTY_ADMIN_PW, value);
+	}
+
+	public void setRMINamingPort(String value) {
+		setInstanceProperty(PROPERTY_RMI_PORT, value);
+	}
+
+	public void setHTTPPort(String value) {
+		setInstanceProperty(PROPERTY_HTTP_PORT, value);
+	}
+
+	public void setConsoleLogLevel(String value) {
+		setInstanceProperty(PROPERTY_LOG_LEVEL, value);
+	}
+	
+	public void setVMArgs(String value) {
+		setInstanceProperty(PROPERTY_VM_ARGS, value);
+	}
+	
+	public int getPingDelay() {
+		String pingDelay = getInstanceProperty(PROPERTY_PING_DELAY);
+		return Integer.parseInt(pingDelay);
+	}
+	
+	public int getPingInterval() {
+		String pingInterval = getInstanceProperty(PROPERTY_PING_INTERVAL);
+		return Integer.parseInt(pingInterval);
+	}
+	
+	public int getMaxPings() {
+		String maxPings = getInstanceProperty(PROPERTY_MAX_PINGS);
+		return Integer.parseInt(maxPings);
+	}
+	
+	public long getPublishTimeout() {
+		String timeout = getInstanceProperty(PROPERTY_PUBLISH_TIMEOUT);
+		return Long.parseLong(timeout);
+	}
+	
+	public void setPingDelay(Integer delay) {
+		setInstanceProperty(PROPERTY_PING_DELAY, delay.toString());
+	}
+	
+	public void setPingInterval(Integer interval) {
+		setInstanceProperty(PROPERTY_PING_INTERVAL, interval.toString());
+	}
+	
+	public void setMaxPings(Integer maxPings) {
+		setInstanceProperty(PROPERTY_MAX_PINGS, maxPings.toString());
+	}
+	
+	public void setPublishTimeout(long timeout) {
+		setInstanceProperty(PROPERTY_PUBLISH_TIMEOUT, Long.toString(timeout));
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.apache.geronimo.st.v21.core.IGeronimoServer#isInPlace()
+	 */
+	public boolean isInPlaceSharedLib() {
+		return getAttribute(PROPERTY_IN_PLACE_SHARED_LIB, false);
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.apache.geronimo.st.v21.core.IGeronimoServer#isRunFromWorkspace()
+	 */
+	public boolean isRunFromWorkspace() {
+		return getAttribute(PROPERTY_RUN_FROM_WORKSPACE, false);
+	}
+	
+	
+    //
+	// PROPERTY_SELECT_CLASSPATH_CONTAINERS
+	//
+	public boolean isSelectClasspathContainers() {
+		return getAttribute(PROPERTY_SELECT_CLASSPATH_CONTAINERS, false);
+	}
+	public void setSelectClasspathContainers(boolean enable) {
+		setAttribute(PROPERTY_SELECT_CLASSPATH_CONTAINERS, enable);
+	}
+	
+	
+	//
+	// PROPERTY_CLASSPATH_CONTAINERS
+	//
+	public List<String> getClasspathContainers() {
+		return getAttribute(PROPERTY_CLASSPATH_CONTAINERS, new ArrayList<String>() );
+	}
+	public void setClasspathContainers( List<String> list ) {
+		setAttribute(PROPERTY_CLASSPATH_CONTAINERS, list);
+	}
+	
+	
+	public void setInPlaceSharedLib(boolean enable) {
+		setAttribute(PROPERTY_IN_PLACE_SHARED_LIB, enable);
+	}
+
+    public void setNotRedeployJSPFiles(boolean enable){
+        setAttribute(PROPERTY_NOT_REDEPLOY_JSP_FILES,enable);
+    }
+
+	public void setRunFromWorkspace(boolean enable) {
+		setAttribute(PROPERTY_RUN_FROM_WORKSPACE, enable);
+	}
+	
+	public String discoverDeploymentFactoryClassName(IPath jarPath) {
+		try {
+			JarFile deployerJar = new JarFile(jarPath.toFile());
+			Manifest manifestFile = deployerJar.getManifest();
+			Attributes attributes = manifestFile.getMainAttributes();
+			return attributes.getValue("J2EE-DeploymentFactory-Implementation-Class");
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.wst.server.core.model.ServerDelegate#setDefaults(org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public void setDefaults(IProgressMonitor monitor) {
+		setAdminID("system");
+		setAdminPassword("manager");
+		setHTTPPort("8080");
+		setRMINamingPort("1099");
+		setConsoleLogLevel(CONSOLE_INFO);
+		setPingDelay(new Integer(10000));
+		setMaxPings(new Integer(40));
+		setPingInterval(new Integer(5000));
+		setPublishTimeout(900000);
+		setInPlaceSharedLib(false);
+		setRunFromWorkspace(false);
+		setSelectClasspathContainers(false);
+	}
+
+	public String getInstanceProperty(String name) {
+		return (String) getServerInstanceProperties().get(name);
+	}
+
+	public void setInstanceProperty(String name, String value) {
+		Map map = getServerInstanceProperties();
+		map.put(name, value);
+		setServerInstanceProperties(map);
+	}
+
+	public Map getServerInstanceProperties() {
+		return getAttribute(GeronimoRuntimeDelegate.SERVER_INSTANCE_PROPERTIES, new HashMap());
+	}
+
+	public void setServerInstanceProperties(Map map) {
+		setAttribute(GeronimoRuntimeDelegate.SERVER_INSTANCE_PROPERTIES, map);
+	}
+
+	
+}

Modified: geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoServerInfo.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoServerInfo.java?rev=952535&r1=952534&r2=952535&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoServerInfo.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoServerInfo.java Tue Jun  8 04:40:16 2010
@@ -40,7 +40,7 @@ import org.apache.geronimo.kernel.Kernel
 import org.apache.geronimo.kernel.NoSuchAttributeException;
 import org.apache.geronimo.kernel.NoSuchOperationException;
 import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.st.core.GeronimoServerBehaviourDelegate;
+import org.apache.geronimo.st.v21.core.GeronimoServerBehaviourDelegate;
 import org.apache.geronimo.st.v21.core.internal.Trace;
 import org.apache.geronimo.system.jmx.KernelDelegate;
 import org.eclipse.core.runtime.IProgressMonitor;

Added: geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoUtils.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoUtils.java?rev=952535&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoUtils.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoUtils.java Tue Jun  8 04:40:16 2010
@@ -0,0 +1,224 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core;
+
+import javax.enterprise.deploy.shared.ModuleType;
+
+import org.apache.geronimo.st.core.internal.Trace;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jst.j2ee.internal.deployables.J2EEFlexProjDeployable;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.server.core.IWebModule;
+import org.eclipse.wst.common.componentcore.ArtifactEdit;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.server.core.IModule;
+
+/**
+ * @version $Rev: 817996 $ $Date: 2009-09-23 16:04:12 +0800 (Wed, 23 Sep 2009) $
+ */
+public class GeronimoUtils {
+
+	public static final String WEB_PLAN_NAME = "geronimo-web.xml";
+
+	public static final String OPENEJB_PLAN_NAME = "openejb-jar.xml";
+
+	public static final String APP_PLAN_NAME = "geronimo-application.xml";
+
+	public static final String APP_CLIENT_PLAN_NAME = "geronimo-application-client.xml";
+
+	public static final String CONNECTOR_PLAN_NAME = "geronimo-ra.xml";
+	
+	public static final String SERVICE_PLAN_NAME = "geronimo-service.xml";
+
+	public static boolean isWebModule(IModule module) {
+		return "jst.web".equals(module.getModuleType().getId());
+	}
+
+	public static boolean isEjbJarModule(IModule module) {
+		return "jst.ejb".equals(module.getModuleType().getId());
+	}
+
+	public static boolean isEarModule(IModule module) {
+		return "jst.ear".equals(module.getModuleType().getId());
+	}
+
+	public static boolean isAppClientModule(IModule module) {
+		return "jst.appclient".equals(module.getModuleType().getId());
+	}
+
+	public static boolean isRARModule(IModule module) {
+		return "jst.connector".equals(module.getModuleType().getId());
+	}
+	
+	public static ModuleType getJSR88ModuleType(IModule module) {
+		if (isWebModule(module)) {
+			return ModuleType.WAR;
+		} else if (isEjbJarModule(module)) {
+			return ModuleType.EJB;
+		} else if (isEarModule(module)) {
+			return ModuleType.EAR;
+		} else if (isRARModule(module)) {
+			return ModuleType.RAR;
+		} else {
+			Trace.trace(Trace.SEVERE, "getJSR88ModuleType = null");
+			return null;
+		}
+	}
+	
+	public static IFile getDeploymentPlanFile(IModule module) {
+		IProject project = module.getProject();
+		IVirtualComponent comp = ComponentCore.createComponent(project);
+		String type = J2EEProjectUtilities.getJ2EEProjectType(project);
+		if (IModuleConstants.JST_WEB_MODULE.equals(type)) {
+			return getWebDeploymentPlanFile(comp);
+		} else if (IModuleConstants.JST_EJB_MODULE.equals(type)) {
+			return getOpenEjbDeploymentPlanFile(comp);
+		} else if (IModuleConstants.JST_EAR_MODULE.equals(type)) {
+			return getApplicationDeploymentPlanFile(comp);
+		} else if (IModuleConstants.JST_APPCLIENT_MODULE.equals(type)) {
+			return getApplicationClientDeploymentPlanFile(comp);
+		} else if (IModuleConstants.JST_CONNECTOR_MODULE.equals(type)) {
+			return getConnectorDeploymentPlanFile(comp);
+		}
+		return null;
+	}
+	
+	public static String getQualifiedConfigID(String groupId, String artifactId, String version, String type) {
+		return groupId + "/" + artifactId + "/" + version + "/" + type;
+	}
+
+	public static IFile getWebDeploymentPlanFile(IVirtualComponent comp) {
+		IPath deployPlanPath = comp.getRootFolder().getUnderlyingFolder().getProjectRelativePath().append("WEB-INF").append(WEB_PLAN_NAME);
+		return comp.getProject().getFile(deployPlanPath);
+	}
+
+	public static IFile getOpenEjbDeploymentPlanFile(IVirtualComponent comp) {
+		IPath deployPlanPath = comp.getRootFolder().getUnderlyingFolder().getProjectRelativePath().append("META-INF").append(OPENEJB_PLAN_NAME);
+		return comp.getProject().getFile(deployPlanPath);
+	}
+
+	public static IFile getApplicationDeploymentPlanFile(IVirtualComponent comp) {
+		IPath deployPlanPath = comp.getRootFolder().getUnderlyingFolder().getProjectRelativePath().append("META-INF").append(APP_PLAN_NAME);
+		return comp.getProject().getFile(deployPlanPath);
+	}
+
+	public static IFile getApplicationClientDeploymentPlanFile(IVirtualComponent comp) {
+		IPath deployPlanPath = comp.getRootFolder().getUnderlyingFolder().getProjectRelativePath().append("META-INF").append(APP_CLIENT_PLAN_NAME);
+		return comp.getProject().getFile(deployPlanPath);
+	}
+
+	public static IFile getConnectorDeploymentPlanFile(IVirtualComponent comp) {
+		IPath deployPlanPath = comp.getRootFolder().getUnderlyingFolder().getProjectRelativePath().append("META-INF").append(CONNECTOR_PLAN_NAME);
+		return comp.getProject().getFile(deployPlanPath);
+	}
+
+	public static IVirtualComponent getVirtualComponent(IModule module) {
+		return ComponentCore.createComponent(module.getProject());
+	}
+
+	public static String getContextRoot(IModule module) throws Exception{
+		String contextRoot = null;
+
+		J2EEFlexProjDeployable j2eeModule = (J2EEFlexProjDeployable) module.loadAdapter(J2EEFlexProjDeployable.class, null);
+		contextRoot = ((IWebModule) j2eeModule).getContextRoot();
+
+		if (contextRoot == null)
+			contextRoot = getId(module);
+
+		return contextRoot;
+	}
+
+	public static String getId(IModule module) {
+		// use the module ID
+		String moduleId = module.getId();
+
+		J2EEFlexProjDeployable j2eeModule = (J2EEFlexProjDeployable) module.loadAdapter(J2EEFlexProjDeployable.class, null);
+		if (j2eeModule != null) {
+			// j2eeFlex
+			ArtifactEdit edit = null;
+			try {
+				edit = ArtifactEdit.getArtifactEditForRead(j2eeModule.getProject());
+				//TODO JAXB Refactoring - Can below two lines be removed without harm?
+				//XMIResource res = (XMIResource) edit.getContentModelRoot().eResource();
+				//moduleId = res.getID(edit.getContentModelRoot());
+			} finally {
+				if (edit != null)
+					edit.dispose();
+			}
+		}
+
+		if (moduleId != null && moduleId.length() > 0)
+			return moduleId;
+
+		// ...but if there is no defined module ID, pick the best alternative
+
+		IPath moduleLocation = new Path(j2eeModule.getURI(module));
+		if (moduleLocation != null) {
+			moduleId = moduleLocation.removeFileExtension().lastSegment();
+		}
+
+		if (j2eeModule instanceof IWebModule) {
+			// A better choice is to use the context root
+			// For wars most appservers use the module name
+			// as the context root
+			String contextRoot = ((IWebModule) j2eeModule).getContextRoot();
+			if (contextRoot.charAt(0) == '/')
+				moduleId = contextRoot.substring(1);
+		}
+
+		return moduleId;
+	}
+
+	public static IFile getServiceDeploymentPlanFile(IVirtualComponent comp) {
+		IPath deployPlanPath = comp.getRootFolder().getUnderlyingFolder().getProjectRelativePath().append("META-INF").append(SERVICE_PLAN_NAME);
+		return comp.getProject().getFile(deployPlanPath);
+	}
+
+/*
+//TODO JAXB Refactoring - Can this function be removed without harm?
+	public static Resource load(IFile dpFile, ResourceSet resourceSet) {
+		try {
+
+			URI uri = URI.createPlatformResourceURI(dpFile.getFullPath().toString(), false);
+
+			Resource resource = resourceSet.createResource(uri);
+			if (!resource.isLoaded()) {
+				resource.load(null);
+			}
+			return resource;
+		} catch (MalformedURLException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+*/	
+/*
+//TODO JAXB Refactoring - Can this function be removed without harm?
+	public static void register(ResourceSet resourceSet,
+			Resource.Factory factory, EPackage pkg, String nsUri) {
+		resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, factory);
+		resourceSet.getPackageRegistry().put(nsUri, pkg);
+	}
+*/
+}

Modified: geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoV21Utils.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoV21Utils.java?rev=952535&r1=952534&r2=952535&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoV21Utils.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoV21Utils.java Tue Jun  8 04:40:16 2010
@@ -25,7 +25,7 @@ import org.apache.geronimo.jee.deploymen
 import org.apache.geronimo.jee.deployment.Environment;
 import org.apache.geronimo.jee.openejb.OpenejbJar;
 import org.apache.geronimo.jee.web.WebApp;
-import org.apache.geronimo.st.core.GeronimoUtils;
+import org.apache.geronimo.st.v21.core.GeronimoUtils;
 import org.apache.geronimo.st.core.internal.Trace;
 import org.apache.geronimo.st.core.jaxb.JAXBUtils;
 import org.eclipse.core.resources.IFile;

Modified: geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoV21VersionHandler.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoV21VersionHandler.java?rev=952535&r1=952534&r2=952535&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoV21VersionHandler.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoV21VersionHandler.java Tue Jun  8 04:40:16 2010
@@ -19,7 +19,7 @@ package org.apache.geronimo.st.v21.core;
 import javax.enterprise.deploy.spi.TargetModuleID;
 
 import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl;
-import org.apache.geronimo.st.core.IGeronimoVersionHandler;
+import org.apache.geronimo.st.v21.core.IGeronimoVersionHandler;
 import org.eclipse.wst.server.core.IModule;
 
 /**

Added: geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/IGeronimoServer.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/IGeronimoServer.java?rev=952535&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/IGeronimoServer.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/IGeronimoServer.java Tue Jun  8 04:40:16 2010
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core;
+
+import java.util.List;
+
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.factories.DeploymentFactory;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.wst.server.core.model.IURLProvider;
+
+/**
+ * @version $Rev: 797732 $ $Date: 2009-07-25 17:42:04 +0800 (Sat, 25 Jul 2009) $
+ */
+public interface IGeronimoServer extends IURLProvider {
+
+	public String getAdminID();
+
+	public String getAdminPassword();
+
+	public String getRMINamingPort();
+
+	public String getDeployerURL();
+
+	public String getJMXServiceURL();
+
+	public IPath getJSR88DeployerJar();
+	
+	public DeploymentFactory getDeploymentFactory();
+
+	public void configureDeploymentManager(DeploymentManager dm);
+
+	public IGeronimoVersionHandler getVersionHandler();
+	
+	public boolean isNotRedeployJSPFiles();	
+	
+	public boolean isInPlaceSharedLib();
+	
+	public boolean isRunFromWorkspace();
+	
+	public boolean isSelectClasspathContainers();
+	
+	public List<String> getClasspathContainers();
+	
+	public int getPingDelay();
+	
+	public int getPingInterval();
+	
+	public int getMaxPings();
+	
+	public long getPublishTimeout();
+
+}

Added: geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/IGeronimoServerBehavior.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/IGeronimoServerBehavior.java?rev=952535&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/IGeronimoServerBehavior.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/IGeronimoServerBehavior.java Tue Jun  8 04:40:16 2010
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core;
+
+import javax.enterprise.deploy.spi.Target;
+
+/**
+ * @version $Rev: 471551 $ $Date: 2006-11-06 06:47:11 +0800 (Mon, 06 Nov 2006) $
+ */
+public interface IGeronimoServerBehavior {
+
+	public boolean isFullyStarted();
+
+	public boolean isKernelAlive();
+
+	public void setServerStarted();
+
+	public void setServerStopped();
+	
+	public Target[] getTargets();
+
+}

Added: geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/IGeronimoVersionHandler.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/IGeronimoVersionHandler.java?rev=952535&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/IGeronimoVersionHandler.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/IGeronimoVersionHandler.java Tue Jun  8 04:40:16 2010
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core;
+
+import javax.enterprise.deploy.spi.TargetModuleID;
+
+import org.eclipse.wst.server.core.IModule;
+
+/**
+ * @version $Rev: 817996 $ $Date: 2009-09-23 16:04:12 +0800 (Wed, 23 Sep 2009) $
+ */
+public interface IGeronimoVersionHandler {
+
+	public String getConfigID(IModule module) throws Exception;
+	
+	public TargetModuleID createTargetModuleId(String configId);
+
+}

Added: geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/PingThread.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/PingThread.java?rev=952535&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/PingThread.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/PingThread.java Tue Jun  8 04:40:16 2010
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core;
+
+import org.apache.geronimo.st.core.internal.Trace;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.util.SocketUtil;
+
+/**
+ * @version $Rev: 817996 $ $Date: 2009-09-23 16:04:12 +0800 (Wed, 23 Sep 2009) $
+ */
+public class PingThread extends Thread {
+
+	private int pingDelay;
+
+	private int pingInterval;
+
+	private int maxPings;
+
+	private IGeronimoServerBehavior geronimoServer;
+
+	private IServer server;
+
+	public PingThread(IGeronimoServerBehavior geronimoServer, IServer server) {
+		super();
+		this.geronimoServer = geronimoServer;
+		this.server = server;
+		this.setDaemon(true);
+		loadPingDelay();
+		loadPingInterval();
+		loadMaxPings();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Runnable#run()
+	 */
+	public void run() {
+
+		if (!SocketUtil.isLocalhost(server.getHost())) {
+			return;
+		}
+
+		try {
+			sleep(pingDelay);
+		} catch (InterruptedException e) {
+			// ignore
+		}
+
+		for (int tries = maxPings; tries > 0; tries--) {
+			
+			if(server.getServerState() == IServer.STATE_STOPPED || server.getServerState() == IServer.STATE_STOPPING) {
+				return;
+			}
+
+			ClassLoader old = Thread.currentThread().getContextClassLoader();
+			try {
+				ClassLoader cl = ((GeronimoServerBehaviourDelegate) geronimoServer).getContextClassLoader();
+				Thread.currentThread().setContextClassLoader(cl);
+				if (geronimoServer.isFullyStarted()) {
+					Trace.trace(Trace.INFO, "Ping: success");
+					geronimoServer.setServerStarted();
+					return;
+				}
+			} finally {
+				Thread.currentThread().setContextClassLoader(old);
+			}
+
+			Trace.trace(Trace.INFO, "Ping: fail");
+
+			try {
+				sleep(pingInterval);
+			} catch (InterruptedException e) {
+				// ignore
+			}
+		}
+
+		//don't need to show this message to user, since wst Server will show the timeout message to user
+		Trace.trace(Trace.SEVERE, "Ping: Can't ping for server startup.");
+		server.stop(false);
+	}
+	
+	public void loadPingDelay() {
+		pingDelay = getGeronimoServer().getPingDelay();
+	}
+	
+	public void loadPingInterval() {
+		pingInterval = getGeronimoServer().getPingInterval();
+	}
+	
+	public void loadMaxPings() {
+		maxPings = getGeronimoServer().getMaxPings();
+	}
+	
+	private IGeronimoServer getGeronimoServer() {
+		IGeronimoServer gServer = (IGeronimoServer) server.getAdapter(IGeronimoServer.class);
+		if(gServer == null) {
+			gServer = (IGeronimoServer) server.loadAdapter(IGeronimoServer.class, null);
+		}
+		return gServer;
+	}
+}

Added: geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/UpdateServerStateTask.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/UpdateServerStateTask.java?rev=952535&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/UpdateServerStateTask.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/UpdateServerStateTask.java Tue Jun  8 04:40:16 2010
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core;
+
+import java.util.TimerTask;
+
+import org.apache.geronimo.st.core.internal.Trace;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.core.internal.Server;
+
+/**
+ * @version $Rev: 817996 $ $Date: 2009-09-23 16:04:12 +0800 (Wed, 23 Sep 2009) $
+ */
+public class UpdateServerStateTask extends TimerTask {
+
+	private IGeronimoServerBehavior delegate;
+
+	private IServer server;
+
+	public UpdateServerStateTask(IGeronimoServerBehavior delegate, IServer server) {
+		super();
+		this.delegate = delegate;
+		this.server = server;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.util.TimerTask#run()
+	 */
+	public void run() {
+		if (canUpdateState()) {
+			updateServerState();
+		}
+	}
+
+	/**
+	 * Returns true if either the connection URL is unique for all g-servers or
+	 * if all other servers that share the same connection URL but have
+	 * different runtime locations are stopped.
+	 * 
+	 * @return true if ok to update state
+	 */
+	private boolean canUpdateState() {
+		IGeronimoServer thisServer = (IGeronimoServer) this.server.loadAdapter(IGeronimoServer.class, null);
+		IServer[] allServers = ServerCore.getServers();
+		for (int i = 0; i < allServers.length; i++) {
+			IServer server = allServers[i];
+			IGeronimoServer gs = (IGeronimoServer) server.loadAdapter(IGeronimoServer.class, null);
+			if (gs != null && !this.server.getId().equals(server.getId())) {
+				if (isSameConnectionURL(gs, thisServer)) {
+					if (!isSameRuntimeLocation(server) && server.getServerState() != IServer.STATE_STOPPED) {
+						Trace.trace(Trace.WARNING, server.getId() + " Cannot update server state.  URL conflict between multiple servers.");
+						return false;
+					}
+				}
+			}
+		}
+
+		return true;
+	}
+
+	private boolean isSameRuntimeLocation(IServer server) {
+		return server.getRuntime().getLocation().equals(this.server.getRuntime().getLocation());
+	}
+
+	private boolean isSameConnectionURL(IGeronimoServer server, IGeronimoServer thisServer) {
+		return server.getJMXServiceURL().equals(thisServer.getJMXServiceURL());
+	}
+
+	private void updateServerState() {
+		Trace.trace(Trace.INFO, ">> " + server.getId() + " Updating Server State.");
+		try {
+			switch (server.getServerState()) {
+			case IServer.STATE_STOPPED:
+				if (delegate.isKernelAlive())
+					updateFromStopped();
+				break;
+			case IServer.STATE_STARTING:
+				if (delegate.isKernelAlive())
+					updateFromStarting();
+				else
+					delegate.setServerStopped();
+				break;
+			case IServer.STATE_STARTED:
+				updateFromStarted();
+				break;
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		Trace.trace(Trace.INFO, "<< " + server.getId() + " Updating Server State.");
+	}
+
+	private void updateFromStopped() throws CoreException {
+		if (isFullyStarted()) {
+			delegate.setServerStarted();
+		} else {
+			((Server) server).setServerState(IServer.STATE_STARTING);
+		}
+	}
+
+	private void updateFromStarting() throws CoreException {
+		if (isFullyStarted())
+			delegate.setServerStarted();
+	}
+
+	private void updateFromStarted() throws CoreException {
+		if (!isFullyStarted())
+			delegate.setServerStopped();
+	}
+
+	private boolean isFullyStarted() throws CoreException {
+		ClassLoader old = Thread.currentThread().getContextClassLoader();
+		try {
+			Thread.currentThread().setContextClassLoader(((GeronimoServerBehaviourDelegate) delegate).getContextClassLoader());
+			return delegate.isFullyStarted();
+		} finally {
+			Thread.currentThread().setContextClassLoader(old);
+		}
+	}
+}

Added: geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/AbstractDeploymentCommand.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/AbstractDeploymentCommand.java?rev=952535&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/AbstractDeploymentCommand.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/AbstractDeploymentCommand.java Tue Jun  8 04:40:16 2010
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core.commands;
+
+import javax.enterprise.deploy.spi.DeploymentManager;
+
+import org.apache.geronimo.st.v21.core.IGeronimoServer;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+
+/**
+ * @version $Rev: 480044 $ $Date: 2006-11-28 22:02:54 +0800 (Tue, 28 Nov 2006) $
+ */
+abstract class AbstractDeploymentCommand implements IDeploymentCommand {
+	
+	private IServer server;
+
+	private IModule module;
+	
+	private long timeout;
+
+	public AbstractDeploymentCommand(IServer server, IModule module) {
+		super();
+		this.server = server;
+		this.module = module;
+		timeout = getGeronimoServer().getPublishTimeout();
+	}
+
+	public DeploymentManager getDeploymentManager() throws CoreException {
+		return DeploymentCommandFactory.getDeploymentManager(server);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.geronimo.st.core.commands.IDeploymentCommand#getModule()
+	 */
+	public IModule getModule() {
+		return module;
+	}
+
+	public IServer getServer() {
+		return server;
+	}
+	
+	public IGeronimoServer getGeronimoServer() {
+		return (IGeronimoServer) getServer().getAdapter(IGeronimoServer.class);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.geronimo.st.core.commands.IDeploymentCommand#getTimeout()
+	 */
+	public long getTimeout() {
+		return timeout;
+	}
+}

Added: geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/DeployCommand.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/DeployCommand.java?rev=952535&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/DeployCommand.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/DeployCommand.java Tue Jun  8 04:40:16 2010
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core.commands;
+
+import java.io.File;
+
+import org.apache.geronimo.st.v21.core.DeploymentUtils;
+import org.apache.geronimo.st.v21.core.IGeronimoServer;
+import org.apache.geronimo.st.core.internal.Trace;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+
+/**
+ * @version $Rev: 509683 $ $Date: 2007-02-21 01:47:35 +0800 (Wed, 21 Feb 2007) $
+ */
+abstract public class DeployCommand extends AbstractDeploymentCommand {
+
+	/**
+	 * @param server
+	 * @param module
+	 */
+	public DeployCommand(IServer server, IModule module) {
+		super(server, module);
+	}
+
+	public File getTargetFile() {
+		File file = null;
+		IGeronimoServer gs = getGeronimoServer();
+		if (gs.isRunFromWorkspace()) {
+		    //TODO Re-enable after DeployableModule supported in G
+			//file = generateRunFromWorkspaceConfig(getModule());
+		} else {
+			IPath outputDir = DeploymentUtils.STATE_LOC.append("server_" + getServer().getId());
+			outputDir.toFile().mkdirs();
+			file = DeploymentUtils.createJarFile(getModule(), outputDir);
+		}
+		Trace.trace(Trace.INFO, "File: " + file.getAbsolutePath());
+		return file;
+	}
+
+	/*protected File generateRunFromWorkspaceConfig(IModule module) {
+		IPath configDir = Activator.getDefault().getStateLocation().append("looseconfig").append("server_" + getServer().getId());
+		configDir.toFile().mkdirs();
+
+		ModuleDocument doc = ModuleDocument.Factory.newInstance();
+		Module deployable = doc.addNewModule();
+		processModuleConfig(deployable, module);
+
+		XmlOptions options = new XmlOptions();
+		options.setSavePrettyPrint();
+		File file = configDir.append(module.getName()).addFileExtension("xml").toFile();
+		Trace.trace(Trace.INFO,doc.xmlText(options));
+		try {
+			doc.save(file, options);
+			return file;
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	private void processModuleConfig(Module deployable, IModule serverModule) {
+		deployable.setName(serverModule.getName());
+		J2EEFlexProjDeployable j2eeModule = (J2EEFlexProjDeployable) serverModule.loadAdapter(J2EEFlexProjDeployable.class, null);
+		if (j2eeModule != null) {
+
+			if(j2eeModule.isBinary()) {
+				deployable.setPath(serverModule.getName());
+				return;
+			}
+
+			IContainer[] containers = j2eeModule.getResourceFolders();
+			for (int i = 0; i < containers.length; i++) {
+				deployable.addNewResources().setPath(containers[i].getLocation().toOSString());
+			}
+			containers = j2eeModule.getJavaOutputFolders();
+			for (int i = 0; i < containers.length; i++) {
+				deployable.addNewClasses().setPath(containers[i].getLocation().toOSString());
+			}
+		}
+
+		IModule[] children = j2eeModule.getChildModules();		
+		if (children.length > 0) {
+			Children modChild = deployable.addNewChildren();
+			for (int i = 0; i < children.length; i++) {
+				processModuleConfig(modChild.addNewModule(), children[i]);
+			}
+		}
+
+		IVirtualComponent vc = ComponentCore.createComponent(serverModule.getProject());
+		IVirtualReference[] refs = vc.getReferences();
+		for(int i = 0; i< refs.length; i++) {
+			IVirtualComponent refComp = refs[i].getReferencedComponent();
+			if(refComp.isBinary()) {
+				Children modChild = deployable.getChildren() == null ? deployable.addNewChildren() : deployable.getChildren();
+				Module binaryModule = modChild.addNewModule();
+				VirtualArchiveComponent archiveComp = (VirtualArchiveComponent) refComp;
+				binaryModule.setName(archiveComp.getUnderlyingDiskFile().getName());
+				binaryModule.setPath(archiveComp.getUnderlyingDiskFile().getAbsolutePath());
+			}
+		}
+	}*/
+
+}

Added: geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/DeploymentCmdStatus.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/DeploymentCmdStatus.java?rev=952535&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/DeploymentCmdStatus.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/DeploymentCmdStatus.java Tue Jun  8 04:40:16 2010
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core.commands;
+
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.status.ProgressObject;
+
+import org.eclipse.core.runtime.IStatus;
+
+/**
+ * @version $Rev: 471551 $ $Date: 2006-11-06 06:47:11 +0800 (Mon, 06 Nov 2006) $
+ */
+public class DeploymentCmdStatus implements IStatus {
+
+	private IStatus status;
+
+	private ProgressObject po;
+
+	public DeploymentCmdStatus(IStatus status, ProgressObject po) {
+		super();
+		this.status = status;
+		this.po = po;
+	}
+
+	public ProgressObject getProgressObject() {
+		return po;
+	}
+
+	public TargetModuleID[] getResultTargetModuleIDs() {
+		if (po != null) {
+			return po.getResultTargetModuleIDs();
+		}
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.core.runtime.IStatus#getChildren()
+	 */
+	public IStatus[] getChildren() {
+		return status.getChildren();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.core.runtime.IStatus#getCode()
+	 */
+	public int getCode() {
+		return status.getCode();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.core.runtime.IStatus#getException()
+	 */
+	public Throwable getException() {
+		return status.getException();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.core.runtime.IStatus#getMessage()
+	 */
+	public String getMessage() {
+		return status.getMessage();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.core.runtime.IStatus#getPlugin()
+	 */
+	public String getPlugin() {
+		return status.getPlugin();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.core.runtime.IStatus#getSeverity()
+	 */
+	public int getSeverity() {
+		return status.getSeverity();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.core.runtime.IStatus#isMultiStatus()
+	 */
+	public boolean isMultiStatus() {
+		return status.isMultiStatus();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.core.runtime.IStatus#isOK()
+	 */
+	public boolean isOK() {
+		return status.isOK();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.core.runtime.IStatus#matches(int)
+	 */
+	public boolean matches(int severityMask) {
+		return status.matches(severityMask);
+	}
+
+}

Added: geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/DeploymentCommandFactory.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/DeploymentCommandFactory.java?rev=952535&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/DeploymentCommandFactory.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/DeploymentCommandFactory.java Tue Jun  8 04:40:16 2010
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core.commands;
+
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.Target;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
+
+import org.apache.geronimo.st.v21.core.Activator;
+import org.apache.geronimo.st.v21.core.GeronimoConnectionFactory;
+import org.apache.geronimo.st.v21.core.IGeronimoServerBehavior;
+import org.apache.geronimo.st.core.internal.Messages;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+
+/**
+ * 
+ * This class provides static factory methods that return "synchronized" wrapper
+ * instances of JSR-88 deployment commands.
+ *
+ * @version $Rev: 471551 $ $Date: 2006-11-06 06:47:11 +0800 (Mon, 06 Nov 2006) $
+ */
+public class DeploymentCommandFactory {
+
+	private DeploymentCommandFactory() {
+	}
+
+	/**
+	 * @param module
+	 * @param server
+	 * @return
+	 * @throws CoreException
+	 */
+	public static IDeploymentCommand createDistributeCommand(IModule module, IServer server) throws CoreException {
+		IGeronimoServerBehavior gs = (IGeronimoServerBehavior) server.loadAdapter(IGeronimoServerBehavior.class, null);
+		Target[] targets = gs.getTargets();
+		return new SynchronizedDeploymentOp(new DistributeCommand(server, module, targets));
+	}
+
+	/**
+	 * @param ids
+	 * @param module
+	 * @param server
+	 * @return
+	 * @throws CoreException
+	 */
+	public static IDeploymentCommand createStartCommand(TargetModuleID[] ids, IModule module, IServer server) throws CoreException {
+		return new SynchronizedDeploymentOp(new StartCommand(server, ids, module));
+	}
+
+	/**
+	 * @param module
+	 * @param server
+	 * @return
+	 * @throws CoreException
+	 */
+	public static IDeploymentCommand createStopCommand(IModule module, IServer server) throws CoreException {
+		return new SynchronizedDeploymentOp(new StopCommand(server, module));
+	}
+
+	/**
+	 * @param module
+	 * @param server
+	 * @return
+	 * @throws CoreException
+	 */
+	public static IDeploymentCommand createRedeployCommand(IModule module, IServer server) throws CoreException {
+		return new SynchronizedDeploymentOp(new RedeployCommand(server, module));
+	}
+
+	/**
+	 * @param module
+	 * @param server
+	 * @return
+	 * @throws CoreException
+	 */
+	public static IDeploymentCommand createUndeployCommand(IModule module, IServer server) throws CoreException {
+		return new SynchronizedDeploymentOp(new UndeployCommand(server, module));
+	}
+
+	/**
+	 * @param server
+	 * @return
+	 * @throws CoreException
+	 */
+	public static DeploymentManager getDeploymentManager(IServer server) throws CoreException {
+		try {
+			DeploymentManager dm = GeronimoConnectionFactory.getInstance().getDeploymentManager(server);
+			if (dm == null) {
+				throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.DM_CONNECTION_FAIL, null));
+			}
+			return dm;
+		} catch (DeploymentManagerCreationException e) {
+			throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.DM_CONNECTION_FAIL, e));
+		}
+	}
+
+}

Added: geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/DistributeCommand.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/DistributeCommand.java?rev=952535&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/DistributeCommand.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/DistributeCommand.java Tue Jun  8 04:40:16 2010
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core.commands;
+
+import java.io.File;
+
+import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.Target;
+
+import org.apache.geronimo.st.core.internal.Trace;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+
+/**
+ * @version $Rev: 612208 $ $Date: 2008-01-16 04:34:43 +0800 (Wed, 16 Jan 2008) $
+ */
+class DistributeCommand extends DeployCommand {
+
+	Target[] targets;
+
+	public DistributeCommand(IServer server, IModule module, Target[] targets) {
+		super(server, module);
+		this.targets = targets;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.core.commands.IDeploymentCommand#execute(org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public IStatus execute(IProgressMonitor monitor) throws CoreException {
+
+		DeploymentManager dm = getDeploymentManager();
+
+		if (targets == null)
+			targets = dm.getTargets();
+
+        Trace.trace(Trace.INFO, "Available targets: ");
+        for ( int ii=0; ii<targets.length; ii++ ) {
+            Trace.trace(Trace.INFO, "--> Target[" + ii + "]: " + targets[ii]);
+        }
+
+        //
+        // Geronimo 2.1 now supports clustering which will likely result in multiple targets getting 
+        // returned from the deployment manager. In our case though we have to ensure that only the 
+        // first target is used, which is the default configuration store and which is explicitly 
+        // configured by users. Thus, we will distribute the project to the defaultTarget only.
+        //
+        Target[] defaultTarget = new Target[1];
+        defaultTarget[0] = targets[0];
+
+        Trace.trace(Trace.INFO, "Using default target:");
+        Trace.trace(Trace.INFO, "--> " + defaultTarget[0]);
+
+		File file = getTargetFile();
+		return new DeploymentCmdStatus(Status.OK_STATUS, dm.distribute( defaultTarget, file, null));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.core.commands.IDeploymentCommand#getCommandType()
+	 */
+	public CommandType getCommandType() {
+		return CommandType.DISTRIBUTE;
+	}
+
+}

Added: geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/IDeploymentCommand.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/IDeploymentCommand.java?rev=952535&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/IDeploymentCommand.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/IDeploymentCommand.java Tue Jun  8 04:40:16 2010
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.st.v21.core.commands;
+
+import javax.enterprise.deploy.shared.CommandType;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.wst.server.core.IModule;
+
+/**
+ * @version $Rev: 568527 $ $Date: 2007-08-22 17:21:59 +0800 (Wed, 22 Aug 2007) $
+ */
+public interface IDeploymentCommand {
+
+	public IStatus execute(IProgressMonitor monitor) throws Exception;
+
+	public CommandType getCommandType();
+
+	public IModule getModule();
+	
+	public long getTimeout();
+
+}

Added: geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/RedeployCommand.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/RedeployCommand.java?rev=952535&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/RedeployCommand.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/RedeployCommand.java Tue Jun  8 04:40:16 2010
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core.commands;
+
+import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.spi.TargetModuleID;
+
+import org.apache.geronimo.st.v21.core.Activator;
+import org.apache.geronimo.st.v21.core.DeploymentUtils;
+import org.apache.geronimo.st.v21.core.GeronimoUtils;
+import org.apache.geronimo.st.v21.core.IGeronimoServer;
+import org.apache.geronimo.st.core.ModuleArtifactMapper;
+import org.apache.geronimo.st.core.commands.TargetModuleIdNotFoundException;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+
+/**
+ * @version $Rev: 817996 $ $Date: 2009-09-23 16:04:12 +0800 (Wed, 23 Sep 2009) $
+ */
+class RedeployCommand extends DeployCommand {
+
+	public RedeployCommand(IServer server, IModule module) {
+		super(server, module);
+	}
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.core.commands.IDeploymentCommand#execute(org.eclipse.core.runtime.IProgressMonitor)
+     */
+    public IStatus execute(IProgressMonitor monitor) throws TargetModuleIdNotFoundException, CoreException {
+        String configId = ModuleArtifactMapper.getInstance().resolve(getServer(), getModule());
+        
+        if(configId == null) {
+            IGeronimoServer gs = (IGeronimoServer) getServer().getAdapter(IGeronimoServer.class);
+            try {
+				configId = gs.getVersionHandler().getConfigID(getModule());
+			} catch (Exception e) {
+				throw new CoreException(new Status(IStatus.ERROR,Activator.PLUGIN_ID,"Module config Id not found for redeployment",e));
+			}
+        }
+        
+        TargetModuleID[] ids = null;
+        if(configId != null) {
+            TargetModuleID id = DeploymentUtils.getTargetModuleID(getDeploymentManager(), configId);
+            ids = new TargetModuleID[] {id};
+        }
+        else {
+            throw new CoreException(new Status(IStatus.ERROR,Activator.PLUGIN_ID,"Module config Id not found for redeployment"));
+        }
+        
+        return new DeploymentCmdStatus(Status.OK_STATUS, getDeploymentManager().redeploy(ids, getTargetFile(), GeronimoUtils.getDeploymentPlanFile(getModule()).getLocation().toFile()));
+    }
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.core.commands.IDeploymentCommand#getCommandType()
+	 */
+	public CommandType getCommandType() {
+		return CommandType.REDEPLOY;
+	}
+}

Added: geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/StartCommand.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/StartCommand.java?rev=952535&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/StartCommand.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/StartCommand.java Tue Jun  8 04:40:16 2010
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.st.v21.core.commands;
+
+import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.spi.TargetModuleID;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+
+/**
+ * @version $Rev: 568527 $ $Date: 2007-08-22 17:21:59 +0800 (Wed, 22 Aug 2007) $
+ */
+class StartCommand extends AbstractDeploymentCommand {
+
+	TargetModuleID[] ids;
+
+	public StartCommand(IServer server, TargetModuleID[] ids, IModule module) {
+		super(server, module);
+		this.ids = ids;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.core.commands.IDeploymentCommand#execute(org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public IStatus execute(IProgressMonitor monitor) throws CoreException {
+		return new DeploymentCmdStatus(Status.OK_STATUS, getDeploymentManager().start(ids));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.core.commands.IDeploymentCommand#getCommandType()
+	 */
+	public CommandType getCommandType() {
+		return CommandType.START;
+	}
+
+}

Added: geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/StopCommand.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/StopCommand.java?rev=952535&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/StopCommand.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/StopCommand.java Tue Jun  8 04:40:16 2010
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core.commands;
+
+import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.spi.TargetModuleID;
+
+import org.apache.geronimo.st.core.commands.TargetModuleIdNotFoundException;
+import org.apache.geronimo.st.v21.core.DeploymentUtils;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+
+/**
+ * @version $Rev: 471551 $ $Date: 2006-11-06 06:47:11 +0800 (Mon, 06 Nov 2006) $
+ */
+class StopCommand extends AbstractDeploymentCommand {
+
+	public StopCommand(IServer server, IModule module) {
+		super(server, module);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.core.commands.IDeploymentCommand#execute(org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public IStatus execute(IProgressMonitor monitor) throws TargetModuleIdNotFoundException, CoreException {
+		TargetModuleID id = DeploymentUtils.getTargetModuleID(getServer(), getModule());
+		return new DeploymentCmdStatus(Status.OK_STATUS, getDeploymentManager().stop(new TargetModuleID[] { id }));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.core.commands.IDeploymentCommand#getCommandType()
+	 */
+	public CommandType getCommandType() {
+		return CommandType.STOP;
+	}
+
+}

Added: geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/SynchronizedDeploymentOp.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/SynchronizedDeploymentOp.java?rev=952535&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/SynchronizedDeploymentOp.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/SynchronizedDeploymentOp.java Tue Jun  8 04:40:16 2010
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.st.v21.core.commands;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
+
+import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.spi.status.DeploymentStatus;
+import javax.enterprise.deploy.spi.status.ProgressEvent;
+import javax.enterprise.deploy.spi.status.ProgressListener;
+import javax.enterprise.deploy.spi.status.ProgressObject;
+
+import org.apache.geronimo.st.v21.core.Activator;
+import org.apache.geronimo.st.v21.core.DeploymentStatusMessage;
+import org.apache.geronimo.st.core.internal.Trace;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.server.core.IModule;
+
+/**
+ * This class is a wrapper IDeploymentCommand that when executed blocks the
+ * callee's thread until completed, either when the waiting thread times out, or
+ * a failed or completed notification is recieved from the DeploymentManager.
+ *
+ * @version $Rev: 568527 $ $Date: 2007-08-22 17:21:59 +0800 (Wed, 22 Aug 2007) $
+ */
+public class SynchronizedDeploymentOp implements ProgressListener,
+		IDeploymentCommand {
+
+	private IDeploymentCommand command;
+
+	private MultiStatus status = null;
+
+	private IProgressMonitor _monitor = null;
+
+	private boolean timedOut = true;
+
+	public SynchronizedDeploymentOp(IDeploymentCommand command) {
+		super();
+		this.command = command;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.core.commands.IDeploymentCommand#execute(org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public IStatus execute(IProgressMonitor monitor) throws Exception {
+
+		_monitor = monitor;
+
+		if (_monitor == null) {
+			_monitor = new NullProgressMonitor();
+		}
+
+		ProgressObject po = run();
+
+		return new DeploymentCmdStatus(status, po);
+	}
+
+	private synchronized ProgressObject run() throws Exception {
+		Trace.trace(Trace.INFO, "--> run()");
+		
+		IStatus ds = command.execute(_monitor);
+
+		ProgressObject po = null;
+
+		if (ds instanceof DeploymentCmdStatus) {
+			po = ((DeploymentCmdStatus) ds).getProgressObject();
+			po.addProgressListener(this);
+
+			try {
+				wait(getTimeout());
+			} catch (InterruptedException e) {
+			}
+
+			po.removeProgressListener(this);
+			if (timedOut) {
+				Trace.trace(Trace.SEVERE, "Command Timed Out!");
+				status = new MultiStatus(Activator.PLUGIN_ID, 0, "", null);
+				status.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, command.getCommandType() + " timed out.", null));
+			}
+		}
+
+		Trace.trace(Trace.INFO, "<-- run()");
+		return po;
+	}
+
+	private synchronized void sendNotification() {
+		timedOut = false;
+		Trace.trace(Trace.INFO, "notifyAll()");
+		notifyAll();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.enterprise.deploy.spi.status.ProgressListener#handleProgressEvent(javax.enterprise.deploy.spi.status.ProgressEvent)
+	 */
+	public void handleProgressEvent(ProgressEvent event) {
+		DeploymentStatus deploymentStatus = event.getDeploymentStatus();
+		if (deploymentStatus != null) {
+			DeploymentStatusMessage dsm = new DeploymentStatusMessage(deploymentStatus);
+			Trace.trace(Trace.INFO, dsm.toString());
+			_monitor.subTask(dsm.toString());
+			if (command.getCommandType() == deploymentStatus.getCommand()) {
+				if (deploymentStatus.isCompleted()) {
+					messageToStatus(IStatus.OK, dsm.getMessage(), false);
+					sendNotification();
+				} else if (deploymentStatus.isFailed()) {
+					messageToStatus(IStatus.ERROR, dsm.getMessage(), true);
+					sendNotification();
+				}
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.core.commands.IDeploymentCommand#getCommandType()
+	 */
+	public CommandType getCommandType() {
+		return command.getCommandType();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.core.commands.IDeploymentCommand#getModule()
+	 */
+	public IModule getModule() {
+		return command.getModule();
+	}
+	
+	public long getTimeout() {
+		return command.getTimeout();
+	}
+	
+    public void messageToStatus(int severity, String source, boolean error) {
+    	status = new MultiStatus(Activator.PLUGIN_ID, 0, "", null);
+		try {
+			BufferedReader in = new BufferedReader(new StringReader(source));
+			String line;
+			while ((line = in.readLine()) != null) {
+				status.add(new Status(severity, Activator.PLUGIN_ID, 0,line, null));
+			}
+		} catch (IOException e) {
+
+		}
+    }
+}

Added: geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/UndeployCommand.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/UndeployCommand.java?rev=952535&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/UndeployCommand.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.2.1/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/commands/UndeployCommand.java Tue Jun  8 04:40:16 2010
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core.commands;
+
+import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.spi.TargetModuleID;
+
+import org.apache.geronimo.st.v21.core.Activator;
+import org.apache.geronimo.st.v21.core.DeploymentUtils;
+import org.apache.geronimo.st.v21.core.IGeronimoServer;
+import org.apache.geronimo.st.core.ModuleArtifactMapper;
+import org.apache.geronimo.st.core.commands.TargetModuleIdNotFoundException;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+
+/**
+ * @version $Rev: 817996 $ $Date: 2009-09-23 16:04:12 +0800 (Wed, 23 Sep 2009) $
+ */
+class UndeployCommand extends AbstractDeploymentCommand {
+
+	public UndeployCommand(IServer server, IModule module) {
+		super(server, module);
+	}
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.core.commands.IDeploymentCommand#execute(org.eclipse.core.runtime.IProgressMonitor)
+     */
+    public IStatus execute(IProgressMonitor monitor) throws TargetModuleIdNotFoundException, CoreException {
+        String configId = ModuleArtifactMapper.getInstance().resolve(getServer(), getModule());
+
+        if(configId == null) {
+            IGeronimoServer gs = (IGeronimoServer) getServer().getAdapter(IGeronimoServer.class);
+            try {
+				configId = gs.getVersionHandler().getConfigID(getModule());
+			} catch (Exception e) {
+				throw new CoreException(new Status(IStatus.ERROR,Activator.PLUGIN_ID,"Module config Id not found for undeployment",e));
+			}
+        }
+       
+        if(configId == null) {
+            throw new CoreException(new Status(IStatus.ERROR,Activator.PLUGIN_ID,"Module config Id not found for undeployment"));
+        }
+        
+        TargetModuleID id = DeploymentUtils.getTargetModuleID(getDeploymentManager(), configId);
+        return new DeploymentCmdStatus(Status.OK_STATUS, getDeploymentManager().undeploy(new TargetModuleID[] { id }));
+    }
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.core.commands.IDeploymentCommand#getCommandType()
+	 */
+	public CommandType getCommandType() {
+		return CommandType.UNDEPLOY;
+	}
+
+}



Mime
View raw message