You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ch...@apache.org on 2005/09/30 16:29:19 UTC
svn commit: r292747 - in /webservices/sandesha/trunk: config/
src/org/apache/sandesha2/ src/org/apache/sandesha2/handlers/
src/org/apache/sandesha2/msgprocessors/
Author: chamikara
Date: Fri Sep 30 07:27:53 2005
New Revision: 292747
URL: http://svn.apache.org/viewcvs?rev=292747&view=rev
Log:
Applied Sanka's patch which contains code for CreateSequenceResponse processor.
Added:
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java
Modified:
webservices/sandesha/trunk/config/module.xml
webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java
webservices/sandesha/trunk/src/org/apache/sandesha2/MsgInitializer.java
webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgCreator.java
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerInHandler.java
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java
Modified: webservices/sandesha/trunk/config/module.xml
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/config/module.xml?rev=292747&r1=292746&r2=292747&view=diff
==============================================================================
--- webservices/sandesha/trunk/config/module.xml (original)
+++ webservices/sandesha/trunk/config/module.xml Fri Sep 30 07:27:53 2005
@@ -23,6 +23,11 @@
<parameter name="wsamapping" locked="xsd:false">http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence</parameter>
</operation>
+ <operation name="CreateSequenceResponse" mep="http://www.w3.org/2004/08/wsdl/in-only">
+ <messageReceiver class="org.apache.sandesha2.msgreceivers.RMMessageReceiver"/>
+ <parameter name="wsamapping" locked="xsd:false">http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequenceResponse</parameter>
+ </operation>
+
<!--
http://schemas.xmlsoap.org/ws/2005/02/rm/TerminateSequence
http://schemas.xmlsoap.org/ws/2005/02/rm/TerminateSequence
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=292747&r1=292746&r2=292747&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java Fri Sep 30 07:27:53 2005
@@ -135,6 +135,8 @@
String OUT_SEQUENCE_ID = "OutSequenceId";
String REPLY_TO_EPR = "ReplyToEPR";
+
+ String APP_MSG_PROCESSOR_LIST = "AppMsgProcessorList";
}
public interface SOAPVersion {
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/MsgInitializer.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/MsgInitializer.java?rev=292747&r1=292746&r2=292747&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/MsgInitializer.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/MsgInitializer.java Fri Sep 30 07:27:53 2005
@@ -81,6 +81,7 @@
//TODO: performa validation
+ int a = 1;
//Setting message type.
if (rmMsgCtx.getMessagePart(Constants.MessageParts.CREATE_SEQ) != null)
rmMsgCtx.setMessageType(Constants.MessageTypes.CREATE_SEQ);
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgCreator.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgCreator.java?rev=292747&r1=292746&r2=292747&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgCreator.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgCreator.java Fri Sep 30 07:27:53 2005
@@ -91,13 +91,16 @@
createSeqmsgContext.setServiceContextID(applicationMsgContext
.getServiceContextID());
+ String createSeqMsgId = SandeshaUtil.getUUID();
try {
//TODO set a suitable ope. description
OperationContext createSeqOpContext = new OperationContext(
applicationMsgContext.getOperationDescription());
createSeqmsgContext.setOperationContext(createSeqOpContext);
createSeqOpContext.addMessageContext(createSeqmsgContext);
-
+ //registering opearion context
+ context.registerOperationContext(createSeqMsgId,createSeqOpContext);
+
//Setting a new SOAP Envelop.
SOAPEnvelope envelope = SOAPAbstractFactory.getSOAPFactory(
Constants.SOAPVersion.DEFAULT).getDefaultEnvelope();
@@ -145,7 +148,7 @@
"ReplyTo value of the Application Message is not set correctly");
createSeqRMMsg.setReplyTo(replyTo);
- createSeqRMMsg.setMessageId(SandeshaUtil.getUUID());
+ createSeqRMMsg.setMessageId(createSeqMsgId);
MessageContext createSeqMsg = createSeqRMMsg.getMessageContext();
MessageContext applicationMsg = applicationRMMsg.getMessageContext();
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerInHandler.java?rev=292747&r1=292746&r2=292747&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerInHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerInHandler.java Fri Sep 30 07:27:53 2005
@@ -58,6 +58,9 @@
MsgProcessor msgProcessor = MsgProcessorFactory
.getMessageProcessor(rmMsgCtx.getMessageType());
+ if (msgProcessor==null)
+ throw new AxisFault ("Cant find a suitable message processor");
+
try {
msgProcessor.processMessage(rmMsgCtx);
} catch (SandeshaException se) {
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java?rev=292747&r1=292746&r2=292747&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java Fri Sep 30 07:27:53 2005
@@ -58,6 +58,8 @@
*/
public class ApplicationMsgProcessor implements MsgProcessor {
+ private boolean letInvoke = false;
+
public void processMessage(RMMsgContext rmMsgCtx) throws SandeshaException {
System.out.println("Application msg processor called");
@@ -226,14 +228,27 @@
.getMessageContext());
storageMapMgr.insert(new StorageMapBean(key, msgNo,
sequenceId));
+// rmMsgCtx.setProperty(Constants.APPLICATION_PROCESSING_DONE,"true");
- // This will avoid performing application processing more
- // than once.
- rmMsgCtx.setProperty(Constants.APPLICATION_PROCESSING_DONE,
- "true");
-
- System.out.println("paused");
-
+
+ SequencePropertyBean msgProcessorListBean = seqPropMgr.retrieve(sequenceId,Constants.SequenceProperties.APP_MSG_PROCESSOR_LIST);
+ if (msgProcessorListBean == null){
+ ArrayList msgProcessorList = new ArrayList ();
+ msgProcessorListBean = new SequencePropertyBean (sequenceId,Constants.SequenceProperties.APP_MSG_PROCESSOR_LIST,msgProcessorList);
+ seqPropMgr.update(msgProcessorListBean);
+ }
+
+ if (! (msgProcessorListBean.getValue() instanceof ArrayList)){
+ throw new SandeshaException ("Invalid property value");
+ }
+
+ ArrayList msgProcessorList = (ArrayList) msgProcessorListBean.getValue();
+ msgProcessorList.add(this);
+
+ while (!isLetInvoke()){
+ Thread.sleep(Constants.INVOKER_SLEEP_TIME);
+ }
+
} catch (Exception ex) {
throw new SandeshaException(ex.getMessage());
}
@@ -242,11 +257,14 @@
// nothing here :D )
}
}
-
-
- //wait till InOrderInvoker allows me.
- //TODO analyze and optimize performance
-
+ }
+
+ public synchronized void letInvoke () {
+ letInvoke = true;
+ }
+
+ public synchronized boolean isLetInvoke () {
+ return letInvoke;
}
//TODO convert following from INT to LONG
Added: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java?rev=292747&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java Fri Sep 30 07:27:53 2005
@@ -0,0 +1,51 @@
+/*
+ * Copyright 1999-2004 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.sandesha2.msgprocessors;
+
+import org.apache.sandesha2.RMMsgContext;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.storage.AbstractBeanMgrFactory;
+import org.apache.sandesha2.storage.beans.RetransmitterBean;
+import org.apache.sandesha2.storage.beanmanagers.RetransmitterBeanMgr;
+import org.apache.axis2.context.ConfigurationContext;
+
+import java.util.Iterator;
+
+
+public class CreateSeqResponseMsgProcessor implements MsgProcessor {
+ public void processMessage(RMMsgContext rmMsgCtx) throws SandeshaException {
+
+ System.out.println("IN CREATE SEQ RESPONSE PROCESSOR");
+ ConfigurationContext configCtx = rmMsgCtx.getMessageContext().getSystemContext();
+ String msgId = rmMsgCtx.getMessageContext().getRelatesTo().getValue();
+ RetransmitterBeanMgr mgr =
+ AbstractBeanMgrFactory.getInstance(configCtx).getRetransmitterBeanMgr();
+
+ RetransmitterBean createSeqBean = mgr.retrieve(msgId);
+ String tempSeqId = createSeqBean.getTempSequenceId();
+ mgr.delete(msgId);
+
+ RetransmitterBean target = new RetransmitterBean();
+ target.setTempSequenceId(tempSeqId);
+
+ Iterator iterator = mgr.find(target).iterator();
+ while (iterator.hasNext()) {
+ ((RetransmitterBean) iterator.next()).setSend(true);
+ }
+ }
+}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java?rev=292747&r1=292746&r2=292747&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java Fri Sep 30 07:27:53 2005
@@ -34,7 +34,9 @@
return new TerminateSeqMsgProcessor ();
case (Constants.MessageTypes.APPLICATION):
return new ApplicationMsgProcessor ();
- default:
+ case (Constants.MessageTypes.CREATE_SEQ_RESPONSE):
+ return new CreateSeqResponseMsgProcessor();
+ default:
return null;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org