Oracle

weblogic.wsee.reliability
Class WsrmUtils

java.lang.Object
  extended by weblogic.wsee.reliability.WsrmUtils

public class WsrmUtils
extends Object

This class is a utility class for using Web Services Reliable Messaging (WSRM) given a service stub (WLStub) instance. It allows you to do common things such as setting configuration options, getting the sequence id, and terminating a reliable sequence.


Constructor Summary
WsrmUtils()
           
 
Method Summary
static void closeSequence(Stub stub)
          This method is used to close a reliable sequence on the given stub.
static Duration getExpires(Stub stub)
          This method gets the expiration time that was previously set on the reliable sequence.
static Duration getOfferExpires(Stub stub)
          This method gets the expiration time that was previously set on the offered reliable sequence.
static String getSequenceId(Stub stub)
          This method is to obtain the sequence id on a stub.
static boolean isAnonymousAck(Stub stub)
          This method determines whether anonymous acknowledgement is used.
static boolean isFinalMessage(Stub stub)
          This method determines whether the final message has been sent on the sequence for this stub.
static boolean isLastMessage(Stub stub)
          This method determines whether the last message property has been previously set.
static boolean isSequenceInitialized(Stub stub)
          Convenience method to check if a given stub has had its sequence created and fully initialized.
static void printSoapMsg(SOAPMessage msg)
          Dumps the contents of a SOAPMessage to the WSEE Verbose.getOut() output stream.
static void reset(Stub stub)
          This method is used to clear any reliable sequence on the given stub, thus allowing a new sequence to be started using this stub.
static void sendEmptyLastMessage(Stub stub)
          This method is used to send an empty last message according to the WSRM spec.
static void setAnonymousAck(Stub stub)
          This method allows to use anonymous acknowledgement according to the WSRM specification.
static void setExpires(Stub stub, Duration duration)
          This method sets the expiration time of the reliable sequence on the client side.
static void setFinalMessage(Stub stub)
          Sets a flag on this service handle indicating that the next message sent using the handle will be the 'final' request to be sent.
static void setLastMessage(Stub stub)
          This method sets the next message sent to be the last message.
static void setOfferExpires(Stub stub, Duration duration)
          This method sets the expiration time of the offered reliable sequence.
static void terminateSequence(Stub stub)
          This method is used to terminate a reliable sequence on the given stub.
static String waitForSequenceInitialization(Stub stub, long waitIntervalInMillis, long maxWaitIntervals)
          Convenience method to wait until a given stub has had its sequence created and fully initialized.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WsrmUtils

public WsrmUtils()
Method Detail

isSequenceInitialized

public static boolean isSequenceInitialized(Stub stub)
Convenience method to check if a given stub has had its sequence created and fully initialized. This method is useful for waiting to try to send acknowledgement requests, or to close/terminate a sequence.

Parameters:
stub - The stub that carries the reliable sequence.
Returns:
True if the sequence is fully initialized.

waitForSequenceInitialization

public static String waitForSequenceInitialization(Stub stub,
                                                   long waitIntervalInMillis,
                                                   long maxWaitIntervals)
Convenience method to wait until a given stub has had its sequence created and fully initialized. This method is useful for waiting to try to send acknowledgement requests, or to close/terminate a sequence.

Parameters:
stub - The stub that carries the reliable sequence.
waitIntervalInMillis - The number of milliseconds to wait at each interval (before checking the sequence again).
maxWaitIntervals - The maximum number of times to recheck the sequence.
See Also:
WsrmUtils.isSequenceInitialized(Stub)

sendEmptyLastMessage

public static void sendEmptyLastMessage(Stub stub)
This method is used to send an empty last message according to the WSRM spec. This will complete the reliable sequence. No further reliable message should be sent on this stub. Note, you should insure the sequence is initialized prior to calling this method.

Parameters:
stub - The jaxrpc stub that's used to carry the reliable sequence.
Throws:
JAXRPCException - This exception is thrown when there are errors in sending the mesage.
See Also:
WsrmUtils.waitForSequenceInitialization(Stub, long, long)

closeSequence

public static void closeSequence(Stub stub)
This method is used to close a reliable sequence on the given stub. No further reliable messages may be sent on this stub. This method allows the client to get a full and final reckoning for the reliable sequence, and decide how to proceed if there are unacknowleged messages.

Parameters:
stub - The jaxrpc stub that's used to carry the reliable sequence.
Throws:
JAXRPCException - This exception is thrown when there are errors in closing the sequence.

terminateSequence

public static void terminateSequence(Stub stub)
This method is used to terminate a reliable sequence on the given stub. No further reliable messages should be sent on this stub. Note, you should insure the sequence is initialized prior to calling this method.

Parameters:
stub - The jaxrpc stub that's used to carry the reliable sequence.
Throws:
JAXRPCException - This exception is thrown when there are errors in terminating the sequence.
See Also:
WsrmUtils.waitForSequenceInitialization(Stub, long, long)

reset

public static void reset(Stub stub)
This method is used to clear any reliable sequence on the given stub, thus allowing a new sequence to be started using this stub. This method first terminates the sequence on the stub, and then clears the sequence from it.

Parameters:
stub - The jaxrpc stub that's used to carry the reliable sequence.
Throws:
JAXRPCException - This exception is thrown when there are errors in resetting the stub.

getSequenceId

public static String getSequenceId(Stub stub)
This method is to obtain the sequence id on a stub.

Parameters:
stub - The jaxrpc stub that's used to carry the reliable sequence.
Returns:
The sequence id for this reliable sequence. Null will be returned if the sequence has not been established yet.
Throws:
JAXRPCException - This exception is thrown when there are errors in getting the reliable sequence id.

setExpires

public static void setExpires(Stub stub,
                              Duration duration)
This method sets the expiration time of the reliable sequence on the client side. This value is then negotiated with the server side value to come up with the final expiration time. If this value is not set, the value specified in the policy file will be used.

Parameters:
stub - The jaxrpc stub that's used to carry the reliable sequence.
duration - The duration of the reliable sequence.

getExpires

public static Duration getExpires(Stub stub)
This method gets the expiration time that was previously set on the reliable sequence.

Parameters:
stub - The jaxrpc stub that's used to carry the reliable sequence.
Returns:
The duration of the reliable sequence.

setOfferExpires

public static void setOfferExpires(Stub stub,
                                   Duration duration)
This method sets the expiration time of the offered reliable sequence. If this value is not set, the value specified in the policy file will be used.

Parameters:
stub - The jaxrpc stub that's used to carry the reliable sequence.
duration - The duration of the reliable sequence.

getOfferExpires

public static Duration getOfferExpires(Stub stub)
This method gets the expiration time that was previously set on the offered reliable sequence.

Parameters:
stub - The jaxrpc stub that's used to carry the reliable sequence.
Returns:
The duration of the reliable sequence.

setAnonymousAck

public static void setAnonymousAck(Stub stub)
This method allows to use anonymous acknowledgement according to the WSRM specification.

Parameters:
stub - The jaxrpc stub that's used to carry the reliable sequence.

isAnonymousAck

public static boolean isAnonymousAck(Stub stub)
This method determines whether anonymous acknowledgement is used.

Parameters:
stub - The jaxrpc stub that's used to carry the reliable sequence.
Returns:
Whether anonymous acknowledgement is used.

setLastMessage

public static void setLastMessage(Stub stub)
This method sets the next message sent to be the last message.

Parameters:
stub - The jaxrpc stub that's used to carry the reliable sequence.

isLastMessage

public static boolean isLastMessage(Stub stub)
This method determines whether the last message property has been previously set.

Parameters:
stub - The jaxrpc stub that's used to carry the reliable sequence.
Returns:
Whether last message property has been set.

setFinalMessage

public static void setFinalMessage(Stub stub)
Sets a flag on this service handle indicating that the next message sent using the handle will be the 'final' request to be sent. Thus, you would call this method before invoking an operation on the service handle. Note, this method is fundamentally different than setting 'last' message (calling setLastMessage) in that setting the 'final' message is BEA-specific, and triggers BEA-specific behavior.

Setting this flag (and after sending the final message) will trigger the reliable messaging subsystem to start looking for acknowledgements for all messages up to and including the final message. When RM receives acknowledgements for all messages up to the final message, it will auto-terminate the sequence being maintained for this service handle. Note that auto-terminate will also auto-terminate any offer sequence (being used to send reliable responses to the requests sent by this service handle) once acknowlegements for all responses have been received.

Parameters:
stub - The stub for a service that's used to carry the reliable sequence.

isFinalMessage

public static boolean isFinalMessage(Stub stub)
This method determines whether the final message has been sent on the sequence for this stub.

Parameters:
stub - The stub for a service that's used to carry the reliable sequence.
Returns:
Whether final message has been sent.
See Also:
WsrmUtils.setFinalMessage(Stub)

printSoapMsg

public static void printSoapMsg(SOAPMessage msg)
Dumps the contents of a SOAPMessage to the WSEE Verbose.getOut() output stream. Note, use of this method on the receiving channel of a connection (i.e. the message received from a connection) is discouraged as it can reset the input stream used to read the message, and prevent attachments to the message (deferred until later) from being read.


Documentation is available at
http://edocs.bea.com/wls/docs103
Copyright 2008 Oracle