public abstract class WmManagedConnection extends java.lang.Object implements javax.resource.spi.ManagedConnection, ResourceDomainDataProvider
WmManagedConnection
and return instances of this object to its corresponding
WmManagedConnectionFactory's
createManagedConnectionObject method.Modifier and Type | Field and Description |
---|---|
protected WmConnection |
_activeConnectionHandle
Currently active CCI connection handle
|
protected java.util.ArrayList |
_connectionEventListeners
List of event listeners
|
protected WmManagedConnectionFactory |
_factory |
protected java.io.PrintWriter |
_logWriter
Log writer
|
Constructor and Description |
---|
WmManagedConnection()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract java.lang.Boolean |
adapterCheckValue(java.lang.String serviceName,
java.lang.String resourceDomainName,
java.lang.String[][] values,
java.lang.String testValue)
Checks a resourceDomain value.
|
abstract ResourceDomainValues[] |
adapterResourceDomainLookup(java.lang.String serviceName,
java.lang.String resourceDomainName,
java.lang.String[][] values)
Looks up values for a resourceDomain.
|
void |
addConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
Register a connection event listener
|
void |
associateConnection(java.lang.Object connection)
Link a WmConnection Handle to this ManagedConnection and make it active
|
void |
cleanup()
Cleanup the managed connection instance
|
protected void |
cleanupConnectionAfterUse()
Cleans up the connection each time it is used.
|
protected boolean |
cleanupRequiredAfterConnectionUse()
Determines whether the connection requires cleanup each time the connection is used.
|
protected boolean |
connectionMatches(javax.security.auth.Subject subject,
javax.resource.spi.ConnectionRequestInfo cxRequestInfo) |
void |
destroy() |
protected abstract void |
destroyConnection()
Destroys the connection.
|
void |
fireConnectionEvent(javax.resource.spi.ConnectionEvent event)
Send a connection event to all the listeners
|
java.lang.Object |
getConnection(javax.security.auth.Subject subject,
javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
Returns a CCI Connection Instance representing this managed connection
Optionally, update the connection for this particular session
|
javax.resource.cci.ConnectionMetaData |
getConnectionMetaData()
Return the connection handle MetaData regarding this managed connection
|
WmManagedConnectionFactory |
getFactory()
Gets the
WmManagedConnectionFactory associated with this
connection object. |
javax.resource.spi.LocalTransaction |
getLocalTransaction()
Return a
LocalTransaction object if this connection type supports
local transactions. |
java.lang.String |
getLoggableName()
Returns loggable name for use by connection manager.
|
java.io.PrintWriter |
getLogWriter()
Returns the log writer that an adapter writer can use to print debug messages.
|
javax.resource.spi.ManagedConnectionMetaData |
getMetaData()
Return the meta data regarding this managed connection
|
javax.transaction.xa.XAResource |
getXAResource()
Returns an
XAResource object if this connection type supports
XA transactions. |
protected boolean |
initializationRequired()
Determines whether the connection requires initialization when it is created for
the first time.
|
protected void |
initializeConnection(javax.security.auth.Subject subject,
javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
Initializes a connection immediately after it is created for the first time.
|
void |
processConnectionHandleCloseEvent(WmConnection connectionHandle)
Called by the WmConnection instance when a connection close is requested
|
abstract void |
registerResourceDomain(WmAdapterAccess access)
Sets a reference to the
WmAdapterAccess object. |
void |
removeConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
De-register a connection event listener
|
WmConnection |
retrieveAssociatedConn() |
void |
setFactory(WmManagedConnectionFactory factory)
Initialize the managed connections meta data and establish a connection to the EIS
This method should only be called from WmManagedConnectionFactory.createManagedConnection
method, immediately after the managed connection instance is created
and hence does not need to be synchronized
|
void |
setLogWriter(java.io.PrintWriter writer)
Sets the log writer for this ManagedConnection instance.
|
protected void |
setupConnectionBeforeUse(javax.security.auth.Subject subject,
javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
Initializes the connection immediately before it is used each time.
|
protected boolean |
setupRequiredBeforeConnectionUse(javax.security.auth.Subject subject,
javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
Determines whether the connection requires initialization immediately before it is used each time.
|
protected WmConnection _activeConnectionHandle
protected java.util.ArrayList _connectionEventListeners
protected WmManagedConnectionFactory _factory
protected java.io.PrintWriter _logWriter
public WmManagedConnection()
public abstract java.lang.Boolean adapterCheckValue(java.lang.String serviceName, java.lang.String resourceDomainName, java.lang.String[][] values, java.lang.String testValue) throws AdapterException
Boolean.TRUE
if
testValue is valid in this context, Boolean.FALSE
if it is
not valid, or null
if the value cannot be confirmed by the
adapter.
Implement this method if your adapter supports resourceDomains. Return
null
if you are not able to confirm the value. Otherwise,
return Boolean.TRUE
if the value is valid, or
Boolean.FALSE
if the value is not valid.
This method is called when a user types a value into
the Adapter Service Editor or Adapter Notification Editor
while the editor is displaying an incomplete resourceDomain (ResourceDomainValues.complete
is false) and the
ResourceDomainValues.canValidate
flag is set to true.
adapterCheckValue
in interface ResourceDomainDataProvider
serviceName
- the name of the service templateresourceDomainName
- the name of the resourceDomainvalues
- the values for the resourceDomain parameterstestValue
- the value to testBoolean.TRUE
if testValue
is valid
in this context, Boolean.FALSE
if it is not
valid, or null
if the value cannot be confirmed
by the adapter.AdapterException
- if it encounters an error.public abstract ResourceDomainValues[] adapterResourceDomainLookup(java.lang.String serviceName, java.lang.String resourceDomainName, java.lang.String[][] values) throws AdapterException
ResourceDomainValues
class with the proper data. Returns multiple objects
if you are using tuples.adapterResourceDomainLookup
in interface ResourceDomainDataProvider
serviceName
- the name of the adapter service/notification templateresourceDomainName
- the name of the resourceDomainvalues
- the values for the resourceDomain parametersAdapterException
- if it encounters an error.public void addConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
addConnectionEventListener
in interface javax.resource.spi.ManagedConnection
public void associateConnection(java.lang.Object connection) throws javax.resource.ResourceException
associateConnection
in interface javax.resource.spi.ManagedConnection
javax.resource.ResourceException
public void cleanup() throws javax.resource.ResourceException
cleanup
in interface javax.resource.spi.ManagedConnection
javax.resource.ResourceException
protected void cleanupConnectionAfterUse() throws javax.resource.ResourceException
Cleanup performed in cleanupConnectionAfterUse() is different from the cleanup that is performed in destroyConnection(). Cleanup performed in destroyConnection() occurs only where the connection is destroyed. Connections are not always destroyed after use. If the connection is pooled, the connection is returned to the pool instead of being destroyed. cleanupConnectionAfterUse() ensures the connection is cleaned each time after use, before being returned to the pool. Adapter writers must implement this method if this connection requires cleanup after it is used. Adapter writers must also ensure that cleanupConnectionAfterUse() returns true.
subject
- currently, this parameter is not usedcxRequestInfo
- currently, this parameter is not usedjavax.resource.ResourceException
- an instance of AdapterException
or one of its subclasses, indicating an error occurred while cleaning the connection.destroyConnection()
,
cleanupRequiredAfterConnectionUse()
protected boolean cleanupRequiredAfterConnectionUse()
Cleanup performed in cleanupConnectionAfterUse() is different from the cleanup that is performed in destroyConnection(). Cleanup performed in destroyConnection() occurs only where the connection is destroyed. Connections are not always destroyed after use. If the connection is pooled, the connection is returned to the pool instead of being destroyed. cleanupConnectionAfterUse() ensures the connection is cleaned each time after use, before being returned to the pool. Adapter writers must implement this method to return true to indicate that this connection requires cleanup after each use.
cleanupConnectionAfterUse()
,
destroyConnection()
protected boolean connectionMatches(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
public void destroy() throws javax.resource.ResourceException
destroy
in interface javax.resource.spi.ManagedConnection
javax.resource.ResourceException
protected abstract void destroyConnection() throws javax.resource.ResourceException
javax.resource.ResourceException
public void fireConnectionEvent(javax.resource.spi.ConnectionEvent event)
public java.lang.Object getConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cxRequestInfo) throws javax.resource.ResourceException
getConnection
in interface javax.resource.spi.ManagedConnection
javax.resource.ResourceException
public javax.resource.cci.ConnectionMetaData getConnectionMetaData()
public WmManagedConnectionFactory getFactory()
WmManagedConnectionFactory
associated with this
connection object.public javax.resource.spi.LocalTransaction getLocalTransaction() throws javax.resource.ResourceException
LocalTransaction
object if this connection type supports
local transactions. If local transactions are supported, adapter writers must implement this
method to return the LocalTransaction
object associated with the resource.getLocalTransaction
in interface javax.resource.spi.ManagedConnection
LocalTransaction
objectjavax.resource.ResourceException
- if a problem was encountered while retrieving the
transaction object.LocalTransaction
public java.lang.String getLoggableName()
getLoggableName
in interface com.wm.app.b2b.server.jca.LogDescriptor
public java.io.PrintWriter getLogWriter()
getLogWriter
in interface javax.resource.spi.ManagedConnection
public javax.resource.spi.ManagedConnectionMetaData getMetaData()
getMetaData
in interface javax.resource.spi.ManagedConnection
public javax.transaction.xa.XAResource getXAResource() throws javax.resource.ResourceException
XAResource
object if this connection type supports
XA transactions. If XA transactions are supported, adapter writers must implement this method
to return the XAResource
object associated with the resource.getXAResource
in interface javax.resource.spi.ManagedConnection
XAResource
objectjavax.resource.ResourceException
- if a problem was encountered while retrieving the
transaction object.XAResource
protected boolean initializationRequired()
initializeConnection(javax.security.auth.Subject, javax.resource.spi.ConnectionRequestInfo)
protected void initializeConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cxRequestInfo) throws javax.resource.ResourceException, java.lang.InterruptedException
subject
- currently, this parameter is not usedcxRequestInfo
- currently, this parameter is not usedjavax.resource.ResourceException
- an instance of AdapterException
or one of its subclasses, indicating that an error occurred while initializing the connectionjava.lang.InterruptedException
- based on the configured time out for the thread interrupt, Connection Pool interrupter thread will interrupt the connection creation thread.initializationRequired()
public void processConnectionHandleCloseEvent(WmConnection connectionHandle)
public abstract void registerResourceDomain(WmAdapterAccess access) throws AdapterException
WmAdapterAccess
object. This method will be called
after the constructor has been called, but before any
properties are set. The reference to WmAdapterAccess should be
stored for later use, if needed.
Register resourceDomain, (using
addResourceDomainLookup
,
addResourceDomain
, etc.) in this method.
registerResourceDomain
in interface ResourceDomainDataProvider
access
- a reference to WmAdapterAccess objectAdapterException
- if it encounters an error.public void removeConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
removeConnectionEventListener
in interface javax.resource.spi.ManagedConnection
public final WmConnection retrieveAssociatedConn()
public void setFactory(WmManagedConnectionFactory factory)
public void setLogWriter(java.io.PrintWriter writer)
setLogWriter
in interface javax.resource.spi.ManagedConnection
protected void setupConnectionBeforeUse(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cxRequestInfo) throws javax.resource.ResourceException
subject
- currently, this parameter is not usedcxRequestInfo
- currently, this parameter is not usedjavax.resource.ResourceException
- an instance of AdapterException
or one of its subclasses, indicating an error occurred while initializing the connection
before each use.protected boolean setupRequiredBeforeConnectionUse(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
subject
- currently, this parameter is not usedcxRequestInfo
- currently, this parameter is not usedsetupConnectionBeforeUse(javax.security.auth.Subject, javax.resource.spi.ConnectionRequestInfo)
,
initializeConnection(javax.security.auth.Subject, javax.resource.spi.ConnectionRequestInfo)
Copyright © 2003 - 2021 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.