com.softwareag.tamino.db.api.accessor
Class TAbstractAccessor

java.lang.Object
  extended by com.softwareag.tamino.db.api.accessor.TAbstractAccessor
All Implemented Interfaces:
TAccessor, TInvalidatableAccessor
Direct Known Subclasses:
TAbstractSchemaDefinitionAccessor, TAdministrationAccessorImpl, TGenericAccessorImpl, TNonXMLObjectAccessorImpl, TStreamAccessorImpl, TSystemAccessorImpl, TXMLObjectAccessorImpl

public abstract class TAbstractAccessor
extends java.lang.Object
implements TAccessor

This class provides a skeletal implementation of the TAccessor interface to minimize the effort required to implement a concrete accessor class. The abstract accessor allows multiple accessors to share their properties, so that different accessors, e.g. helper accessors and client accessor, can share theire properties, e.g. transaction parameters, invocation, ..

Version:
$Revision: 1.32 $
Author:
Marcus Schreyer

Field Summary
protected  boolean canBeCancelled
          Boolean flag that indicates whether request sent to tamino can be canceled or not.
protected  java.util.List<java.lang.String> clientRequests
          Application-Generated Unique Request Identifier
protected  int requestCounter
          Request Counter.
protected  java.lang.String SGUAI
          Server-Generated Unique Application Identifier
 
Constructor Summary
protected TAbstractAccessor()
          Default Constructor.
protected TAbstractAccessor(TAbstractAccessor abstractAccessor)
          Initializes the accessor with the shared properties of a given TAbstractAccessor (shallow copy constructor).
protected TAbstractAccessor(TAccessLocation accessLocation, TInvocation invocation, java.util.Locale locale)
          Initializes the accessor with the given TAccessLocation and TInvocation instances.
 
Method Summary
 void cancelRequests()
          Cancels all requests issued using current accessor.
protected  java.lang.String getAccessCollection()
          Gets the collection access location information.
 TAccessLocation getAccessLocation()
          Returns a deep copy of the accessors properties.
 java.lang.String getApplicationName()
          Returns Client Application Name.
 boolean getCanBeCancelled()
          Returns true if request can be cancelled.
protected  TUri getDatabaseUri()
          Returns the database uri instance of the invocation.
protected  TInvocation getInvocation()
          Returns the TInvocation instance.
 java.util.Locale getLocale()
          Gets the locale.
 TLockMode getLockMode()
          Gets the lock mode.
 TLockwaitMode getLockwaitMode()
          Gets the current lockwait mode A 'null' value represents the Tamino default.
 long getMaximumRequestDuration()
          Gets the maximum request duration in seconds.

Note:
This method retrieves the servers default value, when this duration has not been set to a specific value (unequal to TConnection.DEFAULT_TIMEOUT)!
 void invalidate()
          Invalidates the accessor.
 TInputStream invoke(TCommandStatement commandStatement)
          Invokes a specific command given by a TCommandStatement on an underlying Tamino database.
 TInputStream invoke(TCommandStatement commandStatement, java.lang.String collection)
          Invokes a specific command given by a TCommandStatement on an underlying Tamino database.
 TInputStream invoke(TCommandStatement commandStatement, java.lang.String collection, java.lang.String doctype, java.lang.String docname)
          Invokes a specific command given by a TCommandStatement on an underlying Tamino database.
 void setAccessLocation(TAccessLocation accessLocation)
          Sets the accessor's properties.
 void setApplicationName(java.lang.String name)
          Sets Client Application Name.
 void setCanBeCancelled(boolean canBeCancelled)
          Sets whether request can be canBeCancelled.
 void setInvocation(TInvocation invocation)
          Set the TInvocation instance.
 void setLockMode(TLockMode lockMode)
          Sets the lock mode.
 void setLockwaitMode(TLockwaitMode lockwaitMode)
          Sets the lockwait mode for a transaction.
 void setMaximumRequestDuration(long maximumRequestDuration)
          Sets the maximum request duration in seconds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

requestCounter

protected int requestCounter
Request Counter.


canBeCancelled

protected boolean canBeCancelled
Boolean flag that indicates whether request sent to tamino can be canceled or not. The default is false.


SGUAI

protected java.lang.String SGUAI
Server-Generated Unique Application Identifier


clientRequests

protected java.util.List<java.lang.String> clientRequests
Application-Generated Unique Request Identifier

Constructor Detail

TAbstractAccessor

protected TAbstractAccessor()
Default Constructor.


TAbstractAccessor

protected TAbstractAccessor(TAbstractAccessor abstractAccessor)
Initializes the accessor with the shared properties of a given TAbstractAccessor (shallow copy constructor). Note: This accessor will share the properties with the given accessor.

Parameters:
abstractAccessor - The accessor to share the properties with.

TAbstractAccessor

protected TAbstractAccessor(TAccessLocation accessLocation,
                            TInvocation invocation,
                            java.util.Locale locale)
Initializes the accessor with the given TAccessLocation and TInvocation instances.

Parameters:
accessLocation - The access location, i.e. the collection name
invocation - The invocation to invoke command statements on.
Method Detail

invalidate

public void invalidate()
Invalidates the accessor. Once this operation is invoked, the accessor cannot be used any longer. Any invocation of an access operation for an invalidated accessor leads to a ViolatedPrecondition.

