Package adams.flow.webservice
Class AbstractWebServiceClientSource<O>
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.webservice.AbstractWebServiceClientSource<O>
-
- Type Parameters:
O
- the type of output data to handle
- All Implemented Interfaces:
adams.core.AdditionalInformationHandler
,adams.core.CleanUpHandler
,adams.core.Destroyable
,adams.core.ErrorProvider
,adams.core.GlobalInfoSupporter
,adams.core.logging.LoggingLevelHandler
,adams.core.logging.LoggingSupporter
,adams.core.option.OptionHandler
,adams.core.QuickInfoSupporter
,adams.core.SizeOfHandler
,AlternativeUrlSupporter
,WebServiceClient
,WebServiceClientProducer<O>
,WsdlUrlProvider
,Serializable
- Direct Known Subclasses:
AbstractWebServiceClientSourceWithCallableTransformer
public abstract class AbstractWebServiceClientSource<O> extends adams.core.option.AbstractOptionHandler implements WebServiceClientProducer<O>, adams.core.QuickInfoSupporter, WsdlUrlProvider, AlternativeUrlSupporter
Ancestor for webservice clients.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected String
m_AlternativeURL
the URL of the webservice.protected int
m_ConnectionTimeout
the connection timeout.protected AbstractInInterceptorGenerator
m_InInterceptor
the interceptor generator for incoming messages.protected String
m_LastError
the last error that was generated.protected adams.flow.core.Actor
m_Owner
the owner.protected int
m_ReceiveTimeout
the receive timeout.protected O
m_ResponseData
the response data.protected HashSet<WebServiceClientProducerResponseDataListener>
m_ResponseDataListeners
the listeners for reponse data.protected boolean
m_UseAlternativeURL
whether to use an alternative URL.
-
Constructor Summary
Constructors Constructor Description AbstractWebServiceClientSource()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addResponseDataListener(WebServiceClientProducerResponseDataListener l)
Adds the listener for response data being received.String
alternativeURLTipText()
Returns the tip text for this property.void
cleanUp()
Cleans up the client.String
connectionTimeoutTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected abstract void
doQuery()
Performs the actual webservice query.String
getAdditionalInformation()
Returns the additional information.String
getAlternativeURL()
Returns the alternative URL used for the service.int
getConnectionTimeout()
Returns the timeout for the connection.String
getDefaultAlternativeURL()
Returns the default URL for the service.protected AbstractInInterceptorGenerator
getDefaultInInterceptor()
Returns the default interceptor for incoming messages.AbstractInInterceptorGenerator
getInInterceptor()
Returns the interceptor for incoming messages.String
getLastError()
Returns the last error that occurred.adams.flow.core.Actor
getOwner()
Returns the owning actor.String
getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.int
getReceiveTimeout()
Returns the timeout for receiving.O
getResponseData()
Returns the response data, if any.boolean
getUseAlternativeURL()
Returns whether to use the alternative URL used for the service.abstract URL
getWsdlLocation()
Returns the WSDL location.boolean
hasLastError()
Checks whether there was an error with the last call.boolean
hasResponseData()
Checks whether there is any response data to be collected.String
inInterceptorTipText()
Returns the tip text for this property.protected void
initialize()
Initializes the members.protected void
notifyResponseDataListeners()
Notifies all listeners that response data has arrived.protected void
postQuery()
Hook method after querying the webservice.protected void
preQuery()
Hook method before querying the webservice.void
query()
Queries the webservice.String
receiveTimeoutTipText()
Returns the tip text for this property.void
removeResponseDataListener(WebServiceClientProducerResponseDataListener l)
Removes the listener for response data being received.void
setAlternativeURL(String value)
Sets the alternative URL to use.void
setConnectionTimeout(int value)
Sets the timeout for connection.void
setInInterceptor(AbstractInInterceptorGenerator value)
Sets the interceptor for incoming messages.void
setOwner(adams.flow.core.Actor value)
Sets the actor that executes this webservice.void
setReceiveTimeout(int value)
Sets the timeout for receiving.void
setResponseData(O value)
Sets the response data.void
setUseAlternativeURL(boolean value)
Sets whether to use the alternative URL.String
useAlternativeURLTipText()
Returns the tip text for this property.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
Methods inherited from interface adams.flow.webservice.WebServiceClientProducer
generates
-
-
-
-
Field Detail
-
m_Owner
protected adams.flow.core.Actor m_Owner
the owner.
-
m_ConnectionTimeout
protected int m_ConnectionTimeout
the connection timeout.
-
m_ReceiveTimeout
protected int m_ReceiveTimeout
the receive timeout.
-
m_UseAlternativeURL
protected boolean m_UseAlternativeURL
whether to use an alternative URL.
-
m_AlternativeURL
protected String m_AlternativeURL
the URL of the webservice.
-
m_InInterceptor
protected AbstractInInterceptorGenerator m_InInterceptor
the interceptor generator for incoming messages.
-
m_ResponseData
protected transient O m_ResponseData
the response data.
-
m_ResponseDataListeners
protected HashSet<WebServiceClientProducerResponseDataListener> m_ResponseDataListeners
the listeners for reponse data.
-
m_LastError
protected String m_LastError
the last error that was generated.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classadams.core.option.AbstractOptionHandler
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classadams.core.option.AbstractOptionHandler
-
setConnectionTimeout
public void setConnectionTimeout(int value)
Sets the timeout for connection.- Specified by:
setConnectionTimeout
in interfaceWebServiceClient
- Parameters:
value
- the timeout in msec, 0 is infinite
-
getConnectionTimeout
public int getConnectionTimeout()
Returns the timeout for the connection.- Specified by:
getConnectionTimeout
in interfaceWebServiceClient
- Returns:
- the timeout in msec, 0 is infinite
-
connectionTimeoutTipText
public String connectionTimeoutTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setReceiveTimeout
public void setReceiveTimeout(int value)
Sets the timeout for receiving.- Specified by:
setReceiveTimeout
in interfaceWebServiceClient
- Parameters:
value
- the timeout in msec, 0 is infinite
-
getReceiveTimeout
public int getReceiveTimeout()
Returns the timeout for receiving.- Specified by:
getReceiveTimeout
in interfaceWebServiceClient
- Returns:
- the timeout in msec, 0 is infinite
-
receiveTimeoutTipText
public String receiveTimeoutTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setUseAlternativeURL
public void setUseAlternativeURL(boolean value)
Sets whether to use the alternative URL.- Specified by:
setUseAlternativeURL
in interfaceAlternativeUrlSupporter
- Parameters:
value
- whether to use the alternative URL
-
getUseAlternativeURL
public boolean getUseAlternativeURL()
Returns whether to use the alternative URL used for the service.- Specified by:
getUseAlternativeURL
in interfaceAlternativeUrlSupporter
- Returns:
- true if to use alternative URL
-
useAlternativeURLTipText
public String useAlternativeURLTipText()
Returns the tip text for this property.- Specified by:
useAlternativeURLTipText
in interfaceAlternativeUrlSupporter
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getDefaultAlternativeURL
public String getDefaultAlternativeURL()
Returns the default URL for the service.- Specified by:
getDefaultAlternativeURL
in interfaceAlternativeUrlSupporter
- Returns:
- the URL
-
setAlternativeURL
public void setAlternativeURL(String value)
Sets the alternative URL to use.- Specified by:
setAlternativeURL
in interfaceAlternativeUrlSupporter
- Parameters:
value
- the URL to use
-
getAlternativeURL
public String getAlternativeURL()
Returns the alternative URL used for the service.- Specified by:
getAlternativeURL
in interfaceAlternativeUrlSupporter
- Returns:
- the URL
-
alternativeURLTipText
public String alternativeURLTipText()
Returns the tip text for this property.- Specified by:
alternativeURLTipText
in interfaceAlternativeUrlSupporter
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getDefaultInInterceptor
protected AbstractInInterceptorGenerator getDefaultInInterceptor()
Returns the default interceptor for incoming messages.- Returns:
- the interceptor
-
setInInterceptor
public void setInInterceptor(AbstractInInterceptorGenerator value)
Sets the interceptor for incoming messages.- Specified by:
setInInterceptor
in interfaceWebServiceClientProducer<O>
- Parameters:
value
- the interceptor
-
getInInterceptor
public AbstractInInterceptorGenerator getInInterceptor()
Returns the interceptor for incoming messages.- Specified by:
getInInterceptor
in interfaceWebServiceClientProducer<O>
- Returns:
- the interceptor
-
inInterceptorTipText
public String inInterceptorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getAdditionalInformation
public String getAdditionalInformation()
Returns the additional information.- Specified by:
getAdditionalInformation
in interfaceadams.core.AdditionalInformationHandler
- Returns:
- the additional information, null or 0-length string for no information
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceadams.core.QuickInfoSupporter
- Returns:
- null if no info available, otherwise short string
-
setOwner
public void setOwner(adams.flow.core.Actor value)
Sets the actor that executes this webservice.- Specified by:
setOwner
in interfaceWebServiceClient
- Parameters:
value
- the owner
-
getOwner
public adams.flow.core.Actor getOwner()
Returns the owning actor.- Specified by:
getOwner
in interfaceWebServiceClient
- Returns:
- the owner
-
hasLastError
public boolean hasLastError()
Checks whether there was an error with the last call.- Specified by:
hasLastError
in interfaceadams.core.ErrorProvider
- Returns:
- true if there was an error
- See Also:
getLastError()
-
getLastError
public String getLastError()
Returns the last error that occurred.- Specified by:
getLastError
in interfaceadams.core.ErrorProvider
- Returns:
- the last error, null if none occurred
-
addResponseDataListener
public void addResponseDataListener(WebServiceClientProducerResponseDataListener l)
Adds the listener for response data being received.- Specified by:
addResponseDataListener
in interfaceWebServiceClientProducer<O>
- Parameters:
l
- the listener to add
-
removeResponseDataListener
public void removeResponseDataListener(WebServiceClientProducerResponseDataListener l)
Removes the listener for response data being received.- Specified by:
removeResponseDataListener
in interfaceWebServiceClientProducer<O>
- Parameters:
l
- the listener to remove
-
notifyResponseDataListeners
protected void notifyResponseDataListeners()
Notifies all listeners that response data has arrived.
-
hasResponseData
public boolean hasResponseData()
Checks whether there is any response data to be collected.- Specified by:
hasResponseData
in interfaceWebServiceClientProducer<O>
- Returns:
- true if data can be collected
- See Also:
getResponseData()
-
setResponseData
public void setResponseData(O value)
Sets the response data.- Specified by:
setResponseData
in interfaceWebServiceClientProducer<O>
- Parameters:
value
- the response data
-
getResponseData
public O getResponseData()
Returns the response data, if any.- Specified by:
getResponseData
in interfaceWebServiceClientProducer<O>
- Returns:
- the response data
-
getWsdlLocation
public abstract URL getWsdlLocation()
Returns the WSDL location.- Specified by:
getWsdlLocation
in interfaceWsdlUrlProvider
- Returns:
- the location
-
preQuery
protected void preQuery() throws Exception
Hook method before querying the webservice.
Default implementation ensures that an owner is set.- Throws:
Exception
- if it fails for some reason
-
doQuery
protected abstract void doQuery() throws Exception
Performs the actual webservice query.- Throws:
Exception
- if accessing webservice fails for some reason
-
postQuery
protected void postQuery() throws Exception
Hook method after querying the webservice.
Default implementation does nothing.- Throws:
Exception
- if it fails for some reason
-
query
public void query() throws Exception
Queries the webservice.- Specified by:
query
in interfaceWebServiceClient
- Throws:
Exception
- if accessing webservice fails for some reason
-
cleanUp
public void cleanUp()
Cleans up the client.- Specified by:
cleanUp
in interfaceadams.core.CleanUpHandler
-
-