return connectionFactory;
}
private ActiveMQConnectionFactory createActiveMQConnectionFactory(PortletRequest portletRequest, JMSDestinationInfo destinationInfo) throws JMSException {
try {
Kernel kernel = PortletManager.getKernel();
ResourceAdapterModule resourceAdapterModule = (ResourceAdapterModule) PortletManager.getManagementHelper(portletRequest).getObject(destinationInfo.getResourceAdapterModuleAbName());
AbstractName resourceAdapterAbstractName = PortletManager.getNameFor(portletRequest, resourceAdapterModule.getResourceAdapterInstances()[0].getJCAResourceImplementations()[0]
.getResourceAdapterInstances()[0]);
if (kernel.isRunning(resourceAdapterAbstractName)) {
String serverUrl = (String) kernel.getAttribute(resourceAdapterAbstractName, "ServerUrl");
String userName = (String) kernel.getAttribute(resourceAdapterAbstractName, "UserName");
String password = (String) kernel.getAttribute(resourceAdapterAbstractName, "Password");
return new ActiveMQConnectionFactory(userName, password, serverUrl);
}
throw new JMSException("Fail to create ActiveMQConnectionFactory for the resource adapter module is not in running status");
} catch (JMSException e) {
throw e;