org.alfresco.config
Interface ConfigService

All Known Implementing Classes:
ZkConfigService

public interface ConfigService

Interface for classes that are able to provide configuration specifically for the benchmark server.

Since:
1.0
Author:
Derek Hulley

Field Summary
static String SEPARATOR
           
 
Method Summary
 void delete(String... path)
          Recursive delete of a path without any option to recover.
 boolean exists(String... path)
          Check if a given path exists
 Set<String> getChildren(ConfigChildListener listener, String... path)
          Retrieve the children of a given path
 ClassLoader getClassLoader(ConfigClassesListener listener, ClassLoader parent, String... path)
          Retrieve a ClassLoader rooted at the given location
 ClassLoader getJarLoader(ConfigClassesListener listener, ClassLoader parent, String... path)
          Retrieve a URLClassLoader rooted at the given location.
 Properties getProperties(ConfigDataListener listener, String... path)
          Retrieve the properties from a given path
 String getString(ConfigDataListener listener, String... path)
          Retrieve string data from a given path
 String setData(ConfigDataListener listener, boolean ephemeral, boolean sequential, byte[] bytes, String... path)
          Set binary data
 String setProperties(ConfigDataListener listener, boolean ephemeral, boolean sequential, Properties properties, String... path)
          Set properties against a path
 String setString(ConfigDataListener listener, boolean ephemeral, boolean sequential, String value, String... path)
          Retrieve string data from a given path
 boolean updateData(byte[] bytes, String... path)
          Update data at a given path
 boolean updateProperties(Properties properties, String... path)
          Update properties at a given path
 boolean updateString(String value, String... path)
          Update a specific string value
 

Field Detail

SEPARATOR

static final String SEPARATOR
See Also:
Constant Field Values
Method Detail

exists

boolean exists(String... path)
Check if a given path exists

Parameters:
path - the path (over and above any root path) to check
Returns:
true if the path exists

delete

void delete(String... path)
Recursive delete of a path without any option to recover.

Parameters:
path - the path (over and above any root path)

getString

String getString(ConfigDataListener listener,
                 String... path)
Retrieve string data from a given path

Parameters:
listener - a listener to call if the data changes (null allowed)
path - the path to the data
Returns:
Returns the data or null if not found

setData

String setData(ConfigDataListener listener,
               boolean ephemeral,
               boolean sequential,
               byte[] bytes,
               String... path)
Set binary data

Parameters:
listener - a listener to call if the properties change (null allowed)
ephemeral - true if the path should be removed when the server stops
sequential - true if the last path element must have an auto-incrementing value attached i.e. if the final path element is always new
bytes - the data to set
path - the path to the properties
Returns:
the final path element, which will be different from the one supplied if it is auto-incrementing

updateData

boolean updateData(byte[] bytes,
                   String... path)
Update data at a given path

Parameters:
bytes - the properties to set
path - the path to the properties
Returns:
true if the properties were updated otherwise false

setString

String setString(ConfigDataListener listener,
                 boolean ephemeral,
                 boolean sequential,
                 String value,
                 String... path)
Retrieve string data from a given path

Parameters:
listener - a listener to call if the data changes (null allowed)
ephemeral - true if the path should be removed when the server stops
sequential - true if the last path element must have an auto-incrementing value attached i.e. if the final path element is always new
value - the value to set
path - the path to the properties
Returns:
the final path element, which will be different from the one supplied if it is auto-incrementing

updateString

boolean updateString(String value,
                     String... path)
Update a specific string value

Parameters:
value - the value to set
path - the path to the properties
Returns:
true if a value was updated otherwise false

getProperties

Properties getProperties(ConfigDataListener listener,
                         String... path)
Retrieve the properties from a given path

Parameters:
listener - a listener to call if the properties change (null allowed)
path - the path to the properties
Returns:
Java properties from the location (never null)

setProperties

String setProperties(ConfigDataListener listener,
                     boolean ephemeral,
                     boolean sequential,
                     Properties properties,
                     String... path)
Set properties against a path

Parameters:
listener - a listener to call if the properties change (null allowed)
ephemeral - true if the path should be removed when the server stops
sequential - true if the last path element must have an auto-incrementing value attached i.e. if the final path element is always new
properties - the properties to set
path - the path to the properties
Returns:
the final path element, which will be different from the one supplied if it is auto-incrementing

updateProperties

boolean updateProperties(Properties properties,
                         String... path)
Update properties at a given path

Parameters:
properties - the properties to set
path - the path to the properties
Returns:
true if the properties were updated otherwise false

getChildren

Set<String> getChildren(ConfigChildListener listener,
                        String... path)
Retrieve the children of a given path

Parameters:
listener - a listener to call if the the children change (null allowed)
path - the path to the parent
Returns:
Returns the current children of the provided path (never null)

getClassLoader

ClassLoader getClassLoader(ConfigClassesListener listener,
                           ClassLoader parent,
                           String... path)
Retrieve a ClassLoader rooted at the given location

Parameters:
listener - a listener to call if the classes change (null allowed)
parent - the parent ClassLoader
path - the path to the classes root (akin to a classpath)
Returns:
Returns the new ClassLoader

getJarLoader

ClassLoader getJarLoader(ConfigClassesListener listener,
                         ClassLoader parent,
                         String... path)
Retrieve a URLClassLoader rooted at the given location. The children of the given path are found and each is treated as a separate jar file.

Parameters:
listener - a listener to call if the classes change (null allowed)
parent - the parent ClassLoader
path - the path to the jar
Returns:
Returns the new ClassLoader


Copyright © 2012. All Rights Reserved.