public abstract class DatasourceLogin extends java.lang.Object implements Login, java.io.Serializable, java.lang.Cloneable
Purpose: Hold the configuration information necessary to connect to a datasource.
Description: This is an abstract class that defines the common datasource independent connection configuration. It is extended to support specific datasources such as JDBC, JCA, XML, etc.
Modifier and Type | Field and Description |
---|---|
protected int |
cacheTransactionIsolation
By default concurrency is optimized and the cache is not locked during reads or writes,
This allows for concurrent reading and writing and should never cause any problems.
|
static int |
CONCURRENT_READ_WRITE
Reads and unit of work merges can occur concurrently.
|
protected Connector |
connector
Provide a little flexibility for connecting to a database
|
protected org.eclipse.persistence.internal.databaseaccess.Platform |
platform
Implementation of platform-specific behaviors.
|
protected java.util.Properties |
properties
Connection properties (e.g. user, password, and driver-specific settings)
|
static int |
SYNCHRONIZED_READ_ON_WRITE
Reads and unit of work merges will be serialized.
|
static int |
SYNCHRONIZED_WRITE
Reads can occur concurrently but unit of work merges will be serialized.
|
static int |
SYNCRONIZED_OBJECT_LEVEL_READ_WRITE
Writes to the cache (merge, object build/refresh will be synchronized
as will cache access (cloning) based on when access is required.
|
static int |
SYNCRONIZED_OBJECT_LEVEL_READ_WRITE_DATABASE
Writes to the cache (merge, object build/refresh will be synchronized
as will cache access (cloning) based on database transaction.
|
protected boolean |
usesExternalConnectionPooling
True if we use an external connection pool such as WebLogic's JTS driver
|
protected boolean |
usesExternalTransactionController
True if we should use some external transaction service such as JTS.
|
static java.lang.String |
versionString |
Constructor and Description |
---|
DatasourceLogin()
PUBLIC:
Create a new login.
|
DatasourceLogin(org.eclipse.persistence.internal.databaseaccess.Platform databasePlatform)
ADVANCED:
Create a new login for the given platform.
|
Modifier and Type | Method and Description |
---|---|
void |
addSequence(Sequence sequence)
Add sequence corresponding to the name
Don't use if the session is connected.
|
DatasourceLogin |
clone()
INTERNAL:
Clone the login.
|
java.lang.Object |
connectToDatasource(org.eclipse.persistence.internal.databaseaccess.Accessor accessor,
Session session)
INTERNAL:
Connect to the datasource, and return the driver level connection object.
|
void |
dontUseExternalConnectionPooling()
PUBLIC:
Do not use external connection pooling.
|
void |
dontUseExternalTransactionController()
PUBLIC:
Let EclipseLink control transactions instead of some external transaction
service such as JTS.
|
int |
getCacheTransactionIsolation()
ADVANCED:
By default concurrency is optimized and the cache is not locked more than required during reads or writes,
This allows for virtual concurrent reading and writing and should never cause any problems.
|
Connector |
getConnector()
ADVANCED:
Return the connector that will instantiate the connection.
|
org.eclipse.persistence.internal.databaseaccess.Platform |
getDatasourcePlatform()
PUBLIC:
Return the datasource platform specific information.
|
Sequence |
getDefaultSequence()
Get default sequence
|
Sequence |
getDefaultSequenceToWrite()
INTERNAL:
Used only for writing the login into XML or Java.
|
java.lang.String |
getPassword()
Return the password.
|
DatabasePlatform |
getPlatform()
INTERNAL:
Return the database platform specific information.
|
java.lang.String |
getPlatformClassName()
INTERNAL:
Return the name of the database platform class.
|
java.util.Properties |
getProperties()
INTERNAL:
The properties are additional, driver-specific, connection information
to be passed to the driver.
|
java.lang.Object |
getProperty(java.lang.String name)
PUBLIC:
The properties are additional, driver-specific, connection information
to be passed to the driver.
|
protected org.eclipse.persistence.internal.security.SecurableObjectHolder |
getSecurableObjectHolder()
INTERNAL:
Return the encryption securable holder.
|
Sequence |
getSequence(java.lang.String seqName)
Get sequence corresponding to the name
|
java.util.Map |
getSequences()
Returns a map of sequence names to Sequences (may be null).
|
java.util.Map |
getSequencesToWrite()
INTERNAL:
Used only for writing the login into XML or Java.
|
java.lang.String |
getTableQualifier()
PUBLIC:
Return the qualifier for the all of the tables referenced by EclipseLink.
|
java.lang.String |
getUserName()
PUBLIC:
The user name is the database login name.
|
static java.lang.String |
getVersion()
PUBLIC:
Return the EclipseLink version.
|
boolean |
isConnectionHealthValidatedOnError()
PUBLIC:
This value defaults to false when not on a DatabaseLogin as the functionality has not been implemented
for other datasource type.
|
void |
removeAllSequences()
Remove all sequences but the default one.
|
void |
removeProperty(java.lang.String propertyName)
PUBLIC:
Some drivers don't like the "user" and "password" properties.
|
Sequence |
removeSequence(java.lang.String seqName)
Remove sequence corresponding to name.
|
void |
setCacheTransactionIsolation(int cacheTransactionIsolation)
ADVANCED:
By default concurrency is optimized and the cache is not locked more than required during reads or writes,
This allows for virtual concurrent reading and writing and should never cause any problems.
|
void |
setConnector(Connector connector)
PUBLIC:
Set the connector that will instantiate the connection.
|
void |
setDatasourcePlatform(org.eclipse.persistence.internal.databaseaccess.Platform platform)
PUBLIC:
Set the database platform specific information.
|
void |
setDefaultNullValue(java.lang.Class type,
java.lang.Object value)
PUBLIC:
The default value to substitute for database NULLs can be configured
on a per-class basis.
|
void |
setDefaultSequence(Sequence sequence)
Set default sequence
|
void |
setEncryptedPassword(java.lang.String password)
Set the encrypted password.
|
void |
setEncryptionClassName(java.lang.String encryptionClassName)
Sets the encryption class name
|
void |
setPassword(java.lang.String password)
Set the password.
|
void |
setPlatform(org.eclipse.persistence.internal.databaseaccess.Platform platform)
INTERNAL:
Set the database platform specific information.
|
void |
setPlatformClassName(java.lang.String platformClassName)
INTERNAL:
Set the name of the Platform to be used.
|
void |
setPlatformClassName(java.lang.String platformClassName,
java.lang.ClassLoader loader)
INTERNAL:
Set the name of the Platform to be created using the
passed in class loader.
|
void |
setProperties(java.util.Properties properties)
PUBLIC:
The properties are additional, driver-specific, connection information
to be passed to the JDBC driver.
|
void |
setProperty(java.lang.String propertyName,
java.lang.Object propertyValue)
PUBLIC:
Some JDBC drivers require additional, driver-specific, properties.
|
void |
setSequences(java.util.Map sequences)
INTERNAL:
Used only for reading the login from XML.
|
void |
setTableQualifier(java.lang.String qualifier)
PUBLIC:
Set the default qualifier for all tables.
|
void |
setTimestampQuery(ValueReadQuery timestampQuery)
PUBLIC:
Override the default query for returning a timestamp from the server.
|
void |
setUserName(java.lang.String name)
PUBLIC:
The user name is the database login name.
|
void |
setUsesExternalConnectionPooling(boolean usesExternalConnectionPooling)
PUBLIC:
Return whether EclipseLink uses some external connection pooling service such as a JDBC 2.0 driver.
|
void |
setUsesExternalTransactionController(boolean usesExternalTransactionController)
PUBLIC:
Return whether EclipseLink uses some external transaction service such as JTS.
|
boolean |
shouldAllowConcurrentReadWrite()
INTERNAL:
Used for cache isolation.
|
boolean |
shouldSynchronizedReadOnWrite()
INTERNAL:
Used for cache isolation.
|
boolean |
shouldSynchronizeObjectLevelReadWrite()
INTERNAL:
Used for Cache Isolation.
|
boolean |
shouldSynchronizeObjectLevelReadWriteDatabase()
INTERNAL:
Used for Cache Isolation.
|
boolean |
shouldSynchronizeWrites()
INTERNAL:
Used for Cache Isolation.
|
boolean |
shouldUseExternalConnectionPooling()
PUBLIC:
Return whether EclipseLink uses some external connection pooling
(e.g.
|
boolean |
shouldUseExternalTransactionController()
PUBLIC:
Return whether EclipseLink uses some external transaction service such as JTS.
|
java.lang.String |
toString()
PUBLIC:
Print all of the connection information.
|
void |
useExternalConnectionPooling()
PUBLIC:
Use external connection pooling.
|
void |
useExternalTransactionController()
PUBLIC:
Use an external transaction controller such as a JTS service
|
void |
usePlatform(org.eclipse.persistence.internal.databaseaccess.Platform platform)
ADVANCED:
Set the database platform to be custom platform.
|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
buildAccessor
public static java.lang.String versionString
protected java.util.Properties properties
protected org.eclipse.persistence.internal.databaseaccess.Platform platform
protected Connector connector
protected boolean usesExternalConnectionPooling
protected boolean usesExternalTransactionController
protected int cacheTransactionIsolation
public static final int CONCURRENT_READ_WRITE
public static final int SYNCHRONIZED_WRITE
public static final int SYNCHRONIZED_READ_ON_WRITE
public static final int SYNCRONIZED_OBJECT_LEVEL_READ_WRITE
public static final int SYNCRONIZED_OBJECT_LEVEL_READ_WRITE_DATABASE
public DatasourceLogin()
public DatasourceLogin(org.eclipse.persistence.internal.databaseaccess.Platform databasePlatform)
protected org.eclipse.persistence.internal.security.SecurableObjectHolder getSecurableObjectHolder()
public DatasourceLogin clone()
public java.lang.Object connectToDatasource(org.eclipse.persistence.internal.databaseaccess.Accessor accessor, Session session) throws DatabaseException
connectToDatasource
in interface Login
DatabaseException
public int getCacheTransactionIsolation()
Setting are:
public Connector getConnector()
public DatabasePlatform getPlatform()
getPlatform
in interface Login
public org.eclipse.persistence.internal.databaseaccess.Platform getDatasourcePlatform()
getDatasourcePlatform
in interface CoreLogin<org.eclipse.persistence.internal.databaseaccess.Platform>
getDatasourcePlatform
in interface Login
public java.util.Properties getProperties()
NOTE: Do not set the password directly by getting the properties and setting the "password" property directly. Use the method DatabaseLogin.setPassword(String).
public java.lang.Object getProperty(java.lang.String name)
NOTE: Do not set the password directly by getting the properties and setting the "password" property directly. Use the method DatabaseLogin.setPassword(String).
getProperty
in interface Login
public java.lang.String getTableQualifier()
getTableQualifier
in interface Login
public java.lang.String getUserName()
getUserName
in interface Login
public boolean isConnectionHealthValidatedOnError()
isConnectionHealthValidatedOnError
in interface Login
public static java.lang.String getVersion()
public void removeProperty(java.lang.String propertyName)
public void setCacheTransactionIsolation(int cacheTransactionIsolation)
Setting are:
public void setConnector(Connector connector)
DataSource
, use code
something like the following:
session.getLogin().setConnector(new JNDIConnector(context, dataSourceName));
session.login();
where the context
is an instance of a javax.naming.Context
and
the dataSourceName
refers to the name of the DataSource
within the context.public void setDefaultNullValue(java.lang.Class type, java.lang.Object value)
public void setPassword(java.lang.String password)
setPassword
in interface Login
public java.lang.String getPassword()
getPassword
in interface Login
public void setEncryptedPassword(java.lang.String password)
public void setEncryptionClassName(java.lang.String encryptionClassName)
public void setPlatform(org.eclipse.persistence.internal.databaseaccess.Platform platform)
setPlatform
in interface Login
public void setDatasourcePlatform(org.eclipse.persistence.internal.databaseaccess.Platform platform)
setDatasourcePlatform
in interface Login
public java.lang.String getPlatformClassName()
public void setPlatformClassName(java.lang.String platformClassName) throws ValidationException
ValidationException
public void setPlatformClassName(java.lang.String platformClassName, java.lang.ClassLoader loader) throws ValidationException
ValidationException
setPlatformClassName(String platformClassName)
public void usePlatform(org.eclipse.persistence.internal.databaseaccess.Platform platform)
public void setProperties(java.util.Properties properties)
setProperties
in interface Login
public void setProperty(java.lang.String propertyName, java.lang.Object propertyValue)
setProperty
in interface Login
public void setTableQualifier(java.lang.String qualifier)
public void setTimestampQuery(ValueReadQuery timestampQuery)
public void setUserName(java.lang.String name)
setUserName
in interface Login
public void setUsesExternalConnectionPooling(boolean usesExternalConnectionPooling)
public void setUsesExternalTransactionController(boolean usesExternalTransactionController)
public void dontUseExternalConnectionPooling()
useExternalConnectionPooling()
public void dontUseExternalTransactionController()
useExternalTransactionController()
public boolean shouldAllowConcurrentReadWrite()
shouldAllowConcurrentReadWrite
in interface Login
public boolean shouldSynchronizedReadOnWrite()
shouldSynchronizedReadOnWrite
in interface Login
public boolean shouldSynchronizeWrites()
shouldSynchronizeWrites
in interface Login
public boolean shouldSynchronizeObjectLevelReadWrite()
shouldSynchronizeObjectLevelReadWrite
in interface Login
public boolean shouldSynchronizeObjectLevelReadWriteDatabase()
shouldSynchronizeObjectLevelReadWriteDatabase
in interface Login
public boolean shouldUseExternalConnectionPooling()
shouldUseExternalConnectionPooling
in interface Login
useExternalConnectionPooling()
,
dontUseExternalConnectionPooling()
public boolean shouldUseExternalTransactionController()
shouldUseExternalTransactionController
in interface Login
useExternalTransactionController()
,
dontUseExternalTransactionController()
public void useExternalConnectionPooling()
public void useExternalTransactionController()
public java.lang.String toString()
toString
in class java.lang.Object
public Sequence getDefaultSequence()
public void setDefaultSequence(Sequence sequence)
public void addSequence(Sequence sequence)
public Sequence getSequence(java.lang.String seqName)
public java.util.Map getSequences()
public Sequence removeSequence(java.lang.String seqName)
public void removeAllSequences()
public Sequence getDefaultSequenceToWrite()
public java.util.Map getSequencesToWrite()
public void setSequences(java.util.Map sequences)