You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by ch...@apache.org on 2005/11/03 02:32:41 UTC
svn commit: r330406 [1/3] - in
/webservices/sandesha/trunk/src/org/apache/sandesha2: ./ handlers/
msgprocessors/ storage/ storage/beanmanagers/ storage/beans/
storage/inmemory/ util/ workers/ wsrm/
Author: chamikara
Date: Wed Nov 2 17:27:17 2005
New Revision: 330406
URL: http://svn.apache.org/viewcvs?rev=330406&view=rev
Log:
Refactored code.
Removed unnecessary comments.
Removed unused imports.
Modified:
webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java
webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaModule.java
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
webservices/sandesha/trunk/src/org/apache/sandesha2/storage/StorageManager.java
webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/CreateSeqBeanMgr.java
webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/NextMsgBeanMgr.java
webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/RetransmitterBeanMgr.java
webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/SequencePropertyBeanMgr.java
webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/StorageMapBeanMgr.java
webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/CreateSeqBean.java
webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/NextMsgBean.java
webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/RetransmitterBean.java
webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/SequencePropertyBean.java
webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/StorageMapBean.java
webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryCreateSeqBeanMgr.java
webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryNextMsgBeanMgr.java
webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryRetransmitterBeanMgr.java
webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemorySequencePropertyBeanMgr.java
webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java
webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryStorageMapBeanMgr.java
webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryTransaction.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/FaultMgr.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/MsgInitializer.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/MsgValidator.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/SOAPAbstractFactory.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java
webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java
webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Accept.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckRequested.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcknowledgementRange.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcksTo.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Address.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequence.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequenceResponse.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Expires.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/FaultCode.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/IOMRMElement.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/IOMRMPart.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Identifier.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/LastMessage.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/MessageNumber.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Nack.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/RMElements.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Sequence.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceAcknowledgement.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceFault.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceOffer.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequence.java
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java?rev=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java Wed Nov 2 17:27:17 2005
@@ -26,18 +26,12 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.addressing.miheaders.RelatesTo;
-import org.apache.axis2.addressing.om.AddressingHeaders;
import org.apache.axis2.context.AbstractContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.soap.SOAPEnvelope;
import org.apache.sandesha2.util.SOAPAbstractFactory;
-import org.apache.sandesha2.util.SandeshaUtil;
-import org.apache.sandesha2.wsrm.CreateSequence;
import org.apache.sandesha2.wsrm.IOMRMElement;
import org.apache.sandesha2.wsrm.IOMRMPart;
-import org.apache.sandesha2.wsrm.TerminateSequence;
-import org.apache.wsdl.WSDLConstants;
-import org.ietf.jgss.MessageProp;
/**
* @author Chamikara
@@ -57,8 +51,8 @@
rmMessageParts = new HashMap();
messageType = Constants.MessageTypes.UNKNOWN;
}
-
- public void setMessageContext (MessageContext msgCtx) {
+
+ public void setMessageContext(MessageContext msgCtx) {
this.msgContext = msgCtx;
}
@@ -121,12 +115,12 @@
public String getMessageId() {
return msgContext.getMessageID();
}
-
- public void setFaultTo (EndpointReference epr) {
+
+ public void setFaultTo(EndpointReference epr) {
msgContext.setFaultTo(epr);
}
-
- public EndpointReference getFaultTo () {
+
+ public EndpointReference getFaultTo() {
return msgContext.getFaultTo();
}
@@ -135,16 +129,17 @@
}
public void setSOAPEnvelop(SOAPEnvelope envelope) throws SandeshaException {
-
+
try {
msgContext.setEnvelope(envelope);
} catch (AxisFault e) {
- throw new SandeshaException (e.getMessage());
+ throw new SandeshaException(e.getMessage());
}
}
public void test() {
- String opearaitonName = msgContext.getOperationContext().getAxisOperation().getName().getLocalPart();
+ String opearaitonName = msgContext.getOperationContext()
+ .getAxisOperation().getName().getLocalPart();
System.out.println("Operation is:" + opearaitonName);
}
@@ -182,12 +177,12 @@
public void setRelatesTo(RelatesTo relatesTo) {
msgContext.setRelatesTo(relatesTo);
}
-
+
public void setWSAAction(String URI) {
msgContext.setWSAAction(URI);
}
-
- public String getWSAAction () {
+
+ public String getWSAAction() {
return msgContext.getWSAAction();
}
@@ -217,7 +212,7 @@
return msgContext.getSystemContext();
}
- public void setSOAPAction (String SOAPAction) {
+ public void setSOAPAction(String SOAPAction) {
msgContext.setSoapAction(SOAPAction);
}
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaModule.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaModule.java?rev=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaModule.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaModule.java Wed Nov 2 17:27:17 2005
@@ -21,12 +21,6 @@
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.modules.Module;
-/**
- * @author Chamikara
- * @author Sanka
- * @author Jaliya
- */
-
public class SandeshaModule implements Module{
//private InOrderInvoker inorderInvoker = new InOrderInvoker ();
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java?rev=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java Wed Nov 2 17:27:17 2005
@@ -15,18 +15,10 @@
*
*/
-/**
- * @author Chamikara
- * @author Sanka
- */
-
package org.apache.sandesha2.handlers;
import java.util.ArrayList;
-import java.util.Collection;
-
import javax.xml.namespace.QName;
-
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
@@ -35,14 +27,9 @@
import org.apache.sandesha2.RMMsgContext;
import org.apache.sandesha2.SandeshaException;
import org.apache.sandesha2.msgprocessors.ApplicationMsgProcessor;
-import org.apache.sandesha2.msgprocessors.MsgProcessor;
-import org.apache.sandesha2.msgprocessors.MsgProcessorFactory;
import org.apache.sandesha2.storage.StorageManager;
import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
import org.apache.sandesha2.storage.beans.SequencePropertyBean;
-import org.apache.sandesha2.storage.beans.StorageMapBean;
-import org.apache.sandesha2.storage.inmemory.InMemorySequencePropertyBeanMgr;
-import org.apache.sandesha2.storage.inmemory.InMemoryStorageMapBeanMgr;
import org.apache.sandesha2.util.MsgInitializer;
import org.apache.sandesha2.util.SandeshaUtil;
import org.apache.sandesha2.wsrm.Sequence;
@@ -164,7 +151,7 @@
switch (rmMsgCtx.getMessageType()) {
case Constants.MessageTypes.ACK:
rmMsgCtx.setRelatesTo(null); //Removing the relatesTo part from
- // ackMessageIf present.
+ // ackMessageIf present.
//Some Frameworks tend to send this.
}
}
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=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java Wed Nov 2 17:27:17 2005
@@ -1,54 +1,37 @@
/*
- * 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.
- *
+ * 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.handlers;
-import java.util.ArrayList;
-
import javax.xml.namespace.QName;
-import javax.xml.stream.FactoryConfigurationError;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
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;
import org.apache.sandesha2.SandeshaException;
import org.apache.sandesha2.RMMsgContext;
import org.apache.sandesha2.msgprocessors.MsgProcessor;
import org.apache.sandesha2.msgprocessors.MsgProcessorFactory;
-import org.apache.sandesha2.storage.inmemory.InMemorySequencePropertyBeanMgr;
import org.apache.sandesha2.util.MsgInitializer;
-import org.apache.sandesha2.util.MsgValidator;
import org.apache.sandesha2.util.SandeshaUtil;
-/**
- * @author Chamikara
- * @author Sanka
- * @author Jaliya
- */
public class SandeshaInHandler extends AbstractHandler {
public QName getName() {
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=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java Wed Nov 2 17:27:17 2005
@@ -25,14 +25,12 @@
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;
-import org.apache.axis2.util.UUIDGenerator;
import org.apache.sandesha2.Constants;
import org.apache.sandesha2.SandeshaException;
import org.apache.sandesha2.RMMsgContext;
@@ -43,9 +41,6 @@
import org.apache.sandesha2.storage.beans.CreateSeqBean;
import org.apache.sandesha2.storage.beans.RetransmitterBean;
import org.apache.sandesha2.storage.beans.SequencePropertyBean;
-import org.apache.sandesha2.storage.inmemory.InMemoryCreateSeqBeanMgr;
-import org.apache.sandesha2.storage.inmemory.InMemoryRetransmitterBeanMgr;
-import org.apache.sandesha2.storage.inmemory.InMemorySequencePropertyBeanMgr;
import org.apache.sandesha2.util.MsgInitializer;
import org.apache.sandesha2.util.RMMsgCreator;
import org.apache.sandesha2.util.SOAPAbstractFactory;
@@ -58,11 +53,6 @@
import org.apache.sandesha2.wsrm.Sequence;
import org.apache.sandesha2.wsrm.SequenceOffer;
import org.apache.wsdl.WSDLConstants;
-
-/**
- * @author Chamikara
- * @author Sanka
- */
public class SandeshaOutHandler extends AbstractHandler {
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java?rev=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java Wed Nov 2 17:27:17 2005
@@ -19,42 +19,24 @@
import java.util.Collection;
import java.util.Iterator;
-import java.util.List;
-
import javax.xml.namespace.QName;
-import javax.xml.stream.FactoryConfigurationError;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.context.AbstractContext;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.soap.SOAPEnvelope;
import org.apache.sandesha2.Constants;
import org.apache.sandesha2.RMMsgContext;
import org.apache.sandesha2.SandeshaException;
-import org.apache.sandesha2.handlers.SandeshaOutHandler;
import org.apache.sandesha2.storage.StorageManager;
import org.apache.sandesha2.storage.beanmanagers.RetransmitterBeanMgr;
import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
import org.apache.sandesha2.storage.beans.RetransmitterBean;
import org.apache.sandesha2.storage.beans.SequencePropertyBean;
-import org.apache.sandesha2.storage.inmemory.InMemoryRetransmitterBeanMgr;
-import org.apache.sandesha2.storage.inmemory.InMemorySequencePropertyBeanMgr;
import org.apache.sandesha2.util.RMMsgCreator;
import org.apache.sandesha2.util.SandeshaUtil;
import org.apache.sandesha2.wsrm.AcknowledgementRange;
-import org.apache.sandesha2.wsrm.LastMessage;
import org.apache.sandesha2.wsrm.Nack;
import org.apache.sandesha2.wsrm.SequenceAcknowledgement;
-/**
- * @author Chamikara
- * @author Sanka
- */
-
public class AcknowledgementProcessor implements MsgProcessor {
public void processMessage(RMMsgContext rmMsgCtx) throws SandeshaException {
@@ -68,9 +50,13 @@
if (context == null)
throw new SandeshaException("Context is null");
- StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(rmMsgCtx.getMessageContext().getSystemContext());
- RetransmitterBeanMgr retransmitterMgr = storageManager.getRetransmitterBeanMgr();
- SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
+ StorageManager storageManager = SandeshaUtil
+ .getSandeshaStorageManager(rmMsgCtx.getMessageContext()
+ .getSystemContext());
+ RetransmitterBeanMgr retransmitterMgr = storageManager
+ .getRetransmitterBeanMgr();
+ SequencePropertyBeanMgr seqPropMgr = storageManager
+ .getSequencePropretyBeanMgr();
Iterator ackRangeIterator = sequenceAck.getAcknowledgementRanges()
.iterator();
@@ -88,16 +74,17 @@
String tempSequenceId = (String) tempSequenceBean.getValue();
-
-
//Following happens in the SandeshaGlobal handler
- rmMsgCtx.getMessageContext().setProperty(Constants.ACK_PROCSSED,"true");
-
- //Removing relatesTo - Some WSRM endpoints tend to set relatesTo value for ack messages.
+ rmMsgCtx.getMessageContext()
+ .setProperty(Constants.ACK_PROCSSED, "true");
+
+ //Removing relatesTo - Some WSRM endpoints tend to set relatesTo value
+ // for ack messages.
//Because of this dispatching may go wrong.
- //So we set relatesTo value to null for ackMessages. (this happens in the SandeshaGlobal handler)
+ //So we set relatesTo value to null for ackMessages. (this happens in
+ // the SandeshaGlobal handler)
rmMsgCtx.setRelatesTo(null);
-
+
RetransmitterBean input = new RetransmitterBean();
input.setTempSequenceId(tempSequenceId);
Collection retransmitterEntriesOfSequence = retransmitterMgr
@@ -126,51 +113,41 @@
//TODO - Process Nack
}
-
-
-
-// boolean justSendTerminateIfNeeded = false;
-// String ackProcessed = (String) rmMsgCtx.getProperty(Constants.ACK_PROCSSED);
-// if (ackProcessed!=null && "true".equals(ackProcessed))
-// justSendTerminateIfNeeded = true;
-
//following get called in the SandesaInHandler
//if (justSendTerminateIfNeeded) {
- //If all messages up to last message have been acknowledged.
- //Add terminate Sequence message.
- SequencePropertyBean lastOutMsgBean = seqPropMgr.retrieve(
- tempSequenceId,
- Constants.SequenceProperties.LAST_OUT_MESSAGE);
- if (lastOutMsgBean != null) {
- Long lastOutMsgNoLng = (Long) lastOutMsgBean.getValue();
- if (lastOutMsgNoLng == null)
- throw new SandeshaException(
- "Invalid object set for the Last Out Message");
-
- long lastOutMessageNo = lastOutMsgNoLng.longValue();
- if (lastOutMessageNo <= 0)
- throw new SandeshaException(
- "Invalid value set for the last out message");
-
- boolean complete = SandeshaUtil.verifySequenceCompletion(
- sequenceAck.getAcknowledgementRanges().iterator(),
- lastOutMessageNo);
-
- if (complete) {
- addTerminateSequenceMessage(rmMsgCtx, outSequenceId,
- tempSequenceId);
- }
-
- //stopping the progress of the message further.
- rmMsgCtx.getMessageContext().setPausedTrue(
- new QName(Constants.IN_HANDLER_NAME));
-
- //return;
+ //If all messages up to last message have been acknowledged.
+ //Add terminate Sequence message.
+ SequencePropertyBean lastOutMsgBean = seqPropMgr.retrieve(
+ tempSequenceId, Constants.SequenceProperties.LAST_OUT_MESSAGE);
+ if (lastOutMsgBean != null) {
+ Long lastOutMsgNoLng = (Long) lastOutMsgBean.getValue();
+ if (lastOutMsgNoLng == null)
+ throw new SandeshaException(
+ "Invalid object set for the Last Out Message");
+
+ long lastOutMessageNo = lastOutMsgNoLng.longValue();
+ if (lastOutMessageNo <= 0)
+ throw new SandeshaException(
+ "Invalid value set for the last out message");
+
+ boolean complete = SandeshaUtil.verifySequenceCompletion(
+ sequenceAck.getAcknowledgementRanges().iterator(),
+ lastOutMessageNo);
+
+ if (complete) {
+ addTerminateSequenceMessage(rmMsgCtx, outSequenceId,
+ tempSequenceId);
+ }
+
+ //stopping the progress of the message further.
+ rmMsgCtx.getMessageContext().setPausedTrue(
+ new QName(Constants.IN_HANDLER_NAME));
+
+ //return;
//}
}
-
- int i = 1;
+ int i = 1;
}
@@ -193,35 +170,33 @@
.createTerminateSequenceMessage(incomingAckRMMsg, outSequenceId);
//detting addressing headers.
- StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(incomingAckRMMsg.getMessageContext().getSystemContext());
- SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
-
+ StorageManager storageManager = SandeshaUtil
+ .getSandeshaStorageManager(incomingAckRMMsg.getMessageContext()
+ .getSystemContext());
+ SequencePropertyBeanMgr seqPropMgr = storageManager
+ .getSequencePropretyBeanMgr();
+
//SequencePropertyBean replyToBean =
// seqPropMgr.retrieve(tempSequenceId,Constants.SequenceProperties.REPLY_TO_EPR);
SequencePropertyBean toBean = seqPropMgr.retrieve(tempSequenceId,
Constants.SequenceProperties.TO_EPR);
- // if (replyToBean==null)
- // throw new SandeshaException ("ReplyTo property is not set");
-
- // EndpointReference replyToEPR = (EndpointReference)
- // replyToBean.getValue();
- // if (replyToEPR==null)
- // throw new SandeshaException ("ReplyTo EPR has an invalid value");
EndpointReference toEPR = (EndpointReference) toBean.getValue();
if (toEPR == null)
throw new SandeshaException("To EPR has an invalid value");
terminateRMMessage.setTo(new EndpointReference(toEPR.getAddress()));
- terminateRMMessage.setFrom(new EndpointReference (Constants.WSA.NS_URI_ANONYMOUS));
- terminateRMMessage.setFaultTo(new EndpointReference (Constants.WSA.NS_URI_ANONYMOUS));
+ terminateRMMessage.setFrom(new EndpointReference(
+ Constants.WSA.NS_URI_ANONYMOUS));
+ terminateRMMessage.setFaultTo(new EndpointReference(
+ Constants.WSA.NS_URI_ANONYMOUS));
//terminateRMMessage.setFrom(new EndpointReference
// (replyToEPR.getAddress()));
terminateRMMessage
.setWSAAction(Constants.WSRM.Actions.TERMINATE_SEQUENCE);
- terminateRMMessage
- .setSOAPAction("\"" + Constants.WSRM.Actions.TERMINATE_SEQUENCE + "\"");
-
+ terminateRMMessage.setSOAPAction("\""
+ + Constants.WSRM.Actions.TERMINATE_SEQUENCE + "\"");
+
try {
terminateRMMessage.addSOAPEnvelope();
} catch (AxisFault e) {
@@ -244,7 +219,8 @@
terminateBean.setSend(true);
terminateBean.setReSend(false);
- RetransmitterBeanMgr retramsmitterMgr = storageManager.getRetransmitterBeanMgr();
+ RetransmitterBeanMgr retramsmitterMgr = storageManager
+ .getRetransmitterBeanMgr();
retramsmitterMgr.insert(terminateBean);
}
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=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java Wed Nov 2 17:27:17 2005
@@ -1,31 +1,24 @@
/*
- * 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.
- *
+ * 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 java.util.ArrayList;
-import java.util.Collection;
-
import javax.xml.namespace.QName;
-import javax.xml.stream.FactoryConfigurationError;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.context.ConfigurationContext;
@@ -43,8 +36,6 @@
import org.apache.sandesha2.Constants;
import org.apache.sandesha2.RMMsgContext;
import org.apache.sandesha2.SandeshaException;
-import org.apache.sandesha2.handlers.SandeshaOutHandler;
-import org.apache.sandesha2.msgreceivers.RMMessageReceiver;
import org.apache.sandesha2.storage.StorageManager;
import org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr;
import org.apache.sandesha2.storage.beanmanagers.RetransmitterBeanMgr;
@@ -54,27 +45,12 @@
import org.apache.sandesha2.storage.beans.RetransmitterBean;
import org.apache.sandesha2.storage.beans.SequencePropertyBean;
import org.apache.sandesha2.storage.beans.StorageMapBean;
-import org.apache.sandesha2.storage.inmemory.InMemoryNextMsgBeanMgr;
-import org.apache.sandesha2.storage.inmemory.InMemoryRetransmitterBeanMgr;
-import org.apache.sandesha2.storage.inmemory.InMemorySequencePropertyBeanMgr;
-import org.apache.sandesha2.storage.inmemory.InMemoryStorageMapBeanMgr;
-import org.apache.sandesha2.util.MsgInitializer;
-import org.apache.sandesha2.util.MsgValidator;
import org.apache.sandesha2.util.RMMsgCreator;
import org.apache.sandesha2.util.SOAPAbstractFactory;
import org.apache.sandesha2.util.SandeshaUtil;
-import org.apache.sandesha2.workers.InOrderInvoker;
-import org.apache.sandesha2.wsrm.AckRequested;
-import org.apache.sandesha2.wsrm.AcknowledgementRange;
import org.apache.sandesha2.wsrm.Sequence;
import org.apache.sandesha2.wsrm.SequenceAcknowledgement;
import org.apache.wsdl.WSDLConstants;
-import org.ietf.jgss.MessageProp;
-
-/**
- * @author Chamikara
- * @author Sanka
- */
public class ApplicationMsgProcessor implements MsgProcessor {
@@ -101,8 +77,11 @@
return;
}
- StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(rmMsgCtx.getMessageContext().getSystemContext());
- SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
+ StorageManager storageManager = SandeshaUtil
+ .getSandeshaStorageManager(rmMsgCtx.getMessageContext()
+ .getSystemContext());
+ SequencePropertyBeanMgr seqPropMgr = storageManager
+ .getSequencePropretyBeanMgr();
//setting acked msg no range
Sequence sequence = (Sequence) rmMsgCtx
@@ -143,7 +122,7 @@
msgsBean.setValue(messagesStr);
seqPropMgr.update(msgsBean);
- sendAckIfNeeded(rmMsgCtx,messagesStr);
+ sendAckIfNeeded(rmMsgCtx, messagesStr);
// } else {
// //TODO Add async Ack
@@ -241,7 +220,6 @@
//SET THe RESPONSE
-
}
//TODO convert following from INT to LONG
@@ -257,19 +235,21 @@
return false;
}
-
- public void sendAckIfNeeded (RMMsgContext rmMsgCtx,String messagesStr) throws SandeshaException {
-
+
+ public void sendAckIfNeeded(RMMsgContext rmMsgCtx, String messagesStr)
+ throws SandeshaException {
+
MessageContext msgCtx = rmMsgCtx.getMessageContext();
- StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(msgCtx.getSystemContext());
- SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
-
-
+ StorageManager storageManager = SandeshaUtil
+ .getSandeshaStorageManager(msgCtx.getSystemContext());
+ SequencePropertyBeanMgr seqPropMgr = storageManager
+ .getSequencePropretyBeanMgr();
+
Sequence sequence = (Sequence) rmMsgCtx
- .getMessagePart(Constants.MessageParts.SEQUENCE);
+ .getMessagePart(Constants.MessageParts.SEQUENCE);
String sequenceId = sequence.getIdentifier().getIdentifier();
ConfigurationContext configCtx = rmMsgCtx.getMessageContext()
- .getSystemContext();
+ .getSystemContext();
if (configCtx == null)
throw new SandeshaException("Configuration Context is null");
@@ -288,40 +268,46 @@
//if (acksToStr.equals(Constants.WSA.NS_URI_ANONYMOUS)) {
AxisConfiguration axisConfig = configCtx.getAxisConfiguration();
- AxisServiceGroup serviceGroup = new AxisServiceGroup (axisConfig);
- AxisService service = new AxisService (new QName ("RMClientService")); // This is a dummy service.
- ServiceGroupContext serviceGroupContext = new ServiceGroupContext (configCtx,serviceGroup);
- ServiceContext serviceContext = new ServiceContext (service,serviceGroupContext);
-
+ AxisServiceGroup serviceGroup = new AxisServiceGroup(axisConfig);
+ AxisService service = new AxisService(new QName("RMClientService")); // This
+ // is a
+ // dummy
+ // service.
+ ServiceGroupContext serviceGroupContext = new ServiceGroupContext(
+ configCtx, serviceGroup);
+ ServiceContext serviceContext = new ServiceContext(service,
+ serviceGroupContext);
RMMsgContext ackRMMsgCtx = SandeshaUtil.deepCopy(rmMsgCtx);
MessageContext ackMsgCtx = ackRMMsgCtx.getMessageContext();
-
+
ackMsgCtx.setAxisServiceGroup(serviceGroup);
ackMsgCtx.setServiceGroupContext(serviceGroupContext);
ackMsgCtx.setAxisService(service);
ackMsgCtx.setServiceContext(serviceContext);
-
+
try {
- AxisOperation ackOperation = AxisOperationFactory.getOperetionDescription(AxisOperationFactory.MEP_URI_IN_ONLY);
+ AxisOperation ackOperation = AxisOperationFactory
+ .getOperetionDescription(AxisOperationFactory.MEP_URI_IN_ONLY);
- AxisOperation rmMsgOperation = rmMsgCtx.getMessageContext().getAxisOperation();
- if (rmMsgOperation!=null) {
+ AxisOperation rmMsgOperation = rmMsgCtx.getMessageContext()
+ .getAxisOperation();
+ if (rmMsgOperation != null) {
ArrayList outFlow = rmMsgOperation.getPhasesOutFlow();
- if (outFlow!=null) {
+ if (outFlow != null) {
ackOperation.setPhasesOutFlow(outFlow);
ackOperation.setPhasesOutFaultFlow(outFlow);
}
}
-
- OperationContext ackOpContext = new OperationContext (ackOperation);
+
+ OperationContext ackOpContext = new OperationContext(ackOperation);
ackMsgCtx.setAxisOperation(ackOperation);
ackMsgCtx.setOperationContext(ackOpContext);
ackOpContext.addMessageContext(ackMsgCtx);
ackMsgCtx.setOperationContext(ackOpContext);
-
+
} catch (AxisFault e) {
- throw new SandeshaException (e.getMessage());
+ throw new SandeshaException(e.getMessage());
}
//Set new envelope
@@ -342,30 +328,31 @@
AxisEngine engine = new AxisEngine(ackRMMsgCtx.getMessageContext()
.getSystemContext());
-
//set CONTEXT_WRITTEN since acksto is anonymous
rmMsgCtx.getMessageContext().getOperationContext().setProperty(
org.apache.axis2.Constants.RESPONSE_WRITTEN, "true");
- rmMsgCtx.getMessageContext().setProperty(Constants.ACK_WRITTEN, "true");
+ rmMsgCtx.getMessageContext().setProperty(Constants.ACK_WRITTEN,
+ "true");
try {
engine.send(ackRMMsgCtx.getMessageContext());
} catch (AxisFault e1) {
throw new SandeshaException(e1.getMessage());
}
} else {
- RetransmitterBeanMgr retransmitterBeanMgr = storageManager.getRetransmitterBeanMgr();
-
+ RetransmitterBeanMgr retransmitterBeanMgr = storageManager
+ .getRetransmitterBeanMgr();
+
String key = SandeshaUtil.storeMessageContext(ackMsgCtx);
- RetransmitterBean ackBean = new RetransmitterBean ();
+ RetransmitterBean ackBean = new RetransmitterBean();
ackBean.setKey(key);
ackBean.setMessageId(ackMsgCtx.getMessageID());
ackBean.setReSend(false);
ackBean.setSend(true);
-
+
retransmitterBeanMgr.insert(ackBean);
-
+
SandeshaUtil.startSenderIfStopped(configCtx);
}
-
+
}
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java?rev=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java Wed Nov 2 17:27:17 2005
@@ -1,18 +1,18 @@
/*
- * 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.
- *
+ * 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;
@@ -33,115 +33,133 @@
import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
import org.apache.sandesha2.storage.beans.CreateSeqBean;
import org.apache.sandesha2.storage.beans.SequencePropertyBean;
-import org.apache.sandesha2.storage.inmemory.InMemoryCreateSeqBeanMgr;
-import org.apache.sandesha2.storage.inmemory.InMemorySequencePropertyBeanMgr;
import org.apache.sandesha2.util.RMMsgCreator;
import org.apache.sandesha2.util.SandeshaUtil;
import org.apache.sandesha2.util.SequenceManager;
import org.apache.sandesha2.wsrm.Accept;
import org.apache.sandesha2.wsrm.CreateSequence;
import org.apache.sandesha2.wsrm.CreateSequenceResponse;
-import org.apache.sandesha2.wsrm.SequenceAcknowledgement;
import org.apache.sandesha2.wsrm.SequenceOffer;
-/**
- * @author Chamikara
- * @author Sanka
- */
-
public class CreateSeqMsgProcessor implements MsgProcessor {
- public void processMessage(RMMsgContext createSeqRMMsg) throws SandeshaException {
-
+ public void processMessage(RMMsgContext createSeqRMMsg)
+ throws SandeshaException {
+
MessageContext createSeqMsg = createSeqRMMsg.getMessageContext();
- CreateSequence createSeqPart = (CreateSequence) createSeqRMMsg.getMessagePart(Constants.MessageParts.CREATE_SEQ);
- if (createSeqPart==null)
- throw new SandeshaException ("No create sequence part is present in the create sequence message");
-
+ CreateSequence createSeqPart = (CreateSequence) createSeqRMMsg
+ .getMessagePart(Constants.MessageParts.CREATE_SEQ);
+ if (createSeqPart == null)
+ throw new SandeshaException(
+ "No create sequence part is present in the create sequence message");
+
MessageContext outMessage = null;
try {
outMessage = Utils.createOutMessageContext(createSeqMsg);
} catch (AxisFault e) {
- throw new SandeshaException (e.getMessage());
+ throw new SandeshaException(e.getMessage());
}
-
-
-
+
try {
- String newSequenceId = SequenceManager.setupNewSequence(createSeqRMMsg);
- ConfigurationContext context = createSeqRMMsg.getMessageContext().getSystemContext();
+ String newSequenceId = SequenceManager
+ .setupNewSequence(createSeqRMMsg);
+ ConfigurationContext context = createSeqRMMsg.getMessageContext()
+ .getSystemContext();
if (newSequenceId == null)
- throw new AxisFault("Internal error - Generated sequence id is null");
-
- RMMsgContext createSeqResponse = RMMsgCreator.createCreateSeqResponseMsg(createSeqRMMsg, outMessage, newSequenceId);
- CreateSequenceResponse createSeqResPart = (CreateSequenceResponse) createSeqResponse.getMessagePart(Constants.MessageParts.CREATE_SEQ_RESPONSE);
+ throw new AxisFault(
+ "Internal error - Generated sequence id is null");
+ RMMsgContext createSeqResponse = RMMsgCreator
+ .createCreateSeqResponseMsg(createSeqRMMsg, outMessage,
+ newSequenceId);
+ CreateSequenceResponse createSeqResPart = (CreateSequenceResponse) createSeqResponse
+ .getMessagePart(Constants.MessageParts.CREATE_SEQ_RESPONSE);
//If an offer is accepted do necessary procesing.
Accept accept = createSeqResPart.getAccept();
- if (accept!=null) {
+ if (accept != null) {
SequenceOffer offer = createSeqPart.getSequenceOffer();
- if (offer==null)
- throw new SandeshaException ("Internal error - no offer for the response message with Accept");
-
+ if (offer == null)
+ throw new SandeshaException(
+ "Internal error - no offer for the response message with Accept");
+
//Setting the CreateSequence table entry.
- String incomingSeqId = createSeqResPart.getIdentifier().getIdentifier();
+ String incomingSeqId = createSeqResPart.getIdentifier()
+ .getIdentifier();
String outSequenceId = offer.getIdentifer().getIdentifier();
- CreateSeqBean createSeqBean = new CreateSeqBean ();
+ CreateSeqBean createSeqBean = new CreateSeqBean();
createSeqBean.setSequenceId(outSequenceId);
createSeqBean.setTempSequenceId(newSequenceId);
- createSeqBean.setCreateSeqMsgId(SandeshaUtil.getUUID()); //this is a dummy value.
-
- StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(context);
- CreateSeqBeanMgr createSeqMgr = storageManager.getCreateSeqBeanMgr();
-
+ createSeqBean.setCreateSeqMsgId(SandeshaUtil.getUUID()); //this
+ // is a
+ // dummy
+ // value.
+
+ StorageManager storageManager = SandeshaUtil
+ .getSandeshaStorageManager(context);
+ CreateSeqBeanMgr createSeqMgr = storageManager
+ .getCreateSeqBeanMgr();
+
//Setting sequence properties.
- SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
- SequencePropertyBean outSequenceBean = new SequencePropertyBean ();
- outSequenceBean.setName(Constants.SequenceProperties.OUT_SEQUENCE_ID);
+ SequencePropertyBeanMgr seqPropMgr = storageManager
+ .getSequencePropretyBeanMgr();
+ SequencePropertyBean outSequenceBean = new SequencePropertyBean();
+ outSequenceBean
+ .setName(Constants.SequenceProperties.OUT_SEQUENCE_ID);
outSequenceBean.setValue(outSequenceId);
- outSequenceBean.setSequenceId(newSequenceId);
+ outSequenceBean.setSequenceId(newSequenceId);
seqPropMgr.insert(outSequenceBean);
-
- //Temp sequence id should be set for the server side.
+
+ //Temp sequence id should be set for the server side.
//If temp sequence id is not set. this implies server side.
- SequencePropertyBean tempSeqBean = seqPropMgr.retrieve(outSequenceId,Constants.SequenceProperties.TEMP_SEQUENCE_ID);
- if (tempSeqBean==null) {
- SequencePropertyBean tempSequenceBean = new SequencePropertyBean ();
- tempSequenceBean.setName(Constants.SequenceProperties.TEMP_SEQUENCE_ID);
+ SequencePropertyBean tempSeqBean = seqPropMgr.retrieve(
+ outSequenceId,
+ Constants.SequenceProperties.TEMP_SEQUENCE_ID);
+ if (tempSeqBean == null) {
+ SequencePropertyBean tempSequenceBean = new SequencePropertyBean();
+ tempSequenceBean
+ .setName(Constants.SequenceProperties.TEMP_SEQUENCE_ID);
tempSequenceBean.setSequenceId(outSequenceId);
tempSequenceBean.setValue(newSequenceId);
seqPropMgr.insert(tempSequenceBean);
}
}
-
-
- CreateSequence createSeq = (CreateSequence) createSeqRMMsg.getMessagePart(Constants.MessageParts.CREATE_SEQ);
+
+ CreateSequence createSeq = (CreateSequence) createSeqRMMsg
+ .getMessagePart(Constants.MessageParts.CREATE_SEQ);
if (createSeq == null)
- throw new AxisFault("Create sequence part not present in the create sequence message");
+ throw new AxisFault(
+ "Create sequence part not present in the create sequence message");
- EndpointReference acksTo = createSeq.getAcksTo().getAddress().getEpr();
+ EndpointReference acksTo = createSeq.getAcksTo().getAddress()
+ .getEpr();
if (acksTo == null || acksTo.getAddress() == null
|| acksTo.getAddress() == "")
- throw new AxisFault("Acks to not present in the create sequence message");
+ throw new AxisFault(
+ "Acks to not present in the create sequence message");
- SequencePropertyBean seqPropBean = new SequencePropertyBean(newSequenceId, Constants.SequenceProperties.ACKS_TO_EPR, acksTo);
- // InMemorySequencePropertyBeanMgr beanMgr = new InMemorySequencePropertyBeanMgr
+ SequencePropertyBean seqPropBean = new SequencePropertyBean(
+ newSequenceId, Constants.SequenceProperties.ACKS_TO_EPR,
+ acksTo);
+ // InMemorySequencePropertyBeanMgr beanMgr = new
+ // InMemorySequencePropertyBeanMgr
// (Constants.DEFAULT_STORAGE_TYPE);
// beanMgr.create(seqPropBean);
- StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(context);
- SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
+ StorageManager storageManager = SandeshaUtil
+ .getSandeshaStorageManager(context);
+ SequencePropertyBeanMgr seqPropMgr = storageManager
+ .getSequencePropretyBeanMgr();
seqPropMgr.insert(seqPropBean);
outMessage.setResponseWritten(true);
- AxisEngine engine = new AxisEngine (context);
+ AxisEngine engine = new AxisEngine(context);
engine.send(outMessage);
} catch (AxisFault e1) {
- throw new SandeshaException (e1.getMessage());
+ throw new SandeshaException(e1.getMessage());
}
-
- createSeqMsg.setPausedTrue(new QName (Constants.IN_HANDLER_NAME));
+
+ createSeqMsg.setPausedTrue(new QName(Constants.IN_HANDLER_NAME));
}
-}
+}
\ No newline at end of file
Modified: 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=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java Wed Nov 2 17:27:17 2005
@@ -29,48 +29,32 @@
import org.apache.sandesha2.storage.beans.NextMsgBean;
import org.apache.sandesha2.storage.beans.RetransmitterBean;
import org.apache.sandesha2.storage.beans.SequencePropertyBean;
-import org.apache.sandesha2.storage.inmemory.InMemoryCreateSeqBeanMgr;
-import org.apache.sandesha2.storage.inmemory.InMemoryNextMsgBeanMgr;
-import org.apache.sandesha2.storage.inmemory.InMemoryRetransmitterBeanMgr;
-import org.apache.sandesha2.storage.inmemory.InMemorySequencePropertyBeanMgr;
import org.apache.sandesha2.util.MsgInitializer;
import org.apache.sandesha2.util.SandeshaUtil;
import org.apache.sandesha2.wsrm.Accept;
import org.apache.sandesha2.wsrm.CreateSequenceResponse;
import org.apache.sandesha2.wsrm.Identifier;
-import org.apache.sandesha2.wsrm.MessageNumber;
import org.apache.sandesha2.wsrm.Sequence;
import org.apache.sandesha2.wsrm.SequenceAcknowledgement;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.soap.SOAPEnvelope;
-
import java.util.Iterator;
-
import javax.xml.namespace.QName;
-import javax.xml.stream.FactoryConfigurationError;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
-/**
- * @author Chamikara
- * @author Sanka
- */
public class CreateSeqResponseMsgProcessor implements MsgProcessor {
public void processMessage(RMMsgContext createSeqResponseRMMsgCtx)
throws SandeshaException {
//Processing for ack if any
- SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) createSeqResponseRMMsgCtx.getMessagePart(Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
- if (sequenceAck!=null) {
- AcknowledgementProcessor ackProcessor = new AcknowledgementProcessor ();
+ SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) createSeqResponseRMMsgCtx
+ .getMessagePart(Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
+ if (sequenceAck != null) {
+ AcknowledgementProcessor ackProcessor = new AcknowledgementProcessor();
ackProcessor.processMessage(createSeqResponseRMMsgCtx);
}
-
+
//Processing the create sequence response.
CreateSequenceResponse createSeqResponsePart = (CreateSequenceResponse) createSeqResponseRMMsgCtx
.getMessagePart(Constants.MessageParts.CREATE_SEQ_RESPONSE);
@@ -86,10 +70,12 @@
.getMessageContext().getSystemContext();
String createSeqMsgId = createSeqResponseRMMsgCtx.getMessageContext()
.getRelatesTo().getValue();
-
- StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configCtx);
-
- RetransmitterBeanMgr retransmitterMgr = storageManager.getRetransmitterBeanMgr();
+
+ StorageManager storageManager = SandeshaUtil
+ .getSandeshaStorageManager(configCtx);
+
+ RetransmitterBeanMgr retransmitterMgr = storageManager
+ .getRetransmitterBeanMgr();
CreateSeqBeanMgr createSeqMgr = storageManager.getCreateSeqBeanMgr();
CreateSeqBean createSeqBean = createSeqMgr.retrieve(createSeqMsgId);
@@ -104,46 +90,49 @@
retransmitterMgr.delete(createSeqMsgId);
//storing new out sequence id
- SequencePropertyBeanMgr sequencePropMgr = storageManager.getSequencePropretyBeanMgr();
+ SequencePropertyBeanMgr sequencePropMgr = storageManager
+ .getSequencePropretyBeanMgr();
SequencePropertyBean outSequenceBean = new SequencePropertyBean(
- tempSequenceId,
- Constants.SequenceProperties.OUT_SEQUENCE_ID, newOutSequenceId);
- SequencePropertyBean tempSequenceBean = new SequencePropertyBean (newOutSequenceId,
+ tempSequenceId, Constants.SequenceProperties.OUT_SEQUENCE_ID,
+ newOutSequenceId);
+ SequencePropertyBean tempSequenceBean = new SequencePropertyBean(
+ newOutSequenceId,
Constants.SequenceProperties.TEMP_SEQUENCE_ID, tempSequenceId);
sequencePropMgr.insert(outSequenceBean);
sequencePropMgr.insert(tempSequenceBean);
-
-
+
//processing for accept (offer has been sent)
Accept accept = createSeqResponsePart.getAccept();
- if (accept!=null) {
+ if (accept != null) {
//Find offered sequence from temp sequence id.
- SequencePropertyBean offeredSequenceBean = sequencePropMgr.retrieve(tempSequenceId,Constants.SequenceProperties.OFFERED_SEQUENCE);
-
+ SequencePropertyBean offeredSequenceBean = sequencePropMgr
+ .retrieve(tempSequenceId,
+ Constants.SequenceProperties.OFFERED_SEQUENCE);
+
//TODO this should be detected in the Fault manager.
- if (offeredSequenceBean==null)
- throw new SandeshaException ("No offered sequence. But an accept was received");
-
+ if (offeredSequenceBean == null)
+ throw new SandeshaException(
+ "No offered sequence. But an accept was received");
+
String offeredSequenceId = (String) offeredSequenceBean.getValue();
-
- EndpointReference acksToEPR = accept.getAcksTo().getAddress().getEpr();
- SequencePropertyBean acksToBean = new SequencePropertyBean ();
+
+ EndpointReference acksToEPR = accept.getAcksTo().getAddress()
+ .getEpr();
+ SequencePropertyBean acksToBean = new SequencePropertyBean();
acksToBean.setName(Constants.SequenceProperties.ACKS_TO_EPR);
acksToBean.setSequenceId(offeredSequenceId);
- acksToBean.setValue(acksToEPR);
-
+ acksToBean.setValue(acksToEPR);
+
sequencePropMgr.insert(acksToBean);
-
- NextMsgBean nextMsgBean = new NextMsgBean ();
+
+ NextMsgBean nextMsgBean = new NextMsgBean();
nextMsgBean.setSequenceId(offeredSequenceId);
nextMsgBean.setNextMsgNoToProcess(1);
-
+
NextMsgBeanMgr nextMsgMgr = storageManager.getNextMsgBeanMgr();
nextMsgMgr.insert(nextMsgBean);
}
-
-
-
+
RetransmitterBean target = new RetransmitterBean();
target.setTempSequenceId(tempSequenceId);
@@ -154,34 +143,38 @@
//updating the application message
String key = tempBean.getKey();
MessageContext applicationMsg = SandeshaUtil
- .getStoredMessageContext(key);
-
+ .getStoredMessageContext(key);
+
RMMsgContext applicaionRMMsg = MsgInitializer
.initializeMessage(applicationMsg);
-
- Sequence sequencePart = (Sequence) applicaionRMMsg.getMessagePart(Constants.MessageParts.SEQUENCE);
- if (sequencePart==null)
- throw new SandeshaException ("Sequence part is null");
-
- Identifier identifier = new Identifier ();
+ Sequence sequencePart = (Sequence) applicaionRMMsg
+ .getMessagePart(Constants.MessageParts.SEQUENCE);
+ if (sequencePart == null)
+ throw new SandeshaException("Sequence part is null");
+
+ Identifier identifier = new Identifier();
identifier.setIndentifer(newOutSequenceId);
-
+
sequencePart.setIdentifier(identifier);
try {
applicaionRMMsg.addSOAPEnvelope();
} catch (AxisFault e) {
- throw new SandeshaException (e.getMessage());
+ throw new SandeshaException(e.getMessage());
}
-
+
//asking to send the application msssage
tempBean.setSend(true);
retransmitterMgr.update(tempBean);
}
-
- createSeqResponseRMMsgCtx.getMessageContext().getOperationContext().setProperty(org.apache.axis2.Constants.RESPONSE_WRITTEN,"false");
-
- //FIXME - Dont have to de below if the correct operation description is set.
- createSeqResponseRMMsgCtx.getMessageContext().setPausedTrue(new QName (Constants.IN_HANDLER_NAME));
+
+ createSeqResponseRMMsgCtx.getMessageContext().getOperationContext()
+ .setProperty(org.apache.axis2.Constants.RESPONSE_WRITTEN,
+ "false");
+
+ //FIXME - Dont have to de below if the correct operation description is
+ // set.
+ createSeqResponseRMMsgCtx.getMessageContext().setPausedTrue(
+ new QName(Constants.IN_HANDLER_NAME));
}
}
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=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java Wed Nov 2 17:27:17 2005
@@ -1,45 +1,40 @@
/*
- * 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.
- *
+ * 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.Constants;
-/**
- * @author
- *
- */
public class MsgProcessorFactory {
- public static MsgProcessor getMessageProcessor (int msgType) {
- switch (msgType)
- {
- case (Constants.MessageTypes.CREATE_SEQ):
- return new CreateSeqMsgProcessor ();
- case (Constants.MessageTypes.TERMINATE_SEQ):
- return new TerminateSeqMsgProcessor ();
- case (Constants.MessageTypes.APPLICATION):
- return new ApplicationMsgProcessor ();
- case (Constants.MessageTypes.CREATE_SEQ_RESPONSE):
- return new CreateSeqResponseMsgProcessor();
- case (Constants.MessageTypes.ACK):
- return new AcknowledgementProcessor ();
- default:
- return null;
+ public static MsgProcessor getMessageProcessor(int msgType) {
+ switch (msgType) {
+ case (Constants.MessageTypes.CREATE_SEQ):
+ return new CreateSeqMsgProcessor();
+ case (Constants.MessageTypes.TERMINATE_SEQ):
+ return new TerminateSeqMsgProcessor();
+ case (Constants.MessageTypes.APPLICATION):
+ return new ApplicationMsgProcessor();
+ case (Constants.MessageTypes.CREATE_SEQ_RESPONSE):
+ return new CreateSeqResponseMsgProcessor();
+ case (Constants.MessageTypes.ACK):
+ return new AcknowledgementProcessor();
+ default:
+ return null;
}
}
-}
+}
\ No newline at end of file
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java?rev=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java Wed Nov 2 17:27:17 2005
@@ -1,61 +1,48 @@
/*
- * 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.
- *
+ * 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 java.io.SequenceInputStream;
import javax.xml.namespace.QName;
-
-import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.sandesha2.Constants;
import org.apache.sandesha2.RMMsgContext;
import org.apache.sandesha2.SandeshaException;
-import org.apache.sandesha2.storage.StorageManager;
-import org.apache.sandesha2.storage.inmemory.InMemoryCreateSeqBeanMgr;
-import org.apache.sandesha2.storage.inmemory.InMemoryNextMsgBeanMgr;
-import org.apache.sandesha2.storage.inmemory.InMemorySequencePropertyBeanMgr;
-import org.apache.sandesha2.storage.inmemory.InMemoryStorageMapBeanMgr;
import org.apache.sandesha2.wsrm.SequenceAcknowledgement;
-import org.apache.sandesha2.wsrm.TerminateSequence;
-
-/**
- * @author Chamikara
- * @author Sanka
- */
public class TerminateSeqMsgProcessor implements MsgProcessor {
public void processMessage(RMMsgContext terminateSeqRMMSg)
throws SandeshaException {
-
+
MessageContext terminateSeqMsg = terminateSeqRMMSg.getMessageContext();
//Processing for ack if any
- SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) terminateSeqRMMSg.getMessagePart(Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
- if (sequenceAck!=null) {
- AcknowledgementProcessor ackProcessor = new AcknowledgementProcessor ();
+ SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) terminateSeqRMMSg
+ .getMessagePart(Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
+ if (sequenceAck != null) {
+ AcknowledgementProcessor ackProcessor = new AcknowledgementProcessor();
ackProcessor.processMessage(terminateSeqRMMSg);
}
-
+
//Processing the terminate message
//TODO Add terminate sequence message logic.
-
- terminateSeqMsg.setPausedTrue(new QName (Constants.IN_HANDLER_NAME));
-
+
+ terminateSeqMsg.setPausedTrue(new QName(Constants.IN_HANDLER_NAME));
+
}
-}
+}
\ No newline at end of file
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/StorageManager.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/StorageManager.java?rev=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/StorageManager.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/StorageManager.java Wed Nov 2 17:27:17 2005
@@ -17,21 +17,12 @@
package org.apache.sandesha2.storage;
-import org.apache.axis2.context.AbstractContext;
import org.apache.axis2.context.ConfigurationContext;
-import org.apache.sandesha2.Constants;
import org.apache.sandesha2.storage.beanmanagers.CreateSeqBeanMgr;
import org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr;
import org.apache.sandesha2.storage.beanmanagers.RetransmitterBeanMgr;
import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
import org.apache.sandesha2.storage.beanmanagers.StorageMapBeanMgr;
-import org.apache.sandesha2.storage.inmemory.InMemoryCreateSeqBeanMgr;
-import org.apache.sandesha2.storage.inmemory.InMemoryNextMsgBeanMgr;
-import org.apache.sandesha2.storage.inmemory.InMemoryRetransmitterBeanMgr;
-import org.apache.sandesha2.storage.inmemory.InMemorySequencePropertyBeanMgr;
-import org.apache.sandesha2.storage.inmemory.InMemoryStorageMapBeanMgr;
-
-import com.sun.corba.se.internal.core.Constant;
/**
* @author Chamikara Jayalath <ch...@wso2.com>
@@ -40,30 +31,30 @@
public abstract class StorageManager {
private ConfigurationContext context;
-
- public StorageManager (ConfigurationContext context) {
+
+ public StorageManager(ConfigurationContext context) {
this.context = context;
}
-
- public ConfigurationContext getContext () {
+
+ public ConfigurationContext getContext() {
return context;
}
-
- public void setContext (ConfigurationContext context) {
- if (context!=null)
+
+ public void setContext(ConfigurationContext context) {
+ if (context != null)
this.context = context;
}
-
- public abstract Transaction getTransaction ();
-
- public abstract CreateSeqBeanMgr getCreateSeqBeanMgr ();
-
- public abstract NextMsgBeanMgr getNextMsgBeanMgr ();
- public abstract RetransmitterBeanMgr getRetransmitterBeanMgr ();
+ public abstract Transaction getTransaction();
+
+ public abstract CreateSeqBeanMgr getCreateSeqBeanMgr();
+
+ public abstract NextMsgBeanMgr getNextMsgBeanMgr();
+
+ public abstract RetransmitterBeanMgr getRetransmitterBeanMgr();
- public abstract SequencePropertyBeanMgr getSequencePropretyBeanMgr ();
+ public abstract SequencePropertyBeanMgr getSequencePropretyBeanMgr();
- public abstract StorageMapBeanMgr getStorageMapBeanMgr ();
+ public abstract StorageMapBeanMgr getStorageMapBeanMgr();
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/CreateSeqBeanMgr.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/CreateSeqBeanMgr.java?rev=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/CreateSeqBeanMgr.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/CreateSeqBeanMgr.java Wed Nov 2 17:27:17 2005
@@ -18,13 +18,8 @@
package org.apache.sandesha2.storage.beanmanagers;
import java.sql.ResultSet;
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.Hashtable;
-import java.util.Iterator;
-import org.apache.axis2.context.AbstractContext;
-import org.apache.sandesha2.Constants;
import org.apache.sandesha2.storage.beans.CreateSeqBean;
/**
@@ -45,4 +40,4 @@
public Collection find(CreateSeqBean bean);
public ResultSet find(String query);
-}
+}
\ No newline at end of file
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/NextMsgBeanMgr.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/NextMsgBeanMgr.java?rev=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/NextMsgBeanMgr.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/NextMsgBeanMgr.java Wed Nov 2 17:27:17 2005
@@ -18,13 +18,7 @@
package org.apache.sandesha2.storage.beanmanagers;
import java.sql.ResultSet;
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.Hashtable;
-import java.util.Iterator;
-
-import org.apache.axis2.context.AbstractContext;
-import org.apache.sandesha2.Constants;
import org.apache.sandesha2.storage.beans.NextMsgBean;
/**
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/RetransmitterBeanMgr.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/RetransmitterBeanMgr.java?rev=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/RetransmitterBeanMgr.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/RetransmitterBeanMgr.java Wed Nov 2 17:27:17 2005
@@ -18,13 +18,7 @@
package org.apache.sandesha2.storage.beanmanagers;
import java.sql.ResultSet;
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.Hashtable;
-import java.util.Iterator;
-
-import org.apache.axis2.context.AbstractContext;
-import org.apache.sandesha2.Constants;
import org.apache.sandesha2.SandeshaException;
import org.apache.sandesha2.storage.beans.RetransmitterBean;
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/SequencePropertyBeanMgr.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/SequencePropertyBeanMgr.java?rev=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/SequencePropertyBeanMgr.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/SequencePropertyBeanMgr.java Wed Nov 2 17:27:17 2005
@@ -18,13 +18,7 @@
package org.apache.sandesha2.storage.beanmanagers;
import java.sql.ResultSet;
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.Hashtable;
-import java.util.Iterator;
-
-import org.apache.axis2.context.AbstractContext;
-import org.apache.sandesha2.Constants;
import org.apache.sandesha2.storage.beans.SequencePropertyBean;
/**
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/StorageMapBeanMgr.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/StorageMapBeanMgr.java?rev=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/StorageMapBeanMgr.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/StorageMapBeanMgr.java Wed Nov 2 17:27:17 2005
@@ -18,13 +18,7 @@
package org.apache.sandesha2.storage.beanmanagers;
import java.sql.ResultSet;
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.Hashtable;
-import java.util.Iterator;
-
-import org.apache.axis2.context.AbstractContext;
-import org.apache.sandesha2.Constants;
import org.apache.sandesha2.storage.beans.StorageMapBean;
/**
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/CreateSeqBean.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/CreateSeqBean.java?rev=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/CreateSeqBean.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/CreateSeqBean.java Wed Nov 2 17:27:17 2005
@@ -1,24 +1,22 @@
/*
- * 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.
- *
+ * 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.storage.beans;
-import java.io.Serializable;
-
public class CreateSeqBean implements RMBean {
private String tempSequenceId;
@@ -26,15 +24,17 @@
private String SequenceId;
- public CreateSeqBean (){
-
+ public CreateSeqBean() {
+
}
-
- public CreateSeqBean (String tempSeqId, String CreateSeqMsgId, String sequenceId) {
+
+ public CreateSeqBean(String tempSeqId, String CreateSeqMsgId,
+ String sequenceId) {
this.tempSequenceId = tempSeqId;
this.CreateSeqMsgId = CreateSeqMsgId;
this.SequenceId = sequenceId;
}
+
/**
* @return Returns the createSeqMsgId.
*/
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/NextMsgBean.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/NextMsgBean.java?rev=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/NextMsgBean.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/NextMsgBean.java Wed Nov 2 17:27:17 2005
@@ -17,10 +17,8 @@
package org.apache.sandesha2.storage.beans;
-import java.io.Serializable;
-
/**
- * @author
+ * @author
*/
public class NextMsgBean implements RMBean {
private String SequenceId;
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/RetransmitterBean.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/RetransmitterBean.java?rev=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/RetransmitterBean.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/RetransmitterBean.java Wed Nov 2 17:27:17 2005
@@ -1,24 +1,22 @@
/*
- * 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.
- *
+ * 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.storage.beans;
-import java.io.Serializable;
-
public class RetransmitterBean implements RMBean {
private String messageId;
@@ -32,13 +30,13 @@
private String tempSequenceId;
private int sentCount = 0;
-
+
private long messageNumber = 0;
-
+
private boolean reSend = true;
-
- public RetransmitterBean () {
-
+
+ public RetransmitterBean() {
+
}
public RetransmitterBean(String messageId, String key, long lastSentTime,
@@ -90,30 +88,29 @@
public void setTempSequenceId(String tempSequenceId) {
this.tempSequenceId = tempSequenceId;
}
-
+
public int getSentCount() {
return sentCount;
}
-
+
public void setSentCount(int sentCount) {
this.sentCount = sentCount;
}
-
+
public long getMessageNumber() {
return messageNumber;
}
-
+
public void setMessageNumber(long messageNumber) {
this.messageNumber = messageNumber;
}
-
-
+
public boolean isReSend() {
return reSend;
}
-
+
public void setReSend(boolean reSend) {
this.reSend = reSend;
}
-
+
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/SequencePropertyBean.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/SequencePropertyBean.java?rev=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/SequencePropertyBean.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/SequencePropertyBean.java Wed Nov 2 17:27:17 2005
@@ -16,8 +16,6 @@
*/
package org.apache.sandesha2.storage.beans;
-import java.io.Serializable;
-
/**
* @author Sanka Samaranayake <ss...@gmail.com>
*/
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/StorageMapBean.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/StorageMapBean.java?rev=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/StorageMapBean.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/StorageMapBean.java Wed Nov 2 17:27:17 2005
@@ -17,8 +17,6 @@
package org.apache.sandesha2.storage.beans;
-import java.io.Serializable;
-
/**
* @author
*/
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryCreateSeqBeanMgr.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryCreateSeqBeanMgr.java?rev=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryCreateSeqBeanMgr.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryCreateSeqBeanMgr.java Wed Nov 2 17:27:17 2005
@@ -23,9 +23,7 @@
import java.util.Iterator;
import org.apache.axis2.context.AbstractContext;
-import org.apache.axis2.context.ConfigurationContext;
import org.apache.sandesha2.Constants;
-import org.apache.sandesha2.SandeshaException;
import org.apache.sandesha2.storage.beanmanagers.CreateSeqBeanMgr;
import org.apache.sandesha2.storage.beans.CreateSeqBean;
@@ -38,7 +36,6 @@
private Hashtable table = null;
-
//TODO change the primary key.
//When offered. msgId==null
/**
@@ -70,43 +67,47 @@
public boolean update(CreateSeqBean bean) {
if (!table.contains(bean))
return false;
-
+
return table.put(bean.getCreateSeqMsgId(), bean) != null;
}
public Collection find(CreateSeqBean bean) {
ArrayList beans = new ArrayList();
- if (bean==null)
+ if (bean == null)
return beans;
-
+
Iterator iterator = table.values().iterator();
CreateSeqBean temp;
while (iterator.hasNext()) {
temp = (CreateSeqBean) iterator.next();
-// if ((bean.getCreateSeqMsgId() != null && bean.getCreateSeqMsgId()
-// .equals(temp.getCreateSeqMsgId()))
-// && (bean.getSequenceId() != null && bean.getSequenceId()
-// .equals(bean.getSequenceId()))) {
-// beans.add(temp);
-//
-// }
-
+ // if ((bean.getCreateSeqMsgId() != null && bean.getCreateSeqMsgId()
+ // .equals(temp.getCreateSeqMsgId()))
+ // && (bean.getSequenceId() != null && bean.getSequenceId()
+ // .equals(bean.getSequenceId()))) {
+ // beans.add(temp);
+ //
+ // }
+
boolean equal = true;
-
- if (bean.getCreateSeqMsgId()!=null && !bean.getCreateSeqMsgId().equals(temp.getCreateSeqMsgId()))
+
+ if (bean.getCreateSeqMsgId() != null
+ && !bean.getCreateSeqMsgId().equals(
+ temp.getCreateSeqMsgId()))
equal = false;
-
- if (bean.getSequenceId()!=null && !bean.getSequenceId().equals(temp.getSequenceId()))
+
+ if (bean.getSequenceId() != null
+ && !bean.getSequenceId().equals(temp.getSequenceId()))
equal = false;
-
- if (bean.getTempSequenceId()!=null && !bean.getTempSequenceId().equals(temp.getTempSequenceId()))
+
+ if (bean.getTempSequenceId() != null
+ && !bean.getTempSequenceId().equals(
+ temp.getTempSequenceId()))
equal = false;
-
-
+
if (equal)
beans.add(temp);
-
+
}
return beans;
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryNextMsgBeanMgr.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryNextMsgBeanMgr.java?rev=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryNextMsgBeanMgr.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryNextMsgBeanMgr.java Wed Nov 2 17:27:17 2005
@@ -23,9 +23,7 @@
import java.util.Iterator;
import org.apache.axis2.context.AbstractContext;
-import org.apache.axis2.context.ConfigurationContext;
import org.apache.sandesha2.Constants;
-import org.apache.sandesha2.SandeshaException;
import org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr;
import org.apache.sandesha2.storage.beans.NextMsgBean;
@@ -72,36 +70,38 @@
ArrayList beans = new ArrayList();
Iterator iterator = table.values().iterator();
- if (bean==null)
+ if (bean == null)
return beans;
-
+
NextMsgBean temp;
while (iterator.hasNext()) {
temp = (NextMsgBean) iterator.next();
-// if ((bean.getSequenceId() != null && bean.getSequenceId().equals(
-// temp.getSequenceId()))
-// /*
-// * && (bean.getNextMsgNoToProcess() != null &&
-// * bean.getNextMsgNoToProcess().equals(temp.getNextMsgNoToProcess()))
-// */
-// && (bean.getNextMsgNoToProcess() > 0)) {
-//
-// beans.add(temp);
-// }
-
-
+ // if ((bean.getSequenceId() != null && bean.getSequenceId().equals(
+ // temp.getSequenceId()))
+ // /*
+ // * && (bean.getNextMsgNoToProcess() != null &&
+ // *
+ // bean.getNextMsgNoToProcess().equals(temp.getNextMsgNoToProcess()))
+ // */
+ // && (bean.getNextMsgNoToProcess() > 0)) {
+ //
+ // beans.add(temp);
+ // }
+
boolean equal = true;
-
- if (bean.getNextMsgNoToProcess()>0 && bean.getNextMsgNoToProcess()!=temp.getNextMsgNoToProcess())
+
+ if (bean.getNextMsgNoToProcess() > 0
+ && bean.getNextMsgNoToProcess() != temp
+ .getNextMsgNoToProcess())
equal = false;
-
- if (bean.getSequenceId()!=null && !bean.getSequenceId().equals(temp.getSequenceId()))
+
+ if (bean.getSequenceId() != null
+ && !bean.getSequenceId().equals(temp.getSequenceId()))
equal = false;
-
+
if (equal)
beans.add(temp);
-
}
return beans;
@@ -110,7 +110,7 @@
public boolean update(NextMsgBean bean) {
if (!table.contains(bean))
return false;
-
+
return table.put(bean.getSequenceId(), bean) != null;
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryRetransmitterBeanMgr.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryRetransmitterBeanMgr.java?rev=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryRetransmitterBeanMgr.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryRetransmitterBeanMgr.java Wed Nov 2 17:27:17 2005
@@ -23,12 +23,10 @@
import java.util.Iterator;
import org.apache.axis2.context.AbstractContext;
-import org.apache.axis2.context.ConfigurationContext;
import org.apache.sandesha2.Constants;
import org.apache.sandesha2.SandeshaException;
import org.apache.sandesha2.storage.beanmanagers.RetransmitterBeanMgr;
import org.apache.sandesha2.storage.beans.RetransmitterBean;
-import org.apache.sandesha2.util.MsgInitializer;
/**
* @author Chamikara Jayalath <ch...@wso2.com>
@@ -57,7 +55,7 @@
public boolean insert(RetransmitterBean bean) throws SandeshaException {
if (bean.getMessageId() == null)
- throw new SandeshaException("Key (MessageId) is null. Cant insert.");
+ throw new SandeshaException("Key (MessageId) is null. Cant insert.");
table.put(bean.getMessageId(), bean);
return true;
}
@@ -75,7 +73,7 @@
temp = (RetransmitterBean) iterator.next();
boolean add = true;
-
+
if (bean.getKey() != null && !bean.getKey().equals(temp.getKey()))
add = false;
@@ -88,7 +86,8 @@
add = false;
if (bean.getTempSequenceId() != null
- && !bean.getTempSequenceId().equals(temp.getTempSequenceId()))
+ && !bean.getTempSequenceId().equals(
+ temp.getTempSequenceId()))
add = false;
if (bean.getMessageNumber() > 0
@@ -126,7 +125,7 @@
public boolean update(RetransmitterBean bean) {
if (!table.contains(bean))
return false;
-
+
return table.put(bean.getMessageId(), bean) != null;
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemorySequencePropertyBeanMgr.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemorySequencePropertyBeanMgr.java?rev=330406&r1=330405&r2=330406&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemorySequencePropertyBeanMgr.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemorySequencePropertyBeanMgr.java Wed Nov 2 17:27:17 2005
@@ -23,9 +23,7 @@
import java.util.Iterator;
import org.apache.axis2.context.AbstractContext;
-import org.apache.axis2.context.ConfigurationContext;
import org.apache.sandesha2.Constants;
-import org.apache.sandesha2.SandeshaException;
import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
import org.apache.sandesha2.storage.beans.SequencePropertyBean;
@@ -68,40 +66,43 @@
public Collection find(SequencePropertyBean bean) {
ArrayList beans = new ArrayList();
-
- if (bean==null)
+
+ if (bean == null)
return beans;
-
+
Iterator iterator = table.values().iterator();
SequencePropertyBean temp;
while (iterator.hasNext()) {
temp = (SequencePropertyBean) iterator.next();
-// if ((bean.getSequenceId() != null && bean.getSequenceId().equals(
-// temp.getSequenceId()))
-// && (bean.getName() != null && bean.getName().equals(
-// temp.getName()))
-// && (bean.getValue() != null && bean.getValue().equals(
-// temp.getValue()))) {
-//
-// beans.add(temp);
-// }
-
+ // if ((bean.getSequenceId() != null && bean.getSequenceId().equals(
+ // temp.getSequenceId()))
+ // && (bean.getName() != null && bean.getName().equals(
+ // temp.getName()))
+ // && (bean.getValue() != null && bean.getValue().equals(
+ // temp.getValue()))) {
+ //
+ // beans.add(temp);
+ // }
+
boolean equal = true;
-
- if (bean.getSequenceId()!=null && !bean.getSequenceId().equals(temp.getSequenceId()))
+
+ if (bean.getSequenceId() != null
+ && !bean.getSequenceId().equals(temp.getSequenceId()))
equal = false;
-
- if (bean.getName()!=null && !bean.getName().equals(temp.getName()))
+
+ if (bean.getName() != null
+ && !bean.getName().equals(temp.getName()))
equal = false;
-
- if (bean.getValue()!=null && !bean.getValue().equals(temp.getValue()))
+
+ if (bean.getValue() != null
+ && !bean.getValue().equals(temp.getValue()))
equal = false;
-
+
if (equal)
beans.add(temp);
-
+
}
return beans;
}
@@ -109,7 +110,7 @@
public boolean update(SequencePropertyBean bean) {
if (!table.contains(bean))
return false;
-
+
return table.put(getId(bean), bean) != null;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org