Top Description Fields Constructors Methods
org.eclipse.persistence.sessions

public Class JNDIConnector

extends Object
implements Connector
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.sessions.Connector, java.lang.Cloneable, java.io.Serializable
Imports
java.util.*, java.sql.*, javax.naming.*, javax.sql.*, org.eclipse.persistence.exceptions.*, org.eclipse.persistence.internal.helper.*, org.eclipse.persistence.internal.localization.*

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().
Author
Big Country
Since
TOPLink/Java 2.1

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
protected Context
protected DataSource
protected boolean
protected int
lookupType

Deprecated
protected String
public static final int
public static final int

Constructor Summary

AccessConstructor and Description
public
JNDIConnector()

PUBLIC: Construct a Connector with no settings.

public
JNDIConnector(Context context, String name)

PUBLIC: Construct a Connector with the datasource name.

public
JNDIConnector(String name)

PUBLIC: Construct a Connector with the datasource name.

public
JNDIConnector(DataSource dataSource)

PUBLIC: Construct a Connector with the datasource object.

Method Summary

Modifier and TypeMethod and Description
public Object
clone()

Overrides java.lang.Object.clone.

Implements org.eclipse.persistence.sessions.Connector.clone.

INTERNAL: Clone the connector.
public Connection
connect(Properties properties, Session session)

Implements org.eclipse.persistence.sessions.Connector.connect.

INTERNAL: Connect with the specified properties and return the Connection.
public String

Returns:

java.lang.String
getConnectionDetails
()

Implements org.eclipse.persistence.sessions.Connector.getConnectionDetails.

PUBLIC: Provide the details of my connection information.
public Context
getContext()

PUBLIC: Return the JNDI Context that can supplied the named DataSource.

public DataSource
getDataSource()

PUBLIC: Return the javax.sql.DataSource.

public int
getLookupType()

Deprecated As of 2.6.0, replaced by configuration provided by org.eclipse.persistence.platform.server.ServerPlatform#getJNDIConnectorLookupType()
public String
getName()

PUBLIC: Return the name of the DataSource within the JNDI Context.

public void
setContext(Context context)

PUBLIC: Set the JNDI Context that can supply the named DataSource.

public void
setDataSource(DataSource dataSource)

PUBLIC: Set the javax.sql.DataSource.

public void
setLookupType(int lookupType)

Deprecated As of 2.6.0, replaced by configuration provided by org.eclipse.persistence.platform.server.ServerPlatform#getJNDIConnectorLookupType()
public void
setName(String name)

PUBLIC: Set the name of the DataSource within the JNDI Context.

public String
toString()

Overrides java.lang.Object.toString.

PUBLIC: Print data source info.
public void
toString(PrintWriter writer)

Implements org.eclipse.persistence.sessions.Connector.toString.

INTERNAL: Print something useful on the log.
Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

COMPOSITE_NAME_LOOKUPback to summary
public static final int COMPOSITE_NAME_LOOKUP
COMPOUND_NAME_LOOKUPback to summary
public static final int COMPOUND_NAME_LOOKUP
contextback to summary
protected Context context
dataSourceback to summary
protected DataSource dataSource
isCallbackRegisteredback to summary
protected boolean isCallbackRegistered
lookupTypeback to summary
protected int lookupType

Deprecated

Annotations
@Deprecated
nameback to summary
protected String name
STRING_LOOKUPback to summary
public static final int STRING_LOOKUP
UNDEFINED_LOOKUPback to summary
public static final int UNDEFINED_LOOKUP

Constructor Detail

JNDIConnectorback to summary
public JNDIConnector()

PUBLIC: Construct a Connector with no settings. The datasource name will still need to be set.

JNDIConnectorback to summary
public JNDIConnector(Context context, String name) throws ValidationException

PUBLIC: Construct a Connector with the datasource name.

JNDIConnectorback to summary
public JNDIConnector(String name)

PUBLIC: Construct a Connector with the datasource name.

JNDIConnectorback to summary
public JNDIConnector(DataSource dataSource)

PUBLIC: Construct a Connector with the datasource object.

Method Detail

cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Implements org.eclipse.persistence.sessions.Connector.clone.

INTERNAL: Clone the connector.

Returns:Object

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override
connectback to summary
public Connection connect(Properties properties, Session session) throws DatabaseException, ValidationException

Implements org.eclipse.persistence.sessions.Connector.connect.

INTERNAL: Connect with the specified properties and return the Connection.

Returns:Connection

Doc from org.eclipse.persistence.sessions.Connector.connect.

java.sql.Connection

Annotations
@Override
getConnectionDetailsback to summary
public String getConnectionDetails()

Implements org.eclipse.persistence.sessions.Connector.getConnectionDetails.

PUBLIC: Provide the details of my connection information. This is primarily for JMX runtime services.

Returns:String

java.lang.String

Annotations
@Override
getContextback to summary
public Context getContext()

PUBLIC: Return the JNDI Context that can supplied the named DataSource.

getDataSourceback to summary
public DataSource getDataSource()

PUBLIC: Return the javax.sql.DataSource.

getLookupTypeback to summary
public int getLookupType()

Deprecated

As of 2.6.0, replaced by configuration provided by org.eclipse.persistence.platform.server.ServerPlatform#getJNDIConnectorLookupType()

Annotations
@Deprecated
getNameback to summary
public String getName()

PUBLIC: Return the name of the DataSource within the JNDI Context.

setContextback to summary
public void setContext(Context context)

PUBLIC: Set the JNDI Context that can supply the named DataSource.

setDataSourceback to summary
public void setDataSource(DataSource dataSource)

PUBLIC: Set the javax.sql.DataSource.

setLookupTypeback to summary
public void setLookupType(int lookupType)

Deprecated

As of 2.6.0, replaced by configuration provided by org.eclipse.persistence.platform.server.ServerPlatform#getJNDIConnectorLookupType()

Annotations
@Deprecated
setNameback to summary
public void setName(String name) throws ValidationException

PUBLIC: Set the name of the DataSource within the JNDI Context.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

PUBLIC: Print data source info.

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object.

Annotations
@Override
toStringback to summary
public void toString(PrintWriter writer)

Implements org.eclipse.persistence.sessions.Connector.toString.

INTERNAL: Print something useful on the log.

Annotations
@Override