com.sap.ip.me.api.pios.configuration
Class ConfigurationManager

java.lang.Object
  extended bycom.sap.ip.me.api.pios.configuration.ConfigurationManager
Direct Known Subclasses:
DriverConfigurationManager, FontConfigurationManager, TagConfigurationManager

public abstract class ConfigurationManager
extends java.lang.Object

Configuration Manager is the manager for all the PIOS configurations (internal use only).

Provides a skeletal implementation of a configuration manager. Note that all methods of this class are protected. The inherited class will provide access to different configurations options like delete, get, add, list or save. Different scenarios may render in a Configuration class when only the get and list method are accessible to developers. Other scenarios involve all method access to developers.

Since:
MI 2.5
Author:
Abaco

Constructor Summary
protected ConfigurationManager()
          Allow access to the default constructor only for inheritance.
protected ConfigurationManager(ConfigurationManager confManager)
          Constructs a new ConfigurationManager object.
 
Method Summary
protected  Configuration add(java.lang.String name, java.lang.String type)
          Adds a configuration data to the configuration file.
protected  void delete(java.lang.String name)
          Deletes a configuration.
protected  Configuration get(java.lang.String name, java.lang.String type)
          Returns the Configuration object to which this manager maps the specified name and type.
protected  java.util.Properties getConfig()
          Returns the configuration properties file.
protected  java.lang.String getHeaderName()
          Returns the name of the header to be used for this configuration.
protected  java.lang.String getParamaterValue(java.lang.String name, java.lang.String parameter)
          Returns the value for the parameter.
protected  java.lang.String[] getParameters(java.lang.String type)
          Returns all the parameters for an specific configuration type.
protected  java.lang.String[] getPossibleValues(java.lang.String type, java.lang.String parameter)
          Returns the possible values intended for the specific parameter on a configuration type.
protected  java.lang.String[] getTypes()
          Returns a list of all types registered on the metadata file.
protected  java.lang.String[] list()
          Returns a list of all configurations registered on the configuration file.
protected  java.lang.String[] list(java.lang.String type)
          Returns all configurations that match the specified type.
protected  void save()
          Stores all the configurations to the configuration file.
protected  void setParameterValue(java.lang.String name, java.lang.String parameter, java.lang.String value)
          Sets a value for a parameter for an specific configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurationManager

protected ConfigurationManager()
Allow access to the default constructor only for inheritance.


ConfigurationManager

protected ConfigurationManager(ConfigurationManager confManager)
                        throws ConfigurationException
Constructs a new ConfigurationManager object.

Parameters:
confManager - implementation for the configuration manager.
Throws:
ConfigurationException
Method Detail

getConfig

protected java.util.Properties getConfig()
Returns the configuration properties file. Developers will allow access to the internal configuration Properties instance. This will allow setting values directly without invoking methods of this class.

Returns:
The configuration file Property object.
See Also:
Properties

getHeaderName

protected java.lang.String getHeaderName()
Returns the name of the header to be used for this configuration. This header name is a name that is going to be inserted as a first line comment on the configuration file. Class will override this method to customize the header name on the configuration file.

Returns:
Name of the header on the configuration file.

add

protected Configuration add(java.lang.String name,
                            java.lang.String type)
                     throws ConfigurationException
Adds a configuration data to the configuration file. Calling this method will create a new configuration setting all parameters to nothing.

Parameters:
name - the configuration name
type - the configuration type
Returns:
The created Configuration object.
Throws:
ConfigurationException - thrown if a configuration with this name already exists.

getTypes

protected java.lang.String[] getTypes()
                               throws ConfigurationException
Returns a list of all types registered on the metadata file. If there are no types it will return a string array with 0 elements.

Returns:
A string array with the name of all registered configuration types listed on the metadata file.
Throws:
ConfigurationException - thrown if there is an error while searching for the types key on the metadata file

list

protected java.lang.String[] list()
                           throws ConfigurationException
Returns a list of all configurations registered on the configuration file. If there are no configurations it will return a string array with 0 elements.

Returns:
A string array with the configuration names for all configurations in the configuration file.
Throws:
ConfigurationException - thrown if there is an error while searching for the configurations key on the configuration file

list

protected java.lang.String[] list(java.lang.String type)
                           throws ConfigurationException
Returns all configurations that match the specified type. If there are no matching configurations it will return a string array with 0 elements.

Parameters:
type - the type used to filter the configurations
Returns:
A string array with the configurations names matching the specified type.
Throws:
ConfigurationException - thrown if there is an error while searching the configurations

delete

protected void delete(java.lang.String name)
               throws ConfigurationException
Deletes a configuration.

Parameters:
name - the configuration name
Throws:
ConfigurationException - thrown if the configuration do not exits.

get

protected Configuration get(java.lang.String name,
                            java.lang.String type)
                     throws ConfigurationException
Returns the Configuration object to which this manager maps the specified name and type.

Parameters:
name - the configuration name
type - the configuration type
Returns:
The Configuration object matching the configuration name and type.
Throws:
ConfigurationException - thrown if the configuration do not exists.

getParameters

protected java.lang.String[] getParameters(java.lang.String type)
                                    throws ConfigurationException
Returns all the parameters for an specific configuration type. This data is obtained from the metadata file. If there are no matching parameters it will return a string array with 0 elements.

Parameters:
type - the configuration type
Returns:
A string array with all the parameters.
Throws:
ConfigurationException - thrown if the type does not exists

getPossibleValues

protected java.lang.String[] getPossibleValues(java.lang.String type,
                                               java.lang.String parameter)
                                        throws ConfigurationException
Returns the possible values intended for the specific parameter on a configuration type. If there are no possible values it will return a string array with 0 elements.

Parameters:
type - the configuration type
parameter - the parameter name
Returns:
A string array with all the possible values intended for the parameter.
Throws:
ConfigurationException - thrown if the type does not exist

setParameterValue

protected void setParameterValue(java.lang.String name,
                                 java.lang.String parameter,
                                 java.lang.String value)
                          throws ConfigurationException
Sets a value for a parameter for an specific configuration. The value is not validated against possible values or any other source. If validation is needed needs to be implemented overriding this method.

Parameters:
name - the configuration name
parameter - the parameter name
value - the parameter value
Throws:
ConfigurationException - throw if the parameter name does not exist

save

protected void save()
             throws ConfigurationException
Stores all the configurations to the configuration file.

Throws:
ConfigurationException - thrown if an error occurs while saving the configuration file.

getParamaterValue

protected java.lang.String getParamaterValue(java.lang.String name,
                                             java.lang.String parameter)
                                      throws ConfigurationException
Returns the value for the parameter.

Parameters:
name - the configuration name
parameter - the parameter name
Returns:
A string with the parameter value.
Throws:
ConfigurationException - thrown if the parameter does not exist


Copyright © 2005 SAP AG. All Rights Reserved.