Package org.apache.axis2.context
Class AbstractContext
- java.lang.Object
- 
- org.apache.axis2.context.AbstractContext
 
- 
- Direct Known Subclasses:
- ConfigurationContext,- MessageContext,- OperationContext,- ServiceContext,- ServiceGroupContext,- SessionContext
 
 public abstract class AbstractContext extends Object This is the top most level of the Context hierarchy and is a bag of properties.
- 
- 
Field SummaryFields Modifier and Type Field Description static StringCOPY_PROPERTIESProperty used to indicate copying of properties is needed by context.protected longlastTouchedTimeprotected AbstractContextparentprotected Map<String,Object>properties
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedAbstractContext()protectedAbstractContext(AbstractContext parent)
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclearPropertyDifferences()Once the clustering mechanism transmits the property differences, it should call this method to avoid retransmitting stuff that has already been sent.voidflush()longgetLastTouchedTime()ObjectgetLocalProperty(String key)Retrieves an object given a key.AbstractContextgetParent()Map<String,Object>getProperties()Deprecated.ObjectgetProperty(String key)Retrieves an object given a key.Map<String,Object>getPropertyDifferences()Get the property differences since the last transmission by the clustering mechanismIterator<String>getPropertyNames()An iterator over a collection ofStringobjects, which are the keys in the properties object.ObjectgetPropertyNonReplicable(String key)Retrieves an object given a key.abstract ConfigurationContextgetRootContext()booleanisAncestor(AbstractContext context)voidmergeProperties(Map<String,Object> props)This will do a copy of the given properties to the current properties table.voidremoveProperty(String key)Remove a property.voidremovePropertyNonReplicable(String key)Remove a property.voidsetLastTouchedTime(long t)voidsetNonReplicableProperty(String key, Object value)Store a property in this context.voidsetParent(AbstractContext context)voidsetProperties(Map<String,Object> properties)This will set the properties to the context.voidsetProperty(String key, Object value)Store a property in this contextprotected voidtouch()ServiceContext and ServiceGroupContext are not getting automatically garbage collected.
 
- 
- 
- 
Field Detail- 
COPY_PROPERTIESpublic static final String COPY_PROPERTIES Property used to indicate copying of properties is needed by context.- See Also:
- Constant Field Values
 
 - 
lastTouchedTimeprotected long lastTouchedTime 
 - 
parentprotected transient AbstractContext parent 
 
- 
 - 
Constructor Detail- 
AbstractContextprotected AbstractContext(AbstractContext parent) 
 - 
AbstractContextprotected AbstractContext() 
 
- 
 - 
Method Detail- 
getParentpublic AbstractContext getParent() - Returns:
- Returns the parent of this context.
 
 - 
isAncestorpublic boolean isAncestor(AbstractContext context) - Parameters:
- context-
- Returns:
- true if the context is an ancestor
 
 - 
getPropertyNamespublic Iterator<String> getPropertyNames() An iterator over a collection ofStringobjects, which are the keys in the properties object.- Returns:
- Iterator over a collection of keys
 
 - 
getPropertypublic Object getProperty(String key) Retrieves an object given a key.- Parameters:
- key- - if not found, will return null
- Returns:
- Returns the property.
 
 - 
getLocalPropertypublic Object getLocalProperty(String key) Retrieves an object given a key. Only searches at this level i.e. getLocalProperty on MessageContext does not look in the OperationContext properties map if a local result is not found.- Parameters:
- key- - if not found, will return null
- Returns:
- Returns the property.
 
 - 
getPropertyNonReplicablepublic Object getPropertyNonReplicable(String key) Retrieves an object given a key. The retrieved property will not be replicated to other nodes in the clustered scenario.- Parameters:
- key- - if not found, will return null
- Returns:
- Returns the property.
 
 - 
setPropertypublic void setProperty(String key, Object value) Store a property in this context- Parameters:
- key-
- value-
 
 - 
setNonReplicablePropertypublic void setNonReplicableProperty(String key, Object value) Store a property in this context. But these properties should not be replicated when Axis2 is clustered.- Parameters:
- key-
- value-
 
 - 
removePropertypublic void removeProperty(String key) Remove a property. Only properties at this level will be removed. Properties of the parents cannot be removed using this method.- Parameters:
- key-
 
 - 
removePropertyNonReplicablepublic void removePropertyNonReplicable(String key) Remove a property. Only properties at this level will be removed. Properties of the parents cannot be removed using this method. The removal of the property will not be replicated when Axis2 is clustered.- Parameters:
- key-
 
 - 
getPropertyDifferencespublic Map<String,Object> getPropertyDifferences() Get the property differences since the last transmission by the clustering mechanism- Returns:
- The property differences
 
 - 
clearPropertyDifferencespublic void clearPropertyDifferences() Once the clustering mechanism transmits the property differences, it should call this method to avoid retransmitting stuff that has already been sent.
 - 
setParentpublic void setParent(AbstractContext context) - Parameters:
- context-
 
 - 
setPropertiespublic void setProperties(Map<String,Object> properties) This will set the properties to the context. But in setting that one may need to "copy" all the properties from the source properties to the target properties. To enable this we introduced a property (COPY_PROPERTIES) so that if set to true, this code will copy the whole thing, without just referencing to the source.- Parameters:
- properties-
 
 - 
mergePropertiespublic void mergeProperties(Map<String,Object> props) This will do a copy of the given properties to the current properties table.- Parameters:
- props- The table of properties to copy
 
 - 
touchprotected void touch() ServiceContext and ServiceGroupContext are not getting automatically garbage collected. And there is no specific way for some one to go and make it garbage collectible. So the current solution is to make them time out. So the logic is that, there is a timer task in each and every service group which will check for the last touched time. And if it has not been touched for some time, the timer task will remove it from the memory. The touching logic happens like this. Whenever there is a call to addMessageContext in the operationContext it will go and update operationCOntext -> serviceContext -> serviceGroupContext.
 - 
getLastTouchedTimepublic long getLastTouchedTime() 
 - 
setLastTouchedTimepublic void setLastTouchedTime(long t) 
 - 
getRootContextpublic abstract ConfigurationContext getRootContext() 
 
- 
 
-