geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcco...@apache.org
Subject svn commit: r797844 - in /geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/commands: RedeployCommand.java UndeployCommand.java
Date Sat, 25 Jul 2009 21:25:11 GMT
Author: mcconne
Date: Sat Jul 25 21:25:05 2009
New Revision: 797844

URL: http://svn.apache.org/viewvc?rev=797844&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/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/commands/RedeployCommand.java
    geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/commands/UndeployCommand.java

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.5/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/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/commands/RedeployCommand.java?rev=797844&r1=797843&r2=797844&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/commands/RedeployCommand.java
(original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/commands/RedeployCommand.java
Sat Jul 25 21:25:05 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/branches/2.1.5/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/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/commands/UndeployCommand.java?rev=797844&r1=797843&r2=797844&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/commands/UndeployCommand.java
(original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/commands/UndeployCommand.java
Sat Jul 25 21:25:05 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)



Mime
View raw message