info.sswap.api.model
Class Config

java.lang.Object
  extended by info.sswap.api.model.Config

public class Config
extends java.lang.Object

Configuration properties for SSWAP Services. These properties may be set in a Java properties file and loaded at startup by entering a path to the file in web.xml as in this snippet:

 <servlet>
   <servlet-name>MyServlet</servlet-name>
 
     <servlet-class>org.mySite.sswap.MyServlet</servlet-class>
 
     <!-- if not defined, defaults to values in info.sswap.api.model.Config <url-pattern>
     <init-param>
       <param-name>ConfigPath</param-name>
       <param-value>/pathTo/config.properties</param-value>
     </init-param>
     -->
 </servlet>
 
 
Sample sswap.properties file:
 info.sswap.impl.empire.io.CACHE_DIR = /opt/tomcat/cache
 info.sswap.impl.empire.model.RIG_INVOCATION_TIMEOUT = 120000
 
 
The keys in the property file (e.g. 'info.sswap.impl.empire.io.CACHE_DIR') are the values of their respective _KEY fields in this class (e.g. CACHE_DIR_KEY) as listed in Constant Field Values link for each field.

Author:
Blazej Bulka

Field Summary
static java.lang.String CACHE_DIR_DEFAULT
          The default cache directory.
static java.lang.String CACHE_DIR_KEY
          Key for the cache directory which contains the index and cached files.
static java.lang.String CACHE_ENABLED_DEFAULT
          The default value for enabling (or disabling) caching (value is 'true' or 'false').
static java.lang.String CACHE_ENABLED_KEY
          Key for enabling any caching (disk or memory)
static java.lang.String CACHE_INDEX_FILE_DEFAULT
          The default name of the cache index file.
static java.lang.String CACHE_INDEX_FILE_KEY
          Key for the name of the index file for the cache that maps URIs to local file paths.
static java.lang.String CLOSURE_BYTES_LIMIT_DEFAULT
          The default byte limit for closure computation in bytes, if not otherwise specified.
static java.lang.String CLOSURE_BYTES_LIMIT_KEY
          Key for the property that defines a closure-wide bytes limit (i.e., if that many bytes are transmitted during a single closure computation, no further HTTP connections will be initiated, and existing connections will be terminated as soon as possible).
static java.lang.String CLOSURE_CONNECT_TIMEOUT_DEFAULT
          The default connect timeout for closure computation (in milliseconds), if not otherwise specified.
static java.lang.String CLOSURE_CONNECT_TIMEOUT_KEY
          Key for the property that defines the connect timeout for a single HTTP connection during closure computation (i.e., if an HTTP connection cannot be established in that many milliseconds, it will be interrupted, and a retrieval failure will be declared for that term.)
static java.lang.String CLOSURE_READ_TIMEOUT_DEFAULT
          The default read timeout for closure computation (in milliseconds), if not otherwise specified.
static java.lang.String CLOSURE_READ_TIMEOUT_KEY
          Key for the property that defines the read timeout for a single HTTP connection during closure computation (i.e., if data transmission for an HTTP connection should stall past that many milliseconds, it will be interrupted, and a retrieval failure will be declared for that term).
static java.lang.String CLOSURE_THREADS_DEFAULT
          The default number of threads for closure retrieval, if not otherwise specified.
static java.lang.String CLOSURE_THREADS_KEY
          Key for the property that defines how many threads/concurrent connections should be used in a single closure computation.
static java.lang.String CLOSURE_TIME_LIMIT_DEFAULT
          The default time limit for closure computation in milliseconds, if not otherwise specified.
static java.lang.String CLOSURE_TIME_LIMIT_KEY
          Key for the property that defines a closure-wide time limit (i.e., if an attempt to retrieve a closure should exceed that many milliseconds, no further HTTP connections will be initiated, and existing connections will be terminated as soon as possible).
static java.lang.String CONTENT_EHCACHE_CACHE_NAME_DEFAULT
          Default value of the EHCache cache that stores content/output data (produced by the SSWAP service)
static java.lang.String CONTENT_EHCACHE_CACHE_NAME_KEY
          Property name for the name of the EHCache cache for storing content/output of the service (produced by the SSWAP service)
static java.lang.String CONTENT_EHCACHE_FILE_KEY
          Property name for the path to EHCache configuration file for storing content/output of the service (e.g., referenced in an RRG).
static java.lang.String DISABLE_UNA_WHEN_CLOSING_WORLD
          We are not disabling UNA by default when closing the world during service invocations.
