org.apache.uima.resource
Interface ConfigurationManager


public interface ConfigurationManager

Manages the configuration parameters of all components within a possibly aggregate Resource. Note that the ConfigurationManager needs to make use of the Session object in order to store configuration settings that are specific to a particular client session.


Method Summary
 void createContext(String aContextName, ResourceMetaData aResourceMetaData)
          Creates and sets up a new configuration parameter context.
 ConfigurationParameterDeclarations getConfigParameterDeclarations(String aContextName)
          Gets the ConfigurationParameterDeclarations for the given context.
 Object getConfigParameterValue(String aQualifiedName)
          Retrieves the value for a configuration parameter.
 Object getConfigParameterValue(String aQualifiedParamName, String aGroupName)
          Retrieves the value for a configuration parameter in a group.
 ConfigurationParameterSettings getCurrentConfigParameterSettings(String aContextName)
          Gets an object containing the current settings for all configuration parameters within the given context.
 void reconfigure(String aContextName)
          Completes the reconfiguration of parameters within the specified context.
 void setConfigParameterValue(String aQualifiedParamName, Object aValue)
          Sets the value of a configuration parameter.
 void setConfigParameterValue(String aQualifiedParamName, String aGroupName, Object aValue)
          Sets the value of a configuration parameter in a group.
 void setSession(Session aSession)
          Sets the current Session.
 

Method Detail

createContext

void createContext(String aContextName,
                   ResourceMetaData aResourceMetaData)
                   throws ResourceConfigurationException
Creates and sets up a new configuration parameter context. This method is called during the initialization of each Resource that uses this Configuration Manager. Validation will be performed on the configuration parameters declared in this context; if an error is found an exception will be thrown.

Parameters:
aContextName - the name of the context in which the configuration parameter is being accessed. This corresponds to the path through the aggregate resource, e.g /subAE1/annotator1.
aResourceMetaData - metadata object containing the configuration parameter declarations and settings.
Throws:
ResourceConfigurationException - if the configuration settings are invalid

setSession

void setSession(Session aSession)
Sets the current Session. The Configuration Manager uses the Session object to store changes to configuration settings made by calling the setConfigParameterValue methods. This ensures that in a multi-client deployment those settings only apply to the same client that set them.

Code that uses this class must be sure to call setSession before using the other methods (except createContext) on this class.

Parameters:
aSession - the session object used to store configuration parameter overrides made by a particular client.

getConfigParameterValue

Object getConfigParameterValue(String aQualifiedName)
Retrieves the value for a configuration parameter.

Parameters:
aQualifiedName - the fully-qualified configuration parameter name. This is of the form ContextName + / + ParameterName.
Returns:
the value of the parameter with the given name. The caller is expected to know the data type of the parameter. If the parameter does not exist,null is returned.

getConfigParameterValue

Object getConfigParameterValue(String aQualifiedParamName,
                               String aGroupName)
Retrieves the value for a configuration parameter in a group.

Parameters:
aQualifiedParamName - the fully-qualified configuration parameter name. This is of the form ContextName + / + ParameterName.
Returns:
the value of the parameter with the given name. The caller is expected to know the data type of the parameter. If the parameter does not exist,null is returned.

setConfigParameterValue

void setConfigParameterValue(String aQualifiedParamName,
                             Object aValue)
Sets the value of a configuration parameter. This only works for a parameter that is not defined in any group. Note that there is no guarantee that the change will take effect until reconfigure(String) is called.

Parameters:
aQualifiedParamName - the fully-qualified configuration parameter name. This is of the form ContextName + / + ParameterName.
aValue - the value to assign to the parameter

setConfigParameterValue

void setConfigParameterValue(String aQualifiedParamName,
                             String aGroupName,
                             Object aValue)
Sets the value of a configuration parameter in a group. Note that there is no guarantee that the change will take effect until reconfigure(String) is called.

Parameters:
aQualifiedParamName - the fully-qualified configuration parameter name. This is of the form ContextName + / + ParameterName.
aGroupName - the name of a configuration group. If this parameter is null, this method will have the same effet as setParameterValue(String,Object).
aValue - the value to assign to the parameter

reconfigure

void reconfigure(String aContextName)
                 throws ResourceConfigurationException
Completes the reconfiguration of parameters within the specified context. Also validates the parameter settings.

Parameters:
aContextName - the name of the context being reconfigured
Throws:
ResourceConfigurationException - if the new configuration is invalid

getConfigParameterDeclarations

ConfigurationParameterDeclarations getConfigParameterDeclarations(String aContextName)
Gets the ConfigurationParameterDeclarations for the given context.

Parameters:
aContextName - the name for which to get the parameter declarations
Returns:
parameter declarations for the context

getCurrentConfigParameterSettings

ConfigurationParameterSettings getCurrentConfigParameterSettings(String aContextName)
Gets an object containing the current settings for all configuration parameters within the given context.

Parameters:
aContextName - name of context for which to retrieve parameter settings
Returns:
an object containing the current configuration parameter settings


Copyright © 2010 The Apache Software Foundation. All Rights Reserved.