com.indexdata.masterkey.config
Class ModuleConfiguration

java.lang.Object
  extended by com.indexdata.masterkey.config.ModuleConfiguration

public class ModuleConfiguration
extends Object


Field Summary
 String moduleName
           
 
Constructor Summary
ModuleConfiguration(MasterkeyConfiguration mkConfigContext, String moduleName)
           
 
Method Summary
 String get(String name)
          Short-hand for getting a parameter value by name
 String get(String name, String defaultValue)
          Short-hand for getting a parameter value by name, while returning the provided defaultValue if the parameter is not found
 String getConfigFilePath()
          Retrieves the location of this components property file.
 Map<String,String> getConfigMap()
          Retrieves all the parameters for the module as a HashMap.
 String getConfigParameter(String name)
          Retrieves a config parameter prefixed with a given module name (ie a servlet name)
 Properties getConfigProperties()
          Retrieves all parameters for the module as a Properties
 String getContextKey()
           
 String getHostName()
          Host name intended for logging.
 String getMandatory(String name)
          Gets a mandatory parameter value by name
 boolean hasParameter(String name)
          Short-hand for checking for the existence of a parameter
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

moduleName

public String moduleName
Constructor Detail

ModuleConfiguration

public ModuleConfiguration(MasterkeyConfiguration mkConfigContext,
                           String moduleName)
Method Detail

getConfigParameter

public String getConfigParameter(String name)
                          throws IOException
Retrieves a config parameter prefixed with a given module name (ie a servlet name)

Parameters:
name - The name of the parameter, without the service name prefix.
Returns:
Throws:
javax.servlet.ServletException
IOException

getConfigMap

public Map<String,String> getConfigMap()
                                throws IOException
Retrieves all the parameters for the module as a HashMap.

Returns:
Throws:
javax.servlet.ServletException
IOException

getConfigProperties

public Properties getConfigProperties()
                               throws IOException
Retrieves all parameters for the module as a Properties

Returns:
Throws:
IOException

getContextKey

public String getContextKey()

getConfigFilePath

public String getConfigFilePath()
Retrieves the location of this components property file. Allows the module to keep and retrieve additional configuration files from there - i.e. a Pazpar2 service definition XML file

Returns:
Path to the config file directory

getHostName

public String getHostName()
Host name intended for logging.

Returns:
Name of (virtual) host to which the HTTP request was made.

get

public String get(String name)
Short-hand for getting a parameter value by name

Parameters:
name -
Returns:

get

public String get(String name,
                  String defaultValue)
Short-hand for getting a parameter value by name, while returning the provided defaultValue if the parameter is not found

Parameters:
name -
defaultValue -
Returns:
The value of the parameter, or defaultValue if not found

getMandatory

public String getMandatory(String name)
                    throws MissingMandatoryParameterException
Gets a mandatory parameter value by name

Parameters:
name - parameter key
Returns:
the parameter value
Throws:
Exception - if mandatory parameter was not found
MissingMandatoryParameterException

hasParameter

public boolean hasParameter(String name)
Short-hand for checking for the existence of a parameter

Parameters:
name -
Returns:
true if the parameter name exists in the modules properties

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012. All Rights Reserved.