org.apache.geronimo.kernel.config
Class Configuration

java.lang.Object
  extended byorg.apache.geronimo.kernel.config.Configuration
All Implemented Interfaces:
ConfigurationParent, org.apache.geronimo.gbean.GBeanLifecycle

public class Configuration
extends Object
implements org.apache.geronimo.gbean.GBeanLifecycle, ConfigurationParent

A Configuration represents a collection of runnable services that can be loaded into a Geronimo Kernel and brought online. The primary components in a Configuration are a codebase, represented by a collection of URLs that is used to locate classes, and a collection of GBean instances that define its state.

The persistent attributes of the Configuration are:

When a configuration is started, it converts the URIs into a set of absolute URLs by resolving them against the specified baseURL (this would typically be the root of the CAR file which contains the configuration) and then constructs a ClassLoader for that codebase. That ClassLoader is then used to de-serialize the persisted GBeans, ensuring the GBeans can be recycled as necessary. Once the GBeans have been restored, they are brought online by registering them with the MBeanServer.

A dependency on the Configuration is created for every GBean it loads. As a result, a startRecursive() operation on the configuration will result in a startRecursive() for all the GBeans it contains. Similarly, if the Configuration is stopped then all of its GBeans will be stopped as well.

Version:
$Rev:385718 $ $Date: 2006-05-08 02:18:35 +0200 (Mon, 08 May 2006) $

Field Summary
static org.apache.geronimo.gbean.GBeanInfo GBEAN_INFO
           
 
Constructor Summary
Configuration()
          Only used to allow declaration as a reference.
Configuration(Collection parents, ConfigurationData configurationData, ConfigurationResolver configurationResolver, ManageableAttributeStore attributeStore)
          Creates a configuration.
 
Method Summary
 void addGBean(org.apache.geronimo.gbean.GBeanData gbean)
           
 org.apache.geronimo.gbean.AbstractName addGBean(String name, org.apache.geronimo.gbean.GBeanData gbean)
           
 void addToClassPath(String pattern)
           
 boolean containsGBean(org.apache.geronimo.gbean.AbstractName gbean)
          Determines of this configuration constains the specified GBean.
 void doFail()
           
 void doStart()
           
 void doStop()
           
 org.apache.geronimo.gbean.AbstractName findGBean(org.apache.geronimo.gbean.AbstractNameQuery pattern)
           
 org.apache.geronimo.gbean.AbstractName findGBean(org.apache.geronimo.gbean.ReferencePatterns referencePatterns)
           
 org.apache.geronimo.gbean.AbstractName findGBean(Set patterns)
           
 org.apache.geronimo.gbean.GBeanData findGBeanData(org.apache.geronimo.gbean.AbstractNameQuery pattern)
           
 org.apache.geronimo.gbean.GBeanData findGBeanData(Set patterns)
           
 LinkedHashSet findGBeanDatas(Set patterns)
           
 LinkedHashSet findGBeans(org.apache.geronimo.gbean.AbstractNameQuery pattern)
           
 LinkedHashSet findGBeans(org.apache.geronimo.gbean.ReferencePatterns referencePatterns)
           
 LinkedHashSet findGBeans(Set patterns)
           
 org.apache.geronimo.gbean.AbstractName getAbstractName()
           
 List getChildren()
          Gets the nested configurations of this configuration.
 List getClassParents()
          Gets the parent configurations used for class loading.
 List getClassPath()
          Gets the relative class path (URIs) of this configuration.
static org.apache.geronimo.gbean.AbstractName getConfigurationAbstractName(Artifact configId)
          Converts an Artifact to an AbstractName for a configuration.
 ClassLoader getConfigurationClassLoader()
          Gets the class loader for this configuration.
static Artifact getConfigurationID(javax.management.ObjectName objectName)
           
 ConfigurationResolver getConfigurationResolver()
          Deprecated. this is only exposed temporarily for configuration manager
 long getCreated()
          Gets the time at which this configuration was created (or deployed).
 LinkedHashSet getDependencies()
          Gets the artifact dependencies of this configuration.
 Configuration getEnclosingConfiguration()
          Gets the enclosing configuration of this one (e.g.
 Environment getEnvironment()
          Gets the declaration of the environment in which this configuration runs.
static org.apache.geronimo.gbean.GBeanInfo getGBeanInfo()
           
 Map getGBeans()
          Gets an unmodifiable collection of the GBeanDatas for the GBeans in this configuration.
 Artifact getId()
          Return the unique Id
 ConfigurationModuleType getModuleType()
          Gets the type of the configuration (WAR, RAR et cetera)
 String getObjectName()
          Gets the unique name of this configuration within the kernel.
 Set getOwnedConfigurations()
          Gets the configurations owned by this configuration.
 List getServiceParents()
          Gets the parent configurations used for service resolution.
static boolean isConfigurationObjectName(javax.management.ObjectName name)
           
 void removeGBean(org.apache.geronimo.gbean.AbstractName name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GBEAN_INFO

public static final org.apache.geronimo.gbean.GBeanInfo GBEAN_INFO
Constructor Detail

Configuration

public Configuration()
Only used to allow declaration as a reference.


Configuration

public Configuration(Collection parents,
                     ConfigurationData configurationData,
                     ConfigurationResolver configurationResolver,
                     ManageableAttributeStore attributeStore)
              throws MissingDependencyException,
                     MalformedURLException,
                     NoSuchConfigException,
                     InvalidConfigException
Creates a configuration.

Parameters:
parents - parents of this configuation (not ordered)
configurationData - the module type, environment and classpath of the configuration
configurationResolver - used to resolve dependecies and paths
Method Detail

getConfigurationAbstractName

public static org.apache.geronimo.gbean.AbstractName getConfigurationAbstractName(Artifact configId)
                                                                           throws InvalidConfigException
Converts an Artifact to an AbstractName for a configuration. Does not validate that this is a reasonable or resolved Artifact, or that it corresponds to an actual Configuration.

Throws:
InvalidConfigException

isConfigurationObjectName

public static boolean isConfigurationObjectName(javax.management.ObjectName name)

getConfigurationID

public static Artifact getConfigurationID(javax.management.ObjectName objectName)

getId

public Artifact getId()
Return the unique Id

Returns:
the unique Id

getObjectName

public String getObjectName()
Gets the unique name of this configuration within the kernel.

Returns:
the unique name of this configuration

getAbstractName

public org.apache.geronimo.gbean.AbstractName getAbstractName()

getClassParents

public List getClassParents()
Gets the parent configurations used for class loading.

Returns:
the parents of this configuration used for class loading

getServiceParents

public List getServiceParents()
Gets the parent configurations used for service resolution.

Returns:
the parents of this configuration used for service resolution

getDependencies

public LinkedHashSet getDependencies()
Gets the artifact dependencies of this configuration.

Returns:
the artifact dependencies of this configuration

getEnvironment

public Environment getEnvironment()
Gets the declaration of the environment in which this configuration runs.

Returns:
the environment of this configuration

getConfigurationResolver

public ConfigurationResolver getConfigurationResolver()
Deprecated. this is only exposed temporarily for configuration manager


getClassPath

public List getClassPath()
Gets the relative class path (URIs) of this configuration.

Returns:
the relative class path of this configuation

addToClassPath

public void addToClassPath(String pattern)
                    throws IOException
Throws:
IOException

getModuleType

public ConfigurationModuleType getModuleType()
Gets the type of the configuration (WAR, RAR et cetera)

Returns:
Type of the configuration.

getCreated

public long getCreated()
Gets the time at which this configuration was created (or deployed).

Returns:
the time at which this configuration was created (or deployed)

getConfigurationClassLoader

public ClassLoader getConfigurationClassLoader()
Gets the class loader for this configuration.

Specified by:
getConfigurationClassLoader in interface ConfigurationParent
Returns:
the class loader for this configuration

getChildren

public List getChildren()
Gets the nested configurations of this configuration. That is, the configurations within this one as a WAR can be within an EAR; not including wholly separate configurations that just depend on this one as a parent.

Returns:
the nested configuration of this configuration

getOwnedConfigurations

public Set getOwnedConfigurations()
Gets the configurations owned by this configuration. This is only used for cascade-uninstall.

Returns:
the configurations owned by this configuration

getGBeans

public Map getGBeans()
Gets an unmodifiable collection of the GBeanDatas for the GBeans in this configuration.

Returns:
the GBeans in this configuration

containsGBean

public boolean containsGBean(org.apache.geronimo.gbean.AbstractName gbean)
Determines of this configuration constains the specified GBean.

Parameters:
gbean - the name of the GBean
Returns:
true if this configuration contains the specified GBean; false otherwise

getEnclosingConfiguration

public Configuration getEnclosingConfiguration()
Gets the enclosing configuration of this one (e.g. the EAR for a WAR), or null if it has none.


addGBean

public org.apache.geronimo.gbean.AbstractName addGBean(String name,
                                                       org.apache.geronimo.gbean.GBeanData gbean)
                                                throws GBeanAlreadyExistsException
Throws:
GBeanAlreadyExistsException

addGBean

public void addGBean(org.apache.geronimo.gbean.GBeanData gbean)
              throws GBeanAlreadyExistsException
Throws:
GBeanAlreadyExistsException

removeGBean

public void removeGBean(org.apache.geronimo.gbean.AbstractName name)
                 throws GBeanNotFoundException
Throws:
GBeanNotFoundException

findGBean

public org.apache.geronimo.gbean.AbstractName findGBean(org.apache.geronimo.gbean.AbstractNameQuery pattern)
                                                 throws GBeanNotFoundException
Throws:
GBeanNotFoundException

findGBeanData

public org.apache.geronimo.gbean.GBeanData findGBeanData(org.apache.geronimo.gbean.AbstractNameQuery pattern)
                                                  throws GBeanNotFoundException
Throws:
GBeanNotFoundException

findGBean

public org.apache.geronimo.gbean.AbstractName findGBean(org.apache.geronimo.gbean.ReferencePatterns referencePatterns)
                                                 throws GBeanNotFoundException
Throws:
GBeanNotFoundException

findGBean

public org.apache.geronimo.gbean.AbstractName findGBean(Set patterns)
                                                 throws GBeanNotFoundException
Throws:
GBeanNotFoundException

findGBeanData

public org.apache.geronimo.gbean.GBeanData findGBeanData(Set patterns)
                                                  throws GBeanNotFoundException
Throws:
GBeanNotFoundException

findGBeans

public LinkedHashSet findGBeans(org.apache.geronimo.gbean.AbstractNameQuery pattern)

findGBeans

public LinkedHashSet findGBeans(org.apache.geronimo.gbean.ReferencePatterns referencePatterns)

findGBeans

public LinkedHashSet findGBeans(Set patterns)

findGBeanDatas

public LinkedHashSet findGBeanDatas(Set patterns)

doStart

public void doStart()
             throws Exception
Specified by:
doStart in interface org.apache.geronimo.gbean.GBeanLifecycle
Throws:
Exception

doStop

public void doStop()
            throws Exception
Specified by:
doStop in interface org.apache.geronimo.gbean.GBeanLifecycle
Throws:
Exception

doFail

public void doFail()
Specified by:
doFail in interface org.apache.geronimo.gbean.GBeanLifecycle

getGBeanInfo

public static org.apache.geronimo.gbean.GBeanInfo getGBeanInfo()


Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.