some refactoring around improving compatibility testing

This commit is contained in:
Andy Taylor 2015-02-24 14:34:27 +00:00
parent 59deb85586
commit 4fcb6b4b75
3 changed files with 13 additions and 6 deletions

View File

@ -50,7 +50,7 @@ public class TCPTransportConfigurationSchema extends AbstractTransportConfigurat
@Override
protected List<TransportConfiguration> internalNewObject(URI uri, Map<String, String> query, String name) throws Exception
{
return getTransportConfigurations(uri, query, allowableProperties, name, getFactoryName());
return getTransportConfigurations(uri, query, allowableProperties, name, getFactoryName(uri));
}
@Override
@ -88,8 +88,13 @@ public class TCPTransportConfigurationSchema extends AbstractTransportConfigurat
return transportConfigurations;
}
protected String getFactoryName()
protected String getFactoryName(URI uri)
{
//here for backwards compatibility
if (uri.getPath() != null && uri.getPath().contains("hornetq"))
{
return "org.hornetq.core.remoting.impl.netty.NettyConnectorFactory";
}
return NettyConnectorFactory.class.getName();
}
}

View File

@ -16,6 +16,7 @@
*/
package org.apache.activemq.jndi;
import javax.jms.ConnectionFactory;
import javax.jms.Queue;
import javax.jms.Topic;
import javax.naming.Context;
@ -27,7 +28,6 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.activemq.api.jms.ActiveMQJMSClient;
import org.apache.activemq.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.uri.ConnectionFactoryParser;
/**
@ -60,7 +60,7 @@ public class ActiveMQInitialContextFactory implements InitialContextFactory
String jndiName = key.substring(connectionFactoryPrefix.length());
try
{
ActiveMQConnectionFactory factory = createConnectionFactory((String) environment.get(key), jndiName);
ConnectionFactory factory = createConnectionFactory((String) environment.get(key), jndiName);
data.put(jndiName, factory);
}
catch (Exception e)
@ -175,7 +175,7 @@ public class ActiveMQInitialContextFactory implements InitialContextFactory
/**
* Factory method to create a new connection factory from the given environment
*/
protected ActiveMQConnectionFactory createConnectionFactory(String uri, String name) throws Exception
protected ConnectionFactory createConnectionFactory(String uri, String name) throws Exception
{
ConnectionFactoryParser parser = new ConnectionFactoryParser();
return parser.newObject(parser.expandURI(uri), name);

View File

@ -17,6 +17,8 @@
package org.apache.activemq.uri;
import org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory;
import java.net.URI;
import java.util.Set;
/**
@ -29,7 +31,7 @@ public class TCPAcceptorTransportConfigurationSchema extends TCPTransportConfigu
super(allowableProperties);
}
public String getFactoryName()
public String getFactoryName(URI uri)
{
return NettyAcceptorFactory.class.getName();
}