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 ch...@apache.org on 2005/05/04 05:39:31 UTC

svn commit: r168066 - in /webservices/axis/trunk/java/modules/core/src/org/apache/axis: clientapi/Call.java context/BasicMEPContext.java context/EngineContext.java context/MEPContext.java description/AxisOperation.java description/DescriptionConstants.java

Author: chathura
Date: Tue May  3 20:39:30 2005
New Revision: 168066

URL: http://svn.apache.org/viewcvs?rev=168066&view=rev
Log:
Made the MEPContext available at the EngineConfiguration level. Fixed the call API to be inline with it.

Modified:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/Call.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/BasicMEPContext.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/EngineContext.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MEPContext.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/AxisOperation.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/DescriptionConstants.java

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/Call.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/Call.java?rev=168066&r1=168065&r2=168066&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/Call.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/Call.java Tue May  3 20:39:30 2005
@@ -159,7 +159,7 @@
                 callbackReceiver.addCallback(messageInfoHeaders.getMessageId(), callback);
                 messageInfoHeaders.setReplyTo(
                     ListenerManager.replyToEPR(callbackServiceName + "/" + replyToOpName.getLocalPart()));
-                callbackOperation.addMEPContext(msgctx.getMepContext(),messageInfoHeaders.getMessageId());
+                callbackOperation.findMEPContext(msgctx, false);
             }
 
             msgctx.setMessageInformationHeaders(messageInfoHeaders);

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/BasicMEPContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/BasicMEPContext.java?rev=168066&r1=168065&r2=168066&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/BasicMEPContext.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/BasicMEPContext.java Tue May  3 20:39:30 2005
@@ -54,17 +54,21 @@
 	/**
 	 * 
 	 * When a new message is added to the <code>MEPContext</code> the logic
-	 * should be included remove the MEPContext from the MEPMAp of the
-	 * <code>AxisOperation</code>. Example: IN_IN_OUT At the second IN
+	 * 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 ctxt
 	 */
-	public void addMessageContext(MessageContext ctxt) {
-		if (WSDLConstants.MEP_URI_IN_ONLY.equals(this.axisOperation
-				.getMessageExchangePattern()))
-			//    		this.axisOperation.removeMEPContext(this);
-			messageContextList.add(ctxt);
+	public void addMessageContext(MessageContext msgContext) throws AxisFault {
+		if (WSDLConstants.MEP_URI_IN_ONLY.equals(this.axisOperation.getMessageExchangePattern())){
+			messageContextList.add(msgContext);				
+		} else if(WSDLConstants.MEP_URI_IN_OUT.equals(this.axisOperation.getMessageExchangePattern())){
+			messageContextList.add(msgContext);			
+		}
+		
+		if(this.isComplete())
+			msgContext.getEngineContext().removeMEP(this);
 
 	}
 
@@ -96,7 +100,7 @@
 			}
 		}
 
-		throw new AxisFault(" Message doennot exist in the current MEP : Invalid MessageID :" + messageID);
+		throw new AxisFault(" Message doesnot exist in the current MEP : Invalid MessageID :" + messageID);
 	}
 
 	/**
@@ -112,5 +116,17 @@
 	 */
 	public void setMepId(String mepId) {
 		MepId = mepId;
+	}
+	
+	public boolean isComplete(){
+		if (WSDLConstants.MEP_URI_IN_ONLY.equals(this.axisOperation.getMessageExchangePattern())){
+			if(1 == this.messageContextList.size())
+				return true;
+		}else if(WSDLConstants.MEP_URI_IN_OUT.equals(this.axisOperation.getMessageExchangePattern())){
+			if(2 == this.messageContextList.size())
+				return true;
+		}
+		
+		return false;
 	}
 }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/EngineContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/EngineContext.java?rev=168066&r1=168065&r2=168066&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/EngineContext.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/EngineContext.java Tue May  3 20:39:30 2005
@@ -20,6 +20,7 @@
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Map;
 
 import javax.xml.namespace.QName;
@@ -38,6 +39,12 @@
     private Map serviceContextMap;
     private Map sessionContextMap;
     private Map moduleContextMap;
