|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jgroup.relacs.config.AppConfig
public class AppConfig
Class for holding application information, including replication style and recovery strategy for the dependable applications.
Constructor Summary | |
---|---|
AppConfig()
Default constructor for externalization and configuration parser construction. |
|
AppConfig(java.lang.String regName,
java.lang.String className,
java.lang.String args,
int groupId,
boolean inExecJVM)
Creates a new AppConfig instance, from the given class
name, arguments and group identifier. |
Method Summary | |
---|---|
static AppConfig |
addApplication(java.lang.String regname,
java.lang.String classname,
java.lang.String args,
int group,
boolean inExecJVM)
Augment the system with an additional application. |
static void |
addApplications(AppConfig[] apps)
Add the given set of applications to the static maps. |
void |
addParam(java.lang.String name,
java.lang.String value)
Add the given name-value pair to the internal parameter map. |
void |
addService(java.lang.String serviceName)
Add the given service to the protocol stack for this application. |
boolean |
equals(java.lang.Object obj)
Returns true if the provided object is equal to this object. |
static AppConfig |
getApplication(java.lang.Class cl)
Returns an AppConfig object associated with the
specified class. |
static AppConfig |
getApplication(int gid)
Returns an AppConfig object associated with the
specified group identifier. |
static AppConfig |
getApplication(java.lang.Object appObj)
Returns an AppConfig object associated with the
specified object instance. |
static AppConfig |
getApplication(java.lang.String name)
Returns an AppConfig object associated with the
specified name. |
static AppConfig[] |
getApplications()
Returns an array of all applications registered. |
boolean |
getBooleanParam(java.lang.String name)
Returns the boolean value associated with the parameter name provided to this method. |
java.lang.String[] |
getClassArgs()
Returns the class arguments as a string array. |
ClassData |
getClassData()
Returns a class data object for the application. |
java.lang.String |
getClassName()
Returns the class name as a string. |
int |
getCurrentGroupSize()
|
int |
getGroupId()
|
int |
getInitialRedundancy()
|
int |
getIntParam(java.lang.String name)
Returns the integer value associated with the parameter name provided to this method. |
int |
getIntParam(java.lang.String name,
int defaultValue)
Returns the integer value associated with the parameter name provided to this method. |
int |
getMinimalRedundancy()
|
java.lang.String |
getParam(java.lang.String name)
Returns the value associated with the parameter name provided to this method. |
java.lang.String |
getParam(java.lang.String name,
java.lang.String defaultVal)
Returns the value associated with the parameter name provided to this method; if this application has no such parameter defined the provided default value will be returned. |
RecoveryStrategy |
getRecoveryStrategy()
|
java.lang.String |
getRegistryName()
Returns the name associated with this application in the (dependable) registry. |
java.lang.String[] |
getServiceSet()
Retrieve the set of services used by this application. |
View |
getView()
Returns the current view of this application, which may be an empty view in case the application has not installed any views yet. |
HostSet |
getViewHosts()
Returns the set of hosts on which replicas of this application is known to be located. |
int |
hashCode()
Returns a hash code value for this application info object. |
boolean |
hasService(java.lang.String service)
Returns true if this application contains the specified service, otherwise false is returned. |
boolean |
needsRecovery()
Returns true if this application needs recovery, otherwise false is returned. |
void |
parse(org.w3c.dom.Element elm)
Parses the specified element. |
void |
readExternal(java.io.ObjectInput in)
|
static void |
setDistributionScheme(DistributionScheme distScheme)
Method to store the distribution scheme of the local replication manager. |
void |
setProperties(java.util.Map<java.lang.String,java.lang.String> properties)
Set the properties that should apply for this application. |
void |
setRecoveryStrategy(java.lang.String strategy)
Sets the recovery strategy for this application. |
void |
setRedundancy(int minimal,
int initial)
Set the minimal and initial redundancy for this application. |
void |
setServiceSet(java.lang.String stackOrder)
Set the service set or stack order for this application. |
boolean |
startInExecJVM()
Returns true if this application should be started within the same JVM as the execution daemon. |
java.lang.String |
toString()
Returns a string representation of this object |
java.lang.String |
toString(boolean full)
Returns a string representation of this object. |
void |
viewChange(View view)
Update this application group's view and set of view hosts. |
void |
writeExternal(java.io.ObjectOutput out)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AppConfig(java.lang.String regName, java.lang.String className, java.lang.String args, int groupId, boolean inExecJVM)
AppConfig
instance, from the given class
name, arguments and group identifier. The AppConfig
object must also be initialized with the required
redundancy and replication style parameters through the
corresponding set methods; otherwise an
IllegalStateException
will be thrown upon using the
AppConfig
object.
className
- The classname for this application object.args
- The arguments for the application object.groupId
- The group identifier for this application object.
java.lang.ClassNotFoundException
- Raised if the given class could not be found.public AppConfig()
Method Detail |
---|
public static AppConfig addApplication(java.lang.String regname, java.lang.String classname, java.lang.String args, int group, boolean inExecJVM) throws ConfigurationException
regname
- the registry name for this applicationclassname
- the class nameargs
- argument stringgroup
- the group identifier for the applicationinExecJVM
- must be true if the application should be started in the execution daemon JVM.
if set to false, the application will be started in a separate process.
ConfigurationException
- if the specified class name is already registeredpublic static void addApplications(AppConfig[] apps) throws ConfigurationException
apps
-
ConfigurationException
public static AppConfig[] getApplications()
public static AppConfig getApplication(java.lang.String name)
AppConfig
object associated with the
specified name. The name may be either the registry name or the
class name of the application.
java.lang.NullPointerException
- Raised if the specified name has no corresponding class in the
applications configuration.public static AppConfig getApplication(java.lang.Object appObj)
AppConfig
object associated with the
specified object instance.
java.lang.NullPointerException
- Raised if the specified object instance name has no
corresponding class in the applications configuration.public static AppConfig getApplication(java.lang.Class cl)
AppConfig
object associated with the
specified class.
java.lang.NullPointerException
- Raised if the specified class has no corresponding class
in the applications configuration.public static AppConfig getApplication(int gid)
AppConfig
object associated with the
specified group identifier.
java.lang.NullPointerException
- Raised if the specified group identifier has no corresponding application
in the applications configuration.public static void setDistributionScheme(DistributionScheme distScheme)
public void parse(org.w3c.dom.Element elm) throws ConfigurationException
parse
in interface ConfigurationObject
ConfigurationException
public java.lang.String getRegistryName()
public ClassData getClassData()
public void setProperties(java.util.Map<java.lang.String,java.lang.String> properties)
public int getGroupId()
public java.lang.String getClassName()
public java.lang.String[] getClassArgs()
public boolean startInExecJVM()
public java.lang.String getParam(java.lang.String name) throws java.util.NoSuchElementException
name
- The name of the parameter to retreive from the parameter map.
java.util.NoSuchElementException
- Raised if the given parameter name was not found in the internal
parameter map, or if there is no parameters associated with this
application.public java.lang.String getParam(java.lang.String name, java.lang.String defaultVal)
name
- The name of the parameter to retreive from the parameter map.defaultVal
- The default value to return if the given parameter is not
defined in the parameter map.
public int getIntParam(java.lang.String name) throws java.util.NoSuchElementException
name
- The name of the parameter to retreive from the parameter map.
int
parameter value associated with the given
parameter name.
java.util.NoSuchElementException
- Raised if the given parameter name was not found in the internal
parameter map.public int getIntParam(java.lang.String name, int defaultValue)
name
- The name of the parameter to retreive from the parameter map.defaultValue
- The default value of the parameter to be return if no value
is available in the parameter map.
int
parameter value associated with the given
parameter name. If the parameter have no specified value for
the associated application, we return the provided default value.public boolean getBooleanParam(java.lang.String name)
name
- The name of the parameter to retreive from the parameter map.
boolean
parameter value associated with the given
parameter name. If the parameter have no specified value for
the associated application, false is returned.public java.lang.String[] getServiceSet()
String[]
of services used by this application,
ordered from the lowest layer at index position zero.
java.lang.IllegalStateException
- Raised if the service set has not yet been initialized.public boolean hasService(java.lang.String service)
java.lang.IllegalStateException
- Raised if the service set has not yet been initialized.public RecoveryStrategy getRecoveryStrategy()
public void setRedundancy(int minimal, int initial) throws ConfigurationException
initial
- initial redundancy for this applicationminimal
- minimal redundancy for this application
ConfigurationException
- if the redundancy specifications are out of bound.public int getInitialRedundancy()
public int getMinimalRedundancy()
public int getCurrentGroupSize()
public boolean needsRecovery()
public void viewChange(View view)
public View getView()
public HostSet getViewHosts()
public void setRecoveryStrategy(java.lang.String strategy) throws ConfigurationException
strategy
- class name denoting the recovery strategy
ConfigurationException
- if the recovery strategy is not supported.public void setServiceSet(java.lang.String stackOrder) throws ConfigurationException
stackOrder
- The colon separate string of services that this application
requires.
ConfigurationException
- Thrown if the string contains an unspecified service.public void addService(java.lang.String serviceName) throws ConfigurationException
serviceName
- The service name to add to the application.
ConfigurationException
public void addParam(java.lang.String name, java.lang.String value) throws ConfigurationException
name
- The name of the parameter to add to the map.value
- The value to associate with the parameter.
ConfigurationException
- Raised if the given parameter name already exists within the
internal parameter map.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(boolean full)
full
parameter is false, only a short version
is returned, otherwise a full version is returned.
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
Externalizable.readExternal(ObjectInput)
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
Externalizable.writeExternal(ObjectOutput)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |