geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jboy...@apache.org
Subject cvs commit: incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel Kernel.java KernelMBean.java
Date Tue, 01 Jun 2004 18:27:02 GMT
jboynes     2004/06/01 11:27:02

  Modified:    modules/kernel/src/java/org/apache/geronimo/kernel
                        Kernel.java KernelMBean.java
  Log:
  Expose methods to start/stop configurations
  This is on kernel as we don't want clients interacting directly with the config manager
  
  Revision  Changes    Path
  1.28      +32 -1     incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java
  
  Index: Kernel.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- Kernel.java	1 Jun 2004 16:06:51 -0000	1.27
  +++ Kernel.java	1 Jun 2004 18:27:02 -0000	1.28
  @@ -18,11 +18,14 @@
   package org.apache.geronimo.kernel;
   
   import java.io.Serializable;
  +import java.io.IOException;
   import java.lang.ref.ReferenceQueue;
   import java.lang.ref.WeakReference;
   import java.util.Collections;
   import java.util.Hashtable;
   import java.util.Map;
  +import java.util.List;
  +import java.net.URI;
   import javax.management.Attribute;
   import javax.management.InstanceAlreadyExistsException;
   import javax.management.InstanceNotFoundException;
  @@ -34,6 +37,7 @@
   import javax.management.NotCompliantMBeanException;
   import javax.management.NotificationBroadcasterSupport;
   import javax.management.ObjectName;
  +import javax.management.MalformedObjectNameException;
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  @@ -42,6 +46,7 @@
   import org.apache.geronimo.kernel.config.ConfigurationManagerImpl;
   import org.apache.geronimo.kernel.config.InvalidConfigException;
   import org.apache.geronimo.kernel.config.ConfigurationManager;
  +import org.apache.geronimo.kernel.config.NoSuchConfigException;
   import org.apache.geronimo.kernel.jmx.JMXUtil;
   
   
  @@ -279,6 +284,32 @@
           } catch (MBeanRegistrationException e) {
               throw (IllegalStateException) new IllegalStateException("Error unloading GBean
" + name).initCause(e);
           }
  +    }
  +
  +    public ObjectName startConfiguration(URI configID) throws NoSuchConfigException, IOException,
InvalidConfigException {
  +        ObjectName configName = getConfigurationManager().load(configID);
  +        try {
  +            startRecursiveGBean(configName);
  +        } catch (InstanceNotFoundException e) {
  +            // should not happen as we just loaded it
  +            throw new InvalidConfigException(e);
  +        }
  +        return configName;
  +    }
  +
  +    public void stopConfiguration(URI configID) throws NoSuchConfigException {
  +        ConfigurationManager configurationManager = getConfigurationManager();
  +        try {
  +            ObjectName configName = configurationManager.getConfigObjectName(configID);
  +            stopGBean(configName);
  +        } catch (MalformedObjectNameException e) {
  +            throw new NoSuchConfigException(e);
  +        } catch (InstanceNotFoundException e) {
  +            throw new NoSuchConfigException(e);
  +        } catch (InvalidConfigException e) {
  +            throw (IllegalStateException) new IllegalStateException().initCause(e);
  +        }
  +        configurationManager.unload(configID);
       }
   
       /**
  
  
  
  1.9       +9 -1      incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/KernelMBean.java
  
  Index: KernelMBean.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/KernelMBean.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- KernelMBean.java	27 May 2004 01:06:00 -0000	1.8
  +++ KernelMBean.java	1 Jun 2004 18:27:02 -0000	1.9
  @@ -17,6 +17,9 @@
   
   package org.apache.geronimo.kernel;
   
  +import java.net.URI;
  +import java.io.IOException;
  +import java.util.List;
   import javax.management.InstanceAlreadyExistsException;
   import javax.management.InstanceNotFoundException;
   import javax.management.MBeanServer;
  @@ -25,6 +28,7 @@
   import org.apache.geronimo.gbean.jmx.GBeanMBean;
   import org.apache.geronimo.kernel.config.ConfigurationManager;
   import org.apache.geronimo.kernel.config.InvalidConfigException;
  +import org.apache.geronimo.kernel.config.NoSuchConfigException;
   
   /**
    * @version $Revision$ $Date$
  @@ -91,6 +95,10 @@
       boolean isRunning();
   
       ConfigurationManager getConfigurationManager();
  +
  +    ObjectName startConfiguration(URI configID) throws NoSuchConfigException, IOException,
InvalidConfigException;
  +
  +    void stopConfiguration(URI configID) throws NoSuchConfigException;
   
       Object getAttribute(ObjectName objectName, String attributeName) throws Exception;
   
  
  
  

Mime
View raw message