geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sachin Patel <sppat...@gmail.com>
Subject Re: svn commit: r503370 [3/3] - in /geronimo/server/trunk: applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/util/ assemblies/geronimo-boilerplate-minimal/ assemblies/geronimo-boilerplate-minimal/src/main/resources/va...
Date Mon, 05 Feb 2007 21:03:13 GMT
Gianny,

Would it be possible for you to temporarily back these changes out  
until we all get a better understanding of the impact of these changes?

For example, the eclipse-plugin currently points to the geronimo- 
deployer-jsr88 jar to configure the deployment manager.  Since this  
has been removed, what should such a client now point to?

Thanks.

-sachin


On Feb 4, 2007, at 2:38 AM, gdamour@apache.org wrote:

> Modified: geronimo/server/trunk/configs/online-deployer/src/plan/ 
> plan.xml
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/ 
> online-deployer/src/plan/plan.xml? 
> view=diff&rev=503370&r1=503369&r2=503370
> ====================================================================== 
> ========
> --- geronimo/server/trunk/configs/online-deployer/src/plan/plan.xml  
> (original)
> +++ geronimo/server/trunk/configs/online-deployer/src/plan/plan.xml  
> Sat Feb  3 23:38:35 2007
> @@ -19,5 +19,84 @@
>  <!-- $Rev$ $Date$ -->
>
>  <module xmlns="http://geronimo.apache.org/xml/ns/deployment-$ 
> {geronimoSchemaVersion}">
> -    <environment/>
> +
> +    <!-- ServerInfo service -->
> +    <gbean name="ServerInfo"  
> class="org.apache.geronimo.system.serverinfo.BasicServerInfo"/>
> +
> +    <!--Repository-->
> +    <gbean name="Repository"  
> class="org.apache.geronimo.system.repository.Maven2Repository">
> +        <attribute name="root">repository/</attribute>
> +        <reference name="ServerInfo">
> +            <name>ServerInfo</name>
> +        </reference>
> +    </gbean>
> +
> +    <!--Configuration Store service-->
> +    <gbean name="Local"  
> class="org.apache.geronimo.system.configuration.RepositoryConfiguratio 
> nStore">
> +        <reference name="Repository">
> +            <name>Repository</name>
> +        </reference>
> +    </gbean>
> +
> +    <!--User-editable attribute service-->
> +    <gbean name="AttributeManager"  
> class="org.apache.geronimo.system.configuration.LocalAttributeManager" 
> >
> +        <reference name="ServerInfo">
> +            <name>ServerInfo</name>
> +        </reference>
> +        <attribute name="readOnly">true</attribute>
> +        <attribute name="configFile">var/config/jsr88-configurer- 
> config.xml</attribute>
> +    </gbean>
> +
> +    <!-- ArtifactManager -->
> +    <gbean name="ArtifactManager"  
> class="org.apache.geronimo.kernel.repository.DefaultArtifactManager"/>
> +
> +    <!-- ArtifactResolver -->
> +    <gbean name="ArtifactResolver"  
> class="org.apache.geronimo.system.resolver.ExplicitDefaultArtifactReso 
> lver">
> +        <reference name="ArtifactManager">
> +            <name>ArtifactManager</name>
> +        </reference>
> +        <reference name="Repositories"></reference>
> +        <attribute name="versionMapLocation">var/config/ 
> artifact_aliases.properties</attribute>
> +        <reference name="ServerInfo">
> +            <name>ServerInfo</name>
> +        </reference>
> +    </gbean>
> +
> +    <!--Server attribute service-->
> +    <gbean name="ServerAttributeManager"  
> class="org.apache.geronimo.system.configuration.SwitchableLocalAttribu 
> teManager">
> +        <reference name="ServerInfo">
> +            <name>ServerInfo</name>
> +        </reference>
> +        <attribute name="configFile">var/config/config.xml</ 
> attribute>
> +    </gbean>
> +
> +    <!--Configuration Manager service-->
> +    <gbean name="ConfigurationManager"  
> class="org.apache.geronimo.kernel.config.EditableKernelConfigurationMa 
> nager">
> +        <reference name="Repositories"></reference>
> +        <reference name="Stores"></reference>
> +        <reference name="Watchers"></reference>
> +        <reference name="AttributeStore">
> +            <name>AttributeManager</name>
> +        </reference>
> +        <reference name="PersistentConfigurationList">
> +            <type>AttributeStore</type>
> +            <name>ServerAttributeManager</name>
> +        </reference>
> +        <reference name="ArtifactManager">
> +            <name>ArtifactManager</name>
> +        </reference>
> +        <reference name="ArtifactResolver">
> +            <name>ArtifactResolver</name>
> +        </reference>
> +    </gbean>
> +
> +    <!-- Logging service -->
> +    <gbean name="Logger"  
> class="org.apache.geronimo.system.logging.log4j.Log4jService">
> +        <attribute name="configFileName">var/log/deployer- 
> log4j.properties</attribute>
> +        <attribute name="refreshPeriodSeconds">60</attribute>
> +        <reference name="ServerInfo">
> +            <name>ServerInfo</name>
> +        </reference>
> +    </gbean>
> +
>  </module>
>
> Modified: geronimo/server/trunk/configs/pom.xml
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/ 
> pom.xml?view=diff&rev=503370&r1=503369&r2=503370
> ====================================================================== 
> ========
> --- geronimo/server/trunk/configs/pom.xml (original)
> +++ geronimo/server/trunk/configs/pom.xml Sat Feb  3 23:38:35 2007
> @@ -128,9 +128,15 @@
>          <module>javamail</module>
>          <module>jsp-examples-jetty</module>
>          <module>jsp-examples-tomcat</module>
> +        <module>jsr88-cli</module>
> +        <module>jsr88-jar-configurer</module>
> +        <module>jsr88-rar-configurer</module>
> +        <module>jsr88-war-configurer</module>
> +        <module>jsr88-ear-configurer</module>
>          <module>ldap-demo-jetty</module>
>          <module>ldap-demo-tomcat</module>
>          <module>ldap-realm</module>
> +        <module>offline-deployer</module>
>          <module>online-deployer</module>
>          <module>openejb</module>
>          <module>openejb-deployer</module>
>
> Modified: geronimo/server/trunk/modules/geronimo-client-builder/src/ 
> main/java/org/apache/geronimo/client/builder/jsr88/ 
> ClientConfigurer.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/ 
> geronimo-client-builder/src/main/java/org/apache/geronimo/client/ 
> builder/jsr88/ClientConfigurer.java? 
> view=diff&rev=503370&r1=503369&r2=503370
> ====================================================================== 
> ========
> --- geronimo/server/trunk/modules/geronimo-client-builder/src/main/ 
> java/org/apache/geronimo/client/builder/jsr88/ClientConfigurer.java  
> (original)
> +++ geronimo/server/trunk/modules/geronimo-client-builder/src/main/ 
> java/org/apache/geronimo/client/builder/jsr88/ClientConfigurer.java  
> Sat Feb  3 23:38:35 2007
> @@ -20,16 +20,15 @@
>
>  package org.apache.geronimo.client.builder.jsr88;
>
> -import javax.enterprise.deploy.spi.DeploymentConfiguration;
>  import javax.enterprise.deploy.model.DeployableObject;
>  import javax.enterprise.deploy.shared.ModuleType;
> +import javax.enterprise.deploy.spi.DeploymentConfiguration;
>
>  import org.apache.geronimo.deployment.ModuleConfigurer;
> -import org.apache.geronimo.j2ee.jsr88.EARConfiguration;
> -import org.apache.geronimo.j2ee.jsr88.EARConfigurer;
> -import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
>  import org.apache.geronimo.gbean.GBeanInfo;
>  import org.apache.geronimo.gbean.GBeanInfoBuilder;
> +import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
> +import org.apache.geronimo.j2ee.jsr88.EARConfiguration;
>
>  /**
>   *
>
> Modified: geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/ 
> main/java/org/apache/geronimo/deployment/plugin/factories/ 
> DeploymentFactoryImpl.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/ 
> geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/ 
> plugin/factories/DeploymentFactoryImpl.java? 
> view=diff&rev=503370&r1=503369&r2=503370
> ====================================================================== 
> ========
> --- geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/ 
> java/org/apache/geronimo/deployment/plugin/factories/ 
> DeploymentFactoryImpl.java (original)
> +++ geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/ 
> java/org/apache/geronimo/deployment/plugin/factories/ 
> DeploymentFactoryImpl.java Sat Feb  3 23:38:35 2007
> @@ -17,12 +17,10 @@
>
>  package org.apache.geronimo.deployment.plugin.factories;
>
> -import  
> org.apache.geronimo.deployment.plugin.DisconnectedDeploymentManager;
> -import  
> org.apache.geronimo.deployment.plugin.jmx.LocalDeploymentManager;
> -import  
> org.apache.geronimo.deployment.plugin.jmx.RemoteDeploymentManager;
> -import org.apache.geronimo.kernel.KernelRegistry;
> -import org.apache.commons.logging.Log;
> -import org.apache.commons.logging.LogFactory;
> +import java.io.IOException;
> +import java.util.Collections;
> +import java.util.HashMap;
> +import java.util.Map;
>
>  import  
> javax.enterprise.deploy.shared.factories.DeploymentFactoryManager;
>  import javax.enterprise.deploy.spi.DeploymentManager;
> @@ -31,9 +29,15 @@
>  import javax.management.remote.JMXConnector;
>  import javax.management.remote.JMXConnectorFactory;
>  import javax.management.remote.JMXServiceURL;
> -import java.io.IOException;
> -import java.util.HashMap;
> -import java.util.Map;
> +
> +import org.apache.commons.logging.Log;
> +import org.apache.commons.logging.LogFactory;
> +import  
> org.apache.geronimo.deployment.plugin.DisconnectedDeploymentManager;
> +import  
> org.apache.geronimo.deployment.plugin.jmx.LocalDeploymentManager;
> +import  
> org.apache.geronimo.deployment.plugin.jmx.RemoteDeploymentManager;
> +import org.apache.geronimo.kernel.GBeanNotFoundException;
> +import org.apache.geronimo.kernel.Kernel;
> +import org.apache.geronimo.kernel.KernelRegistry;
>
>  /**
>   * Implementation of JSR88 DeploymentFactory.
> @@ -50,6 +54,16 @@
>      public static final String URI_PREFIX = "deployer:geronimo:";
>      private static final int DEFAULT_PORT = 1099;
>
> +    private final Kernel baseKernel;
> +
> +    public DeploymentFactoryImpl() {
> +        baseKernel = null;
> +    }
> +
> +    public DeploymentFactoryImpl(Kernel baseKernel) {
> +        this.baseKernel = baseKernel;
> +    }
> +
>      public String getDisplayName() {
>          return "Apache Geronimo";
>      }
> @@ -121,22 +135,7 @@
>
>          try {
>              if (params.getProtocol().equals("jmx")) {
> -                Map environment = new HashMap();
> -                String[] credentials = new String[]{username,  
> password};
> -                environment.put(JMXConnector.CREDENTIALS,  
> credentials);
> -                try {
> -                    JMXServiceURL address = new JMXServiceURL 
> ("service:jmx:rmi:///jndi/rmi://"+params.getHost() 
> +":"+params.getPort()+"/JMXConnector");
> -                    JMXConnector jmxConnector =  
> JMXConnectorFactory.connect(address, environment);
> -                    RemoteDeploymentManager manager = new  
> RemoteDeploymentManager(jmxConnector, params.getHost());
> -                    if(!manager.isSameMachine()) {
> -                        manager.setAuthentication(username,  
> password);
> -                    }
> -                    return manager;
> -                } catch (IOException e) {
> -                    throw (DeploymentManagerCreationException)new  
> DeploymentManagerCreationException(e.getMessage()).initCause(e);
> -                } catch (SecurityException e) {
> -                    throw (AuthenticationFailedException) new  
> AuthenticationFailedException("Invalid login.").initCause(e);
> -                }
> +                return newRemoteDeploymentManager(username,  
> password, params);
>              } else if(params.getProtocol().equals("inVM")) {
>                  return new LocalDeploymentManager 
> (KernelRegistry.getKernel(params.getHost()));
>              } else {
> @@ -153,6 +152,33 @@
>          }
>      }
>
> +    protected DeploymentManager newRemoteDeploymentManager(String  
> username, String password, ConnectParams params) throws  
> DeploymentManagerCreationException, AuthenticationFailedException {
> +        Map environment = new HashMap();
> +        String[] credentials = new String[]{username, password};
> +        environment.put(JMXConnector.CREDENTIALS, credentials);
> +        try {
> +            JMXServiceURL address = new JMXServiceURL 
> ("service:jmx:rmi:///jndi/rmi://"+params.getHost() 
> +":"+params.getPort()+"/JMXConnector");
> +            JMXConnector jmxConnector = JMXConnectorFactory.connect 
> (address, environment);
> +            RemoteDeploymentManager manager;
> +            if (null != baseKernel) {
> +                manager = (RemoteDeploymentManager)  
> baseKernel.getGBean(RemoteDeploymentManager.class);
> +            } else {
> +                manager = new RemoteDeploymentManager 
> (Collections.EMPTY_LIST);
> +            }
> +            manager.init(jmxConnector, params.getHost());
> +            if(!manager.isSameMachine()) {
> +                manager.setAuthentication(username, password);
> +            }
> +            return manager;
> +        } catch (GBeanNotFoundException e) {
> +            throw (DeploymentManagerCreationException)new  
> DeploymentManagerCreationException(e.getMessage()).initCause(e);
> +        } catch (IOException e) {
> +            throw (DeploymentManagerCreationException)new  
> DeploymentManagerCreationException(e.getMessage()).initCause(e);
> +        } catch (SecurityException e) {
> +            throw (AuthenticationFailedException) new  
> AuthenticationFailedException("Invalid login.").initCause(e);
> +        }
> +    }
> +
>      static {
>          DeploymentFactoryManager manager =  
> DeploymentFactoryManager.getInstance();
>          manager.registerDeploymentFactory(new DeploymentFactoryImpl 
> ());
> @@ -186,7 +212,4 @@
>          }
>      }
>
> -    public static void main(String[] args) {
> -        System.out.println("Parsed: "+new DeploymentFactoryImpl 
> ().parseURI("deployer:geronimo:inVM"));
> -    }
>  }
>
> Modified: geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/ 
> main/java/org/apache/geronimo/deployment/plugin/jmx/ 
> JMXDeploymentManager.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/ 
> geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/ 
> plugin/jmx/JMXDeploymentManager.java? 
> view=diff&rev=503370&r1=503369&r2=503370
> ====================================================================== 
> ========
> --- geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/ 
> java/org/apache/geronimo/deployment/plugin/jmx/ 
> JMXDeploymentManager.java (original)
> +++ geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/ 
> java/org/apache/geronimo/deployment/plugin/jmx/ 
> JMXDeploymentManager.java Sat Feb  3 23:38:35 2007
> @@ -19,11 +19,9 @@
>  import java.io.File;
>  import java.io.InputStream;
>  import java.util.ArrayList;
> +import java.util.Collection;
>  import java.util.List;
>  import java.util.Locale;
> -import java.util.Map;
> -import java.util.Set;
> -import java.util.HashMap;
>
>  import javax.enterprise.deploy.model.DeployableObject;
>  import javax.enterprise.deploy.shared.DConfigBeanVersionType;
> @@ -49,8 +47,6 @@
>  import org.apache.geronimo.deployment.plugin.local.StopCommand;
>  import org.apache.geronimo.deployment.plugin.local.UndeployCommand;
>  import org.apache.geronimo.gbean.AbstractName;
> -import org.apache.geronimo.gbean.AbstractNameQuery;
> -import org.apache.geronimo.kernel.GBeanNotFoundException;
>  import org.apache.geronimo.kernel.Kernel;
>  import org.apache.geronimo.kernel.config.ConfigurationInfo;
>  import org.apache.geronimo.kernel.config.ConfigurationManager;
> @@ -68,8 +64,15 @@
>      protected Kernel kernel;
>      private ConfigurationManager configurationManager;
>      private CommandContext commandContext;
> -    protected final Map<ModuleType, ModuleConfigurer>  
> moduleConfigurers = new HashMap<ModuleType, ModuleConfigurer>();
> +    private final Collection<ModuleConfigurer> moduleConfigurers;
>
> +    public JMXDeploymentManager(Collection<ModuleConfigurer>  
> moduleConfigurers) {
> +        if (null == moduleConfigurers) {
> +            throw new IllegalArgumentException("moduleConfigurers  
> is required");
> +        }
> +        this.moduleConfigurers = moduleConfigurers;
> +    }
> +
>      protected void initialize(Kernel kernel) {
>          this.kernel = kernel;
>          configurationManager =  
> ConfigurationUtil.getConfigurationManager(kernel);
> @@ -288,7 +291,13 @@
>          if (dObj == null) {
>              throw new NullPointerException("No deployable object  
> supplied to configure");
>          }
> -        ModuleConfigurer configurer = moduleConfigurers.get 
> (dObj.getType());
> +        ModuleConfigurer configurer = null;
> +        for (ModuleConfigurer moduleConfigurer : moduleConfigurers) {
> +            if (moduleConfigurer.getModuleType() == dObj.getType()) {
> +                configurer = moduleConfigurer;
> +               break;
> +            }
> +        }
>          if (configurer == null) {
>              throw new InvalidModuleException("No configurer for  
> module type: " + dObj.getType() + " registered");
>          }
>
> Modified: geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/ 
> main/java/org/apache/geronimo/deployment/plugin/jmx/ 
> LocalDeploymentManager.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/ 
> geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/ 
> plugin/jmx/LocalDeploymentManager.java? 
> view=diff&rev=503370&r1=503369&r2=503370
> ====================================================================== 
> ========
> --- geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/ 
> java/org/apache/geronimo/deployment/plugin/jmx/ 
> LocalDeploymentManager.java (original)
> +++ geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/ 
> java/org/apache/geronimo/deployment/plugin/jmx/ 
> LocalDeploymentManager.java Sat Feb  3 23:38:35 2007
> @@ -16,15 +16,17 @@
>   */
>  package org.apache.geronimo.deployment.plugin.jmx;
>
> +import java.util.ArrayList;
> +import java.util.Collection;
>  import java.util.Set;
>
> -import org.apache.geronimo.kernel.Kernel;
> -import org.apache.geronimo.kernel.GBeanNotFoundException;
> -import org.apache.geronimo.gbean.AbstractName;
> -import org.apache.geronimo.gbean.AbstractNameQuery;
> -import org.apache.geronimo.deployment.ModuleConfigurer;
>  import org.apache.commons.logging.Log;
>  import org.apache.commons.logging.LogFactory;
> +import org.apache.geronimo.deployment.ModuleConfigurer;
> +import org.apache.geronimo.gbean.AbstractName;
> +import org.apache.geronimo.gbean.AbstractNameQuery;
> +import org.apache.geronimo.kernel.GBeanNotFoundException;
> +import org.apache.geronimo.kernel.Kernel;
>
>  /**
>   * Connects to a kernel in the same VM.
> @@ -36,16 +38,23 @@
>      private static final AbstractNameQuery CONFIGURER_QUERY = new  
> AbstractNameQuery(ModuleConfigurer.class.getName());
>
>      public LocalDeploymentManager(Kernel kernel) {
> +        super(loadModuleConfigurers(kernel));
>          initialize(kernel);
> +    }
> +
> +    private static Collection<ModuleConfigurer>  
> loadModuleConfigurers(Kernel kernel) {
> +        Collection<ModuleConfigurer> moduleConfigurers = new  
> ArrayList<ModuleConfigurer>();
>          Set configurerNames = kernel.listGBeans(CONFIGURER_QUERY);
>          for (Object configurerName : configurerNames) {
>              AbstractName name = (AbstractName) configurerName;
>              try {
>                  ModuleConfigurer configurer = (ModuleConfigurer)  
> kernel.getGBean(name);
> -                moduleConfigurers.put(configurer.getModuleType(),  
> configurer);
> +                moduleConfigurers.add(configurer);
>              } catch (GBeanNotFoundException e) {
>                  log.warn("No gbean found for name returned in  
> query : " + name);
>              }
>          }
> +        return moduleConfigurers;
>      }
> +
>  }
>
> Modified: geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/ 
> main/java/org/apache/geronimo/deployment/plugin/jmx/ 
> RemoteDeploymentManager.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/ 
> geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/ 
> plugin/jmx/RemoteDeploymentManager.java? 
> view=diff&rev=503370&r1=503369&r2=503370
> ====================================================================== 
> ========
> --- geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/ 
> java/org/apache/geronimo/deployment/plugin/jmx/ 
> RemoteDeploymentManager.java (original)
> +++ geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/ 
> java/org/apache/geronimo/deployment/plugin/jmx/ 
> RemoteDeploymentManager.java Sat Feb  3 23:38:35 2007
> @@ -22,13 +22,15 @@
>  import java.net.InetAddress;
>  import java.net.NetworkInterface;
>  import java.net.URL;
> +import java.util.ArrayList;
> +import java.util.Arrays;
> +import java.util.Collection;
>  import java.util.Enumeration;
>  import java.util.Iterator;
> -import java.util.Set;
> -import java.util.Map;
>  import java.util.List;
> -import java.util.ArrayList;
> -import java.util.Arrays;
> +import java.util.Map;
> +import java.util.Set;
> +
>  import javax.enterprise.deploy.shared.CommandType;
>  import javax.enterprise.deploy.spi.Target;
>  import javax.enterprise.deploy.spi.TargetModuleID;
> @@ -38,6 +40,9 @@
>  import javax.management.remote.JMXConnector;
>  import javax.security.auth.login.FailedLoginException;
>
> +import org.apache.commons.logging.Log;
> +import org.apache.commons.logging.LogFactory;
> +import org.apache.geronimo.deployment.ModuleConfigurer;
>  import  
> org.apache.geronimo.deployment.plugin.GeronimoDeploymentManager;
>  import  
> org.apache.geronimo.deployment.plugin.local.AbstractDeployCommand;
>  import org.apache.geronimo.deployment.plugin.local.DistributeCommand;
> @@ -45,16 +50,16 @@
>  import org.apache.geronimo.deployment.plugin.remote.RemoteDeployUtil;
>  import org.apache.geronimo.gbean.AbstractName;
>  import org.apache.geronimo.gbean.AbstractNameQuery;
> +import org.apache.geronimo.gbean.GBeanInfo;
> +import org.apache.geronimo.gbean.GBeanInfoBuilder;
> +import org.apache.geronimo.kernel.repository.Artifact;
>  import org.apache.geronimo.system.jmx.KernelDelegate;
> +import org.apache.geronimo.system.plugin.DownloadPoller;
>  import org.apache.geronimo.system.plugin.DownloadResults;
> +import org.apache.geronimo.system.plugin.PluginInstaller;
>  import org.apache.geronimo.system.plugin.PluginList;
> -import org.apache.geronimo.system.plugin.DownloadPoller;
>  import org.apache.geronimo.system.plugin.PluginMetadata;
> -import org.apache.geronimo.system.plugin.PluginInstaller;
>  import org.apache.geronimo.system.plugin.PluginRepositoryList;
> -import org.apache.geronimo.kernel.repository.Artifact;
> -import org.apache.commons.logging.Log;
> -import org.apache.commons.logging.LogFactory;
>
>  /**
>   * Connects to a Kernel in a remote VM (may or many not be on the  
> same machine).
> @@ -67,13 +72,17 @@
>      private JMXConnector jmxConnector;
>      private boolean isSameMachine;
>
> -    public RemoteDeploymentManager(JMXConnector jmxConnector,  
> String hostname) throws IOException {
> +    public RemoteDeploymentManager(Collection<ModuleConfigurer>  
> moduleConfigurers) {
> +        super(moduleConfigurers);
> +    }
> +
> +    public void init(JMXConnector jmxConnector, String hostname)  
> throws IOException {
>          this.jmxConnector = jmxConnector;
>          MBeanServerConnection mbServerConnection =  
> jmxConnector.getMBeanServerConnection();
>          initialize(new KernelDelegate(mbServerConnection));
>          checkSameMachine(hostname);
>      }
> -
> +
>      public boolean isSameMachine() {
>          return isSameMachine;
>      }
> @@ -274,4 +283,22 @@
>          }
>          return (URL[]) list.toArray(new URL[list.size()]);
>      }
> +
> +    public static final GBeanInfo GBEAN_INFO;
> +    public static final String GBEAN_REF_MODULE_CONFIGURERS =  
> "ModuleConfigurers";
> +
> +    static {
> +        GBeanInfoBuilder infoFactory =  
> GBeanInfoBuilder.createStatic(RemoteDeploymentManager.class,  
> "RemoteDeploymentManager");
> +        infoFactory.addInterface(GeronimoDeploymentManager.class);
> +        infoFactory.addReference(GBEAN_REF_MODULE_CONFIGURERS,  
> ModuleConfigurer.class);
> +
> +        infoFactory.setConstructor(new String[]  
> {GBEAN_REF_MODULE_CONFIGURERS});
> +
> +        GBEAN_INFO = infoFactory.getBeanInfo();
> +    }
> +
> +    public static GBeanInfo getGBeanInfo() {
> +        return GBEAN_INFO;
> +    }
> +
>  }
>
> Modified: geronimo/server/trunk/modules/geronimo-deploy-tool/src/ 
> main/java/org/apache/geronimo/deployment/cli/AbstractCommand.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/ 
> geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/ 
> cli/AbstractCommand.java?view=diff&rev=503370&r1=503369&r2=503370
> ====================================================================== 
> ========
> --- geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/ 
> java/org/apache/geronimo/deployment/cli/AbstractCommand.java  
> (original)
> +++ geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/ 
> java/org/apache/geronimo/deployment/cli/AbstractCommand.java Sat  
> Feb  3 23:38:35 2007
> @@ -17,21 +17,20 @@
>
>  package org.apache.geronimo.deployment.cli;
>
> -import org.apache.geronimo.common.DeploymentException;
> -
> -import javax.enterprise.deploy.spi.status.ProgressObject;
> -import javax.enterprise.deploy.spi.status.ProgressListener;
> -import javax.enterprise.deploy.spi.status.ProgressEvent;
> -import javax.enterprise.deploy.spi.TargetModuleID;
> -import javax.enterprise.deploy.spi.Target;
> -import javax.enterprise.deploy.spi.DeploymentManager;
> -import java.io.PrintWriter;
>  import java.io.OutputStreamWriter;
> +import java.io.PrintWriter;
> +import java.util.HashSet;
>  import java.util.List;
>  import java.util.Set;
> -import java.util.HashSet;
> -import java.util.Collection;
> -import java.util.LinkedList;
> +
> +import javax.enterprise.deploy.spi.DeploymentManager;
> +import javax.enterprise.deploy.spi.Target;
> +import javax.enterprise.deploy.spi.TargetModuleID;
> +import javax.enterprise.deploy.spi.status.ProgressEvent;
> +import javax.enterprise.deploy.spi.status.ProgressListener;
> +import javax.enterprise.deploy.spi.status.ProgressObject;
> +
> +import org.apache.geronimo.common.DeploymentException;
>
>  /**
>   * Base class for CLI deployer commands.  Tracks some simple  
> properties and
>
> Modified: geronimo/server/trunk/modules/geronimo-deploy-tool/src/ 
> main/java/org/apache/geronimo/deployment/cli/DeployTool.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/ 
> geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/ 
> cli/DeployTool.java?view=diff&rev=503370&r1=503369&r2=503370
> ====================================================================== 
> ========
> --- geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/ 
> java/org/apache/geronimo/deployment/cli/DeployTool.java (original)
> +++ geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/ 
> java/org/apache/geronimo/deployment/cli/DeployTool.java Sat Feb  3  
> 23:38:35 2007
> @@ -17,11 +17,30 @@
>
>  package org.apache.geronimo.deployment.cli;
>
> +import java.io.BufferedReader;
> +import java.io.File;
> +import java.io.FileReader;
> +import java.io.IOException;
> +import java.io.InputStream;
> +import java.io.OutputStreamWriter;
> +import java.io.PrintWriter;
> +import java.util.ArrayList;
> +import java.util.Arrays;
> +import java.util.Collection;
> +import java.util.Collections;
> +import java.util.Comparator;
> +import java.util.HashMap;
> +import java.util.Iterator;
> +import java.util.LinkedList;
> +import java.util.List;
> +import java.util.Map;
> +
>  import org.apache.geronimo.common.DeploymentException;
> -import org.apache.geronimo.common.GeronimoEnvironment;
> +import org.apache.geronimo.gbean.GBeanInfo;
> +import org.apache.geronimo.gbean.GBeanInfoBuilder;
> +import org.apache.geronimo.kernel.Kernel;
> +import org.apache.geronimo.kernel.util.Main;
>
> -import java.util.*;
> -import java.io.*;
>
>  /**
>   * The main class for the CLI deployer.  Handles chunking the  
> input arguments
> @@ -35,56 +54,39 @@
>   *
>   * @version $Rev$ $Date$
>   */
> -public class DeployTool {
> -    private final static Map commands = new HashMap();
> +public class DeployTool implements Main {
>
> -    public static void registerCommand(DeployCommand command) {
> -        String key = command.getCommandName();
> -        if(commands.containsKey(key)) {
> -            throw new IllegalArgumentException("Command "+key+" is  
> already registered!");
> -        } else {
> -            commands.put(key, command);
> -        }
> -    }
> -
> -    private static DeployCommand getCommand(String name) {
> -        return (DeployCommand) commands.get(name);
> -    }
> -
> -    private static DeployCommand[] getAllCommands() {
> -        DeployCommand[] list = (DeployCommand[]) commands.values 
> ().toArray(new DeployCommand[0]);
> -        Arrays.sort(list, new Comparator() {
> -            public int compare(Object o1, Object o2) {
> -                return ((DeployCommand)o1).getCommandName 
> ().compareTo(((DeployCommand)o2).getCommandName());
> -            }
> -        });
> -        return list;
> -    }
> +    private static final Collection<DeployCommand> commands = new  
> ArrayList<DeployCommand>();
>
>      static {
> -        // Perform initialization tasks common with the various  
> Geronimo process environments.
> -        GeronimoEnvironment.init();
> -
> -        registerCommand(new CommandLogin());
> -        registerCommand(new CommandDeploy());
> -        registerCommand(new CommandDistribute());
> -        registerCommand(new CommandListModules());
> -        registerCommand(new CommandListTargets());
> -        registerCommand(new CommandRedeploy());
> -        registerCommand(new CommandStart());
> -        registerCommand(new CommandStop());
> -        registerCommand(new CommandRestart());
> -        registerCommand(new CommandUndeploy());
> -        registerCommand(new CommandListConfigurations());
> -        registerCommand(new CommandInstallCAR());
> +        commands.add(new CommandLogin());
> +        commands.add(new CommandDeploy());
> +        commands.add(new CommandDistribute());
> +        commands.add(new CommandListModules());
> +        commands.add(new CommandListTargets());
> +        commands.add(new CommandRedeploy());
> +        commands.add(new CommandStart());
> +        commands.add(new CommandStop());
> +        commands.add(new CommandRestart());
> +        commands.add(new CommandUndeploy());
> +        commands.add(new CommandListConfigurations());
> +        commands.add(new CommandInstallCAR());
>      }
>
>      private boolean failed = false;
>      String[] generalArgs = new String[0];
>      ServerConnection con = null;
>      private boolean multipleCommands = false;
> +    private final Kernel kernel;
>
> -    public boolean execute(String args[]) {
> +    public DeployTool(Kernel kernel) {
> +        if (null == kernel) {
> +            throw new IllegalArgumentException("kernel is required");
> +        }
> +        this.kernel = kernel;
> +    }
> +
> +    public int execute(String args[]) {
>          PrintWriter out = new PrintWriter(new OutputStreamWriter 
> (System.out), true);
>          InputStream in = System.in;
>
> @@ -154,7 +156,7 @@
>              } else {
>                  try {
>                      if(con == null) {
> -                        con = new ServerConnection(generalArgs,  
> out, in);
> +                        con = new ServerConnection(generalArgs,  
> out, in, kernel);
>                      }
>                      try {
>                          dc.execute(out, con, commandArgs);
> @@ -178,7 +180,7 @@
>          }
>          out.flush();
>          System.out.flush();
> -        return !failed;
> +        return failed ? 1 : 0;
>      }
>
>      public static String[] splitCommand(String line) {
> @@ -310,11 +312,40 @@
>          return (String[]) list.toArray(new String[list.size()]);
>      }
>
> -    public static void main(String[] args) {
> -        if(!new DeployTool().execute(args)) {
> -            System.exit(1);
> -        } else {
> -            System.exit(0);
> +    private DeployCommand getCommand(String commandName) {
> +        for (DeployCommand command : commands) {
> +            if (command.getCommandName().equals(commandName)) {
> +                return command;
> +            }
>          }
> +        return null;
>      }
> +
> +    private DeployCommand[] getAllCommands() {
> +        DeployCommand[] list = (DeployCommand[]) commands.toArray 
> (new DeployCommand[0]);
> +        Arrays.sort(list, new Comparator() {
> +            public int compare(Object o1, Object o2) {
> +                return ((DeployCommand)o1).getCommandName 
> ().compareTo(((DeployCommand)o2).getCommandName());
> +            }
> +        });
> +        return list;
> +    }
> +
> +
> +    public static final GBeanInfo GBEAN_INFO;
> +
> +    static {
> +        GBeanInfoBuilder infoBuilder =  
> GBeanInfoBuilder.createStatic("DeployTool", DeployTool.class,  
> "DeployTool");
> +
> +        infoBuilder.addInterface(Main.class);
> +
> +        infoBuilder.setConstructor(new String[] {"kernel"});
> +
> +        GBEAN_INFO = infoBuilder.getBeanInfo();
> +    }
> +
> +    public static GBeanInfo getGBeanInfo() {
> +        return GBEAN_INFO;
> +    }
> +
>  }
>
> Added: geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/ 
> java/org/apache/geronimo/deployment/cli/OfflineDeployerStarter.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/ 
> geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/ 
> cli/OfflineDeployerStarter.java?view=auto&rev=503370
> ====================================================================== 
> ========
> --- geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/ 
> java/org/apache/geronimo/deployment/cli/OfflineDeployerStarter.java  
> (added)
> +++ geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/ 
> java/org/apache/geronimo/deployment/cli/OfflineDeployerStarter.java  
> Sat Feb  3 23:38:35 2007
> @@ -0,0 +1,130 @@
> +/**
> + *  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.deployment.cli;
> +
> +import java.util.ArrayList;
> +import java.util.Collections;
> +import java.util.Iterator;
> +import java.util.List;
> +import java.util.Set;
> +
> +import org.apache.geronimo.common.DeploymentException;
> +import org.apache.geronimo.gbean.AbstractName;
> +import org.apache.geronimo.gbean.AbstractNameQuery;
> +import org.apache.geronimo.kernel.GBeanNotFoundException;
> +import org.apache.geronimo.kernel.Kernel;
> +import org.apache.geronimo.kernel.config.ConfigurationManager;
> +import org.apache.geronimo.kernel.config.ConfigurationStore;
> +import org.apache.geronimo.kernel.config.ConfigurationUtil;
> +import org.apache.geronimo.kernel.config.LifecycleException;
> +import org.apache.geronimo.kernel.config.NoSuchConfigException;
> +import org.apache.geronimo.kernel.config.PersistentConfigurationList;
> +import  
> org.apache.geronimo.kernel.config.SwitchablePersistentConfigurationLis 
> t;
> +import org.apache.geronimo.kernel.repository.Artifact;
> +import org.apache.geronimo.kernel.repository.ArtifactResolver;
> +import  
> org.apache.geronimo.kernel.repository.MissingDependencyException;
> +
> +/**
> + * @version $Rev: 476049 $ $Date: 2006-11-17 15:35:17 +1100 (Fri,  
> 17 Nov 2006) $
> + */
> +public class OfflineDeployerStarter {
> +    private static final Artifact OFFLINE_DEPLOYER_ARTIFACT = new  
> Artifact("org.apache.geronimo.configs",
> +            "offline-deployer",
> +            (String) null,
> +            "car");
> +
> +    private final Kernel kernel;
> +    private final AbstractName  
> onlineDeployerConfigurationManagerName;
> +    private final ConfigurationManager  
> onlineDeployerConfigurationManager;
> +    private final Set<AbstractName> onlineDeployerConfigStores;
> +
> +    public OfflineDeployerStarter(Kernel kernel) {
> +        if (null == kernel) {
> +            throw new IllegalArgumentException("kernel is required");
> +        }
> +        this.kernel = kernel;
> +
> +        onlineDeployerConfigurationManagerName =  
> ConfigurationUtil.getConfigurationManagerName(kernel);
> +        onlineDeployerConfigurationManager =  
> ConfigurationUtil.getConfigurationManager(kernel);
> +        onlineDeployerConfigStores = kernel.listGBeans(new  
> AbstractNameQuery(ConfigurationStore.class.getName()));
> +    }
> +
> +    public void start() throws DeploymentException {
> +        try {
> +            Artifact offlineDeployerArtifact =  
> resolveOfflineDeployer();
> +            startOfflineConfiguration(offlineDeployerArtifact);
> +            startPersistentOfflineConfigurations 
> (offlineDeployerArtifact);
> +            stopOfflineConfigurationManager();
> +            stopOnlineConfigStores();
> +            enablePersistentConfigurationTracking();
> +        } catch (Exception e) {
> +            throw new DeploymentException("Unexpected error.  
> Cannot start offline-deployer", e);
> +        }
> +        onlineDeployerConfigurationManager.setOnline(false);
> +    }
> +
> +    protected Artifact resolveOfflineDeployer() throws  
> MissingDependencyException {
> +        ArtifactResolver artifactResolver =  
> onlineDeployerConfigurationManager.getArtifactResolver();
> +        return artifactResolver.resolveInClassLoader 
> (OFFLINE_DEPLOYER_ARTIFACT);
> +    }
> +
> +    protected void enablePersistentConfigurationTracking() throws  
> GBeanNotFoundException {
> +        SwitchablePersistentConfigurationList switchableList =  
> (SwitchablePersistentConfigurationList) kernel.getGBean 
> (SwitchablePersistentConfigurationList.class);
> +        switchableList.setOnline(true);
> +    }
> +
> +    protected void stopOnlineConfigStores() throws  
> GBeanNotFoundException {
> +        for (AbstractName configStoreName :  
> onlineDeployerConfigStores) {
> +            kernel.stopGBean(configStoreName);
> +        }
> +    }
> +
> +    protected void stopOfflineConfigurationManager() throws  
> GBeanNotFoundException {
> +        Set names = kernel.listGBeans(new AbstractNameQuery 
> (ConfigurationManager.class.getName()));
> +        for (Iterator iterator = names.iterator(); iterator.hasNext 
> ();) {
> +            AbstractName abstractName = (AbstractName)  
> iterator.next();
> +            if (!onlineDeployerConfigurationManagerName.equals 
> (abstractName)) {
> +                kernel.stopGBean(abstractName);
> +            }
> +        }
> +    }
> +
> +    protected void startPersistentOfflineConfigurations(Artifact  
> offlineDeployerArtifact) throws Exception {
> +        AbstractNameQuery query = new AbstractNameQuery 
> (offlineDeployerArtifact,
> +                Collections.EMPTY_MAP,
> +                Collections.singleton 
> (PersistentConfigurationList.class.getName()));
> +        Set configLists = kernel.listGBeans(query);
> +
> +        List<Artifact> configs = new ArrayList<Artifact>();
> +        for (Iterator i = configLists.iterator(); i.hasNext();) {
> +            AbstractName configListName = (AbstractName) i.next();
> +            configs.addAll((List<Artifact>) kernel.invoke 
> (configListName, "restore"));
> +        }
> +
> +        for (Artifact config : configs) {
> +            onlineDeployerConfigurationManager.loadConfiguration 
> (config);
> +            onlineDeployerConfigurationManager.startConfiguration 
> (config);
> +        }
> +    }
> +
> +    protected void startOfflineConfiguration(Artifact  
> offlineDeployerArtifact) throws NoSuchConfigException,  
> LifecycleException {
> +        onlineDeployerConfigurationManager.loadConfiguration 
> (offlineDeployerArtifact);
> +        onlineDeployerConfigurationManager.startConfiguration 
> (offlineDeployerArtifact);
> +    }
> +
> +}
>
> Modified: geronimo/server/trunk/modules/geronimo-deploy-tool/src/ 
> main/java/org/apache/geronimo/deployment/cli/ServerConnection.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/ 
> geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/ 
> cli/ServerConnection.java?view=diff&rev=503370&r1=503369&r2=503370
> ====================================================================== 
> ========
> --- geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/ 
> java/org/apache/geronimo/deployment/cli/ServerConnection.java  
> (original)
> +++ geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/ 
> java/org/apache/geronimo/deployment/cli/ServerConnection.java Sat  
> Feb  3 23:38:35 2007
> @@ -20,11 +20,11 @@
>  import java.io.BufferedInputStream;
>  import java.io.File;
>  import java.io.FileInputStream;
> +import java.io.FileNotFoundException;
>  import java.io.IOException;
>  import java.io.InputStream;
>  import java.io.PrintWriter;
>  import java.io.Serializable;
> -import java.io.FileNotFoundException;
>  import java.util.LinkedHashMap;
>  import java.util.List;
>  import java.util.Map;
> @@ -41,11 +41,8 @@
>  import  
> org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl;
>  import  
> org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager;
>  import  
> org.apache.geronimo.deployment.plugin.jmx.LocalDeploymentManager;
> -import org.apache.geronimo.util.SimpleEncryption;
>  import org.apache.geronimo.kernel.Kernel;
> -import org.apache.geronimo.kernel.config.ConfigurationManager;
> -import org.apache.geronimo.kernel.config.ConfigurationUtil;
> -import org.apache.geronimo.system.main.LocalServer;
> +import org.apache.geronimo.util.SimpleEncryption;
>
>  /**
>   * Supports online connections to the server, via JSR-88, valid only
> @@ -112,8 +109,13 @@
>      private SavedAuthentication auth;
>      private boolean logToSysErr;
>      private boolean verboseMessages;
> +    private final Kernel kernel;
>
> -    public ServerConnection(String[] args, PrintWriter out,  
> InputStream in) throws DeploymentException {
> +    public ServerConnection(String[] args, PrintWriter out,  
> InputStream in, Kernel kernel) throws DeploymentException {
> +        if (null == kernel) {
> +            throw new IllegalArgumentException("kernel is required");
> +        }
> +        this.kernel = kernel;
>          String uri = null, driver = null, user = null, password =  
> null, host = null;
>          Integer port = null;
>          this.out = out;
> @@ -194,17 +196,8 @@
>              uri = DEFAULT_URI + "://" + (host == null ? "" : host)  
> + (port == null ? "" : ":" + port);
>          }
>          if (offline) {
> -            LocalServer localServer;
> -            try {
> -                localServer = new LocalServer 
> ("org.apache.geronimo.configs/j2ee-system//car", "var/config/ 
> offline-deployer-list");
> -            } catch (Exception e) {
> -                throw new DeploymentException("Could not start  
> local server", e);
> -            }
> -            Kernel kernel = localServer.getKernel();
> -            ConfigurationManager configurationManager =  
> ConfigurationUtil.getConfigurationManager(kernel);
> -            configurationManager.setOnline(false);
> -
> -            manager = new LocalDeploymentManager 
> (localServer.getKernel());
> +            startOfflineDeployer(kernel);
> +            manager = new LocalDeploymentManager(kernel);
>          } else {
>              tryToConnect(uri, driver, user, password, true);
>          }
> @@ -213,6 +206,11 @@
>          }
>      }
>
> +    protected void startOfflineDeployer(Kernel kernel) throws  
> DeploymentException {
> +        OfflineDeployerStarter offlineDeployerStarter = new  
> OfflineDeployerStarter(kernel);
> +        offlineDeployerStarter.start();
> +    }
> +
>      public void close() throws DeploymentException {
>          if (manager != null) {
>              manager.release();
> @@ -232,7 +230,7 @@
>          if (driver != null) {
>              loadDriver(driver, mgr);
>          } else {
> -            mgr.registerDeploymentFactory(new DeploymentFactoryImpl 
> ());
> +            mgr.registerDeploymentFactory(new DeploymentFactoryImpl 
> (kernel));
>          }
>          String useURI = argURI == null ? DEFAULT_URI : argURI;
>
>
> Modified: geronimo/server/trunk/modules/geronimo-hot-deploy/src/ 
> main/java/org/apache/geronimo/deployment/hot/DirectoryHotDeployer.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/ 
> geronimo-hot-deploy/src/main/java/org/apache/geronimo/deployment/ 
> hot/DirectoryHotDeployer.java?view=diff&rev=503370&r1=503369&r2=503370
> ====================================================================== 
> ========
> --- geronimo/server/trunk/modules/geronimo-hot-deploy/src/main/java/ 
> org/apache/geronimo/deployment/hot/DirectoryHotDeployer.java  
> (original)
> +++ geronimo/server/trunk/modules/geronimo-hot-deploy/src/main/java/ 
> org/apache/geronimo/deployment/hot/DirectoryHotDeployer.java Sat  
> Feb  3 23:38:35 2007
> @@ -142,7 +142,7 @@
>
>      public void doStart() throws Exception {
>          if (factory == null) {
> -            factory = new DeploymentFactoryImpl();
> +            factory = new DeploymentFactoryImpl(kernel);
>          }
>          File dir = serverInfo.resolve(path);
>          if (!dir.exists()) {
>
> Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/ 
> java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/ 
> geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ 
> ConfigurationUtil.java?view=diff&rev=503370&r1=503369&r2=503370
> ====================================================================== 
> ========
> --- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/ 
> apache/geronimo/kernel/config/ConfigurationUtil.java (original)
> +++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/ 
> apache/geronimo/kernel/config/ConfigurationUtil.java Sat Feb  3  
> 23:38:35 2007
> @@ -237,12 +237,12 @@
>      }
>
>      /**
> -     * Gets a reference or proxy to the ConfigurationManager  
> running in the specified kernel.
> +     * Gets the name of the ConfigurationManager running in the  
> specified kernel.
>       *
> -     * @return The ConfigurationManager
> +     * @return Its AbstractName
>       * @throws IllegalStateException Occurs if a  
> ConfigurationManager cannot be identified
>       */
> -    public static ConfigurationManager getConfigurationManager 
> (Kernel kernel) {
> +    public static AbstractName getConfigurationManagerName(Kernel  
> kernel) {
>          Set names = kernel.listGBeans(new AbstractNameQuery 
> (ConfigurationManager.class.getName()));
>          for (Iterator iterator = names.iterator(); iterator.hasNext 
> ();) {
>              AbstractName abstractName = (AbstractName)  
> iterator.next();
> @@ -256,7 +256,18 @@
>          if (names.size() > 1) {
>              throw new IllegalStateException("More than one  
> Configuration Manager was found in the kernel");
>          }
> -        AbstractName configurationManagerName = (AbstractName)  
> names.iterator().next();
> +        return (AbstractName) names.iterator().next();
> +    }
> +
> +
> +    /**
> +     * Gets a reference or proxy to the ConfigurationManager  
> running in the specified kernel.
> +     *
> +     * @return The ConfigurationManager
> +     * @throws IllegalStateException Occurs if a  
> ConfigurationManager cannot be identified
> +     */
> +    public static ConfigurationManager getConfigurationManager 
> (Kernel kernel) {
> +        AbstractName configurationManagerName =  
> getConfigurationManagerName(kernel);
>          return (ConfigurationManager) kernel.getProxyManager 
> ().createProxy(configurationManagerName, ConfigurationManager.class);
>      }
>
>
> Added: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/ 
> org/apache/geronimo/kernel/config/ 
> SwitchablePersistentConfigurationList.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/ 
> geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ 
> SwitchablePersistentConfigurationList.java?view=auto&rev=503370
> ====================================================================== 
> ========
> --- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/ 
> apache/geronimo/kernel/config/ 
> SwitchablePersistentConfigurationList.java (added)
> +++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/ 
> apache/geronimo/kernel/config/ 
> SwitchablePersistentConfigurationList.java Sat Feb  3 23:38:35 2007
> @@ -0,0 +1,30 @@
> +/**
> + *  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.kernel.config;
> +
> +
> +/**
> + *
> + *
> + *
> + * @version $Rev: 486815 $ $Date: 2006-12-14 06:45:10 +1100 (Thu,  
> 14 Dec 2006) $
> + */
> +public interface SwitchablePersistentConfigurationList extends  
> PersistentConfigurationList {
> +    boolean isOnline();
> +
> +    void setOnline(boolean online);
> +}
>
> Added: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/ 
> org/apache/geronimo/kernel/util/Main.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/ 
> geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/ 
> Main.java?view=auto&rev=503370
> ====================================================================== 
> ========
> --- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/ 
> apache/geronimo/kernel/util/Main.java (added)
> +++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/ 
> apache/geronimo/kernel/util/Main.java Sat Feb  3 23:38:35 2007
> @@ -0,0 +1,26 @@
> +/**
> + *  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.kernel.util;
> +
> +
> +/**
> + *
> + * @version $Rev: 476049 $ $Date: 2006-11-17 15:35:17 +1100 (Fri,  
> 17 Nov 2006) $
> + */
> +public interface Main {
> +    int execute(String[] args);
> +}
>
> Added: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/ 
> org/apache/geronimo/kernel/util/MainBootstrapper.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/ 
> geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/ 
> MainBootstrapper.java?view=auto&rev=503370
> ====================================================================== 
> ========
> --- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/ 
> apache/geronimo/kernel/util/MainBootstrapper.java (added)
> +++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/ 
> apache/geronimo/kernel/util/MainBootstrapper.java Sat Feb  3  
> 23:38:35 2007
> @@ -0,0 +1,132 @@
> +/**
> + *  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.kernel.util;
> +
> +import java.io.IOException;
> +import java.io.InputStream;
> +import java.util.ArrayList;
> +import java.util.Iterator;
> +import java.util.List;
> +import java.util.Set;
> +
> +import org.apache.geronimo.gbean.AbstractName;
> +import org.apache.geronimo.gbean.AbstractNameQuery;
> +import org.apache.geronimo.kernel.Kernel;
> +import org.apache.geronimo.kernel.KernelFactory;
> +import org.apache.geronimo.kernel.config.ConfigurationManager;
> +import org.apache.geronimo.kernel.config.ConfigurationUtil;
> +import org.apache.geronimo.kernel.config.PersistentConfigurationList;
> +import org.apache.geronimo.kernel.repository.Artifact;
> +
> +/**
> + *
> + * @version $Rev: 476049 $ $Date: 2006-11-17 15:35:17 +1100 (Fri,  
> 17 Nov 2006) $
> + */
> +public class MainBootstrapper {
> +
> +    public static void main(String[] args) {
> +        MainBootstrapper bootstrapper = new MainBootstrapper();
> +        Main main = bootstrapper.getMain 
> (MainBootstrapper.class.getClassLoader());
> +
> +        int exitCode;
> +        ClassLoader oldTCCL = Thread.currentThread 
> ().getContextClassLoader();
> +        try {
> +            ClassLoader newTCCL = main.getClass().getClassLoader();
> +            Thread.currentThread().setContextClassLoader(newTCCL);
> +            exitCode = main.execute(args);
> +        } finally {
> +            Thread.currentThread().setContextClassLoader(oldTCCL);
> +        }
> +        bootstrapper.shutdown();
> +
> +        System.exit(exitCode);
> +    }
> +
> +    protected Kernel kernel;
> +
> +    public Main getMain(ClassLoader classLoader) {
> +        try {
> +            bootKernel();
> +            loadBootConfiguration(classLoader);
> +            loadPersistentConfigurations();
> +            return getMain();
> +        } catch (Exception e) {
> +            if (null != kernel) {
> +                kernel.shutdown();
> +            }
> +            e.printStackTrace();
> +            System.exit(1);
> +            throw new AssertionError();
> +        }
> +    }
> +
> +    protected void shutdown() {
> +        kernel.shutdown();
> +    }
> +
> +    protected void bootKernel() throws Exception {
> +        kernel = KernelFactory.newInstance().createKernel 
> ("MainBootstrapper");
> +        kernel.boot();
> +
> +        Runtime.getRuntime().addShutdownHook(new Thread 
> ("MainBootstrapper shutdown thread") {
> +            public void run() {
> +                kernel.shutdown();
> +            }
> +        });
> +    }
> +
> +    protected void loadBootConfiguration(ClassLoader classLoader)  
> throws Exception {
> +        InputStream in = classLoader.getResourceAsStream("META-INF/ 
> config.ser");
> +        try {
> +            ConfigurationUtil.loadBootstrapConfiguration(kernel,  
> in, classLoader);
> +        } finally {
> +            if (in != null) {
> +                try {
> +                    in.close();
> +                } catch (IOException ignored) {
> +                    // ignored
> +                }
> +            }
> +        }
> +    }
> +
> +    protected void loadPersistentConfigurations() throws Exception {
> +        List<Artifact> configs = new ArrayList<Artifact>();
> +
> +        AbstractNameQuery query = new AbstractNameQuery 
> (PersistentConfigurationList.class.getName());
> +        Set configLists = kernel.listGBeans(query);
> +        for (Iterator i = configLists.iterator(); i.hasNext();) {
> +            AbstractName configListName = (AbstractName) i.next();
> +            configs.addAll((List<Artifact>) kernel.invoke 
> (configListName, "restore"));
> +        }
> +
> +        ConfigurationManager configurationManager =  
> ConfigurationUtil.getConfigurationManager(kernel);
> +        try {
> +            for (Artifact config : configs) {
> +                configurationManager.loadConfiguration(config);
> +                configurationManager.startConfiguration(config);
> +            }
> +        } finally {
> +            ConfigurationUtil.releaseConfigurationManager(kernel,  
> configurationManager);
> +        }
> +    }
> +
> +    protected Main getMain() throws Exception {
> +        return (Main) kernel.getGBean(Main.class);
> +    }
> +
> +}
>
> Added: geronimo/server/trunk/modules/geronimo-system/src/main/java/ 
> org/apache/geronimo/system/configuration/ 
> SwitchableLocalAttributeManager.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/ 
> geronimo-system/src/main/java/org/apache/geronimo/system/ 
> configuration/SwitchableLocalAttributeManager.java? 
> view=auto&rev=503370
> ====================================================================== 
> ========
> --- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/ 
> apache/geronimo/system/configuration/ 
> SwitchableLocalAttributeManager.java (added)
> +++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/ 
> apache/geronimo/system/configuration/ 
> SwitchableLocalAttributeManager.java Sat Feb  3 23:38:35 2007
> @@ -0,0 +1,103 @@
> +/**
> + *  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.system.configuration;
> +
> +import java.io.IOException;
> +import java.util.Collections;
> +import java.util.List;
> +
> +import org.apache.geronimo.gbean.GBeanInfo;
> +import org.apache.geronimo.gbean.GBeanInfoBuilder;
> +import org.apache.geronimo.kernel.config.Configuration;
> +import  
> org.apache.geronimo.kernel.config.SwitchablePersistentConfigurationLis 
> t;
> +import org.apache.geronimo.kernel.repository.Artifact;
> +import org.apache.geronimo.system.serverinfo.ServerInfo;
> +
> +/**
> + *
> + * @version $Rev: 486815 $ $Date: 2006-12-14 06:45:10 +1100 (Thu,  
> 14 Dec 2006) $
> + */
> +public class SwitchableLocalAttributeManager extends  
> LocalAttributeManager implements  
> SwitchablePersistentConfigurationList {
> +    private boolean online;
> +
> +    public SwitchableLocalAttributeManager(String configFile,  
> boolean readOnly, ServerInfo serverInfo) {
> +        super(configFile, readOnly, serverInfo);
> +    }
> +
> +    @Override
> +    public synchronized List restore() throws IOException {
> +        return Collections.EMPTY_LIST;
> +    }
> +
> +    public synchronized void setOnline(boolean online) {
> +        this.online = online;
> +    }
> +
> +    public synchronized boolean isOnline() {
> +        return online;
> +    }
> +
> +    @Override
> +    public synchronized void addConfiguration(Artifact  
> configurationName) {
> +        if (online) {
> +            super.addConfiguration(configurationName);
> +        }
> +    }
> +
> +    @Override
> +    public void startConfiguration(Artifact configurationName) {
> +        if (online) {
> +            super.startConfiguration(configurationName);
> +        }
> +    }
> +
> +    @Override
> +    public void stopConfiguration(Artifact configName) {
> +        if (online) {
> +            super.stopConfiguration(configName);
> +        }
> +    }
> +
> +    @Override
> +    public synchronized void removeConfiguration(Artifact  
> configName) {
> +        if (online) {
> +            super.removeConfiguration(configName);
> +        }
> +    }
> +
> +    @Override
> +    public void migrateConfiguration(Artifact oldName, Artifact  
> newName, Configuration configuration) {
> +        if (online) {
> +            super.migrateConfiguration(oldName, newName,  
> configuration);
> +        }
> +    }
> +
> +    public static final GBeanInfo GBEAN_INFO;
> +
> +    static {
> +        GBeanInfoBuilder infoFactory =  
> GBeanInfoBuilder.createStatic 
> (SwitchableLocalAttributeManager.class,  
> LocalAttributeManager.GBEAN_INFO);
> +
> +        infoFactory.addInterface 
> (SwitchablePersistentConfigurationList.class);
> +
> +        GBEAN_INFO = infoFactory.getBeanInfo();
> +    }
> +
> +    public static GBeanInfo getGBeanInfo() {
> +        return GBEAN_INFO;
> +    }
> +
> +}
>
>


Mime
View raw message