You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by sa...@apache.org on 2006/01/04 08:26:37 UTC
svn commit: r365848 - in /incubator/synapse/trunk/java: ./
repository/modules/ src/org/apache/synapse/ src/org/apache/synapse/axis2/
src/org/apache/synapse/processors/builtin/axis2/
synapse-test-resources/axis2/ test/org/apache/synapse/spi/processors/
Author: saminda
Date: Tue Jan 3 23:26:14 2006
New Revision: 365848
URL: http://svn.apache.org/viewcvs?rev=365848&view=rev
Log:
Major change in AddressinInProcessor, SynapseEnvironment and SendProcessor.
1.By default Synapse will engage addressing module :). Using the Axis2' property setting on message context
(msgContext.setProperty(Constants.Configuration.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.TRUE) at runtime Axis2
can false through AddressingOutHandler even though addressing is engaged. If a rule say <engage-addressing-in/> and
Synapse will hit AddressingInProcessor. There Processor set the property
se.setProperty(Constants.ADDRESSING_PROCESSED,Boolean.TRUE); . This property will late use to false through
AddressingOutHandler.
2.SynapseEnviroment has changed to a abstract class. This call hold the property bag.
Modified:
incubator/synapse/trunk/java/maven.xml
incubator/synapse/trunk/java/repository/modules/addressing.mar
incubator/synapse/trunk/java/src/org/apache/synapse/Constants.java
incubator/synapse/trunk/java/src/org/apache/synapse/SynapseEnvironment.java
incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.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/axis2/AddressingInProcessor.java
incubator/synapse/trunk/java/synapse-test-resources/axis2/axis2.xml
incubator/synapse/trunk/java/test/org/apache/synapse/spi/processors/AddressingProcessorTest.java
Modified: incubator/synapse/trunk/java/maven.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/maven.xml?rev=365848&r1=365847&r2=365848&view=diff
==============================================================================
--- incubator/synapse/trunk/java/maven.xml (original)
+++ incubator/synapse/trunk/java/maven.xml Tue Jan 3 23:26:14 2006
@@ -52,13 +52,13 @@
<include name="**"/>
</jar>
<echo message="----------------Creating Empty Mediator aar----------------"/>
- <!--<mkdir dir="target/services/emptymediator/META-INF"/>-->
- <!--<copy file="synapse-test-resources/axis2/services/emptymediator/META-INF/services.xml"-->
- <!--tofile="target/services/emptymediator/META-INF/services.xml"/>-->
- <!--<jar jarfile="target/emptymediator.aar"-->
- <!--basedir="target/services/emptymediator">-->
- <!--<include name="**"/>-->
- <!--</jar>-->
+ <mkdir dir="target/services/emptymediator/META-INF"/>
+ <copy file="synapse-test-resources/axis2/services/emptymediator/META-INF/services.xml"
+ tofile="target/services/emptymediator/META-INF/services.xml"/>
+ <jar jarfile="target/emptymediator.aar"
+ basedir="target/services/emptymediator">
+ <include name="**"/>
+ </jar>
<j:if test="${context.getVariable('maven.test.skip') != 'true'}">
<echo message="----------------Creating NPE aar----------------"/>
@@ -102,8 +102,8 @@
tofile="target/synapse-repository-sendon/services/synapse.aar"/>
<copy file="target/npe.aar"
tofile="target/synapse-repository-sendon/services/npe.aar"/>
- <!--<copy file="target/emptymediator.aar"-->
- <!--tofile="target/synapse-repository-sendon/services/emptymediator.aar"/>-->
+ <copy file="target/emptymediator.aar"
+ tofile="target/synapse-repository-sendon/services/emptymediator.aar"/>
<mkdir dir="target/synapse-repository-sendon/modules"/>
<copy file="synapse-test-resources/axis2/modules/addressing.mar"
tofile="target/synapse-repository-sendon/modules/addressing.mar"/>
@@ -119,8 +119,8 @@
tofile="target/synapse-repository-sendonAxis2/services/npe.aar"/>
<copy file="target/test-mediator.aar"
tofile="target/synapse-repository-sendonAxis2/services/test-mediator.aar"/>
-
-
+ <copy file="target/emptymediator.aar"
+ tofile="target/synapse-repository-sendonAxis2/services/emptymediator.aar"/>
<copy file="synapse-test-resources/axis2/modules/addressing.mar"
tofile="target/synapse-repository-sendonAxis2/modules/addressing.mar"/>
<copy file="repository/axis2.xml"
@@ -131,6 +131,8 @@
<copy file="target/environmentaware-mediator.aar"
tofile="target/synapse-repository-environmentaware/services/environmentaware-mediator.aar"/>
+ <copy file="target/emptymediator.aar"
+ tofile="target/synapse-repository-sendon/services/emptymediator.aar"/>
<copy file="target/synapse.aar"
tofile="target/synapse-repository-environmentaware/services/synapse.aar"/>
<copy file="synapse-test-resources/axis2/modules/addressing.mar"
@@ -153,8 +155,8 @@
<mkdir dir="target/synapse-repository"/>
<copy file="target/synapse.aar"
tofile="target/synapse-repository/services/synapse.aar"/>
- <!--<copy file="target/emptymediator.aar"-->
- <!--tofile="target/synapse-repository/services/emptymediator.aar"/>-->
+ <copy file="target/emptymediator.aar"
+ tofile="target/synapse-repository/services/emptymediator.aar"/>
<mkdir dir="target/synapse-repository/modules"/>
<copy file="synapse-test-resources/axis2/modules/addressing.mar"
tofile="target/synapse-repository/modules/addressing.mar"/>
@@ -167,8 +169,8 @@
<mkdir dir="target/synapse-repository-fault"/>
<copy file="target/synapse.aar"
tofile="target/synapse-repository-fault/services/synapse.aar"/>
- <!--<copy file="target/emptymediator.aar"-->
- <!--tofile="target/synapse-repository-fault/services/emptymediator.aar"/>-->
+ <copy file="target/emptymediator.aar"
+ tofile="target/synapse-repository-fault/services/emptymediator.aar"/>
<mkdir dir="target/synapse-repository-fault/modules"/>
<copy file="synapse-test-resources/axis2/modules/addressing.mar"
tofile="target/synapse-repository-fault/modules/addressing.mar"/>
@@ -181,8 +183,8 @@
<mkdir dir="target/synapse-repository-send"/>
<copy file="target/synapse.aar"
tofile="target/synapse-repository-send/services/synapse.aar"/>
- <!--<copy file="target/emptymediator.aar"-->
- <!--tofile="target/synapse-repository-send/services/emptymediator.aar"/>-->
+ <copy file="target/emptymediator.aar"
+ tofile="target/synapse-repository-send/services/emptymediator.aar"/>
<mkdir dir="target/synapse-repository-send/modules"/>
<copy file="synapse-test-resources/axis2/modules/addressing.mar"
tofile="target/synapse-repository-send/modules/addressing.mar"/>
@@ -219,7 +221,7 @@
<ant:delete dir="target/modules"/>
<ant:delete dir="target/services"/>
- <!--<ant:delete file="target/emptymediator.aar"/>-->
+ <ant:delete file="target/emptymediator.aar"/>
<ant:delete file="target/synapse.aar"/>
<ant:delete dir="target/sample-deprecation"/>
<ant:delete file="target/DeprecationMediator.aar"/>
Modified: incubator/synapse/trunk/java/repository/modules/addressing.mar
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/repository/modules/addressing.mar?rev=365848&r1=365847&r2=365848&view=diff
==============================================================================
Binary files - no diff available.
Modified: incubator/synapse/trunk/java/src/org/apache/synapse/Constants.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/src/org/apache/synapse/Constants.java?rev=365848&r1=365847&r2=365848&view=diff
==============================================================================
--- incubator/synapse/trunk/java/src/org/apache/synapse/Constants.java (original)
+++ incubator/synapse/trunk/java/src/org/apache/synapse/Constants.java Tue Jan 3 23:26:14 2006
@@ -51,8 +51,7 @@
String SECURITY_QOS = "synapse_security";
String ADDRESSING_PROCESSED_CONFIGURATION_CONTEXT = "addressing_processed_configurationContext";
- // Synapse's client side repository settng
+ // addressing properites handling
- String DIRECTORY_HOME_SYNAPSE_AS_CLIENT = ".synapse_as_client";
- String HOME_USER = "user.home";
+ String ADDRESSING_PROCESSED = "__ADDRESSING_PROCESSED";
}
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=365848&r1=365847&r2=365848&view=diff
==============================================================================
--- incubator/synapse/trunk/java/src/org/apache/synapse/SynapseEnvironment.java (original)
+++ incubator/synapse/trunk/java/src/org/apache/synapse/SynapseEnvironment.java Tue Jan 3 23:26:14 2006
@@ -15,6 +15,9 @@
*/
package org.apache.synapse;
+import java.util.Map;
+import java.util.HashMap;
+
/**
*
@@ -24,57 +27,101 @@
*
*
*/
-public interface SynapseEnvironment {
-
- /*
- * This method injects a new message into the Synapse engine
- * It is used in a couple of ways. Firstly, this is how, for example,
- * Axis2 kicks messages into Synapse to start with.
- * <p>
- * Also mediators can use this to send messages that they want to be mediated by Synapse
- * <p>For example if you want to send a copy of a message somewhere, you can clone it and then
- * injectMessage()
- */
- public void injectMessage(SynapseMessage smc);
-
- /*
- * Processors or Mediators that wish to load classes should use the ClassLoader given here
- */
- public ClassLoader getClassLoader();
-
-
- /**
- * This method allows you send messages on. As opposed to injectMessage send message does not
- * process these through Synapse.
- * <p>
- * This will send request messages on, and send response messages back to the client
- */
- public void send(SynapseMessage smc, SynapseEnvironment se);
-
-
- /**
- * This is used by the references to find a processor with a given name
- *
- */
- public Processor lookupProcessor(String name);
-
-
- /**
- * This is how you add a processor to the list of processors. The name which it can be
- * retrieved by is the processor.getName()
- */
- public void addProcessor(Processor p);
-
-
- /**
- * This returns the "Master Processor" which is the root processor for this instance of
- * Synapse. Usually this would be the processor derived from <synapse>.
- */
- public Processor getMasterProcessor();
-
-
- /**
- * This sets the root processor for the engine.
- */
- public void setMasterProcessor(Processor p);
+public abstract class SynapseEnvironment {
+
+ protected SynapseEnvironment parent;
+ protected Map properties;
+
+ protected SynapseEnvironment(SynapseEnvironment parent) {
+ this.properties = new HashMap();
+ this.parent = parent;
+ }
+
+ public SynapseEnvironment getParent() {
+ return this.parent;
+ }
+
+ public void setParent(SynapseEnvironment parent) {
+ this.parent = parent;
+ }
+
+ /**
+ * Retrieves an object given a key.
+ *
+ * @param key - if not found, will return null
+ * @return Returns the property.
+ */
+ public Object getProperty(String key) {
+ Object obj = null;
+
+ obj = properties.get(key);
+
+ if ((obj == null) && (parent != null)) {
+ obj = parent.getProperty(key);
+ }
+
+ return obj;
+ }
+
+ /**
+ * Store a property for message context
+ *
+ * @param key
+ * @param value
+ */
+ public void setProperty(String key, Object value) {
+ properties.put(key, value);
+ }
+
+ /*
+ * This method injects a new message into the Synapse engine
+ * It is used in a couple of ways. Firstly, this is how, for example,
+ * Axis2 kicks messages into Synapse to start with.
+ * <p>
+ * Also mediators can use this to send messages that they want to be mediated by Synapse
+ * <p>For example if you want to send a copy of a message somewhere, you can clone it and then
+ * injectMessage()
+ */
+ abstract public void injectMessage(SynapseMessage smc);
+
+ /*
+ * Processors or Mediators that wish to load classes should use the ClassLoader given here
+ */
+ abstract public ClassLoader getClassLoader();
+
+
+ /**
+ * This method allows you send messages on. As opposed to injectMessage send message does not
+ * process these through Synapse.
+ * <p>
+ * This will send request messages on, and send response messages back to the client
+ */
+ abstract public void send(SynapseMessage smc, SynapseEnvironment se);
+
+
+ /**
+ * This is used by the references to find a processor with a given name
+ *
+ */
+ abstract public Processor lookupProcessor(String name);
+
+
+ /**
+ * This is how you add a processor to the list of processors. The name which it can be
+ * retrieved by is the processor.getName()
+ */
+ abstract public void addProcessor(Processor p);
+
+
+ /**
+ * This returns the "Master Processor" which is the root processor for this instance of
+ * Synapse. Usually this would be the processor derived from <synapse>.
+ */
+ abstract public Processor getMasterProcessor();
+
+
+ /**
+ * This sets the root processor for the engine.
+ */
+ abstract public void setMasterProcessor(Processor p);
}
Modified: incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java?rev=365848&r1=365847&r2=365848&view=diff
==============================================================================
--- incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java (original)
+++ incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java Tue Jan 3 23:26:14 2006
@@ -25,6 +25,8 @@
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPHeader;
+import org.apache.axis2.soap.SOAPHeaderBlock;
import org.apache.axis2.util.UUIDGenerator;
import org.apache.axis2.deployment.util.PhasesInfo;
import org.apache.axis2.AxisFault;
@@ -36,6 +38,7 @@
import javax.xml.namespace.QName;
+import java.util.Iterator;
/**
@@ -45,10 +48,18 @@
private static SOAPEnvelope outEnvelopeConfiguration(MessageContext smc) {
SOAPEnvelope env = smc.getEnvelope();
- env.getHeader().detach();
+ SOAPHeader soapHeader = env.getHeader();
+ if (soapHeader != null) {
+ Iterator iterator = soapHeader.getChildren();
+ while (iterator.hasNext()) {
+ SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) iterator.next();
+ headerBlock.detach();
+ }
+ }
return env;
}
- // Following code is based on Axis2 Client code.
+
+ // Following code is based on Axis2 Client code.
public static MessageContext send(MessageContext smc) throws AxisFault {
// In this logic Synapse Work as a Client to a Server
// So here this logic should expect 200 ok, 202 ok and 500 internal server error
@@ -121,7 +132,7 @@
// variable
response.setDoingREST(smc.isDoingREST());
response.setProperty(Constants.ISRESPONSE_PROPERTY, new Boolean(
- true));
+ true));
return response;
}
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=365848&r1=365847&r2=365848&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 Tue Jan 3 23:26:14 2006
@@ -49,6 +49,16 @@
MessageContext messageContext = ((Axis2SynapseMessage) smc)
.getMessageContext();
+ // runtime switch between AddressingOutProcessor.
+ // By default addressing is engaged. At runtime we check
+ // SynapseEnvironemnt, whether Addressing engaged. If not using the following code
+ // ar runtime Synapse will desable Axis2's AddressingOutHandler
+ if (se.getProperty(Constants.ADDRESSING_PROCESSED) == null) {
+ messageContext
+ .setProperty(
+ org.apache.axis2.Constants.Configuration.DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
+ Boolean.TRUE);
+ }
MessageContext outMsgContext = Axis2FlexibleMEPClient
.send(messageContext);
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=365848&r1=365847&r2=365848&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 Tue Jan 3 23:26:14 2006
@@ -36,19 +36,18 @@
* <p> This is the Axis2 implementation of the SynapseEnvironment
*
*/
-public class Axis2SynapseEnvironment implements SynapseEnvironment {
+public class Axis2SynapseEnvironment extends SynapseEnvironment {
private Processor mainprocessor = null;
private ClassLoader cl = null;
private Map processors = new HashMap();
- private HashMap environmentProperties = new HashMap();
private Log log = LogFactory.getLog(getClass());
public Axis2SynapseEnvironment(OMElement synapseConfiguration,
ClassLoader cl) {
- super();
+ super(null);
this.cl = cl;
if (synapseConfiguration!=null)
mainprocessor = ProcessorConfiguratorFinder.getProcessor(this, synapseConfiguration);
@@ -92,11 +91,4 @@
public void setMasterProcessor(Processor p) {
mainprocessor = p;
}
- // Need to have a parent and set it
- public void setProperty(String key, Object value) {
- environmentProperties.put(key,value);
- }
- public Object getProperty(String key) {
- return environmentProperties.get(key);
- }
}
Modified: incubator/synapse/trunk/java/src/org/apache/synapse/processors/builtin/axis2/AddressingInProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/src/org/apache/synapse/processors/builtin/axis2/AddressingInProcessor.java?rev=365848&r1=365847&r2=365848&view=diff
==============================================================================
--- incubator/synapse/trunk/java/src/org/apache/synapse/processors/builtin/axis2/AddressingInProcessor.java (original)
+++ incubator/synapse/trunk/java/src/org/apache/synapse/processors/builtin/axis2/AddressingInProcessor.java Tue Jan 3 23:26:14 2006
@@ -17,7 +17,6 @@
package org.apache.synapse.processors.builtin.axis2;
-
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.*;
import org.apache.axis2.description.AxisOperation;
@@ -49,106 +48,140 @@
public class AddressingInProcessor extends AbstractProcessor {
private Log log = LogFactory.getLog(getClass());
+// public boolean process(SynapseEnvironment se, SynapseMessage smc) {
+// log.debug("process");
+// try {
+// MessageContext mc = ((Axis2SynapseMessage) smc)
+// .getMessageContext();
+// ///////////////////////////////////////////////////////////////////
+// // Default Configurations. We are not going to alter these configurtions
+// ConfigurationContext cc = mc.getConfigurationContext();
+// AxisConfiguration ac = cc.getAxisConfiguration();
+// //////////////////////////////////////////////////////////////////
+//// AxisService as = ac.getService(Constants.EMPTYMEDIATOR);
+//// if (as == null)
+//// throw new SynapseException("cannot locate service "
+//// + Constants.EMPTYMEDIATOR);
+//
+// ///////////////////////////////////////////////////////////////////
+// //////////////////////////////////////////////////////////////////
+// // making addressing on/off behavior possible
+// // default addressing is on. Allow MessageContext to pass through the chain
+// // and fill the addressingHeaderInformation. Once the chain is excuted old ConfigurationContext
+// // set to the MessageContext.
+// // inorder to make this possible, we create a new ConfigurationContext
+// // from scratch. Then add the service, operation and MessageReceiver
+// // programatically. After the invocation, old ConfigurationContext and
+// // AxisConfiguration is set to the MessageContext
+//
+// ConfigurationContextFactory configCtxFac =
+// new ConfigurationContextFactory();
+// ConfigurationContext configCtx =
+// configCtxFac.buildConfigurationContext(null);
+// AxisConfiguration axisConfig = configCtx.getAxisConfiguration();
+//
+// AxisService service = new AxisService(Constants.EMPTYMEDIATOR);
+// service.setClassLoader(ac.getServiceClassLoader());
+// AxisOperation axisOp =
+// new InOutAxisOperation(Constants.MEDIATE_OPERATION_NAME);
+// axisOp.setMessageReceiver(new EmptyMessageReceiver());
+// service.addOperation(axisOp);
+// axisConfig.addService(service);
+//
+// mc.setConfigurationContext(configCtx);
+//
+// //setging the addressing enable ConfigurationContext to SynapeMessage
+//
+// smc.setProperty(
+// Constants.ADDRESSING_PROCESSED_CONFIGURATION_CONTEXT,
+// configCtx);
+// //////////////////////////////////////////////////////////////////
+// //////////////////////////////////////////////////////////////////
+// //AxisEngine ae = new AxisEngine(cc);
+// AxisEngine ae = new AxisEngine(configCtx);
+//
+// // see if addressing already engage
+//// boolean addressingModuleEngage = false;
+//// for (Iterator iterator = ac.getEngagedModules().iterator();
+//// iterator.hasNext();) {
+//// QName qname = (QName) iterator.next();
+//// if (qname.getLocalPart()
+//// .equals(org.apache.axis2.Constants.MODULE_ADDRESSING)) {
+//// addressingModuleEngage = true;
+//// break;
+//// }
+//// }
+//// if (!addressingModuleEngage) {
+//// ac.engageModule(new QName(
+//// org.apache.axis2.Constants.MODULE_ADDRESSING));
+//// }
+//// AxisOperation ao = as
+//// .getOperation(Constants.MEDIATE_OPERATION_NAME);
+//// OperationContext oc = OperationContextFactory
+//// .createOperationContext(ao.getAxisSpecifMEPConstant(), ao);
+// OperationContext oc = OperationContextFactory
+// .createOperationContext(axisOp.getAxisSpecifMEPConstant(),
+// axisOp);
+// //ao.registerOperationContext(mc, oc);
+// axisOp.registerOperationContext(mc, oc);
+//
+// //ServiceContext sc = Utils.fillContextInformation(ao, as, cc);
+// ServiceContext sc =
+// Utils.fillContextInformation(axisOp, service, configCtx);
+// oc.setParent(sc);
+//
+// mc.setOperationContext(oc);
+// mc.setServiceContext(sc);
+//
+//// mc.setAxisOperation(ao);
+//// mc.setAxisService(as);
+// mc.setAxisOperation(axisOp);
+// mc.setAxisService(service);
+//
+// ae.receive(mc);
+// //////////////////////////////////////////////////////////////////////
+// // Now the MessageContext is filled with SOAP properties. We don't need to send
+// // this message anymore time through AddressingInHandler. But we need to send it through
+// // AddressingOutHandler
+// // Thus, setting the Default ConfigurationContext
+// mc.setConfigurationContext(cc);
+// /////////////////////////////////////////////////////////////////////
+//
+// } catch (AxisFault e) {
+// throw new SynapseException(e);
+// }
+// return true;
+// }
+
public boolean process(SynapseEnvironment se, SynapseMessage smc) {
- log.debug("process");
+ log.debug("Processing __AddressingInHandler__");
try {
- MessageContext mc = ((Axis2SynapseMessage) smc)
- .getMessageContext();
- ///////////////////////////////////////////////////////////////////
- // Default Configurations. We are not going to alter these configurtions
+ MessageContext mc = ((Axis2SynapseMessage)smc).getMessageContext();
+ se.setProperty(Constants.ADDRESSING_PROCESSED,Boolean.TRUE);
+ // default configuration_contex and axis_configuration
ConfigurationContext cc = mc.getConfigurationContext();
AxisConfiguration ac = cc.getAxisConfiguration();
- //////////////////////////////////////////////////////////////////
-// AxisService as = ac.getService(Constants.EMPTYMEDIATOR);
-// if (as == null)
-// throw new SynapseException("cannot locate service "
-// + Constants.EMPTYMEDIATOR);
-
- ///////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////
- // making addressing on/off behavior possible
- // default addressing is on. Allow MessageContext to pass through the chain
- // and fill the addressingHeaderInformation. Once the chain is excuted old ConfigurationContext
- // set to the MessageContext.
- // inorder to make this possible, we create a new ConfigurationContext
- // from scratch. Then add the service, operation and MessageReceiver
- // programatically. After the invocation, old ConfigurationContext and
- // AxisConfiguration is set to the MessageContext
-
- ConfigurationContextFactory configCtxFac =
- new ConfigurationContextFactory();
- ConfigurationContext configCtx =
- configCtxFac.buildConfigurationContext(null);
- AxisConfiguration axisConfig = configCtx.getAxisConfiguration();
-
- AxisService service = new AxisService(Constants.EMPTYMEDIATOR);
- service.setClassLoader(ac.getServiceClassLoader());
- AxisOperation axisOp =
- new InOutAxisOperation(Constants.MEDIATE_OPERATION_NAME);
- axisOp.setMessageReceiver(new EmptyMessageReceiver());
- service.addOperation(axisOp);
- axisConfig.addService(service);
-
- mc.setConfigurationContext(configCtx);
-
- //setging the addressing enable ConfigurationContext to SynapeMessage
-
- smc.setProperty(Constants.ADDRESSING_PROCESSED_CONFIGURATION_CONTEXT,
- configCtx);
- //////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////
- //AxisEngine ae = new AxisEngine(cc);
- AxisEngine ae = new AxisEngine(configCtx);
-
- // see if addressing already engage
-// boolean addressingModuleEngage = false;
-// for (Iterator iterator = ac.getEngagedModules().iterator();
-// iterator.hasNext();) {
-// QName qname = (QName) iterator.next();
-// if (qname.getLocalPart()
-// .equals(org.apache.axis2.Constants.MODULE_ADDRESSING)) {
-// addressingModuleEngage = true;
-// break;
-// }
-// }
-// if (!addressingModuleEngage) {
-// ac.engageModule(new QName(
-// org.apache.axis2.Constants.MODULE_ADDRESSING));
-// }
-// AxisOperation ao = as
-// .getOperation(Constants.MEDIATE_OPERATION_NAME);
-// OperationContext oc = OperationContextFactory
-// .createOperationContext(ao.getAxisSpecifMEPConstant(), ao);
+ AxisService as = ac.getService(Constants.EMPTYMEDIATOR);
+ if (as == null)
+ throw new SynapseException("cannot locate service "
+ + Constants.EMPTYMEDIATOR);
+
+ AxisEngine ae = new AxisEngine(cc);
+ AxisOperation ao = as
+ .getOperation(Constants.MEDIATE_OPERATION_NAME);
OperationContext oc = OperationContextFactory
- .createOperationContext(axisOp.getAxisSpecifMEPConstant(),
- axisOp);
- //ao.registerOperationContext(mc, oc);
- axisOp.registerOperationContext(mc, oc);
-
- //ServiceContext sc = Utils.fillContextInformation(ao, as, cc);
- ServiceContext sc =
- Utils.fillContextInformation(axisOp, service, configCtx);
+ .createOperationContext(ao.getAxisSpecifMEPConstant(), ao);
+ ao.registerOperationContext(mc,oc);
+ ServiceContext sc = Utils.fillContextInformation(ao, as, cc);
oc.setParent(sc);
-
- mc.setOperationContext(oc);
- mc.setServiceContext(sc);
-
-// mc.setAxisOperation(ao);
-// mc.setAxisService(as);
- mc.setAxisOperation(axisOp);
- mc.setAxisService(service);
-
+ mc.setAxisOperation(ao);
+ mc.setAxisService(as);
ae.receive(mc);
- //////////////////////////////////////////////////////////////////////
- // Now the MessageContext is filled with SOAP properties. We don't need to send
- // this message anymore time through AddressingInHandler. But we need to send it through
- // AddressingOutHandler
- // Thus, setting the Default ConfigurationContext
- mc.setConfigurationContext(cc);
- /////////////////////////////////////////////////////////////////////
- } catch (AxisFault e) {
- throw new SynapseException(e);
+ } catch (AxisFault axisFault) {
+ throw new SynapseException(
+ "__AddresingInHandler__ caught an Exception" +
+ axisFault.getMessage());
}
return true;
}
Modified: incubator/synapse/trunk/java/synapse-test-resources/axis2/axis2.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/synapse-test-resources/axis2/axis2.xml?rev=365848&r1=365847&r2=365848&view=diff
==============================================================================
--- incubator/synapse/trunk/java/synapse-test-resources/axis2/axis2.xml (original)
+++ incubator/synapse/trunk/java/synapse-test-resources/axis2/axis2.xml Tue Jan 3 23:26:14 2006
@@ -60,15 +60,15 @@
<parameter name="port" locked="false">6060</parameter>
</transportReceiver>
- <!--<transportReceiver name="jms"-->
- <!--class="org.apache.axis2.transport.jms.SimpleJMSListener">-->
- <!--<parameter name="transport.jms.Destination" locked="false">-->
- <!--dynamicQueues/FOO</parameter>-->
- <!--<parameter name="java.naming.factory.initial" locked="false">-->
- <!--org.activemq.jndi.ActiveMQInitialContextFactory</parameter>-->
- <!--<parameter name="java.naming.provider.url" locked="false">-->
- <!--tcp://localhost:61616</parameter>-->
- <!--</transportReceiver>-->
+ <transportReceiver name="jms"
+ class="org.apache.axis2.transport.jms.SimpleJMSListener">
+ <parameter name="transport.jms.Destination" locked="false">
+ dynamicQueues/FOO</parameter>
+ <parameter name="java.naming.factory.initial" locked="false">
+ org.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url" locked="false">
+ tcp://localhost:61616</parameter>
+ </transportReceiver>
<!-- ================================================= -->
<!-- Transport Outs -->
@@ -78,8 +78,8 @@
class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
<transportSender name="local"
class="org.apache.axis2.transport.local.LocalTransportSender"/>
- <!--<transportSender name="jms"-->
- <!--class="org.apache.axis2.transport.jms.JMSSender"/>-->
+ <transportSender name="jms"
+ class="org.apache.axis2.transport.jms.JMSSender"/>
<transportSender name="http"
class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
<parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
@@ -102,7 +102,7 @@
<!-- Global Modules -->
<!-- ================================================= -->
<!-- Comment this to disable Addressing -->
- <!--<module ref="addressing"/>-->
+ <module ref="addressing"/>
<!--Configuring module , providing parameters for modules whether they refer or not-->
Modified: incubator/synapse/trunk/java/test/org/apache/synapse/spi/processors/AddressingProcessorTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/org/apache/synapse/spi/processors/AddressingProcessorTest.java?rev=365848&r1=365847&r2=365848&view=diff
==============================================================================
--- incubator/synapse/trunk/java/test/org/apache/synapse/spi/processors/AddressingProcessorTest.java (original)
+++ incubator/synapse/trunk/java/test/org/apache/synapse/spi/processors/AddressingProcessorTest.java Tue Jan 3 23:26:14 2006
@@ -4,8 +4,10 @@
import org.apache.synapse.SynapseMessage;
import org.apache.synapse.Constants;
import org.apache.synapse.Processor;
+import org.apache.synapse.SynapseEnvironment;
import org.apache.synapse.processors.builtin.axis2.AddressingInProcessor;
import org.apache.synapse.axis2.Axis2SynapseMessage;
+import org.apache.synapse.axis2.Axis2SynapseEnvironment;
import junit.framework.TestCase;
/*
* Copyright 2004,2005 The Apache Software Foundation.
@@ -30,7 +32,8 @@
SynapseMessage sm = new Axis2SynapseMessage(
Axis2EvnSetup.axis2Deployment("target/synapse-repository"));
Processor addressingProcessor = new AddressingInProcessor();
- boolean result = addressingProcessor.process(null,sm);
+ SynapseEnvironment env = new Axis2SynapseEnvironment(null,null);
+ boolean result = addressingProcessor.process(env,sm);
assertTrue(((Boolean) sm.getProperty(
Constants.MEDIATOR_RESPONSE_PROPERTY)).booleanValue());
assertTrue(result);
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org