static java.lang.String DISABLE_UNA_WHEN_CLOSING_WORLD_KEY
          Property name for controlling Unique Name Assumption (UNA) when closing the world during service invocations.
static java.lang.String DISCOVERY_SERVER_URI_DEFAULT
          The default URI of the discovery server, if not otherwise specified.
static java.lang.String DISCOVERY_SERVER_URI_KEY
          The URI of the discovery server (used to answer RQGs)
static java.lang.String DISK_CACHE_ENABLED_DEFAULT
          The default value for enabling (or disabling) the disk cache (value is 'true' or 'false').
static java.lang.String DISK_CACHE_ENABLED_KEY
          Key for enabling the disk cache (vs.
static java.lang.String HTTP_API_URI_DEFAULT
          The default URI for HTTP API, if not otherwise specified.
static java.lang.String HTTP_API_URI_KEY
          The URI of the publicly accessible instance of HTTP/JSON API (used by classes in info.sswap.api.http).
private static Config instance
          A singleton instance of the config.
static java.lang.String MAX_CLOSURE_DEGREE_DEFAULT
          The default closure degree if not otherwise specified (must be a parseable integer)
static java.lang.String MAX_CLOSURE_DEGREE_KEY
          Key for the property that defines how many closure degrees will be performed during closure computation.
static java.lang.String MAX_HIERARCHY_CLOSURE_DEGREE_DEFAULT
          The default hierarchy retrieving closure degree if not otherwise specified (must be a parseable integer)
static java.lang.String MAX_HIERARCHY_CLOSURE_DEGREE_KEY
          Key for the property that defines how many additional "hierarchy retrieving" closure degrees will be performed (in addition to the closure degrees defined by MAX_CLOSURE_DEGREE_KEY) during closure computation.
static java.lang.String MODEL_CACHE_ENTRY_TTL_DEFAULT
          The default TTL for a model cache entry, if not otherwise specified.
static java.lang.String MODEL_CACHE_ENTRY_TTL_KEY
          Key for the property that defines how long an entry cached in model cache should be stored (time-to-live; TTL).
static java.lang.String MODEL_CACHE_NEGATIVE_ENTRY_TTL_DEFAULT
           
static java.lang.String MODEL_CACHE_NEGATIVE_ENTRY_TTL_KEY
           
static java.lang.String MODULE_EXTRACTION_ENABLED_DEFAULT
          The default URI for the module extraction service
static java.lang.String MODULE_EXTRACTION_ENABLED_KEY
          The key for the URI of the module extraction service
static java.lang.String MODULE_EXTRACTION_URI_DEFAULT
          The default URI for the module extraction service
static java.lang.String MODULE_EXTRACTION_URI_KEY
          The key for the URI of the module extraction service
private  java.util.Properties properties
          Actual property values.
static java.lang.String RIG_INVOCATION_TIMEOUT_DEFAULT
          The default connect timeout (in milliseconds) during RIG invocation.
static java.lang.String RIG_INVOCATION_TIMEOUT_KEY
          Property name for setting the connect timeout (in milliseconds) during RIG invocation.
static java.lang.String RRG_EHCACHE_CACHE_NAME_DEFAULT
          Default value of the EHCache cache that stores RRGs (produced by the SSWAP service and available for asynchronous retrieval)
static java.lang.String RRG_EHCACHE_CACHE_NAME_KEY
          Property name for the name of the EHCache cache for storing RRGs (produced by the SSWAP service and available for asynchronous retrieval)
static java.lang.String RRG_EHCACHE_FILE_KEY
          Property name for the path to EHCache configuration file for storing RRGs.
 
Constructor Summary
private Config()
          Initializes the default values of all known properties.
 
Method Summary
static Config get()
          Getter for the singleton instance of the config.
 java.lang.String getProperty(java.lang.String key)
          Gets the value of the specified property.
 java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
          Gets the value of the specified property or the specified default value, if the default value is not defined.
 void load(java.io.InputStream is)
          Loads the values from the specified input stream (which is expected to contain standard Java properties file).
 void load(java.io.Reader reader)
          Loads the values from the specified reader (which is expected to contain standard Java properties file).
 void setProperty(java.lang.String key, java.lang.String value)
          Sets the value of the specified property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_CLOSURE_DEGREE_KEY

public static java.lang.String MAX_CLOSURE_DEGREE_KEY
Key for the property that defines how many closure degrees will be performed during closure computation.


MAX_CLOSURE_DEGREE_DEFAULT

public static final java.lang.String MAX_CLOSURE_DEGREE_DEFAULT
The default closure degree if not otherwise specified (must be a parseable integer)

See Also:
Constant Field Values

MAX_HIERARCHY_CLOSURE_DEGREE_KEY

public static java.lang.String MAX_HIERARCHY_CLOSURE_DEGREE_KEY
Key for the property that defines how many additional "hierarchy retrieving" closure degrees will be performed (in addition to the closure degrees defined by MAX_CLOSURE_DEGREE_KEY) during closure computation.


MAX_HIERARCHY_CLOSURE_DEGREE_DEFAULT

public static final java.lang.String MAX_HIERARCHY_CLOSURE_DEGREE_DEFAULT
The default hierarchy retrieving closure degree if not otherwise specified (must be a parseable integer)

See Also:
Constant Field Values

CLOSURE_CONNECT_TIMEOUT_KEY

public static java.lang.String CLOSURE_CONNECT_TIMEOUT_KEY
Key for the property that defines the connect timeout for a single HTTP connection during closure computation (i.e., if an HTTP connection cannot be established in that many milliseconds, it will be interrupted, and a retrieval failure will be declared for that term.)


CLOSURE_CONNECT_TIMEOUT_DEFAULT

public static final java.lang.String CLOSURE_CONNECT_TIMEOUT_DEFAULT
The default connect timeout for closure computation (in milliseconds), if not otherwise specified. Must be a parseable integer

See Also:
Constant Field Values

CLOSURE_READ_TIMEOUT_KEY

public static java.lang.String CLOSURE_READ_TIMEOUT_KEY
Key for the property that defines the read timeout for a single HTTP connection during closure computation (i.e., if data transmission for an HTTP connection should stall past that many milliseconds, it will be interrupted, and a retrieval failure will be declared for that term).


CLOSURE_READ_TIMEOUT_DEFAULT

public static final java.lang.String CLOSURE_READ_TIMEOUT_DEFAULT
The default read timeout for closure computation (in milliseconds), if not otherwise specified. Must be a parseable integer

See Also:
Constant Field Values

CLOSURE_BYTES_LIMIT_KEY

public static java.lang.String CLOSURE_BYTES_LIMIT_KEY
Key for the property that defines a closure-wide bytes limit (i.e., if that many bytes are transmitted during a single closure computation, no further HTTP connections will be initiated, and existing connections will be terminated as soon as possible).


CLOSURE_BYTES_LIMIT_DEFAULT

public static final java.lang.String CLOSURE_BYTES_LIMIT_DEFAULT
The default byte limit for closure computation in bytes, if not otherwise specified. Must be a parseable integer

See Also:
Constant Field Values

CLOSURE_TIME_LIMIT_KEY

public static java.lang.String CLOSURE_TIME_LIMIT_KEY
Key for the property that defines a closure-wide time limit (i.e., if an attempt to retrieve a closure should exceed that many milliseconds, no further HTTP connections will be initiated, and existing connections will be terminated as soon as possible).


CLOSURE_TIME_LIMIT_DEFAULT

public static final java.lang.String CLOSURE_TIME_LIMIT_DEFAULT
The default time limit for closure computation in milliseconds, if not otherwise specified. Must be a parseable integer

See Also:
Constant Field Values

CLOSURE_THREADS_KEY

public static java.lang.String CLOSURE_THREADS_KEY
Key for the property that defines how many threads/concurrent connections should be used in a single closure computation. Setting higher value of this property may allow to utilize more bandwidth for faster closure computation. Setting lower value of this property can reduce the bandwidth utilization but it may also stall closure computation if some terms are to be retrieved from a slow HTTP server.


CLOSURE_THREADS_DEFAULT

public static final java.lang.String CLOSURE_THREADS_DEFAULT
The default number of threads for closure retrieval, if not otherwise specified. Must be a parseable integer.

See Also:
Constant Field Values

MODEL_CACHE_ENTRY_TTL_KEY

public static java.lang.String MODEL_CACHE_ENTRY_TTL_KEY
Key for the property that defines how long an entry cached in model cache should be stored (time-to-live; TTL). Whenever the closure computation process successfully a definition of a term, it is stored in the model cache (which allows subsequent requests to dereference this term not to generate an HTTP connection, which is not only faster, but also does not exhaust the byte limit for a particular closure). Note: model cache does not store information about failed retrievals; that is, if a closure computation fails to retrieve a term (e.g., due to network issue or because the term is not available at the address), next closure computations will still attempt to dereference the term (because the failure could have been transient).


MODEL_CACHE_ENTRY_TTL_DEFAULT

public static final java.lang.String MODEL_CACHE_ENTRY_TTL_DEFAULT
The default TTL for a model cache entry, if not otherwise specified. Must be a parseable long.

See Also:
Constant Field Values

MODEL_CACHE_NEGATIVE_ENTRY_TTL_KEY

public static java.lang.String MODEL_CACHE_NEGATIVE_ENTRY_TTL_KEY

MODEL_CACHE_NEGATIVE_ENTRY_TTL_DEFAULT

public static final java.lang.String MODEL_CACHE_NEGATIVE_ENTRY_TTL_DEFAULT
See Also:
Constant Field Values

HTTP_API_URI_KEY

public static java.lang.String HTTP_API_URI_KEY
The URI of the publicly accessible instance of HTTP/JSON API (used by classes in info.sswap.api.http).


HTTP_API_URI_DEFAULT

public static final java.lang.String HTTP_API_URI_DEFAULT
The default URI for HTTP API, if not otherwise specified. Must also be a parseable URL

See Also:
Constant Field Values

DISCOVERY_SERVER_URI_KEY

public static java.lang.String DISCOVERY_SERVER_URI_KEY
The URI of the discovery server (used to answer RQGs)


DISCOVERY_SERVER_URI_DEFAULT

public static final java.lang.String DISCOVERY_SERVER_URI_DEFAULT
The default URI of the discovery server, if not otherwise specified. Must also be a parseable URL.

See Also:
Constant Field Values

RIG_INVOCATION_TIMEOUT_KEY

public static final java.lang.String RIG_INVOCATION_TIMEOUT_KEY
Property name for setting the connect timeout (in milliseconds) during RIG invocation.

See Also:
Constant Field Values

RIG_INVOCATION_TIMEOUT_DEFAULT

public static final java.lang.String RIG_INVOCATION_TIMEOUT_DEFAULT
The default connect timeout (in milliseconds) during RIG invocation. (Must be a parseable integer.)

See Also:
Constant Field Values

CACHE_DIR_KEY

public static final java.lang.String CACHE_DIR_KEY
Key for the cache directory which contains the index and cached files.

See Also:
Constant Field Values

CACHE_DIR_DEFAULT

public static final java.lang.String CACHE_DIR_DEFAULT
The default cache directory.

See Also:
Constant Field Values

CACHE_INDEX_FILE_KEY

public static final java.lang.String CACHE_INDEX_FILE_KEY
Key for the name of the index file for the cache that maps URIs to local file paths.

See Also:
Constant Field Values

CACHE_INDEX_FILE_DEFAULT

public static final java.lang.String CACHE_INDEX_FILE_DEFAULT
The default name of the cache index file.

See Also:
Constant Field Values

DISK_CACHE_ENABLED_KEY

public static final java.lang.String DISK_CACHE_ENABLED_KEY
Key for enabling the disk cache (vs. memory-only caching)

See Also:
Constant Field Values

DISK_CACHE_ENABLED_DEFAULT

public static final java.lang.String DISK_CACHE_ENABLED_DEFAULT
The default value for enabling (or disabling) the disk cache (value is 'true' or 'false').

See Also:
Constant Field Values

CACHE_ENABLED_KEY

public static final java.lang.String CACHE_ENABLED_KEY
Key for enabling any caching (disk or memory)

See Also:
Constant Field Values

CACHE_ENABLED_DEFAULT

public static final java.lang.String CACHE_ENABLED_DEFAULT
The default value for enabling (or disabling) caching (value is 'true' or 'false').

See Also:
Constant Field Values

DISABLE_UNA_WHEN_CLOSING_WORLD_KEY

public static final java.lang.String DISABLE_UNA_WHEN_CLOSING_WORLD_KEY
Property name for controlling Unique Name Assumption (UNA) when closing the world during service invocations. If set to true, the individuals referred in sswap:Subjects/sswap:Resource will be assumed different if they have different URIs and cannot be proven to be the same by the reasoner. If set to false (default), the "regular" rules of OWL will apply; i.e., there may not be enough information to prove individuals be the same or different, and subsequently some cardinality restrictions may fail (e.g., if the service requires two values for a certain property, it may not be provable that the two values in the request are different, and therefore the request will fail).

See Also:
Constant Field Values

DISABLE_UNA_WHEN_CLOSING_WORLD

public static final java.lang.String DISABLE_UNA_WHEN_CLOSING_WORLD
We are not disabling UNA by default when closing the world during service invocations.

See Also:
Constant Field Values

RRG_EHCACHE_FILE_KEY

public static final java.lang.String RRG_EHCACHE_FILE_KEY
Property name for the path to EHCache configuration file for storing RRGs. This cache is a persistent cache that is used to store RRGs on the server side during asynchronous invocations of sswap services. There is no default value for this property (if there is no value, SSWAP will use built-in configuration file)

See Also:
Constant Field Values

RRG_EHCACHE_CACHE_NAME_KEY

public static final java.lang.String RRG_EHCACHE_CACHE_NAME_KEY
Property name for the name of the EHCache cache for storing RRGs (produced by the SSWAP service and available for asynchronous retrieval)

See Also:
Constant Field Values

RRG_EHCACHE_CACHE_NAME_DEFAULT

public static final java.lang.String RRG_EHCACHE_CACHE_NAME_DEFAULT
Default value of the EHCache cache that stores RRGs (produced by the SSWAP service and available for asynchronous retrieval)

See Also:
Constant Field Values

CONTENT_EHCACHE_FILE_KEY

public static final java.lang.String CONTENT_EHCACHE_FILE_KEY
Property name for the path to EHCache configuration file for storing content/output of the service (e.g., referenced in an RRG). This cache is a persistent cache that is used to store contentoutput of the service on the server side during asynchronous invocations of sswap services. There is no default value for this property (if there is no value, SSWAP will use built-in configuration file)

See Also:
Constant Field Values

CONTENT_EHCACHE_CACHE_NAME_KEY

public static final java.lang.String CONTENT_EHCACHE_CACHE_NAME_KEY
Property name for the name of the EHCache cache for storing content/output of the service (produced by the SSWAP service)

See Also:
Constant Field Values

CONTENT_EHCACHE_CACHE_NAME_DEFAULT

public static final java.lang.String CONTENT_EHCACHE_CACHE_NAME_DEFAULT
Default value of the EHCache cache that stores content/output data (produced by the SSWAP service)

See Also:
Constant Field Values

MODULE_EXTRACTION_URI_KEY

public static final java.lang.String MODULE_EXTRACTION_URI_KEY
The key for the URI of the module extraction service

See Also:
Constant Field Values

MODULE_EXTRACTION_URI_DEFAULT

public static final java.lang.String MODULE_EXTRACTION_URI_DEFAULT
The default URI for the module extraction service

See Also:
Constant Field Values

MODULE_EXTRACTION_ENABLED_KEY

public static final java.lang.String MODULE_EXTRACTION_ENABLED_KEY
The key for the URI of the module extraction service

See Also:
Constant Field Values

MODULE_EXTRACTION_ENABLED_DEFAULT

public static final java.lang.String MODULE_EXTRACTION_ENABLED_DEFAULT
The default URI for the module extraction service

See Also:
Constant Field Values

instance

private static Config instance
A singleton instance of the config.


properties

private java.util.Properties properties
Actual property values.

Constructor Detail

Config

private Config()
Initializes the default values of all known properties.

Method Detail

get

public static Config get()
Getter for the singleton instance of the config.

Returns:
the singleton instance of the config

getProperty

public java.lang.String getProperty(java.lang.String key)
Gets the value of the specified property.

Parameters:
key - the key identifying the property
Returns:
the value, if known, otherwise null

getProperty

public java.lang.String getProperty(java.lang.String key,
                                    java.lang.String defaultValue)
Gets the value of the specified property or the specified default value, if the default value is not defined.

Parameters:
key - the key identifying the property
defaultValue - the default value to be returned, if there is no property with the specified key
Returns:
value if known, or the default value (this method may return null, if the default value is null)

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
Sets the value of the specified property.

Parameters:
key - the key identifying the property
value - the new value for the property

load

public void load(java.io.InputStream is)
          throws java.io.IOException
Loads the values from the specified input stream (which is expected to contain standard Java properties file).

Parameters:
is - the input stream
Throws:
java.io.IOException - if an I/O error should occur

load

public void load(java.io.Reader reader)
          throws java.io.IOException
Loads the values from the specified reader (which is expected to contain standard Java properties file).

Parameters:
reader - the reader
Throws:
java.io.IOException - if an I/O error should occur


Copyright (c) 2011, iPlant Collaborative, University of Arizona, Cold Spring Harbor Laboratories, University of Texas at Austin.