cgl.narada.wsinfra.wsrm.impl
Class WsrmSinkNodeHelper

java.lang.Object
  extended by cgl.narada.wsinfra.WsProcessor
      extended by cgl.narada.wsinfra.wsrm.impl.WsrmSinkNodeHelper

public class WsrmSinkNodeHelper
extends WsProcessor

This interfaces outlines the functionality of a WSRM sink.


Method Summary
 WsrmSequencePolicies addPolicyAttachment(EnvelopeDocument envelopeDocument, String sequenceIdentifier)
          Adds a policyAttachment to the header of the provide envelope.
 WsrmSequenceInfo checkAckRequestedElementForProblems(AddressingHeaders addressingHeaders, AckRequestedDocument ackRequestedDoc)
          Upon receipt of a sequence this method checks to see if any problems exist within the element.
 void checkExchangeType(WsrmExchangeInfo wsrmExchangeInfo, int direction)
          Checks an exchange type for validity.
 boolean checkIfDuplicate(SequenceDocument sequenceDocument)
          Checks to see if there is already a widget that has been stored corresponding to messageNumber and sequenceIdentifier encapsulated within the [wsrm:SequenceDocument].
 WsrmSequenceInfo checkSequenceElementForProblems(AddressingHeaders addressingHeaders, SequenceDocument sequenceDocument)
          Upon receipt of a sequence this method checks to see if any problems exist within the element.
 WsrmSequenceInfo checkTerminateSequenceElementForProblems(AddressingHeaders addressingHeaders, TerminateSequenceDocument terminateSequenceDocument)
          Upon receipt of a sequence this method checks to see if any problems exist within the element.
 EndpointReferenceType getEndpointReference()
           
static WsrmSinkNodeHelper getInstance()
           
 WsMessageFlow getMessageFlow()
          Gets the message flow which the processor should use.
 void initialize(WsrmStorageService wsrmStorageService)
           
 EnvelopeDocument prepareCreateSequenceResponseEnvelope(AddressingHeaders addressingHeaders)
          Prepares a create sequence response based on the addressing headers contained in the original request.
 EnvelopeDocument prepareEnvelopeForAcknowledgement(AddressingHeaders addressingHeaders, WsrmSequenceInfo wsrmSequenceInfo)
          Prepares a SOAP envelope for the acknowledgement based on the specified addressingHeaders (contained within an AckRequested element) and the SequenceIdentifier contained within the WsrmSequenceInfo.
 boolean processExchange(EnvelopeDocument envelopeDocument, int direction)
          This is the method which all implementations of the various WS specifications will override.
 void setEndpointReference(EndpointReferenceType endpointReference)
          Retrieves the endpoint reference associated with this node
 void setMessageFlow(WsMessageFlow wsMessageFlow)
          Sets the message flow which the processor should use
 void throwCreateSequenceRefusedFaultException(AddressingHeaders addressingHeaders, String additionalReason)
          Throws a CreateSequenceRefused Fault exception, if additional reason is not null, it will be added to the default reason element.
 void throwInvalidMessageFaultException(String reason, AddressingHeaders addressingHeaders)
          Throws an Invalid MessageFault exception based on the specified parameters
 void throwLastMessageNumberExceededFaultException(AddressingHeaders addressingHeaders, String sequenceIdentifier, String additionalReason)
          Throws a WsFaultException corresponding to the LastMessageNumberExceeded fault.
 void throwSequenceTerminatedFaultException(AddressingHeaders addressingHeaders, String sequenceIdentifier, String additionalReason)
          Throws a WsFaultException corresponding to the sequence terminated fault.
 void throwUnknownSequenceFaultException(AddressingHeaders addressingHeaders, String identifier)
          Throws an UnknownSequence Fault exception based on the specified parameters
 
Methods inherited from class cgl.narada.wsinfra.WsProcessor
enrouteToApplication, enrouteToNetwork, enrouteToNetwork, isFault, manageFaultException, processExchange, processExchange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static WsrmSinkNodeHelper getInstance()

