geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hanhongf...@apache.org
Subject svn commit: r1084873 - in /geronimo/devtools/eclipse-plugin/trunk/plugins: org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/ org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/ org.apache...
Date Thu, 24 Mar 2011 08:27:22 GMT
Author: hanhongfang
Date: Thu Mar 24 08:27:21 2011
New Revision: 1084873

URL: http://svn.apache.org/viewvc?rev=1084873&view=rev
Log:
GERONIMODEVTOOLS-718 Update a bundle within an EBA

Added:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/commands/SetRefreshOSGiBundleCommand.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerEditorRefreshOSGiBundleSection.java
Modified:
    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/GeronimoServerBehaviourDelegate.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerDelegate.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoUtils.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/ModuleArtifactMapper.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/SynchronizeProjectOnServerTask.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
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.properties
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/plugin.xml
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/Messages.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/Messages.properties

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=1084873&r1=1084872&r2=1084873&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 Thu Mar 24 08:27:21 2011
@@ -229,7 +229,7 @@ public class DeploymentUtils {
     public static TargetModuleID getTargetModuleID(IServer server, IModule module) throws TargetModuleIdNotFoundException {
         Trace.tracePoint("Entry", "DeploymentUtils.getTargetModuleID", module);
     
-        String configId = ModuleArtifactMapper.getInstance().resolve(server, module);
+        String configId = ModuleArtifactMapper.getInstance().resolveArtifact(server, module);
         if(configId == null) {
             throw new TargetModuleIdNotFoundException("Could not do a local TargetModuleID lookup for module " + module.getName());
         }
@@ -277,7 +277,7 @@ public class DeploymentUtils {
         
         IGeronimoServer gs = (IGeronimoServer) server.getAdapter(IGeronimoServer.class);
         String currentId = gs.getVersionHandler().getConfigID(module);
-        String publishedId = ModuleArtifactMapper.getInstance().resolve(server, module);
+        String publishedId = ModuleArtifactMapper.getInstance().resolveArtifact(server, module);
         String query = publishedId != null ? publishedId : currentId;
         
         Trace.trace(Trace.INFO, "currentConfigId = " + currentId + " previousConfigId = " + publishedId);

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=1084873&r1=1084872&r2=1084873&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 Thu Mar 24 08:27:21 2011
@@ -41,6 +41,9 @@ import javax.management.remote.JMXConnec
 import javax.management.remote.JMXConnectorFactory;
 import javax.management.remote.JMXServiceURL;
 
+import org.apache.geronimo.deployment.plugin.jmx.ExtendedDeploymentManager;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.st.v30.core.UpdateServerStateTask;
 import org.apache.geronimo.st.v30.core.commands.DeploymentCmdStatus;
 import org.apache.geronimo.st.v30.core.commands.DeploymentCommandFactory;
@@ -273,6 +276,26 @@ abstract public class GeronimoServerBeha
             IModule[] toProcess = (IModule[])rootModules.toArray(new IModule[rootModules.size()]);
             status = updateSharedLib(toProcess, ProgressUtil.getSubMonitorFor(monitor, 1000));
         }
+
+        
+        ArrayList<IModule> noChangedEBAs = new ArrayList<IModule>();        
+        // noChangeEBAModules is used to record the no changed EBA modules, which also need to reset 
+        // the publish state otherwise leads to error message in server state  
+        ArrayList<IModule[]> noChangeEBAModules = new ArrayList<IModule[]>();        
+        ArrayList<IModule[]> updatedBundleWithinEBAList = new ArrayList<IModule[]>();
+        
+        if (getServerDelegate().isRefreshOSGiBundle()) {
+            for (int i = 0; i < modules.size(); i++) {
+                IModule[] module = (IModule[]) modules.get(i);
+                IModule rootModule = module[0];
+                Integer moduleDeltaKind = (Integer) deltaKind.get(i);
+                if (GeronimoUtils.isEBAModule(rootModule) && module.length == 1
+                        && moduleDeltaKind.intValue() == NO_CHANGE) {
+                    noChangedEBAs.add(rootModule);
+                }
+            }
+        }
+
         
         /* 
          * Build a map of root modules that need to be published. This is to ensure that
@@ -283,6 +306,30 @@ abstract public class GeronimoServerBeha
         for (int i = 0; i < modules.size(); i++) {
             IModule[] module = (IModule[]) modules.get(i);
             Integer moduleDeltaKind = (Integer) deltaKind.get(i);
+            IModule rootModule = module[0];
+            
+            if (getServerDelegate().isRefreshOSGiBundle()) {
+                /*
+                 * Build a map of bundles that need to be published individually without to 
+                 * publish the whole EBA they belong to  
+                 */
+                if (noChangedEBAs.contains(rootModule)) {
+                    if (module.length == 1) {
+                        noChangeEBAModules.add(module);
+                        continue;
+                    } else {
+                        if (moduleDeltaKind.intValue() == CHANGED) {
+                            updatedBundleWithinEBAList.add(module); 
+                            continue;
+                        } else if (moduleDeltaKind.intValue() == NO_CHANGE) {
+                            noChangeEBAModules.add(module);
+                            continue;
+                        }
+                    }
+                }
+            }
+            
+            
             ModuleList list = publishMap.get(module[0]);
             if (list == null) {
                 list = new ModuleList(module[0]);
@@ -313,6 +360,26 @@ abstract public class GeronimoServerBeha
                     }
                 }
             }
