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/07/11 15:40:30 UTC

svn commit: r420842 - in /incubator/synapse/trunk/java: ./ modules/core/src/org/apache/synapse/ modules/core/src/org/apache/synapse/config/xml/ modules/core/src/org/apache/synapse/core/axis2/ modules/core/src/org/apache/synapse/mediators/builtin/ repos...

Author: saminda
Date: Tue Jul 11 06:40:29 2006
New Revision: 420842

URL: http://svn.apache.org/viewvc?rev=420842&view=rev
Log:
1. Added RMMediator/RMMediatorFactory to enableRM on incomming messages
2. Updated dependencies. 

Added:
    incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/EmptyRMMessageReceiver.java
    incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/mediators/builtin/RMMediator.java
Removed:
    incubator/synapse/trunk/java/repository/conf/sample/axis2.xml
Modified:
    incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/Constants.java
    incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/MediatorFactoryFinder.java
    incubator/synapse/trunk/java/project.properties
    incubator/synapse/trunk/java/project.xml
    incubator/synapse/trunk/java/repository/conf/axis2.xml

Modified: incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/Constants.java
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/Constants.java?rev=420842&r1=420841&r2=420842&view=diff
==============================================================================
--- incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/Constants.java (original)
+++ incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/Constants.java Tue Jul 11 06:40:29 2006
@@ -75,4 +75,6 @@
     /** The QName of the WS-Security Rampart module */
     QName RAMPART_MODULE_NAME = new QName("rampart");
 
+    String MESSAGE_RECEIVED_RM_ENGAGED = "__MESSAGE_RECEIVED_RM_ENGAGED__";
+
 }

Modified: incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/MediatorFactoryFinder.java
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/MediatorFactoryFinder.java?rev=420842&r1=420841&r2=420842&view=diff
==============================================================================
--- incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/MediatorFactoryFinder.java (original)
+++ incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/MediatorFactoryFinder.java Tue Jul 11 06:40:29 2006
@@ -64,7 +64,8 @@
         SwitchCaseMediatorFactory.class,
         SwitchCaseDefaultMediatorFactory.class,
         InMediatorFactory.class,
-        OutMediatorFactory.class
+        OutMediatorFactory.class,
+        RMMediatorFactory.class
       };
 
     private static final String STR_SCHEMA =

Added: incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/EmptyRMMessageReceiver.java
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/EmptyRMMessageReceiver.java?rev=420842&view=auto
==============================================================================
--- incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/EmptyRMMessageReceiver.java (added)
+++ incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/EmptyRMMessageReceiver.java Tue Jul 11 06:40:29 2006
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.synapse.core.axis2;
+
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.AxisFault;
+/*
+ * 
+ */
+
+public class EmptyRMMessageReceiver implements MessageReceiver {
+    public void receive(MessageContext messageContext) throws AxisFault {
+        /*
+         Message Recieved with RM
+        */
+        //TODO : SynapseEnvironment Inject
+        messageContext.setProperty(
+                org.apache.synapse.Constants.MESSAGE_RECEIVED_RM_ENGAGED,
+                Boolean.TRUE);
+
+    }
+}

Added: incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/mediators/builtin/RMMediator.java
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/mediators/builtin/RMMediator.java?rev=420842&view=auto
==============================================================================
--- incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/mediators/builtin/RMMediator.java (added)
+++ incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/mediators/builtin/RMMediator.java Tue Jul 11 06:40:29 2006
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.synapse.mediators.builtin;
+
+import org.apache.synapse.mediators.AbstractMediator;
+import org.apache.synapse.MessageContext;
+import org.apache.synapse.Constants;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.core.axis2.Axis2MessageContext;
+import org.apache.synapse.core.axis2.EmptyRMMessageReceiver;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.context.OperationContextFactory;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.InOutAxisOperation;
+import org.apache.axis2.description.AxisModule;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.util.Utils;
+
+import javax.xml.namespace.QName;
+/*
+ * 
+ */
+
+public class RMMediator extends AbstractMediator {
+
+    private static Log log = LogFactory.getLog(RMMediator.class);
+
+    private static final String EMPTY_RM_ENGAGED_SERVICE =
+            "__EMPTY_RM_ENGAGED_SERVICE__";
+    private static final QName EMPTY_OPERATION =
+            new QName("__EMPTY_OPERTAION__");
+
+    public boolean mediate(MessageContext synCtx) {
+        log.debug("RM Mediator  ::  mediate() ");
+        org.apache.axis2.context.MessageContext msgCtx =
+                ((Axis2MessageContext) synCtx).getAxis2MessageContext();
+
+        ConfigurationContext cc = msgCtx.getConfigurationContext();
+        AxisConfiguration ac = cc.getAxisConfiguration();
+
+        try {
+            rmEnabledService(cc, ac, msgCtx);
+
+            AxisEngine ae = new AxisEngine(cc);
+
+            ae.receive(msgCtx);
+
+            if (msgCtx.getProperty(
+                    org.apache.synapse.Constants.MESSAGE_RECEIVED_RM_ENGAGED) !=
+                                                                              null)
+            {
+                return ((Boolean) msgCtx.getProperty(
+                        org.apache.synapse.Constants.MESSAGE_RECEIVED_RM_ENGAGED))
+                        .booleanValue();
+            }
+
+        } catch (AxisFault axisFault) {
+            throw new SynapseException(axisFault);
+        }
+        return false;
+    }
+
+    private void rmEnabledService(ConfigurationContext cc, AxisConfiguration ac,
+                                  org.apache.axis2.context.MessageContext mc)
+            throws AxisFault {
+        AxisService as = ac.getService(EMPTY_RM_ENGAGED_SERVICE);
+
+        if (as == null) {
+            synchronized (RMMediator.class) {
+                AxisService emptyRMEngagedService =
+                        new AxisService(EMPTY_RM_ENGAGED_SERVICE);
+                AxisOperation emptyOperation =
+                        new InOutAxisOperation(EMPTY_OPERATION);
+                emptyOperation.setMessageReceiver(new EmptyRMMessageReceiver());
+                emptyRMEngagedService.addOperation(emptyOperation);
+                ac.addService(emptyRMEngagedService);
+
+                as = emptyRMEngagedService;
+                AxisModule am = ac
+                        .getModule(Constants.SANDESHA2_MODULE_NAME);
+
+                if (am == null) {
+                    throw new AxisFault("Sandesha 2 Module couldn't Find");
+                }
+                emptyRMEngagedService.engageModule(am, ac);
+            }
+        }
+
+
+        AxisOperation ao = as.getOperation(EMPTY_OPERATION);
+        OperationContext oc =
+                OperationContextFactory.createOperationContext(
+                        ao.getAxisSpecifMEPConstant(),
+                        ao);
+        ao.registerOperationContext(mc, oc);
+
+        ServiceContext sc = Utils.fillContextInformation(as, cc);
+        oc.setParent(sc);
+        mc.setAxisOperation(ao);
+        mc.setAxisService(as);
+
+
+    }
+
+
+}

