geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1147527 - in /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core: ./ src/main/java/org/apache/geronimo/st/v30/core/
Date Sun, 17 Jul 2011 05:17:26 GMT
Author: gawor
Date: Sun Jul 17 05:17:23 2011
New Revision: 1147527

URL: http://svn.apache.org/viewvc?rev=1147527&view=rev
Log:
reduce number of classes

Removed:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoRuntime.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServer.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviour.java
Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/plugin.xml
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoRuntimeDelegate.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/IGeronimoServer.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/plugin.xml?rev=1147527&r1=1147526&r2=1147527&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/plugin.xml
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/plugin.xml
Sun Jul 17 05:17:23 2011
@@ -34,7 +34,7 @@
                 name="%runtimeTypeName"
                 description="%runtimeTypeDescription"
                 vendor="%runtimeTypeVendor"
-                class="org.apache.geronimo.st.v30.core.GeronimoRuntime">
+                class="org.apache.geronimo.st.v30.core.GeronimoRuntimeDelegate">
             <moduleType types="jst.web"       versions="2.2, 2.3, 2.4, 2.5, 3.0"/>
             <moduleType types="jst.ejb"       versions="1.1, 2.0, 2.1, 3.0, 3.1"/>
             <moduleType types="jst.connector" versions="1.0, 1.5"/>
@@ -62,7 +62,7 @@
             name="%serverTypeName"
             description="%serverTypeDescription"
             runtime="true"
-            class="org.apache.geronimo.st.v30.core.GeronimoServer"
+            class="org.apache.geronimo.st.v30.core.GeronimoServerDelegate"
             initialState="stopped"
             supportsRemoteHosts="true"
             startTimeout="240000"
@@ -70,7 +70,7 @@
             startBeforePublish="true"
             runtimeTypeId="org.apache.geronimo.runtime.30"
             launchConfigId="org.apache.geronimo.st.v30.core.launchConfigurationType"
-            behaviourClass="org.apache.geronimo.st.v30.core.GeronimoServerBehaviour"
+            behaviourClass="org.apache.geronimo.st.v30.core.GeronimoServerBehaviourDelegate"
             hasConfiguration="false"
             launchModes="run,debug,profile">
         </serverType>

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoRuntimeDelegate.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/GeronimoRuntimeDelegate.java?rev=1147527&r1=1147526&r2=1147527&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoRuntimeDelegate.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoRuntimeDelegate.java
Sun Jul 17 05:17:23 2011
@@ -45,7 +45,7 @@ import org.eclipse.wst.server.core.model
 /**
  * @version $Rev$ $Date$
  */
-abstract public class GeronimoRuntimeDelegate extends RuntimeDelegate implements IGeronimoRuntime
{
+public class GeronimoRuntimeDelegate extends RuntimeDelegate implements IGeronimoRuntime
{
 
     private static final String PROP_VM_INSTALL_TYPE_ID = "vm-install-type-id";
 

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=1147527&r1=1147526&r2=1147527&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
Sun Jul 17 05:17:23 2011
@@ -25,6 +25,7 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
@@ -37,17 +38,29 @@ import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 
 import javax.enterprise.deploy.spi.Target;
+import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
 import javax.management.MBeanServerConnection;
 import javax.management.ObjectName;
 import javax.management.remote.JMXConnector;
 import javax.management.remote.JMXConnectorFactory;
 import javax.management.remote.JMXServiceURL;
+import javax.naming.directory.NoSuchAttributeException;
 
 import org.apache.geronimo.deployment.plugin.jmx.ExtendedDeploymentManager;
+import org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager;
 import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.InternalKernelException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.config.PersistentConfigurationList;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.st.v30.core.UpdateServerStateTask;
 import org.apache.geronimo.st.v30.core.commands.DeploymentCommandFactory;
+import org.apache.geronimo.st.v30.core.internal.DependencyHelper;
 import org.apache.geronimo.st.v30.core.internal.Messages;
 import org.apache.geronimo.st.v30.core.internal.Trace;
 import org.apache.geronimo.st.v30.core.operations.ISharedLibEntryCreationDataModelProperties;
@@ -55,6 +68,7 @@ import org.apache.geronimo.st.v30.core.o
 import org.apache.geronimo.st.v30.core.operations.SharedLibEntryDataModelProvider;
 import org.apache.geronimo.st.v30.core.osgi.AriesHelper;
 import org.apache.geronimo.st.v30.core.osgi.OSGiModuleHandler;
+import org.apache.geronimo.system.jmx.KernelDelegate;
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.CoreException;
@@ -65,6 +79,7 @@ import org.eclipse.core.runtime.MultiSta
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.debug.core.DebugEvent;
 import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.IDebugEventSetListener;
@@ -81,6 +96,7 @@ import org.eclipse.jdt.launching.IJavaLa
 import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
 import org.eclipse.jdt.launching.IVMInstall;
 import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
 import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
 import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
@@ -89,6 +105,7 @@ import org.eclipse.wst.server.core.IServ
 import org.eclipse.wst.server.core.IServerListener;
 import org.eclipse.wst.server.core.ServerEvent;
 import org.eclipse.wst.server.core.ServerPort;
+import org.eclipse.wst.server.core.internal.IModulePublishHelper;
 import org.eclipse.wst.server.core.internal.ProgressUtil;
 import org.eclipse.wst.server.core.model.IModuleFile;
 import org.eclipse.wst.server.core.model.IModuleResourceDelta;
@@ -98,12 +115,14 @@ import org.eclipse.wst.server.core.util.
 /**
  * @version $Rev$ $Date$
  */
-abstract public class GeronimoServerBehaviourDelegate extends ServerBehaviourDelegate implements
IGeronimoServerBehavior {
+public class GeronimoServerBehaviourDelegate extends ServerBehaviourDelegate implements IGeronimoServerBehavior,
IModulePublishHelper {
 
     public static final int TIMER_TASK_INTERVAL = 20;
     
     public static final int TIMER_TASK_DELAY = 20;
 
+    private Kernel kernel = null;
+    
     protected Timer stateTimer = null;
     
     protected Timer synchronizerTimer = null;
@@ -114,10 +133,6 @@ abstract public class GeronimoServerBeha
 
     public static final String ERROR_SETUP_LAUNCH_CONFIGURATION = "errorInSetupLaunchConfiguration";
 
-    abstract protected ClassLoader getContextClassLoader();
-    
-    abstract protected String getWebModuleDocumentBase(String contextPath);
-
     private PublishStateListener publishStateListener;
     
     private Lock publishLock = new ReentrantLock();
@@ -127,6 +142,10 @@ abstract public class GeronimoServerBeha
     private DefaultModuleHandler defaultModuleHandler;
     private OSGiModuleHandler osgiModuleHandler;
 
+    protected ClassLoader getContextClassLoader() {
+        return Kernel.class.getClassLoader();
+    }
+    
     /*
      * (non-Javadoc)
      * 
@@ -628,8 +647,11 @@ abstract public class GeronimoServerBeha
     /*
      * This method is used to invoke DependencyHelper of different version
      */
-    abstract protected List getOrderedModules(IServer server, List modules, List deltaKind);
-
+    protected List getOrderedModules(IServer server, List modules, List deltaKind) {
+        DependencyHelper dh = new DependencyHelper();
+        List list = dh.reorderModules(this.getServer(),modules, deltaKind);
+        return list;
+   }
 
     /*
      * (non-Javadoc)
@@ -794,7 +816,9 @@ abstract public class GeronimoServerBeha
         Trace.tracePoint("Exit", Activator.traceCore, "GeronimoServerBehaviourDelegate.dispose");
     }
 
-    public abstract String getRuntimeClass();
+    public String getRuntimeClass() {
+        return "org.apache.geronimo.cli.daemon.DaemonCLI";
+    }
 
     public void setServerStarted() {
         setServerState(IServer.STATE_STARTED);
@@ -1158,8 +1182,107 @@ abstract public class GeronimoServerBeha
         Trace.tracePoint("Exit ", Activator.traceCore, "GeronimoServerBehaviourDelegate.stopPingThread");
     }
     
-    protected abstract void stopKernel();
+    protected Kernel getKernel() throws SecurityException {
+        if (kernel == null) {
+            try {
+                MBeanServerConnection connection = getServerConnection();
+                if (connection != null)
+                    kernel = new KernelDelegate(connection);
+            } catch (SecurityException e) {
+                throw e;
+            } catch (Exception e) {
+                Trace.trace(Trace.INFO, "Kernel connection failed. "
+                        + e.getMessage(), Activator.traceCore);
+            }
+        }
+        return kernel;
+    }
+    
+    protected void stopKernel() {
+        try {
+            MBeanServerConnection connection = getServerConnection();
+            Trace.trace(Trace.INFO, "Server shutdown starting...", Activator.traceCore);
+            connection.invoke(getFrameworkMBean(connection), "stopBundle",
+                     new Object[] { 0 }, new String[] { long.class.getName() });
+            Trace.trace(Trace.INFO, "Server shutdown completed", Activator.traceCore);  
       
+        } catch (Exception e) {
+            Trace.trace(Trace.ERROR, e.getMessage(), e, Activator.traceCore);
+        }
+    }
+
+    public boolean isKernelAlive() {
+        try {
+            return getKernel() != null && kernel.isRunning();
+        } catch (SecurityException e) {
+            Trace.trace(Trace.ERROR, "Invalid username and/or password.", e, Activator.logCore);
 
+            pingThread.interrupt();
+            if (getServer().getServerState() != IServer.STATE_STOPPED) {
+                forceStopJob(true,e);
+            }
+        } catch (Exception e) {
+            Trace.trace(Trace.WARNING, "Geronimo Server may have been terminated manually
outside of workspace.", e, Activator.logCore);
+            kernel = null;
+        }
+        return false;
+    }
+    
+    private void forceStopJob(boolean b, final SecurityException e) {
+        /* 
+         *
+         * Currently, there is another Status is returned by StartJob in Server. 
+         * The message doesn't contain reason for the exception. 
+         * So this job is created to show a message(Invalid username and/or password) to
user.
+         *  
+         * TODO: Need a method to remove the error message thrown by StartJob in Server.
+         * 
+         */
+        
+        String jobName = NLS.bind(org.eclipse.wst.server.core.internal.Messages.errorStartFailed,
getServer().getName());                       
+        
+        //This message has different variable names in WTP 3.0 and 3.1, so we define it here
instead of using that in WTP
+        final String jobStartingName =  NLS.bind("Starting {0}", getServer().getName());
+
+        new Job(jobName) {
+            @Override
+            protected IStatus run(IProgressMonitor monitor) {
+                MultiStatus multiStatus = new  MultiStatus(Activator.PLUGIN_ID, 0, jobStartingName,
null);
+                multiStatus.add(new Status(IStatus.ERROR,Activator.PLUGIN_ID,0,"Invalid username
and/or password.",e));
+                try {
+                    stop(true);
+                } catch (Exception e){
+                    multiStatus.add(new Status(IStatus.ERROR,Activator.PLUGIN_ID,0,"Failed
to stop server",e));
+                }
+            
+                return multiStatus;
+            }
+        }.schedule();
+        
+    }
+    
+    public boolean isFullyStarted() {
+        if (isKernelAlive()) {
+            AbstractNameQuery query = new AbstractNameQuery(PersistentConfigurationList.class.getName());
+            Set<AbstractName> configLists = kernel.listGBeans(query);
+            if (!configLists.isEmpty()) {
+                AbstractName on = (AbstractName) configLists.toArray()[0];
+                try {
+                    Boolean b = (Boolean) kernel.getAttribute(on, "kernelFullyStarted");
+                    return b.booleanValue();
+                } catch (GBeanNotFoundException e) {
+                    // ignore
+                } catch (NoSuchAttributeException e) {
+                    // ignore
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            } else {
+                Trace.trace(Trace.INFO, "configLists is empty", Activator.traceCore);
+            }
+        }
+        return false;
+    }
+    
     public void startUpdateServerStateTask() {
         Trace.tracePoint("Entry", Activator.traceCore, "GeronimoServerBehaviourDelegate.startUpdateServerStateTask",
getServer().getName());
 
@@ -1225,6 +1348,18 @@ abstract public class GeronimoServerBeha
         return modulePath;
     }
 
+    private Kernel getDeploymentManagerKernel() {
+        GeronimoConnectionFactory connectionFactory = GeronimoConnectionFactory.getInstance();
+        try {
+            JMXDeploymentManager manager =
+                (JMXDeploymentManager) connectionFactory.getDeploymentManager(getServer());
+            return manager.getKernel();
+        } catch (DeploymentManagerCreationException e) {
+            Trace.trace(Trace.WARNING, "Error getting kernel from deployment manager", e,
Activator.logCore);
+            return null;
+        }
+    }
+    
     public MBeanServerConnection getServerConnection() throws Exception {
         Map<String, Object> map = new HashMap<String, Object>();
         String user = getGeronimoServer().getAdminID();
@@ -1270,6 +1405,10 @@ abstract public class GeronimoServerBeha
         }
     }
     
+    private ObjectName getFrameworkMBean(MBeanServerConnection connection) throws Exception
{
+        return getMBean(connection, "osgi.core:type=framework,*", "Framework");
+    }
+    
     public Target[] getTargets() {
         return null;
     }
@@ -1374,4 +1513,69 @@ abstract public class GeronimoServerBeha
     public void setModulesState(IModule[] module, int state) {
         setModuleState(module, state);
     }
+    
+    public IPath getPublishDirectory(IModule[] module) {
+        if (module == null || module.length == 0)
+            return null;
+
+        if (getGeronimoServer().isRunFromWorkspace()) {
+            // TODO fix me, see if project root, component root, or output
+            // container should be returned
+            return module[module.length - 1].getProject().getLocation();
+        } else {
+            ClassLoader old = Thread.currentThread().getContextClassLoader();
+            try {
+                Thread.currentThread().setContextClassLoader(getContextClassLoader());
+                String configId = getConfigId(module[0]);
+                Artifact artifact = Artifact.create(configId);
+                AbstractName name = Configuration.getConfigurationAbstractName(artifact);
+                GBeanData data = kernel.getGBeanData(name);
+                URL url = (URL) data.getAttribute("baseURL");
+                return getModulePath(module, url);
+            } catch (InvalidConfigException e) {
+                e.printStackTrace();
+            } catch (GBeanNotFoundException e) {
+                e.printStackTrace();
+            } catch (InternalKernelException e) {
+                e.printStackTrace();
+            } catch (Exception e) {
+                e.printStackTrace();
+            } finally {
+                Thread.currentThread().setContextClassLoader(old);
+            }
+        }
+
+        return null;
+    }
+    
+    // TODO: this can be cached 
+    public String getWebModuleDocumentBase(String contextPath) {
+        Kernel kernel = getDeploymentManagerKernel();
+        if (kernel == null) {
+            Trace.trace(Trace.WARNING, "Error getting web module document base - no kernel",
null, Activator.logCore);
+            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) {
+            try {
+                String moduleContextPath = (String) kernel.getAttribute(name, "contextPath");
+                if (contextPath.equals(moduleContextPath)) {
+                    String docBase = (String) kernel.getAttribute(name, "docBase");
+                    return docBase;
+                }
+            } catch (GBeanNotFoundException e) {
+                // ignore
+            } catch (NoSuchAttributeException e) {
+                // ignore
+            } catch (Exception e) {
+                Trace.trace(Trace.WARNING, "Error getting web module document base", e, Activator.logCore);
+            }
+        }
+        return null;
+    }
 }

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=1147527&r1=1147526&r2=1147527&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
Sun Jul 17 05:17:23 2011
@@ -32,7 +32,12 @@ import java.util.jar.Manifest;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.factories.DeploymentFactory;
+
 import org.apache.geronimo.crypto.EncryptionManager;
+import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl;
+import org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager;
 import org.apache.geronimo.st.v30.core.internal.Trace;
 import org.apache.geronimo.st.v30.core.osgi.AriesHelper;
 import org.apache.geronimo.st.v30.core.osgi.OsgiConstants;
@@ -52,6 +57,7 @@ import org.eclipse.wst.server.core.Serve
 import org.eclipse.wst.server.core.ServerUtil;
 import org.eclipse.wst.server.core.internal.ServerMonitorManager;
 import org.eclipse.wst.server.core.model.ServerDelegate;
+import org.eclipse.wst.server.core.util.SocketUtil;
 import org.eclipse.wst.web.internal.deployables.FlatComponentDeployable;
 
 
@@ -65,7 +71,7 @@ import org.eclipse.wst.web.internal.depl
  * 
  * @version $Rev$ $Date$
  */
-abstract public class GeronimoServerDelegate extends ServerDelegate implements IGeronimoServer
{
+public class GeronimoServerDelegate extends ServerDelegate implements IGeronimoServer {
 
     public static final List<String> DEFAULT_NOREDEPLOY_INCLUDE_PATTERNS = 
         Arrays.asList("**/*.html", "**/*.xhtml", "**/*.css", "**/*.js", "**/*.jsp", "**/*.jspx",
"**/*.gif", "**/*.jpg", "**/*.png", "**/*.swt", "**/*.properties", "**/*.xml");
@@ -128,7 +134,65 @@ abstract public class GeronimoServerDele
     // required to avoid error start, and work nicely on windows, when Karaf shell is enabled.
     public static final String JLINE_UNSUPPORTED_TERMINAL = "-Djline.terminal=jline.UnsupportedTerminal";
 
+    private static IGeronimoVersionHandler versionHandler = null;
+
+    private static DeploymentFactory deploymentFactory = new DeploymentFactoryImpl();
+    
     private boolean suspendArgUpdates;
+    
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.geronimo.st.v30.core.IGeronimoServer#getDeployerURL()
+     */
+    public String getDeployerURL() {
+        return "deployer:geronimo:jmx://" + getServer().getHost() + ":" + getRMINamingPort();
+    }
+    
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.geronimo.st.v30.core.IGeronimoServer#getJMXServiceURL()
+     */
+    public String getJMXServiceURL() {
+        String host = getServer().getHost();
+        return "service:jmx:rmi://" + host + "/jndi/rmi://" + host + ":" + getRMINamingPort()
+ "/JMXConnector";
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.geronimo.st.v30.core.IGeronimoServer#getDeploymentFactory()
+     */
+    public DeploymentFactory getDeploymentFactory() {
+        return deploymentFactory;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.geronimo.st.v30.core.IGeronimoServer#configureDeploymentManager(javax.enterprise.deploy.spi.DeploymentManager)
+     */
+    public void configureDeploymentManager(DeploymentManager dm) {
+        ((JMXDeploymentManager) dm).setLogConfiguration(true, true);
+        boolean enableInPlace = SocketUtil.isLocalhost(getServer().getHost()) &&
isRunFromWorkspace();
+        setInPlaceDeployment(dm, enableInPlace);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.geronimo.st.v30.core.IGeronimoServer#getVersionHandler()
+     */
+    public IGeronimoVersionHandler getVersionHandler() {
+        if (versionHandler == null)
+            versionHandler = new GeronimoVersionHandler();
+        return versionHandler;
+    }
+
+    public void setInPlaceDeployment(DeploymentManager dm, boolean enable) {
+        ((JMXDeploymentManager) dm).setInPlace(enable);
+    }
 
     /**
      * Determines whether the specified module modifications can be made to the server at
this time
@@ -263,6 +327,78 @@ abstract public class GeronimoServerDele
         return new IModule[] {};
     }
 
+    /**
+     * Return all parent module(s) of this module
+     * 
+     * @param module
+     * 
+     * @return 
+     */
+    private IModule[] doGetParentModules(IModule module) {
+        Trace.tracePoint("Entry", Activator.traceCore, "GeronimoServerDelegate.doGetParentModules",
module);
+
+        ArrayList<IModule> parents = new ArrayList<IModule>();
+        parents.addAll(getApplicationModules(module));
+
+        // also check to see if the module is a utility module for a stand-alone
+        // web module
+        for (IModule war : J2EEUtil.getWebModules(module, null)) {
+            if (getApplicationModules(war).isEmpty()) {
+                parents.add(war);
+            }
+        }
+        IModule[] modules = (IModule[]) parents.toArray(new IModule[parents.size()]);
+        Trace.tracePoint("Exit ", Activator.traceCore, "GeronimoServerDelegate.doGetParentModules",
modules);
+        return modules;
+    }
+
+    /**
+     * Return all applications this module is contained in
+     * 
+     * @param module
+     * 
+     * @return 
+     */
+    private List<IModule> getApplicationModules(IModule module) {
+        Trace.tracePoint("Entry", Activator.traceCore, "GeronimoServerDelegate.getApplicationModules",
module);
+
+        ArrayList<IModule> list = new ArrayList<IModule>();
+
+        IModule[] ears = ServerUtil.getModules(IModuleConstants.JST_EAR_MODULE);
+        for (int i = 0; i < ears.length; i++) {
+            IEnterpriseApplication ear = (IEnterpriseApplication) ears[i].loadAdapter(IEnterpriseApplication.class,
null);
+            IModule[] modules = ear.getModules();
+            for (int j = 0; j < modules.length; j++) {
+                if (modules[j].equals(module))
+                    list.add(ears[i]);
+            }
+        }
+
+        if (AriesHelper.isAriesInstalled()) {
+            IModule[] applications = ServerUtil.getModules(OsgiConstants.APPLICATION);
+            for (int i = 0; i < applications.length; i++) {
+                FlatComponentDeployable application = (FlatComponentDeployable) applications[i].loadAdapter(FlatComponentDeployable.class,
 null);
+                IModule[] modules = application.getModules();
+                for (int j = 0; j < modules.length; j++) {
+                    if (modules[j].equals(module))
+                        list.add(applications[i]);
+                }
+            }
+  
+            IModule[] composites = ServerUtil.getModules(OsgiConstants.COMPOSITE_BUNDLE);
+            for (int i = 0; i < composites.length; i++) {
+                FlatComponentDeployable composite = (FlatComponentDeployable) composites[i].loadAdapter(FlatComponentDeployable.class,
 null);
+                IModule[] modules = composite.getModules();
+                for (int j = 0; j < modules.length; j++) {
+                    if (modules[j].equals(module))
+                        list.add(composites[i]);
+                }
+            }
+        }
+
+        Trace.tracePoint("Exit ", Activator.traceCore, "GeronimoServerDelegate.getApplicationModules",
list);
+        return list;
+    }
 
     /**
      * Return an array of ServerPorts associated with this server
@@ -277,7 +413,7 @@ abstract public class GeronimoServerDele
         ports.add(new ServerPort(PROPERTY_RMI_PORT, "RMI Naming", Integer.parseInt(getRMINamingPort()),
"rmi"));
 
         ServerPort[] serverPorts = ports.toArray(new ServerPort[ports.size()]);
-        Trace.tracePoint("Entry", Activator.traceCore, "GeronimoServerDelegate.getServerPorts;",
serverPorts);
+        Trace.tracePoint("Entry", Activator.traceCore, "GeronimoServerDelegate.getServerPorts",
serverPorts);
         return serverPorts;
     }
 
@@ -391,18 +527,18 @@ abstract public class GeronimoServerDele
 
     @Override
     public void saveConfiguration(IProgressMonitor monitor) throws CoreException {
-        Trace.tracePoint("Enter", Activator.traceCore, "GeronimoServerDelegate.v30.saveConfiguration",
monitor);
+        Trace.tracePoint("Enter", Activator.traceCore, "GeronimoServerDelegate.saveConfiguration",
monitor);
         super.saveConfiguration(monitor);
-        Trace.tracePoint("Exit", Activator.traceCore, "GeronimoServerDelegate.v30.saveConfiguration",
monitor);
+        Trace.tracePoint("Exit", Activator.traceCore, "GeronimoServerDelegate.saveConfiguration",
monitor);
     }
     
     
 
     @Override
     public void configurationChanged() {
-        Trace.tracePoint("Enter", Activator.traceCore, "GeronimoServerDelegate.v30.configurationChanged");
+        Trace.tracePoint("Enter", Activator.traceCore, "GeronimoServerDelegate.configurationChanged");
         super.configurationChanged();
-        Trace.tracePoint("Exit", Activator.traceCore, "GeronimoServerDelegate.v30.configurationChanged");
+        Trace.tracePoint("Exit", Activator.traceCore, "GeronimoServerDelegate.configurationChanged");
     }
 
     // 
@@ -681,11 +817,13 @@ abstract public class GeronimoServerDele
         resumeArgUpdates();
     }
 
-    private void addParm(StringBuilder sb, String parm) {
+    private void addParm(StringBuilder sb, Object... args) {
         if (sb.length() > 0) {
             sb.append(" ");
         }
-        sb.append(parm);
+        for (Object arg : args) {
+            sb.append(arg);
+        }
     }
 
     public String getCleanOSGiBundleCacheArgs() {
@@ -748,8 +886,43 @@ abstract public class GeronimoServerDele
     // PROPERTY_VM_ARGS
     // 
     public String getVMArgs() {
-        return getInstanceProperty(PROPERTY_VM_ARGS);
+        String superVMArgs = getInstanceProperty(PROPERTY_VM_ARGS);
+        if (superVMArgs != null && superVMArgs.trim().length() > 0) {
+            return superVMArgs;
+        }
+  
+        StringBuilder args = new StringBuilder();
+
+        addParm(args, "-javaagent:\"$(GERONIMO_HOME)/lib/agent/transformer.jar\"");
+
+        String pS = System.getProperty("path.separator");
+        
+        //-Djava.ext.dirs="GERONIMO_BASE/lib/ext;JRE_HOME/lib/ext"
+        addParm(args, "-Djava.ext.dirs=\"$(GERONIMO_HOME)/lib/ext", pS, "$(JRE_HOME)/lib/ext\"");
+
+        //-Djava.endorsed.dirs="GERONIMO_BASE/lib/endorsed;JRE_HOME/lib/endorsed"
+        addParm(args, "-Djava.endorsed.dirs=\"$(GERONIMO_HOME)/lib/endorsed", pS, "$(JRE_HOME)/lib/endorsed\"");
+
+        // Specify the minimum memory options for the Geronimo server
+        addParm(args, "-Xms256m -Xmx512m -XX:MaxPermSize=128m");
+
+        // Specify GERONIMO_BASE
+        addParm(args, "-Dorg.apache.geronimo.home.dir=\"$(GERONIMO_HOME)\"");
+                
+        addParm(args, "-Dkaraf.home=\"$(GERONIMO_HOME)\"");
+        addParm(args, "-Dkaraf.base=\"$(GERONIMO_HOME)\"");
+        addParm(args, "-Djava.util.logging.config.file=\"$(GERONIMO_HOME)/etc/java.util.logging.properties\"");
+               
+        // Karaf arguments
+        addParm(args, getKarafShellArgs());
+        addParm(args, "-Dkaraf.startRemoteShell=true");
+        
+        String vmArgs = args.toString();
+        Trace.tracePoint("Exit", Activator.traceCore, "GeronimoServer.getVMArgs", vmArgs);
+        
+        return vmArgs;
     }
+    
     public void setVMArgs(String value) {
         setInstanceProperty(PROPERTY_VM_ARGS, value);
     }
@@ -766,8 +939,26 @@ abstract public class GeronimoServerDele
     // PROPERTY_PROGRAM_ARGS
     // 
     public String getProgramArgs() {
-        return getInstanceProperty(PROPERTY_PROGRAM_ARGS);
+        String superVMArgs = getInstanceProperty(PROPERTY_PROGRAM_ARGS);
+        if (superVMArgs != null && superVMArgs.trim().length() > 0) {
+            return superVMArgs;
+        }
+        
+        StringBuilder args = new StringBuilder();
+
+        addParm(args, getConsoleLogLevel());
+        
+        if (isCleanOSGiBundleCache()) {
+            addParm(args, getCleanOSGiBundleCacheArgs());
+        }
+
+        String programArgs = args.toString();
+        
+        Trace.tracePoint("Exit", Activator.traceCore, "GeronimoServerDelegate.getProgramArgs",
programArgs);
+        
+        return programArgs;
     }
+    
     public void setProgramArgs(String value) {
         setInstanceProperty(PROPERTY_PROGRAM_ARGS, value);
     }
@@ -922,78 +1113,4 @@ abstract public class GeronimoServerDele
         setAttribute(GeronimoRuntimeDelegate.SERVER_INSTANCE_PROPERTIES, map);
     }
 
-
-    /**
-     * Return all parent module(s) of this module
-     * 
-     * @param module
-     * 
-     * @return 
-     */
-    private IModule[] doGetParentModules(IModule module) {
-        Trace.tracePoint("Entry", Activator.traceCore, "GeronimoServerDelegate.v30.doGetParentModules",
module);
-
-        ArrayList<IModule> parents = new ArrayList<IModule>();
-        parents.addAll(getApplicationModules(module));
-
-        // also check to see if the module is a utility module for a stand-alone
-        // web module
-        for (IModule war : J2EEUtil.getWebModules(module, null)) {
-            if (getApplicationModules(war).isEmpty()) {
-                parents.add(war);
-            }
-        }
-        IModule[] modules = (IModule[]) parents.toArray(new IModule[parents.size()]);
-        Trace.tracePoint("Exit ", Activator.traceCore, "GeronimoServerDelegate.v30.doGetParentModules",
modules);
-        return modules;
-    }
-
-
-    /**
-     * Return all applications this module is contained in
-     * 
-     * @param module
-     * 
-     * @return 
-     */
-    private List<IModule> getApplicationModules(IModule module) {
-        Trace.tracePoint("Entry", Activator.traceCore, "GeronimoServerDelegate.getApplicationModules",
module);
-
-        ArrayList<IModule> list = new ArrayList<IModule>();
-
-        IModule[] ears = ServerUtil.getModules(IModuleConstants.JST_EAR_MODULE);
-        for (int i = 0; i < ears.length; i++) {
-            IEnterpriseApplication ear = (IEnterpriseApplication) ears[i].loadAdapter(IEnterpriseApplication.class,
null);
-            IModule[] modules = ear.getModules();
-            for (int j = 0; j < modules.length; j++) {
-                if (modules[j].equals(module))
-                    list.add(ears[i]);
-            }
-        }
-
-        if (AriesHelper.isAriesInstalled()) {
-            IModule[] applications = ServerUtil.getModules(OsgiConstants.APPLICATION);
-            for (int i = 0; i < applications.length; i++) {
-                FlatComponentDeployable application = (FlatComponentDeployable) applications[i].loadAdapter(FlatComponentDeployable.class,
 null);
-                IModule[] modules = application.getModules();
-                for (int j = 0; j < modules.length; j++) {
-                    if (modules[j].equals(module))
-                        list.add(applications[i]);
-                }
-            }
-  
-            IModule[] composites = ServerUtil.getModules(OsgiConstants.COMPOSITE_BUNDLE);
-            for (int i = 0; i < composites.length; i++) {
-                FlatComponentDeployable composite = (FlatComponentDeployable) composites[i].loadAdapter(FlatComponentDeployable.class,
 null);
-                IModule[] modules = composite.getModules();
-                for (int j = 0; j < modules.length; j++) {
-                    if (modules[j].equals(module))
-                        list.add(composites[i]);
-                }
-            }
-        }
-
-        Trace.tracePoint("Exit ", Activator.traceCore, "GeronimoServerDelegate.getApplicationModules",
list);
-        return list;
-    }
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/IGeronimoServer.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/IGeronimoServer.java?rev=1147527&r1=1147526&r2=1147527&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/IGeronimoServer.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/IGeronimoServer.java
Sun Jul 17 05:17:23 2011
@@ -39,8 +39,6 @@ public interface IGeronimoServer extends
 
     public String getJMXServiceURL();
 
-    public IPath getJSR88DeployerJar();
-    
     public DeploymentFactory getDeploymentFactory();
 
     public void configureDeploymentManager(DeploymentManager dm);



Mime
View raw message