+            
+            if (getServerDelegate().isRefreshOSGiBundle()) {
+                for (IModule[] modules2 : updatedBundleWithinEBAList) {
+                    IModule ebaModule = modules2[0];
+                    IModule bundleModule = modules2[1];
+                    status = refreshBundle(ebaModule, bundleModule, ProgressUtil.getSubMonitorFor(monitor, 3000));
+                    if (status != null && !status.isOK()) {
+                        multi.add(status);
+                    } else {
+                        setModulePublishState(modules2, IServer.PUBLISH_STATE_NONE);
+                        setModuleStatus(modules2, null);
+                    }
+                }
+
+                for (Iterator iterator = noChangeEBAModules.iterator(); iterator.hasNext();) {
+                    IModule[] modules3 = (IModule[]) iterator.next();
+                    setModulePublishState(modules3, IServer.PUBLISH_STATE_NONE);
+                }
+            }          
+            
             /*
             List<IModule> rootModulesPublished = new ArrayList<IModule>();
             for (int i = 0; i < size; i++) {
@@ -341,6 +408,50 @@ abstract public class GeronimoServerBeha
         Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.publishModules");
     }
     
+    protected IStatus refreshBundle(IModule ebaModule, IModule bundleModule, IProgressMonitor subMonitorFor) {
+        ExtendedDeploymentManager dm;
+        try {
+            dm = (ExtendedDeploymentManager) DeploymentCommandFactory.getDeploymentManager(getServer());
+            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()));
+            }
+            AbstractName abstractName = dm.getApplicationGBeanName(Artifact.create(configId));
+            File file = getTargetFile(bundleModule);
+            String bundleId = ModuleArtifactMapper.getInstance().resolveBundle(getServer(), ebaModule, bundleModule);
+            if (bundleId != null) {
+                dm.updateEBAContent(abstractName, Long.parseLong(bundleId), file);
+            } else {
+                return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.bind(Messages.REFRESH_NO_BUNDLE_FAIL,
+                        new String[] {bundleModule.getProject().getName(), ebaModule.getProject().getName()}));
+            }
+        } catch (Exception e) {
+            return new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.REFRESH_FAIL, e);
+        }
+
+        return Status.OK_STATUS;
+    }
+    
+     
+    // copied from org.apache.geronimo.st.v30.core.commands.DeployCommand.java
+    private File getTargetFile(IModule module) {
+        
+        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(module, outputDir);
+        }
+        
+        return file;
+    }
+
     private static class ModuleList {
         private final IModule rootModule;
         private final List<IModule[]> modules;
@@ -640,6 +751,10 @@ abstract public class GeronimoServerBeha
             if (!status.isOK()) {
                 doFail(status, Messages.START_FAIL);
             } else {
+                // record the bundle project and bundle ID map to ModuleArtifactMapper since 
+                // starting EBA module leads to the included OSGi bundle project being re-installed 
+                // into geronimo server cache folder
+                addServerModuleBundleIDMap(module);
                 setModuleState(new IModule [] { module }, IServer.STATE_STARTED);
             }
         } else {
@@ -674,6 +789,11 @@ abstract public class GeronimoServerBeha
                 IStatus status = reDeploy(module, monitor);
                 if (!status.isOK()) {
                     doFail(status, Messages.REDEPLOY_FAIL);
+                } else {
+                    // record the bundle project and bundle ID map to ModuleArtifactMapper since 
+                    // starting EBA module leads to the included OSGi bundle project being re-installed 
+                    // into geronimo server cache folder
+                    addServerModuleBundleIDMap(module);
                 }
             } else {
                 //different configIds from what needs to be undeployed to what will be deployed
@@ -818,14 +938,20 @@ abstract public class GeronimoServerBeha
             doFail(status, Messages.UNDEPLOY_FAIL);
         }
 
-        ModuleArtifactMapper.getInstance().removeEntry(getServer(), module.getProject());
+        ModuleArtifactMapper.getInstance().removeArtifactBundleEntry(getServer(), module);
     }
     
     protected void doNoChange(IModule module, IProgressMonitor monitor) throws Exception {
         Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.doNoChange", module.getName());
         
         if(DeploymentUtils.getLastKnownConfigurationId(module, getServer()) != null) {
-            start(module, monitor);
+            IStatus status = start(module, monitor);
+            if (status!=null && status.isOK()) {
+                // record the bundle project and bundle ID map to ModuleArtifactMapper since 
+                // starting EBA module leads to the included OSGi bundle project being re-installed 
+                // into geronimo server cache folder
+                addServerModuleBundleIDMap(module);
+            }
         } else {
             doAdded(module, null, monitor);
         }
@@ -844,6 +970,11 @@ abstract public class GeronimoServerBeha
         status = start(module, monitor);
         if (!status.isOK()) {
             doFail(status, Messages.START_FAIL);
+        } else {
+            // record the bundle project and bundle ID map to ModuleArtifactMapper since 
+            // starting EBA module leads to the included OSGi bundle project being re-installed 
+            // into geronimo server cache folder
+            addServerModuleBundleIDMap(module);
         }
 
         Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.doRestart");
@@ -852,9 +983,19 @@ abstract public class GeronimoServerBeha
     private TargetModuleID[] updateServerModuleConfigIDMap(IModule module, IStatus status) {
         TargetModuleID[] ids = ((DeploymentCmdStatus) status).getResultTargetModuleIDs();
         ModuleArtifactMapper mapper = ModuleArtifactMapper.getInstance();
-        mapper.addEntry(getServer(), module.getProject(), ids[0].getModuleID());
+        mapper.addArtifactEntry(getServer(), module, ids[0].getModuleID());
         return ids;
     }
+    
+    private void addServerModuleBundleIDMap(IModule module) {
+        ModuleArtifactMapper mapper = ModuleArtifactMapper.getInstance();
+        mapper.addBundleEntry(getServer(), module);
+    }
+    
+    private void removeServerModuleBundleIDMap(IModule module) {
+        ModuleArtifactMapper mapper = ModuleArtifactMapper.getInstance();
+        mapper.removeBundleEntry(getServer(), module);
+    }
 
     protected void doFail(IStatus status, String message) throws CoreException {
         MultiStatus ms = new MultiStatus(Activator.PLUGIN_ID, 0, message, null);
@@ -1190,7 +1331,15 @@ abstract public class GeronimoServerBeha
     public void startModule(IModule[] module, IProgressMonitor monitor) {
         Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.startModule", Arrays.asList(module));
         try {
-            start(module[0], monitor);
+            IStatus status = start(module[0], monitor);
+            if (status!=null && status.isOK()) {
+                for (IModule m : module) {
+                    // record the bundle project and bundle ID map to ModuleArtifactMapper since 
+                    // starting EBA module leads to the included OSGi bundle project being re-installed 
+                    // into geronimo server cache folder
+                    addServerModuleBundleIDMap(m);
+                }                
+            }
         } catch (Exception e) {
             Trace.trace(Trace.SEVERE, "Error starting module " + module[0].getName(), e);
             throw new RuntimeException("Error starting module " + module[0].getName(), e);
@@ -1202,7 +1351,15 @@ abstract public class GeronimoServerBeha
     public void stopModule(IModule[] module, IProgressMonitor monitor) {
         Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.stopModule", Arrays.asList(module));
         try {
-            stop(module[0], monitor);
+            IStatus status = stop(module[0], monitor);
+            // remove bundle project and bundle ID map from ModuleArtifactMapper if it is EBA module, 
+            // since restarting EBA module will lead to the included OSGi bundle project being re-installed 
+            // into geronimo server cache folder
+            if (status != null && status.isOK()) {
+                for (IModule m : module) {
+                    removeServerModuleBundleIDMap(m);
+                }                
+            }
         } catch (Exception e) {
             Trace.trace(Trace.SEVERE, "Error stopping module " + module[0].getName(), e);
             throw new RuntimeException("Error stopping module " + module[0].getName(), e);
@@ -1214,8 +1371,25 @@ abstract public class GeronimoServerBeha
     public void restartModule(IModule[] module, IProgressMonitor monitor) {
         Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.restartModule", Arrays.asList(module));
         try {
-            stop(module[0], monitor);
-            start(module[0], monitor);            
+            IStatus status = stop(module[0], monitor);            
+            // remove bundle project and bundle ID map from ModuleArtifactMapper if it is EBA module, 
+            // since restarting EBA module will lead to the included OSGi bundle project being re-installed 
+            // into geronimo server cache folder
+            if (status != null && status.isOK()) {
+                for (IModule m : module) {
+                    removeServerModuleBundleIDMap(m);
+                }                
+            }
+            
+            status = start(module[0], monitor);
+            if (status!=null && status.isOK()) {
+                for (IModule m : module) {
+                    // record the bundle project and bundle ID map to ModuleArtifactMapper since 
+                    // starting EBA module leads to the included OSGi bundle project being re-installed 
+                    // into geronimo server cache folder
+                    addServerModuleBundleIDMap(m);
+                }                
+            }
         } catch (Exception e) {
             Trace.trace(Trace.SEVERE, "Error restarting module " + module[0].getName(), e);
             throw new RuntimeException("Error restarting module " + module[0].getName(), e);

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerDelegate.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/GeronimoServerDelegate.java?rev=1084873&r1=1084872&r2=1084873&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerDelegate.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerDelegate.java Thu Mar 24 08:27:21 2011
@@ -75,6 +75,8 @@ abstract public class GeronimoServerDele
     public static final String PROPERTY_HTTP_PORT = "WebConnector";
 
     public static final String PROPERTY_CLEAN_OSGI_BUNDLE_CACHE = "cleanOSGiBundleCache";
+    
+    public static final String PROPERTY_REFRESH_OSGI_BUNDLE = "refreshOSGiBundle";
 
     public static final String PROPERTY_LOG_LEVEL = "logLevel";
     
@@ -346,6 +348,7 @@ abstract public class GeronimoServerDele
         setRMINamingPort("1099");
         setConsoleLogLevel(CONSOLE_INFO);
         setCleanOSGiBundleCache(false);
+        setRefreshOSGiBundle(false);
         setKarafShell(false);
         setPingDelay(new Integer(10000));
         setMaxPings(new Integer(40));
@@ -445,6 +448,18 @@ abstract public class GeronimoServerDele
         updateProgramArgsFromProperties();
     }
     
+    //
+    // REFRESH_OSGI_BUNDLE
+    //
+    public boolean isRefreshOSGiBundle() {
+        String enable = getInstanceProperty(PROPERTY_REFRESH_OSGI_BUNDLE);
+        return Boolean.valueOf(enable);
+    }
+    
+    public void setRefreshOSGiBundle(boolean value) {
+        setInstanceProperty(PROPERTY_REFRESH_OSGI_BUNDLE, Boolean.toString(value));
+    }
+    
     
     /**
      * remove args no longer specified, add newly specified args, and only specify them once.

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoUtils.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/GeronimoUtils.java?rev=1084873&r1=1084872&r2=1084873&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoUtils.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoUtils.java Thu Mar 24 08:27:21 2011
@@ -37,6 +37,7 @@ import org.apache.geronimo.st.v30.core.o
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.jst.j2ee.internal.deployables.J2EEFlexProjDeployable;
 import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
@@ -46,6 +47,8 @@ import org.eclipse.wst.common.componentc
 import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
 import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
 import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.internal.ModuleFactory;
+import org.eclipse.wst.server.core.internal.ServerPlugin;
 import org.osgi.framework.Version;
 
 /**
@@ -437,4 +440,17 @@ public class GeronimoUtils {
         Trace.tracePoint("EXIT", "GeronimoUtils.getConnectorDeploymentPlan", null);
         return null;
     }
+    
+    public static IModule[] getModules(IProject project) {
+        ModuleFactory[] factories = ServerPlugin.getModuleFactories();
+        if (factories != null) {
+            for (ModuleFactory factory : factories) {
+                IModule[] modules = factory.getModules(project, new NullProgressMonitor());
+                if (modules != null && modules.length != 0) {
+                    return modules;
+                }
+            }
+        }
+        return new IModule [0];
+    }
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/ModuleArtifactMapper.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/ModuleArtifactMapper.java?rev=1084873&r1=1084872&r2=1084873&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/ModuleArtifactMapper.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/ModuleArtifactMapper.java Thu Mar 24 08:27:21 2011
@@ -28,9 +28,18 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutput;
 import java.io.ObjectOutputStream;
 import java.io.OutputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Map;
 
+import org.apache.geronimo.deployment.plugin.jmx.ExtendedDeploymentManager;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.st.v30.core.commands.DeploymentCommandFactory;
+import org.apache.geronimo.st.v30.core.osgi.AriesHelper;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.wst.server.core.IModule;
@@ -44,13 +53,17 @@ public class ModuleArtifactMapper {
 
     private static ModuleArtifactMapper instance = new ModuleArtifactMapper();
 
-    private static final String FILE_NAME = "servermodule.info";
+    private static final String FILE_NAME = "servermodule.info";    
+    private static final String FILE_NAME2 = "serverbundle.info";
 
-    ServerEntries serverEntries = null;
+    ServerEntries serverArtifactEntries = null;    
+    ServerEntries2 serverBundleEntries = null;
 
     private ModuleArtifactMapper() {
-        if (serverEntries == null)
-            serverEntries = new ServerEntries();
+        if (serverArtifactEntries == null)
+            serverArtifactEntries = new ServerEntries();
+        if (serverBundleEntries == null) 
+            serverBundleEntries = new ServerEntries2();
         load();
     }
 
@@ -58,49 +71,187 @@ public class ModuleArtifactMapper {
         return instance;
     }
 
-    synchronized public void addEntry(IServer server, IProject project, String configId) {
+    synchronized public void addArtifactEntry(IServer server, IModule module, String configId) {
 
         if (!SocketUtil.isLocalhost(server.getHost()))
             return;
 
         File runtimeLoc = server.getRuntime().getLocation().toFile();
-        Map artifactEntries = (Map) serverEntries.get(runtimeLoc);
+        Map artifactEntries = (Map) serverArtifactEntries.get(runtimeLoc);
         if (artifactEntries == null) {
             artifactEntries = new HashMap();
-            serverEntries.put(runtimeLoc, artifactEntries);
+            serverArtifactEntries.put(runtimeLoc, artifactEntries);
         }
 
-        artifactEntries.put(project.getName(), configId);
+        artifactEntries.put(module.getProject().getName(), configId);       
     }
+    
+    synchronized public void addBundleEntry(IServer server, IModule eba) {
+        
+        if (!GeronimoUtils.isEBAModule(eba))
+            return;        
+        if (!SocketUtil.isLocalhost(server.getHost()))
+            return;
+
+        File runtimeLoc = server.getRuntime().getLocation().toFile();
+        
+        Map bundleEntries = (Map) serverBundleEntries.get(runtimeLoc);
+        if (bundleEntries == null) {
+            bundleEntries = new HashMap();
+            serverBundleEntries.put(runtimeLoc, bundleEntries);
+        }
+        
+        // first clean up the previous bundle entries for this eba if such entries exist
+        removeBundleEntry(bundleEntries, eba);
+        
+        try {
+            String configId = this.resolveArtifact(server, eba);
+            IModule[] bundleModules = getChildModules(eba);            
+            ExtendedDeploymentManager dm = (ExtendedDeploymentManager) DeploymentCommandFactory.getDeploymentManager(server);
+            AbstractName abstractName = dm.getApplicationGBeanName(Artifact.create(configId));
+            long[] bundleIds = dm.getEBAContentBundleIds(abstractName);
+
+            for (long bundleId : bundleIds) {
+                String symbolicName = dm.getEBAContentBundleSymbolicName(abstractName, bundleId);
+                if (symbolicName != null) {
+                    for (IModule bundleModule : bundleModules) {
+                        if (symbolicName.equals(getSymbolicName(bundleModule))) {
+                            EBABundle ebaBundle = new EBABundle(eba, bundleModule);
+                            bundleEntries.put(ebaBundle, Long.toString(bundleId));
+                            break;
+                        }
+                    }
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }     
+        
+    }
+      
+    synchronized public void removeBundleEntry(IServer server, IModule eba) {
+
+        if (!GeronimoUtils.isEBAModule(eba))
+            return;
+        if (!SocketUtil.isLocalhost(server.getHost()))
+            return;
+
+        File runtimeLoc = server.getRuntime().getLocation().toFile();
+        Map bundleEntries = (Map) serverBundleEntries.get(runtimeLoc);    
+        removeBundleEntry(bundleEntries, eba);
+    }
+    
+    private void removeBundleEntry(Map map, IModule eba) {
+        
+        if (map == null)
+            return;
+        
+        Iterator<EBABundle> iterator = map.keySet().iterator();
+        ArrayList<EBABundle> removes = new ArrayList<EBABundle>();
+        for ( ; iterator.hasNext();) {
+            EBABundle ebaBundle = iterator.next();
+            if (ebaBundle.ebaName != null && ebaBundle.ebaName.equals(eba.getProject().getName())) {
+                removes.add(ebaBundle);
+            }
+        }            
+        if (removes.size()!=0) {
+            for (EBABundle remove : removes) {
+                map.remove(remove);
+            }
+        }
+    }
+    
+    private IModule[] getChildModules(IModule ebaModule){
+        if (AriesHelper.isAriesInstalled()) {
+            try {
+                Class class1 = Class.forName("com.ibm.etools.aries.internal.core.modules.AriesModuleDelegate");
+                Method method = class1.getMethod("getChildModules");
+                Constructor constructor = class1.getConstructor(IProject.class);
+                Object object = constructor.newInstance(ebaModule.getProject());
+                return (IModule[]) method.invoke(object);                
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }        
+        return new IModule[0];
+    }
+    
+    private String getSymbolicName(IModule module) {
+        if (AriesHelper.isAriesInstalled()) {
+            try {
+                Class class1 = Class.forName("com.ibm.etools.aries.internal.core.utils.AriesUtils");
+                Method method = class1.getMethod("getBundleSymbolicName", IProject.class);
+                return (String) method.invoke(null, module.getProject());
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return null;
+    }
+    
 
-    synchronized public void removeEntry(IServer server, IProject project) {
+    synchronized public void removeArtifactBundleEntry(IServer server, IModule module) {
 
         if (!SocketUtil.isLocalhost(server.getHost()))
             return;
 
         File runtimeLoc = server.getRuntime().getLocation().toFile();
-        Map artifactEntries = (Map) serverEntries.get(runtimeLoc);
+        Map artifactEntries = (Map) serverArtifactEntries.get(runtimeLoc);
         if (artifactEntries != null) {
-            artifactEntries.remove(project.getName());
+            artifactEntries.remove(module.getProject().getName());
+        }
+        
+        if (GeronimoUtils.isEBAModule(module)) {
+            removeBundleEntry(server, module);
         }
     }
 
-    synchronized public String resolve(IServer server, IModule module) {
-        Map artifactEntries = (Map) serverEntries.get(server.getRuntime().getLocation().toFile());
-        if (artifactEntries != null && module != null && module.getProject() != null) {
-            return (String) artifactEntries.get(module.getProject().getName());
+    synchronized public String resolveArtifact(IServer server, IModule module) {        
+        if (module != null ) {
+            return resolveArtifact(server, module.getProject());
         }
         return null;
     }
+    
+    synchronized public String resolveArtifact(IServer server, IProject project) {
+        Map artifactEntries = (Map) serverArtifactEntries.get(server.getRuntime().getLocation().toFile());
+        if (artifactEntries != null && project != null) {
+            return (String) artifactEntries.get(project.getName());
+        }
+        return null;
+    }
+    
+    synchronized public String resolveBundle(IServer server, IModule eba, IModule bundle) {
+        Map bundleEntries = (Map) serverBundleEntries.get(server.getRuntime().getLocation().toFile());
+        if (bundleEntries != null && eba != null && bundle!=null) {
+            return (String) bundleEntries.get(new EBABundle(eba, bundle));            
+        }
+        return null;
+    }
+    
+    synchronized public HashMap getServerArtifactsMap(IServer server) {
+        if (!SocketUtil.isLocalhost(server.getHost())) {
+            return null;
+        }            
+        
+        File runtimeLoc = server.getRuntime().getLocation().toFile();  
+        HashMap artifactEntries = (HashMap) serverArtifactEntries.get(runtimeLoc);
+        if (artifactEntries == null) {
+            artifactEntries = new HashMap();
+            serverArtifactEntries.put(runtimeLoc, artifactEntries);
+        }
+        
+        return artifactEntries;        
+    }
 
-    synchronized public void save() {
+    private void save(IServerEntries entries, String fileName) {
         ObjectOutput output = null;
         try {
-            IPath dest = Activator.getDefault().getStateLocation().append(FILE_NAME);
+            IPath dest = Activator.getDefault().getStateLocation().append(fileName);
             OutputStream file = new FileOutputStream(dest.toFile());
             OutputStream buffer = new BufferedOutputStream(file);
             output = new ObjectOutputStream(buffer);
-            String xml = serverEntries.toXML();
+            String xml = entries.toXML();
             output.writeObject(xml);
         } catch (IOException e) {
             e.printStackTrace();
@@ -113,17 +264,22 @@ public class ModuleArtifactMapper {
             }
         }
     }
+    
+    synchronized public void save() {
+        save(serverArtifactEntries, FILE_NAME);
+        save(serverBundleEntries, FILE_NAME2);
+    }
 
-    synchronized private void load() {
+    private void load(IServerEntries entries, String fileName) {
         ObjectInput input = null;
         try {
-            IPath dest = Activator.getDefault().getStateLocation().append(FILE_NAME);
+            IPath dest = Activator.getDefault().getStateLocation().append(fileName);
             if (dest.toFile().exists()) {
                 InputStream file = new FileInputStream(dest.toFile());
                 InputStream buffer = new BufferedInputStream(file);
                 input = new ObjectInputStream(buffer);
                 String xml = (String) input.readObject();
-                serverEntries.loadXML(xml);
+                entries.loadXML(xml);
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -136,7 +292,44 @@ public class ModuleArtifactMapper {
             }
         }
     }
+    
+    synchronized private void load() {
+        load(serverArtifactEntries, FILE_NAME);
+        load(serverBundleEntries, FILE_NAME2);
+    }
+    
+    protected class EBABundle {
+        String ebaName;
+        String bundleName;
+
+        public EBABundle(IModule eba, IModule bundle) {
+                this.ebaName = eba.getProject().getName();
+                this.bundleName = bundle.getProject().getName();
+        }
+        
+        public EBABundle(String ebaName, String bundleName) {
+            this.ebaName = ebaName;
+            this.bundleName = bundleName;
+        }
+
+        public boolean equals(Object bundle) {
+            if (bundle instanceof EBABundle) {
+                return bundleName.equals(((EBABundle) bundle).bundleName)
+                        && ebaName.equals(((EBABundle) bundle).ebaName);
+            }
+            return false;
+        }
+        
+        public int hashCode() {
+            return ebaName.hashCode() + bundleName.hashCode();
+        }
+    }
 
+    protected interface IServerEntries{
+        public  void loadXML (String xml);
+        public String toXML ();
+        
+    }
     // This Inner class is the result of removing XStream.  ModuleArtifactMapper
     // was the only class using it so it seemed silly to have two extra jar
     // files (xpp3.jar and xstream.jar) just for one class.
@@ -144,10 +337,10 @@ public class ModuleArtifactMapper {
     // keys are the files
     // entries are the Maps of artifact entries
     // this is all saved/loaded to .plugins/org.apache.geronimo.st.v30.core/servermodule.info
-    protected class ServerEntries extends HashMap {
+    protected class ServerEntries extends HashMap implements IServerEntries{
         static final long serialVersionUID = 0;
 
-        protected void loadXML (String xml) {
+        public void loadXML (String xml) {
             if (xml == null || xml.length() == 0)
                 return;
 
@@ -183,7 +376,7 @@ public class ModuleArtifactMapper {
             }
         }
 
-        protected String toXML () {
+        public String toXML () {
             String xmlString = "";
             if (!isEmpty()) {
                 xmlString = "<map>\n  <entry>\n";
@@ -214,18 +407,85 @@ public class ModuleArtifactMapper {
         }
     }
     
-    synchronized public HashMap getServerArtifactsMap(IServer server) {
-        if (!SocketUtil.isLocalhost(server.getHost())) {
-            return null;
-        }            
-        
-        File runtimeLoc = server.getRuntime().getLocation().toFile();  
-        HashMap artifactEntries = (HashMap) serverEntries.get(runtimeLoc);
-        if (artifactEntries == null) {
-            artifactEntries = new HashMap();
-            serverEntries.put(runtimeLoc, artifactEntries);
+    // This Inner class is the result of removing XStream.  ModuleArtifactMapper
+    // was the only class using it so it seemed silly to have two extra jar
+    // files (xpp3.jar and xstream.jar) just for one class.
+    // this class is a HashMap
+    // keys are the files
+    // entries are the Maps of bundle entries
+    // this is all saved/loaded to .plugins/org.apache.geronimo.st.v30.core/serverbundle.info
+    protected class ServerEntries2 extends HashMap implements IServerEntries{
+        static final long serialVersionUID = 0;
+
+        public void loadXML (String xml) {
+            if (xml == null || xml.length() == 0)
+                return;
+
+            String ebaProjectName, bundleProjectName, bundleId;
+            int fileEndPos, nomapStartPos, mapStartPos, mapEndPos, stringStartPos, stringEndPos;
+            int fileStartPos = xml.indexOf("<file>", 0);
+            Map bundleEntries;
+            while (fileStartPos > -1) {
+                fileEndPos = xml.indexOf("</file>", fileStartPos);
+                File runtimeLoc = new File(xml.substring(fileStartPos + 6, fileEndPos));
+
+                nomapStartPos = xml.indexOf("<map/>", fileEndPos);
+                mapStartPos = xml.indexOf("<map>", fileEndPos);
+                bundleEntries = new HashMap();
+                // have EBAs on the server
+                if ((nomapStartPos == -1) || (nomapStartPos > mapStartPos)) {
+                    mapEndPos = xml.indexOf("</map>", mapStartPos);
+                    stringStartPos = xml.indexOf("<string>", mapStartPos);
+                    while ((stringStartPos > -1) && (stringStartPos < mapEndPos)) {
+                        stringEndPos = xml.indexOf("</string>", stringStartPos);
+                        ebaProjectName = xml.substring(stringStartPos + 8, stringEndPos);
+                        stringStartPos = xml.indexOf("<string>", stringEndPos);
+                        stringEndPos = xml.indexOf("</string>", stringStartPos);
+                        bundleProjectName = xml.substring(stringStartPos + 8, stringEndPos);
+                        stringStartPos = xml.indexOf("<string>", stringEndPos);
+                        stringEndPos = xml.indexOf("</string>", stringStartPos);
+                        bundleId = xml.substring(stringStartPos + 8, stringEndPos);
+                        bundleEntries.put(new EBABundle(ebaProjectName, bundleProjectName), bundleId);
+                        stringStartPos = xml.indexOf("<string>", stringEndPos);
+                    }
+                }
+                // if no projects on the server, it is ok to put an empty HashMap
+                this.put (runtimeLoc, bundleEntries);
+
+                fileStartPos = xml.indexOf("<file>", fileEndPos);
+            }
+        }
+
+        public String toXML () {
+            String xmlString = "";
+            if (!isEmpty()) {
+                xmlString = "<map>\n  <entry>\n";
+
+                Object[] serverKeySet = keySet().toArray();
+                for (int i = 0; i < serverKeySet.length; i++) {
+                    xmlString += "    <file>" + serverKeySet[i] + "</file>\n";
+                    Map bundleMap = (Map)get(serverKeySet[i]);
+                    if (bundleMap == null || bundleMap.size() == 0) {
+                        xmlString += "    <map/>\n";
+                    }
+                    else {
+                        xmlString += "    <map>\n";
+                        Object[] bundleKeySet = bundleMap.keySet().toArray();
+                        for (int j = 0; j < bundleKeySet.length; j++)
+                        {
+                             xmlString += "      <entry>\n";
+                             xmlString += "        <string>" + ((EBABundle)bundleKeySet[j]).ebaName + "</string>\n";
+                             xmlString += "        <string>" + ((EBABundle)bundleKeySet[j]).bundleName + "</string>\n";
+                             xmlString += "        <string>" + (String)bundleMap.get(bundleKeySet[j]) + "</string>\n";
+                             xmlString += "      </entry>\n";
+                        }
+                        xmlString += "    </map>\n";
+                    }
+                }
+                xmlString += "  </entry>\n</map>";
+            }
+            return xmlString;
         }
-        
-        return artifactEntries;        
     }
+    
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/SynchronizeProjectOnServerTask.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/SynchronizeProjectOnServerTask.java?rev=1084873&r1=1084872&r2=1084873&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/SynchronizeProjectOnServerTask.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/SynchronizeProjectOnServerTask.java Thu Mar 24 08:27:21 2011
@@ -71,7 +71,6 @@ public class SynchronizeProjectOnServerT
                     synchronized (projectsOnServer) {                        
                         Iterator projectsIterator = projectsOnServer.keySet().iterator();
                         TreeSet<String> removedConfigIds = new TreeSet<String>();
-                        List<IProject> removedProjects = new ArrayList<IProject>();
                         List<IModule> removedModules = new ArrayList<IModule>();
                         
                         DeploymentManager dm = DeploymentCommandFactory.getDeploymentManager(server);
@@ -83,8 +82,7 @@ public class SynchronizeProjectOnServerT
                             if (!isInstalledModule(ids, configID)) {
                                 removedConfigIds.add(configID);
                                 IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
-                                removedProjects.add(project);
-                                IModule[] modules = getModules(project);
+                                IModule[] modules = GeronimoUtils.getModules(project);
                                 for (IModule module : modules) {
                                     removedModules.add(module);
                                 }
@@ -94,7 +92,7 @@ public class SynchronizeProjectOnServerT
                         if (removedConfigIds.size() != 0 && removedModules.size() != 0) {
                             IModule[] removedModules2 = new IModule[removedModules.size()];
                             removedModules.toArray(removedModules2);
-                            removeModules(removedModules2, removedProjects);
+                            removeModules(removedModules2);
                         } else {
                             Trace.trace(Trace.INFO, "SynchronizeProjectOnServerTask: no configuration is removed outside eclipse on server: " + this.server.getId());
                         }
@@ -130,9 +128,9 @@ public class SynchronizeProjectOnServerT
         return false;
     }
       
-    private void removeModules(IModule[] remove, List<IProject> projects) {
+    private void removeModules(IModule[] remove) {
         
-        Trace.tracePoint("Entry ", "SynchronizeProjectOnServerTask.removeModules", remove, projects);
+        Trace.tracePoint("Entry ", "SynchronizeProjectOnServerTask.removeModules", remove);
         
         IServerWorkingCopy wc = server.createWorkingCopy();
         IProgressMonitor monitor = new NullProgressMonitor(); 
@@ -141,9 +139,9 @@ public class SynchronizeProjectOnServerT
             wc.modifyModules(null, remove, monitor);
             server = wc.save(true, monitor); 
 
-            if (projects != null) {
-                for (IProject project : projects) {
-                    ModuleArtifactMapper.getInstance().removeEntry(this.server, project);
+            if (remove != null) {
+                for (IModule module : remove) {
+                    ModuleArtifactMapper.getInstance().removeArtifactBundleEntry(this.server, module);
                 }
             }           
         } catch (CoreException e) {
@@ -152,19 +150,6 @@ public class SynchronizeProjectOnServerT
         
         Trace.tracePoint("Exist ", "SynchronizeProjectOnServerTask.removeModules");
     }
-
-    private IModule[] getModules(IProject project) {
-        ModuleFactory[] factories = ServerPlugin.getModuleFactories();
-        if (factories != null) {
-            for (ModuleFactory factory : factories) {
-                IModule[] modules = factory.getModules(project, new NullProgressMonitor());
-                if (modules != null && modules.length != 0) {
-                    return modules;
-                }
-            }
-        }
-        return new IModule [0];
-    }
     
     private boolean canUpdateState() {
         

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=1084873&r1=1084872&r2=1084873&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 Thu Mar 24 08:27:21 2011
@@ -49,7 +49,7 @@ 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().resolve(getServer(), getModule());
+        String configId = ModuleArtifactMapper.getInstance().resolveArtifact(getServer(), getModule());
         
         if(configId == null) {
             IGeronimoServer gs = (IGeronimoServer) getServer().getAdapter(IGeronimoServer.class);

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=1084873&r1=1084872&r2=1084873&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 Thu Mar 24 08:27:21 2011
@@ -45,7 +45,7 @@ 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().resolve(getServer(), getModule());
+        String configId = ModuleArtifactMapper.getInstance().resolveArtifact(getServer(), getModule());
 
         if(configId == null) {
             IGeronimoServer gs = (IGeronimoServer) getServer().getAdapter(IGeronimoServer.class);

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.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/internal/Messages.java?rev=1084873&r1=1084872&r2=1084873&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.java Thu Mar 24 08:27:21 2011
@@ -34,6 +34,9 @@ public class Messages extends NLS {
     public static String STOP_FAIL;
     public static String UNDEPLOY_FAIL;
     public static String REDEPLOY_FAIL;
+    public static String REFRESH_FAIL;
+    public static String REFRESH_NO_CONFIGURATION_FAIL;
+    public static String REFRESH_NO_BUNDLE_FAIL;
     public static String DM_CONNECTION_FAIL;
 
     public static String errorJRE;

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.properties
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/internal/Messages.properties?rev=1084873&r1=1084872&r2=1084873&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.properties (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.properties Thu Mar 24 08:27:21 2011
@@ -21,6 +21,9 @@ START_FAIL=Starting of module failed.  S
 STOP_FAIL=Stopping of module failed.  See log for details.
 UNDEPLOY_FAIL=Undeploy of module failed.  See log for details.
 REDEPLOY_FAIL=Redeploy of module failed.  See log for details.
+REFRESH_FAIL=Refresh of bundle failed. See log for details.
+REFRESH_NO_CONFIGURATION_FAIL=The configuration ID of OSGi application project {0} can not be found.
+REFRESH_NO_BUNDLE_FAIL=The bundle ID of OSGI bundle project {0} in OSGi application project {1} can not be found. 
 DM_CONNECTION_FAIL=Connection to deployment manager failed.  See log for details.
 
 target11runtime=Geronimo v1.1 Runtime

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/plugin.xml?rev=1084873&r1=1084872&r2=1084873&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/plugin.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/plugin.xml Thu Mar 24 08:27:21 2011
@@ -165,6 +165,14 @@
         </section>
     </extension>
     
+	<extension point="org.eclipse.wst.server.ui.editorPageSections">
+		<section id="org.apache.server.geronimo.cleanOSGiBundleCache" order="23"
+		    insertionId="org.eclipse.wst.server.editor.overview.right"
+		    typeIds="org.apache.geronimo.server.30"
+		    class="org.apache.geronimo.st.v30.ui.sections.ServerEditorRefreshOSGiBundleSection">
+		</section>
+	</extension>
+    
     <extension point="org.eclipse.wst.server.ui.editorPageSections">
         <section id="org.apache.server.geronimo.security" order="30"
             insertionId="org.eclipse.wst.server.editor.overview.right"

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/commands/SetRefreshOSGiBundleCommand.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/commands/SetRefreshOSGiBundleCommand.java?rev=1084873&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/commands/SetRefreshOSGiBundleCommand.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/commands/SetRefreshOSGiBundleCommand.java Thu Mar 24 08:27:21 2011
@@ -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.v30.ui.commands;
+
+import org.apache.geronimo.st.v30.core.GeronimoServerDelegate;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class SetRefreshOSGiBundleCommand extends ServerCommand {
+    
+
+    boolean value;
+
+    boolean oldValue;
+
+    public SetRefreshOSGiBundleCommand(IServerWorkingCopy server, boolean value) {
+        super(server, "SetRefreshOSGiBundleCommand");
+        this.value = value;
+        
+    }
+    
+    @Override
+    public void execute() {
+        GeronimoServerDelegate gs = getGeronimoServer();
+        oldValue = gs.isRefreshOSGiBundle();
+        gs.setRefreshOSGiBundle(value);
+    }
+
+    @Override
+    public void undo() {
+        getGeronimoServer().setRefreshOSGiBundle(oldValue);
+    }
+    
+    private GeronimoServerDelegate getGeronimoServer() {
+        GeronimoServerDelegate gs = (GeronimoServerDelegate) server.getAdapter(GeronimoServerDelegate.class);
+        if (gs == null) {
+            gs = (GeronimoServerDelegate) server.loadAdapter(GeronimoServerDelegate.class, new NullProgressMonitor());
+        }
+        return gs;
+    }
+
+}

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/Messages.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/Messages.java?rev=1084873&r1=1084872&r2=1084873&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/Messages.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/Messages.java Thu Mar 24 08:27:21 2011
@@ -47,6 +47,11 @@ public class Messages extends NLS {
     public static String editorSectionCleanOSGiBundleCacheDescription;
     public static String cleanOSGiBundleCache;
     
+    public static String editorSectionRefreshOSGiBundleTitle;
+    public static String editorSectionRefreshOSGiBundleDescription;
+    public static String refreshOSGiBundle;
+    public static String refreshOSGiBundleNotes;
+    
     public static String editorSectionKarafShellTitle;
     public static String editorSectionKarafShellDescription;
     public static String enableKarafShell;

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/Messages.properties
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/Messages.properties?rev=1084873&r1=1084872&r2=1084873&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/Messages.properties (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/Messages.properties Thu Mar 24 08:27:21 2011
@@ -94,6 +94,11 @@ editorSectionCleanOSGiBundleCacheTitle=C
 editorSectionCleanOSGiBundleCacheDescription=Select whether to clean the OSGi bundle cache.
 cleanOSGiBundleCache=Clean OSGi bundle cache
 
+editorSectionRefreshOSGiBundleTitle=Refresh OSGi bundle within OSGi application
+editorSectionRefreshOSGiBundleDescription=Select whether to refresh the modified OSGi bundle only.
+refreshOSGiBundle=Refresh the modified OSGi bundle only
+refreshOSGiBundleNotes=When you choose to refresh the modified OSGi bundle instead of re-deploying the whole OSGi application, the updated OSGi bundle will be kept in Geronimo server cache. If Geronimo server is restarted with the --clean option or the OSGi application is restarted, all changes on server side will be lost.
+
 editorSectionKarafShellTitle=Karaf shell in Eclipse console
 editorSectionKarafShellDescription=Select whether to enable the Karaf shell in Eclipse console window.
 enableKarafShell=Enable

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerEditorRefreshOSGiBundleSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerEditorRefreshOSGiBundleSection.java?rev=1084873&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerEditorRefreshOSGiBundleSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerEditorRefreshOSGiBundleSection.java Thu Mar 24 08:27:21 2011
@@ -0,0 +1,92 @@
+/*
+ * 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.v30.ui.sections;
+
+import org.apache.geronimo.st.v30.core.GeronimoServerDelegate;
+import org.apache.geronimo.st.v30.ui.commands.SetCleanOSGiBundleCacheCommand;
+import org.apache.geronimo.st.v30.ui.commands.SetRefreshOSGiBundleCommand;
+import org.apache.geronimo.st.v30.ui.internal.Messages;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class ServerEditorRefreshOSGiBundleSection extends AbstractServerEditorSection {
+
+    Button refreshOSGiBundle;
+    
+    public ServerEditorRefreshOSGiBundleSection() {
+        super();
+    }
+    
+    public void createSection(Composite parent) {
+        super.createSection(parent);
+
+        FormToolkit toolkit = getFormToolkit(parent.getDisplay());
+
+        Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE
+                | ExpandableComposite.EXPANDED
+                | ExpandableComposite.TITLE_BAR
+                | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE);
+        
+        section.setText(Messages.editorSectionRefreshOSGiBundleTitle);
+        section.setDescription(Messages.editorSectionRefreshOSGiBundleDescription);
+        section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+        
+        Composite composite = toolkit.createComposite(section);
+        GridLayout layout = new GridLayout();
+        layout.numColumns = 1;
+        layout.marginHeight = 5;
+        layout.marginWidth = 10;
+        layout.verticalSpacing = 5;
+        layout.horizontalSpacing = 15;
+        composite.setLayout(layout);
+        composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+        section.setClient(composite);
+        
+        refreshOSGiBundle = toolkit.createButton(composite, Messages.refreshOSGiBundle, SWT.CHECK);
+        GeronimoServerDelegate gsd = (GeronimoServerDelegate) server.getAdapter(GeronimoServerDelegate.class);
+        boolean refreshEnabled = gsd.isRefreshOSGiBundle();
+        refreshOSGiBundle.setSelection(refreshEnabled);
+        
+        refreshOSGiBundle.addSelectionListener( new SelectionListener(){
+            public void widgetSelected(SelectionEvent e) {
+                execute(new SetRefreshOSGiBundleCommand(server, refreshOSGiBundle.getSelection()));
+                if (refreshOSGiBundle.getSelection()) {
+                    MessageDialog.openInformation(Display.getCurrent().getActiveShell(), Messages.editorSectionRefreshOSGiBundleTitle, Messages.refreshOSGiBundleNotes);
+                }
+            }
+
+            public void widgetDefaultSelected(SelectionEvent e) {
+            }
+            
+        });
+        
+    }
+}



Mime
View raw message