org.apache.axis2.client
Class Options

java.lang.Object
  extended by org.apache.axis2.client.Options
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, SafeSerializable

public class Options
extends java.lang.Object
implements java.io.Externalizable, SafeSerializable

Holder for operation client options. This is used by the other classes in this package to configure various aspects of how a client communicates with a service. It exposes a number of predefined properties as part of the API (with specific getXXX and setXXX methods), and also allows for arbitrary named properties to be passed using a properties map with the property name as the key value. Instances of this class can be chained together for property inheritance, so that if a property is not set in one instance it will check its parent for a setting.

See Also:
Serialized Form

Field Summary
static java.lang.String CUSTOM_REPLYTO_ADDRESS
           
static java.lang.String CUSTOM_REPLYTO_ADDRESS_TRUE
           
static int DEFAULT_TIMEOUT_MILLISECONDS
          Default blocking timeout value.
protected  TransportOutDescription transportOut
          This is used for sending and receiving messages.
 
Constructor Summary
Options()
          Default constructor
Options(Options parent)
          In normal mode operation, this options will try to fulfil the request from its values.
 
Method Summary
 void activate(ConfigurationContext cc)
          This method checks to see if additional work needs to be done in order to complete the object reconstitution.
 void addReferenceParameter(org.apache.axiom.om.OMElement referenceParameter)
          Deprecated.  
 void addRelatesTo(RelatesTo relatesTo)
          Add WS-Addressing RelatesTo item.
 java.lang.String getAction()
          Get WS-Addressing Action / SOAP Action string.
 EndpointReference getFaultTo()
          Get WS-Addressing FaultTo endpoint reference.
 EndpointReference getFrom()
          Set WS-Addressing From endpoint reference.
 TransportListener getListener()
          Get listener used for incoming message.
 java.lang.String getLogCorrelationIDString()
          Get the ID associated with this object instance.
 java.lang.String getMessageId()
          Get WS-Addressing MessageId.
 Options getParent()
          Get parent instance providing default property values.
 java.lang.String getPassword()
           
 java.util.Map getProperties()
          Get a copy of the general option properties.
 java.lang.Object getProperty(java.lang.String key)
          Get named property value.
 RelatesTo getRelatesTo()
          Return a single instance of WS-Addressing RelatesTo that has a relationship type of either "http://www.w3.org/2005/08/addressing/reply" or "wsa:Reply".
 RelatesTo getRelatesTo(java.lang.String type)
          Get WS-Addressing RelatesTo item with a specified type.
 RelatesTo[] getRelationships()
          Get all WS-Addressing RelatesTo items.
 EndpointReference getReplyTo()
          Get WS-Addressing ReplyTo endpoint reference.
 java.lang.String getSoapVersionURI()
          Get SOAP version being used.
 long getTimeOutInMilliSeconds()
          Gets the wait time after which a client times out in a blocking scenario.
 EndpointReference getTo()
          Get WS-Addressing To endpoint reference.
 TransportInDescription getTransportIn()
          Get transport used for incoming message.
 java.lang.String getTransportInProtocol()
          Get transport protocol used for incoming message.
 TransportOutDescription getTransportOut()
          Get outbound transport description.
 java.lang.String getUserName()
           
 boolean isCallTransportCleanup()
           
 boolean isEquivalent(Options obj)
          Compares key parts of the state from the current instance of this class with the specified instance to see if they are equivalent.
 boolean isExceptionToBeThrownOnSOAPFault()
          If there is a SOAP Fault in the body of the incoming SOAP Message, system can be configured to throw an exception with the details extracted from the information from the fault message.
 boolean isManageSession()
          Check if session management is enabled.
 boolean isUseSeparateListener()
          Check whether the two SOAP Messages are be sent over same channel or over separate channels.
 void readExternal(java.io.ObjectInput inObject)
          Restore the contents of the MessageContext that was previously saved.
 void setAction(java.lang.String action)
          Set WS-Addressing Action / SOAP Action string.
 void setCallTransportCleanup(boolean callTransportCleanup)
           
 void setExceptionToBeThrownOnSOAPFault(boolean exceptionToBeThrownOnSOAPFault)
          If there is a SOAP Fault in the body of the incoming SOAP Message, system can be configured to throw an exception with the details extracted from the information from the fault message.
 void setFaultTo(EndpointReference faultTo)
          Set WS-Addressing FaultTo endpoint reference.
 void setFrom(EndpointReference from)
          Set WS-Addressing From endpoint reference.
 void setListener(TransportListener listener)
          Set listener used for incoming message.
 void setManageSession(boolean manageSession)
          Set session management enabled state.
 void setMessageId(java.lang.String messageId)
          Set WS-Addressing MessageId.
 void setParent(Options parent)
          Set parent instance providing default property values.
 void setPassword(java.lang.String password)
           
 void setProperties(java.util.Map properties)
          Set the general property definitions.
 void setProperty(java.lang.String propertyKey, java.lang.Object property)
          General properties you need to pass in to the message context must be set via this method.
 void setRelationships(RelatesTo[] list)
          Set WS-Addressing RelatesTo items.
 void setReplyTo(EndpointReference replyTo)
          Set WS-Addressing ReplyTo endpoint.
 void setSenderTransport(java.lang.String senderTransport, AxisConfiguration axisConfiguration)
          Set transport used for outgoing message.
 void setSoapVersionURI(java.lang.String soapVersionURI)
          Set the SOAP version to be used.
 void setTimeOutInMilliSeconds(long timeOutInMilliSeconds)
          This is used in blocking scenario.
 void setTo(EndpointReference to)
          Set WS-Addressing To endpoint.
 void setTransportIn(TransportInDescription transportIn)
          Set transport used for incoming message.
 void setTransportInfo(java.lang.String senderTransport, java.lang.String listenerTransport, boolean useSeparateListener)
          Deprecated. Use setTransportInProtocol(String) and useSeparateListener(boolean) instead. You do not need to setSenderTransportProtocol(String) as sender transport can be inferred from the to EPR. But still you can setTransportOut(TransportOutDescription).
 void setTransportInProtocol(java.lang.String transportInProtocol)
          Set transport protocol used for incoming message.
 void setTransportOut(TransportOutDescription transportOut)
          Set transport used for outgoing message.
 void setUserName(java.lang.String userName)
           
 void setUseSeparateListener(boolean useSeparateListener)
          Used to specify whether the two SOAP Messages are be sent over same channel or over separate channels.
 void writeExternal(java.io.ObjectOutput o)
          Save the contents of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CUSTOM_REPLYTO_ADDRESS

