This project has retired. For details please refer to its Attic page.
DefaultArchivaConfiguration

org.apache.maven.archiva.configuration
Class DefaultArchivaConfiguration

Package class diagram package DefaultArchivaConfiguration
java.lang.Object
  extended by org.apache.maven.archiva.configuration.DefaultArchivaConfiguration
All Implemented Interfaces:
ArchivaConfiguration, org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable, org.codehaus.plexus.registry.RegistryListener

public class DefaultArchivaConfiguration
extends java.lang.Object
implements ArchivaConfiguration, org.codehaus.plexus.registry.RegistryListener, org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable

Implementation of configuration holder that retrieves it from the registry.

The registry layers and merges the 2 configuration files: user, and application server.

Instead of relying on the model defaults, if the registry is empty a default configuration file is loaded and applied from a resource. The defaults are not loaded into the registry as the lists (eg repositories) could no longer be removed if that was the case.

When saving the configuration, it is saved to the location it was read from. If it was read from the defaults, it will be saved to the user location. However, if the configuration contains information from both sources, an exception is raised as this is currently unsupported. The reason for this is that it is not possible to identify where to re-save elements, and can result in list configurations (eg repositories) becoming inconsistent.

If the configuration is outdated, it will be upgraded when it is loaded. This is done by checking the version flag before reading it from the registry.


Field Summary
 
Fields inherited from interface org.apache.maven.archiva.configuration.ArchivaConfiguration
ROLE
 
Constructor Summary
DefaultArchivaConfiguration()
           
 
Method Summary
 void addChangeListener(org.codehaus.plexus.registry.RegistryListener listener)
          Add a registry listener to notify of events in plexus-registry.
 void addListener(ConfigurationListener listener)
          Add a configuration listener to notify of changes to the configuration.
 void afterConfigurationChange(org.codehaus.plexus.registry.Registry registry, java.lang.String propertyName, java.lang.Object propertyValue)
           
 void beforeConfigurationChange(org.codehaus.plexus.registry.Registry registry, java.lang.String propertyName, java.lang.Object propertyValue)
           
 java.lang.String getAltConfigFilename()
           
 org.apache.maven.archiva.configuration.Configuration getConfiguration()
          Get the configuration.
 java.lang.String getUserConfigFilename()
           
 void initialize()
           
 boolean isDefaulted()
          Determines if the configuration in use was as a result of a defaulted configuration.
 void removeListener(ConfigurationListener listener)
          Remove a configuration listener to stop notifications of changes to the configuration.
 void save(org.apache.maven.archiva.configuration.Configuration configuration)
          Save any updated configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultArchivaConfiguration

public DefaultArchivaConfiguration()
Method Detail

getConfiguration

public org.apache.maven.archiva.configuration.Configuration getConfiguration()
Description copied from interface: ArchivaConfiguration
Get the configuration.

Specified by:
getConfiguration in interface ArchivaConfiguration
Returns:
the configuration

save

public void save(org.apache.maven.archiva.configuration.Configuration configuration)
          throws org.codehaus.plexus.registry.RegistryException,
                 IndeterminateConfigurationException
Description copied from interface: ArchivaConfiguration
Save any updated configuration.

Specified by:
save in interface ArchivaConfiguration
Parameters:
configuration - the configuration to save
Throws:
org.codehaus.plexus.registry.RegistryException - if there is a problem saving the registry data
IndeterminateConfigurationException - if the configuration cannot be saved because it was read from two sources

addListener

public void addListener(ConfigurationListener listener)
Description copied from interface: ArchivaConfiguration
Add a configuration listener to notify of changes to the configuration.

Specified by:
addListener in interface ArchivaConfiguration
Parameters:
listener - the listener

removeListener

public void removeListener(ConfigurationListener listener)
Description copied from interface: ArchivaConfiguration
Remove a configuration listener to stop notifications of changes to the configuration.

Specified by:
removeListener in interface ArchivaConfiguration
Parameters:
listener - the listener

addChangeListener

public void addChangeListener(org.codehaus.plexus.registry.RegistryListener listener)
Description copied from interface: ArchivaConfiguration
Add a registry listener to notify of events in plexus-registry.

Specified by:
addChangeListener in interface ArchivaConfiguration
Parameters:
listener - the listener TODO: Remove in future.

initialize

public void initialize()
                throws org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException
Specified by:
initialize in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable
Throws:
org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException

beforeConfigurationChange

public void beforeConfigurationChange(org.codehaus.plexus.registry.Registry registry,
                                      java.lang.String propertyName,
                                      java.lang.Object propertyValue)
Specified by:
beforeConfigurationChange in interface org.codehaus.plexus.registry.RegistryListener

afterConfigurationChange

public void afterConfigurationChange(org.codehaus.plexus.registry.Registry registry,
                                     java.lang.String propertyName,
                                     java.lang.Object propertyValue)
Specified by:
afterConfigurationChange in interface org.codehaus.plexus.registry.RegistryListener

getUserConfigFilename

public java.lang.String getUserConfigFilename()

getAltConfigFilename

public java.lang.String getAltConfigFilename()

isDefaulted

public boolean isDefaulted()
Description copied from interface: ArchivaConfiguration
Determines if the configuration in use was as a result of a defaulted configuration.

Specified by:
isDefaulted in interface ArchivaConfiguration
Returns:
true if the configuration was created from the default-archiva.xml as opposed to being loaded from the usual locations of ${user.home}/.m2/archiva.xml or ${appserver.base}/conf/archiva.xml