|
Version: ${maven.project.version} | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.soaplab.services.Config
public abstract class Config
An abstract class giving access to the global Soaplab configuration. It also allows to add additional configuration files (which may be useful for Soaplab's plugins, for example).
It also contains names and description of (most of) the Soaplab configuration properties.
The class uses Apache
Commons Configuration - the method get()
gives back
directly an Apache's CompositeConfiguration instance
allowing to fine-tune your configuration. But in most cases,
few convenient methods are used.
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_JOB_FACTORY_CLASS
A default name for a class representing a Job factory. |
static java.lang.String |
LSF_ARCH
A property name. |
static java.lang.String |
LSF_ENABLED
A property name. |
static java.lang.String |
LSF_PROJECT
A property name. |
static java.lang.String |
LSF_QUEUENAME
A property name. |
static java.lang.String |
PREFIX_SYNONYM
A part of property names. |
static java.lang.String |
PROP_ACCEPT_ANY_EXITCODE
A property name. |
static java.lang.String |
PROP_ADDTOPATH_DIR
A property name. |
static java.lang.String |
PROP_APPLIST_FILENAME
A property name. |
static java.lang.String |
PROP_BASE_DIR
A property name. |
static java.lang.String |
PROP_ENVAR
A property name. |
static java.lang.String |
PROP_EVENT_IGNORE_HEARBEAT
A property name. |
static java.lang.String |
PROP_EVENT_LOG_LEVEL
A property name. |
static java.lang.String |
PROP_JOBS_CLEANING_INTERVAL
A property name. |
static java.lang.String |
PROP_JOBS_TIMEOUT
A property name. |
static java.lang.String |
PROP_JOBS_WAITFOR_TIMEOUT
A property name. |
static java.lang.String |
PROP_KEEP_INPUTS
A property name. |
static java.lang.String |
PROP_LAUNCHER
A property name. |
static java.lang.String |
PROP_METADATA_DIR
A property name. |
static java.lang.String |
PROP_METADATA_FILE
A part of a property name. |
static java.lang.String |
PROP_RESULTS_DIR
A property name. |
static java.lang.String |
PROP_RESULTS_URL
A property name. |
static java.lang.String |
PROP_RESULTS_URL_DIR
A property name. |
static java.lang.String |
PROP_RESULTS_URL_IGNORE
A property name. |
static java.lang.String |
PROP_SANDBOX_DIR
A property name. |
static java.lang.String |
PROP_SCRIPTS_DIR
A property name. |
static java.lang.String |
PROP_SERVICES_CLEANING_INTERVAL
A property name. |
static java.lang.String |
PROP_SOAPLAB_CONFIGURATION
A property name. |
static java.lang.String |
PROP_SUPPLIER
A property name. |
static java.lang.String |
PROP_TOMCAT_HOST
A property name. |
static java.lang.String |
PROP_TOMCAT_PORT
A property name. |
static java.lang.String |
PROP_WORKING_DIR
A property name. |
static java.lang.String |
SOAPLAB_CONFIG_FILENAME
A filename indicating a file containing Soaplab run-time properties. |
Constructor Summary | |
---|---|
Config()
|
Method Summary | |
---|---|
static boolean |
addConfigPropertyFile(java.lang.String configFilename)
Add new configuration properties from a property file. |
static boolean |
addConfigXMLFile(java.lang.String configFilename)
Add new configuration properties from an XML file. |
static org.apache.commons.configuration.CompositeConfiguration |
get()
The main method returning a configuration object. |
static java.io.File[] |
getConfigFiles()
|
static int |
getInt(java.lang.String key,
int defaultValue,
java.lang.String serviceName,
java.lang.Object owner)
Almost the same functionality as getString
method - see there details about parameters - except that it
expects property value to be an integer. |
static java.util.Properties |
getMatchingProperties(java.lang.String prefix,
java.lang.String serviceName,
java.lang.Object owner)
Get all properties contained in the configuration whose keys (names) match the specified prefix. |
static java.lang.String |
getString(java.lang.String key,
java.lang.String defaultValue,
java.lang.String serviceName,
java.lang.Object owner)
Get a string associated with the given configuration key, or - if not found - get the given default value (which still may be null). |
static java.lang.String[] |
getStrings(java.lang.String key,
java.lang.String defaultValue,
java.lang.String serviceName,
java.lang.Object owner)
Almost the same functionality as getString
method - see there details about parameters. |
static boolean |
isEnabled(java.lang.String key,
boolean defaultValue,
java.lang.String serviceName,
java.lang.Object owner)
Almost the same functionality as getString
method - see there details about parameters - except that it
expects property value to be a boolean. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String SOAPLAB_CONFIG_FILENAME
PROP_SOAPLAB_CONFIGURATION
to point to a
different file name.
public static final java.lang.String PREFIX_SYNONYM
PREFIX_SYNONYM.module = org.soaplab.plugins.Godmeans that the class name org.soaplab.plugins.God is known under a synonym module.
public static final java.lang.String DEFAULT_JOB_FACTORY_CLASS
public static final java.lang.String PROP_SOAPLAB_CONFIGURATION
SOAPLAB_CONFIG_FILENAME
.
public static final java.lang.String PROP_APPLIST_FILENAME
There is no default value.
public static final java.lang.String PROP_JOBS_CLEANING_INTERVAL
Default value is 60000 (one minute).
public static final java.lang.String PROP_JOBS_TIMEOUT
Default value is 864000000 (10 days).
public static final java.lang.String PROP_JOBS_WAITFOR_TIMEOUT
Default value is 864000000 (10 days).
public static final java.lang.String PROP_SERVICES_CLEANING_INTERVAL
Default value is 300000 (five minutes).
public static final java.lang.String PROP_RESULTS_DIR
Default value (also used when the given directory is not writable to the current user) is "soaplab.results" in the system-dependent default temporary-file directory (the default temporary-file directory is specified by the system property "java.io.tmpdir").
public static final java.lang.String PROP_METADATA_DIR
There is no default value.
public static final java.lang.String PROP_METADATA_FILE
The property name must be prefixed by the analysis (service) name whose metadata this file contains. For example, for service "edit.seqret", the full property name should be: "edit.seqret" + PROP_METADATA_FILE.
There is no default value.
public static final java.lang.String PROP_EVENT_IGNORE_HEARBEAT
Default value is false.
public static final java.lang.String PROP_EVENT_LOG_LEVEL
Default value is debug.
public static final java.lang.String PROP_WORKING_DIR
No default value; instead a temporary directory will be used.
public static final java.lang.String PROP_SANDBOX_DIR
PROP_WORKING_DIR
.
public static final java.lang.String PROP_KEEP_INPUTS
Default value is false.
public static final java.lang.String PROP_SUPPLIER
public static final java.lang.String PROP_LAUNCHER
public static final java.lang.String PROP_ENVAR
public static final java.lang.String PROP_ADDTOPATH_DIR
There is no default value.
public static final java.lang.String PROP_SCRIPTS_DIR
PROP_ADDTOPATH_DIR
- Soaplab does not do it
automatically. But Soaplab tries to make these scripts
executable by changing their permissions appropriately. This is
useful when the scripts were transported to the servlet
container in a war file (because unpacking the war file does
not preserve the files permissions). There is no default value.
public static final java.lang.String PROP_ACCEPT_ANY_EXITCODE
Default value is false.
public static final java.lang.String PROP_RESULTS_URL_IGNORE
Default value is false.
public static final java.lang.String PROP_TOMCAT_HOST
Default value is localhost.
public static final java.lang.String PROP_TOMCAT_PORT
Default value is 8080.
public static final java.lang.String PROP_RESULTS_URL_DIR
PROP_RESULTS_URL
points to as a URL. Default value depends on the context: if a Soaplab service is running in a servlet container (such as Tomcat - which is a usual case), a default directory is created inside Soaplab web application. Otherwise, there is no default (which means that the URL-based results will not be created).
public static final java.lang.String PROP_RESULTS_URL
PROP_RESULTS_URL_DIR
. Default value is http://localhost:8080/soaplab2/results.
public static final java.lang.String PROP_BASE_DIR
Default value depends on the context: if a Soaplab service is running in a servlet container (such as Tomcat - which is a usual case), a default value points to the Soaplab web application (inside Tomcat). Otherwise, it is usually the place current directory.
public static final java.lang.String LSF_ENABLED
public static final java.lang.String LSF_QUEUENAME
public static final java.lang.String LSF_ARCH
public static final java.lang.String LSF_PROJECT
Constructor Detail |
---|
public Config()
Method Detail |
---|
public static org.apache.commons.configuration.CompositeConfiguration get()
The configuration object contains all Java system properties
and properties read from the Soaplab configuration file. This
file name is given by the system property PROP_SOAPLAB_CONFIGURATION
, or using a default name SOAPLAB_CONFIG_FILENAME
. If the filename does not specify an
absolute path, the file will be searched automatically in the
following locations:
The System properties take precedence over properties read from the Soaplab property file.
The configuration object can be anytime extended by properties
from other sources by using either methods defined in the
CompositeConfiguration's API, or using a convenient
methods addConfigPropertyFile(java.lang.String)
and addConfigXMLFile(java.lang.String)
defined here. Properties from these
additional files have higher priority than properties added
earlier - except System properties, they are always the most
prioritized.
public static boolean addConfigPropertyFile(java.lang.String configFilename)
The newly added properties have higher priority than properties added earlier - except System properties, they are always the most prioritized.
configFilename
- is a filename indicating a file
(formatted as a Java properties file) with new properties (see
get()
explaining where is this file looked for)
public static boolean addConfigXMLFile(java.lang.String configFilename)
The newly added properties have higher priority than properties added earlier - except System properties, they are always the most prioritized.
configFilename
- is an XML filename indicating a file with
new properties (see get()
explaining where is this file
looked for)
public static java.lang.String getString(java.lang.String key, java.lang.String defaultValue, java.lang.String serviceName, java.lang.Object owner)
So far, it looks like the same-named method in org.apache.commons.configuration.Configuration. So if you need just that functionality, go directly there. For example, do this:
String value = Config.get().getString ("my.property", "yes");The other two parameters, 'serviceName' and 'owner' - if not null - act as prefixes of the given property key, and they are tried first. This way you can select some property to be used only for specified service, or for a specified class name. For example, a property file can have these properties:
applist = ... org.soaplab.lists.MyList.applist = ...or:
delay = ... big.service.delay = ...The method looks first for property <serviceName>.<key>. Then, if not found, for property <class-name>.<key>. And finally, just for <key>. The class-name is a fuly-qualified class name of 'owner'.
key
- is a property namedefaultValue
- used if the 'key' cannot be foundserviceName
- is a preferred prefix for the 'key'owner
- is a preferred prefix for the 'key': if 'owner' is
of type Class its name is used, otherwise, the name of the
class of the instance 'owner' is used
public static java.lang.String[] getStrings(java.lang.String key, java.lang.String defaultValue, java.lang.String serviceName, java.lang.Object owner)
getString
method - see there details about parameters. The different is
the return value - it allows to return several values of the
same property. In the configuration file, the property can be
repeated, or can have several comma-separated values.
public static int getInt(java.lang.String key, int defaultValue, java.lang.String serviceName, java.lang.Object owner)
getString
method - see there details about parameters - except that it
expects property value to be an integer. If the key is found but its value is not an integer, or if it is not found at all, it returns the given default value.
public static boolean isEnabled(java.lang.String key, boolean defaultValue, java.lang.String serviceName, java.lang.Object owner)
getString
method - see there details about parameters - except that it
expects property value to be a boolean. For the property values 'true', 'on', 'yes' (case insensitive), and for an empty value it returns true. For other values, false is returned. If the property does not exist at all, the 'defaultValue' is returned.
public static java.util.Properties getMatchingProperties(java.lang.String prefix, java.lang.String serviceName, java.lang.Object owner)
The remaining parameters are used in the similar way as in
getString
method. Meaning if they are not
null, the following prefixes are actually tried:
<prefix>. <class-of-owner>.<prefix>. <serviceName>.<prefix>.These prefixes are tried in the order as indicated above - causing the properties with earlier prefixes being overwritten by those having newer ones. For example, having the following properties in the configuration (classic.helloworld is a name of a service):
classic.helloworld.grid.env.One = ein classic.helloworld.grid.env.Two = zwei grid.env.One = un grid.env.Two = deux grid.env.Three = troisand calling:
getMatchingProperties ("grid.env", "classic.helloworld", null)will return properties:
One = ein Two = zwei Three = troi
prefix
- is a part of property name (may or may not end
with a dot)serviceName
- is a possibly 'prefix' for the 'prefix' (can
be null)owner
- is another possible 'prefix' for the 'prefix': if
'owner' is of type Class its name is used, otherwise, the name
of the class of the instance 'owner' is used
public static java.io.File[] getConfigFiles()
|
Version: ${maven.project.version} | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |