jaliya      2005/02/15 21:07:16

  Added:       sandesha/src/org/apache/sandesha/server/msgprocessors
                        AcknowledgementProcessor.java
                        CompositeProcessor.java
                        CreateSequenceProcessor.java
                        CreateSequenceResponseProcessor.java
                        FaultProcessor.java IRMMessageProcessor.java
                        ReTransmissionProcessor.java RequestProcessor.java
                        TerminateSequenceProcessor.java
  Log:
  Refactored the code, Manly change the package structure for the Storage
  
  Revision  Changes    Path
  1.1                  
ws-fx/sandesha/src/org/apache/sandesha/server/msgprocessors/AcknowledgementProcessor.java
  
  Index: AcknowledgementProcessor.java
  ===================================================================
  /*
   * 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.sandesha.server.msgprocessors;
  
  import org.apache.axis.Message;
  import org.apache.axis.MessageContext;
  import org.apache.sandesha.*;
  import org.apache.sandesha.ws.rm.AcknowledgementRange;
  import org.apache.sandesha.ws.rm.SequenceAcknowledgement;
  
  import javax.xml.soap.SOAPEnvelope;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Map;
  import java.util.Vector;
  
  /**
   * @author
   */
  public final class AcknowledgementProcessor implements IRMMessageProcessor {
      private IStorageManager storageManger = null;
  
      public AcknowledgementProcessor(IStorageManager storageManger) {
          this.storageManger = storageManger;
      }
  
      public final boolean processMessage(RMMessageContext rmMessageContext) 
throws RMException {
          SequenceAcknowledgement seqAcknowledgement = rmMessageContext
                  .getRMHeaders().getSequenceAcknowledgement();
          String seqID = seqAcknowledgement.getIdentifier().getIdentifier();
          List ackRanges = seqAcknowledgement.getAckRanges();
          Iterator ite = ackRanges.iterator();
  
          while (ite.hasNext()) {
              AcknowledgementRange ackRange = (AcknowledgementRange) ite.next();
              long msgNumber = ackRange.getMinValue();
              while (ackRange.getMaxValue() >= msgNumber) {
                  storageManger.setAckReceived(seqID, msgNumber);
                  storageManger.setAcknowledged(seqID, msgNumber);
                  msgNumber++;
              }
          }
          //At the moment this return is not used.
          return false;
      }
  
  
      public boolean sendAcknowledgement(RMMessageContext rmMessageContext) 
throws RMException {
          //EnvelopCreater createAcknowledgement
          //if async then add message to the queue
          //else set the response env of the messageContext.
          String seqID = rmMessageContext.getSequenceID();
  
          long messageNumber = rmMessageContext.getRMHeaders().getSequence()
                  .getMessageNumber().getMessageNumber();
          //Assume that the list is sorted and in the ascending order.
          Map listOfMsgNumbers = storageManger.getListOfMessageNumbers(seqID);
  
          if (null == listOfMsgNumbers)
              System.out.println("MSG Number list is NULL");
          else {
              Iterator ite = listOfMsgNumbers.keySet().iterator();
          }
  
          Vector ackRangeVector = null;
          if (listOfMsgNumbers != null) {
              ackRangeVector = getAckRangesVector(listOfMsgNumbers);
          } else {
              ackRangeVector = new Vector();
              AcknowledgementRange ackRange = new AcknowledgementRange();
              ackRange.setMaxValue(messageNumber);
              ackRange.setMinValue(messageNumber);
              ackRangeVector.add(ackRange);
          }
  
          RMMessageContext rmMsgContext = getAckRMMsgCtx(rmMessageContext, 
ackRangeVector);
  
          //FIX THIS FIX THIS //FIX THIS FIX THIS //FIX THIS FIX THIS
          //Need to change this to the new Anonymous URI.
          if ((true == 
(rmMessageContext.getAddressingHeaders().getFrom().getAddress().toString()
                  
.equals(org.apache.axis.message.addressing.Constants.NS_URI_ANONYMOUS)))
                  || 
("http://schemas.xmlsoap.org/ws/2003/03/addressing/role/anonymous".equals(rmMessageContext.getAddressingHeaders().getFrom()
                  .getAddress().toString()))) {
              //Now we have synchronized ack.
              //The original message context is used to send the ack
              // asynchronously to the client.
              //So the response message is replaced by the new ack message.
              try {
                  String soapMsg = 
rmMsgContext.getMsgContext().getResponseMessage().getSOAPPartAsString();
                  rmMessageContext.getMsgContext().setResponseMessage(new 
Message(soapMsg));
              } catch (Exception e) {
                  throw new RMException(e.getLocalizedMessage());
              }
  
              return true;
          } else {
              //Store the asynchronize ack in the queue.
              //The name for this queue is not yet fixed.
              //RENAME insertAcknowledgement(rmMessageContext)
              storageManger.addAcknowledgement(rmMsgContext);
              return false;
          }
  
      }
  
      private static RMMessageContext getAckRMMsgCtx(RMMessageContext 
rmMessageContext, Vector ackRangeVector) {
  
          SOAPEnvelope ackEnvelope = EnvelopeCreator
                  .createAcknowledgementEnvelope(rmMessageContext, 
ackRangeVector);
          //Add the envelope to the response message of the messageContext.
          //rmMessageContext.getMsgContext().setResponseMessage(new
          // Message(ackEnvelope));
          RMMessageContext rmMsgContext = new RMMessageContext();
          try {
              //Create a new message using the ackEnvelope
              Message resMsg = new Message(ackEnvelope);
  
              //Create a new message context to store the ack message.
              MessageContext msgContext = new 
MessageContext(rmMessageContext.getMsgContext().getAxisEngine());
              //Copy the contents of the rmMessageContext to the rmMsgContext.
              rmMessageContext.copyContents(rmMsgContext);
              //Set the response message using the Ack message
              msgContext.setResponseMessage(resMsg);
              //Set the msgContext to the rmMsgContext
              rmMsgContext.setMsgContext(msgContext);
  
              //Get the from address to send the Ack.
              //Doesn't matter whether we have Sync or ASync messages.
              //If we have Sync them this property is not used.
              rmMsgContext.setOutGoingAddress(rmMessageContext
                      
.getAddressingHeaders().getFrom().getAddress().toString());
              //Set the messsage type
              rmMsgContext.setMessageType(Constants.MSG_TYPE_ACKNOWLEDGEMENT);
          } catch (Exception e) {
              e.printStackTrace();
              //TODO: Log the error
          }
          return rmMsgContext;
      }
  
      /**
       * This method will split the input map with messages numbers to 
respectable
       * message ranges and will return a vector of AcknowledgementRange.
       *
       * @param listOfMsgNumbers
       * @return
       */
      private Vector getAckRangesVector(Map listOfMsgNumbers) {
          long min;
          long max;
          long size = listOfMsgNumbers.size();
          Vector vec = new Vector();
          boolean found = false;
  
          min = ((Long) listOfMsgNumbers.get(new Long(1))).longValue();
          max = min;
  
          if (size > 1) {
              for (long i = 1; i <= size; i++) {
  
                  if (i + 1 > size) {
                      found = true;
                      max = ((Long) listOfMsgNumbers.get(new Long(i)))
                              .longValue();
                  } else {
  
                      if (1 == (((Long) listOfMsgNumbers.get(new Long(i + 1)))
                              .longValue() - ((Long) listOfMsgNumbers
                              .get(new Long(i))).longValue())) {
                          max = ((Long) listOfMsgNumbers.get(new Long(i + 1)))
                                  .longValue();
                          found = true;
                      } else {
                          found = false;
                          max = ((Long) listOfMsgNumbers.get(new Long(i)))
                                  .longValue();
                          AcknowledgementRange ackRange = new 
AcknowledgementRange();
                          ackRange.setMaxValue(max);
                          ackRange.setMinValue(min);
                          vec.add(ackRange);
  
                          min = ((Long) listOfMsgNumbers.get(new Long(i + 1)))
                                  .longValue();
                      }
  
                  }
              }
              if (found) {
                  //System.out.println("Range "+min+" "+max);
                  AcknowledgementRange ackRange = new AcknowledgementRange();
                  ackRange.setMaxValue(max);
                  ackRange.setMinValue(min);
                  vec.add(ackRange);
              }
          } else {
              // System.out.println("Range "+min+" "+max);
              AcknowledgementRange ackRange = new AcknowledgementRange();
              ackRange.setMaxValue(max);
              ackRange.setMinValue(min);
              vec.add(ackRange);
          }
          return vec;
      }
  }
  
  
  1.1                  