Modified: incubator/synapse/trunk/java/project.properties
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/project.properties?rev=420842&r1=420841&r2=420842&view=diff
==============================================================================
--- incubator/synapse/trunk/java/project.properties (original)
+++ incubator/synapse/trunk/java/project.properties Tue Jul 11 06:40:29 2006
@@ -47,9 +47,9 @@
 wsdl4j.version=1.5.2
 axis2.version=SNAPSHOT
 
-axiom.version=1.0
+axiom.version=SNAPSHOT
 neethi.version=SNAPSHOT
-XmlSchema.version=1.0.2
+XmlSchema.version=SNAPSHOT
 jakarta.httpcore.version=4.0-alpha2
 commons.codec.version=1.3
 commons.fileupload.version=1.0
@@ -95,7 +95,7 @@
 # -------------------------------------------------------------------
 #                Addressing Version
 # -------------------------------------------------------------------
-addressing.version=1.0
+addressing.version=SNAPSHOT
 
 # -------------------------------------------------------------------
 #                Sandesha2 Version
@@ -105,7 +105,7 @@
 # -------------------------------------------------------------------
 #                Rampart Version
 # -------------------------------------------------------------------
-rampart.version=1.0
+rampart.version=SNAPSHOT
 
 # -------------------------------------------------------------------
 #                Synapse Version

Modified: incubator/synapse/trunk/java/project.xml
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/project.xml?rev=420842&r1=420841&r2=420842&view=diff
==============================================================================
--- incubator/synapse/trunk/java/project.xml (original)
+++ incubator/synapse/trunk/java/project.xml Tue Jul 11 06:40:29 2006
@@ -68,6 +68,18 @@
         </dependency>
 
         <dependency>
+            <groupId>ws-commons</groupId>
+            <artifactId>axiom-dom</artifactId>
+            <version>${axiom.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>axis2</groupId>
+            <artifactId>axis2-rahas</artifactId>
+            <version>${axis2.version}</version>
+        </dependency>
+
+        <dependency>
             <groupId>org.apache.ws.commons</groupId>
             <artifactId>XmlSchema</artifactId>
             <version>${XmlSchema.version}</version>

Modified: incubator/synapse/trunk/java/repository/conf/axis2.xml
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/repository/conf/axis2.xml?rev=420842&r1=420841&r2=420842&view=diff
==============================================================================
--- incubator/synapse/trunk/java/repository/conf/axis2.xml (original)
+++ incubator/synapse/trunk/java/repository/conf/axis2.xml Tue Jul 11 06:40:29 2006
@@ -16,6 +16,9 @@
     <!--is set then, Axis2 tries to get the first exception and set its message as the faultreason/Reason.-->
     <parameter name="DrillDownToRootCauseForFaultReason" locked="false">false</parameter>
 
+
+    <parameter name="Sandesha2StorageManager" locked="false">inmemory</parameter>
+
     <!--This is the user name and password of admin console-->
     <parameter name="userName" locked="false">admin</parameter>
     <parameter name="password" locked="false">axis2</parameter>
@@ -133,11 +136,13 @@
             </handler>
         </phase>
         <!--  System pre defined phases       -->
+        <phase name="RMPhase"/>
         <!--   After Postdispatch phase module author or or service author can add any phase he want      -->
         <phase name="OperationInPhase"/>
     </phaseOrder>
     <phaseOrder type="outflow">
         <!--      user can add his own phases to this area  -->
+        <phase name="RMPhase"/>
         <phase name="OperationOutPhase"/>
         <!--system predefined phase-->
         <!--these phase will run irrespective of the service-->
@@ -172,10 +177,12 @@
             </handler>
         </phase>
         <!--      user can add his own phases to this area  -->
+        <phase name="RMPhase"/>
         <phase name="OperationInFaultPhase"/>
     </phaseOrder>
     <phaseOrder type="Outfaultflow">
         <!--      user can add his own phases to this area  -->
+        <phase name="RMPhase"/>
         <phase name="OperationOutFaultPhase"/>
         <phase name="PolicyDetermination"/>
         <phase name="MessageOut"/>



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