public class ServiceContext extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
ServiceDescription |
desc
The service description describing this context.
|
Modifier and Type | Method and Description |
---|---|
Object |
getAttribute(String key)
Obtains the attribute of a given key.
|
List<NameValuePair<Integer>> |
getHostPorts()
Obtains a list of host:ports as configured in the configuration file
to be used by the role this service is associated.
|
String |
getHostRole()
Obtains host role.
|
String[] |
getHosts()
Obtains the list of hosts as configured in the configuration file
for the role this service is associated.
|
String |
getName()
Obtains the name (aka id) of the service.
|
String |
getProperty(String key)
Obtains the property for a given key.
|
String |
getRunDuration()
Obtains the run duration.
|
List<NameValuePair<Integer>> |
getUniqueHostPorts()
Obtains a list of hostports non-duplicate hosts:ports.
|
String[] |
getUniqueHosts()
Obtains a list of non-duplicate hosts.
|
boolean |
isRestart()
Check if service restart is enabled
|
void |
setAttribute(String key,
Object value)
Sets an object attribute in the service context.
|
void |
setProperty(String key,
String value)
Sets a property in the service context.
|
public ServiceDescription desc
public String getName()
public String[] getHosts()
public String[] getUniqueHosts()
public List<NameValuePair<Integer>> getHostPorts()
public List<NameValuePair<Integer>> getUniqueHostPorts()
public boolean isRestart()
true
if restart is enabledpublic String getHostRole()
public String getProperty(String key)
key
- The property keypublic void setProperty(String key, String value)
key
- The property keyvalue
- The property valuepublic Object getAttribute(String key)
key
- They attribute keypublic void setAttribute(String key, Object value)
key
- The attribute keyvalue
- The attributepublic String getRunDuration()