geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1136782 - in /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core: ./ commands/
Date Fri, 17 Jun 2011 06:09:57 GMT
Author: gawor
Date: Fri Jun 17 06:09:56 2011
New Revision: 1136782

URL: http://svn.apache.org/viewvc?rev=1136782&view=rev
Log:
a few minor improvements

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

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/Activator.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/Activator.java?rev=1136782&r1=1136781&r2=1136782&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/Activator.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/Activator.java
Fri Jun 17 06:09:56 2011
@@ -149,7 +149,6 @@ public class Activator extends Plugin {
     }
     
     final protected GeronimoServerBehaviourDelegate getGeronimoServerBehaviourDelegate (IServer
server) {
-        
         GeronimoServerBehaviourDelegate delegate = (GeronimoServerBehaviourDelegate) server.getAdapter(GeronimoServerBehaviourDelegate.class);
         if (delegate == null) {
             delegate = (GeronimoServerBehaviourDelegate) server.loadAdapter(GeronimoServerBehaviourDelegate.class,
null);
@@ -167,10 +166,7 @@ public class Activator extends Plugin {
      * @param server 
      */
     private void triggerStartUpdateServerTask(IServer server) {
-        GeronimoServerBehaviourDelegate delegate = (GeronimoServerBehaviourDelegate) server.getAdapter(GeronimoServerBehaviourDelegate.class);
-        if (delegate == null) {
-            delegate = (GeronimoServerBehaviourDelegate) server.loadAdapter(GeronimoServerBehaviourDelegate.class,
null);
-        }
+        GeronimoServerBehaviourDelegate delegate = getGeronimoServerBehaviourDelegate(server);
         if (delegate != null) {
             delegate.startUpdateServerStateTask();
         }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/DeploymentUtils.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/DeploymentUtils.java?rev=1136782&r1=1136781&r2=1136782&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/DeploymentUtils.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/DeploymentUtils.java
Fri Jun 17 06:09:56 2011
@@ -33,7 +33,9 @@ import org.apache.geronimo.st.v30.core.o
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
 import org.eclipse.jst.j2ee.application.internal.operations.AppClientComponentExportDataModelProvider;
 import org.eclipse.jst.j2ee.application.internal.operations.EARComponentExportDataModelProvider;
 import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentExportDataModelProvider;
@@ -422,4 +424,23 @@ public class DeploymentUtils {
         Trace.tracePoint("Exit ", Activator.traceCore, "DeploymentUtils.isInstalledModule",
(Object) null);
         return null;
     }
+    
+    public static String getConfigId(IServer server, IModule module) throws CoreException
{
+        String configId = ModuleArtifactMapper.getInstance().resolveArtifact(server, module);
+
+        if (configId == null) {
+            IGeronimoServer gs = (IGeronimoServer) server.getAdapter(IGeronimoServer.class);
+            try {
+                configId = gs.getVersionHandler().getConfigID(module);
+            } catch (Exception e) {
+                throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Unable
to determine configId for module: " + module.getName(), e));
+            }
+            
+            if (configId == null) {
+                throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Unable
to determine configId for module: " + module.getName()));
+            }
+        }
+        
+        return configId;
+    }
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviour.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviour.java?rev=1136782&r1=1136781&r2=1136782&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviour.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviour.java
Fri Jun 17 06:09:56 2011
@@ -256,6 +256,9 @@ public class GeronimoServerBehaviour ext
             return null;
         }
         Map<String, String> map = Collections.singletonMap("j2eeType", "WebModule");
+        if (!contextPath.startsWith("/")) {
+            contextPath = "/" + contextPath;
+        }
         AbstractNameQuery query = new AbstractNameQuery(null, map, Collections.EMPTY_SET);
         Set<AbstractName> webModuleNames = kernel.listGBeans(query);
         for (AbstractName name : webModuleNames) {

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java?rev=1136782&r1=1136781&r2=1136782&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
Fri Jun 17 06:09:56 2011
@@ -220,7 +220,7 @@ abstract public class GeronimoServerBeha
      * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#stop(boolean)
      */
     synchronized public void stop(final boolean force) {
-        Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.stop", Activator.traceCore);
+        Trace.tracePoint("Entry", Activator.traceCore, "GeronimoServerBehaviourDelegate.stop",
force);
 
         stopPingThread();
         if (getServer().getServerState() != IServer.STATE_STOPPED) {
@@ -238,7 +238,7 @@ abstract public class GeronimoServerBeha
         if (state == IServer.STATE_STARTING || state == IServer.STATE_STOPPING)
             terminate();
                                                    
-        Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.stop", Activator.traceCore);
+        Trace.tracePoint("Exit", Activator.traceCore, "GeronimoServerBehaviourDelegate.stop");
     }
 
     private void setStatus(IModule[] module, IStatus status, MultiStatus multiStatus) {
@@ -432,9 +432,11 @@ abstract public class GeronimoServerBeha
     private IStatus refreshBundles(IModule ebaModule, List<IModule[]> bundleModules,
IProgressMonitor monitor) {
         Trace.tracePoint("Entry", Activator.traceCore, "GeronimoServerBehaviourDelegate.refreshBundles",
ebaModule, bundleModules, monitor);
 
-        String configId = ModuleArtifactMapper.getInstance().resolveArtifact(getServer(),
ebaModule);
-        if (configId == null) {
-            return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.bind(Messages.REFRESH_NO_CONFIGURATION_FAIL,
ebaModule.getProject().getName()));
+        String configId = null;
+        try {
+            configId = DeploymentUtils.getConfigId(getServer(), ebaModule);
+        } catch (CoreException e) {
+            return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.bind(Messages.REFRESH_NO_CONFIGURATION_FAIL,
ebaModule.getProject().getName()), e);
         }
         
         if (monitor.isCanceled()) {
@@ -729,11 +731,13 @@ abstract public class GeronimoServerBeha
      * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#dispose()
      */
     public void dispose() {
+        Trace.tracePoint("Entry", Activator.traceCore, "GeronimoServerBehaviourDelegate.dispose");
         stopUpdateServerStateTask();
         stopSynchronizeProjectOnServerTask();
         if (publishStateListener != null) {
             getServer().removeServerListener(publishStateListener);
         }
+        Trace.tracePoint("Exit", Activator.traceCore, "GeronimoServerBehaviourDelegate.dispose");
     }
 
     public abstract String getRuntimeClass();

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/RedeployCommand.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/RedeployCommand.java?rev=1136782&r1=1136781&r2=1136782&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/RedeployCommand.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/RedeployCommand.java
Fri Jun 17 06:09:56 2011
@@ -21,11 +21,8 @@ import java.io.File;
 import javax.enterprise.deploy.shared.CommandType;
 import javax.enterprise.deploy.spi.TargetModuleID;
 
-import org.apache.geronimo.st.v30.core.Activator;
 import org.apache.geronimo.st.v30.core.DeploymentUtils;
 import org.apache.geronimo.st.v30.core.GeronimoUtils;
-import org.apache.geronimo.st.v30.core.IGeronimoServer;
-import org.apache.geronimo.st.v30.core.ModuleArtifactMapper;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -49,25 +46,10 @@ class RedeployCommand extends DeployComm
      * @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().resolveArtifact(getServer(),
getModule());
+        String configId = DeploymentUtils.getConfigId(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"));
-        }
+        TargetModuleID id = DeploymentUtils.getTargetModuleID(getDeploymentManager(), configId);
+        TargetModuleID[] ids = new TargetModuleID[] {id};
         
         IFile dp = GeronimoUtils.getDeploymentPlanFile(getModule());
         File deploymentPlanFile = null;

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/UndeployCommand.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/UndeployCommand.java?rev=1136782&r1=1136781&r2=1136782&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/UndeployCommand.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/UndeployCommand.java
Fri Jun 17 06:09:56 2011
@@ -19,10 +19,7 @@ package org.apache.geronimo.st.v30.core.
 import javax.enterprise.deploy.shared.CommandType;
 import javax.enterprise.deploy.spi.TargetModuleID;
 
-import org.apache.geronimo.st.v30.core.Activator;
 import org.apache.geronimo.st.v30.core.DeploymentUtils;
-import org.apache.geronimo.st.v30.core.IGeronimoServer;
-import org.apache.geronimo.st.v30.core.ModuleArtifactMapper;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
@@ -45,23 +42,12 @@ class UndeployCommand extends AbstractDe
      * @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().resolveArtifact(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"));
-        }
+        String configId = DeploymentUtils.getConfigId(getServer(), getModule());
         
         TargetModuleID id = DeploymentUtils.getTargetModuleID(getDeploymentManager(), configId);
-        return new DeploymentCmdStatus(Status.OK_STATUS, getDeploymentManager().undeploy(new
TargetModuleID[] { id }));
+        TargetModuleID[] ids = new TargetModuleID[] {id};
+        
+        return new DeploymentCmdStatus(Status.OK_STATUS, getDeploymentManager().undeploy(ids));
     }
 
     /*



Mime
View raw message