com.softwareag.tamino.db.api.invocation.http
Class THTTPInvocation

java.lang.Object
  extended by com.softwareag.tamino.db.api.invocation.TAbstractInvocation
      extended by com.softwareag.tamino.db.api.invocation.http.THTTPInvocation
All Implemented Interfaces:
TInvocation, TRetryInvocation
Direct Known Subclasses:
THTTPSInvocation

public class THTTPInvocation
extends TAbstractInvocation

THTTPInvocation is the default implementation for TInvocation that makes use of the HTTP protocol. The HTTP communication is realized by the use of the java.net package. This means when the API is used within an Applet with this class as the HTTP communication layer, it is stronly advised to use the Applet by the Javasoft Pluging to ensure that Suns JDK is used.

Version:
$Revision: 1.74 $
Author:
Marcus Schreyer

Field Summary
 
Fields inherited from class com.softwareag.tamino.db.api.invocation.TAbstractInvocation
PROP_RETRY
 
Constructor Summary
THTTPInvocation(TUri databaseUri)
          Initializes the instance with Tamino's database uri.
THTTPInvocation(TUri databaseUri, SecurityToken token)
           
THTTPInvocation(TUri databaseUri, java.lang.String userId, java.lang.String password)
          Initializes the instance with Tamino's database uri, and a users authorization parameters.
THTTPInvocation(TUri databaseUri, java.lang.String domain, java.lang.String userId, java.lang.String password)
          Initializes the instance with Tamino's database uri, and a users authorization parameters.
 
Method Summary
protected  void doClose()
          Implements the plug in method doClose of TAbstractInvocation.
 TInputStream doInvoke(TCommandStatement commandStatement, java.lang.String collection, java.lang.String doctype, java.lang.String docname, boolean useTransactionMode)
          Invokes a Tamino specific command given by a TCommandStatement on an underlying Tamino database.
protected  java.net.HttpURLConnection getHttpURLConnection(java.lang.String urlString)
          Gets a HttpURLConnection for the specified url.
 int getSocketTimeout()
           
protected  void setAuthentication(java.net.HttpURLConnection connection)
          Setting authentication to the http(s) connection.
 void setLocale(java.util.Locale locale)
          Sets the locale.
 void setSocketTimeout(int timeout)
          This value indicates to use Tamino default values for the timeout parameters.
 
Methods inherited from class com.softwareag.tamino.db.api.invocation.TAbstractInvocation
addRetryHandler, checkServerAvailabilityAndVersion, close, getDatabaseUri, getDomain, getLastExecutedCommandStatement, getLastNonActivityTimeoutRelevantInvokeTimeMillis, getLocale, getPassword, getPooledConnectionReconnectHandler, getSecurityToken, getTransactionModeCoordinator, getUserId, invoke, invoke, invoke, isClosed, setPooledConnectionReconnectHandler, setTransactionModeCoordinator, supports, updateStreamHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

THTTPInvocation

public THTTPInvocation(TUri databaseUri,
                       SecurityToken token)

THTTPInvocation

public THTTPInvocation(TUri databaseUri,
                       java.lang.String domain,
                       java.lang.String userId,
                       java.lang.String password)
                throws TInvocationException
Initializes the instance with Tamino's database uri, and a users authorization parameters.

Parameters:
databaseUri - is the Tamino database.
domain - denotes the domain user for WWW authorization.
userId - denotes the user for WWW authorization.
password - denotes the password that is related to the given userId.
Throws:
TInvocationException - is thrown if the Tamino database cannot be reached.

THTTPInvocation

public THTTPInvocation(TUri databaseUri,
                       java.lang.String userId,
                       java.lang.String password)
                throws TInvocationException
Initializes the instance with Tamino's database uri, and a users authorization parameters.

Parameters:
databaseUri - is the Tamino database.
userId - denotes the user for WWW authorization.
password - denotes the password that is related to the given userId.
Throws:
TInvocationException - is thrown if the Tamino database cannot be reached.

THTTPInvocation

public THTTPInvocation(TUri databaseUri)
                throws TInvocationException
Initializes the instance with Tamino's database uri. Please note that an invocation cannot be used for invocations that require a www authorization.

Parameters:
databaseUri - is the Tamino database.
Throws:
TInvocationException - is thrown if the Tamino database cannot be reached.
Method Detail

doInvoke

public TInputStream doInvoke(TCommandStatement commandStatement,
                             java.lang.String collection,
                             java.lang.String doctype,
                             java.lang.String docname,
                             boolean useTransactionMode)
                      throws TInvocationException
Invokes a Tamino specific command given by a TCommandStatement on an underlying Tamino database. This abstract method serves as a plug in method (GOF) for the template various methods invoke, invokeForXML and invokeForNonXML. It has to be implemented by any concrete TInvocation class.

Specified by:
doInvoke in interface TRetryInvocation
Specified by:
doInvoke in class TAbstractInvocation
Parameters:
commandStatement - spcifies the concrete Tamino specific action that should be fullfilled.
collection - is the collection of the Tamino DB to which the command statement might be related to.
doctype - within a schema of the given collection to which the command statement might be related to.
objectName - is the name of the object to which the command statement might be related to.
useTransactionMode - specifies whether the transaction mode shall be considered.
Returns:
TInputStream representing Tamino's response as a core input stream.
Throws:
TInvocationException - due to any problems that can occur when performing the invocation on Tamino.

doClose

protected void doClose()
Implements the plug in method doClose of TAbstractInvocation. Is invoked by template method close. Has to be implemented by concrete TInvocation class.

Specified by:
doClose in class TAbstractInvocation

getHttpURLConnection

protected java.net.HttpURLConnection getHttpURLConnection(java.lang.String urlString)
                                                   throws TCommunicationException
Gets a HttpURLConnection for the specified url.

Throws:
TCommunicationException

setAuthentication

protected void setAuthentication(java.net.HttpURLConnection connection)
                          throws TInvocationException
Setting authentication to the http(s) connection. Subclass may overwrite ...

Parameters:
connection - the http(s) connection
Throws:
TInvocationException

setLocale

public void setLocale(java.util.Locale locale)
Description copied from class: TAbstractInvocation
Sets the locale.

Specified by:
setLocale in interface TInvocation
Overrides:
setLocale in class TAbstractInvocation

getSocketTimeout

public int getSocketTimeout()

setSocketTimeout

public void setSocketTimeout(int timeout)
Description copied from interface: TInvocation
This value indicates to use Tamino default values for the timeout parameters.



Copyright (c) 2013 Software AG. All Rights Reserved.