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/system/src/java/org/apache/geronimo/system/configuration LocalConfigStore.java
Date Wed, 02 Jun 2004 19:50:41 GMT
jboynes     2004/06/02 12:50:41

  Modified:    modules/deployment/src/java/org/apache/geronimo/deployment/plugin
                        TargetImpl.java
               modules/deployment/src/java/org/apache/geronimo/deployment/plugin/jmx
                        JMXDeploymentManager.java
               modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local
                        LocalServer.java
               modules/kernel/src/java/org/apache/geronimo/kernel
                        Kernel.java KernelMBean.java
               modules/kernel/src/java/org/apache/geronimo/kernel/config
                        ConfigurationManager.java
                        ConfigurationManagerImpl.java
                        ConfigurationStore.java
               modules/system/src/java/org/apache/geronimo/system/configuration
                        LocalConfigStore.java
  Added:       modules/kernel/src/java/org/apache/geronimo/kernel/config
                        ConfigurationInfo.java NoSuchStoreException.java
  Log:
  Support JSR88 inquires about modules
  
  Revision  Changes    Path
  1.5       +12 -7     incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/TargetImpl.java
  
  Index: TargetImpl.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/TargetImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TargetImpl.java	2 Jun 2004 18:05:46 -0000	1.4
  +++ TargetImpl.java	2 Jun 2004 19:50:40 -0000	1.5
  @@ -18,31 +18,36 @@
   package org.apache.geronimo.deployment.plugin;
   
   import javax.enterprise.deploy.spi.Target;
  +import javax.management.ObjectName;
   
   /**
  - * 
  - * 
  + *
  + *
    * @version $Revision$ $Date$
    */
   public class TargetImpl implements Target {
  -    private final String name;
  +    private final ObjectName name;
       private final String description;
   
  -    public TargetImpl(String name, String description) {
  +    public TargetImpl(ObjectName name, String description) {
           this.name = name;
           this.description = description;
       }
   
  -    public String getName() {
  +    public ObjectName getObjectName() {
           return name;
       }
   
  +    public String getName() {
  +        return name.toString();
  +    }
  +
       public String getDescription() {
           return description;
       }
   
       public String toString() {
  -        return name;
  +        return name.toString();
       }
   
       public boolean equals(Object o) {
  
  
  
  1.3       +72 -12    incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java
  
  Index: JMXDeploymentManager.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JMXDeploymentManager.java	2 Jun 2004 07:05:30 -0000	1.2
  +++ JMXDeploymentManager.java	2 Jun 2004 19:50:40 -0000	1.3
  @@ -19,6 +19,8 @@
   import java.io.File;
   import java.io.IOException;
   import java.io.InputStream;
  +import java.util.ArrayList;
  +import java.util.List;
   import java.util.Locale;
   import javax.enterprise.deploy.model.DeployableObject;
   import javax.enterprise.deploy.shared.DConfigBeanVersionType;
  @@ -31,15 +33,20 @@
   import javax.enterprise.deploy.spi.exceptions.InvalidModuleException;
   import javax.enterprise.deploy.spi.exceptions.TargetException;
   import javax.enterprise.deploy.spi.status.ProgressObject;
  -import javax.management.remote.JMXConnector;
   import javax.management.MBeanServerConnection;
  +import javax.management.ObjectName;
  +import javax.management.remote.JMXConnector;
   
  -import org.apache.geronimo.kernel.KernelMBean;
  -import org.apache.geronimo.kernel.Kernel;
  -import org.apache.geronimo.kernel.jmx.MBeanProxyFactory;
  +import org.apache.geronimo.deployment.plugin.TargetImpl;
  +import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl;
   import org.apache.geronimo.deployment.plugin.local.StartCommand;
   import org.apache.geronimo.deployment.plugin.local.StopCommand;
  -import org.apache.geronimo.deployment.plugin.TargetImpl;
  +import org.apache.geronimo.kernel.Kernel;
  +import org.apache.geronimo.kernel.KernelMBean;
  +import org.apache.geronimo.kernel.config.ConfigurationInfo;
  +import org.apache.geronimo.kernel.config.NoSuchStoreException;
  +import org.apache.geronimo.kernel.jmx.MBeanProxyFactory;
  +import org.apache.geronimo.kernel.management.State;
   
   /**
    *
  @@ -61,7 +68,7 @@
           try {
               jmxConnector.close();
           } catch (IOException e) {
  -            // can't do much with this
  +            throw (IllegalStateException) new IllegalStateException("Unable to close connection").initCause(e);
           } finally {
               mbServerConnection = null;
               kernel = null;
  @@ -72,20 +79,73 @@
           if (kernel == null) {
               throw new IllegalStateException("Disconnected");
           }
  -        Target target = new TargetImpl("default", null);
  -        return new Target[]{target};
  +        List stores = kernel.listConfigurationStores();
  +        if (stores.size() == 0) {
  +            return null;
  +        }
  +
  +        Target[] targets = new Target[stores.size()];
  +        for (int i = 0; i < stores.size(); i++) {
  +            ObjectName storeName = (ObjectName) stores.get(i);
  +            targets[i] = new TargetImpl(storeName, null);
  +        }
  +        return targets;
       }
   
       public TargetModuleID[] getAvailableModules(ModuleType moduleType, Target[] targetList)
throws TargetException {
  -        throw new UnsupportedOperationException();
  +        ConfigFilter filter = new ConfigFilter() {
  +            public boolean accept(ConfigurationInfo info) {
  +                return true;
  +            }
  +        };
  +        return getModules(targetList, filter);
       }
   
       public TargetModuleID[] getNonRunningModules(ModuleType moduleType, Target[] targetList)
throws TargetException {
  -        throw new UnsupportedOperationException();
  +        ConfigFilter filter = new ConfigFilter() {
  +            public boolean accept(ConfigurationInfo info) {
  +                return info.getState() != State.RUNNING;
  +            }
  +        };
  +        return getModules(targetList, filter);
       }
   
       public TargetModuleID[] getRunningModules(ModuleType moduleType, Target[] targetList)
throws TargetException {
  -        throw new UnsupportedOperationException();
  +        ConfigFilter filter = new ConfigFilter() {
  +            public boolean accept(ConfigurationInfo info) {
  +                return info.getState() == State.RUNNING;
  +            }
  +        };
  +        return getModules(targetList, filter);
  +    }
  +
  +    private static interface ConfigFilter {
  +        boolean accept(ConfigurationInfo info);
  +    }
  +
  +    private TargetModuleID[] getModules(Target[] targetList, ConfigFilter filter) throws
TargetException {
  +        if (kernel == null) {
  +            throw new IllegalStateException("Disconnected");
  +        }
  +
  +        try {
  +            ArrayList result = new ArrayList();
  +            for (int i = 0; i < targetList.length; i++) {
  +                TargetImpl target = (TargetImpl) targetList[i];
  +                ObjectName storeName = target.getObjectName();
  +                List infos = kernel.listConfigurations(storeName);
  +                for (int j = 0; j < infos.size(); j++) {
  +                    ConfigurationInfo info = (ConfigurationInfo) infos.get(j);
  +                    if (filter.accept(info)) {
  +                        TargetModuleID moduleID = new TargetModuleIDImpl(target, info.getConfigID().toString());
  +                        result.add(moduleID);
  +                    }
  +                }
  +            }
  +            return result.size() == 0 ? null : (TargetModuleID[]) result.toArray(new TargetModuleID[result.size()]);
  +        } catch (NoSuchStoreException e) {
  +            throw (TargetException) new TargetException(e.getMessage()).initCause(e);
  +        }
       }
   
       public ProgressObject distribute(Target[] targetList, File moduleArchive, File deploymentPlan)
{
  
  
  
  1.11      +2 -2      incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/LocalServer.java
  
  Index: LocalServer.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/LocalServer.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- LocalServer.java	2 Jun 2004 05:33:02 -0000	1.10
  +++ LocalServer.java	2 Jun 2004 19:50:40 -0000	1.11
  @@ -62,7 +62,7 @@
   
       public LocalServer(URI rootConfigID, File storeDir) throws Exception {
           this.rootConfigID = rootConfigID;
  -        target = new TargetImpl(this.rootConfigID.toString(), null);
  +        target = new TargetImpl(null, null);
           kernel = new Kernel(this.rootConfigID.toString(), "geronimo.localserver");
           this.storeDir = storeDir;
       }
  
  
  
  1.30      +11 -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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- Kernel.java	2 Jun 2004 06:49:23 -0000	1.29
  +++ Kernel.java	2 Jun 2004 19:50:40 -0000	1.30
  @@ -25,6 +25,7 @@
   import java.util.Collections;
   import java.util.Hashtable;
   import java.util.Map;
  +import java.util.List;
   import javax.management.Attribute;
   import javax.management.InstanceAlreadyExistsException;
   import javax.management.InstanceNotFoundException;
  @@ -46,6 +47,7 @@
   import org.apache.geronimo.kernel.config.ConfigurationManagerImpl;
   import org.apache.geronimo.kernel.config.InvalidConfigException;
   import org.apache.geronimo.kernel.config.NoSuchConfigException;
  +import org.apache.geronimo.kernel.config.NoSuchStoreException;
   import org.apache.geronimo.kernel.jmx.JMXUtil;
   
   
  @@ -283,6 +285,14 @@
           } catch (MBeanRegistrationException e) {
               throw (IllegalStateException) new IllegalStateException("Error unloading GBean
" + name).initCause(e);
           }
  +    }
  +
  +    public List listConfigurationStores() {
  +        return getConfigurationManager().listStores();
  +    }
  +
  +    public List listConfigurations(ObjectName storeName) throws NoSuchStoreException {
  +        return getConfigurationManager().listConfigurations(storeName);
       }
   
       public ObjectName startConfiguration(URI configID) throws NoSuchConfigException, IOException,
InvalidConfigException {
  
  
  
  1.11      +17 -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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- KernelMBean.java	2 Jun 2004 06:49:23 -0000	1.10
  +++ KernelMBean.java	2 Jun 2004 19:50:41 -0000	1.11
  @@ -19,6 +19,7 @@
   
   import java.io.IOException;
   import java.net.URI;
  +import java.util.List;
   import javax.management.InstanceAlreadyExistsException;
   import javax.management.InstanceNotFoundException;
   import javax.management.MBeanServer;
  @@ -28,6 +29,7 @@
   import org.apache.geronimo.kernel.config.ConfigurationManager;
   import org.apache.geronimo.kernel.config.InvalidConfigException;
   import org.apache.geronimo.kernel.config.NoSuchConfigException;
  +import org.apache.geronimo.kernel.config.NoSuchStoreException;
   
   /**
    * @version $Revision$ $Date$
  @@ -94,6 +96,20 @@
       boolean isRunning();
   
       ConfigurationManager getConfigurationManager();
  +
  +    /**
  +     * Return a list of the stores this kernel knows about.
  +     * @return a List<ObjectName> of the stores this kernel controls
  +     */
  +    List listConfigurationStores();
  +
  +    /**
  +     * Return info about the configurations in a store.
  +     * @param storeName the store
  +     * @return a List<ConfigurationInfo> of information about the store's configurations
  +     * @throws NoSuchStoreException if this store does not exist
  +     */
  +    List listConfigurations(ObjectName storeName) throws NoSuchStoreException;
   
       ObjectName startConfiguration(URI configID) throws NoSuchConfigException, IOException,
InvalidConfigException;
   
  
  
  
  1.6       +15 -1     incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
  
  Index: ConfigurationManager.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ConfigurationManager.java	1 Jun 2004 16:06:50 -0000	1.5
  +++ ConfigurationManager.java	2 Jun 2004 19:50:41 -0000	1.6
  @@ -33,6 +33,20 @@
   public interface ConfigurationManager {
       boolean isLoaded(URI configID);
   
  +    /**
  +     * Return a list of the stores this manager knows about.
  +     * @return a List<ObjectName> of the stores this manager controls
  +     */
  +    List listStores();
  +
  +    /**
  +     * Return a list of the configurations in a specific store.
  +     * @param store the store to list
  +     * @return a List<ConfigurationInfo> of all the configurations in the store
  +     * @throws NoSuchStoreException if the store could not be located
  +     */
  +    List listConfigurations(ObjectName store) throws NoSuchStoreException;
  +
       ObjectName getConfigObjectName(URI configID) throws MalformedObjectNameException;
   
       ObjectName load(URI configID) throws NoSuchConfigException, IOException, InvalidConfigException;
  
  
  
  1.3       +52 -7     incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java
  
  Index: ConfigurationManagerImpl.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConfigurationManagerImpl.java	2 Jun 2004 05:33:03 -0000	1.2
  +++ ConfigurationManagerImpl.java	2 Jun 2004 19:50:41 -0000	1.3
  @@ -26,6 +26,7 @@
   import java.util.LinkedList;
   import java.util.List;
   import java.util.Set;
  +import java.util.ArrayList;
   import javax.management.InstanceNotFoundException;
   import javax.management.MalformedObjectNameException;
   import javax.management.ObjectName;
  @@ -36,6 +37,7 @@
   import org.apache.geronimo.gbean.GBeanInfoFactory;
   import org.apache.geronimo.gbean.jmx.GBeanMBean;
   import org.apache.geronimo.kernel.Kernel;
  +import org.apache.geronimo.kernel.management.State;
   
   /**
    * @version $Revision$ $Date$
  @@ -50,6 +52,49 @@
           this.stores = stores;
       }
   
  +    public List listStores() {
  +        List storeSnapshot = getStores();
  +        List result = new ArrayList(storeSnapshot.size());
  +        for (int i=0; i < storeSnapshot.size(); i++) {
  +            ConfigurationStore store = (ConfigurationStore) storeSnapshot.get(i);
  +            result.add(store.getObjectName());
  +        }
  +        return result;
  +    }
  +
  +    public List listConfigurations(ObjectName storeName) throws NoSuchStoreException {
  +        List storeSnapshot = getStores();
  +        for (int i=0; i < storeSnapshot.size(); i++) {
  +            ConfigurationStore store = (ConfigurationStore) storeSnapshot.get(i);
  +            if (storeName.equals(store.getObjectName())) {
  +                List ids = store.listConfiguations();
  +                List result = new ArrayList(ids.size());
  +                for (int j = 0; j < ids.size(); j++) {
  +                    URI configID = (URI) ids.get(j);
  +                    ObjectName configName;
  +                    try {
  +                        configName = getConfigObjectName(configID);
  +                    } catch (MalformedObjectNameException e) {
  +                        throw new AssertionError("Store returned invalid configID: " +
configID);
  +                    }
  +                    State state;
  +                    if (kernel.isLoaded(configName)) {
  +                        try {
  +                            state = State.fromInteger((Integer)kernel.getAttribute(configName,
"state"));
  +                        } catch (Exception e) {
  +                            state = null;
  +                        }
  +                    } else {
  +                        state = null;
  +                    }
  +                    result.add(new ConfigurationInfo(storeName, configID, state));
  +                }
  +                return result;
  +            }
  +        }
  +        throw new NoSuchStoreException("No such store: " + storeName);
  +    }
  +
       public boolean isLoaded(URI configID) {
           try {
               ObjectName name = getConfigObjectName(configID);
  @@ -60,17 +105,17 @@
       }
   
       public ObjectName load(URI configID) throws NoSuchConfigException, IOException, InvalidConfigException
{
  -        Set storeSnapshot = getStoreSnapshot();
  +        List storeSnapshot = getStores();
   
  -        for (Iterator iterator = storeSnapshot.iterator(); iterator.hasNext();) {
  -            ConfigurationStore store = (ConfigurationStore) iterator.next();
  +        for (int i=0; i < storeSnapshot.size(); i++) {
  +            ConfigurationStore store = (ConfigurationStore) storeSnapshot.get(i);
               if (store.containsConfiguration(configID)) {
                   GBeanMBean config = store.getConfiguration(configID);
                   URL baseURL = store.getBaseURL(configID);
                   return load(config, baseURL);
               }
           }
  -        throw new NoSuchConfigException("A configuration with the specifiec id could not
be found: " + configID);
  +        throw new NoSuchConfigException("No configuration with id: " + configID);
       }
   
       public ObjectName load(GBeanMBean config, URL rootURL) throws InvalidConfigException
{
  @@ -151,8 +196,8 @@
           log.info("Unloaded Configuration " + configName);
       }
   
  -    private Set getStoreSnapshot() {
  -        Set storeSnapshot = new HashSet(stores);
  +    private List getStores() {
  +        List storeSnapshot = new ArrayList(stores);
           if (storeSnapshot.size() == 0) {
               throw new UnsupportedOperationException("There are no installed ConfigurationStores");
           }
  
  
  
  1.7       +16 -1     incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
  
  Index: ConfigurationStore.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ConfigurationStore.java	27 May 2004 01:06:00 -0000	1.6
  +++ ConfigurationStore.java	2 Jun 2004 19:50:41 -0000	1.7
  @@ -20,6 +20,9 @@
   import java.io.IOException;
   import java.net.URI;
   import java.net.URL;
  +import java.util.List;
  +
  +import javax.management.ObjectName;
   
   import org.apache.geronimo.gbean.jmx.GBeanMBean;
   
  @@ -65,4 +68,16 @@
        * @throws NoSuchConfigException if the store does not contain a Configuration with
that id
        */
       URL getBaseURL(URI id) throws NoSuchConfigException;
  +
  +    /**
  +     * Return the object name for the store.
  +     * @return the object name for the store
  +     */
  +    ObjectName getObjectName();
  +
  +    /**
  +     * Return the configurations in the store
  +     * @return a List<URI> of configurations in the store
  +     */
  +    List listConfiguations();
   }
  
  
  
  1.1                  incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationInfo.java
  
  Index: ConfigurationInfo.java
  ===================================================================
  /**
   *
   * Copyright 2004 The Apache Software Foundation
   *
   *  Licensed 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;
  
  import java.io.Serializable;
  import java.net.URI;
  import javax.management.ObjectName;
  
  import org.apache.geronimo.kernel.management.State;
  
  /**
   * 
   * 
   * @version $Revision: 1.1 $ $Date: 2004/06/02 19:50:41 $
   */
  public class ConfigurationInfo implements Serializable {
      private final ObjectName storeName;
      private final URI configID;
      private final State state;
  
      public ConfigurationInfo(ObjectName storeName, URI configID, State state) {
          this.storeName = storeName;
          this.configID = configID;
          this.state = state;
      }
  
      public ObjectName getStoreName() {
          return storeName;
      }
  
      public URI getConfigID() {
          return configID;
      }
  
      public State getState() {
          return state;
      }
  }
  
  
  
  1.1                  incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/config/NoSuchStoreException.java
  
  Index: NoSuchStoreException.java
  ===================================================================
  /**
   *
   * Copyright 2003-2004 The Apache Software Foundation
   *
   *  Licensed 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;
  
  /**
   * Exception indicating the requested ConfigurationStore could not be located.
   * 
   * @version $Revision: 1.1 $ $Date: 2004/06/02 19:50:41 $
   */
  public class NoSuchStoreException extends Exception {
      public NoSuchStoreException() {
      }
  
      public NoSuchStoreException(Throwable cause) {
          super(cause);
      }
  
      public NoSuchStoreException(String message) {
          super(message);
      }
  
      public NoSuchStoreException(String message, Throwable cause) {
          super(message, cause);
      }
  }
  
  
  
  1.5       +24 -6     incubator-geronimo/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java
  
  Index: LocalConfigStore.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LocalConfigStore.java	2 Jun 2004 05:33:05 -0000	1.4
  +++ LocalConfigStore.java	2 Jun 2004 19:50:41 -0000	1.5
  @@ -32,9 +32,13 @@
   import java.net.URL;
   import java.util.Iterator;
   import java.util.Properties;
  +import java.util.List;
  +import java.util.ArrayList;
   import java.util.zip.ZipEntry;
   import java.util.zip.ZipInputStream;
   
  +import javax.management.ObjectName;
  +
   import org.apache.geronimo.gbean.GBean;
   import org.apache.geronimo.gbean.GBeanContext;
   import org.apache.geronimo.gbean.GBeanInfo;
  @@ -60,6 +64,7 @@
       private File rootDir;
       private final Properties index = new Properties();
       private int maxId;
  +    private GBeanContext context;
   
       /**
        * Constructor is only used for direct testing with out a kernel.
  @@ -77,6 +82,11 @@
       }
   
       public void setGBeanContext(GBeanContext context) {
  +        this.context = context;
  +    }
  +
  +    public ObjectName getObjectName() {
  +        return context.getObjectName();
       }
   
       public void doStart() throws WaitingException, FileNotFoundException, IOException {
  @@ -157,6 +167,18 @@
           return loadConfig(getRoot(configID));
       }
   
  +    public List listConfiguations() {
  +        List configs;
  +        synchronized (this) {
  +            configs = new ArrayList(index.size());
  +            for (Iterator i = index.keySet().iterator(); i.hasNext();) {
  +                String id = (String) i.next();
  +                configs.add(URI.create(id));
  +            }
  +        }
  +        return configs;
  +    }
  +
       public URL getBaseURL(URI configID) throws NoSuchConfigException {
           File root = getRoot(configID);
           try {
  @@ -253,13 +275,9 @@
           GBeanInfoFactory infoFactory = new GBeanInfoFactory(LocalConfigStore.class);
   
           infoFactory.addAttribute("root", URI.class, true);
  +        infoFactory.addInterface(ConfigurationStore.class);
   
           infoFactory.addReference("ServerInfo", ServerInfo.class);
  -
  -        infoFactory.addOperation("install", new Class[]{URL.class});
  -        infoFactory.addOperation("containsConfiguration", new Class[]{URI.class});
  -        infoFactory.addOperation("getConfiguration", new Class[]{URI.class});
  -        infoFactory.addOperation("getBaseURL", new Class[]{URI.class});
   
           infoFactory.setConstructor(new String[]{"root", "ServerInfo"});
   
  
  
  

Mime
View raw message