You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by mc...@apache.org on 2009/07/25 23:24:39 UTC

svn commit: r797843 - in /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/commands: RedeployCommand.java UndeployCommand.java

Author: mcconne
Date: Sat Jul 25 21:24:24 2009
New Revision: 797843

URL: http://svn.apache.org/viewvc?rev=797843&view=rev
Log:
GERONIMODEVTOOLS-575 Properly handle scenario where module config Id not found during redeploy/undeploy by throwing CoreException -- Thanks to Delos Dai for this patch !!

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/commands/RedeployCommand.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/commands/UndeployCommand.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/commands/RedeployCommand.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/commands/RedeployCommand.java?rev=797843&r1=797842&r2=797843&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/commands/RedeployCommand.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/commands/RedeployCommand.java Sat Jul 25 21:24:24 2009
@@ -19,6 +19,7 @@
 import javax.enterprise.deploy.shared.CommandType;
 import javax.enterprise.deploy.spi.TargetModuleID;
 
+import org.apache.geronimo.st.core.Activator;
 import org.apache.geronimo.st.core.DeploymentUtils;
 import org.apache.geronimo.st.core.GeronimoUtils;
 import org.apache.geronimo.st.core.IGeronimoServer;
@@ -39,27 +40,30 @@
 		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);
-			configId = gs.getVersionHandler().getConfigID(getModule());
-		}
-		
-		TargetModuleID[] ids = null;
-		if(configId != null) {
-			TargetModuleID id = DeploymentUtils.getTargetModuleID(getDeploymentManager(), configId);
-			ids = new TargetModuleID[] {id};
-		}
-		
-		return new DeploymentCmdStatus(Status.OK_STATUS, getDeploymentManager().redeploy(ids, getTargetFile(), GeronimoUtils.getDeploymentPlanFile(getModule()).getLocation().toFile()));
-	}
+    /*
+     * (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);
+            configId = gs.getVersionHandler().getConfigID(getModule());
+        }
+        
+        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)

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/commands/UndeployCommand.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/commands/UndeployCommand.java?rev=797843&r1=797842&r2=797843&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/commands/UndeployCommand.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/commands/UndeployCommand.java Sat Jul 25 21:24:24 2009
@@ -19,6 +19,7 @@
 import javax.enterprise.deploy.shared.CommandType;
 import javax.enterprise.deploy.spi.TargetModuleID;
 
+import org.apache.geronimo.st.core.Activator;
 import org.apache.geronimo.st.core.DeploymentUtils;
 import org.apache.geronimo.st.core.IGeronimoServer;
 import org.apache.geronimo.st.core.ModuleArtifactMapper;
@@ -38,26 +39,26 @@
 		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);
-			configId = gs.getVersionHandler().getConfigID(getModule());
-		}
-		
-		if(configId == null) {
-			//TODO Throw exception or handle TargetModuleIdNotFoundException in parent
-		}
-		
-		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#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);
+            configId = gs.getVersionHandler().getConfigID(getModule());
+        }
+       
+        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)