Search in sources :

Example 1 with TomEEConnectionFactory

use of org.apache.openejb.resource.activemq.jms2.TomEEConnectionFactory in project tomee by apache.

the class ActiveMQResourceAdapter method createConnectionFactory.

@Override
protected ActiveMQConnectionFactory createConnectionFactory(final ActiveMQConnectionRequestInfo connectionRequestInfo, final MessageActivationSpec activationSpec) {
    if (TomEEMessageActivationSpec.class.isInstance(activationSpec)) {
        final TomEEMessageActivationSpec s = TomEEMessageActivationSpec.class.cast(activationSpec);
        if (s.getConnectionFactoryLookup() != null) {
            try {
                final Object lookup = SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext().lookup("openejb:Resource/" + s.getConnectionFactoryLookup());
                if (ActiveMQConnectionFactory.class.isInstance(lookup)) {
                    return ActiveMQConnectionFactory.class.cast(lookup);
                }
                // already handled
                return ActiveMQConnectionFactory.class.cast(lookup);
            } catch (final NamingException e) {
                throw new IllegalArgumentException("");
            }
        }
    }
    final ActiveMQConnectionFactory factory = new TomEEConnectionFactory();
    connectionRequestInfo.configure(factory, activationSpec);
    return factory;
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) TomEEConnectionFactory(org.apache.openejb.resource.activemq.jms2.TomEEConnectionFactory) NamingException(javax.naming.NamingException)

Aggregations

NamingException (javax.naming.NamingException)1 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)1 TomEEConnectionFactory (org.apache.openejb.resource.activemq.jms2.TomEEConnectionFactory)1