processExchange

public boolean processExchange(EnvelopeDocument envelopeDocument,
                               int direction)
                        throws UnknownExchangeException,
                               IncorrectExchangeException,
                               ProcessingException,
                               MessageFlowException
Description copied from class: WsProcessor
This is the method which all implementations of the various WS specifications will override. Note that deployement need only pass the JAVA-WORLD javax.xml.SOAPMessage and all the processing and conversions take place automatically.

Specified by:
processExchange in class WsProcessor
Throws:
UnknownExchangeException
IncorrectExchangeException
ProcessingException
MessageFlowException

setMessageFlow

public void setMessageFlow(WsMessageFlow wsMessageFlow)
                    throws DeploymentException
Sets the message flow which the processor should use

Specified by:
setMessageFlow in class WsProcessor
Throws:
DeploymentException

getMessageFlow

public WsMessageFlow getMessageFlow()
Gets the message flow which the processor should use.

Specified by:
getMessageFlow in class WsProcessor

initialize

public void initialize(WsrmStorageService wsrmStorageService)
                throws DeploymentException
Throws:
DeploymentException

getEndpointReference

public EndpointReferenceType getEndpointReference()

setEndpointReference

public void setEndpointReference(EndpointReferenceType endpointReference)
Retrieves the endpoint reference associated with this node


prepareCreateSequenceResponseEnvelope

public EnvelopeDocument prepareCreateSequenceResponseEnvelope(AddressingHeaders addressingHeaders)
                                                       throws WsFaultException,
                                                              ProcessingException,
                                                              WsrmStorageException
Prepares a create sequence response based on the addressing headers contained in the original request. This method performs the following functions.
(a) Checks to see if the required elements [wsa:To] & [wsa:MessageID] are present. If they are not a ProcessingException or FaultException is thrown respectively.
(b) Prepare the SOAP enevelope with the approporiate destination, [wsa:Action] and [wsa:RelatesTo] fields.
(c) Create a new sequenceIdentifier, proceed to add the appropriate CreateSequenceResponse document based on this.
(d) Attach policy information to the envelope.
(e) Create the wsrmSequenceInfo element and add it to the database.

Throws:
WsFaultException
ProcessingException
WsrmStorageException

addPolicyAttachment

public WsrmSequencePolicies addPolicyAttachment(EnvelopeDocument envelopeDocument,
                                                String sequenceIdentifier)
Adds a policyAttachment to the header of the provide envelope. Make sure that a header is present within the supplied envelope. This attachment is typically added to the header of the CreateSequenceResponse envelope document.


checkSequenceElementForProblems

public WsrmSequenceInfo checkSequenceElementForProblems(AddressingHeaders addressingHeaders,
                                                        SequenceDocument sequenceDocument)
                                                 throws WsrmStorageException,
                                                        WsFaultException
Upon receipt of a sequence this method checks to see if any problems exist within the element. Specifically we check for the following problems
(a)Make sure that there is a wsu:Identifier element in Sequence, and that it is not of a NULL value.
(b)Make sure that we know about the sequence.
(c)Make sure that this sequence is not terminated.
(d)Check to see that the message number is NOT ZERO.
(e)Check to see that the LastMessageNumber constraint is not exceeded.
(f)Check to see that the source is not trying to OVERRIDE a PREVIOUSLY established last message number. This method returns the WsrmSequenceInfo corresponding to the element; this is done to reduce the number of database accesses.

Throws:
WsrmStorageException
WsFaultException

checkIfDuplicate

public boolean checkIfDuplicate(SequenceDocument sequenceDocument)
                         throws WsrmStorageException
Checks to see if there is already a widget that has been stored corresponding to messageNumber and sequenceIdentifier encapsulated within the [wsrm:SequenceDocument].

Throws:
WsrmStorageException

checkAckRequestedElementForProblems

