|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.ims.rds.ClientManagedConnectionFactory
In a managed-server environment, ClientManagedConnectionFactory
is the object that is configured at deployment time with the information
necessary to create a specific connection. It is used to create an
ClientDataSource
which is stored in the JNDI name space by a
deployment tool, such as that for WebSphere Application Server. An application,
such as an Enterprise Java Bean, can then use JNDI to find the object at
runtime. For example, a DataSource
deployed into the JNDI with the
the name "ims/jdbc1" can be found and used to create a Connection
using code like the following:
// obtain the initial JNDI context Context initialContext = new InitialContext(); // perform JNDI lookup to obtain connection factory javax.sql.DataSource dataSource = (javax.sql.DataSource)initialContext.lookup(“java:comp/env/ims/jdbc1”); javax.sql.Connection connection = dataSource.getConnection();
In an unmanged-server environment, the prior code can still be used
to look up a DataSource
for use in creating a Connection
,
however the application, or a related application, must have first deployed
the DataSource
into the name space. The following code snippet
shows how to serialize an ClientDataSource
into the JNDI
namespace:
ClientManagedConnectionFactory mcf = new ClientConnectionFactory(); mcf.setDatabaseViewName("MyDatabaseView"); mcf.setDRAName("IMS1"); DataSource dataSource = (DataSource)mcf.createConnectionFactory(); javax.naming.Context context = new javax.naming.InitialContext(env); context.bind("java:comp/env/ims/jdbc1", context);
Connection
,
DataSource
,
ManagedConnectionFactory
,
ClientDataSource
, Serialized FormConstructor Summary | |
ClientManagedConnectionFactory()
ClientManagedConnectionFactory default constructor method |
Method Summary | |
java.lang.Object |
createConnectionFactory()
Creates an IMSJdbcDataSource with a default connection
manager (IMSJdbcConnectionManager ). |
java.lang.Object |
createConnectionFactory(javax.resource.spi.ConnectionManager connectionManager)
Creates an ClientDataSource using the supplied
ConnectionManager . |
javax.resource.spi.ManagedConnection |
createManagedConnection(javax.security.auth.Subject subject,
javax.resource.spi.ConnectionRequestInfo requestInfo)
Creates a managed connection from the connection factory. |
boolean |
equals(java.lang.Object anObject)
Determines if the input object matches set of configuration properties that make this ClientManagedConnectionFactory instance unique and specific to an instance; |
java.lang.String |
getDatabaseViewName()
Returns the name of the DLIDatabaseView subclass. |
java.lang.String |
getDRAName()
Returns the Database Resource Adapter (DRA) startup table identifier. |
java.lang.String |
getHostName()
Returns the name (or IP address) of the host machine. |
java.io.PrintWriter |
getLogWriter()
Returns the PrintWriter provided by the server
runtime. |
java.lang.Integer |
getPortNumber()
Returns the IIOP port number of the host machine's web server. |
java.lang.Integer |
getTraceLevel()
Gets the value of the trace level property. |
java.lang.String |
getTransactionResourceRegistration()
When WAS creates the ManagedConnectionFactory, it will do a getMethod for this method and then invoke the method. |
int |
hashCode()
Returns the hash code of the configuration properties that make this ClientManagedConnectionFactory instance unique. |
javax.resource.spi.ManagedConnection |
matchManagedConnections(java.util.Set connectionPool,
javax.security.auth.Subject subject,
javax.resource.spi.ConnectionRequestInfo requestInfo)
This method is used by the server runtime to support connection pooling. |
void |
setDatabaseViewName(java.lang.String databaseViewName)
Sets the name of the DLIDatabaseView subclass. |
void |
setDRAName(java.lang.String draName)
Sets the name of the Database Resource Adapter (DRA) startup table identifier. |
void |
setHostName(java.lang.String hostName)
Sets the name of the host machine. |
void |
setLogWriter(java.io.PrintWriter logWriter)
Used by the server runtime to provide a PrintWriter
for resource adapter tracing. |
void |
setPortNumber(java.lang.Integer portNumber)
Sets the IIOP port number of the host machine's web server. |
void |
setTraceLevel(java.lang.Integer newTraceLevel)
Turns on tracing and sets the value of the trace level property to one of the trace levels defined in XMLTrace (e.g XMLTrace.TRACE_EXCEPTIONS, XMLTrace.TRACE_METHOD1, etc). |
void |
setTransactionResourceRegistration(java.lang.String registration)
Sets the transaction resource registration value. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ClientManagedConnectionFactory()
Method Detail |
public java.lang.Object createConnectionFactory() throws javax.resource.ResourceException
IMSJdbcDataSource
with a default connection
manager (IMSJdbcConnectionManager
). This supports use of
the DataSource
in an unmanaged server environment.createConnectionFactory
in interface javax.resource.spi.ManagedConnectionFactory
javax.resource.ResourceException
- if the DataSource
object cannot be created.DataSource
public java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager connectionManager) throws javax.resource.ResourceException
ClientDataSource
using the supplied
ConnectionManager
. This supports use of the
DataSource
in a managed-server environment (e.g. WebSphere
Application Server). This
method is intended for use of the server runtime and should not normally
be used in client code.createConnectionFactory
in interface javax.resource.spi.ManagedConnectionFactory
connectionManager
- the server-provided ConnectionManager
javax.resource.ResourceException
- if the DataSource
object cannot be created.DataSource
,
ConnectionManager
public javax.resource.spi.ManagedConnection createManagedConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo requestInfo) throws javax.resource.ResourceException
createManagedConnection
in interface javax.resource.spi.ManagedConnectionFactory
subject
- The subject for which this connection should be obtained. The application
server (connection manager) will pass a null subject if the res-ref was
configured to be application managed. This resource adaptor is configured
such that the ACEE should be placed on the TCB prior to this call, so if the
subject is passed, then the ACEE is setup already, and there is nothing to
do security wise.reqInfo
- This opaque object was passed from the connection factory to this object
through the application server (connection manager).public javax.resource.spi.ManagedConnection matchManagedConnections(java.util.Set connectionPool, javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo requestInfo) throws javax.resource.ResourceException
matchManagedConnections
in interface javax.resource.spi.ManagedConnectionFactory
connectionPool
- the Set
containing the available ManagedConnection
objects.subject
- requestInfo
- ManagedConnection
object that matches the passed parameters or
null if no match can be found.javax.resource.ResourceException
- on an error matching the managed connectionpublic void setLogWriter(java.io.PrintWriter logWriter) throws javax.resource.ResourceException
PrintWriter
for resource adapter tracing. Not available for client code.setLogWriter
in interface javax.resource.spi.ManagedConnectionFactory
logWriter
- the PrintWriter
to use for tracing.javax.resource.ResourceException
- PrintWriter
public java.io.PrintWriter getLogWriter() throws javax.resource.ResourceException
PrintWriter
provided by the server
runtime.getLogWriter
in interface javax.resource.spi.ManagedConnectionFactory
PrintWriter
provided by the server runtime or null
if one has not been provided.javax.resource.ResourceException
- none currentlypublic java.lang.String getDatabaseViewName()
DLIDatabaseView
subclass.DLIDatabaseView
subclass.DLIDatabaseView
public void setDatabaseViewName(java.lang.String databaseViewName)
DLIDatabaseView
subclass.databaseViewName
- the name of the DLIDatabaseView subclass.DLIDatabaseView
public java.lang.String getHostName()
public void setHostName(java.lang.String hostName)
hostName
- the name (or IP address) of the host machine.public java.lang.Integer getPortNumber()
public void setPortNumber(java.lang.Integer portNumber)
portNumber
- the port number of the host machine.public java.lang.String getDRAName()
public void setDRAName(java.lang.String draName)
draName
- the name of the DRA startup table.public java.lang.Integer getTraceLevel()
XMLTrace
public void setTraceLevel(java.lang.Integer newTraceLevel)
newTraceLevel
- One of the trace levels defined in XMLTrace (e.g XMLTrace.TRACE_EXCEPTIONS,
XMLTrace.TRACE_METHOD1, etc).XMLTrace
public java.lang.String getTransactionResourceRegistration()
public void setTransactionResourceRegistration(java.lang.String registration)
public boolean equals(java.lang.Object anObject)
equals
in interface javax.resource.spi.ManagedConnectionFactory
equals
in class java.lang.Object
anObject
- ClientManagedConnectionFactory
object to test.public int hashCode()
hashCode
in interface javax.resource.spi.ManagedConnectionFactory
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |