|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.dsrg.sofa.deployment.zeroconf.Configuration
public class Configuration
Configuration
instance contains key-value pairs
which are intended to represent configuration settings. You can query
the configuration using its get()
methods.
Configuration is supposed to be obtained from the Zero Configuration
Server. The getFromServer()
static methods serve as a client
that tries to obtain the settings from the server.
Field Summary | |
---|---|
static ValueParser<java.lang.Integer> |
INTEGER_PARSER
A convenient ValueParser for parsing integer values. |
static java.lang.String[] |
SofaProperties
|
static ValueParser<java.lang.String[]> |
STRING_ARRAY_PARSER
A convenient ValueParser for parsing string arrays. |
Method Summary | ||
---|---|---|
java.lang.String |
get(java.lang.String key)
|
|
|
get(java.lang.String key,
ValueParser<T> parser)
Searches for the key key and, if found, parses its value
with parser . |
|
static Configuration |
getFromServer()
Obtains the configuration from server, using default values for port, timeout and number of tries. |
|
static Configuration |
getFromServer(int port,
int timeout,
int tries)
Obtains the configuration from server. |
|
static java.util.Properties |
getSofaPropertiesFromServer(int zeroconfPort)
Gets the SOFA configuration properties from the zeroconf server. |
|
java.util.Set<java.lang.String> |
keys()
Returns a set of all keys in this Configuration . |
|
static void |
loadSofaConfiguration()
Gets the SOFA configuration from the zeroconf server and sets the appropriate java system properties. |
|
static void |
loadSofaConfiguration(int zeroconfPort)
Gets the SOFA configuration from the zeroconf server and sets the appropriate java system properties. |
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String[] SofaProperties
public static final ValueParser<java.lang.Integer> INTEGER_PARSER
ValueParser
for parsing integer values.
public static final ValueParser<java.lang.String[]> STRING_ARRAY_PARSER
ValueParser
for parsing string arrays.
For information on how an array or list of strings should be encoded
into a string, see ListParser
.
Method Detail |
---|
public static void loadSofaConfiguration()
public static void loadSofaConfiguration(int zeroconfPort)
zeroconfPort
- The port of the zeroconf server to look up.public static java.util.Properties getSofaPropertiesFromServer(int zeroconfPort)
zeroconfPort
- The port of the zeroconf server to look up.public static Configuration getFromServer() throws java.net.SocketException, java.io.IOException
java.net.SocketException
java.io.IOException
getFromServer(int, int, int)
public static Configuration getFromServer(int port, int timeout, int tries) throws java.net.SocketException, java.io.IOException
port
- port on which the request is broadcasted. If -1,
default port will be used.timeout
- time in milliseconds to wait for the response before
retrying. If -1, default timeout will be used.tries
- number of requests sent before giving up. If -1,
default value will be used.
null
if no response was received within the given timeout and tries.
java.net.SocketException
java.io.IOException
public java.lang.String get(java.lang.String key)
String
value for the key key
or
null
when there's no value with the given key.public <T> T get(java.lang.String key, ValueParser<T> parser) throws ParseException
key
and, if found, parses its value
with parser
.
null
when there's no value
with the given key.
ParseException
- propagates any exceptions thrown
by parser
.public java.util.Set<java.lang.String> keys()
Configuration
.
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |