ESBCOMP-89 Check if the MBean for datasource creation under GFv2 exists
parent
c3c7ebbe2f
commit
eab57bbd5a
|
@ -43,18 +43,22 @@ import javax.naming.InitialContext;
|
|||
import com.sun.jbi.engine.bpel.core.bpel.connection.ConnectionConfiguration;
|
||||
import com.sun.jbi.engine.bpel.core.bpel.exception.BPELConfigurationException;
|
||||
import com.sun.jbi.engine.bpel.util.I18n;
|
||||
import java.util.Set;
|
||||
import javax.management.MalformedObjectNameException;
|
||||
|
||||
/**
|
||||
* Implemetation of the BPEL engine com.sun.jbi.engine.bpel.core.bpel.connection.ConnectionConfiguration
|
||||
* interface. This Appserver context in which the BPEL engine resides, has the knowledge to create, configure
|
||||
* and maintain the connection pools and jdbc resources.
|
||||
* This class can be extended to implement all the connection requirements like schema creation, etc that
|
||||
* the BPEL engine needs.
|
||||
* Implemetation of the BPEL engine
|
||||
* com.sun.jbi.engine.bpel.core.bpel.connection.ConnectionConfiguration
|
||||
* interface. This Appserver context in which the BPEL engine resides, has the
|
||||
* knowledge to create, configure and maintain the connection pools and jdbc
|
||||
* resources. This class can be extended to implement all the connection
|
||||
* requirements like schema creation, etc that the BPEL engine needs.
|
||||
*
|
||||
* Currently this class is used as an user friendly utility to programmatically create connection pools and
|
||||
* resources for the the Derby DB. This is done so that a user wanting to try out the product does not have
|
||||
* to worry about these connection configurations.
|
||||
* This could be extended to all other DB that are supported with proper design.
|
||||
* Currently this class is used as an user friendly utility to programmatically
|
||||
* create connection pools and resources for the the Derby DB. This is done so
|
||||
* that a user wanting to try out the product does not have to worry about these
|
||||
* connection configurations. This could be extended to all other DB that are
|
||||
* supported with proper design.
|
||||
*
|
||||
* @author Sun Microsystems.
|
||||
*
|
||||
|
@ -70,7 +74,6 @@ public class ConnectionConfigurationImpl implements ConnectionConfiguration {
|
|||
private static final String PASSWORD = "pass2";
|
||||
private static final String SERVER_NAME = "localhost"; //default is taken as the localhost where Derby DB is running
|
||||
private static final String PORT_NUM = "1527"; // Derby DB port number (taken as the default.
|
||||
|
||||
private ComponentContext mComponentContext;
|
||||
private Properties mProperties;
|
||||
|
||||
|
@ -83,7 +86,20 @@ public class ConnectionConfigurationImpl implements ConnectionConfiguration {
|
|||
* @see com.sun.jbi.engine.bpel.core.bpel.connection.ConnectionConfiguration#createConnections()
|
||||
*/
|
||||
public void createConnectionsPools() {
|
||||
boolean mBeanAvailable = false;
|
||||
|
||||
try {
|
||||
MBeanServer mBeanServer = mComponentContext.getMBeanServer();
|
||||
|
||||
Set<ObjectName> objectNames = mBeanServer.queryNames(
|
||||
new ObjectName(RESOURCES_MBEAN_OBJ_NAME), null);
|
||||
|
||||
mBeanAvailable = !objectNames.isEmpty();
|
||||
} catch (MalformedObjectNameException ex) {
|
||||
// Nothing to do here... we are not running under Glassfish v2
|
||||
}
|
||||
|
||||
if (mBeanAvailable) {
|
||||
try {
|
||||
String nonXaJndiResName = mProperties.getProperty(DatabaseNonXAJNDIName);
|
||||
String xaJndiResName = mProperties.getProperty(DatabaseXAJNDIName);
|
||||
|
@ -104,6 +120,7 @@ public class ConnectionConfigurationImpl implements ConnectionConfiguration {
|
|||
throw new BPELConfigurationException(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.sun.jbi.engine.bpel.core.bpel.connection.ConnectionConfiguration#getNamingContext()
|
||||
|
@ -112,17 +129,18 @@ public class ConnectionConfigurationImpl implements ConnectionConfiguration {
|
|||
return mComponentContext.getNamingContext();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method creates a connection pool and a jdbc resource pointing to that pool
|
||||
* if the pool is not already created.
|
||||
* Use non public, non published apis to lookup and create the pools and resources.
|
||||
* Hence it is liable to change as and when the api's change.
|
||||
* This method creates a connection pool and a jdbc resource pointing to
|
||||
* that pool if the pool is not already created. Use non public, non
|
||||
* published apis to lookup and create the pools and resources. Hence it is
|
||||
* liable to change as and when the api's change.
|
||||
*
|
||||
* @param connPoolName, String value for the connection pool name.
|
||||
* @param jndiResName, String value for the Jdbc jndi resource name.
|
||||
* @param dataSrcClassName, String value of the actual datasource class name.
|
||||
* @param resourceType, String value of the resource type. ex: javax.sql.DataSource
|
||||
* @param dataSrcClassName, String value of the actual datasource class
|
||||
* name.
|
||||
* @param resourceType, String value of the resource type. ex:
|
||||
* javax.sql.DataSource
|
||||
* @param isXA, boolean value indicating if this is a XA connection
|
||||
* @throws Exception
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue