axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject svn commit: r169400 - in /webservices/axis/trunk/java/modules: core/src/org/apache/axis/clientapi/ core/src/org/apache/axis/context/ core/src/org/apache/axis/description/ core/test/org/apache/axis/engine/ core/test/org/apache/axis/handlers/addressing/ wsdl/src/org/apache/wsdl/
Date Tue, 10 May 2005 03:06:44 GMT
Author: chathura
Date: Mon May  9 20:06:44 2005
New Revision: 169400

URL: http://svn.apache.org/viewcvs?rev=169400&view=rev
Log:
Change the MEP URI String Constants to have Axis Specific integer constants for performance.

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/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/description/AxisOperation.java
    webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/EnginePausingTest.java
    webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/EngineWithoutPhaseResolvingTest.java
    webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/MessageContextTest.java
    webservices/axis/trunk/java/modules/core/test/org/apache/axis/handlers/addressing/AddressingOutHandlerTest.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLConstants.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=169400&r1=169399&r2=169400&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 Mon May
 9 20:06:44 2005
@@ -193,7 +193,7 @@
                     null,
                     transportIn,
                     transportOut,
-            OperationContextFactory.createMEPContext(WSDLConstants.MEP_URI_IN_OUT,false,axisOperation,
null));
+            OperationContextFactory.createMEPContext(WSDLConstants.MEP_CONSTANT_IN_OUT,false,axisOperation,
null));
             msgctx.setEnvelope(env);
             msgctx.setMessageInformationHeaders(messageInfoHeaders);
 

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=169400&r1=169399&r2=169400&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 20:06:44 2005
@@ -47,7 +47,7 @@
 	// AxisOperation must be one of the 8 predefined ones in WSDL 2.0.
 	private AxisOperation axisOperation;
 
-	private String operationMEP;
+	private int operationMEP;
 
 	private boolean isComplete = false;
 
@@ -69,7 +69,7 @@
 			ServiceContext serviceContext) {
 		super(serviceContext);
 		this.axisOperation = axisOperation;
-		this.operationMEP = axisOperation.getMessageExchangePattern();
+		this.operationMEP = axisOperation.getAxisSpecifMEPConstant();
 		this.operationContextMap = ((SystemContext) parent.parent)
 				.getOperationContextMap();
 	}
@@ -112,24 +112,24 @@
 		// 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_URI_IN_OUT.equals(operationMEP)
-				|| WSDLConstants.MEP_URI_IN_OPTIONAL_OUT.equals(operationMEP)
-				|| WSDLConstants.MEP_URI_ROBUST_IN_ONLY.equals(operationMEP)) {
+		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_URI_IN_ONLY.equals(operationMEP)) {
+		} else if (WSDLConstants.MEP_CONSTANT_IN_ONLY == operationMEP) {
 			inMessageContext = msgContext;
 			isComplete = true;
-		} else if (WSDLConstants.MEP_URI_OUT_ONLY.equals(operationMEP)) {
+		} else if (WSDLConstants.MEP_CONSTANT_OUT_ONLY == operationMEP) {
 			outMessageContext = msgContext;
 			isComplete = true;
-		} else if (WSDLConstants.MEP_URI_OUT_IN.equals(operationMEP)
-				|| WSDLConstants.MEP_URI_OUT_OPTIONAL_IN.equals(operationMEP)
-				|| WSDLConstants.MEP_URI_ROBUST_OUT_ONLY.equals(operationMEP)) {
+		} 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 {
@@ -201,8 +201,10 @@
 			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=169400&r1=169399&r2=169400&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 20:06:44 2005
@@ -23,16 +23,16 @@
 
 public class OperationContextFactory implements WSDLConstants {
 
-	public static OperationContext createMEPContext(String mepURI, boolean serverSide,
+	public static OperationContext createMEPContext(int mepURI, boolean serverSide,
 			AxisOperation axisOp, ServiceContext serviceContext)
 			throws AxisFault {
-		if (MEP_URI_IN_OUT.equals(mepURI) || MEP_URI_IN_ONLY.equals(mepURI)
-				|| MEP_URI_IN_OPTIONAL_OUT.equals(mepURI)
-				|| MEP_URI_ROBUST_IN_ONLY.equals(mepURI)
-				|| MEP_URI_OUT_ONLY.equals(mepURI)
-				|| MEP_URI_OUT_IN.equals(mepURI)
-				|| MEP_URI_OUT_OPTIONAL_IN.equals(mepURI)
-				|| MEP_URI_ROBUST_OUT_ONLY.equals(mepURI)) {
+		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 {

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=169400&r1=169399&r2=169400&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
Mon May  9 20:06:44 2005
@@ -9,8 +9,10 @@
 import org.apache.axis.context.OperationContext;
 import org.apache.axis.context.OperationContextFactory;
 import org.apache.axis.context.ServiceContext;
+import org.apache.axis.engine.AxisError;
 import org.apache.axis.engine.AxisFault;
 import org.apache.axis.engine.MessageReceiver;
+import org.apache.wsdl.WSDLConstants;
 import org.apache.wsdl.WSDLOperation;
 import org.apache.wsdl.impl.WSDLOperationImpl;
 
@@ -19,10 +21,13 @@
  *  
  */
 public class AxisOperation extends WSDLOperationImpl implements
-		ParameterInclude, WSDLOperation, DescriptionConstants, PhasesInclude {
+		ParameterInclude, WSDLOperation, DescriptionConstants, PhasesInclude,
+		WSDLConstants {
 
 	private MessageReceiver messageReceiver;
 
+	private int mep = MEP_CONSTANT_INVALID;
+
 	public AxisOperation() {
 		this.setMessageExchangePattern(MEP_URI_IN_OUT);
 		this.setComponentProperty(PARAMETER_KEY, new ParameterIncludeImpl());
@@ -117,7 +122,7 @@
 			//Its a new incomming message so get the factory to create a new
 			// one
 			operationContext = OperationContextFactory.createMEPContext(
-					getMessageExchangePattern(), serverside, this,
+					getAxisSpecifMEPConstant(), serverside, this,
 					serviceContext);
 
 		} else {
@@ -127,10 +132,11 @@
 					msgContext.getRelatesTo().getValue());
 
 			if (null == operationContext) {
-				throw new AxisFault("Cannot relate the message in the operation :"
-					+ this.getName()
-					+ " :Unrelated RelatesTO value "
-					+ msgContext.getRelatesTo().getValue());
+				throw new AxisFault(
+						"Cannot relate the message in the operation :"
+								+ this.getName()
+								+ " :Unrelated RelatesTO value "
+								+ msgContext.getRelatesTo().getValue());
 			}
 
 		}
@@ -181,6 +187,46 @@
 		PhasesIncludeImpl phaseInclude = (PhasesIncludeImpl) this
 				.getComponentProperty(PHASES_KEY);
 		return (ArrayList) phaseInclude.getPhases(flow);
+	}
+
+	/**
+	 * This method will simply map the String URI of the Message exchange
+	 * pattern to a integer. Further in the first lookup it will cash the looked
+	 * up value so that the subsequent method calls will be extremely efficient.
+	 * 
+	 * @return
+	 */
+	public int getAxisSpecifMEPConstant() {
+		if (this.mep != MEP_CONSTANT_INVALID) {
+			return this.mep;
+		}
+		
+		int temp = MEP_CONSTANT_INVALID;
+
+		if (MEP_URI_IN_OUT.equals(getMessageExchangePattern())) {
+			temp = MEP_CONSTANT_IN_OUT;
+		} else if (MEP_URI_IN_ONLY.equals(getMessageExchangePattern())) {
+			temp = MEP_CONSTANT_IN_ONLY;
+		} else if (MEP_URI_IN_OPTIONAL_OUT.equals(getMessageExchangePattern())) {
+			temp = MEP_CONSTANT_IN_OPTIONAL_OUT;
+		} else if (MEP_URI_OUT_IN.equals(getMessageExchangePattern())) {
+			temp = MEP_CONSTANT_OUT_IN;
+		} else if (MEP_URI_OUT_ONLY.equals(getMessageExchangePattern())) {
+			temp = MEP_CONSTANT_OUT_ONLY;
+		} else if (MEP_URI_OUT_OPTIONAL_IN.equals(getMessageExchangePattern())) {
+			temp = MEP_CONSTANT_OUT_OPTIONAL_IN;
+		} else if (MEP_URI_ROBUST_IN_ONLY.equals(getMessageExchangePattern())) {
+			temp = MEP_CONSTANT_ROBUST_IN_ONLY;
+		} else if (MEP_URI_ROBUST_OUT_ONLY.equals(getMessageExchangePattern())) {
+			temp = MEP_CONSTANT_ROBUST_OUT_ONLY;
+		}
+		
+		if(temp == MEP_CONSTANT_INVALID){
+			throw new AxisError("Could not Map the MEP URI to a axis MEP constant value");
+		}
+		this.mep = temp;
+		return this.mep;
+
 	}
 }
 

Modified: webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/EnginePausingTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/EnginePausingTest.java?rev=169400&r1=169399&r2=169400&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/EnginePausingTest.java
(original)
+++ webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/EnginePausingTest.java
Mon May  9 20:06:44 2005
@@ -58,7 +58,8 @@
 
         AxisOperation axisOp = new AxisOperation(operationName);
 
-        mc = new MessageContext(engineContext, null, transportIn,transportOut,OperationContextFactory.createMEPContext(WSDLConstants.MEP_URI_IN_OUT,false,axisOp,null));
+        mc = new MessageContext(engineContext, null, transportIn,transportOut,OperationContextFactory.createMEPContext(WSDLConstants.MEP_CONSTANT_IN_OUT,false,axisOp,null));
+
         mc.setTransportOut(transportOut);
         mc.setServerSide(true);
         SOAPFactory omFac = OMAbstractFactory.getSOAP11Factory();

Modified: webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/EngineWithoutPhaseResolvingTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/EngineWithoutPhaseResolvingTest.java?rev=169400&r1=169399&r2=169400&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/EngineWithoutPhaseResolvingTest.java
(original)
+++ webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/EngineWithoutPhaseResolvingTest.java
Mon May  9 20:06:44 2005
@@ -66,7 +66,7 @@
                null,
                 transportIn,
                 transport,
-        OperationContextFactory.createMEPContext(WSDLConstants.MEP_URI_IN_OUT,false,axisOp,
null));
+        OperationContextFactory.createMEPContext(WSDLConstants.MEP_CONSTANT_IN_OUT,false,axisOp,
null));
         mc.setTransportOut(transport);
         mc.setServerSide(true);
         SOAPFactory omFac = OMAbstractFactory.getSOAP11Factory();

Modified: webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/MessageContextTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/MessageContextTest.java?rev=169400&r1=169399&r2=169400&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/MessageContextTest.java
(original)
+++ webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/MessageContextTest.java
Mon May  9 20:06:44 2005
@@ -39,7 +39,7 @@
                 null,
                 null,
                 null,
-                OperationContextFactory.createMEPContext(WSDLConstants.MEP_URI_IN_OUT, false,
null, null));
+                OperationContextFactory.createMEPContext(WSDLConstants.MEP_CONSTANT_IN_OUT,
false, null, null));
 
         SOAPFactory omFac = OMAbstractFactory.getSOAP11Factory();
 

Modified: webservices/axis/trunk/java/modules/core/test/org/apache/axis/handlers/addressing/AddressingOutHandlerTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/test/org/apache/axis/handlers/addressing/AddressingOutHandlerTest.java?rev=169400&r1=169399&r2=169400&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/test/org/apache/axis/handlers/addressing/AddressingOutHandlerTest.java
(original)
+++ webservices/axis/trunk/java/modules/core/test/org/apache/axis/handlers/addressing/AddressingOutHandlerTest.java
Mon May  9 20:06:44 2005
@@ -48,7 +48,9 @@
         super.setUp();
         outHandler = new AddressingOutHandler();
         testUtil = new TestUtil();
-        msgCtxt = new MessageContext(null, null, null,null,OperationContextFactory.createMEPContext(WSDLConstants.MEP_URI_IN_OUT,false,null,null));
+
+        msgCtxt = new MessageContext(null, null, null,null,OperationContextFactory.createMEPContext(WSDLConstants.MEP_CONSTANT_IN_OUT,false,null,null));
+
     }
 
     public void testAddToSOAPHeader() throws Exception {

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLConstants.java?rev=169400&r1=169399&r2=169400&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLConstants.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLConstants.java Mon May
 9 20:06:44 2005
@@ -29,25 +29,24 @@
 	 */
 	public static final String WSDL1_1_NAMESPACE = "http://schemas.xmlsoap.org/wsdl/";
 
-	/**
-	 * Field WSDL_NAMESPACES
-	 */
-	public static final String[] WSDL_NAMESPACES = { WSDL2_0_NAMESPACE,
-			WSDL1_1_NAMESPACE };
-
-	// TODO Verify weather the value is right with the spec.
-
+//	/**
+//	 * Field WSDL_NAMESPACES
+//	 */
+//	public static final String[] WSDL_NAMESPACES = { WSDL2_0_NAMESPACE,
+//			WSDL1_1_NAMESPACE };
+//
+//
 	/**
 	 * Field WSDL_MESSAGE_DIRECTION_IN
 	 */
-	public static final String WSDL_MESSAGE_DIRECTION_IN = "in";
+	public static final String WSDL_MESSAGE_DIRECTION_IN = "In";
 
 	// TODO Verify weather the value is right with the spec.
 
 	/**
 	 * Field WSDL_MESSAGE_DIRECTION_OUT
 	 */
-	public static final String WSDL_MESSAGE_DIRECTION_OUT = "out";
+	public static final String WSDL_MESSAGE_DIRECTION_OUT = "Out";
 
 	// ////////////////////////////////////////////////////////////////
 	// /////////////Message Exchange Pattern Constants/////////////////
@@ -57,41 +56,61 @@
 	 * Field MEP_URI_IN_ONLY
 	 */
 	public static final String MEP_URI_IN_ONLY = "http://www.w3.org/2004/08/wsdl/in-only";
+	
+	public static final int MEP_CONSTANT_IN_ONLY = 10;	
 
 	/**
 	 * Field MEP_URI_ROBUST_IN_ONLY
 	 */
 	public static final String MEP_URI_ROBUST_IN_ONLY = "http://www.w3.org/2004/08/wsdl/robust-in-only";
+	
+	public static final int MEP_CONSTANT_ROBUST_IN_ONLY = 11;
 
 	/**
 	 * Field MEP_URI_IN_OUT
 	 */
 	public static final String MEP_URI_IN_OUT = "http://www.w3.org/2004/08/wsdl/in-out";
+	
+	public static final int MEP_CONSTANT_IN_OUT = 12;
 
 	/**
 	 * Field MEP_URI_IN_OPTIONAL_OUT
 	 */
 	public static final String MEP_URI_IN_OPTIONAL_OUT = "http://www.w3.org/2004/08/wsdl/in-opt-out";
+	
+	public static final int MEP_CONSTANT_IN_OPTIONAL_OUT = 13;
 
 	/**
 	 * Field MEP_URI_OUT_ONLY
 	 */
 	public static final String MEP_URI_OUT_ONLY = "http://www.w3.org/2004/08/wsdl/out-only";
+	
+	public static final int MEP_CONSTANT_OUT_ONLY = 14;
 
 	/**
 	 * Field MEP_URI_ROBUST_OUT_ONLY
 	 */
 	public static final String MEP_URI_ROBUST_OUT_ONLY = "http://www.w3.org/2004/08/wsdl/robust-out-only";
+	
+	public static final int MEP_CONSTANT_ROBUST_OUT_ONLY = 15;
 
 	/**
 	 * Field MEP_URI_OUT_IN
 	 */
 	public static final String MEP_URI_OUT_IN = "http://www.w3.org/2004/08/wsdl/out-in";
+	
+	public static final int MEP_CONSTANT_OUT_IN = 16;
 
 	/**
 	 * Field MEP_URI_OUT_OPTIONL_IN
 	 */
 	public static final String MEP_URI_OUT_OPTIONAL_IN = "http://www.w3.org/2004/08/wsdl/out-opt-in";
+	
+	public static final int MEP_CONSTANT_OUT_OPTIONAL_IN = 17;
+	
+	
+	
+	public static final int MEP_CONSTANT_INVALID = -1;
 
 	//////////////////////////////////////////////////
 	//////////////// Message Labels///////////////////
@@ -102,7 +121,7 @@
 	 * following WSDL 2.0 defined MEPs: In-Only, Robust In-Only, In-Out,
 	 * In-Optional-Out, Out-In, Out-Optional-In.
 	 */
-	public static final byte MESSAGE_LABEL_IN = 0;
+	public static final int MESSAGE_LABEL_IN = 0;
 
 	/**
 	 * Constant to represent the message label "Out" which is used by the
@@ -110,5 +129,6 @@
 	 * Robust Out-Only, Out-In, Out-Optional-In.
 	 *  
 	 */
-	public static final byte MESSAGE_LABEL_OUT = 1;
+	public static final int MESSAGE_LABEL_OUT = 1;
+	
 }



Mime
View raw message