Author: chamikara
Date: Mon Oct 31 01:09:25 2005
New Revision: 329777

URL: http://svn.apache.org/viewcvs?rev=329777&view=rev
Log:
Added logic to check a parameter in the services.xml to detect RMEnabled 
services. To anable RM for a service engage sandesha module globally (within 
axis2.xml) and add following parameter to ur services xml.

<parameter name="RMEnabled">true</parameter>

Modified:
    webservices/sandesha/trunk/samples/conf/interop/services.xml
    webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java
    
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
    
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java

Modified: webservices/sandesha/trunk/samples/conf/interop/services.xml
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/samples/conf/interop/services.xml?rev=329777&r1=329776&r2=329777&view=diff
==============================================================================
--- webservices/sandesha/trunk/samples/conf/interop/services.xml (original)
+++ webservices/sandesha/trunk/samples/conf/interop/services.xml Mon Oct 31 
01:09:25 2005
@@ -1,11 +1,11 @@
 <service name="InteropService">

     <parameter name="ServiceClass" 
locked="xsd:false">org.apache.sandesha2.samples.interop.service.RMInteropService</parameter>

 

+   <parameter name="RMEnabled" >true</parameter>

+

    <description>

         This is a testing service , to test the system is working or not

     </description>

-

-  <!-- <module ref="sandesha" /> -->

 

     <operation name="ping">  

         <messageReceiver 
class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver" />


Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java?rev=329777&r1=329776&r2=329777&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java 
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java Mon Oct 
31 01:09:25 2005
@@ -257,4 +257,6 @@
        

        String ACK_PROCSSED = "AckProcessed";

        

+       String RM_ENABLE_KEY = "RMEnabled";

+       

 }

Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java?rev=329777&r1=329776&r2=329777&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
 (original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
 Mon Oct 31 01:09:25 2005
@@ -27,7 +27,11 @@
 

 import org.apache.axis2.AxisFault;

 import org.apache.axis2.addressing.MessageInformationHeaders;

+import org.apache.axis2.context.ConfigurationContext;

 import org.apache.axis2.context.MessageContext;

+import org.apache.axis2.context.ServiceContext;

+import org.apache.axis2.description.AxisService;

+import org.apache.axis2.description.Parameter;

 import org.apache.axis2.handlers.AbstractHandler;

 import org.apache.axis2.soap.SOAPEnvelope;

 import org.apache.sandesha2.Constants;

@@ -53,6 +57,24 @@
 

        public void invoke(MessageContext msgCtx) throws AxisFault {

 

+               ConfigurationContext context = msgCtx.getSystemContext();

+               if (context==null)

+                       throw new AxisFault ("ConfigurationContext is null");

+               

+               AxisService axisService = msgCtx.getAxisService();

+               if (axisService==null)

+                       throw new AxisFault ("AxisService is null");

+               

+               Parameter keyParam = axisService.getParameter 
(Constants.RM_ENABLE_KEY);

+               Object keyValue = null;

+               if (keyParam!=null)

+                       keyValue = keyParam.getValue();

+               

+               if (keyValue==null || !keyValue.equals("true")) {

+                       //RM is not enabled for the service. Quiting 
SandeshaInHandler

+                       return;

+               }

+               

                RMMsgContext rmMsgCtx = null;

                try {

                        rmMsgCtx = MsgInitializer.initializeMessage(msgCtx);


Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java?rev=329777&r1=329776&r2=329777&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
 (original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
 Mon Oct 31 01:09:25 2005
@@ -25,6 +25,10 @@
 import org.apache.axis2.context.ConfigurationContext;

 import org.apache.axis2.context.MessageContext;

 import org.apache.axis2.context.OperationContext;

+import org.apache.axis2.context.ServiceContext;

+import org.apache.axis2.description.AxisService;

+import org.apache.axis2.description.Parameter;

+import org.apache.axis2.description.ParameterImpl;

 import org.apache.axis2.handlers.AbstractHandler;

 import org.apache.axis2.soap.SOAPBody;

 import org.apache.axis2.soap.SOAPEnvelope;

@@ -61,13 +65,32 @@
 

        public void invoke(MessageContext msgCtx) throws AxisFault {

 

-               String DONE = (String) msgCtx

-                               
.getProperty(Constants.APPLICATION_PROCESSING_DONE);

-               if (null != DONE && "true".equals(DONE))

-                       return;

-

-               msgCtx.setProperty(Constants.APPLICATION_PROCESSING_DONE, 
"true");

+       

 

+               

+               ConfigurationContext context = msgCtx.getSystemContext();

+               if (context==null)

+                       throw new AxisFault ("ConfigurationContext is null");

+               

+               AxisService axisService = msgCtx.getAxisService();

+               if (axisService==null)

+                       throw new AxisFault ("AxisService is null");

+               

+               if (!msgCtx.isServerSide()) {

+                       //getting rm message

+                       RMMsgContext rmMsgCtx = null;

+                       try {

+                               rmMsgCtx = 
MsgInitializer.initializeMessage(msgCtx);

+                       } catch (SandeshaException ex) {

+                               throw new AxisFault("Cant initialize the 
message");

+                       }

+                       

+                       if ( 
rmMsgCtx.getMessageType()==Constants.MessageTypes.UNKNOWN) {

+                               Parameter param = new 
ParameterImpl(Constants.RM_ENABLE_KEY,"true");

+                               axisService.addParameter(param);

+                       }

+               }

+               

                //getting rm message

                RMMsgContext rmMsgCtx = null;

                try {

@@ -76,6 +99,25 @@
                        throw new AxisFault("Cant initialize the message");

                }

                

+               Parameter keyParam = axisService.getParameter 
(Constants.RM_ENABLE_KEY);

+               Object keyValue = null;

+               if (keyParam!=null)

+                       keyValue = keyParam.getValue();

+               

+               if (keyValue==null || !keyValue.equals("true")) {

+                       //RM is not enabled for the service. Quiting 
SandeshaOutHandler

+                       return;

+               }

+               

+               String DONE = (String) msgCtx

+                               
.getProperty(Constants.APPLICATION_PROCESSING_DONE);

+               if (null != DONE && "true".equals(DONE))

+                       return;

+

+               msgCtx.setProperty(Constants.APPLICATION_PROCESSING_DONE, 
"true");

+

+               

+               

                //TODO recheck

                //continue only if an possible application message

                if (!(rmMsgCtx.getMessageType() == 
Constants.MessageTypes.UNKNOWN)) {

@@ -83,7 +125,6 @@
                }

 

                //Strating the sender.

-               ConfigurationContext context = msgCtx.getSystemContext();

                SandeshaUtil.startSenderIfStopped(context);

 

                CreateSeqBeanMgr createSeqMgr = 
AbstractBeanMgrFactory.getInstance(




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to