org.apache.axis2.clustering.state
Class DefaultStateManager

java.lang.Object
  extended by 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
DefaultStateManager()
           
 
Method Summary
 void addParameter(Parameter param)
          Method addParameter.
 void deserializeParameters(org.apache.axiom.om.OMElement parameterElement)
           
 Parameter getParameter(String name)
          Method getParameter.
 ArrayList getParameters()
          Gets all the parameters in a given description.
 Map getReplicationExcludePatterns()
          Get all the excluded context property name patterns
 boolean isContextClusterable(AbstractContext context)
          This is a check to see whether the properties in an instance of AbstractContext should be replicated.
 boolean isParameterLocked(String parameterName)
          Checks whether the parameter is locked at any level.
 void removeContext(AbstractContext context)
          This method is called when AbstractContext is removed from the system
 void removeParameter(Parameter param)
           
 void replicateState(StateClusteringCommand command)
          Replicate state using a custom StateClusteringCommand
 void setConfigurationContext(ConfigurationContext configurationContext)
          Set the system's configuration context.
 void setReplicationExcludePatterns(String contextType, List patterns)
           All properties in the context with type contextType which have names that match the specified pattern will be excluded from replication.
 void setSender(ChannelSender sender)
           
 void updateContext(AbstractContext context)
          This method is called when properties in an AbstractContext are updated.
 void updateContext(AbstractContext context, String[] propertyNames)
          This method is called when one need to update/replicate only certains properties in the specified context
 void updateContexts(AbstractContext[] contexts)
          This method is called when properties in a collection of AbstractContexts are updated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultStateManager

public DefaultStateManager()
Method Detail

setSender

public void setSender(ChannelSender sender)

updateContext

public void updateContext(AbstractContext context)
                   throws ClusteringFault
Description copied from interface: StateManager
This method is called when properties in an AbstractContext are updated. This could be addition of new properties, modifications of existing properties or removal of properties.

Specified by:
updateContext in interface StateManager
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: StateManager
This method is called when one need to update/replicate only certains properties in the specified context

Specified by:
updateContext in interface StateManager
Parameters:
context - The AbstractContext containing the properties to be replicated
propertyNames - 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: StateManager
This method is called when properties in a collection of AbstractContexts are updated. This could be addition of new properties, modifications of existing properties or removal of properties.

Specified by:
updateContexts in interface StateManager
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: StateManager
Replicate state using a custom StateClusteringCommand

Specified by:
replicateState in interface StateManager
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: StateManager
This method is called when AbstractContext is removed from the system

Specified by:
removeContext in interface StateManager
Parameters:
context - The AbstractContext to be removed
Throws:
ClusteringFault - If context removal fails

isContextClusterable

public boolean isContextClusterable(AbstractContext context)
Description copied from interface: StateManager
This is a check to see whether the properties in an instance of AbstractContext should be replicated. This allows an implementer to dissallow the replication of properties stored in a certain type of context

Specified by:
isContextClusterable in interface StateManager
Parameters:
context - The instance of AbstractContext under consideration
Returns:
True - if the provided AbstractContext is clusterable

setConfigurationContext

public void setConfigurationContext(ConfigurationContext configurationContext)
Description copied from interface: StateManager
Set 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:
setConfigurationContext in interface StateManager
Parameters:
configurationContext - The configuration context

setReplicationExcludePatterns

public void setReplicationExcludePatterns(String contextType,
                                          List patterns)
Description copied from interface: StateManager

All properties in the context with type contextType which 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:
setReplicationExcludePatterns in interface StateManager
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 contexts
patterns - The patterns

getReplicationExcludePatterns

public Map getReplicationExcludePatterns()
Description copied from interface: StateManager
Get all the excluded context property name patterns

Specified by:
getReplicationExcludePatterns in interface StateManager
Returns:
All the excluded pattern of all the contexts. The key of the Map is the the contextType. See StateManager.setReplicationExcludePatterns(String,List). The values are of type List of String Objects, 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: ParameterInclude
Method addParameter.

Specified by:
addParameter in interface ParameterInclude
Throws:
AxisFault

removeParameter

public void removeParameter(Parameter param)
                     throws AxisFault
Specified by:
removeParameter in interface ParameterInclude
Throws:
AxisFault

getParameter

public Parameter getParameter(String name)
Description copied from interface: ParameterInclude
Method getParameter.

Specified by:
getParameter in interface ParameterInclude
Returns:
Returns Parameter.

getParameters

public ArrayList getParameters()
Description copied from interface: ParameterInclude
Gets all the parameters in a given description.

Specified by:
getParameters in interface ParameterInclude
Returns:
Returns ArrayList.

isParameterLocked

public boolean isParameterLocked(String parameterName)
Description copied from interface: ParameterInclude
Checks whether the parameter is locked at any level.

Specified by:
isParameterLocked in interface ParameterInclude

deserializeParameters

public void deserializeParameters(org.apache.axiom.om.OMElement parameterElement)
                           throws AxisFault
Specified by:
deserializeParameters in interface ParameterInclude
Throws:
AxisFault


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.