|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.esri.sde.sdk.client.SeConnection
public class SeConnection
This class is used to establish and manage a connection to an ArcSDE server. To establish a connection, which is the first step in most ArcSDE client applications, one of the constructors is invoked. The underlying databases's security model is employed to authenticate the connection. Therefore, a valid database user and password information is required to connect to an ArcSDE server.
The SeConnection
class provides methods to obtain information
about the current connection. It also provides methods to retrieve lists
of ArcSDE objects such as Tables, Layers, States, Versions, Logfiles, Locators
and Metadata.
The SeConnection
class also has an inner class,
that is used
to set and retrieve the specifications for any stream that will
be created by this connection.
SeConnection.SeStreamSpec
By default, the SeConnection
class does not enforce
a concurrency policy for simultaneous access by multiple threads.
This ensures the best performance when invoking methods on an
SeConnection
object.
To enforce a concurrency mechanism, which is required when building
multi-threaded applications, one of the concurrency schemes must be adopted.
This is done by invoking the
method with
the desired concurrency policy.
setConcurrency(int)
Nested Class Summary | |
---|---|
static class |
SeConnection.SeStreamSpec
This inner class is used to set and retrieve the specifications of streams associated with a connection object. |
Field Summary | |
---|---|
static int |
SE_LOCK_POLICY
SeConnection concurrency policy. |
static int |
SE_ONE_THREAD_POLICY
SeConnection concurrency policy. |
static int |
SE_TRYLOCK_POLICY
SeConnection concurrency policy. |
static int |
SE_UNPROTECTED_POLICY
SeConnection concurrency policy. |
Constructor Summary | |
---|---|
SeConnection(java.lang.String server,
int instance,
java.lang.String database,
java.lang.String username,
java.lang.String password)
Creates an application server connection to an ArcSDE server. |
|
SeConnection(java.lang.String server,
int instance,
java.lang.String database,
java.lang.String username,
java.lang.String password,
java.util.Locale connLocale)
Creates a connection to an ArcSDE server, using the Locale
specified. |
|
SeConnection(java.lang.String server,
java.lang.String instance,
java.lang.String database)
Creates a Windows Authenticated direct connection to a Sqlserver Database. |
|
SeConnection(java.lang.String server,
java.lang.String instance,
java.lang.String database,
java.lang.String username,
java.lang.String password)
This constructor can be used to create either an application server or direct connection to an ArcSDE instance. |
Method Summary | |
---|---|
void |
addInstanceMetaData(int recordCount,
SeMetaData[] arrMetadata)
Adds new metadata records for current SE instance. |
void |
alterInstanceMetaData(int recordCount,
SeMetaData[] arrMetadata)
Alters properties of the specified metadata record. |
void |
close()
Closes the connection to the ArcSDE instance. |
void |
commitTransaction()
This method commits all modifications made since the last call to startTransaction() . |
void |
databaseUse(java.lang.String database)
Changes the database or data source being used by a connection. |
void |
deleteInstanceMetaData(int recordCount,
SeObjectId[] recordIds)
Deletes instance's metadata records. |
void |
disableTlmCheck()
This method disables the Time Last Modified check done by the server for state lineages, layers, registered tables, xml columns and raster columns. |
void |
enableTlmCheck()
This method enables the Time Last Modified check done by the ArcSDE server for state lineages, layers, registered tables, xml columns and raster columns. |
void |
exportDbtune(java.lang.String dbtuneFile)
Exports the contents of the DBTUNE table to a file. |
void |
freeAllLocks()
Frees all the Layer, Table, State and Object locks associated with the current connection. |
java.lang.String |
getAdminDatabaseName()
Returns the name of the administration database for this connection. |
java.lang.String[] |
getDatabaseList()
Returns a list of databases or data sources for a DBMS instance. |
java.lang.String |
getDatabaseName()
Returns the name of the database connected to. |
SeDBMSInfo |
getDBMSInfo()
Returns information about the underlying RDBMS used by the ArcSDE server. |
java.lang.String |
getDefaultDatabase()
Gets the name of the default database for this connection. |
int |
getInstance()
Returns the port number of the ArcSDE instance connected to. |
java.util.Vector |
getInstanceList()
Returns an array of instances objects containing information for all instances. |
SeMetaData[] |
getIntanceMetaDataInfoList(java.lang.String whereClause)
Deletes instance's metadata records. |
java.lang.String[] |
getKeywordInfo()
Returns a list of keywords reserved for use by the underlying RDBMS. |
java.util.Vector |
getLayers()
Retrieves a list of all ArcSde layers that are accessible to the current user. |
java.util.Vector |
getList(java.lang.Class cType)
Returns a Vector of objects from an ArcSDE instance
given the class type. |
SeLocale |
getLocale()
Returns the locale used by the current connection. |
SeLog[] |
getLogfileList(java.lang.String owner)
Returns a list of all logfiles owned by the specified owner. |
SeLog[] |
getLogfileList(java.lang.String owner,
java.lang.String table)
Returns a list of all logfiles associated with the specified layer or table. |
SeMetaData[] |
getMetaDataList(java.lang.String whereClause)
Returns the meta-data associated with a table. |
java.util.Vector |
getRasterColumns()
Retrieves a list of all ArcSde raster columns that are accessible to the current user. |
java.util.Vector |
getRegisteredTables()
Returns an array of SeRegistration objects containing information for all registered tables. |
SeRelease |
getRelease()
Returns the version description of the ArcSDE instance to which the connection has been established. |
java.lang.String |
getSdeDbaName()
Returns the name of the ArcSDE DBA user. |
java.lang.String |
getServer()
Returns the name of the ArcSDE server connected to. |
java.util.Date |
getServerTime()
Returns the current time on the computer running the ArcSDE server. |
java.util.Vector |
getSpatialRefList()
Returns an array of SeSpatialReference objects. |
java.lang.String |
getSQLInfo(int sqlId)
Returns the RDBMS dependent function name according to the specified sqlId. |
SeState[] |
getStateList(java.lang.String whereClause)
Returns a list of SeState objects accessible to the current connection. |
SeConnection.SeStreamSpec |
getStreamSpec()
Returns the properties of any stream that will be created with this connection. |
java.util.Vector |
getTables(int permissions)
Retrieves a list of all tables, views, and synonyms which are available to the current user, with the given permissions. |
long |
getTimeSinceLastRT()
This method returns the time, in seconds, since the last round trip to the ArcSDE server. |
int |
getTransactionAutoCommit()
Gets the user transaction autocommit interval for the current connection. |
java.lang.String |
getUser()
Returns the name of the ArcSDE user associated with the current connection. |
SeVersion[] |
getVersionList(java.lang.String whereClause)
Returns a list of SeVersion objects accessible by the current user. |
void |
importDbtune(java.lang.String dbtuneFile)
Imports the data to ArcSde DBTUNE table. |
boolean |
isAdmin()
Check whether the connected user has admin privilege. |
boolean |
isClosed()
Returns TRUE if the connection has been closed, FALSE otherwise. |
void |
restorePrimarySession()
Restore primary session on the connection. |
void |
rollbackTransaction()
This method aborts all modifications since the last call to startTransaction() , or any intermediate commits on a transaction
resulting from a call to commitTransaction() , or an automatic
commit (See the AUTOCOMMIT parameter in the giomgr.defs file). |
void |
setConcurrency(int policy)
Sets the concurrency policy for the SeConnection object. |
void |
setStreamSpec(SeConnection.SeStreamSpec specs)
Sets the properties of streams created by the current connection. |
int |
setTransactionAutoCommit(int interval)
Sets the user transaction autocommit interval. |
void |
startTransaction()
This method begins a transaction on the current connection. |
void |
switchToProxySession(java.lang.String username,
java.lang.String password,
java.lang.String[] role_array,
int num_roles,
java.lang.String distinguished_name)
Switch to the proxy session. |
void |
testServer(long roundTripInterval)
This method tests if this connection object is active by checking if a disconnect occured during the execution of any of the previous ArcSDE client functions. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int SE_UNPROTECTED_POLICY
public static final int SE_ONE_THREAD_POLICY
setConcurrency(int)
method with this policy, locks the connection object. No
other thread(s) can use this connection object until the lock is
released. Any attempt by other threads to use a locked connection
will throw a SeError.SE_CONNECTION_LOCKED
error. The thread that owns the lock releases it by
calling the setConcurrency(int)
method with
a policy other than the SE_ONE_THREAD_POLICY
.
public static final int SE_TRYLOCK_POLICY
SeError.SE_CONNECTION_IN_USE
error
will be thrown.
public static final int SE_LOCK_POLICY
SE_TRYLOCK_POLICY
, except that,
if another thread already has a lock on
the connection object, the current thread will wait
until the connection object is released. If multiple threads
are waiting on a connection, only one thread, chosen at random
from the wait list, will resume execution.
Constructor Detail |
---|
public SeConnection(java.lang.String server, int instance, java.lang.String database, java.lang.String username, java.lang.String password) throws SeException
server
- name of the server to connect to.instance
- the port number that the ArcSDE server is listening on.database
- the specific database to connect to. Only applicable to
certain databases. Value ignored if not applicable.username
- name of a valid database user account.password
- the database user's password.
SeException
- if the connection attempt failed.public SeConnection(java.lang.String server, int instance, java.lang.String database, java.lang.String username, java.lang.String password, java.util.Locale connLocale) throws SeException
Locale
specified.
NOTE:
The ArcSDE Java API Localization Kit is required
for non-English locales. The Kit can be
obtained from any ESRI International distributer.
server
- name of the server to connect to.instance
- the port number that the ArcSDE server is listening on.database
- the specific database to connect to. Only applicable to
certain databases. Value ignored if not applicable.username
- name of a valid database user account.password
- the database user's password.connLocale
- a Locale object. If the Locale is not an English locale,
a sytem property file specific to this locale is required. Please refer
to the documentation available with the
Java API Localization Kit.
SeException
- if the connection attempt failed.public SeConnection(java.lang.String server, java.lang.String instance, java.lang.String database, java.lang.String username, java.lang.String password) throws SeException
server
- name of the server to connect to.instance
- the instance name or the direct connect parameter.database
- the specific database to connect to. Only applicable to
certain databases. Value ignored if not applicable.username
- name of a valid database user account.password
- the database user's password.
SeException
- if the connection attempt failed.public SeConnection(java.lang.String server, java.lang.String instance, java.lang.String database) throws SeException
server
- name of the server to connect to.instance
- the direct connect parameterdatabase
- the Sqlserver database to connect to.
SeException
- if the connection attempt failed.Method Detail |
---|
public void freeAllLocks() throws SeException
SeException
public java.lang.String getDatabaseName() throws SeException
String
is returned.
SeException
public SeDBMSInfo getDBMSInfo() throws SeException
SeException
SeDBMSInfo
public java.lang.String[] getKeywordInfo() throws SeException
SeException
public SeLocale getLocale()
public java.util.Vector getList(java.lang.Class cType) throws SeException
Vector
of objects from an ArcSDE instance
given the class type. The following ArcSde objects can be retrieved:
SeException
getLayers()
,
getRegisteredTables()
,
getSpatialRefList()
,
getTables(int)
,
getRasterColumns()
public java.util.Vector getTables(int permissions) throws SeException
permissions
- permission bit mask.
SeException
public java.util.Vector getRegisteredTables() throws SeException
SeException
public SeVersion[] getVersionList(java.lang.String whereClause) throws SeException
whereClause
- Applied to the SDE.VERSIONS table, a where clause
specifying values of desired version properties. (Don't include the
word WHERE.) If null, all versions are returned.
SeException
public SeState[] getStateList(java.lang.String whereClause) throws SeException
whereClause
- optional where clause to filter the list.
SeException
public SeConnection.SeStreamSpec getStreamSpec() throws SeException
SeConnection.SeStreamSpec
instance containing the
stream properties of the current connection.
SeException
public void setStreamSpec(SeConnection.SeStreamSpec specs) throws SeException
SeException
public java.util.Vector getSpatialRefList() throws SeException
SeException
public SeLog[] getLogfileList(java.lang.String owner) throws SeException
owner
- The name of the logfile owner. If null, current user is used.
SeException
public SeLog[] getLogfileList(java.lang.String owner, java.lang.String table) throws SeException
owner
- the name of the owner. If null, current user is used.table
- the name of the table or layer.
SeException
public SeMetaData[] getMetaDataList(java.lang.String whereClause) throws SeException
whereClause
- optional where clause to filter the data.
SeException
public void addInstanceMetaData(int recordCount, SeMetaData[] arrMetadata) throws SeException
recordCount
- number of records to be added.*arrMetadata
- An array of valid SeMetaData objects to be added.
SeException
public void alterInstanceMetaData(int recordCount, SeMetaData[] arrMetadata) throws SeException
recordCount
- number of records to modified.*arrMetadata
- An array of valid SeMetaData objects to modified.
SeException
public void deleteInstanceMetaData(int recordCount, SeObjectId[] recordIds) throws SeException
recordCount
- number of records to be deleted.recordIds
- list of metadata record ids to be deleted.
SeException
public SeMetaData[] getIntanceMetaDataInfoList(java.lang.String whereClause) throws SeException
whereClause
- optional where clause to filter the data.
SeException
public java.util.Vector getLayers() throws SeException
SeException
public int getTransactionAutoCommit() throws SeException
SeException
public java.lang.String getDefaultDatabase() throws SeException
SeException
public java.util.Vector getRasterColumns() throws SeException
SeException
public int getInstance()
public java.util.Vector getInstanceList() throws SeException
SeException
public void enableTlmCheck() throws SeException
disableTlmCheck()
.
SeException
public void disableTlmCheck() throws SeException
SeException
enableTlmCheck()
public java.lang.String getUser() throws SeException
SeException
public SeRelease getRelease()
public java.lang.String getAdminDatabaseName() throws SeException
SeException
public java.lang.String getSdeDbaName() throws SeException
SeException
public java.lang.String getServer()
public java.util.Date getServerTime() throws SeException
SeException
public java.lang.String getSQLInfo(int sqlId) throws SeException
SeDBMSInfo
class.
sqlId
- the sql id of an RDBMS function.
SeException
public void setConcurrency(int policy) throws SeException
policy
- the concurrency policy.
SeException
public void startTransaction() throws SeException
commitTransaction()
or
rollbackTransaction()
. You can establish an autocommit threshold
for the connection with either setTransactionAutoCommit(int)
or
the AUTOCOMMIT parameter in the giomgr.defs file. The autocommit
threshold determines how many database write operations are allowed before
the transaction is automatically committed.
SeException
public void testServer(long roundTripInterval) throws SeException
roundTripInterval
is less
than the time since the
last round trip to the ArcSDE server, this method also tests the ArcSDE server's
connection to the DBMS. To force a check of the ArcSDE server's connection
to the database, use a negative value, e.g. -1, for
roundTripInterval
.
SeException
getTimeSinceLastRT()
public long getTimeSinceLastRT()
public void databaseUse(java.lang.String database) throws SeException
database
- the database or data source to use.
SeException
public java.lang.String[] getDatabaseList() throws SeException
SeException
public void exportDbtune(java.lang.String dbtuneFile) throws SeException
dbtuneFile
- name of the dbtune file to export data to.
SeException
public void importDbtune(java.lang.String dbtuneFile) throws SeException
dbtuneFile
- name of the dbtune file to copy data from.
SeException
public void commitTransaction() throws SeException
startTransaction()
. Once this function is executed successfully,
rollbackTransaction()
cannot be used to undo modifications.
SeException
public void rollbackTransaction() throws SeException
startTransaction()
, or any intermediate commits on a transaction
resulting from a call to commitTransaction()
, or an automatic
commit (See the AUTOCOMMIT parameter in the giomgr.defs file).
SeException
public int setTransactionAutoCommit(int interval) throws SeException
interval
- number of modification operations to do before an autocommit.
SeException
public void close() throws SeException
SeException
public boolean isClosed()
public boolean isAdmin() throws SeException
SeException
public void switchToProxySession(java.lang.String username, java.lang.String password, java.lang.String[] role_array, int num_roles, java.lang.String distinguished_name) throws SeException
SeException
public void restorePrimarySession() throws SeException
SeException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |