activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: svn commit: r418212 - /incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/SwiftMQPojoSPI.java
Date Fri, 30 Jun 2006 15:02:47 GMT
Where's the Apache copyright header?

Also I'm not sure if we can include support for JBoss & SwiftMQ to the
m2 performance plugin. These would have have to be hosted outside of
Apache AFAIK such as maybe in the Mojo project.


On 6/30/06, jgapuz@apache.org <jgapuz@apache.org> wrote:
> Author: jgapuz
> Date: Fri Jun 30 02:31:41 2006
> New Revision: 418212
>
> URL: http://svn.apache.org/viewvc?rev=418212&view=rev
> Log:
> added to support SwiftMQ.
>
> Added:
>     incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/SwiftMQPojoSPI.java
>
> Added: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/SwiftMQPojoSPI.java
> URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/SwiftMQPojoSPI.java?rev=418212&view=auto
> ==============================================================================
> --- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/SwiftMQPojoSPI.java
(added)
> +++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/SwiftMQPojoSPI.java
Fri Jun 30 02:31:41 2006
> @@ -0,0 +1,57 @@
> +package org.apache.activemq.tool.spi;
> +
> +import javax.jms.ConnectionFactory;
> +import javax.jms.JMSException;
> +import javax.naming.InitialContext;
> +import javax.naming.Context;
> +import javax.naming.NamingException;
> +import java.util.Properties;
> +
> +
> +public class SwiftMQPojoSPI extends ClassLoaderSPIConnectionFactory {
> +    public static final String KEY_BROKER_URL = "brokerUrl";
> +    public static final String KEY_DEST_TYPE = "destType";
> +    public static final String DEFAULT_URL = "smqp://localhost:4001";
> +    public static final String SWIFTMQ_CONTEXT = "com.swiftmq.jndi.InitialContextFactoryImpl";
> +    public static final String SMQP = "com.swiftmq.jms.smqp";
> +
> +    protected ConnectionFactory instantiateConnectionFactory(Properties settings) throws
Exception {
> +        String destType = settings.getProperty(KEY_DEST_TYPE);
> +        ConnectionFactory factory;
> +
> +        InitialContext context = getInitialContext(settings);
> +
> +        if (destType != null && destType == "queue") {
> +            factory = (ConnectionFactory) context.lookup("QueueConnectionFactory");
> +        } else {
> +            factory = (ConnectionFactory) context.lookup("TopicConnectionFactory");
> +        }
> +
> +        return factory;
> +    }
> +
> +    public void configureConnectionFactory(ConnectionFactory jmsFactory, Properties
settings) throws Exception {
> +        //To change body of implemented methods use File | Settings | File Templates.
> +    }
> +
> +    public InitialContext getInitialContext(Properties settings) throws Exception {
> +        String url = settings.getProperty(KEY_BROKER_URL);
> +
> +        Properties properties = new Properties();
> +        properties.put(Context.INITIAL_CONTEXT_FACTORY, SWIFTMQ_CONTEXT);
> +        properties.put(Context.URL_PKG_PREFIXES, SMQP);
> +
> +        if (url != null && url.length() > 0) {
> +            properties.put(Context.PROVIDER_URL, url);
> +        } else {
> +            properties.put(Context.PROVIDER_URL, DEFAULT_URL);
> +        }
> +
> +        try {
> +            return new InitialContext(properties);
> +        } catch (NamingException e) {
> +            throw new JMSException("Error creating InitialContext ", e.toString());
> +        }
> +    }
> +
> +}
>
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/

Mime
View raw message