Example usage for javax.jms ConnectionFactory toString

List of usage examples for javax.jms ConnectionFactory toString

Introduction

In this page you can find the example usage for javax.jms ConnectionFactory toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:nl.nn.adapterframework.jms.JmsMessagingSourceFactory.java

protected ConnectionFactory createConnectionFactory(Context context, String cfName, boolean createDestination,
        boolean useJms102) throws IbisException {
    ConnectionFactory connectionFactory;
    if (jmsFacade.getProxiedConnectionFactories() != null
            && jmsFacade.getProxiedConnectionFactories().containsKey(cfName)) {
        log.debug(jmsFacade.getLogPrefix() + "looking up proxied connection factory [" + cfName + "]");
        connectionFactory = jmsFacade.getProxiedConnectionFactories().get(cfName);
    } else {/*from   w ww  .  j a  v a 2  s.  c om*/
        String prefixedCfName = jmsFacade.getJndiContextPrefix() + cfName;
        log.debug(jmsFacade.getLogPrefix() + "looking up connection factory [" + prefixedCfName + "]");
        if (StringUtils.isNotEmpty(jmsFacade.getJndiContextPrefix())) {
            log.debug(jmsFacade.getLogPrefix() + "using JNDI context prefix ["
                    + jmsFacade.getJndiContextPrefix() + "]");
        }
        try {
            connectionFactory = (ConnectionFactory) getContext().lookup(prefixedCfName);
        } catch (NamingException e) {
            throw new JmsException("Could not find connection factory [" + prefixedCfName + "]", e);
        }
    }
    if (connectionFactory == null) {
        throw new JmsException("Could not find connection factory [" + cfName + "]");
    }
    // wrap ConnectionFactory, to work around bug in JMSQueueConnectionFactoryHandle in combination with Spring
    // see http://forum.springsource.org/archive/index.php/t-43700.html
    if (jmsFacade.useJms102()) {
        if (connectionFactory instanceof QueueConnectionFactory) {
            connectionFactory = new QueueConnectionFactoryWrapper((QueueConnectionFactory) connectionFactory);
        } else if (connectionFactory instanceof TopicConnectionFactory) {
            connectionFactory = new TopicConnectionFactoryWrapper((TopicConnectionFactory) connectionFactory);
        }
    } else {
        connectionFactory = new ConnectionFactoryWrapper(connectionFactory);
    }
    String connectionFactoryInfo = getConnectionFactoryInfo(connectionFactory);
    if (connectionFactoryInfo == null) {
        connectionFactoryInfo = connectionFactory.toString();
    }
    log.info(jmsFacade.getLogPrefix() + "looked up connection factory [" + cfName + "]: ["
            + connectionFactoryInfo + "]");
    return connectionFactory;
}