public static java.lang.String CUSTOM_REPLYTO_ADDRESS

CUSTOM_REPLYTO_ADDRESS_TRUE

public static java.lang.String CUSTOM_REPLYTO_ADDRESS_TRUE

DEFAULT_TIMEOUT_MILLISECONDS

public static final int DEFAULT_TIMEOUT_MILLISECONDS
Default blocking timeout value.

See Also:
Constant Field Values

transportOut

protected TransportOutDescription transportOut
This is used for sending and receiving messages.

Constructor Detail

Options

public Options()
Default constructor


Options

public Options(Options parent)
In normal mode operation, this options will try to fulfil the request from its values. If that is not possible, this options will request those information from its parent.

Parameters:
parent -
Method Detail

getAction

public java.lang.String getAction()
Get WS-Addressing Action / SOAP Action string.

Returns:
action

getFaultTo

public EndpointReference getFaultTo()
Get WS-Addressing FaultTo endpoint reference.

Returns:
endpoint

getFrom

public EndpointReference getFrom()
Set WS-Addressing From endpoint reference.

Returns:
endpoint

getListener

public TransportListener getListener()
Get listener used for incoming message.

Returns:
listener

getTransportIn

public TransportInDescription getTransportIn()
Get transport used for incoming message.

Returns:
transport information

getTransportInProtocol

public java.lang.String getTransportInProtocol()
Get transport protocol used for incoming message.

Returns:
name protocol name ("http", "tcp", etc.)

getMessageId

public java.lang.String getMessageId()
Get WS-Addressing MessageId.

Returns:
uri string

getProperties

public java.util.Map getProperties()
Get a copy of the general option properties. Because of the way options are stored this does not include properties with specific get/set methods, only the general properties identified by a text string. The returned map merges properties inherited from parent options, if any, to give a complete set of property definitions as seen by users of this options instance. The returned copy is not "live", so changes you make to the copy are not reflected in the actual option settings. However, you can make the modified values take effect with a call to setProperties(Map),

Returns:
copy of general properties

getProperty

public java.lang.Object getProperty(java.lang.String key)
Get named property value.

Parameters:
key -
Returns:
the value related to this key. null, if not found.

getRelatesTo

public RelatesTo getRelatesTo(java.lang.String type)
Get WS-Addressing RelatesTo item with a specified type. If there are multiple RelatesTo items defined with the same type, the one returned by this method is arbitrary - if you need to handle this case, you can instead use the getRelationships() to retrieve all the items and check for multiple matches.

Parameters:
type - relationship type (URI)
Returns:
item of specified type

getRelatesTo