+    
+    /**
+     * Map containing <code>MessageContext</code> to 
+     * <code>MEPContext</code> mapping.
+     */
+    private final Map mepContextMap = new HashMap();
 
     public AxisStorage getStorage() {
         return storage;
@@ -123,6 +130,25 @@
      */
     public void setPhases(ArrayList phases, int flow) throws AxisFault {
         phaseInclude.setPhases(phases, flow);
+    }
+    
+    
+    public void addMEPContext(String messageID, MEPContext mepContext){
+    	this.mepContextMap.put(messageID, mepContext);
+    }
+    
+    public MEPContext getMEPContext(String messageID){
+    	return(MEPContext)this.mepContextMap.get(messageID);
+    }
+     
+    public void removeMEP(MEPContext mepContext) throws AxisFault{
+    	if(!mepContext.isComplete())
+    		throw new AxisFault("Illegal attempt to drop the global reference of an incomplete MEPContext");
+    	Iterator iterator = mepContext.getAllMessageContexts().iterator();
+    	while(iterator.hasNext()){
+    		MessageContext msgContext = ((MessageContext)iterator.next());
+    		this.mepContextMap.remove(msgContext.getMessageID());
+    	}
     }
 
 }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MEPContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MEPContext.java?rev=168066&r1=168065&r2=168066&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MEPContext.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MEPContext.java Tue May  3 20:39:30 2005
@@ -25,6 +25,7 @@
 public interface MEPContext {
     public String getMepId();
     public void setMepId(String mepId);
+    public boolean isComplete();
 
   
 //    public MessageContext getInMessageContext(String messageID);

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/AxisOperation.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/AxisOperation.java?rev=168066&r1=168065&r2=168066&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/AxisOperation.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/AxisOperation.java Tue May  3 20:39:30 2005
@@ -1,9 +1,9 @@
 package org.apache.axis.description;
 
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Collection;
+
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
 
 import javax.xml.namespace.QName;
 
@@ -28,8 +28,7 @@
 
 	public AxisOperation(){
         this.setMessageExchangePattern(MEP_URI_IN_OUT);
-		this.setComponentProperty(PARAMETER_KEY, new ParameterIncludeImpl());
-        this.setComponentProperty(MEP_MAP, new HashMap());
+		this.setComponentProperty(PARAMETER_KEY, new ParameterIncludeImpl());        
         this.setComponentProperty(MODULEREF_KEY, new ArrayList());
         modules = new HashMap();
 	}
@@ -124,35 +123,28 @@
 			// one
 			mepContext = MEPContextFactory.createMEP(this
 					.getMessageExchangePattern(), serverside,this);
-           
+			
 
 		} else {
 			// So this message is part of an ongoing MEP
-			mepContext = this
-					.getSavedMEPContextFromComponentProperties(msgContext
-							.getRelatesTo().getAddress());
+			mepContext = msgContext.getEngineContext().getMEPContext(msgContext.getRelatesTo().getAddress());
+			
 			if (null == mepContext) {
 				throw new AxisFault(
 						"Cannot relate the message in the operation :"
-								+ this.getName() + " :Invalid RelatedTO value");
+								+ this.getName() + " :Unrelated RelatesTO value "+msgContext.getRelatesTo().getAddress());
 			}
 
 		}
 
-		this.addMEPContext(mepContext, msgContext.getMessageID());
+		msgContext.getEngineContext().addMEPContext(msgContext.getMessageID(), mepContext);
 		mepContext.addMessageContext(msgContext);
+		msgContext.setMepContext(mepContext);
 		return mepContext;
 
 	}
 
-	public void addMEPContext(MEPContext mepContext, String messageID) {
-		((Map) this.getComponentProperty(MEP_MAP)).put(messageID, mepContext);
-	}
-
-	private MEPContext getSavedMEPContextFromComponentProperties(String messageID) {
-		return (MEPContext) ((Map) this.getComponentProperty(MEP_MAP)).get(messageID);
 
-	}
 
     public String getMessageReciever() {
         return messageReciever;

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/DescriptionConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/DescriptionConstants.java?rev=168066&r1=168065&r2=168066&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/DescriptionConstants.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/DescriptionConstants.java Tue May  3 20:39:30 2005
@@ -102,8 +102,5 @@
      */
     public static final String SERVICE_CLASS_NAME = "SERVICE_CLASS_NAME";
     
-    /**
-     * Key that will keep the <code>MEPContext</code>s in the <code>AxisOperation</code>
-     */
-    public static final String MEP_MAP = "MEP_MAP";
+   
 }