public WsrmSequenceInfo checkAckRequestedElementForProblems(AddressingHeaders addressingHeaders,
                                                            AckRequestedDocument ackRequestedDoc)
                                                     throws WsrmStorageException,
                                                            WsFaultException
Upon receipt of a sequence this method checks to see if any problems exist within the element. Specifically we check for the following problems
(a)Make sure that there is a wsu:Identifier element in Sequence, and that it is not of a NULL value.
(b)Make sure that we know about the sequence.
(c)Make sure that this sequence is not terminated.
(d)Check to see that the message number is NOT ZERO.
(e)Check to see that the LastMessageNumber constraint is not exceeded.

Throws:
WsrmStorageException
WsFaultException

prepareEnvelopeForAcknowledgement

public EnvelopeDocument prepareEnvelopeForAcknowledgement(AddressingHeaders addressingHeaders,
                                                          WsrmSequenceInfo wsrmSequenceInfo)
                                                   throws WsFaultException,
                                                          ProcessingException
Prepares a SOAP envelope for the acknowledgement based on the specified addressingHeaders (contained within an AckRequested element) and the SequenceIdentifier contained within the WsrmSequenceInfo.

Throws:
WsFaultException
ProcessingException

checkTerminateSequenceElementForProblems

public WsrmSequenceInfo checkTerminateSequenceElementForProblems(AddressingHeaders addressingHeaders,
                                                                 TerminateSequenceDocument terminateSequenceDocument)
                                                          throws WsrmStorageException,
                                                                 WsFaultException
Upon receipt of a sequence this method checks to see if any problems exist within the element. Specifically we check for the following problems
(a)Make sure that there is a wsu:Identifier element in Sequence, and that it is not of a NULL value.
(b)Make sure that we know about the sequence.
(c)Make sure that this sequence is not terminated.
(d)Make sure that the sequence being terminated DOES NOT have any pending acknowledgements to issue.

Throws:
WsrmStorageException
WsFaultException

throwLastMessageNumberExceededFaultException

public void throwLastMessageNumberExceededFaultException(AddressingHeaders addressingHeaders,
                                                         String sequenceIdentifier,
                                                         String additionalReason)
                                                  throws WsFaultException
Throws a WsFaultException corresponding to the LastMessageNumberExceeded fault.

Throws:
WsFaultException

throwSequenceTerminatedFaultException

public void throwSequenceTerminatedFaultException(AddressingHeaders addressingHeaders,
                                                  String sequenceIdentifier,
                                                  String additionalReason)
                                           throws WsFaultException
Throws a WsFaultException corresponding to the sequence terminated fault.

Throws:
WsFaultException

throwCreateSequenceRefusedFaultException

public void throwCreateSequenceRefusedFaultException(AddressingHeaders addressingHeaders,
                                                     String additionalReason)
                                              throws WsFaultException
Throws a CreateSequenceRefused Fault exception, if additional reason is not null, it will be added to the default reason element.

Throws:
WsFaultException

throwInvalidMessageFaultException

public void throwInvalidMessageFaultException(String reason,
                                              AddressingHeaders addressingHeaders)
                                       throws WsFaultException
Throws an Invalid MessageFault exception based on the specified parameters

Throws:
WsFaultException

throwUnknownSequenceFaultException

public void throwUnknownSequenceFaultException(AddressingHeaders addressingHeaders,
                                               String identifier)
                                        throws WsFaultException
Throws an UnknownSequence Fault exception based on the specified parameters

Throws:
WsFaultException

checkExchangeType

public void checkExchangeType(WsrmExchangeInfo wsrmExchangeInfo,
                              int direction)
                       throws UnknownExchangeException,
                              IncorrectExchangeException
Checks an exchange type for validity. If there are problems exceptions are thrown.

Throws:
UnknownExchangeException
IncorrectExchangeException


For comments and suggestions please send e-mail to The NaradaBrokering Project