org.geotools.arcsde.session
Interface ISession

All Known Implementing Classes:
SessionWrapper

public interface ISession

Provides thread safe access to an SeConnection.

An ISession is a decorator around an SeConnection, ensuring the SeConnection is not hit by two concurrent threads while at the same time participating in a connection pool where more than one thread can reclaim usage of the SeConnection.

Each piece of code that needs access to an SeConnection, either directly or indirectly (for example, by accessing an SeStreamOp like in SeQuery.fetch() or new SeLayer(connection), needs to do so inside the body of a Command, and issue the command through issue(Command).

Since:
2.5.x
Author:
Gabriel Roldan, Jody Garnett

Method Summary
 void close(SeState state)
           
 void close(SeStreamOp stream)
           
 void commitTransaction()
          Commits the current transaction.
 SeQuery createAndExecuteQuery(String[] propertyNames, SeSqlConstruct sql)
           
 SeState createChildState(long parentStateId)
           
 SeDelete createSeDelete()
           
 SeInsert createSeInsert()
           
 SeRegistration createSeRegistration(String typeName)
           
 SeTable createSeTable(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(String tableName)
           
 void dispose()
          Return to the pool (may not close the internal connection, depends on pool settings).
 boolean equals(Object other)
          Compares for reference equality
 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 seQuery, SdeRow currentRow)
           
 String getDatabaseName()
           
 SeDBMSInfo getDBMSInfo()
           
 SeLayer getLayer(String layerName)
           
 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(String rasterName)
           
 List<String> getRasterColumns()
           
 SeRelease getRelease()
           
 SeTable getTable(String tableName)
           
 String getUser()
           
 int hashCode()
           
 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 As for any other public method, this one can't be called if isDisposed() is true.
 SeQuery prepareQuery(SeQueryInfo qInfo, SeFilter[] spatialConstraints, ArcSdeVersionHandler version)
           
 void rollbackTransaction()
          Rolls back the current transaction When this method returns it is guaranteed that isTransactionActive() will return false, regardless of the success of the rollback operation.
 void startTransaction()
          Starts a transaction over the connection held by this Session If this method succeeds, isTransactionActive() will return true afterwards
 void testServer()
          Performs a session sanity check to avoid stale connections to be returned from the pool.
 

Method Detail

issue

<T> T issue(Command<T> command)
        throws IOException
Executes the given command and returns its result.

Parameters:
command - the command to execute
Throws:
IOException - if an exception occurs handling any ArcSDE resource while executing the command

testServer

void testServer()
                throws IOException
Performs a session sanity check to avoid stale connections to be returned from the pool.

Throws:
IOException
See Also:
SeConnection#testServer(long)}

isClosed

boolean isClosed()

isDisposed

boolean isDisposed()
Returns whether this connection is on the connection pool domain or not.

Returns:
true if this connection has beed returned to the pool and thus cannot be used, false if its safe to keep using it.

getLayer

SeLayer getLayer(String layerName)
                 throws IOException
Throws:
IOException

getRasterColumn

SeRasterColumn getRasterColumn(String rasterName)
                               throws IOException
Throws:
IOException

getRasterColumns

List<String> getRasterColumns()
                              throws IOException
Throws:
IOException

getTable

SeTable getTable(String tableName)
                 throws IOException
Throws:
IOException

startTransaction

void startTransaction()
                      throws IOException
Starts a transaction over the connection held by this Session

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

Throws:
IOException
See Also:
#issueStartTransaction(Session)}

commitTransaction

void commitTransaction()
                       throws IOException
Commits the current transaction.

This method shall only be called from inside a command

Throws:
IOException

isTransactionActive

boolean isTransactionActive()
Returns whether a transaction is in progress over this connection

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

Returns:

rollbackTransaction

void rollbackTransaction()
                         throws IOException
Rolls back the current transaction

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

Throws:
IOException

dispose

void dispose()
             throws IllegalStateException
Return to the pool (may not close the internal connection, depends on pool settings).

Throws:
IllegalStateException - if dispose() is called while a transaction is in progress

equals

boolean equals(Object other)
Compares for reference equality

Overrides:
equals in class Object

hashCode

int hashCode()
Overrides:
hashCode in class Object

getLayers

List<SeLayer> getLayers()
                        throws IOException
Returns the live list of layers, not the cached ones, so it may pick up the differences in the database.

Returns:
Throws:
IOException

getUser

String getUser()
               throws IOException
Throws:
IOException

getRelease

SeRelease getRelease()
                     throws IOException
Throws:
IOException

getDatabaseName

String getDatabaseName()
                       throws IOException
Throws:
IOException

getDBMSInfo

SeDBMSInfo getDBMSInfo()
                       throws IOException
Throws:
IOException

createSeRegistration

SeRegistration createSeRegistration(String typeName)
                                    throws IOException
Throws:
IOException

createSeTable

SeTable createSeTable(String qualifiedName)
                      throws IOException
Creates an SeTable named qualifiedName; the layer does not need to exist on the server.

Parameters:
qualifiedName -
Returns:
Throws:
IOException

createSeInsert

SeInsert createSeInsert()
                        throws IOException
Throws:
IOException

createSeUpdate

SeUpdate createSeUpdate()
                        throws IOException
Throws:
IOException

createSeDelete

SeDelete createSeDelete()
                        throws IOException
Throws:
IOException

describe

SeColumnDefinition[] describe(String tableName)
                              throws IOException
Throws:
IOException

describe

SeColumnDefinition[] describe(SeTable table)
                              throws IOException
Throws:
IOException

fetch

SdeRow fetch(SeQuery query)
             throws IOException
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.

Parameters:
query -
Returns:
Throws:
IOException

fetch

SdeRow fetch(SeQuery seQuery,
             SdeRow currentRow)
             throws IOException
Throws:
IOException

close

void close(SeState state)
           throws IOException
Throws:
IOException

close

void close(SeStreamOp stream)
           throws IOException
Throws:
IOException

createState

SeState createState(SeObjectId stateId)
                    throws IOException
Throws:
IOException

createAndExecuteQuery

SeQuery createAndExecuteQuery(String[] propertyNames,
                              SeSqlConstruct sql)
                              throws IOException
Throws:
IOException

createChildState

SeState createChildState(long parentStateId)
                         throws IOException
Throws:
IOException

prepareQuery

SeQuery prepareQuery(SeQueryInfo qInfo,
                     SeFilter[] spatialConstraints,
                     ArcSdeVersionHandler version)
                     throws IOException
Throws:
IOException


Copyright © 1996-2014 Geotools. All Rights Reserved.