Class DefaultStateManager
- java.lang.Object
-
- org.apache.axis2.clustering.state.DefaultStateManager
-
- All Implemented Interfaces:
StateManager,ParameterInclude
public class DefaultStateManager extends Object implements StateManager
This class is the defaut StateManager of the Apache Tribes based clustering implementation
-
-
Constructor Summary
Constructors Constructor Description DefaultStateManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddParameter(Parameter param)Method addParameter.voiddeserializeParameters(OMElement parameterElement)ParametergetParameter(String name)Method getParameter.ArrayListgetParameters()Gets all the parameters in a given description.MapgetReplicationExcludePatterns()Get all the excluded context property name patternsbooleanisContextClusterable(AbstractContext context)This is a check to see whether the properties in an instance ofAbstractContextshould be replicated.booleanisParameterLocked(String parameterName)Checks whether the parameter is locked at any level.voidremoveContext(AbstractContext context)This method is called whenAbstractContextis removed from the systemvoidremoveParameter(Parameter param)voidreplicateState(StateClusteringCommand command)Replicate state using a custom StateClusteringCommandvoidsetConfigurationContext(ConfigurationContext configurationContext)Set the system's configuration context.voidsetReplicationExcludePatterns(String contextType, List patterns)All properties in the context with typecontextTypewhich have names that match the specified pattern will be excluded from replication.voidsetSender(ChannelSender sender)voidupdateContext(AbstractContext context)This method is called when properties in anAbstractContextare updated.voidupdateContext(AbstractContext context, String[] propertyNames)This method is called when one need to update/replicate only certains properties in the specifiedcontextvoidupdateContexts(AbstractContext[] contexts)This method is called when properties in a collection ofAbstractContexts are updated.
-
-
-
Method Detail
-
setSender
public void setSender(ChannelSender sender)
-
updateContext
public void updateContext(AbstractContext context) throws ClusteringFault
Description copied from interface:StateManagerThis method is called when properties in anAbstractContextare updated. This could be addition of new properties, modifications of existing properties or removal of properties.- Specified by:
updateContextin interfaceStateManager- Parameters:
context- The context to be replicated- Throws:
ClusteringFault- If replication fails
-
updateContext
public void updateContext(AbstractContext context, String[] propertyNames) throws ClusteringFault
Description copied from interface:StateManagerThis method is called when one need to update/replicate only certains properties in the specifiedcontext- Specified by:
updateContextin interfaceStateManager- Parameters:
context- The AbstractContext containing the properties to be replicatedpropertyNames- The names of the specific properties that should be replicated- Throws:
ClusteringFault- If replication fails
-
updateContexts
public void updateContexts(AbstractContext[] contexts) throws ClusteringFault
Description copied from interface:StateManagerThis method is called when properties in a collection ofAbstractContexts are updated. This could be addition of new properties, modifications of existing properties or removal of properties.- Specified by:
updateContextsin interfaceStateManager- Parameters:
contexts- The AbstractContexts containing the properties to be replicated- Throws:
ClusteringFault- If replication fails
-
replicateState
public void replicateState(StateClusteringCommand command) throws ClusteringFault
Description copied from interface:StateManagerReplicate state using a custom StateClusteringCommand- Specified by:
replicateStatein interfaceStateManager- Parameters:
command- The custom StateClusteringCommand which can be used for replicating state- Throws:
ClusteringFault- If replication fails
-
removeContext
public void removeContext(AbstractContext context) throws ClusteringFault
Description copied from interface:StateManagerThis method is called whenAbstractContextis removed from the system- Specified by:
removeContextin interfaceStateManager- Parameters:
context- The AbstractContext to be removed- Throws:
ClusteringFault- If context removal fails
-
isContextClusterable
public boolean isContextClusterable(AbstractContext context)
Description copied from interface:StateManagerThis is a check to see whether the properties in an instance ofAbstractContextshould be replicated. This allows an implementer to dissallow the replication of properties stored in a certain type of context- Specified by:
isContextClusterablein interfaceStateManager- Parameters:
context- The instance of AbstractContext under consideration- Returns:
- True - if the provided
AbstractContextis clusterable
-
setConfigurationContext
public void setConfigurationContext(ConfigurationContext configurationContext)
Description copied from interface:StateManagerSet the system's configuration context. This will be used by the clustering implementations to get information about the Axis2 environment and to correspond with the Axis2 environment- Specified by:
setConfigurationContextin interfaceStateManager- Parameters:
configurationContext- The configuration context
-
setReplicationExcludePatterns
public void setReplicationExcludePatterns(String contextType, List patterns)
Description copied from interface:StateManagerAll properties in the context with type
contextTypewhich have names that match the specified pattern will be excluded from replication.Only prefixes and suffixes are allowed. e.g. the local_* pattern indicates that all property names starting with local_ should be omitted from replication. *_local pattern indicated that all property names ending with _local should be omitted from replication. * pattern indicates that all properties should be excluded.
Generally, we can use the context class name as the context type.
- Specified by:
setReplicationExcludePatternsin interfaceStateManager- Parameters:
contextType- The type of the context such as org.apache.axis2.context.ConfigurationContext, org.apache.axis2.context.ServiceGroupContext & org.apache.axis2.context.ServiceContext. Also "defaults" is a special type, which will apply to all contextspatterns- The patterns
-
getReplicationExcludePatterns
public Map getReplicationExcludePatterns()
Description copied from interface:StateManagerGet all the excluded context property name patterns- Specified by:
getReplicationExcludePatternsin interfaceStateManager- Returns:
- All the excluded pattern of all the contexts. The key of the Map is the
the
contextType. SeeStateManager.setReplicationExcludePatterns(String,List). The values are of typeListofStringObjects, which are a collection of patterns to be excluded. - See Also:
StateManager.setReplicationExcludePatterns(String, java.util.List)
-
addParameter
public void addParameter(Parameter param) throws AxisFault
Description copied from interface:ParameterIncludeMethod addParameter.- Specified by:
addParameterin interfaceParameterInclude- Throws:
AxisFault
-
removeParameter
public void removeParameter(Parameter param) throws AxisFault
- Specified by:
removeParameterin interfaceParameterInclude- Throws:
AxisFault
-
getParameter
public Parameter getParameter(String name)
Description copied from interface:ParameterIncludeMethod getParameter.- Specified by:
getParameterin interfaceParameterInclude- Returns:
- Returns Parameter.
-
getParameters
public ArrayList getParameters()
Description copied from interface:ParameterIncludeGets all the parameters in a given description.- Specified by:
getParametersin interfaceParameterInclude- Returns:
- Returns ArrayList.
-
isParameterLocked
public boolean isParameterLocked(String parameterName)
Description copied from interface:ParameterIncludeChecks whether the parameter is locked at any level.- Specified by:
isParameterLockedin interfaceParameterInclude
-
deserializeParameters
public void deserializeParameters(OMElement parameterElement) throws AxisFault
- Specified by:
deserializeParametersin interfaceParameterInclude- Throws:
AxisFault
-
-