org.gcube.contentmanagement.layerindependent.servicehelper
Class ConfigUtils

java.lang.Object
  extended by org.gcube.contentmanagement.layerindependent.servicehelper.ConfigUtils

public class ConfigUtils
extends java.lang.Object

Contains utility functionality for handling configurations in JNDI files and Java property files.

Author:
michaelspringmann

Field Summary
static java.lang.String CONFIG_DIRECTORY_VARIABLE_NAME
          the particular parameter in the JNDI that contains the configuration directory - introduced here, so no default JNDI parameter
static java.lang.String JNDI_SERVICE_CTX_LOOKUP_PREFIX
          lookup prefix to find JNDI stuff of a service
 
Constructor Summary
ConfigUtils()
           
 
Method Summary
static java.io.File getConfigDir()
          This method returns the path of the configuration a WSRF GT4 service.
static java.util.Properties loadProperties(java.io.File propertiesFile)
          Loads the local configuration from disk and refreshes the settings with the values read from file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JNDI_SERVICE_CTX_LOOKUP_PREFIX

public static final java.lang.String JNDI_SERVICE_CTX_LOOKUP_PREFIX
lookup prefix to find JNDI stuff of a service

See Also:
Constant Field Values

CONFIG_DIRECTORY_VARIABLE_NAME

public static final java.lang.String CONFIG_DIRECTORY_VARIABLE_NAME
the particular parameter in the JNDI that contains the configuration directory - introduced here, so no default JNDI parameter

See Also:
Constant Field Values
Constructor Detail

ConfigUtils

public ConfigUtils()
Method Detail

getConfigDir

public static java.io.File getConfigDir()
                                 throws java.lang.Exception
This method returns the path of the configuration a WSRF GT4 service. It expects to have the following line in the deploy-jndi-config.xml in the <service> section: <environment name="configDir" type="java.lang.String" value="@config.dir@"/>

Commonly, this directory should be something like $GLOBUS_LOCATION/etc/<name_of_gar>/.

Returns:
the File that represents the directory which contains the config files
Throws:
java.lang.Exception - if something goes wrong with lookup

loadProperties

public static java.util.Properties loadProperties(java.io.File propertiesFile)
                                           throws java.io.IOException
Loads the local configuration from disk and refreshes the settings with the values read from file.

Parameters:
propertiesFile - the file containing the properties
Returns:
the properties
Throws:
java.io.IOException - if properties file cannot be loaded