Package org.jcsp.net
Class ServiceSettings
- java.lang.Object
-
- org.jcsp.net.ServiceSettings
-
public class ServiceSettings extends java.lang.ObjectThis class is used to hold settings that can be passed to services when they are initialized. Two types of settings can be held. The basic type of settings that can be held are
Stringname,value pairs. Only one setting can exist per name. The other type of settings that can be held are address settings. Each address settings can hold a list ofNodeAddressIDobjects against aStringname.The class also has a field for storing the name of the Service. This can be obtained by calling the
getServiceName()method.
-
-
Constructor Summary
Constructors Constructor Description ServiceSettings(java.lang.String name)Constructor which takes the name of the serive for which this object holds settings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAddress(java.lang.String name, NodeAddressID address)Adds a named address setting.voidaddSetting(java.lang.String name, java.lang.String value)Adds aStringname, value setting to this object.NodeAddressID[]getAddresses(java.lang.String name)Gets the addresses held in a setting of a specified name.java.lang.String[]getAddressNames()Returns an array ofStringobjects containing the names of all address settings held in this object.java.lang.StringgetServiceName()An accessor for obtaining the name of the service for which this object holds settings.java.lang.StringgetSetting(java.lang.String name)Gets theStringvalue held in namedStringname, value pair setting.java.lang.String[]getSettingNames()Returns an array ofStringobjects containing the names of allStringname, value settings held in this object.
-
-
-
Method Detail
-
getServiceName
public java.lang.String getServiceName()
An accessor for obtaining the name of the service for which this object holds settings.- Returns:
- the
Stringname of the service.
-
addAddress
public void addAddress(java.lang.String name, NodeAddressID address)Adds a named address setting.- Parameters:
name- the name of the setting to add.address- the address to add to the setting.
-
getAddresses
public NodeAddressID[] getAddresses(java.lang.String name)
Gets the addresses held in a setting of a specified name.- Parameters:
name- the name of the setting- Returns:
- an array of
NodeAddressIDobjects held in the setting.
-
getAddressNames
public java.lang.String[] getAddressNames()
Returns an array ofStringobjects containing the names of all address settings held in this object.- Returns:
- a
Stringarray of all the address setting names.
-
getSettingNames
public java.lang.String[] getSettingNames()
Returns an array ofStringobjects containing the names of allStringname, value settings held in this object.- Returns:
- a
Stringarray of all theStringname, value setting names.
-
addSetting
public void addSetting(java.lang.String name, java.lang.String value)Adds aStringname, value setting to this object.- Parameters:
name- the name of the setting to add.value- the value of the setting.
-
getSetting
public java.lang.String getSetting(java.lang.String name)
Gets theStringvalue held in namedStringname, value pair setting.- Parameters:
name- the name of the setting of which to obtain the value.- Returns:
- the value of the setting.
-
-