org.apache.axis2.context
Class ConfigurationContext

java.lang.Object
  extended by org.apache.axis2.context.AbstractContext
      extended by org.apache.axis2.context.ConfigurationContext

public class ConfigurationContext
extends AbstractContext

Axis2 states are held in two information models, called description hierarchy and context hierarchy. Description hierarchy hold deployment configuration and it's values does not change unless deployment configuration change occurs where Context hierarchy hold run time information. Both hierarchies consists four levels, Global, Service Group, Operation and Message. Please look at "Information Model" section of "Axis2 Architecture Guide" for more information.

Configuration Context hold Global level run-time information. This allows same configurations to be used by two Axis2 instances and most Axis2 wide configurations can changed by setting name value pairs of the configurationContext. This hold all OperationContexts, ServiceGroups, Sessions, and ListenerManager.


Field Summary
protected  java.util.List contextListeners
           
 
Fields inherited from class org.apache.axis2.context.AbstractContext
COPY_PROPERTIES, lastTouchedTime, parent, properties
 
Constructor Summary
ConfigurationContext(AxisConfiguration axisConfiguration)
           
 
Method Summary
 void addContextListener(ContextListener contextListener)
          Register a ContextListener to be notified of all sub-context events.
 void addServiceGroupContextIntoApplicationScopeTable(ServiceGroupContext serviceGroupContext)
           
 void addServiceGroupContextIntoSoapSessionTable(ServiceGroupContext serviceGroupContext)
           
 void cleanupContexts()
           
 MessageContext createMessageContext()
          Create a MessageContext, and notify any registered ContextListener.
 ServiceGroupContext createServiceGroupContext(AxisServiceGroup serviceGroup)
          Create a ServiceGroupContext for the specified service group, and notify any registered ContextListener.
 void deployService(AxisService service)
          Deploy a service to the embedded AxisConfiguration, and initialize it.
 void fillServiceContextAndServiceGroupContext(MessageContext messageContext)
          Searches for a ServiceGroupContext in the map with given id as the key.
protected  void finalize()
           
 OperationContext findOperationContext(java.lang.String operationName, java.lang.String serviceName, java.lang.String serviceGroupName)
           
 AxisConfiguration getAxisConfiguration()
           
 java.lang.String getContextRoot()
           
 ListenerManager getListenerManager()
           
 OperationContext getOperationContext(java.lang.String id)
          Gets a OperationContext given a Message ID.
 java.io.File getRealPath(java.lang.String path)
          Allows users to resolve the path relative to the root diretory.
 ConfigurationContext getRootContext()
           
 java.lang.String getServiceContextPath()
           
 ServiceGroupContext getServiceGroupContext(java.lang.String serviceGroupCtxId)
          Returns a ServiceGroupContext object associated with the specified ID from the internal table.
 ServiceGroupContext getServiceGroupContextFromSoapSessionTable(java.lang.String serviceGroupContextId, MessageContext msgContext)
           
 java.lang.String[] getServiceGroupContextIDs()
          Gets all service groups in the system.
 java.util.Hashtable getServiceGroupContexts()
          Deprecated. Use getServiceGroupContextIDs() & getServiceGroupContext(String)
 long getServiceGroupContextTimoutInterval()
          This will be used to fetch the serviceGroupContextTimoutInterval from any place available.
 java.lang.String getServicePath()
           
 ThreadFactory getThreadPool()
          Returns the thread factory.
 void initCluster()
           
 boolean registerOperationContext(java.lang.String messageID, OperationContext mepContext)
          Registers a OperationContext with a given message ID.
 void removeContextListener(ContextListener contextListener)
          Remove an already registered ContextListener
 void removeServiceGroupContext(AxisServiceGroup serviceGroup)
           
 void removeServiceGroupContext(java.lang.String serviceGroupContextId)
          Remove a ServiceGroupContext
 void setAxisConfiguration(AxisConfiguration configuration)
           
 void setContextRoot(java.lang.String contextRoot)
           
 void setServicePath(java.lang.String servicePath)
           
 void setThreadPool(ThreadFactory pool)
          Sets the thread factory.
 void setTransportManager(ListenerManager listenerManager)
           
 void terminate()
           
 void unregisterOperationContext(java.lang.String key)
          Unregisters the operation context associated with the given messageID
 
Methods inherited from class org.apache.axis2.context.AbstractContext
clearPropertyDifferences, flush, getLastTouchedTime, getParent, getProperties, getProperty, getPropertyDifferences, getPropertyNames, getPropertyNonReplicable, mergeProperties, removeProperty, removePropertyNonReplicable, setLastTouchedTime, setNonReplicableProperty, setParent, setProperties, setProperty, touch
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contextListeners

protected java.util.List contextListeners
Constructor Detail

ConfigurationContext

public ConfigurationContext(AxisConfiguration axisConfiguration)
Method Detail

initCluster

public void initCluster()
                 throws AxisFault
Throws:
AxisFault

addContextListener

public void addContextListener(ContextListener contextListener)
Register a ContextListener to be notified of all sub-context events.

Parameters:
contextListener - A ContextListener
See Also:
removeContextListener(org.apache.axis2.context.ContextListener)

removeContextListener

public void removeContextListener(ContextListener contextListener)
Remove an already registered ContextListener

Parameters:
contextListener - A ContextListener
See Also:
addContextListener(org.apache.axis2.context.ContextListener)

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

fillServiceContextAndServiceGroupContext

public void fillServiceContextAndServiceGroupContext(MessageContext messageContext)
                                              throws AxisFault
Searches for a ServiceGroupContext in the map with given id as the key.
 If(key != null && found)
 check for a service context for the intended service.
 if (!found)
 create one and hook up to ServiceGroupContext
 else
 create new ServiceGroupContext with the given key or if key is null with a new key
 create a new service context for the service
 

Parameters:
messageContext - : MessageContext
Throws:
AxisFault - : If something goes wrong

registerOperationContext

public boolean registerOperationContext(java.lang.String messageID,
                                        OperationContext mepContext)
Registers a OperationContext with a given message ID. If the given message id already has a registered operation context, no change is made and the methid resturns false.

Parameters:
messageID - the message-id to register
mepContext - the OperationContext for the specified message-id
Returns:
true if we added a new context, false if the messageID was already there and we did nothing

unregisterOperationContext

public void unregisterOperationContext(java.lang.String key)
Unregisters the operation context associated with the given messageID

Parameters:
key -

addServiceGroupContextIntoSoapSessionTable

public void addServiceGroupContextIntoSoapSessionTable(ServiceGroupContext serviceGroupContext)

addServiceGroupContextIntoApplicationScopeTable

public void addServiceGroupContextIntoApplicationScopeTable(ServiceGroupContext serviceGroupContext)

deployService

public void deployService(AxisService service)
                   throws AxisFault
Deploy a service to the embedded AxisConfiguration, and initialize it.

Parameters:
service - service to deploy
Throws:
AxisFault - if there's a problem

getAxisConfiguration

public AxisConfiguration getAxisConfiguration()

getOperationContext

public OperationContext getOperationContext(java.lang.String id)
Gets a OperationContext given a Message ID.

Parameters:
id -
Returns:
Returns OperationContext OperationContext

findOperationContext

public OperationContext findOperationContext(java.lang.String operationName,
                                             java.lang.String serviceName,
                                             java.lang.String serviceGroupName)

createMessageContext

public MessageContext createMessageContext()
Create a MessageContext, and notify any registered ContextListener.

Returns:
a new MessageContext

createServiceGroupContext

public ServiceGroupContext createServiceGroupContext(AxisServiceGroup serviceGroup)
Create a ServiceGroupContext for the specified service group, and notify any registered ContextListener.

Parameters:
serviceGroup - an AxisServiceGroup
Returns:
a new ServiceGroupContext

getRealPath

public java.io.File getRealPath(java.lang.String path)
Allows users to resolve the path relative to the root diretory.

Parameters:
path -
Returns:

getServiceGroupContextFromSoapSessionTable

public ServiceGroupContext getServiceGroupContextFromSoapSessionTable(java.lang.String serviceGroupContextId,
                                                                      MessageContext msgContext)
                                                               throws AxisFault
Throws:
AxisFault

getServiceGroupContext

public ServiceGroupContext getServiceGroupContext(java.lang.String serviceGroupCtxId)
Returns a ServiceGroupContext object associated with the specified ID from the internal table.

Parameters:
serviceGroupCtxId - The ID string associated with the ServiceGroupContext object
Returns:
The ServiceGroupContext object, or null if not found

getServiceGroupContextIDs

public java.lang.String[] getServiceGroupContextIDs()
Gets all service groups in the system.

Returns:
Returns hashmap of ServiceGroupContexts.

getServiceGroupContexts

public java.util.Hashtable getServiceGroupContexts()
Deprecated. Use getServiceGroupContextIDs() & getServiceGroupContext(String)

Returns:
The ServiceGroupContexts

getThreadPool

public ThreadFactory getThreadPool()
Returns the thread factory.

Returns:
Returns configuration specific thread pool

setAxisConfiguration

public void setAxisConfiguration(AxisConfiguration configuration)
Parameters:
configuration -

setThreadPool

public void setThreadPool(ThreadFactory pool)
                   throws AxisFault
Sets the thread factory.

Parameters:
pool - The thread pool
Throws:
AxisFault - If a thread pool has already been set

removeServiceGroupContext

public void removeServiceGroupContext(java.lang.String serviceGroupContextId)
Remove a ServiceGroupContext

Parameters:
serviceGroupContextId - The ID of the ServiceGroupContext

getListenerManager

public ListenerManager getListenerManager()

setTransportManager

public void setTransportManager(ListenerManager listenerManager)

cleanupContexts

public void cleanupContexts()

terminate

public void terminate()
               throws AxisFault
Throws:
AxisFault

getServiceContextPath

public java.lang.String getServiceContextPath()

getServicePath

public java.lang.String getServicePath()

setServicePath

public void setServicePath(java.lang.String servicePath)

getContextRoot

public java.lang.String getContextRoot()

setContextRoot

public void setContextRoot(java.lang.String contextRoot)

getServiceGroupContextTimoutInterval

public long getServiceGroupContextTimoutInterval()
This will be used to fetch the serviceGroupContextTimoutInterval from any place available.

Returns:
long

removeServiceGroupContext

public void removeServiceGroupContext(AxisServiceGroup serviceGroup)

getRootContext

public ConfigurationContext getRootContext()
Specified by:
getRootContext in class AbstractContext


Copyright © 2007 Apache Web Services Project. All Rights Reserved.