|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.edg.security.voms.service.Configuration
Provides comfortable access to 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="/edg-voms-admin" docBase=".../edg-voms-admin.war"> <Environment name="configDir" value=".../etc/edg-voms-admin" type="java.lang.String" override="false"/> </Context>
java ... -Dvoms.configuration.directory=.../etc/edg-voms-admin
.../var/etc/edg-voms-admin/...
.
This string will be replaced by .../etc/edg-voms-admin
.
Field Summary | |
private static Configuration |
conf
The single Configuration object. |
private java.lang.String |
configDir
The location of the configuration files. |
private java.lang.String |
defaultConfigDir
The location of the default configuration files. |
private boolean |
loaded
Indicates that the configuration file was successfully loaded. |
private static org.apache.log4j.Logger |
log
|
static java.lang.String[] |
propertiesFiles
The name of the configurations file for VOMS services. |
private java.util.Properties |
props
The standard Java Properties object that holds our properties. |
Constructor Summary | |
protected |
Configuration()
Loads service parameters from the above configuration files. |
Method Summary | |
protected java.io.InputStream |
getConfigResource(java.lang.String resource)
Finds a file with the given name in the configuration directories. |
static java.io.InputStream |
getConfigResourceAsStream(java.lang.String resource)
Finds a file with the given name in the configuration directories or returns null . |
static boolean |
getFlag(java.lang.String key)
Returns the value of a boolean flag (convenience method). |
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 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 property, or default
if there is no such property. |
protected java.io.InputStream |
getResource(java.lang.String resource)
Finds a file with the given name in the configuration directories. |
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 |
private static Configuration conf
private java.util.Properties props
public static final java.lang.String[] propertiesFiles
private java.lang.String configDir
private java.lang.String defaultConfigDir
private boolean loaded
private static org.apache.log4j.Logger log
Constructor Detail |
protected Configuration()
Method Detail |
protected java.io.InputStream getResource(java.lang.String resource) throws java.io.IOException
java.io.IOException
protected java.io.InputStream getConfigResource(java.lang.String resource)
public static java.io.InputStream getConfigResourceAsStream(java.lang.String resource)
null
.
public static java.lang.String getProperty(java.lang.String key)
null
if
there is no such property.
public static java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
default
if there is no such property.
public static java.util.Properties getProperties()
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...
org.edg.security.voms.notificateion.EmailNotification
public static boolean getFlag(java.lang.String key)
"false"
, "off"
, or "no"
;
otherwise returns true.
public static boolean getFlag(java.lang.String key, boolean defaultValue)
"false"
, "off"
, or "no"
;
otherwise returns true.
public static int getInt(java.lang.String key, int defaultValue)
public static long getLong(java.lang.String key, long defaultValue)
public static boolean isLoaded()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |