org.glite.security.voms.service
Class Configuration

java.lang.Object
  extended byorg.glite.security.voms.service.Configuration

public final class Configuration
extends java.lang.Object

Provides comfortable access to VO configuration parameters.

First it tries to locate the configuration directory through JNDI using the "java:comp/env/configDir" environmental variable, which can be set in a servlet context the following way:

  <Context path="/voms-admin" docBase=".../voms-admin.war">
    <Environment name="configDir" value=".../etc/voms-admin"
                   type="java.lang.String" override="false"/>
  </Context>
  

The second guess is through the system property called "voms.configuration.directory", which can be set on the command line:
    java ... -Dvoms.configuration.directory=.../etc/voms-admin
  

The third guess is the default or central configuration directory, which comes with the original installation. But this is only a guess, based on the assumption that the configuration directory is something like .../var/etc/voms-admin/.... This string will be replaced by .../etc/voms-admin.
If none of the above are set, then it will try to load the configuration files from the classpath.

Author:
Karoly Lorentey

Field Summary
static java.lang.String[] propertiesFiles
          The name of the configurations file for VOMS services.
 
Method Summary
static boolean getFlag(java.lang.String key, boolean defaultValue)
          Returns the value of a boolean flag (convenience method).
static int getInt(java.lang.String key, int defaultValue)
          Returns the value of an integer value (convenience method).
static long getLong(java.lang.String key, long defaultValue)
          Returns the value of an long value (convenience method).
static java.util.Properties getProperties()
          Returns the whole properties table.
static java.lang.String getProperty(java.lang.String key)
          Returns the value of the given VO property, or null if there is no such property.
static java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
          Returns the value of the given VO property, or default if there is no such property.
static java.util.Properties getPropertyFamily(java.lang.String prefix)
          Parse a set of properties with keys beginning with prefix.
static java.lang.String getVOName()
          Returns the VO name.
static boolean isLoaded()
          Returns true if the configuration file was successfully loaded.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

propertiesFiles

public static final java.lang.String[] propertiesFiles
The name of the configurations file for VOMS services. The order is important.

Method Detail

getProperty

public static java.lang.String getProperty(java.lang.String key)
Returns the value of the given VO property, or null if there is no such property.


getProperty

public static java.lang.String getProperty(java.lang.String key,
                                           java.lang.String defaultValue)
Returns the value of the given VO property, or default if there is no such property.


getPropertyFamily

public static java.util.Properties getPropertyFamily(java.lang.String prefix)
Parse a set of properties with keys beginning with prefix. The common prefix is removed from the key names, and the new keys are put in a new property set along with their original values.

Parameters:
prefix - The common prefix to look for.
Returns:
A new property set containing the parsed subset.

getProperties

public static java.util.Properties getProperties()
Returns the whole properties table.

It is not a wise idea to return the whole table, however the mail session object requires its settings in a Properties object. Unless we copy everything one-by-one, this is the easiest way to export it.

Returning a javax.mail.Session object from this class is not a great idea, because that would introduce unnecessary dependencies.

The ideal solution would be making EmailNotification a friend class...

See Also:
EmailNotification

getFlag

public static boolean getFlag(java.lang.String key,
                              boolean defaultValue)
Returns the value of a boolean flag (convenience method). Returns false if the value of the given property is one of "false", "off", or "no"; otherwise returns true.


getInt

public static int getInt(java.lang.String key,
                         int defaultValue)
Returns the value of an integer value (convenience method).


getLong

public static long getLong(java.lang.String key,
                           long defaultValue)
Returns the value of an long value (convenience method).


isLoaded

public static boolean isLoaded()
Returns true if the configuration file was successfully loaded.


getVOName

public static java.lang.String getVOName()
Returns the VO name.