|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xins.common.service.DescriptorBuilder
Builder that can build a Descriptor
object based on a set of
properties.
The following example is the definition of a single back-end at
http://somehost/
, identified by the property name
"s1"
, the time-out is set to 20 seconds:
s1=service, http://somehost/, 20000
The next example is the definition of 4 back-ends, of which one will be
chosen randomly. This setting is identified by the property name
"capi.sso"
:
# The root definition "capi.sso"
capi.sso=group, random, target1, target2, target3, target4
# Total time-out is 12.5 seconds, no connection time-out and no socket
# time-out
capi.sso.target1=service, http://somehost/, 12500
# Total time-out is 12.5 seconds, connection time-out is 4 seconds and
# no socket time-out
capi.sso.target2=service, http://othrhost/, 12500, 4000
# Total time-out is 12.5 seconds, connection time-out is 4 seconds,
# socket time-out is 2 seconds
capi.sso.target3=service, http://othrhost:2001/, 12500, 4000, 2000
# Total time-out is not set, connection time-out is not set and socket
# time-out is 2 seconds
capi.sso.target4=service, http://othrhost:2002/, 0, 0,
2000
The last example defines 2 back-ends at a more preferred location and 1
at a less-preferred location. Normally one of the 2 back-ends at the
preferred location will be chosen randomly, but if none is available, then
the back-end at the less preferred location will be tried. The time-out for
all back-ends in 8 seconds. The name of the property is "ldap"
:
ldap=group, ordered, loc1, host2a
ldap.loc1=group, random, host1a, host1b
ldap.host1a=service, ldap://host1a/, 8000
ldap.host1b=service, ldap://host1b/, 8000
ldap.host2a=service, ldap://host2a/, 8000
Field Summary | |
static char |
DELIMITER
Delimiter between tokens within a property value. |
static String |
GROUP_DESCRIPTOR_TYPE
Name identifying a group of descriptors. |
static char |
LINE_DELIMITER
Delimiter between property lines. |
static String |
TARGET_DESCRIPTOR_TYPE
Name identifying an actual target descriptor. |
Method Summary | |
static Descriptor |
build(PropertyReader properties,
String propertyName)
Builds a Descriptor based on the specified set of
properties. |
static Descriptor |
build(ServiceCaller caller,
PropertyReader properties,
String propertyName)
Builds a Descriptor based on the specified set of
properties, for the specified service caller. |
static Descriptor |
build(String descriptorValue)
Builds a Descriptor based on the specified value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final char DELIMITER
','
.
public static final char LINE_DELIMITER
'\n'
.
public static final String TARGET_DESCRIPTOR_TYPE
public static final String GROUP_DESCRIPTOR_TYPE
Method Detail |
public static Descriptor build(ServiceCaller caller, PropertyReader properties, String propertyName) throws IllegalArgumentException, MissingRequiredPropertyException, InvalidPropertyValueException
Descriptor
based on the specified set of
properties, for the specified service caller.
caller
- the caller to create a Descriptor
for, can be
null
if unknown.properties
- the properties to read from, cannot be null
.propertyName
- the base for the property names, cannot be null
.
Descriptor
that was built, never null
.
IllegalArgumentException
- if properties == null || propertyName == null
.
MissingRequiredPropertyException
- if the property named propertyName
cannot be found in
properties
, or if a referenced property cannot be found.
InvalidPropertyValueException
- if the property named propertyName
is found in
properties
, but the format of this property or the
format of a referenced property is invalid.public static Descriptor build(PropertyReader properties, String propertyName) throws IllegalArgumentException, MissingRequiredPropertyException, InvalidPropertyValueException
Descriptor
based on the specified set of
properties.
properties
- the properties to read from, cannot be null
.propertyName
- the base for the property names, cannot be null
.
Descriptor
that was built, never null
.
IllegalArgumentException
- if properties == null || propertyName == null
.
MissingRequiredPropertyException
- if the property named propertyName
cannot be found in
properties
, or if a referenced property cannot be found.
InvalidPropertyValueException
- if the property named propertyName
is found in
properties
, but the format of this property or the
format of a referenced property is invalid.public static Descriptor build(String descriptorValue) throws IllegalArgumentException, MissingRequiredPropertyException, InvalidPropertyValueException
Descriptor
based on the specified value.
descriptorValue
- the value of the descriptor, cannot be null
.
the value must have the same value as specified at the top, the lines
should be separated with '\n' and the first line must start with
the name of the property followed by the sign '='.
Descriptor
that was built, never null
.
IllegalArgumentException
- if descriptorValue == null
or the property name cannot
be found in the value.
MissingRequiredPropertyException
- if the property named propertyName
cannot be found in
properties
, or if a referenced property cannot be found.
InvalidPropertyValueException
- if the property named propertyName
is found in
properties
, but the format of this property or the
format of a referenced property is invalid.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |