You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by de...@apache.org on 2005/05/10 07:45:39 UTC

svn commit: r169417 - in /webservices/axis/trunk/java/modules/core/src/org/apache/axis: context/ deployment/ phaseresolver/

Author: deepal
Date: Mon May  9 22:45:37 2005
New Revision: 169417

URL: http://svn.apache.org/viewcvs?rev=169417&view=rev
Log:
The handler chanin building logigc moved to deployment section, when a service is deployed will creasts all the handler chain for that service (This has to be change , handler chain should build by some one else not by deployment)

Modified:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/AbstractContext.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/EngineContextFactory.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MessageContext.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContext.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContextFactory.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/ServiceContext.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/SessionContext.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/SystemContext.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/AbstractContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/AbstractContext.java?rev=169417&r1=169416&r2=169417&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/AbstractContext.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/AbstractContext.java Mon May  9 22:45:37 2005
@@ -20,6 +20,7 @@
  *
  * 
  */
+
 public abstract class AbstractContext implements Serializable {
 
     protected transient final HashMap nonPersistentMap;
@@ -36,6 +37,7 @@
      * Store an object. depending on the persistent flag the
      * object is either saved in the persistent way or the non-persistent
      * way
+     *
      * @param key
      * @param value
      * @param persistent
@@ -51,15 +53,18 @@
     /**
      * Store an object with the default persistent flag.
      * default is no persistance
+     *
      * @param key
      * @param value
      */
     public void setProperty(Object key, Object value) {
         this.setProperty(key, value, false);
     }
+
     /**
      * Retrieve an object. Default search is done in the non persistent
      * group
+     *
      * @param key
      * @return
      */
@@ -68,7 +73,6 @@
     }
 
     /**
-     *
      * @param key
      * @param persistent
      * @return

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/EngineContextFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/EngineContextFactory.java?rev=169417&r1=169416&r2=169417&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/EngineContextFactory.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/EngineContextFactory.java Mon May  9 22:45:37 2005
@@ -1,12 +1,5 @@
 package org.apache.axis.context;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
 import org.apache.axis.deployment.DeploymentEngine;
 import org.apache.axis.deployment.DeploymentException;
 import org.apache.axis.description.AxisModule;
@@ -19,6 +12,12 @@
 import org.apache.axis.phaseresolver.PhaseException;
 import org.apache.axis.phaseresolver.PhaseResolver;
 
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
 /**
  * Created by IntelliJ IDEA.
  * Author : Deepal Jayasinghe
@@ -37,90 +36,88 @@
             phaseResolver.buildTranspotsChains();
             initModules(engineContext);
         } catch (AxisFault axisFault) {
-            throw new DeploymentException(axisFault.getMessage()) ;
+            throw new DeploymentException(axisFault.getMessage());
         } catch (PhaseException e) {
-            throw new DeploymentException(e.getMessage()) ;
+            throw new DeploymentException(e.getMessage());
         }
         return engineContext;
     }
 
     public SystemContext buildClientEngineContext(String axis2home) throws DeploymentException {
-            SystemContext engineContext = null;
-            try {
-                DeploymentEngine deploymentEngine = new DeploymentEngine(axis2home);
-                AxisSystem configuration = deploymentEngine.loadClient();
-                PhaseResolver phaseResolver = new PhaseResolver(configuration);
-                engineContext = phaseResolver.buildGlobalChains();
-                phaseResolver.buildTranspotsChains();
-                initModules(engineContext);
-            } catch (AxisFault axisFault) {
-                throw new DeploymentException(axisFault.getMessage()) ;
-            } catch (PhaseException e) {
-                throw new DeploymentException(e.getMessage()) ;
-            }
-            return engineContext;
+        SystemContext engineContext = null;
+        try {
+            DeploymentEngine deploymentEngine = new DeploymentEngine(axis2home);
+            AxisSystem configuration = deploymentEngine.loadClient();
+            PhaseResolver phaseResolver = new PhaseResolver(configuration);
+            engineContext = phaseResolver.buildGlobalChains();
+            phaseResolver.buildTranspotsChains();
+            initModules(engineContext);
+        } catch (AxisFault axisFault) {
+            throw new DeploymentException(axisFault.getMessage());
+        } catch (PhaseException e) {
+            throw new DeploymentException(e.getMessage());
         }
+        return engineContext;
+    }
 
-   /**
-    * Is used to initilize the modules , if the module needs to so some recovery process
-    * it can do inside init and this is differnt form module.engage()
-    * @param context
-    * @throws DeploymentException
-    */
+    /**
+     * Is used to initilize the modules , if the module needs to so some recovery process
+     * it can do inside init and this is differnt form module.engage()
+     *
+     * @param context
+     * @throws DeploymentException
+     */
 
 
     private void initModules(SystemContext context) throws DeploymentException {
-        try{
-            HashMap modules = ((AxisSystemImpl)context.getEngineConfig()).getModules();
+        try {
+            HashMap modules = ((AxisSystemImpl) context.getEngineConfig()).getModules();
             Collection col = modules.values();
             for (Iterator iterator = col.iterator(); iterator.hasNext();) {
-                AxisModule  axismodule = (AxisModule)iterator.next();
+                AxisModule axismodule = (AxisModule) iterator.next();
                 Module module = axismodule.getModule();
-                if(module != null ){
+                if (module != null) {
                     module.init(context);
                 }
             }
-        }catch (AxisFault e){
+        } catch (AxisFault e) {
             throw new DeploymentException(e.getMessage());
         }
     }
 
-//    public ServiceContext createServiceContext(AxisService service,EngineContext context) throws PhaseException {
-//        try {
-//            ServiceContext serviceContext = new ServiceContext(service,context);
-//            PhaseResolver reolve = new PhaseResolver(context.getEngineConfig(),serviceContext);
-//            context.addService(serviceContext);
-//            serviceContext = reolve.buildchains();
-//            engageModules(service,context);
-//            return serviceContext;
-//        } catch (PhaseException e) {
-//            throw new PhaseException(e.getMessage()) ;
-//        } catch (AxisFault axisFault) {
-//            throw new PhaseException(axisFault.getMessage()) ;
-//        }
-//    }
-
-    private void engageModules(AxisService service,SystemContext context) throws AxisFault {
-       ArrayList servicemodules = (ArrayList)service.getModules();
-       ArrayList opModules ;
-       Module module ;
-       Collection operations = service.getOperations().values();
-       for (Iterator iterator = operations.iterator(); iterator.hasNext();) {
-           AxisOperation operation = (AxisOperation) iterator.next();
-           opModules = (ArrayList)operation.getModules();
-           for (int i = 0; i < servicemodules.size(); i++) {
-               QName moduleName = (QName) servicemodules.get(i);
-               module = context.getEngineConfig().getModule(moduleName).getModule();
-               //todo AxisOperation shoud have a method to get chains
-               /*ExecutionChain inchain = new ExecutionChain();
-               inchain.addPhases(operation.getPhases(EngineConfiguration.INFLOW));
-               module.engage(inchain);*/
-           }
-           for (int i = 0; i < opModules.size(); i++) {
-               QName moduleName = (QName) opModules.get(i);
-               module = context.getEngineConfig().getModule(moduleName).getModule();
-           }
+    public void createChains(AxisService service, AxisSystem system) throws PhaseException {
+        try {
+            PhaseResolver reolve = new PhaseResolver(system, service);
+            reolve.buildchains();
+            engageModules(service, system);
+        } catch (PhaseException e) {
+            throw new PhaseException(e.getMessage());
+        } catch (AxisFault axisFault) {
+            throw new PhaseException(axisFault.getMessage());
+        }
+    }
 
-       }
+    private void engageModules(AxisService service, AxisSystem context) throws AxisFault {
+        ArrayList servicemodules = (ArrayList) service.getModules();
+        ArrayList opModules;
+        Module module;
+        Collection operations = service.getOperations().values();
+        for (Iterator iterator = operations.iterator(); iterator.hasNext();) {
+            AxisOperation operation = (AxisOperation) iterator.next();
+            opModules = (ArrayList) operation.getModules();
+            for (int i = 0; i < servicemodules.size(); i++) {
+                QName moduleName = (QName) servicemodules.get(i);
+                module = context.getModule(moduleName).getModule();
+                //todo AxisOperation shoud have a method to get chains
+                /*ExecutionChain inchain = new ExecutionChain();
+                inchain.addPhases(operation.getPhases(EngineConfiguration.INFLOW));
+                module.engage(inchain);*/
+            }
+            for (int i = 0; i < opModules.size(); i++) {
+                QName moduleName = (QName) opModules.get(i);
+                module = context.getModule(moduleName).getModule();
+            }
+
+        }
     }
 }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MessageContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MessageContext.java?rev=169417&r1=169416&r2=169417&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MessageContext.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MessageContext.java Mon May  9 22:45:37 2005
@@ -116,7 +116,6 @@
     private String serviceInstanceID;
 
     /**
-     * 
      * @param engineContext
      * @param sessionContext
      * @param transportIn
@@ -124,19 +123,18 @@
      * @param mepContext
      * @throws AxisFault
      */
-    public MessageContext(
-        SystemContext engineContext,
-        SessionContext sessionContext,
-        AxisTransportIn transportIn,
-        AxisTransportOut transportOut,
-        OperationContext mepContext)
-        throws AxisFault {
+    public MessageContext(SystemContext engineContext,
+                          SessionContext sessionContext,
+                          AxisTransportIn transportIn,
+                          AxisTransportOut transportOut,
+                          OperationContext mepContext)
+            throws AxisFault {
         this(sessionContext, transportIn, transportOut, engineContext);
         this.operationContext = mepContext;
 
     }
+
     /**
-     * 
      * @param sessionContext
      * @param transportIn
      * @param transportOut
@@ -144,12 +142,11 @@
      * @throws AxisFault
      */
 
-    public MessageContext(
-        SessionContext sessionContext,
-        AxisTransportIn transportIn,
-        AxisTransportOut transportOut,
-        SystemContext engineContext)
-        throws AxisFault {
+    public MessageContext(SessionContext sessionContext,
+                          AxisTransportIn transportIn,
+                          AxisTransportOut transportOut,
+                          SystemContext engineContext)
+            throws AxisFault {
         super(null);
 
         if (sessionContext == null) {
@@ -352,12 +349,15 @@
     public void setWSAAction(String actionURI) {
         messageInformationHeaders.setAction(actionURI);
     }
+
     public String getWSAAction() {
         return messageInformationHeaders.getAction();
     }
+
     public void setWSAMessageId(String messageID) {
         messageInformationHeaders.setMessageId(messageID);
     }
+
     public String getWSAMessageId() {
         return messageInformationHeaders.getMessageId();
     }
@@ -369,6 +369,7 @@
     public void setMessageInformationHeaders(MessageInformationHeadersCollection messageInformationHeaders) {
         this.messageInformationHeaders = messageInformationHeaders;
     }
+
     /**
      * @return
      */
@@ -382,6 +383,7 @@
     public void setPaused(boolean b) {
         paused = b;
     }
+
     /**
      * @return
      */
@@ -444,6 +446,7 @@
     public String getServiceInstanceID() {
         return serviceInstanceID;
     }
+
     /**
      * @param serviceInstanceID The serviceInstanceID to set.
      */

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContext.java?rev=169417&r1=169416&r2=169417&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContext.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContext.java Mon May  9 22:45:37 2005
@@ -16,13 +16,13 @@
  * limitations under the License.
  */
 
-import java.util.Map;
-
 import org.apache.axis.description.AxisOperation;
 import org.apache.axis.engine.AxisError;
 import org.apache.axis.engine.AxisFault;
 import org.apache.wsdl.WSDLConstants;
 
+import java.util.Map;
+
 /**
  * An OperationContext represents a running "instance" of an operation, which is
  * represented by an AxisOperation object. This concept is needed to allow
@@ -30,7 +30,7 @@
  * essentially arbitrary message exchange patterns. So as messages are being
  * exchanged the OperationContext remembers the state of where in the message
  * exchange pattern it is in.
- * <p>
+ * <p/>
  * OperationContextFactory factory. The base implementation of OperationContext
  * supports MEPs which have one input message and/or one output message. That
  * is, it supports the all the MEPs that are in the WSDL 2.0 specification. In
@@ -38,169 +38,165 @@
  * creation in the OperationContexFactory.
  */
 public class OperationContext extends AbstractContext {
-	// the in and out messages that may be present
-	private MessageContext inMessageContext;
+    // the in and out messages that may be present
+    private MessageContext inMessageContext;
 
-	private MessageContext outMessageContext;
+    private MessageContext outMessageContext;
 
-	// the AxisOperation of which this is a running instance. The MEP of this
-	// AxisOperation must be one of the 8 predefined ones in WSDL 2.0.
-	private AxisOperation axisOperation;
-
-	private int operationMEP;
-
-	private boolean isComplete = false;
-
-	// this is the global MessageID -> OperationContext map which is stored in
-	// the EngineContext. We're caching it here for faster acccess.
-	private Map operationContextMap;
-
-	/**
-	 * Construct a new OperationContext.
-	 * 
-	 * @param axisOperation
-	 *            the AxisOperation whose running instances' state this
-	 *            OperationContext represents.
-	 * @param serviceContext
-	 *            the parent ServiceContext representing any state related to
-	 *            the set of all operations of the service.
-	 */
-	public OperationContext(AxisOperation axisOperation,
-			ServiceContext serviceContext) {
-		super(serviceContext);
-		this.axisOperation = axisOperation;
-		this.operationMEP = axisOperation.getAxisSpecifMEPConstant();
-		this.operationContextMap = ((SystemContext) parent.parent)
-				.getOperationContextMap();
-	}
-
-	/**
-	 * @return Returns the axisOperation.
-	 */
-	public AxisOperation getAxisOperation() {
-		return axisOperation;
-	}
-
-	/**
-	 * Return the ServiceContext in which this OperationContext lives.
-	 * 
-	 * @return parent ServiceContext
-	 */
-	public ServiceContext getServiceContext() {
-		return (ServiceContext) parent;
-	}
-
-	/**
-	 * Return the EngineContext in which the parent ServiceContext lives.
-	 * 
-	 * @return parent ServiceContext's parent EngineContext
-	 */
-	public SystemContext getEngineContext() {
-		return (SystemContext) parent.parent;
-	}
-
-	/**
-	 * 
-	 * When a new message is added to the <code>MEPContext</code> the logic
-	 * should be included remove the MEPContext from the table in the
-	 * <code>EngineContext</code>. Example: IN_IN_OUT At the second IN
-	 * message the MEPContext should be removed from the AxisOperation
-	 * 
-	 * @param msgContext
-	 */
-	public void addMessageContext(MessageContext msgContext) throws AxisFault {
-		// this needs to store the msgContext in either inMessageContext or
-		// outMessageContext depending on the MEP of the AxisOperation
-		// and on the current state of the operation.
-		if (WSDLConstants.MEP_CONSTANT_IN_OUT ==operationMEP
-				|| WSDLConstants.MEP_CONSTANT_IN_OPTIONAL_OUT == operationMEP
-				|| WSDLConstants.MEP_CONSTANT_ROBUST_IN_ONLY == operationMEP) {
-			if (inMessageContext == null) {
-				inMessageContext = msgContext;
-			} else {
-				outMessageContext = msgContext;
-				isComplete = true;
-			}
-		} else if (WSDLConstants.MEP_CONSTANT_IN_ONLY == operationMEP) {
-			inMessageContext = msgContext;
-			isComplete = true;
-		} else if (WSDLConstants.MEP_CONSTANT_OUT_ONLY == operationMEP) {
-			outMessageContext = msgContext;
-			isComplete = true;
-		} else if (WSDLConstants.MEP_CONSTANT_OUT_IN == operationMEP
-				|| WSDLConstants.MEP_CONSTANT_OUT_OPTIONAL_IN == operationMEP
-				|| WSDLConstants.MEP_CONSTANT_ROBUST_IN_ONLY == operationMEP) {
-			if (outMessageContext == null) {
-				outMessageContext = msgContext;
-			} else {
-				inMessageContext = msgContext;
-				isComplete = true;
-			}
-		} else {
-			// NOT REACHED: the factory created this context incorrectly
-			throw new AxisError("Invalid behavior of OperationContextFactory");
-		}
-	}
-
-	/**
-	 * 
-	 * @param messageLabel
-	 * @return
-	 * @throws AxisFault
-	 */
-	public MessageContext getMessageContext(byte messageLabel) throws AxisFault {
-		if (messageLabel == WSDLConstants.MESSAGE_LABEL_IN) {
-			return inMessageContext;
-		} else if (messageLabel == WSDLConstants.MESSAGE_LABEL_OUT) {
-			return outMessageContext;
-		} else {
-			throw new AxisFault("Unrecognized message label: '" + messageLabel
-					+ "'");
-		}
-	}
-
-	/**
-	 * Returns the last message which came into the OperationContext. This is
-	 * useful for the WS-Addressing module for example to be figure out where to
-	 * get the ReplyTo information etc. from. Note that while its trivial to
-	 * implement this for the MEPs supported by this particular
-	 * OperationContext, a more complicated MEP could require a hairy
-	 * implementation (or may make you bald).
-	 * 
-	 * @return the last message coming into the operation.
-	 */
-	public MessageContext getLastInMessageContext() {
-		return inMessageContext;
-	}
-
-	/**
-	 * Checks to see if the MEP is complete. i.e. whether all the messages that
-	 * are associated with the MEP has arrived and MEP is complete.
-	 * 
-	 * @return
-	 */
-	public boolean isComplete() {
-		return isComplete;
-	}
-
-	/**
-	 * Removes the pointers to this <code>OperationContext</code> in the
-	 * <code>EngineContext</code>'s OperationContextMap so that this
-	 * <code>OperationContext</code> will eventually get garbage collected
-	 * along with the <code>MessageContext</code>'s it contains. Note that if
-	 * the caller wants to make sure its safe to clean up this OperationContext
-	 * he should call isComplete() first. However, in cases like IN_OPTIONAL_OUT
-	 * and OUT_OPTIONAL_IN, it is possibe this will get called without the MEP
-	 * being complete due to the optional nature of the MEP.
-	 */
-	public void cleanup() {
-		if (null != this.inMessageContext) {
-			operationContextMap.remove(inMessageContext.getMessageID());
-		}
-		if (null != this.outMessageContext) {
-			operationContextMap.remove(outMessageContext.getMessageID());
-		}
-	}
+    // the AxisOperation of which this is a running instance. The MEP of this
+    // AxisOperation must be one of the 8 predefined ones in WSDL 2.0.
+    private AxisOperation axisOperation;
+
+    private int operationMEP;
+
+    private boolean isComplete = false;
+
+    // this is the global MessageID -> OperationContext map which is stored in
+    // the EngineContext. We're caching it here for faster acccess.
+    private Map operationContextMap;
+
+    /**
+     * Construct a new OperationContext.
+     *
+     * @param axisOperation  the AxisOperation whose running instances' state this
+     *                       OperationContext represents.
+     * @param serviceContext the parent ServiceContext representing any state related to
+     *                       the set of all operations of the service.
+     */
+    public OperationContext(AxisOperation axisOperation,
+                            ServiceContext serviceContext) {
+        super(serviceContext);
+        this.axisOperation = axisOperation;
+        this.operationMEP = axisOperation.getAxisSpecifMEPConstant();
+        this.operationContextMap = ((SystemContext) parent.parent)
+                .getOperationContextMap();
+    }
+
+    /**
+     * @return Returns the axisOperation.
+     */
+    public AxisOperation getAxisOperation() {
+        return axisOperation;
+    }
+
+    /**
+     * Return the ServiceContext in which this OperationContext lives.
+     *
+     * @return parent ServiceContext
+     */
+    public ServiceContext getServiceContext() {
+        return (ServiceContext) parent;
+    }
+
+    /**
+     * Return the EngineContext in which the parent ServiceContext lives.
+     *
+     * @return parent ServiceContext's parent EngineContext
+     */
+    public SystemContext getEngineContext() {
+        return (SystemContext) parent.parent;
+    }
+
+    /**
+     * When a new message is added to the <code>MEPContext</code> the logic
+     * should be included remove the MEPContext from the table in the
+     * <code>EngineContext</code>. Example: IN_IN_OUT At the second IN
+     * message the MEPContext should be removed from the AxisOperation
+     *
+     * @param msgContext
+     */
+    public void addMessageContext(MessageContext msgContext) throws AxisFault {
+        // this needs to store the msgContext in either inMessageContext or
+        // outMessageContext depending on the MEP of the AxisOperation
+        // and on the current state of the operation.
+        if (WSDLConstants.MEP_CONSTANT_IN_OUT == operationMEP
+                || WSDLConstants.MEP_CONSTANT_IN_OPTIONAL_OUT == operationMEP
+                || WSDLConstants.MEP_CONSTANT_ROBUST_IN_ONLY == operationMEP) {
+            if (inMessageContext == null) {
+                inMessageContext = msgContext;
+            } else {
+                outMessageContext = msgContext;
+                isComplete = true;
+            }
+        } else if (WSDLConstants.MEP_CONSTANT_IN_ONLY == operationMEP) {
+            inMessageContext = msgContext;
+            isComplete = true;
+        } else if (WSDLConstants.MEP_CONSTANT_OUT_ONLY == operationMEP) {
+            outMessageContext = msgContext;
+            isComplete = true;
+        } else if (WSDLConstants.MEP_CONSTANT_OUT_IN == operationMEP
+                || WSDLConstants.MEP_CONSTANT_OUT_OPTIONAL_IN == operationMEP
+                || WSDLConstants.MEP_CONSTANT_ROBUST_IN_ONLY == operationMEP) {
+            if (outMessageContext == null) {
+                outMessageContext = msgContext;
+            } else {
+                inMessageContext = msgContext;
+                isComplete = true;
+            }
+        } else {
+            // NOT REACHED: the factory created this context incorrectly
+            throw new AxisError("Invalid behavior of OperationContextFactory");
+        }
+    }
+
+    /**
+     * @param messageLabel
+     * @return
+     * @throws AxisFault
+     */
+    public MessageContext getMessageContext(byte messageLabel) throws AxisFault {
+        if (messageLabel == WSDLConstants.MESSAGE_LABEL_IN) {
+            return inMessageContext;
+        } else if (messageLabel == WSDLConstants.MESSAGE_LABEL_OUT) {
+            return outMessageContext;
+        } else {
+            throw new AxisFault("Unrecognized message label: '" + messageLabel
+                    + "'");
+        }
+    }
+
+    /**
+     * Returns the last message which came into the OperationContext. This is
+     * useful for the WS-Addressing module for example to be figure out where to
+     * get the ReplyTo information etc. from. Note that while its trivial to
+     * implement this for the MEPs supported by this particular
+     * OperationContext, a more complicated MEP could require a hairy
+     * implementation (or may make you bald).
+     *
+     * @return the last message coming into the operation.
+     */
+    public MessageContext getLastInMessageContext() {
+        return inMessageContext;
+    }
+
+    /**
+     * Checks to see if the MEP is complete. i.e. whether all the messages that
+     * are associated with the MEP has arrived and MEP is complete.
+     *
+     * @return
+     */
+    public boolean isComplete() {
+        return isComplete;
+    }
+
+    /**
+     * Removes the pointers to this <code>OperationContext</code> in the
+     * <code>EngineContext</code>'s OperationContextMap so that this
+     * <code>OperationContext</code> will eventually get garbage collected
+     * along with the <code>MessageContext</code>'s it contains. Note that if
+     * the caller wants to make sure its safe to clean up this OperationContext
+     * he should call isComplete() first. However, in cases like IN_OPTIONAL_OUT
+     * and OUT_OPTIONAL_IN, it is possibe this will get called without the MEP
+     * being complete due to the optional nature of the MEP.
+     */
+    public void cleanup() {
+        if (null != this.inMessageContext) {
+            operationContextMap.remove(inMessageContext.getMessageID());
+        }
+        if (null != this.outMessageContext) {
+            operationContextMap.remove(outMessageContext.getMessageID());
+        }
+    }
 
     
 //    public MessageContext createMessageContext(AxisM){

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContextFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContextFactory.java?rev=169417&r1=169416&r2=169417&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContextFactory.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContextFactory.java Mon May  9 22:45:37 2005
@@ -23,22 +23,22 @@
 
 public class OperationContextFactory implements WSDLConstants {
 
-	public static OperationContext createMEPContext(int mepURI, boolean serverSide,
-			AxisOperation axisOp, ServiceContext serviceContext)
-			throws AxisFault {
-		if (MEP_CONSTANT_IN_OUT == mepURI || MEP_CONSTANT_IN_ONLY ==mepURI
-				|| MEP_CONSTANT_IN_OPTIONAL_OUT == mepURI
-				|| MEP_CONSTANT_ROBUST_IN_ONLY == mepURI
-				|| MEP_CONSTANT_OUT_ONLY == mepURI
-				|| MEP_CONSTANT_OUT_IN == mepURI
-				|| MEP_CONSTANT_OUT_OPTIONAL_IN == mepURI
-				|| MEP_CONSTANT_ROBUST_OUT_ONLY == mepURI) {
-			return new OperationContext(axisOp, serviceContext);
+    public static OperationContext createMEPContext(int mepURI, boolean serverSide,
+                                                    AxisOperation axisOp, ServiceContext serviceContext)
+            throws AxisFault {
+        if (MEP_CONSTANT_IN_OUT == mepURI || MEP_CONSTANT_IN_ONLY == mepURI
+                || MEP_CONSTANT_IN_OPTIONAL_OUT == mepURI
+                || MEP_CONSTANT_ROBUST_IN_ONLY == mepURI
+                || MEP_CONSTANT_OUT_ONLY == mepURI
+                || MEP_CONSTANT_OUT_IN == mepURI
+                || MEP_CONSTANT_OUT_OPTIONAL_IN == mepURI
+                || MEP_CONSTANT_ROBUST_OUT_ONLY == mepURI) {
+            return new OperationContext(axisOp, serviceContext);
 
-		} else {
-			throw new AxisFault("Cannot handle the MEP " + mepURI
-					+ " for the current invocation of Operation ");
-		}
-	}
+        } else {
+            throw new AxisFault("Cannot handle the MEP " + mepURI
+                    + " for the current invocation of Operation ");
+        }
+    }
 
 }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/ServiceContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/ServiceContext.java?rev=169417&r1=169416&r2=169417&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/ServiceContext.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/ServiceContext.java Mon May  9 22:45:37 2005
@@ -18,51 +18,52 @@
  * 
  */
 
-import javax.xml.namespace.QName;
-
 import org.apache.axis.description.AxisOperation;
 import org.apache.axis.description.AxisService;
 
+import javax.xml.namespace.QName;
+
+
+public class ServiceContext extends AbstractContext {
+    private AxisService serviceConfig;
 
-public class ServiceContext  extends AbstractContext{
-    private AxisService serviceConfig;   
-    
     private String serviceInstanceID;
 
-    public ServiceContext(AxisService serviceConfig,SystemContext engineContext) {
+    public ServiceContext(AxisService serviceConfig, SystemContext engineContext) {
         super(engineContext);
         this.serviceConfig = serviceConfig;
-        
-
+
+
+    }
+
+
+    /**
+     * @return Returns the serviceInstanceID.
+     */
+    public String getServiceInstanceID() {
+        return serviceInstanceID;
+    }
+
+    /**
+     * @param serviceInstanceID The serviceInstanceID to set.
+     */
+    public void setServiceInstanceID(String serviceInstanceID) {
+        this.serviceInstanceID = serviceInstanceID;
     }
-    
-    
 
-	/**
-	 * @return Returns the serviceInstanceID.
-	 */
-	public String getServiceInstanceID() {
-		return serviceInstanceID;
-	}
-	/**
-	 * @param serviceInstanceID The serviceInstanceID to set.
-	 */
-	public void setServiceInstanceID(String serviceInstanceID) {
-		this.serviceInstanceID = serviceInstanceID;
-	}
     /**
      * @return
      */
     public AxisService getServiceConfig() {
         return serviceConfig;
     }
-    
-    public SystemContext getEngineContext(){
-        return (SystemContext)parent;
+
+    public SystemContext getEngineContext() {
+        return (SystemContext) parent;
     }
-    
-    public OperationContext createOperationContext(QName name){
+
+    public OperationContext createOperationContext(QName name) {
         AxisOperation axisOp = serviceConfig.getOperation(name);
-        return new OperationContext(axisOp,this);
+        return new OperationContext(axisOp, this);
     }
 }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/SessionContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/SessionContext.java?rev=169417&r1=169416&r2=169417&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/SessionContext.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/SessionContext.java Mon May  9 22:45:37 2005
@@ -21,8 +21,8 @@
  */
 public class SessionContext extends AbstractContext {
     /**
-        * @param parent
-        */
+     * @param parent
+     */
     public SessionContext(AbstractContext parent) {
         super(parent);
     }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/SystemContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/SystemContext.java?rev=169417&r1=169416&r2=169417&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/SystemContext.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/SystemContext.java Mon May  9 22:45:37 2005
@@ -18,12 +18,6 @@
  *  Runtime state of the engine
  */
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
 import org.apache.axis.description.AxisService;
 import org.apache.axis.description.PhasesInclude;
 import org.apache.axis.description.PhasesIncludeImpl;
@@ -31,6 +25,11 @@
 import org.apache.axis.engine.AxisSystem;
 import org.apache.axis.storage.AxisStorage;
 
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
 public class SystemContext extends AbstractContext implements PhasesInclude {
 
     private AxisSystem engineConfig;
@@ -40,7 +39,7 @@
     private Map moduleContextMap;
 
     /**
-     * Map containing <code>MessageID</code> to 
+     * Map containing <code>MessageID</code> to
      * <code>OperationContext</code> mapping.
      */
     private final Map operationContextMap = new HashMap();
@@ -62,6 +61,7 @@
     /**
      * The method is used to do the intialization of the EngineContext, right now we know that
      * module.init(..) is called here
+     *
      * @throws AxisFault
      */
 
@@ -74,8 +74,8 @@
     }
 
     /**
-    * @return
-    */
+     * @return
+     */
     public AxisSystem getEngineConfig() {
         return engineConfig;
     }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java?rev=169417&r1=169416&r2=169417&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java Mon May  9 22:45:37 2005
@@ -16,19 +16,7 @@
 
 package org.apache.axis.deployment;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-
+import org.apache.axis.context.EngineContextFactory;
 import org.apache.axis.deployment.listener.RepositoryListenerImpl;
 import org.apache.axis.deployment.repository.utill.ArchiveReader;
 import org.apache.axis.deployment.repository.utill.HDFileItem;
@@ -36,20 +24,23 @@
 import org.apache.axis.deployment.scheduler.DeploymentIterator;
 import org.apache.axis.deployment.scheduler.Scheduler;
 import org.apache.axis.deployment.scheduler.SchedulerTask;
-import org.apache.axis.description.AxisGlobal;
-import org.apache.axis.description.AxisModule;
-import org.apache.axis.description.AxisService;
-import org.apache.axis.description.Flow;
-import org.apache.axis.description.HandlerMetadata;
-import org.apache.axis.description.Parameter;
+import org.apache.axis.description.*;
 import org.apache.axis.engine.AxisFault;
 import org.apache.axis.engine.AxisSystem;
 import org.apache.axis.engine.AxisSystemImpl;
 import org.apache.axis.engine.Handler;
 import org.apache.axis.modules.Module;
+import org.apache.axis.phaseresolver.PhaseException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import java.io.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
 
 public class DeploymentEngine implements DeploymentConstants {
 
@@ -93,6 +84,9 @@
 
     private HDFileItem currentFileItem;
 
+    //tobuild chains
+    private EngineContextFactory factory;
+
     /**
      * This the constructor which is used by Engine inorder to start
      * Deploymenat module,
@@ -105,16 +99,6 @@
         this(RepositaryName, "server.xml");
     }
 
-    /**
-     * this constructor is used to deploy a web service programatically, by using classLoader
-     * and InputStream
-     *
-     * @param engineconfig
-     */
-    public DeploymentEngine(AxisSystem engineconfig) {
-        this.engineconfig = engineconfig;
-    }
-
     public DeploymentEngine(String RepositaryName, String serverXMLFile) throws DeploymentException {
         this.folderName = RepositaryName;
         File repository = new File(RepositaryName);
@@ -151,6 +135,7 @@
 
             }
         }
+        factory = new EngineContextFactory();
         this.engineConfigName = RepositaryName + '/' + serverXMLFile;
     }
 
@@ -200,8 +185,6 @@
             parser.processGlobalConfig(axisGlobal);
         } catch (FileNotFoundException e) {
             throw new DeploymentException("Exception at deployment", e);
-        } catch (AxisFault axisFault) {
-            throw new DeploymentException(axisFault.getMessage());
         } catch (XMLStreamException e) {
             throw new DeploymentException(e.getMessage());
         }
@@ -233,9 +216,7 @@
             parser.processGlobalConfig(axisGlobal);
         } catch (FileNotFoundException e) {
             throw new DeploymentException("Exception at deployment", e);
-        } catch (AxisFault axisFault) {
-            throw new DeploymentException(axisFault.getMessage());
-        } catch (XMLStreamException e) {
+        }  catch (XMLStreamException e) {
             throw new DeploymentException(e.getMessage());
         }
         hotDeployment = false;
@@ -278,7 +259,7 @@
         scheduler.schedule(new SchedulerTask(engine, folderName), new DeploymentIterator());
     }
 
-    private AxisSystem createEngineConfig() throws AxisFault {
+    private AxisSystem createEngineConfig(){
         axisGlobal = new AxisGlobal();
         AxisSystem newEngineConfig = new AxisSystemImpl(axisGlobal);
         return newEngineConfig;
@@ -286,10 +267,16 @@
 
 
     private void addnewService(AxisService serviceMetaData) throws AxisFault {
-        currentFileItem.setClassLoader();
-        loadServiceProperties(serviceMetaData);
-        engineconfig.addService(serviceMetaData);
-        System.out.println("adding new service : " + serviceMetaData.getName().getLocalPart());
+        try {
+            currentFileItem.setClassLoader();
+            loadServiceProperties(serviceMetaData);
+            engineconfig.addService(serviceMetaData);
+            factory.createChains(serviceMetaData, engineconfig);
+            System.out.println("adding new service : " + serviceMetaData.getName().getLocalPart());
+        } catch (PhaseException e) {
+            throw new AxisFault(e);
+        }
+
     }
 
     /**

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java?rev=169417&r1=169416&r2=169417&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java Mon May  9 22:45:37 2005
@@ -15,28 +15,15 @@
 */
 package org.apache.axis.phaseresolver;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
 import org.apache.axis.context.SystemContext;
-import org.apache.axis.context.ServiceContext;
-import org.apache.axis.description.AxisGlobal;
-import org.apache.axis.description.AxisModule;
-import org.apache.axis.description.AxisOperation;
-import org.apache.axis.description.AxisService;
-import org.apache.axis.description.AxisTransportIn;
-import org.apache.axis.description.AxisTransportOut;
-import org.apache.axis.description.Flow;
-import org.apache.axis.description.HandlerMetadata;
+import org.apache.axis.description.*;
 import org.apache.axis.engine.AxisFault;
 import org.apache.axis.engine.AxisSystem;
 import org.apache.axis.engine.AxisSystemImpl;
 
+import javax.xml.namespace.QName;
+import java.util.*;
+
 /**
  * Class PhaseResolver
  */
@@ -51,7 +38,6 @@
      */
     private AxisService axisService;
 
-    private ServiceContext serviceContext;
 
     /**
      * Field phaseHolder
@@ -74,10 +60,9 @@
      * @param serviceContext
      */
     public PhaseResolver(AxisSystem engineConfig,
-                         ServiceContext serviceContext) {
+                         AxisService serviceContext) {
         this.engineConfig = engineConfig;
-        this.axisService = serviceContext.getServiceConfig();
-        this.serviceContext = serviceContext;
+        this.axisService = serviceContext;
     }
 
     /**
@@ -86,7 +71,7 @@
      * @throws PhaseException
      * @throws AxisFault
      */
-    public ServiceContext buildchains() throws PhaseException, AxisFault {
+    public void buildchains() throws PhaseException, AxisFault {
         HashMap operations = axisService.getOperations();
         Collection col = operations.values();
         for (Iterator iterator = col.iterator(); iterator.hasNext();) {
@@ -95,10 +80,9 @@
                 buildExcutionChains(i, operation);
             }
         }
-        return this.serviceContext;
     }
 
-    private void buildModuleHandlers(ArrayList allHandlers  , AxisModule module , int flowtype) throws PhaseException {
+    private void buildModuleHandlers(ArrayList allHandlers, AxisModule module, int flowtype) throws PhaseException {
         Flow flow = null;
         switch (flowtype) {
             case PhaseMetadata.IN_FLOW:
@@ -164,7 +148,7 @@
             QName name = (QName) modules.get(i);
             module = engineConfig.getModule(name);
             if (module != null) {
-                buildModuleHandlers(allHandlers,module,flowtype);
+                buildModuleHandlers(allHandlers, module, flowtype);
             } else {
                 throw new PhaseException("Referred module is NULL " + name.getLocalPart());
             }
@@ -215,8 +199,8 @@
         while (itr.hasNext()) {
             QName moduleref = (QName) itr.next();
             module = engineConfig.getModule(moduleref);
-            if(module != null){
-                 buildModuleHandlers(allHandlers,module,flowtype);
+            if (module != null) {
+                buildModuleHandlers(allHandlers, module, flowtype);
             }
         }
         ///////////////////////////////////////////////////////////////////////////////////////
@@ -226,8 +210,8 @@
         while (opitr.hasNext()) {
             QName moduleref = (QName) opitr.next();
             module = engineConfig.getModule(moduleref);
-            if(module != null ){
-                 buildModuleHandlers(allHandlers,module,flowtype);
+            if (module != null) {
+                buildModuleHandlers(allHandlers, module, flowtype);
             }
         }