com.arjuna.common.util.propertyservice
Interface PropertyManager

All Known Subinterfaces:
PropertyManagerPluginInterface

public interface PropertyManager


Method Summary
 void addManagementPlugin(PropertyManagementPlugin plugin)
          This adds a management plugin to this property manager.
 java.util.Properties getProperties()
          Get all the properties stored in this property manager
 java.lang.String getProperty(java.lang.String name)
          Get the value of the property with the name name
 java.lang.String getProperty(java.lang.String name, java.lang.String defaultValue)
          Get the value of the property with the name name.
 void load(java.lang.String pluginClassname, java.lang.String uri)
          Loads properties from a given URI using the given property manager plugin.
 java.util.Enumeration propertyNames()
          Returns an enumeration of the property names
 java.lang.String removeProperty(java.lang.String name)
          Removes the property from the property manager.
 void save(java.lang.String pluginClassname, java.lang.String uri)
          Saves the properties stored in this property manager using the given property manager plugin.
 java.lang.String setProperty(java.lang.String name, java.lang.String value)
          Set the value of the property name to value
 java.lang.String setProperty(java.lang.String name, java.lang.String value, boolean setSystemProperty)
          Set the value of the property name to value.
 boolean verbose()
          Returns true if the property manager is in verbose mode
 

Method Detail

getProperty

java.lang.String getProperty(java.lang.String name)
Get the value of the property with the name name

Parameters:
name - The name of the property to retrieve the value of.
Returns:
The value of the property.

getProperty

java.lang.String getProperty(java.lang.String name,
                             java.lang.String defaultValue)
Get the value of the property with the name name. If the property cannot be found return the value defaultValue.

Parameters:
name - The name of the property to retrieve the value of.
defaultValue - The default value to return if the property cannot be found.
Returns:
The value of the property (or defaultValue).

setProperty

java.lang.String setProperty(java.lang.String name,
                             java.lang.String value,
                             boolean setSystemProperty)
Set the value of the property name to value.

Parameters:
name - The name of the property to set.
value - The value of the property being set.
setSystemProperty - True - set the system property if it has a value
Returns:
The previous value of the property.

setProperty

java.lang.String setProperty(java.lang.String name,
                             java.lang.String value)
Set the value of the property name to value

Parameters:
name - The name of the property to set.
value - The value of the property to set.
Returns:
The previous value of the property.

removeProperty

java.lang.String removeProperty(java.lang.String name)
Removes the property from the property manager.

Parameters:
name - The name of the property to remove.
Returns:
The previous value of the property.

getProperties

java.util.Properties getProperties()
Get all the properties stored in this property manager

Returns:
the Properties

propertyNames

java.util.Enumeration propertyNames()
Returns an enumeration of the property names

Returns:
the Enumeration

load

void load(java.lang.String pluginClassname,
          java.lang.String uri)
          throws java.io.IOException,
                 java.lang.ClassNotFoundException,
                 LoadPropertiesException
Loads properties from a given URI using the given property manager plugin. This plugin can be overridden by setting the system property 'propertyservice.plugin'.

Parameters:
pluginClassname - The classname of the plugin to use. This plugin is loaded using the current thread context classloader.
uri - The URI to load.
Throws:
java.io.IOException
java.lang.ClassNotFoundException
LoadPropertiesException

save

void save(java.lang.String pluginClassname,
          java.lang.String uri)
          throws java.io.IOException,
                 java.lang.ClassNotFoundException,
                 SavePropertiesException
Saves the properties stored in this property manager using the given property manager plugin. This plugin can be overridden by setting the system property 'propertyservice.plugin'

Parameters:
pluginClassname - The classname of the plugin to use. This plugin is loaded using the current thread context classloader. If null is provided the plugin used to load the properties is also used to save them.
uri - The URI to save to. If null is provided the uri used to load the properties is also used to save them.
Throws:
java.io.IOException
java.lang.ClassNotFoundException
SavePropertiesException

addManagementPlugin

void addManagementPlugin(PropertyManagementPlugin plugin)
                         throws java.io.IOException,
                                ManagementPluginException
This adds a management plugin to this property manager.

Parameters:
plugin - The PropertyManagementPlugin to plug-in.
Throws:
java.io.IOException
ManagementPluginException

verbose

boolean verbose()
Returns true if the property manager is in verbose mode

Returns:
true if verbose, false otherwise