org.apache.geronimo.system.configuration
Class RepositoryConfigurationStore

java.lang.Object
  extended by org.apache.geronimo.system.configuration.RepositoryConfigurationStore
All Implemented Interfaces:
ConfigurationStore
Direct Known Subclasses:
MavenConfigStore

public class RepositoryConfigurationStore
extends Object
implements ConfigurationStore

Implementation of ConfigurationStore GBean that installs/loads Configurations from a repository.


Field Summary
static GBeanInfo GBEAN_INFO
           
protected  WritableListableRepository repository
           
 
Constructor Summary
RepositoryConfigurationStore(Kernel kernel, String objectName, AbstractName abstractName, WritableListableRepository repository)
           
RepositoryConfigurationStore(WritableListableRepository repository)
           
 
Method Summary
 boolean containsConfiguration(Artifact configId)
          Determines if the store contains a configuration with the specified ID.
 File createNewConfigurationDir(Artifact configId)
          Creates an empty directory for a new configuration with the specified configId
 void exportConfiguration(Artifact configId, OutputStream output)
          Exports a configuration as a ZIP file.
 AbstractName getAbstractName()
          Return the object name for the store.
static GBeanInfo getGBeanInfo()
           
 String getObjectName()
          Return the object name for the store.
 void install(ConfigurationData configurationData)
          Move the unpacked configuration directory into this store
 boolean isInPlaceConfiguration(Artifact configId)
          Determines if the identified configuration is an in-place one.
 List<ConfigurationInfo> listConfigurations()
          Return the configurations in the store
 ConfigurationData loadConfiguration(Artifact configId)
          Loads the specified configuration into the kernel
 Set<URL> resolve(Artifact configId, String moduleName, String path)
          Locate the physical locations which match the supplied path in the given artifact/module.
 void uninstall(Artifact configId)
          Removes a configuration from the store
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

repository

protected final WritableListableRepository repository

GBEAN_INFO

public static final GBeanInfo GBEAN_INFO
Constructor Detail

RepositoryConfigurationStore

public RepositoryConfigurationStore(WritableListableRepository repository)

RepositoryConfigurationStore

public RepositoryConfigurationStore(Kernel kernel,
                                    String objectName,
                                    AbstractName abstractName,
                                    WritableListableRepository repository)
Method Detail

getObjectName

public String getObjectName()
Description copied from interface: ConfigurationStore
Return the object name for the store.

Specified by:
getObjectName in interface ConfigurationStore
Returns:
the object name for the store

getAbstractName

public AbstractName getAbstractName()
Description copied from interface: ConfigurationStore
Return the object name for the store.

Specified by:
getAbstractName in interface ConfigurationStore
Returns:
the object name for the store

loadConfiguration

public ConfigurationData loadConfiguration(Artifact configId)
                                    throws NoSuchConfigException,
                                           IOException,
                                           InvalidConfigException
Description copied from interface: ConfigurationStore
Loads the specified configuration into the kernel

Specified by:
loadConfiguration in interface ConfigurationStore
Parameters:
configId - the id of the configuration to load, which must be fully resolved (isResolved() == true)
Returns:
the the configuration object
Throws:
NoSuchConfigException - if the configuration is not contained in the kernel
IOException - if a problem occurs loading the configuration from the store
InvalidConfigException - if the configuration is corrupt

containsConfiguration

public boolean containsConfiguration(Artifact configId)
Description copied from interface: ConfigurationStore
Determines if the store contains a configuration with the specified ID. The configuration need not be loaded or running, this just checks whether the configuration store has the data for it.

Specified by:
containsConfiguration in interface ConfigurationStore
Parameters:
configId - the unique ID of the configuration, which must be fully resolved (isResolved() == true)
Returns:
true if the store contains the configuration

createNewConfigurationDir

public File createNewConfigurationDir(Artifact configId)
                               throws ConfigurationAlreadyExistsException
Description copied from interface: ConfigurationStore
Creates an empty directory for a new configuration with the specified configId

Specified by:
createNewConfigurationDir in interface ConfigurationStore
Parameters:
configId - the unique ID of the configuration, which must be fully resolved (isResolved() == true)
Returns:
the location of the new directory
Throws:
ConfigurationAlreadyExistsException - if the configuration already exists in this store

resolve

public Set<URL> resolve(Artifact configId,
                        String moduleName,
                        String path)
                 throws NoSuchConfigException,
                        MalformedURLException
Description copied from interface: ConfigurationStore
Locate the physical locations which match the supplied path in the given artifact/module. The path may be an Ant-style pattern.

Specified by:
resolve in interface ConfigurationStore
Parameters:
configId - the artifact to search, which must be fully resolved (isResolved() == true)
moduleName - the module name or null to search in the top-level artifact location
path - the pattern to search for within the artifact/module, which may also be null to identify the artifact or module base path
Returns:
a Set (with entries of type URL) of the matching locations
Throws:
NoSuchConfigException
MalformedURLException

exportConfiguration

public void exportConfiguration(Artifact configId,
                                OutputStream output)
                         throws IOException,
                                NoSuchConfigException
Description copied from interface: ConfigurationStore
Exports a configuration as a ZIP file.

Specified by:
exportConfiguration in interface ConfigurationStore
Parameters:
configId - The unique ID of the configuration to export, which must be fully resolved (isResolved() == true)
output - The stream to write the ZIP content to
Throws:
IOException
NoSuchConfigException

isInPlaceConfiguration

public boolean isInPlaceConfiguration(Artifact configId)
                               throws NoSuchConfigException,
                                      IOException
Description copied from interface: ConfigurationStore
Determines if the identified configuration is an in-place one. This means that the configuration store only stores some meta-data and the actual content of the configuration is rooted somewhere else.

Specified by:
isInPlaceConfiguration in interface ConfigurationStore
Parameters:
configId - the unique ID of the configuration, which must be fully resolved (isResolved() == true)
Returns:
true if the identified configuration is an in-place one.
Throws:
NoSuchConfigException - if the configuration is not contained in the store
IOException - If the store cannot be read.

install

public void install(ConfigurationData configurationData)
             throws IOException,
                    InvalidConfigException
Description copied from interface: ConfigurationStore
Move the unpacked configuration directory into this store

Specified by:
install in interface ConfigurationStore
Parameters:
configurationData - the configuration data
Throws:
IOException - if the direcotyr could not be moved into the store
InvalidConfigException - if there is a configuration problem within the source direcotry

uninstall

public void uninstall(Artifact configId)
               throws NoSuchConfigException,
                      IOException
Description copied from interface: ConfigurationStore
Removes a configuration from the store

Specified by:
uninstall in interface ConfigurationStore
Parameters:
configId - the id of the configuration to remove, which must be fully resolved (isResolved() == true)
Throws:
NoSuchConfigException - if the configuration is not contained in the store
IOException - if a problem occurs during the removal

listConfigurations

public List<ConfigurationInfo> listConfigurations()
Description copied from interface: ConfigurationStore
Return the configurations in the store

Specified by:
listConfigurations in interface ConfigurationStore
Returns:
a List (with entries of type ConfigurationInfo) of all the configurations contained in this configuration store

getGBeanInfo

public static GBeanInfo getGBeanInfo()


Copyright © 2003-2008 The Apache Geronimo development community. All Rights Reserved.