- java.lang.Object
-
- org.eclipse.persistence.sessions.JNDIConnector
-
- All Implemented Interfaces:
Serializable,Cloneable,Connector
- Direct Known Subclasses:
OracleOCIProxyConnector
public class JNDIConnector extends Object implements Connector
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:
- Serialized Form
- Author:
- Big Country
- Since:
- TOPLink/Java 2.1
-
-
Field Summary
Fields Modifier and Type Field Description static intCOMPOSITE_NAME_LOOKUPstatic intCOMPOUND_NAME_LOOKUPprotected Contextcontextprotected DataSourcedataSourceprotected booleanisCallbackRegisteredprotected intlookupTypeDeprecated.protected Stringnamestatic intSTRING_LOOKUPstatic intUNDEFINED_LOOKUP
-
Constructor Summary
Constructors Constructor Description JNDIConnector()PUBLIC: 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
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Objectclone()INTERNAL: Clone the connector.Connectionconnect(Properties properties, Session session)INTERNAL: Connect with the specified properties and return the Connection.StringgetConnectionDetails()PUBLIC: Provide the details of my connection information.ContextgetContext()PUBLIC: Return the JNDI Context that can supplied the named DataSource.DataSourcegetDataSource()PUBLIC: Return the javax.sql.DataSource.intgetLookupType()Deprecated.As of 2.6.0, replaced by configuration provided byServerPlatform.getJNDIConnectorLookupType()StringgetName()PUBLIC: Return the name of the DataSource within the JNDI Context.voidsetContext(Context context)PUBLIC: Set the JNDI Context that can supply the named DataSource.voidsetDataSource(DataSource dataSource)PUBLIC: Set the javax.sql.DataSource.voidsetLookupType(int lookupType)Deprecated.As of 2.6.0, replaced by configuration provided byServerPlatform.getJNDIConnectorLookupType()voidsetName(String name)PUBLIC: Set the name of the DataSource within the JNDI Context.StringtoString()PUBLIC: Print data source info.voidtoString(PrintWriter writer)INTERNAL: Print something useful on the log.
-
-
-
Field Detail
-
dataSource
protected DataSource dataSource
-
context
protected Context context
-
name
protected String name
-
isCallbackRegistered
protected boolean isCallbackRegistered
-
UNDEFINED_LOOKUP
public static final int UNDEFINED_LOOKUP
- See Also:
- Constant Field Values
-
STRING_LOOKUP
public static final int STRING_LOOKUP
- See Also:
- Constant Field Values
-
COMPOSITE_NAME_LOOKUP
public static final int COMPOSITE_NAME_LOOKUP
- See Also:
- Constant Field Values
-
COMPOUND_NAME_LOOKUP
public static final int COMPOUND_NAME_LOOKUP
- See Also:
- Constant Field Values
-
lookupType
@Deprecated protected int lookupType
Deprecated.
-
-
Constructor Detail
-
JNDIConnector
public JNDIConnector()
PUBLIC: Construct a Connector with no settings. The datasource name will still need to be set.
-
JNDIConnector
public JNDIConnector(Context context, String name) throws ValidationException
PUBLIC: Construct a Connector with the datasource name.- Throws:
ValidationException
-
JNDIConnector
public JNDIConnector(String name)
PUBLIC: Construct a Connector with the datasource name.
-
JNDIConnector
public JNDIConnector(DataSource dataSource)
PUBLIC: Construct a Connector with the datasource object.
-
-
Method Detail
-
clone
public Object 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:
connectin interfaceConnector- Returns:
- java.sql.Connection
- Throws:
DatabaseExceptionValidationException
-
getContext
public Context getContext()
PUBLIC: Return the JNDI Context that can supplied the named DataSource.
-
getDataSource
public DataSource getDataSource()
PUBLIC: Return the javax.sql.DataSource.
-
getName
public String getName()
PUBLIC: Return the name of the DataSource within the JNDI Context.
-
getConnectionDetails
public String getConnectionDetails()
PUBLIC: Provide the details of my connection information. This is primarily for JMX runtime services.- Specified by:
getConnectionDetailsin interfaceConnector- Returns:
- java.lang.String
-
setContext
public void setContext(Context context)
PUBLIC: Set the JNDI Context that can supply the named DataSource.
-
setDataSource
public void setDataSource(DataSource dataSource)
PUBLIC: Set the javax.sql.DataSource.
-
setName
public void setName(String name) throws ValidationException
PUBLIC: Set the name of the DataSource within the JNDI Context.- Throws:
ValidationException
-
setLookupType
@Deprecated public void setLookupType(int lookupType)
Deprecated.As of 2.6.0, replaced by configuration provided byServerPlatform.getJNDIConnectorLookupType()
-
getLookupType
@Deprecated public int getLookupType()
Deprecated.As of 2.6.0, replaced by configuration provided byServerPlatform.getJNDIConnectorLookupType()
-
toString
public String toString()
PUBLIC: Print data source info.
-
toString
public void toString(PrintWriter writer)
INTERNAL: Print something useful on the log.
-
-