Specified by:
invalidate in interface TInvalidatableAccessor

setAccessLocation

public void setAccessLocation(TAccessLocation accessLocation)
Sets the accessor's properties.

Specified by:
setAccessLocation in interface TAccessor
Parameters:
accessLocation - the TAccessLocation instance to be used by the accessor.

getAccessLocation

public TAccessLocation getAccessLocation()
Returns a deep copy of the accessors properties.

Specified by:
getAccessLocation in interface TAccessor
Returns:
a copy of the TAccessLocation instance.

getInvocation

protected TInvocation getInvocation()
Returns the TInvocation instance.

Returns:
TInvocation.

setInvocation

public void setInvocation(TInvocation invocation)
Set the TInvocation instance.

Parameters:
TInvocation - instance.

getDatabaseUri

protected TUri getDatabaseUri()
Returns the database uri instance of the invocation.

Returns:
the database uri as a TUri.

getAccessCollection

protected java.lang.String getAccessCollection()
Gets the collection access location information.


setLockwaitMode

public void setLockwaitMode(TLockwaitMode lockwaitMode)
Sets the lockwait mode for a transaction.

Specified by:
setLockwaitMode in interface TAccessor
Parameters:
lockwaitMode - the lockwait mode to be set, 'null' for Tamino default.

getLockwaitMode

public TLockwaitMode getLockwaitMode()
Gets the current lockwait mode A 'null' value represents the Tamino default.

Specified by:
getLockwaitMode in interface TAccessor
Returns:
the lockwait mode. Returns 'null' if no lockwait mode is specified.

setLockMode

public void setLockMode(TLockMode lockMode)
Sets the lock mode.

Specified by:
setLockMode in interface TAccessor
Parameters:
lockMode - the lock mode to be set, 'null' for Tamino default.

getLockMode

public TLockMode getLockMode()
Gets the lock mode. A 'null' value represents the Tamino default.

Specified by:
getLockMode in interface TAccessor
Returns:
the lock mode. Returns 'null' if no lock mode is specified.

setMaximumRequestDuration

public void setMaximumRequestDuration(long maximumRequestDuration)
Sets the maximum request duration in seconds.
Note that for pooled connections obtained from a connection pool which configured to pool Tamino physical connections, the invocation of this method has no effect. The default value is set once and for all for all connections in a pool when the pool is created.

Specified by:
setMaximumRequestDuration in interface TAccessor
Parameters:
maximumRequestDuration - the maximum request duration in seconds in seconds be set, TConnection.DEFAULT_TIMEOUT for Tamino default.

getMaximumRequestDuration

public long getMaximumRequestDuration()
Gets the maximum request duration in seconds.

Note:
This method retrieves the servers default value, when this duration has not been set to a specific value (unequal to TConnection.DEFAULT_TIMEOUT)!

Specified by:
getMaximumRequestDuration in interface TAccessor
Returns:
the maximum transaction duration in seconds.

invoke

public TInputStream invoke(TCommandStatement commandStatement)
                    throws TInvocationException
Invokes a specific command given by a TCommandStatement on an underlying Tamino database. Before delegating it to the invocation component the accessor adds it specific transactional parameters to the command statement.

Parameters:
commandStatement - spcifies the concrete XML specific action that should be fullfilled.
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.

invoke

public TInputStream invoke(TCommandStatement commandStatement,
                           java.lang.String collection)
                    throws TInvocationException
Invokes a specific command given by a TCommandStatement on an underlying Tamino database. Before delegating it to the invocation component the accessor adds it specific transactional parameters to the command statement.

Parameters:
commandStatement - spcifies the concrete action that should be fullfilled.
collection - is the collection of the Tamino DB where the object is contained in.
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.

invoke

public TInputStream invoke(TCommandStatement commandStatement,
                           java.lang.String collection,
                           java.lang.String doctype,
                           java.lang.String docname)
                    throws TInvocationException
Invokes a specific command given by a TCommandStatement on an underlying Tamino database. Before delegating it to the invocation component the accessor adds it specific transactional parameters to the command statement.

Parameters:
commandStatement - spcifies the concrete action that should be fullfilled.
collection - is the collection of the Tamino DB where the object is contained in.
doctype - within a schema of a collection to which the statement is related.
docname - denotes the docname under which a specific document might be accessible.
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.

setApplicationName

public void setApplicationName(java.lang.String name)
Sets Client Application Name.

Specified by:
setApplicationName in interface TAccessor

getApplicationName

public java.lang.String getApplicationName()
Returns Client Application Name. Default value is - "TAJ" {Tamino API for Java}

Specified by:
getApplicationName in interface TAccessor

cancelRequests

public void cancelRequests()
                    throws TAdminException
Cancels all requests issued using current accessor.

Specified by:
cancelRequests in interface TAccessor
Throws:
TAdminException

setCanBeCancelled

public void setCanBeCancelled(boolean canBeCancelled)
                       throws TAdminException
Sets whether request can be canBeCancelled.

Specified by:
setCanBeCancelled in interface TAccessor
Throws:
TAdminException

getCanBeCancelled

public boolean getCanBeCancelled()
Returns true if request can be cancelled.

Specified by:
getCanBeCancelled in interface TAccessor

getLocale

public java.util.Locale getLocale()
Gets the locale.

Returns:
the locale.


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