public interface

Registry

org.apache.archiva.redback.components.registry.Registry
Known Indirect Subclasses

Class Overview

The Plexus registry is a single source of external configuration for Plexus components and applications. It can be used by components to source configuration, knowing that it can be used from within applications without the information being hard coded into the component.

Summary

Public Methods
abstract void addChangeListener(RegistryListener listener)
Add a change listener.
abstract void addConfigurationFromFile(File file)
Load configuration from the given file.
abstract void addConfigurationFromFile(File file, String prefix)
Load configuration from the given file.
abstract void addConfigurationFromResource(String resource)
Load configuration from the given classloader resource.
abstract void addConfigurationFromResource(String resource, String prefix)
Load configuration from the given classloader resource.
abstract String dump()
Dump the entire registry to a string, for debugging purposes.
abstract boolean getBoolean(String key, boolean defaultValue)
Get a boolean value from the registry.
abstract boolean getBoolean(String key)
Get a boolean value from the registry.
abstract Collection<String> getFullKeys()
Get all the keys in this registry.
abstract int getInt(String key)
Get an integer value from the registry.
abstract int getInt(String key, int defaultValue)
Get an integer value from the registry.
abstract Collection<String> getKeys()
Get all the keys in this registry.
abstract List getList(String key)
Get a list of strings at the given key in the registry.
abstract Properties getProperties(String key)
TODO move to Map which is more generic ? Get the properties at the given key in the registry.
abstract Registry getSection(String name)
Get a subsection of the registry, identified by the given name.
abstract String getString(String key, String defaultValue)
Get a string value from the registry.
abstract String getString(String key)
Get a string value from the registry.
abstract Registry getSubset(String key)
Get a subset of the registry, for all keys descended from the given key.
abstract List getSubsetList(String key)
Get a list of subsets of the registry, for all keys descended from the given key.
abstract void initialize()
abstract boolean isEmpty()
Determine if the registry contains any elements.
abstract void remove(String key)
Remove a keyed element from the registry.
abstract void removeSubset(String key)
Remove a keyed subset of the registry.
abstract void save()
Save any changes to the registry since it was loaded.
abstract void setBoolean(String key, boolean value)
Set a boolean value in the registry.
abstract void setInt(String key, int value)
Set an integer value in the registry.
abstract void setString(String key, String value)
Set a string value in the registry.

Public Methods

public abstract void addChangeListener (RegistryListener listener)

Add a change listener. Note that settings this on the base registry will only detect 'invalidation' events, not individual changes. You should retrieve the named sub-registry to listen for changes.

Parameters
listener the listener

public abstract void addConfigurationFromFile (File file)

Load configuration from the given file.

Parameters
file the location to load the configuration from
Throws
RegistryException if a problem occurred reading the resource to add to the registry

public abstract void addConfigurationFromFile (File file, String prefix)

Load configuration from the given file.

Parameters
file the location to load the configuration from
prefix the location to add the configuration at in the registry
Throws
RegistryException if a problem occurred reading the resource to add to the registry

public abstract void addConfigurationFromResource (String resource)

Load configuration from the given classloader resource.

Parameters
resource the location to load the configuration from
Throws
RegistryException if a problem occurred reading the resource to add to the registry

public abstract void addConfigurationFromResource (String resource, String prefix)

Load configuration from the given classloader resource.

Parameters
resource the location to load the configuration from
prefix the location to add the configuration at in the registry
Throws
RegistryException if a problem occurred reading the resource to add to the registry

public abstract String dump ()

Dump the entire registry to a string, for debugging purposes.

Returns
  • the registry contents

public abstract boolean getBoolean (String key, boolean defaultValue)

Get a boolean value from the registry. If not found, the default value is used.

Parameters
key the key in the registry
defaultValue the default value
Returns
  • the value

public abstract boolean getBoolean (String key)

Get a boolean value from the registry. If not found, an exception is thrown.

Parameters
key the key in the registry
Returns
  • the value
Throws
NoSuchElementException if the key is not found

public abstract Collection<String> getFullKeys ()

Get all the keys in this registry.

Returns
  • the set of keys

public abstract int getInt (String key)

Get an integer value from the registry. If not found, an exception is thrown.

Parameters
key the key in the registry
Returns
  • the value
Throws
NoSuchElementException if the key is not found

public abstract int getInt (String key, int defaultValue)

Get an integer value from the registry. If not found, the default value is used.

Parameters
key the key in the registry
defaultValue the default value
Returns
  • the value

public abstract Collection<String> getKeys ()

Get all the keys in this registry. Keys are only retrieved at a depth of 1.

Returns
  • the set of keys

public abstract List getList (String key)

Get a list of strings at the given key in the registry.

Parameters
key the key to lookup
Returns
  • the list of strings

public abstract Properties getProperties (String key)

TODO move to Map which is more generic ? Get the properties at the given key in the registry.

Parameters
key the key to lookup
Returns
  • the properties

public abstract Registry getSection (String name)

Get a subsection of the registry, identified by the given name. If it doesn't exist, null will be returned.

Parameters
name registry section name
Returns
  • the registry

public abstract String getString (String key, String defaultValue)

Get a string value from the registry. If not found, the default value is used.

Parameters
key the key in the registry
defaultValue the default value
Returns
  • the value

public abstract String getString (String key)

Get a string value from the registry. If not found, null is returned.

Parameters
key the key in the registry
Returns
  • the value

public abstract Registry getSubset (String key)

Get a subset of the registry, for all keys descended from the given key.

Parameters
key the key to take the subset from
Returns
  • the registry subset

public abstract List getSubsetList (String key)

Get a list of subsets of the registry, for all keys descended from the given key.

Parameters
key the key to take the subsets from
Returns
  • the registry subsets

public abstract void initialize ()

public abstract boolean isEmpty ()

Determine if the registry contains any elements.

Returns
  • whether the registry contains any elements

public abstract void remove (String key)

Remove a keyed element from the registry.

Parameters
key the key to remove

public abstract void removeSubset (String key)

Remove a keyed subset of the registry.

Parameters
key the subset to remove

public abstract void save ()

Save any changes to the registry since it was loaded.

Throws
RegistryException if there was a problem saving the registry
UnsupportedOperationException if the registry is not writable

public abstract void setBoolean (String key, boolean value)

Set a boolean value in the registry.

Parameters
key the key in the registry
value the value to set

public abstract void setInt (String key, int value)

Set an integer value in the registry.

Parameters
key the key in the registry
value the value to set

public abstract void setString (String key, String value)

Set a string value in the registry.

Parameters
key the key in the registry
value the value to set