ws-fx/sandesha/src/org/apache/sandesha/server/msgprocessors/CompositeProcessor.java
  
  Index: CompositeProcessor.java
  ===================================================================
  /*
   * 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.sandesha.server.msgprocessors;
  
  import org.apache.axis.Message;
  import org.apache.axis.MessageContext;
  import org.apache.sandesha.Constants;
  import org.apache.sandesha.IStorageManager;
  import org.apache.sandesha.RMException;
  import org.apache.sandesha.RMMessageContext;
  import org.apache.sandesha.ws.rm.RMHeaders;
  
  /**
   * @author
   */
  public class CompositeProcessor implements IRMMessageProcessor {
  
      IStorageManager storageManger = null;
  
      public CompositeProcessor(IStorageManager storageManger) {
          this.storageManger = storageManger;
      }
  
      public boolean processMessage(RMMessageContext rmMessageContext) throws 
RMException {
  
          //if the message is and Ack then process the ack
          //if the message has a body then insert it to the queue
  
          RMHeaders rmHeaders = rmMessageContext.getRMHeaders();
          AcknowledgementProcessor ackProcessor = new 
AcknowledgementProcessor(this.storageManger);
          if (rmHeaders.getSequenceAcknowledgement() != null) {
              ackProcessor.processMessage(rmMessageContext);
          }
  
          if (rmHeaders.getSequence() != null) {
              if (rmHeaders.getSequence().getMessageNumber() != null) {
                  String sequenceID = 
rmHeaders.getSequence().getIdentifier().getIdentifier();
                  long messageNumber = 
rmHeaders.getSequence().getMessageNumber().getMessageNumber();
                  if (storageManger.isMessageExist(sequenceID, messageNumber) 
!= true) {
                      //Create a copy of the RMMessageContext.
                      RMMessageContext rmMsgContext = new RMMessageContext();
                      //Copy the RMMEssageContext
                      rmMessageContext.copyContents(rmMsgContext);
                      System.out.println("SETTING THE RESPONSE " + sequenceID + 
"  " + messageNumber);
                      rmMsgContext.setSequenceID(sequenceID);
                      rmMsgContext.setMsgNumber(messageNumber);
                      try {
                          //Create a new MessageContext, by pasing the axis 
engine.
                          MessageContext msgContext = new 
MessageContext(rmMessageContext.getMsgContext().getAxisEngine());
                          //Copy the existing message context to the new 
message context.
                          
RMMessageContext.copyMessageContext(rmMessageContext.getMsgContext(), 
msgContext);
                          //Copy the request and response messages.
                          String soapMsg = 
rmMessageContext.getMsgContext().getRequestMessage().getSOAPPartAsString();
                          Message reqMsg = new Message(soapMsg);
                          //Message resMsg = new Message(rmMessageContext
                          //        .getMsgContext().getResponseMessage()
                          //        .getSOAPPartAsString());
                          //Set the request and response messages of the message
                          // context.
                          msgContext.setRequestMessage(reqMsg);
                          //msgContext.setResponseMessage(resMsg);
  
                          //rmMsgContext.setReqEnv(reqMsg.getSOAPEnvelope());
                          //rmMsgContext.setResEnv(resMsg.getSOAPEnvelope());
  
                          rmMsgContext.setMsgContext(msgContext);
                          //Set the message type for this message.
                          
rmMsgContext.setMessageType(Constants.MSG_TYPE_SERVICE_REQUEST);
                      } catch (Exception e) {
                          e.printStackTrace();
                          //TODO: Add to log.
                      }
  
                      System.out.println("INFO: Inserting the request message 
....\n");
                      //Insert the message to the INQUEUE
                      storageManger.insertIncomingMessage(rmMsgContext);
                  }
  
                  //Send an Ack for every message received by the server.
                  //This should be changed according to the WS-policy.
                  return ackProcessor.sendAcknowledgement(rmMessageContext);
              }
          }
          //If we don't have the sequence in the message then we have to send 
some errors.
          return false;
      }
  
  }
  
  
  1.1                  
ws-fx/sandesha/src/org/apache/sandesha/server/msgprocessors/CreateSequenceProcessor.java
  
  Index: CreateSequenceProcessor.java
  ===================================================================
  /*
   * 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.sandesha.server.msgprocessors;
  
  import org.apache.axis.Message;
  import org.apache.axis.MessageContext;
  import org.apache.axis.components.uuid.UUIDGen;
  import org.apache.axis.components.uuid.UUIDGenFactory;
  import org.apache.axis.message.SOAPEnvelope;
  import org.apache.axis.message.addressing.AddressingHeaders;
  import org.apache.axis.message.addressing.Constants;
  import org.apache.sandesha.EnvelopeCreator;
  import org.apache.sandesha.IStorageManager;
  import org.apache.sandesha.RMException;
  import org.apache.sandesha.RMMessageContext;
  import org.apache.sandesha.ws.rm.RMHeaders;
  
  /**
   * @author
   */
  public class CreateSequenceProcessor implements IRMMessageProcessor {
  
      IStorageManager storageManger = null;
  
      public CreateSequenceProcessor(IStorageManager storageManger) {
          this.storageManger = storageManger;
      }
  
      public boolean processMessage(RMMessageContext rmMessageContext) throws 
RMException {
  
          AddressingHeaders addrHeaders = 
rmMessageContext.getAddressingHeaders();
          RMHeaders rmHeaders = rmMessageContext.getRMHeaders();
  
          if (addrHeaders.getReplyTo() == null)
              rmMessageContext.setSync(true);
          else
              rmMessageContext.setSync(false);
  
          /*
           * We may let the user to decide on the UUID generation process. If
           * the user specify a method or service for generating UUIDs then
           * this request will be used to invoke that service and a UUID is
           * acquired. However if we want to do it, the user shoudl specify
           * the provider for that service as an parameter in the RM
           * Configuration. Currently the RMProvider will send create sequence
           * responses.
           */
          UUIDGen uuidGen = UUIDGenFactory.getUUIDGen();
          String uuid = uuidGen.nextUUID();
  
          //TODO
          //storageManger.addSequence("uuid:"+uuid);
  
          //Create the SOAPEnvelop to send and set it to the resEnv of
          // rmMessageCotext.
          SOAPEnvelope resEnvelope = EnvelopeCreator
                  .createCreateSequenceResponseEnvelope(uuid,
                          rmMessageContext);
  
          //Set the message type.
          rmMessageContext
                  
.setMessageType(org.apache.sandesha.Constants.MSG_TYPE_CREATE_SEQUENCE_RESPONSE);
  
          //FIX THIS FIX THIS
          //Need to change the ANONYMOUS URI to the new one after completion.
          //We have some synchronous stuff here
          //TODO  Do we need to support the null replyZo case?
          //If the from is also missing, and the reply to is alos null then we 
will assume it is
          //synchornous.
          if (addrHeaders.getReplyTo() == null || 
addrHeaders.getReplyTo().getAddress().toString()
                  
.equals("http://schemas.xmlsoap.org/ws/2003/03/addressing/role/anonymous";) || 
addrHeaders.getReplyTo().getAddress().toString()
                  .equals(Constants.NS_URI_ANONYMOUS)) {
  
              //Inform that we have a synchronous response.
              rmMessageContext.getMsgContext().setResponseMessage(new 
Message(resEnvelope));
              rmMessageContext.setSync(true);
              return true;
          } else {
  
              MessageContext msgContext = new MessageContext(rmMessageContext
                      .getMsgContext().getAxisEngine());
              msgContext.setResponseMessage(new Message(resEnvelope));
              rmMessageContext.setMsgContext(msgContext);
  
              rmMessageContext.setOutGoingAddress(addrHeaders.getReplyTo()
                      .getAddress().toString());
              rmMessageContext.setSync(false);
              storageManger.addCreateSequenceResponse(rmMessageContext);
              return false;
          }
  
  
      }
  
  }
  
  
  1.1                  
ws-fx/sandesha/src/org/apache/sandesha/server/msgprocessors/CreateSequenceResponseProcessor.java
  
  Index: CreateSequenceResponseProcessor.java
  ===================================================================
  /*
   * 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.sandesha.server.msgprocessors;
  
  import org.apache.axis.message.addressing.RelatesTo;
  import org.apache.sandesha.IStorageManager;
  import org.apache.sandesha.RMException;
  import org.apache.sandesha.RMMessageContext;
  import org.apache.sandesha.ws.rm.CreateSequenceResponse;
  
  /**
   * @author JEkanayake
   */
  public class CreateSequenceResponseProcessor implements IRMMessageProcessor {
      IStorageManager storageManager = null;
  
      public CreateSequenceResponseProcessor(IStorageManager storageManger) {
          this.storageManager = storageManger;
      }
  
      public boolean processMessage(RMMessageContext rmMessageContext) throws 
RMException {
  
          CreateSequenceResponse createSeqRes = rmMessageContext.getRMHeaders()
                  .getCreateSequenceResponse();
          //Assumne that the relatesTo is present.
          //CHEK CHEK
          // 
*********************************************************************************
          RelatesTo relatesTo = (RelatesTo) rmMessageContext
                  .getAddressingHeaders().getRelatesTo().get(0);
          String sequenceID = createSeqRes.getIdentifier().toString();
          //Approve the sequences. Now we can start sending the messages using
          // that sequence.
          storageManager.setApprovedOutSequence(relatesTo.getURI().toString(),
                  sequenceID);
          //No response to this message.
          return false;
      }
  
  }
  
  
  1.1                  
ws-fx/sandesha/src/org/apache/sandesha/server/msgprocessors/FaultProcessor.java
  
  Index: FaultProcessor.java
  ===================================================================
  /*
   * Created on Sep 1, 2004
   *
   * To change the template for this generated file go to
   * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
   */
  package org.apache.sandesha.server.msgprocessors;
  
  import org.apache.axis.AxisFault;
  import org.apache.axis.Message;
  import org.apache.axis.MessageContext;
  import org.apache.axis.components.logger.LogFactory;
  import org.apache.axis.message.SOAPFault;
  import org.apache.axis.message.addressing.AddressingHeaders;
  import org.apache.commons.logging.Log;
  import org.apache.sandesha.Constants;
  import org.apache.sandesha.IStorageManager;
  import org.apache.sandesha.RMException;
  import org.apache.sandesha.RMMessageContext;
  import org.apache.sandesha.storage.dao.SandeshaQueueDAO;
  import org.apache.sandesha.ws.rm.RMHeaders;
  
  /**
   * @author JEkanayake
   *         <p/>
   *         To change the template for this generated type comment go to
   *         Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and 
Comments
   */
  public class FaultProcessor implements IRMMessageProcessor {
      private IStorageManager storageManager = null;
      private AxisFault axisFault = null;
      private static final Log log = 
LogFactory.getLog(SandeshaQueueDAO.class.getName());
  
      public FaultProcessor(IStorageManager storageManager) {
          this.storageManager = storageManager;
      }
  
      public FaultProcessor(IStorageManager storageManager, AxisFault 
axisFault) {
          this.storageManager = storageManager;
          this.axisFault = axisFault;
      }
  
      public IStorageManager getStorageManager() {
          return storageManager;
      }
  
      public void setStorageManager(IStorageManager storageManager) {
          this.storageManager = storageManager;
      }
  
      /*
       * (non-Javadoc)
       * 
       * @see 
org.apache.sandesha.server.msgprocessors.IRMMessageProcessor#processMessage(org.apache.sandesha.RMMessageContext)
       */
      public boolean processMessage(RMMessageContext rmMessageContext) throws 
RMException {
  
          //Check the fault type.
          //Create the fault envelop
          //identify the target endpoin i.e whether async or sync
          //if sync, rmMessageContext.getmsgctx.setresopnes(new msg(fault));
          //return true
          //else inset to the storage
          //return false
          SOAPFault soapFault = null;
  
          if 
(Constants.FaultCodes.IN_CORRECT_MESSAGE.equalsIgnoreCase(axisFault.getFaultCode().getLocalPart()))
 {
              soapFault = new SOAPFault(this.axisFault);
          }
  
          return sendFault(rmMessageContext, soapFault);
  
  
      }
  
      private boolean sendFault(RMMessageContext rmMessageContext, SOAPFault 
soapFault) {
  
          AddressingHeaders addrHeaders;
          RMHeaders rmHeaders;
          MessageContext msgContext = rmMessageContext.getMsgContext();
  
          if (rmMessageContext.getAddressingHeaders() != null) {
              addrHeaders = rmMessageContext.getAddressingHeaders();
              if (addrHeaders.getFaultTo() != null) {
                  if 
(addrHeaders.getFaultTo().getAddress().toString().equals(org.apache.axis.message.addressing.Constants.NS_URI_ANONYMOUS))
 {
                      msgContext.setResponseMessage(new Message(soapFault));
                      return true;
                  } else {
                      storageManager.insertFault(rmMessageContext);
                      return false;
                  }
              } else if (addrHeaders.getReplyTo() != null) {
                  if 
(addrHeaders.getReplyTo().getAddress().toString().equals(org.apache.axis.message.addressing.Constants.NS_URI_ANONYMOUS))
 {
                      msgContext.setResponseMessage(new Message(soapFault));
                      return true;
                  } else {
                      storageManager.insertFault(rmMessageContext);
                      return false;
                  }
              } else if (addrHeaders.getFrom() != null) {
                  if 
(addrHeaders.getFrom().getAddress().toString().equals(org.apache.axis.message.addressing.Constants.NS_URI_ANONYMOUS))
 {
                      msgContext.setResponseMessage(new Message(soapFault));
                      return true;
                  } else {
                      storageManager.insertFault(rmMessageContext);
                      return false;
                  }
              }
          } else {
              FaultProcessor.log.error(this.axisFault);
              msgContext.setResponseMessage(new Message(soapFault));
              return true;
          }
          return true;
      }
  
  }
  
  
  1.1                  
ws-fx/sandesha/src/org/apache/sandesha/server/msgprocessors/IRMMessageProcessor.java
  
  Index: IRMMessageProcessor.java
  ===================================================================
  /*
   * 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.sandesha.server.msgprocessors;
  
  import org.apache.sandesha.RMException;
  import org.apache.sandesha.RMMessageContext;
  
  /**
   * @author
   */
  public interface IRMMessageProcessor {
  
      //Returns true if the message has a synchronous response or ack.
      public boolean processMessage(RMMessageContext rmMessageContext)
              throws RMException;
  
  }
  
  
  1.1                  
ws-fx/sandesha/src/org/apache/sandesha/server/msgprocessors/ReTransmissionProcessor.java
  
  Index: ReTransmissionProcessor.java
  ===================================================================
  /*
   * 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.sandesha.server.msgprocessors;
  
  import org.apache.sandesha.RMException;
  import org.apache.sandesha.RMMessageContext;
  
  /**
   * @author
   */
  public class ReTransmissionProcessor implements IRMMessageProcessor {
  
      /*
       * (non-Javadoc)
       * 
       * @see 
org.apache.sandesha.server.RMMessageProcessor#processMessage(org.apache.sandesha.RMMessageContext)
       */
      public boolean processMessage(RMMessageContext rmMessageContext) throws 
RMException {
          // TODO Auto-generated method stub
          return false;
      }
  
  }
  
  
  1.1                  
ws-fx/sandesha/src/org/apache/sandesha/server/msgprocessors/RequestProcessor.java
  
  Index: RequestProcessor.java
  ===================================================================
  /*
   * 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.sandesha.server.msgprocessors;
  
  import org.apache.sandesha.RMMessageContext;
  
  /**
   * @author JEkanayake
   *         <p/>
   *         To change the template for this generated type comment go to
   *         Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and 
Comments
   */
  public class RequestProcessor implements IRMMessageProcessor {
  
      /*
       * (non-Javadoc)
       * 
       * @see 
org.apache.sandesha.server.RMMessageProcessor#processMessage(org.apache.sandesha.RMMessageContext)
       */
      public boolean processMessage(RMMessageContext rmMessageContext) {
          // TODO Auto-generated method stub
          return false;
      }
  
  }
  
  
  1.1                  
ws-fx/sandesha/src/org/apache/sandesha/server/msgprocessors/TerminateSequenceProcessor.java
  
  Index: TerminateSequenceProcessor.java
  ===================================================================
  /*
   * 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.sandesha.server.msgprocessors;
  
  import org.apache.sandesha.IStorageManager;
  import org.apache.sandesha.RMException;
  import org.apache.sandesha.RMMessageContext;
  import org.apache.sandesha.ws.rm.TerminateSequence;
  
  /**
   * @author
   */
  public class TerminateSequenceProcessor implements IRMMessageProcessor {
  
      IStorageManager storageManger = null;
  
      public TerminateSequenceProcessor(IStorageManager storageManger) {
          this.storageManger = storageManger;
      }
  
      public boolean processMessage(RMMessageContext rmMessageContext) throws 
RMException {
  
          TerminateSequence terminateSeq = 
rmMessageContext.getRMHeaders().getTerminateSequence();
  
          if (terminateSeq != null && terminateSeq.getIdentifier() != null) {
              String seqID = terminateSeq.getIdentifier().getIdentifier();
          }
  
  
          //TODO
          // 
*****************************************************************************
          //storageManger.terminateSequence(sequenceID);
  
  
          return false;
      }
  
  }
  
  

Reply via email to