org.geotools.arcsde.session
Class SessionWrapper

java.lang.Object
  extended by org.geotools.arcsde.session.SessionWrapper
All Implemented Interfaces:
ISession

public class SessionWrapper
extends java.lang.Object
implements ISession

A pure session wrapper to aid in creating session decorators by extending this class.

Since:
2.5.x
Version:
$Id: SessionWrapper.java 34490 2009-11-25 04:19:32Z groldan $
Author:
Gabriel Roldan (TOPP)

Field Summary
protected  ISession wrapped
           
 
Constructor Summary
SessionWrapper(ISession wrapped)
           
 
Method Summary
 void close(SeState state)
           
 void close(SeStreamOp stream)
           
 void commitTransaction()
          Commits the current transaction.
 SeQuery createAndExecuteQuery(java.lang.String[] propertyNames, SeSqlConstruct sql)
           
 SeState createChildState(long parentStateId)
           
 SeDelete createSeDelete()
           
 SeInsert createSeInsert()
           
 SeRegistration createSeRegistration(java.lang.String typeName)
           
 SeTable createSeTable(java.lang.String qualifiedName)
          Creates an SeTable named qualifiedName; the layer does not need to exist on the server.
 SeUpdate createSeUpdate()
           
 SeState createState(SeObjectId stateId)
           
 SeColumnDefinition[] describe(SeTable table)
           
 SeColumnDefinition[] describe(java.lang.String tableName)
           
 void dispose()
          Return to the pool (may not close the internal connection, depends on pool settings).
 SdeRow fetch(SeQuery query)
          Issues a command that fetches a row from an already executed SeQuery and returns the SdeRow object with its contents.
 SdeRow fetch(SeQuery query, SdeRow currentRow)
           
 java.lang.String getDatabaseName()
           
 SeDBMSInfo getDBMSInfo()
           
 SeLayer getLayer(java.lang.String layerName)
           
 java.util.List<SeLayer> getLayers()
          Returns the live list of layers, not the cached ones, so it may pick up the differences in the database.
 SeRasterColumn getRasterColumn(java.lang.String rasterName)
           
 java.util.List<java.lang.String> getRasterColumns()
           
 SeRelease getRelease()
           
 SeTable getTable(java.lang.String tableName)
           
 java.lang.String getUser()
           
 boolean isClosed()
           
 boolean isDisposed()
          Returns whether this connection is on the connection pool domain or not.
<T> T
issue(Command<T> command)
          Executes the given command and returns its result.
 boolean isTransactionActive()
          Returns whether a transaction is in progress over this connection
 void rollbackTransaction()
          Rolls back the current transaction
 void startTransaction()
          Starts a transaction over the connection held by this Session
 void testServer()
          Performs a session sanity check to avoid stale connections to be returned from the pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.geotools.arcsde.session.ISession
equals, hashCode
 

Field Detail

wrapped

protected final ISession wrapped
Constructor Detail

SessionWrapper

public SessionWrapper(ISession wrapped)
Method Detail

testServer

public void testServer()
                throws java.io.IOException
Description copied from interface: ISession
Performs a session sanity check to avoid stale connections to be returned from the pool.

Specified by:
testServer in interface ISession
Throws:
java.io.IOException
See Also:
ISession.testServer()

close

public void close(SeState state)
           throws java.io.IOException
Specified by:
close in interface ISession
Throws:
java.io.IOException
See Also:
ISession.close(com.esri.sde.sdk.client.SeState)

close

public void close(SeStreamOp stream)
           throws java.io.IOException
Specified by:
close in interface ISession
Throws:
java.io.IOException
See Also:
ISession.close(com.esri.sde.sdk.client.SeStreamOp)

commitTransaction

public void commitTransaction()
                       throws java.io.IOException
Description copied from interface: ISession
Commits the current transaction.

This method shall only be called from inside a command

Specified by:
commitTransaction in interface ISession
Throws:
java.io.IOException
See Also:
ISession.commitTransaction()

createAndExecuteQuery

public SeQuery createAndExecuteQuery(java.lang.String[] propertyNames,
                                     SeSqlConstruct sql)
                              throws java.io.IOException
Specified by:
createAndExecuteQuery in interface ISession
Throws:
java.io.IOException
See Also:
ISession.createAndExecuteQuery(java.lang.String[], com.esri.sde.sdk.client.SeSqlConstruct)

createSeDelete

public SeDelete createSeDelete()
                        throws java.io.IOException
Specified by:
createSeDelete in interface ISession
Throws:
java.io.IOException
See Also:
ISession.createSeDelete()

createSeInsert

public SeInsert createSeInsert()
                        throws java.io.IOException
Specified by:
createSeInsert in interface ISession
Throws:
java.io.IOException
See Also:
ISession.createSeInsert()

createSeRegistration

public SeRegistration createSeRegistration(java.lang.String typeName)
                                    throws java.io.IOException
Specified by:
createSeRegistration in interface ISession
Throws:
java.io.IOException
See Also:
ISession.createSeRegistration(java.lang.String)

createSeTable

public SeTable createSeTable(java.lang.String qualifiedName)
                      throws java.io.IOException
Description copied from interface: ISession
Creates an SeTable named qualifiedName; the layer does not need to exist on the server.

Specified by:
createSeTable in interface ISession
Returns:
Throws:
java.io.IOException
See Also:
ISession.createSeTable(java.lang.String)

createSeUpdate

public SeUpdate createSeUpdate()
                        throws java.io.IOException
Specified by:
createSeUpdate in interface ISession
Throws:
java.io.IOException
See Also:
ISession.createSeUpdate()

createState

public SeState createState(SeObjectId stateId)
                    throws java.io.IOException
Specified by:
createState in interface ISession
Throws:
java.io.IOException
See Also:
ISession.createState(com.esri.sde.sdk.client.SeObjectId)

describe

public SeColumnDefinition[] describe(java.lang.String tableName)
                              throws java.io.IOException
Specified by:
describe in interface ISession
Throws:
java.io.IOException
See Also:
ISession.describe(java.lang.String)

describe

public SeColumnDefinition[] describe(SeTable table)
                              throws java.io.IOException
Specified by:
describe in interface ISession
Throws:
java.io.IOException
See Also:
ISession.describe(com.esri.sde.sdk.client.SeTable)

dispose

public void dispose()
             throws java.lang.IllegalStateException
Description copied from interface: ISession
Return to the pool (may not close the internal connection, depends on pool settings).

Specified by:
dispose in interface ISession
Throws:
java.lang.IllegalStateException - if dispose() is called while a transaction is in progress
See Also:
ISession.dispose()

fetch

public SdeRow fetch(SeQuery query)
             throws java.io.IOException
Description copied from interface: ISession
Issues a command that fetches a row from an already executed SeQuery and returns the SdeRow object with its contents.

The point in returning an SdeRow instead of a plain SeRow is that the former prefetches the row values and this can be freely used outside a Command. Otherwise the SeRow should only be used inside a command as accessing its values implies using the connection.

Specified by:
fetch in interface ISession
Returns:
Throws:
java.io.IOException
See Also:
ISession.fetch(com.esri.sde.sdk.client.SeQuery)

fetch

public SdeRow fetch(SeQuery query,
                    SdeRow currentRow)
             throws java.io.IOException
Specified by:
fetch in interface ISession
Throws:
java.io.IOException
See Also:
ISession.fetch(SeQuery, SdeRow)

getDatabaseName

public java.lang.String getDatabaseName()
                                 throws java.io.IOException
Specified by:
getDatabaseName in interface ISession
Throws:
java.io.IOException
See Also:
ISession.getDatabaseName()

getDBMSInfo

