Package org.eclipse.persistence.sessions
Class JNDIConnector
java.lang.Object
org.eclipse.persistence.sessions.JNDIConnector
- All Implemented Interfaces:
Serializable
,Cloneable
,Connector
- Direct Known Subclasses:
OracleOCIProxyConnector
Specifies the J2EE DataSource lookup options.
This connector is normally used with a login in a J2EE environment
to connect to a server's connection pool defined by the DataSource name.
The JNDI name that the DataSource is registered under must be specified,
this must include any required prefix such as "java:comp/env/", (unless a DataSource object is given).
A Context is only required if not running on the server, otherwise default to a new InitialContext().
- See Also:
- Author:
- Big Country
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
protected Context
protected DataSource
protected boolean
protected int
Deprecated.protected String
static final int
static final int
-
Constructor Summary
ConstructorDescriptionPUBLIC: Construct a Connector with no settings.JNDIConnector
(String name) PUBLIC: Construct a Connector with the datasource name.JNDIConnector
(Context context, String name) PUBLIC: Construct a Connector with the datasource name.JNDIConnector
(DataSource dataSource) PUBLIC: Construct a Connector with the datasource object. -
Method Summary
Modifier and TypeMethodDescriptionclone()
INTERNAL: Clone the connector.connect
(Properties properties, Session session) INTERNAL: Connect with the specified properties and return the Connection.PUBLIC: Provide the details of my connection information.PUBLIC: Return the JNDI Context that can supplied the named DataSource.PUBLIC: Return the javax.sql.DataSource.int
Deprecated.getName()
PUBLIC: Return the name of the DataSource within the JNDI Context.void
setContext
(Context context) PUBLIC: Set the JNDI Context that can supply the named DataSource.void
setDataSource
(DataSource dataSource) PUBLIC: Set the javax.sql.DataSource.void
setLookupType
(int lookupType) Deprecated.As of 2.6.0, replaced by configuration provided byServerPlatform.getJNDIConnectorLookupType()
void
PUBLIC: Set the name of the DataSource within the JNDI Context.toString()
PUBLIC: Print data source info.void
toString
(PrintWriter writer) INTERNAL: Print something useful on the log.
-
Field Details
-
dataSource
-
context
-
name
-
isCallbackRegistered
protected boolean isCallbackRegistered -
UNDEFINED_LOOKUP
public static final int UNDEFINED_LOOKUP- See Also:
-
STRING_LOOKUP
public static final int STRING_LOOKUP- See Also:
-
COMPOSITE_NAME_LOOKUP
public static final int COMPOSITE_NAME_LOOKUP- See Also:
-
COMPOUND_NAME_LOOKUP
public static final int COMPOUND_NAME_LOOKUP- See Also:
-
lookupType
Deprecated.
-
-
Constructor Details
-
JNDIConnector
public JNDIConnector()PUBLIC: Construct a Connector with no settings. The datasource name will still need to be set. -
JNDIConnector
PUBLIC: Construct a Connector with the datasource name.- Throws:
ValidationException
-
JNDIConnector
PUBLIC: Construct a Connector with the datasource name. -
JNDIConnector
PUBLIC: Construct a Connector with the datasource object.
-
-
Method Details
-
clone
INTERNAL: Clone the connector. -
connect
public Connection connect(Properties properties, Session session) throws DatabaseException, ValidationException INTERNAL: Connect with the specified properties and return the Connection.- Specified by:
connect
in interfaceConnector
- Returns:
- java.sql.Connection
- Throws:
DatabaseException
ValidationException
-
getContext
PUBLIC: Return the JNDI Context that can supplied the named DataSource. -
getDataSource
PUBLIC: Return the javax.sql.DataSource. -
getName
PUBLIC: Return the name of the DataSource within the JNDI Context. -
getConnectionDetails
PUBLIC: Provide the details of my connection information. This is primarily for JMX runtime services.- Specified by:
getConnectionDetails
in interfaceConnector
- Returns:
- java.lang.String
-
setContext
PUBLIC: Set the JNDI Context that can supply the named DataSource. -
setDataSource
PUBLIC: Set the javax.sql.DataSource. -
setName
PUBLIC: Set the name of the DataSource within the JNDI Context.- Throws:
ValidationException
-
setLookupType
Deprecated.As of 2.6.0, replaced by configuration provided byServerPlatform.getJNDIConnectorLookupType()
- Parameters:
lookupType
-
-
getLookupType
Deprecated.As of 2.6.0, replaced by configuration provided byServerPlatform.getJNDIConnectorLookupType()
-
toString
PUBLIC: Print data source info. -
toString
INTERNAL: Print something useful on the log.
-
ServerPlatform.getJNDIConnectorLookupType()