public RelatesTo getRelatesTo()
Return a single instance of WS-Addressing RelatesTo that has a relationship type of either "http://www.w3.org/2005/08/addressing/reply" or "wsa:Reply". If no such instance of RelatesTo can be found then return null.

Returns:
an instance of RelatesTo

getRelationships

public RelatesTo[] getRelationships()
Get all WS-Addressing RelatesTo items.

Returns:
array of items

setRelationships

public void setRelationships(RelatesTo[] list)
Set WS-Addressing RelatesTo items.

Parameters:
list -

getReplyTo

public EndpointReference getReplyTo()
Get WS-Addressing ReplyTo endpoint reference.

Returns:
endpoint

getTransportOut

public TransportOutDescription getTransportOut()
Get outbound transport description.

Returns:
description

getSoapVersionURI

public java.lang.String getSoapVersionURI()
Get SOAP version being used.

Returns:
version

getTimeOutInMilliSeconds

public long getTimeOutInMilliSeconds()
Gets the wait time after which a client times out in a blocking scenario. The default is Options#DEFAULT_TIMEOUT_MILLISECONDS

Returns:
timeOutInMilliSeconds

getTo

public EndpointReference getTo()
Get WS-Addressing To endpoint reference.

Returns:
endpoint

isExceptionToBeThrownOnSOAPFault

public boolean isExceptionToBeThrownOnSOAPFault()
If there is a SOAP Fault in the body of the incoming SOAP Message, system can be configured to throw an exception with the details extracted from the information from the fault message. This boolean variable will enable that facility. If this is false, the response message will just be returned to the application, irrespective of whether it has a Fault or not.

Returns:
true if exception to be thrown

isUseSeparateListener

public boolean isUseSeparateListener()
Check whether the two SOAP Messages are be sent over same channel or over separate channels. Only duplex transports such as http and tcp support a false value.

Returns:
separate channel flag

getParent

public Options getParent()
Get parent instance providing default property values.

Returns:
parent (null if none)

setParent

public void setParent(Options parent)
Set parent instance providing default property values.

Parameters:
parent - (null if none)

setAction

public void setAction(java.lang.String action)
Set WS-Addressing Action / SOAP Action string.

Parameters:
action -

setExceptionToBeThrownOnSOAPFault

public void setExceptionToBeThrownOnSOAPFault(boolean exceptionToBeThrownOnSOAPFault)
If there is a SOAP Fault in the body of the incoming SOAP Message, system can be configured to throw an exception with the details extracted from the information from the fault message. This boolean variable will enable that facility. If this is false, the response message will just be returned to the application, irrespective of whether it has a Fault or not.

Parameters:
exceptionToBeThrownOnSOAPFault -

setFaultTo

public void setFaultTo(EndpointReference faultTo)
Set WS-Addressing FaultTo endpoint reference.

Parameters:
faultTo - endpoint

setFrom

public void setFrom(EndpointReference from)
Set WS-Addressing From endpoint reference.

Parameters:
from - endpoint

setListener

public void setListener(TransportListener listener)
Set listener used for incoming message.

Parameters:
listener -

setTransportIn

public void setTransportIn(TransportInDescription transportIn)
Set transport used for incoming message.

Parameters:
transportIn -

setTransportInProtocol

public void setTransportInProtocol(java.lang.String transportInProtocol)
Set transport protocol used for incoming message.

Parameters:
transportInProtocol - ("http", "tcp", etc.)

setMessageId

public void setMessageId(java.lang.String messageId)
Set WS-Addressing MessageId.

Parameters:
messageId - URI string

setProperties

public void setProperties(java.util.Map properties)
Set the general property definitions. Due to the way properties are stored, this will not effect the values of predefined properties with specific get/set methods.

Parameters:
properties -

setProperty

public void setProperty(java.lang.String propertyKey,
                        java.lang.Object property)
General properties you need to pass in to the message context must be set via this method. This method can only be used for properties which do not have specific get/set methods.

Here are some of the properties supported in Axis2.

Generic Constants

WS-Addressing Module Specific Constants

HTTP Constants

Constants to be used in a REST Invocation

Parameters:
propertyKey -
property -

addRelatesTo

public void addRelatesTo(RelatesTo relatesTo)
Add WS-Addressing RelatesTo item.

Parameters:
relatesTo -

setReplyTo

public void setReplyTo(EndpointReference replyTo)
Set WS-Addressing ReplyTo endpoint.

Parameters:
replyTo - endpoint

setTransportOut

public void setTransportOut(TransportOutDescription transportOut)
Set transport used for outgoing message.

Parameters:
transportOut -

setSenderTransport

public void setSenderTransport(java.lang.String senderTransport,
                               AxisConfiguration axisConfiguration)
                        throws AxisFault
Set transport used for outgoing message.

Parameters:
senderTransport - transport name in Axis2 configuration ("http", "tcp", etc.)
axisConfiguration -
Throws:
AxisFault - if the transport is not found

setSoapVersionURI

public void setSoapVersionURI(java.lang.String soapVersionURI)
Set the SOAP version to be used.

Parameters:
soapVersionURI -
See Also:
Constants.URI_SOAP11_ENV, Constants.URI_SOAP12_ENV

setTimeOutInMilliSeconds

public void setTimeOutInMilliSeconds(long timeOutInMilliSeconds)
This is used in blocking scenario. Client will time out after waiting this amount of time. The default is 2000 and must be provided in multiples of 100.

Parameters:
timeOutInMilliSeconds -

setTo

public void setTo(EndpointReference to)
Set WS-Addressing To endpoint.

Parameters:
to - endpoint

setTransportInfo

public void setTransportInfo(java.lang.String senderTransport,
                             java.lang.String listenerTransport,
                             boolean useSeparateListener)
                      throws AxisFault
Deprecated. Use setTransportInProtocol(String) and useSeparateListener(boolean) instead. You do not need to setSenderTransportProtocol(String) as sender transport can be inferred from the to EPR. But still you can setTransportOut(TransportOutDescription).

Sets transport information to the call. The scenarios supported are as follows:

  [senderTransport, listenerTransport, useSeparateListener]
  http, http, true
  http, http, false
  http, smtp, true
  smtp, http, true
  smtp, smtp, true
  tcp,  tcp,  true
  tcp,  tcp,  false
  etc.
 

Parameters:
senderTransport -
listenerTransport -
useSeparateListener -
Throws:
AxisFault

setUseSeparateListener

public void setUseSeparateListener(boolean useSeparateListener)
Used to specify whether the two SOAP Messages are be sent over same channel or over separate channels. The value of this variable depends on the transport specified. For e.g., if the transports are different this is true by default. HTTP transport supports both cases while SMTP transport supports only two channel case.

Parameters:
useSeparateListener -

addReferenceParameter

public void addReferenceParameter(org.apache.axiom.om.OMElement referenceParameter)
Deprecated. 

Add WS-Addressing ReferenceParameter child element. Multiple child may be used. TODO Add get method, implement handling.

Parameters:
referenceParameter -

isManageSession

public boolean isManageSession()
Check if session management is enabled.

Returns:
true if enabled

setManageSession

public void setManageSession(boolean manageSession)
Set session management enabled state. When session management is enabled, the engine will automatically send session data (such as the service group id, or HTTP cookies) as part of requests.

Parameters:
manageSession - true if enabling sessions

writeExternal

public void writeExternal(java.io.ObjectOutput o)
                   throws java.io.IOException
Save the contents of this object.

NOTE: Transient fields and static fields are not saved.

Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
out - The stream to write the object contents to
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput inObject)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Restore the contents of the MessageContext that was previously saved.

NOTE: The field data must read back in the same order and type as it was written. Some data will need to be validated when resurrected.

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
in - The stream to read the object contents from
Throws:
java.io.IOException
java.lang.ClassNotFoundException

activate

public void activate(ConfigurationContext cc)
This method checks to see if additional work needs to be done in order to complete the object reconstitution. Some parts of the object restored from the readExternal() cannot be completed until we have a configurationContext from the active engine. The configurationContext is used to help this object to plug back into the engine's configuration and deployment objects.

Parameters:
cc - The configuration context object representing the active configuration

isEquivalent

public boolean isEquivalent(Options obj)
Compares key parts of the state from the current instance of this class with the specified instance to see if they are equivalent.

This differs from the java.lang.Object.equals() method in that the equals() method generally looks at both the object identity (location in memory) and the object state (data).

Parameters:
obj - The object to compare with
Returns:
TRUE if this object is equivalent with the specified object that is, key fields match FALSE, otherwise

getLogCorrelationIDString

public java.lang.String getLogCorrelationIDString()
Get the ID associated with this object instance.

Returns:
A string that can be output to a log file as an identifier for this object instance. It is suitable for matching related log entries.

isCallTransportCleanup

public boolean isCallTransportCleanup()

setCallTransportCleanup

public void setCallTransportCleanup(boolean callTransportCleanup)

getUserName

public java.lang.String getUserName()

setUserName

public void setUserName(java.lang.String userName)

getPassword

public java.lang.String getPassword()

setPassword

public void setPassword(java.lang.String password)


Copyright © 2007 Apache Web Services Project. All Rights Reserved.