|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.websphere.rsadapter.WSCallHelper
Provides static methods for invoking non-standard methods on objects wrapped by WebSphere. For example, the jdbcCall method can be used to invoke vendor specific non-JDBC methods on the underlying JDBC objects wrapped by WebSphere.
Method Summary | |
---|---|
static java.lang.Object |
call(java.lang.Object target,
java.lang.String methName,
java.lang.Object[] params,
java.lang.Class[] types)
A shortcut method for reflection. |
static DataStoreHelper |
createDataStoreHelper(java.lang.String dsClassName)
Create a new instance of the DataStoreHelper for the specified DataSource class. |
static DataStoreHelper |
getDataStoreHelper(javax.sql.DataSource ds)
Retrieves the DataStoreHelper associated with the specified WebSphere DataSource. |
static boolean |
isShareable(java.sql.Connection conn)
Determines whether a WebSphere Connection is shareable or not. |
static java.lang.Object |
jdbcCall(java.lang.Class underlyingObjectType,
java.lang.Object caller,
java.lang.String methName,
java.lang.Object[] args,
java.lang.Class[] argTypes)
Calls a non-standard-JDBC method, specific to the JDBC provider implementation class, on the underlying JDBC object corresponding to a WebSphere JDBC wrapper. |
static void |
setConnectionError(java.lang.Object connHandle)
Signals WebSphere that an application-detected fatal error has occured on the specified Connection handle so that WebSphere may remove it from the pool, or purge the entire pool, as determined by the purge policy. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static java.lang.Object call(java.lang.Object target, java.lang.String methName, java.lang.Object[] params, java.lang.Class[] types) throws java.lang.NoSuchMethodException, java.lang.SecurityException, java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException
target
- the object to invoke a method on.methName
- the name of the method.params
- an ordered list of the parameters passed to the method.types
- an ordered list of the parameter types on the method signature.java.lang.NoSuchMethodException
- if a matching method is not found or if the name is
"java.lang.SecurityException
- if access to the information is denied.java.lang.IllegalAccessException
- if the underlying method is inaccessible.java.lang.IllegalArgumentException
- if the number of actual and formal parameters differ,
or if an unwrapping conversion fails.java.lang.reflect.InvocationTargetException
- if the underlying method throws an exception.NullPointerException
- if the specified object is null and the method is an
instance method.ExceptionInInitializerError
- if the initialization provoked by this method fails.java.lang.Class.getMethod
,
java.lang.reflect.Method.invoke
public static DataStoreHelper createDataStoreHelper(java.lang.String dsClassName) throws javax.resource.ResourceException
dsClassName
- the name of the DataSource class.ResourceException
- if an error occurs creating the DataStoreHelper.public static final DataStoreHelper getDataStoreHelper(javax.sql.DataSource ds)
ds
- a WebSphere DataSource.public static final boolean isShareable(java.sql.Connection conn) throws java.sql.SQLException
conn
- the Connection.SQLException
- if the Connection is closed.ClassCastException
- if the Connection is not a WebSphere Connection wrapper.public static final java.lang.Object jdbcCall(java.lang.Class underlyingObjectType, java.lang.Object caller, java.lang.String methName, java.lang.Object[] args, java.lang.Class[] argTypes) throws java.sql.SQLException
Calls a non-standard-JDBC method, specific to the JDBC provider implementation class, on the underlying JDBC object corresponding to a WebSphere JDBC wrapper. This method should be used for non-JDBC methods only.
For example, if JDBC provider X provided a non-standard method on its implementation
of java.sql.Connection called countOpenStatements()
taking
two int parameters, and if a WebSphere DataSource was configured for JDBC
provider X and used to get a Connection, conn, the following could be used
to call the method and read the value returned,
|
Some WebSphere JDBC wrappers wrap multiple JDBC classes. For example, the WebSphere Connection wrapper contains a java.sql.Connection and either a javax.sql.PooledConnection or a javax.sql.XAConnection. The underlyingObjectType parameter allows for distinguishing between the multiple wrapped objects according to their interface class.
This parameter is only required when invoking a method on WebSphere wrappers containing multiple JDBC objects and requesting to invoke a method on a JDBC interface other than that of the wrapper class. In all other cases a value of null may be used, as in the above example. A second example, where the underlyingObjectType parameter is required follows,
Assume JDBC provider X provides a non-standard method on its implementation of
javax.sql.XAConnection called getTransactionStatus()
, and a
WebSphere DataSource was configured for JDBC provider X and used to get a Connection,
conn. Then the following can be used to call the method and read the value
returned,
|
As a general rule, properties which are settable on the GUI during DataSource creation are not settable through the WSCallHelper. The WSCallHelper support is intended for providing the ability to set additional properties, which are not representable on the GUI configuration.
WebSphere will allow you to set, through the GUI, any property type meeting the following criteria,
All remaining setters should be available through the WSCallHelper.
underlyingObjectType
- The interface class of the underlying JDBC object to use.
This value may be null if WebSphere wrapper wraps only one type of JDBC object or
the JDBC interface is the same as that of the WebSphere wrapper class.caller
- The WebSphere JDBC wrapper on which to call the method.methName
- name of the method to call.args
- list of method parameters.argTypes
- list of method parameter types.SQLException
- if the method call is invalid or throws a SQLException itself
during
execution. SQLException may also be thrown when the method name supplied is a
standard JDBC method.public static final void setConnectionError(java.lang.Object connHandle)
connHandle
- the Connection handle on which the error occurred.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |