synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sami...@apache.org
Subject svn commit: r355886 - in /incubator/synapse/trunk/java/src/org/apache/synapse: SynapseEnvironment.java axis2/Axis2Sender.java axis2/Axis2SynapseEnvironment.java processors/builtin/SendProcessor.java
Date Sun, 11 Dec 2005 03:31:40 GMT
Author: saminda
Date: Sat Dec 10 19:31:38 2005
New Revision: 355886

URL: http://svn.apache.org/viewcvs?rev=355886&view=rev
Log:
Included SyanpseEnvironment to sendon processing

Modified:
    incubator/synapse/trunk/java/src/org/apache/synapse/SynapseEnvironment.java
    incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2Sender.java
    incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java
    incubator/synapse/trunk/java/src/org/apache/synapse/processors/builtin/SendProcessor.java

Modified: incubator/synapse/trunk/java/src/org/apache/synapse/SynapseEnvironment.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/src/org/apache/synapse/SynapseEnvironment.java?rev=355886&r1=355885&r2=355886&view=diff
==============================================================================
--- incubator/synapse/trunk/java/src/org/apache/synapse/SynapseEnvironment.java (original)
+++ incubator/synapse/trunk/java/src/org/apache/synapse/SynapseEnvironment.java Sat Dec 10
19:31:38 2005
@@ -49,7 +49,7 @@
 	 * <p>
 	 * This will send request messages on, and send response messages back to the client
 	 */
-	public void send(SynapseMessage smc);
+	public void send(SynapseMessage smc, SynapseEnvironment se);
 	
 	
 	/**

Modified: incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2Sender.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2Sender.java?rev=355886&r1=355885&r2=355886&view=diff
==============================================================================
--- incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2Sender.java (original)
+++ incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2Sender.java Sat Dec 10
19:31:38 2005
@@ -31,83 +31,85 @@
 import org.apache.synapse.Constants;
 import org.apache.synapse.SynapseException;
 import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.SynapseEnvironment;
 
 
 public class Axis2Sender {
 
-	public static void sendOn(SynapseMessage smc) {
+    public static void sendOn(SynapseMessage smc, SynapseEnvironment se) {
 
-		try {
+        try {
 
-			MessageContext messageContext = ((Axis2SynapseMessage) smc)
-					.getMessageContext();
-			AxisEngine ae = new AxisEngine(messageContext.getConfigurationContext());
-
-			ConfigurationContext sc = messageContext.getConfigurationContext();
-
-			MessageContext outMsgContext = Axis2FlexibleMEPClient
-					.send(messageContext);
-
-			// run all rules on response
-
-			outMsgContext.setServerSide(true);
-
-			// deal with the fact that AddressingOutHandler has a bug if
-			// there
-			// is no header at all.
-			if (outMsgContext.getEnvelope().getHeader() == null)
-				outMsgContext.getEnvelope().getBody().insertSiblingBefore(
-						OMAbstractFactory.getSOAP11Factory()
-								.getDefaultEnvelope().getHeader());
-			Object os = messageContext
-					.getProperty(MessageContext.TRANSPORT_OUT);
-			outMsgContext.setProperty(MessageContext.TRANSPORT_OUT, os);
-			Object ti = messageContext
-					.getProperty(HTTPConstants.HTTPOutTransportInfo);
-			outMsgContext.setProperty(HTTPConstants.HTTPOutTransportInfo, ti);
-
-			SynapseDispatcher sd = new SynapseDispatcher();
-			sd.initDispatcher();
-			AxisService synapseService = sd.findService(messageContext);
-			AxisOperation synapseOperation = sd.findOperation(synapseService,
-					messageContext);
-
-			outMsgContext.setConfigurationContext(sc);
-			outMsgContext.setAxisService(synapseService);
-			outMsgContext.setAxisOperation(synapseOperation);
-			outMsgContext.setOperationContext(OperationContextFactory
-					.createOperationContext(
-							OperationContextFactory.MEP_CONSTANT_OUT_ONLY,
-							synapseOperation));
-
-			ae.receive(outMsgContext);
-
-		} catch (Exception e) {
-			e.printStackTrace();
-			throw new SynapseException(e);
-		}
-	}
-
-	public static void sendBack(SynapseMessage smc) {
-		MessageContext messageContext = ((Axis2SynapseMessage) smc)
-				.getMessageContext();
-		AxisEngine ae = new AxisEngine(messageContext.getConfigurationContext());
-
-		if (messageContext.getEnvelope().getHeader() == null)
-			messageContext.getEnvelope().getBody().insertSiblingBefore(
-					OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope()
-							.getHeader());
-
-		messageContext.setProperty(Constants.ISRESPONSE_PROPERTY, new Boolean(
-				true));
-
-		try {
-			ae.send(messageContext);
-		} catch (AxisFault e) {
-			throw new SynapseException(e);
+            MessageContext messageContext = ((Axis2SynapseMessage) smc)
+                    .getMessageContext();
+            AxisEngine ae = new AxisEngine(messageContext.getConfigurationContext());
+
+            ConfigurationContext sc = messageContext.getConfigurationContext();
+
+            MessageContext outMsgContext = Axis2FlexibleMEPClient
+                    .send(messageContext);
+
+            // run all rules on response
+
+            outMsgContext.setServerSide(true);
+
+            // deal with the fact that AddressingOutHandler has a bug if
+            // there
+            // is no header at all.
+            if (outMsgContext.getEnvelope().getHeader() == null)
+                outMsgContext.getEnvelope().getBody().insertSiblingBefore(
+                        OMAbstractFactory.getSOAP11Factory()
+                                .getDefaultEnvelope().getHeader());
+            Object os = messageContext
+                    .getProperty(MessageContext.TRANSPORT_OUT);
+            outMsgContext.setProperty(MessageContext.TRANSPORT_OUT, os);
+            Object ti = messageContext
+                    .getProperty(HTTPConstants.HTTPOutTransportInfo);
+            outMsgContext.setProperty(HTTPConstants.HTTPOutTransportInfo, ti);
+
+//            SynapseDispatcher sd = new SynapseDispatcher();
+//            sd.initDispatcher();
+//            AxisService synapseService = sd.findService(messageContext);
+//            AxisOperation synapseOperation = sd.findOperation(synapseService,
+//                    messageContext);
+//
+//            outMsgContext.setConfigurationContext(sc);
+//            outMsgContext.setAxisService(synapseService);
+//            outMsgContext.setAxisOperation(synapseOperation);
+//            outMsgContext.setOperationContext(OperationContextFactory
+//                    .createOperationContext(
+//                            OperationContextFactory.MEP_CONSTANT_OUT_ONLY,
+//                            synapseOperation));
+//
+//            ae.receive(outMsgContext);
+            se.injectMessage(new Axis2SynapseMessage(outMsgContext));
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new SynapseException(e);
+        }
+    }
+
+    public static void sendBack(SynapseMessage smc) {
+        MessageContext messageContext = ((Axis2SynapseMessage) smc)
+                .getMessageContext();
+        AxisEngine ae = new AxisEngine(messageContext.getConfigurationContext());
+
+        if (messageContext.getEnvelope().getHeader() == null)
+            messageContext.getEnvelope().getBody().insertSiblingBefore(
+                    OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope()
+                            .getHeader());
+
+        messageContext.setProperty(Constants.ISRESPONSE_PROPERTY, new Boolean(
+                true));
+
+        try {
+            ae.send(messageContext);
+        } catch (AxisFault e) {
+            throw new SynapseException(e);
 
-		}
+        }
 
-	}
+    }
 
 }

Modified: incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java?rev=355886&r1=355885&r2=355886&view=diff
==============================================================================
--- incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java
(original)
+++ incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java
Sat Dec 10 19:31:38 2005
@@ -64,11 +64,11 @@
 		this.cl = cl;
 	}
 
-	public void send(SynapseMessage sm) {
+	public void send(SynapseMessage sm, SynapseEnvironment se) {
 		if (sm.isResponse()) 
 			Axis2Sender.sendBack(sm);
 		else 
-			Axis2Sender.sendOn(sm);
+			Axis2Sender.sendOn(sm, se);
 	}
 
 	

Modified: incubator/synapse/trunk/java/src/org/apache/synapse/processors/builtin/SendProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/src/org/apache/synapse/processors/builtin/SendProcessor.java?rev=355886&r1=355885&r2=355886&view=diff
==============================================================================
--- incubator/synapse/trunk/java/src/org/apache/synapse/processors/builtin/SendProcessor.java
(original)
+++ incubator/synapse/trunk/java/src/org/apache/synapse/processors/builtin/SendProcessor.java
Sat Dec 10 19:31:38 2005
@@ -37,7 +37,7 @@
 	
 	public boolean process(SynapseEnvironment se, SynapseMessage smc) {
 		log.debug("process");
-		se.send(smc);
+		se.send(smc, se);
 		return false;
 
 	}



---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org


Mime
View raw message