public SeDBMSInfo getDBMSInfo()
                       throws java.io.IOException
Specified by:
getDBMSInfo in interface ISession
Throws:
java.io.IOException
See Also:
ISession.getDBMSInfo()

getLayer

public SeLayer getLayer(java.lang.String layerName)
                 throws java.io.IOException
Specified by:
getLayer in interface ISession
Throws:
java.io.IOException
See Also:
ISession.getLayer(java.lang.String)

getLayers

public java.util.List<SeLayer> getLayers()
                                  throws java.io.IOException
Description copied from interface: ISession
Returns the live list of layers, not the cached ones, so it may pick up the differences in the database.

Specified by:
getLayers in interface ISession
Returns:
Throws:
java.io.IOException
See Also:
ISession.getLayers()

getRasterColumn

public SeRasterColumn getRasterColumn(java.lang.String rasterName)
                               throws java.io.IOException
Specified by:
getRasterColumn in interface ISession
Throws:
java.io.IOException
See Also:
ISession.getRasterColumn(java.lang.String)

getRasterColumns

public java.util.List<java.lang.String> getRasterColumns()
                                                  throws java.io.IOException
Specified by:
getRasterColumns in interface ISession
Throws:
java.io.IOException
See Also:
ISession.getRasterColumns()

getRelease

public SeRelease getRelease()
                     throws java.io.IOException
Specified by:
getRelease in interface ISession
Throws:
java.io.IOException
See Also:
ISession.getRelease()

getTable

public SeTable getTable(java.lang.String tableName)
                 throws java.io.IOException
Specified by:
getTable in interface ISession
Throws:
java.io.IOException
See Also:
ISession.getTable(java.lang.String)

getUser

public java.lang.String getUser()
                         throws java.io.IOException
Specified by:
getUser in interface ISession
Throws:
java.io.IOException
See Also:
ISession.getUser()

isClosed

public boolean isClosed()
Specified by:
isClosed in interface ISession
See Also:
ISession.isClosed()

isDisposed

public boolean isDisposed()
Description copied from interface: ISession
Returns whether this connection is on the connection pool domain or not.

Specified by:
isDisposed in interface ISession
Returns:
true if this connection has beed returned to the pool and thus cannot be used, false if its safe to keep using it.
See Also:
ISession.isDisposed()

isTransactionActive

public boolean isTransactionActive()
Description copied from interface: ISession
Returns whether a transaction is in progress over this connection

As for any other public method, this one can't be called if ISession.isDisposed() is true.

Specified by:
isTransactionActive in interface ISession
Returns:
See Also:
ISession.isTransactionActive()

issue

public <T> T issue(Command<T> command)
        throws java.io.IOException
Description copied from interface: ISession
Executes the given command and returns its result.

Specified by:
issue in interface ISession
Parameters:
command - the command to execute
Throws:
java.io.IOException - if an exception occurs handling any ArcSDE resource while executing the command
See Also:
ISession.issue(org.geotools.arcsde.session.Command)

rollbackTransaction

public void rollbackTransaction()
                         throws java.io.IOException
Description copied from interface: ISession
Rolls back the current transaction

When this method returns it is guaranteed that ISession.isTransactionActive() will return false, regardless of the success of the rollback operation.

Specified by:
rollbackTransaction in interface ISession
Throws:
java.io.IOException
See Also:
ISession.rollbackTransaction()

startTransaction

public void startTransaction()
                      throws java.io.IOException
Description copied from interface: ISession
Starts a transaction over the connection held by this Session

If this method succeeds, ISession.isTransactionActive() will return true afterwards

Specified by:
startTransaction in interface ISession
Throws:
java.io.IOException
See Also:
ISession.startTransaction()

createChildState

public SeState createChildState(long parentStateId)
                         throws java.io.IOException
Specified by:
createChildState in interface ISession
Throws:
java.io.IOException


Copyright © 1996-2010 Geotools. All Rights Reserved.