org.jboss.soa.esb.parameters
Class ParamFileRepository

java.lang.Object
  extended by org.jboss.soa.esb.parameters.ParamFileRepository
All Implemented Interfaces:
ParamRepository

public class ParamFileRepository
extends java.lang.Object
implements ParamRepository

This class provides basic file-based storage/retrieval of parameter trees for the JBoss ESB.

This class creates a hierarchical parameter file structure on the file system. E.g. the value for a parameter named "org/jboss/param1" is stored in a file called "param1" in the folder "/org/jboss", where "root" is either the working directory (default) or the directory specified in the "org.jboss.soa.esb.paramsRepository.file.root" System property.

Author:
Esteban

Field Summary
static java.lang.String FILE_PARAMS_REPOS_ROOT
          System property defining the repository root directory.
 
Constructor Summary
ParamFileRepository()
          Public default constructor.
 
Method Summary
 void add(java.lang.String name, java.lang.String value)
          Store a parameter value in the repository.
 java.lang.String get(java.lang.String name)
          Get the value associated with the named parameter.
 java.io.File getRoot()
          Get the repository root directory.
 void remove(java.lang.String name)
          Remove a parameter, or a hierarchy of parameters.
 java.io.File toParamFile(java.lang.String name)
          Get the param file for the specified param name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_PARAMS_REPOS_ROOT

public static final java.lang.String FILE_PARAMS_REPOS_ROOT
System property defining the repository root directory.

See Also:
Constant Field Values
Constructor Detail

ParamFileRepository

public ParamFileRepository()
Public default constructor.

Method Detail

add

public void add(java.lang.String name,
                java.lang.String value)
         throws ParamRepositoryException
Description copied from interface: ParamRepository
Store a parameter value in the repository.

Specified by:
add in interface ParamRepository
Parameters:
name - The parameter name. Must not be null.
value - The parameter value. Must not be null.
Throws:
ParamRepositoryException - Failed to store the specified parameter value.

get

public java.lang.String get(java.lang.String name)
                     throws ParamRepositoryException
Description copied from interface: ParamRepository
Get the value associated with the named parameter.

Specified by:
get in interface ParamRepository
Parameters:
name - The parameter name. Must not be null.
Returns:
The parameter value, or null if the parameter is not available in the repository.
Throws:
ParamRepositoryException - The parameter exists, but an error has occured while readingit.

remove

public void remove(java.lang.String name)
Description copied from interface: ParamRepository
Remove a parameter, or a hierarchy of parameters.

Because the repository is hierarchical in nature, parameters can be addressed explicitly or as a group using a hierarchical name.

Specified by:
remove in interface ParamRepository
Parameters:
name - The parameter name. Must not be null.

getRoot

public java.io.File getRoot()
Get the repository root directory.

Returns:
The repository root directory.

toParamFile

public java.io.File toParamFile(java.lang.String name)
Get the param file for the specified param name.

Parameters:
paramName - The param name.
Returns:
The param file.