public static ActiveResourceAdapter | createActiveResourceAdapter(com.sun.enterprise.deployment.ConnectorDescriptor cd, java.lang.String moduleName, java.lang.ClassLoader loader)Creates an active resource adapter.
ActiveResourceAdapter activeResourceAdapter = null;
int environment = ConnectorRuntime.getRuntime().getEnviron();
ResourceAdapter ra = null;
String raClass = cd.getResourceAdapterClass();
try {
// If raClass is available, load it...
if (raClass != null && !raClass.equals("")) {
if(environment == ConnectorRuntime.SERVER) {
ra = (ResourceAdapter)
loader.loadClass(raClass).newInstance();
} else {
ra = (ResourceAdapter)Class.forName(raClass).newInstance();
}
}
/*
* If any special handling is required for the system resource
* adapter, then ActiveResourceAdapter implementation for that
* RA should implement additional functionality by extending
* ActiveInboundResourceAdapter or ActiveOutboundResourceAdapter.
*
* For example ActiveJmsResourceAdapter extends
* ActiveInboundResourceAdapter.
*/
if (moduleName.equals(ConnectorConstants.DEFAULT_JMS_ADAPTER)) {
// Upgrade jms resource adapter, if necessary before starting
// the RA.
try {
JmsRaUtil raUtil = new JmsRaUtil();
raUtil.upgradeIfNecessary();
}
catch (Throwable t) {
_logger.log(Level.FINE,"Cannot upgrade jmsra"+ t.getMessage());
}
activeResourceAdapter = new ActiveJmsResourceAdapter(
ra,cd,moduleName,loader);
} else if (raClass.equals("")) {
activeResourceAdapter = new ActiveOutboundResourceAdapter(
cd,moduleName,loader);
} else {
activeResourceAdapter = new ActiveInboundResourceAdapter(
ra,cd,moduleName,loader);
}
} catch (ClassNotFoundException Ex) {
ConnectorRuntimeException cre = new ConnectorRuntimeException(
"Error in creating active RAR");
cre.initCause(Ex);
_logger.log(Level.SEVERE,"rardeployment.class_not_found",raClass);
_logger.log(Level.SEVERE,"",cre);
throw cre;
} catch (InstantiationException Ex) {
ConnectorRuntimeException cre = new ConnectorRuntimeException(
"Error in creating active RAR");
cre.initCause(Ex);
_logger.log(Level.SEVERE,"rardeployment.class_instantiation_error",
raClass);
_logger.log(Level.SEVERE,"",cre);
throw cre;
} catch (IllegalAccessException Ex) {
ConnectorRuntimeException cre = new ConnectorRuntimeException(
"Error in creating active RAR");
cre.initCause(Ex);
_logger.log(Level.SEVERE,"rardeployment.illegalaccess_error",
raClass);
_logger.log(Level.SEVERE,"",cre);
throw cre;
}
return activeResourceAdapter;
|