From b24d72900bf1b2bda18212f2ea99cce5ad23af20 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Fri, 12 Dec 2014 14:01:48 -0500 Subject: [PATCH] ACTIVEMQ6-7 - Improve Serialization on Connection Factory https://issues.apache.org/jira/browse/ACTIVEMQ6-7 --- activemq-commons/pom.xml | 4 + .../apache/activemq/utils/uri/URIFactory.java | 70 ++++++ .../apache/activemq/utils/uri/URISchema.java | 188 ++++++++++++++ .../apache/activemq/utils/URIParserTest.java | 237 ++++++++++++++++++ .../core/client/ActiveMQClientLogger.java | 4 + .../client/impl/ClientSessionFactoryImpl.java | 14 -- .../remoting/impl/netty/NettyConnector.java | 58 ++--- .../impl/netty/NettyConnectorFactory.java | 6 - .../impl/netty/TransportConstants.java | 67 ++--- .../spi/core/remoting/ConnectorFactory.java | 10 - activemq-jms-client/pom.xml | 7 + .../jndi/ActiveMQInitialContextFactory.java | 6 +- .../apache/activemq/uri/AbstractCFSchema.java | 45 ++++ .../activemq/uri/ConnectionFactoryParser.java | 34 +++ .../activemq/uri/ConnectionOptions.java | 120 +++++++++ .../apache/activemq/uri/JGroupsSchema.java | 69 +++++ .../org/apache/activemq/uri/UDPSchema.java | 65 +++++ .../uri/ConnectionFactoryURITest.java | 60 +++++ .../impl/invm/InVMAcceptorFactory.java | 6 - .../impl/invm/InVMConnectorFactory.java | 5 - .../impl/invm/TransportConstants.java | 25 +- .../impl/netty/NettyAcceptorFactory.java | 5 - .../spi/core/remoting/AcceptorFactory.java | 8 - pom.xml | 7 + .../integration/jms/SimpleJNDIClientTest.java | 2 +- 25 files changed, 979 insertions(+), 143 deletions(-) create mode 100644 activemq-commons/src/main/java/org/apache/activemq/utils/uri/URIFactory.java create mode 100644 activemq-commons/src/main/java/org/apache/activemq/utils/uri/URISchema.java create mode 100644 activemq-commons/src/test/java/org/apache/activemq/utils/URIParserTest.java create mode 100644 activemq-jms-client/src/main/java/org/apache/activemq/uri/AbstractCFSchema.java create mode 100644 activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionFactoryParser.java create mode 100644 activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionOptions.java create mode 100644 activemq-jms-client/src/main/java/org/apache/activemq/uri/JGroupsSchema.java create mode 100644 activemq-jms-client/src/main/java/org/apache/activemq/uri/UDPSchema.java create mode 100644 activemq-jms-client/src/test/java/org/apache/activemq/uri/ConnectionFactoryURITest.java diff --git a/activemq-commons/pom.xml b/activemq-commons/pom.xml index f2aa75166e..4f15126e9d 100644 --- a/activemq-commons/pom.xml +++ b/activemq-commons/pom.xml @@ -45,6 +45,10 @@ io.netty netty-all + + commons-beanutils + commons-beanutils + junit junit diff --git a/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URIFactory.java b/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URIFactory.java new file mode 100644 index 0000000000..4bc5fa457c --- /dev/null +++ b/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URIFactory.java @@ -0,0 +1,70 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.utils.uri; + +import java.net.URI; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * @author clebertsuconic + */ + +public class URIFactory +{ + + private URI defaultURI; + + private final Map> schemas = new ConcurrentHashMap<>(); + + public URI getDefaultURI() + { + return defaultURI; + } + + public void setDefaultURI(URI uri) + { + this.defaultURI = uri; + } + + public void registerSchema(URISchema schemaFactory) + { + schemas.put(schemaFactory.getSchemaName(), schemaFactory); + schemaFactory.setFactory(this); + } + + public void removeSchema(final String schemaName) + { + schemas.remove(schemaName); + } + + public T newObject(URI uri) throws Exception + { + URISchema schemaFactory = schemas.get(uri.getScheme()); + + if (schemaFactory == null) + { + throw new NullPointerException("Schema " + uri.getScheme() + " not found"); + } + + + return schemaFactory.newObject(uri); + } + + +} diff --git a/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URISchema.java b/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URISchema.java new file mode 100644 index 0000000000..4226d710f1 --- /dev/null +++ b/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URISchema.java @@ -0,0 +1,188 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.utils.uri; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URLDecoder; +import java.util.HashMap; +import java.util.Map; + +import org.apache.commons.beanutils.BeanUtilsBean; +import org.apache.commons.beanutils.FluentPropertyBeanIntrospector; + +/** + * @author clebertsuconic + */ + +public abstract class URISchema +{ + public abstract String getSchemaName(); + + public T newObject(URI uri) throws Exception + { + return newObject(uri, null); + } + + private URIFactory parentFactory; + + + void setFactory(URIFactory factory) + { + this.parentFactory = parentFactory; + } + + protected URIFactory getFactory() + { + return parentFactory; + } + + + protected String getHost(URI uri) + { + URI defaultFactory = getDefaultURI(); + if (defaultFactory != null && uri.getHost() == null && defaultFactory.getScheme().equals(uri.getScheme())) + { + uri = defaultFactory; + } + return uri.getHost(); + } + + protected URI getDefaultURI() + { + URIFactory factory = getFactory(); + if (factory == null) + { + return null; + } + else + { + return factory.getDefaultURI(); + } + } + + protected int getPort(URI uri) + { + URI defaultFactory = getDefaultURI(); + if (defaultFactory != null && uri.getPort() < 0 && defaultFactory.getScheme().equals(uri.getScheme())) + { + uri = defaultFactory; + } + return uri.getPort(); + } + + /** + * It will create a new Object for the URI selected schema. + * the propertyOverrides is used to replace whatever was defined on the URL string + * @param uri + * @param propertyOverrides + * @return + * @throws Exception + */ + public T newObject(URI uri, Map propertyOverrides) throws Exception + { + return internalNewObject(uri, parseQuery(uri.getQuery(), propertyOverrides)); + } + + protected abstract T internalNewObject(URI uri, Map query) throws Exception; + + private static final BeanUtilsBean beanUtils = new BeanUtilsBean(); + + + static + { + // This is to customize the BeanUtils to use Fluent Proeprties as well + beanUtils.getPropertyUtils().addBeanIntrospector(new FluentPropertyBeanIntrospector()); + } + + + public static Map parseQuery(String uri, Map propertyOverrides) throws URISyntaxException + { + try + { + Map rc = new HashMap(); + if (uri != null && !uri.isEmpty()) + { + String[] parameters = uri.split("&"); + for (int i = 0; i < parameters.length; i++) + { + int p = parameters[i].indexOf("="); + if (p >= 0) + { + String name = URLDecoder.decode(parameters[i].substring(0, p), "UTF-8"); + String value = URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8"); + rc.put(name, value); + } + else + { + rc.put(parameters[i], null); + } + } + } + + if (propertyOverrides != null) + { + for (Map.Entry entry: propertyOverrides.entrySet()) + { + rc.put(entry.getKey(), entry.getValue()); + } + } + return rc; + } + catch (UnsupportedEncodingException e) + { + throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e); + } + } + + + + protected String printQuery(Map query) + { + StringBuffer buffer = new StringBuffer(); + for (Map.Entry entry : query.entrySet()) + { + buffer.append(entry.getKey() + "=" + entry.getValue()); + buffer.append("\n"); + } + + return buffer.toString(); + } + + protected static

P copyData(P source, P target) throws Exception + { + synchronized (beanUtils) + { + beanUtils.copyProperties(source, target); + } + return target; + } + + protected static

P setData(URI uri, P obj, Map query) throws Exception + { + synchronized (beanUtils) + { + beanUtils.setProperty(obj, "host", uri.getHost()); + beanUtils.setProperty(obj, "port", uri.getPort()); + beanUtils.setProperty(obj, "userInfo", uri.getUserInfo()); + beanUtils.populate(obj, query); + } + return obj; + } +} diff --git a/activemq-commons/src/test/java/org/apache/activemq/utils/URIParserTest.java b/activemq-commons/src/test/java/org/apache/activemq/utils/URIParserTest.java new file mode 100644 index 0000000000..be389c6457 --- /dev/null +++ b/activemq-commons/src/test/java/org/apache/activemq/utils/URIParserTest.java @@ -0,0 +1,237 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.utils; + +import org.apache.activemq.utils.uri.URIFactory; +import org.apache.activemq.utils.uri.URISchema; +import org.junit.Assert; +import org.junit.Test; + +import java.net.URI; +import java.util.Map; + +/** + * @author clebertsuconic + */ + +public class URIParserTest +{ + + /** + * this is just a simple test to validate the model + * + * @throws Throwable + */ + @Test + public void testSchemaFruit() throws Throwable + { + FruitParser parser = new FruitParser(); + Fruit fruit = (Fruit)parser.newObject(new URI("fruit://some:guy@fair-market:3030?color=green&fluentName=something")); + + Assert.assertEquals("fruit", fruit.getName()); + Assert.assertEquals(3030, fruit.getPort()); + Assert.assertEquals("fair-market", fruit.getHost()); + Assert.assertEquals("some:guy", fruit.getUserInfo()); + Assert.assertEquals("green", fruit.getColor()); + Assert.assertEquals("something", fruit.getFluentName()); + + + } + + /** + * Even thought there's no host Poperty on FruitBase.. this should still work fine without throwing any exceptions + * + * @throws Throwable + */ + @Test + public void testSchemaNoHosPropertyt() throws Throwable + { + FruitParser parser = new FruitParser(); + FruitBase fruit = parser.newObject(new URI("base://some:guy@fair-market:3030?color=green&fluentName=something")); + Assert.assertEquals("base", fruit.getName()); + Assert.assertEquals("green", fruit.getColor()); + Assert.assertEquals("something", fruit.getFluentName()); + } + + /** + * Even thought there's no host Poperty on FruitBase.. this should still work fine without throwing any exceptions + * + * @throws Throwable + */ + @Test + public void testSchemaNoHostOnURL() throws Throwable + { + FruitParser parser = new FruitParser(); + Fruit fruit = (Fruit)parser.newObject(new URI("fruit://some:guy@port?color=green&fluentName=something")); + + System.out.println("fruit:" + fruit); + Assert.assertEquals("fruit", fruit.getName()); + Assert.assertEquals("green", fruit.getColor()); + Assert.assertEquals("something", fruit.getFluentName()); + } + + + class FruitParser extends URIFactory + { + FruitParser() + { + this.registerSchema(new FruitSchema()); + this.registerSchema(new FruitBaseSchema()); + } + } + + class FruitSchema extends URISchema + { + @Override + public String getSchemaName() + { + return "fruit"; + } + + + @Override + public FruitBase internalNewObject(URI uri, Map query) throws Exception + { + return setData(uri, new Fruit(getSchemaName()), query); + } + } + + class FruitBaseSchema extends URISchema + { + @Override + public String getSchemaName() + { + return "base"; + } + + + @Override + public FruitBase internalNewObject(URI uri, Map query) throws Exception + { + return setData(uri, new FruitBase(getSchemaName()), query); + } + } + + + public static class FruitBase + { + final String name; + String fluentName; + String color; + + FruitBase(final String name) + { + this.name = name; + } + + + public String getName() + { + return name; + } + + + public String getColor() + { + return color; + } + + public void setColor(String color) + { + this.color = color; + } + + public String getFluentName() + { + return fluentName; + } + + public FruitBase setFluentName(String name) + { + this.fluentName = name; + + return this; + } + + @Override + public String toString() + { + return "FruitBase{" + + "name='" + name + '\'' + + ", fluentName='" + fluentName + '\'' + + ", color='" + color + '\'' + + '}'; + } + } + + public static class Fruit extends FruitBase + { + + + public Fruit(String name) + { + super(name); + } + + String host; + int port; + String userInfo; + + + + public void setHost(String host) + { + this.host = host; + } + + public String getHost() + { + return host; + } + + public void setPort(int port) + { + this.port = port; + } + + public int getPort() + { + return port; + } + + public void setUserInfo(String userInfo) + { + this.userInfo = userInfo; + } + + public String getUserInfo() + { + return userInfo; + } + + @Override + public String toString() + { + return "Fruit{" + + "host='" + host + '\'' + + ", port=" + port + + ", userInfo='" + userInfo + '\'' + + "super=" + super.toString() + '}'; + } + } +} diff --git a/activemq-core-client/src/main/java/org/apache/activemq/core/client/ActiveMQClientLogger.java b/activemq-core-client/src/main/java/org/apache/activemq/core/client/ActiveMQClientLogger.java index 4acf387a31..ae78db7890 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/core/client/ActiveMQClientLogger.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/core/client/ActiveMQClientLogger.java @@ -416,4 +416,8 @@ public interface ActiveMQClientLogger extends BasicLogger @LogMessage(level = Logger.Level.ERROR) @Message(id = 214024, value = "HTTP upgrade not supported by remote acceptor") void httpUpgradeNotSupportedByRemoteAcceptor(); + + @LogMessage(level = Logger.Level.ERROR) + @Message(id = 214025, value = "Invalid type {0}, Using default connection factory at {1}", format = Message.Format.MESSAGE_FORMAT) + void invalidCFType(String type, String uri); } diff --git a/activemq-core-client/src/main/java/org/apache/activemq/core/client/impl/ClientSessionFactoryImpl.java b/activemq-core-client/src/main/java/org/apache/activemq/core/client/impl/ClientSessionFactoryImpl.java index e7a37a20ff..07aafcc6b5 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/core/client/impl/ClientSessionFactoryImpl.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/core/client/impl/ClientSessionFactoryImpl.java @@ -60,7 +60,6 @@ import org.apache.activemq.spi.core.remoting.TopologyResponseHandler; import org.apache.activemq.spi.core.remoting.SessionContext; import org.apache.activemq.utils.ClassloadingUtil; import org.apache.activemq.utils.ConcurrentHashSet; -import org.apache.activemq.utils.ConfigurationHelper; import org.apache.activemq.utils.ConfirmationWindowWarning; import org.apache.activemq.utils.ExecutorFactory; import org.apache.activemq.utils.OrderedExecutorFactory; @@ -1265,19 +1264,6 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C private void checkTransportKeys(final ConnectorFactory factory, final TransportConfiguration tc) { - if (tc.getParams() != null) - { - Set invalid = ConfigurationHelper.checkKeys(factory.getAllowableProperties(), tc.getParams().keySet()); - - if (!invalid.isEmpty()) - { - String msg = "The following keys are invalid for configuring a connector: " + - ConfigurationHelper.stringSetToCommaListString(invalid); - - throw new IllegalStateException(msg); - - } - } } /** diff --git a/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyConnector.java b/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyConnector.java index 3ed9e879cf..34a532b913 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyConnector.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyConnector.java @@ -163,66 +163,66 @@ public class NettyConnector extends AbstractConnector private final ConnectionLifeCycleListener listener; - private final boolean sslEnabled; + private boolean sslEnabled = TransportConstants.DEFAULT_SSL_ENABLED; - private final boolean httpEnabled; + private boolean httpEnabled; - private final long httpMaxClientIdleTime; + private long httpMaxClientIdleTime; - private final long httpClientIdleScanPeriod; + private long httpClientIdleScanPeriod; - private final boolean httpRequiresSessionId; + private boolean httpRequiresSessionId; // if true, after the connection, the connector will send // a HTTP GET request (+ Upgrade: activemq-remoting) that // will be handled by the server's http server. - private final boolean httpUpgradeEnabled; + private boolean httpUpgradeEnabled; - private final boolean useServlet; + private boolean useServlet; - private final String host; + private String host; - private final int port; + private int port; - private final String localAddress; + private String localAddress; - private final int localPort; + private int localPort; - private final String keyStoreProvider; + private String keyStoreProvider; - private final String keyStorePath; + private String keyStorePath; - private final String keyStorePassword; + private String keyStorePassword; - private final String trustStoreProvider; + private String trustStoreProvider; - private final String trustStorePath; + private String trustStorePath; - private final String trustStorePassword; + private String trustStorePassword; - private final String enabledCipherSuites; + private String enabledCipherSuites; - private final String enabledProtocols; + private String enabledProtocols; - private final boolean tcpNoDelay; + private boolean tcpNoDelay; - private final int tcpSendBufferSize; + private int tcpSendBufferSize; - private final int tcpReceiveBufferSize; + private int tcpReceiveBufferSize; - private final long batchDelay; + private long batchDelay; - private final ConcurrentMap connections = new ConcurrentHashMap(); + private ConcurrentMap connections = new ConcurrentHashMap(); - private final String servletPath; + private String servletPath; - private final int nioRemotingThreads; + private int nioRemotingThreads; - private final boolean useNioGlobalWorkerPool; + private boolean useNioGlobalWorkerPool; - private final ScheduledExecutorService scheduledThreadPool; + private ScheduledExecutorService scheduledThreadPool; - private final Executor closeExecutor; + private Executor closeExecutor; private BatchFlusher flusher; diff --git a/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyConnectorFactory.java b/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyConnectorFactory.java index 213aecc4de..d7d8dce79f 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyConnectorFactory.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyConnectorFactory.java @@ -17,7 +17,6 @@ package org.apache.activemq.core.remoting.impl.netty; import java.util.Map; -import java.util.Set; import java.util.concurrent.Executor; import java.util.concurrent.ScheduledExecutorService; @@ -46,11 +45,6 @@ public class NettyConnectorFactory implements ConnectorFactory return new NettyConnector(configuration, handler, listener, closeExecutor, threadPool, scheduledThreadPool); } - public Set getAllowableProperties() - { - return TransportConstants.ALLOWABLE_CONNECTOR_KEYS; - } - @Override public boolean isReliable() { diff --git a/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/TransportConstants.java b/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/TransportConstants.java index 36033a12bc..f7aeb35d2f 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/TransportConstants.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/TransportConstants.java @@ -27,36 +27,37 @@ import org.apache.activemq.api.config.ActiveMQDefaultConfiguration; * A TransportConstants * * @author Tim Fox + * @author ClebertSuconic */ public class TransportConstants { - public static final String SSL_ENABLED_PROP_NAME = "ssl-enabled"; + public static final String SSL_ENABLED_PROP_NAME = "sslEnabled"; - public static final String HTTP_ENABLED_PROP_NAME = "http-enabled"; + public static final String HTTP_ENABLED_PROP_NAME = "httpEnabled"; - public static final String HTTP_CLIENT_IDLE_PROP_NAME = "http-client-idle-time"; + public static final String HTTP_CLIENT_IDLE_PROP_NAME = "httpClientIdleTime"; - public static final String HTTP_CLIENT_IDLE_SCAN_PERIOD = "http-client-idle-scan-period"; + public static final String HTTP_CLIENT_IDLE_SCAN_PERIOD = "httpClientIdleScanPeriod"; - public static final String HTTP_RESPONSE_TIME_PROP_NAME = "http-response-time"; + public static final String HTTP_RESPONSE_TIME_PROP_NAME = "httpResponseTime"; - public static final String HTTP_SERVER_SCAN_PERIOD_PROP_NAME = "http-server-scan-period"; + public static final String HTTP_SERVER_SCAN_PERIOD_PROP_NAME = "httpServerScanPeriod"; - public static final String HTTP_REQUIRES_SESSION_ID = "http-requires-session-id"; + public static final String HTTP_REQUIRES_SESSION_ID = "httpRequiresSessionId"; - public static final String HTTP_UPGRADE_ENABLED_PROP_NAME = "http-upgrade-enabled"; + public static final String HTTP_UPGRADE_ENABLED_PROP_NAME = "httpUpgradeEnabled"; - public static final String HTTP_UPGRADE_ENDPOINT_PROP_NAME = "http-upgrade-endpoint"; + public static final String HTTP_UPGRADE_ENDPOINT_PROP_NAME = "httpPpgradeEndpoint"; - public static final String USE_SERVLET_PROP_NAME = "use-servlet"; + public static final String USE_SERVLET_PROP_NAME = "useServlet"; - public static final String SERVLET_PATH = "servlet-path"; + public static final String SERVLET_PATH = "servletPath"; - public static final String USE_NIO_PROP_NAME = "use-nio"; + public static final String USE_NIO_PROP_NAME = "useNio"; - public static final String USE_NIO_GLOBAL_WORKER_POOL_PROP_NAME = "use-nio-global-worker-pool"; + public static final String USE_NIO_GLOBAL_WORKER_POOL_PROP_NAME = "useNioGlobalWorkerPool"; - public static final String USE_INVM_PROP_NAME = "use-invm"; + public static final String USE_INVM_PROP_NAME = "useInvm"; public static final String PROTOCOL_PROP_NAME = "protocol"; @@ -66,27 +67,27 @@ public class TransportConstants public static final String PORT_PROP_NAME = "port"; - public static final String LOCAL_ADDRESS_PROP_NAME = "local-address"; + public static final String LOCAL_ADDRESS_PROP_NAME = "localAddress"; - public static final String LOCAL_PORT_PROP_NAME = "local-port"; + public static final String LOCAL_PORT_PROP_NAME = "localPort"; - public static final String KEYSTORE_PROVIDER_PROP_NAME = "key-store-provider"; + public static final String KEYSTORE_PROVIDER_PROP_NAME = "keyStoreProvider"; - public static final String KEYSTORE_PATH_PROP_NAME = "key-store-path"; + public static final String KEYSTORE_PATH_PROP_NAME = "keyStorePath"; - public static final String KEYSTORE_PASSWORD_PROP_NAME = "key-store-password"; + public static final String KEYSTORE_PASSWORD_PROP_NAME = "keyStorePassword"; - public static final String TRUSTSTORE_PROVIDER_PROP_NAME = "trust-store-provider"; + public static final String TRUSTSTORE_PROVIDER_PROP_NAME = "trustStoreProvider"; - public static final String TRUSTSTORE_PATH_PROP_NAME = "trust-store-path"; + public static final String TRUSTSTORE_PATH_PROP_NAME = "trustStorePath"; - public static final String TRUSTSTORE_PASSWORD_PROP_NAME = "trust-store-password"; + public static final String TRUSTSTORE_PASSWORD_PROP_NAME = "trustStorePassword"; - public static final String ENABLED_CIPHER_SUITES_PROP_NAME = "enabled-cipher-suites"; + public static final String ENABLED_CIPHER_SUITES_PROP_NAME = "enabledCipherSuites"; - public static final String ENABLED_PROTOCOLS_PROP_NAME = "enabled-protocols"; + public static final String ENABLED_PROTOCOLS_PROP_NAME = "enabledProtocols"; - public static final String NEED_CLIENT_AUTH_PROP_NAME = "need-client-auth"; + public static final String NEED_CLIENT_AUTH_PROP_NAME = "needClientAuth"; public static final String BACKLOG_PROP_NAME = "backlog"; @@ -102,21 +103,21 @@ public class TransportConstants * @see Oracle * doc on tcpNoDelay */ - public static final String TCP_NODELAY_PROPNAME = "tcp-no-delay"; + public static final String TCP_NODELAY_PROPNAME = "tcpNoDelay"; - public static final String TCP_SENDBUFFER_SIZE_PROPNAME = "tcp-send-buffer-size"; + public static final String TCP_SENDBUFFER_SIZE_PROPNAME = "tcpSendBufferSize"; - public static final String TCP_RECEIVEBUFFER_SIZE_PROPNAME = "tcp-receive-buffer-size"; + public static final String TCP_RECEIVEBUFFER_SIZE_PROPNAME = "tcpReceiveBufferSize"; - public static final String NIO_REMOTING_THREADS_PROPNAME = "nio-remoting-threads"; + public static final String NIO_REMOTING_THREADS_PROPNAME = "nioRemotingThreads"; - public static final String BATCH_DELAY = "batch-delay"; + public static final String BATCH_DELAY = "batchDelay"; - public static final String DIRECT_DELIVER = "direct-deliver"; + public static final String DIRECT_DELIVER = "directDeliver"; - public static final String CLUSTER_CONNECTION = "cluster-connection"; + public static final String CLUSTER_CONNECTION = "clusterConnection"; - public static final String STOMP_CONSUMERS_CREDIT = "stomp-consumer-credits"; + public static final String STOMP_CONSUMERS_CREDIT = "stompConsumerCredits"; public static final int STOMP_DEFAULT_CONSUMERS_CREDIT = 10 * 1024; // 10K diff --git a/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/ConnectorFactory.java b/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/ConnectorFactory.java index 806a138895..2afd9122f8 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/ConnectorFactory.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/ConnectorFactory.java @@ -17,7 +17,6 @@ package org.apache.activemq.spi.core.remoting; import java.util.Map; -import java.util.Set; import java.util.concurrent.Executor; import java.util.concurrent.ScheduledExecutorService; @@ -51,15 +50,6 @@ public interface ConnectorFactory extends TransportConfigurationHelper ScheduledExecutorService scheduledThreadPool, ClientProtocolManager protocolManager); - /** - * Returns the allowable properties for this connector. - *

- * This will differ between different connector implementations. - * - * @return the allowable properties. - */ - Set getAllowableProperties(); - /** * Indicates if connectors from this factory are reliable or not. If a connector is reliable then connection * monitoring (i.e. pings/pongs) will be disabled. diff --git a/activemq-jms-client/pom.xml b/activemq-jms-client/pom.xml index 2949d63bde..c40729ac29 100644 --- a/activemq-jms-client/pom.xml +++ b/activemq-jms-client/pom.xml @@ -50,6 +50,13 @@ javax.inject javax.inject + + + junit + junit + test + + diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java index 18b145dc58..a600b31c84 100644 --- a/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java +++ b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java @@ -60,8 +60,8 @@ import org.apache.activemq.jms.client.ActiveMQConnectionFactory; public class ActiveMQInitialContextFactory implements InitialContextFactory { public static final String CONNECTION_FACTORY_NAMES = "connectionFactoryNames"; - public static final String REFRESH_TIMEOUT = "refresh-timeout"; - public static final String DISCOVERY_INITIAL_WAIT_TIMEOUT = "discovery-initial-wait-timeout"; + public static final String REFRESH_TIMEOUT = "refreshTimeout"; + public static final String DISCOVERY_INITIAL_WAIT_TIMEOUT = "discoveryInitialWaitTimeout"; private static final String[] DEFAULT_CONNECTION_FACTORY_NAMES = {"ConnectionFactory", "XAConnectionFactory", "QueueConnectionFactory", "TopicConnectionFactory"}; public static final String TCP_SCHEME = "tcp"; @@ -340,7 +340,7 @@ public class ActiveMQInitialContextFactory implements InitialContextFactory else if (providerURI.getScheme().equals(VM_SCHEME)) { Map inVmTransportConfig = new HashMap(); - inVmTransportConfig.put("server-id", providerURI.getHost()); + inVmTransportConfig.put("serverId", providerURI.getHost()); TransportConfiguration tc = new TransportConfiguration("org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory", inVmTransportConfig); connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(getJmsFactoryType(environment), tc); } diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/uri/AbstractCFSchema.java b/activemq-jms-client/src/main/java/org/apache/activemq/uri/AbstractCFSchema.java new file mode 100644 index 0000000000..3e4c01e5a9 --- /dev/null +++ b/activemq-jms-client/src/main/java/org/apache/activemq/uri/AbstractCFSchema.java @@ -0,0 +1,45 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.uri; + +import java.net.URI; +import java.util.Map; + +import org.apache.activemq.core.client.ActiveMQClientLogger; +import org.apache.activemq.jms.client.ActiveMQConnectionFactory; +import org.apache.activemq.utils.uri.URISchema; + +/** + * @author clebertsuconic + */ + +public abstract class AbstractCFSchema extends URISchema +{ + + protected ConnectionOptions newConectionOptions(URI uri, Map query) throws Exception + { + String type = query.get("type"); + // We do this check here to guarantee proper logging + if (ConnectionOptions.convertCFType(type) == null) + { + ActiveMQClientLogger.LOGGER.invalidCFType(type, uri.toString()); + } + return setData(uri, new ConnectionOptions(), query); + } + +} diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionFactoryParser.java b/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionFactoryParser.java new file mode 100644 index 0000000000..88ef45ef7b --- /dev/null +++ b/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionFactoryParser.java @@ -0,0 +1,34 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.uri; + +import org.apache.activemq.jms.client.ActiveMQConnectionFactory; +import org.apache.activemq.utils.uri.URIFactory; + +/** + * @author clebertsuconic + */ + +public class ConnectionFactoryParser extends URIFactory +{ + public ConnectionFactoryParser() + { + registerSchema(new UDPSchema()); + registerSchema(new JGroupsSchema()); + } +} diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionOptions.java b/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionOptions.java new file mode 100644 index 0000000000..c9a46b38c8 --- /dev/null +++ b/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionOptions.java @@ -0,0 +1,120 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.uri; + +import org.apache.activemq.api.jms.JMSFactoryType; + +/** + * This will represent all the possible options you could setup on URLs + * When parsing the URL this will serve as an intermediate object + * And it could also be a pl + * @author clebertsuconic + */ + +public class ConnectionOptions +{ + + private boolean ha; + + private JMSFactoryType factoryType = JMSFactoryType.CF; + + private String host; + + private int port; + + public ConnectionOptions setHost(String host) + { + this.host = host; + return this; + } + + public String getHost() + { + return host; + } + + + public ConnectionOptions setPort(int port) + { + this.port = port; + return this; + } + + public int getPort() + { + return port; + } + + public boolean isHa() + { + return ha; + } + + public void setHa(boolean ha) + { + this.ha = ha; + } + + public JMSFactoryType getFactoryTypeEnum() + { + return factoryType; + } + + public String getType() + { + return factoryType.toString(); + } + + + public void setType(final String type) + { + this.factoryType = convertCFType(type); + if (factoryType == null) + { + factoryType = JMSFactoryType.CF; + } + } + + public static JMSFactoryType convertCFType(String type) + { + try + { + if (type == null) + { + return null; + } + else + { + return Enum.valueOf(JMSFactoryType.class, type); + } + } + catch (Exception e) + { + return null; + } + } + + @Override + public String toString() + { + return "ConnectionOptions{" + + "ha=" + ha + + ", factoryType=" + factoryType + + '}'; + } +} diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/uri/JGroupsSchema.java b/activemq-jms-client/src/main/java/org/apache/activemq/uri/JGroupsSchema.java new file mode 100644 index 0000000000..302facd300 --- /dev/null +++ b/activemq-jms-client/src/main/java/org/apache/activemq/uri/JGroupsSchema.java @@ -0,0 +1,69 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.uri; + +import java.net.URI; +import java.util.Map; +import java.util.UUID; + +import org.apache.activemq.api.core.DiscoveryGroupConfiguration; +import org.apache.activemq.api.core.JGroupsBroadcastGroupConfiguration; +import org.apache.activemq.api.jms.ActiveMQJMSClient; +import org.apache.activemq.jms.client.ActiveMQConnectionFactory; +import org.apache.activemq.utils.uri.URISchema; + +/** + * @author clebertsuconic + */ + +public class JGroupsSchema extends AbstractCFSchema +{ + @Override + public String getSchemaName() + { + return "jgroups"; + } + + + @Override + public ActiveMQConnectionFactory internalNewObject(URI uri, Map query) throws Exception + { + ConnectionOptions options = newConectionOptions(uri, query); + + System.out.println("authority = " + uri.getAuthority() + " path = " + uri.getPath()); + + JGroupsBroadcastGroupConfiguration jgroupsConfig = new JGroupsBroadcastGroupConfiguration(uri.getAuthority(), uri.getPath() != null ? uri.getPath() : UUID.randomUUID().toString()); + + URISchema.setData(uri, jgroupsConfig, query); + + + DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration().setBroadcastEndpointFactoryConfiguration(jgroupsConfig); + + URISchema.setData(uri, dcConfig, query); + + + if (options.isHa()) + { + return ActiveMQJMSClient.createConnectionFactoryWithHA(dcConfig, options.getFactoryTypeEnum()); + } + else + { + return ActiveMQJMSClient.createConnectionFactoryWithoutHA(dcConfig, options.getFactoryTypeEnum()); + } + } +} diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/uri/UDPSchema.java b/activemq-jms-client/src/main/java/org/apache/activemq/uri/UDPSchema.java new file mode 100644 index 0000000000..b604233459 --- /dev/null +++ b/activemq-jms-client/src/main/java/org/apache/activemq/uri/UDPSchema.java @@ -0,0 +1,65 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.uri; + +import java.io.PrintStream; +import java.net.URI; +import java.util.Map; + +import org.apache.activemq.api.core.DiscoveryGroupConfiguration; +import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration; +import org.apache.activemq.api.jms.ActiveMQJMSClient; +import org.apache.activemq.core.remoting.impl.netty.TransportConstants; +import org.apache.activemq.jms.client.ActiveMQConnectionFactory; +import org.apache.activemq.utils.uri.URISchema; + +/** + * @author clebertsuconic + */ + +public class UDPSchema extends AbstractCFSchema +{ + @Override + public String getSchemaName() + { + return "udp"; + } + + + @Override + public ActiveMQConnectionFactory internalNewObject(URI uri, Map query) throws Exception + { + ConnectionOptions options = newConectionOptions(uri, query); + + DiscoveryGroupConfiguration dgc = URISchema.setData(uri, new DiscoveryGroupConfiguration(), query) + .setBroadcastEndpointFactoryConfiguration(new UDPBroadcastGroupConfiguration() + .setGroupAddress(getHost(uri)) + .setGroupPort(getPort(uri)) + .setLocalBindAddress(query.containsKey(TransportConstants.LOCAL_ADDRESS_PROP_NAME) ? (String) query.get(TransportConstants.LOCAL_ADDRESS_PROP_NAME) : null) + .setLocalBindPort(query.containsKey(TransportConstants.LOCAL_PORT_PROP_NAME) ? Integer.parseInt((String) query.get(TransportConstants.LOCAL_PORT_PROP_NAME)) : -1)); + + if (options.isHa()) + { + return ActiveMQJMSClient.createConnectionFactoryWithHA(dgc, options.getFactoryTypeEnum()); + } + else + { + return ActiveMQJMSClient.createConnectionFactoryWithoutHA(dgc, options.getFactoryTypeEnum()); + } + } +} diff --git a/activemq-jms-client/src/test/java/org/apache/activemq/uri/ConnectionFactoryURITest.java b/activemq-jms-client/src/test/java/org/apache/activemq/uri/ConnectionFactoryURITest.java new file mode 100644 index 0000000000..19fb50a3e3 --- /dev/null +++ b/activemq-jms-client/src/test/java/org/apache/activemq/uri/ConnectionFactoryURITest.java @@ -0,0 +1,60 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.uri; + +import javax.jms.ConnectionFactory; +import javax.jms.XAQueueConnectionFactory; +import java.net.URI; + +import org.apache.activemq.jms.client.ActiveMQConnectionFactory; +import org.junit.Assert; +import org.junit.Test; + +/** + * @author clebertsuconic + */ + +public class ConnectionFactoryURITest +{ + ConnectionFactoryParser parser = new ConnectionFactoryParser(); + + + @Test + public void testUDP() throws Exception + { + ActiveMQConnectionFactory factory = parser.newObject(new URI("udp://localhost:3030?ha=true&type=QUEUE_XA_CF")); + + Assert.assertTrue(factory instanceof XAQueueConnectionFactory); + } + + @Test + public void testInvalidCFType() throws Exception + { + ActiveMQConnectionFactory factory = parser.newObject(new URI("udp://localhost:3030?ha=true&type=QUEUE_XA_CFInvalid")); + + Assert.assertTrue(factory instanceof ConnectionFactory); + } + + @Test + public void testJGroups() throws Exception + { + ActiveMQConnectionFactory factory = parser.newObject(new URI("jgroups://test.xml?test=33")); + +// Assert.assertTrue(factory instanceof ConnectionFactory); + } +} diff --git a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMAcceptorFactory.java b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMAcceptorFactory.java index c0e186d18b..df30e00f8a 100644 --- a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMAcceptorFactory.java +++ b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMAcceptorFactory.java @@ -47,10 +47,4 @@ public class InVMAcceptorFactory implements AcceptorFactory { return new InVMAcceptor(clusterConnection, configuration, handler, listener, threadPool); } - - public Set getAllowableProperties() - { - return TransportConstants.ALLOWABLE_ACCEPTOR_KEYS; - } - } diff --git a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMConnectorFactory.java b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMConnectorFactory.java index 1c05bca4c1..5de4161ad6 100644 --- a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMConnectorFactory.java +++ b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMConnectorFactory.java @@ -48,11 +48,6 @@ public class InVMConnectorFactory implements ConnectorFactory return connector; } - public Set getAllowableProperties() - { - return TransportConstants.ALLOWABLE_CONNECTOR_KEYS; - } - @Override public boolean isReliable() { diff --git a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/TransportConstants.java b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/TransportConstants.java index 4f9a490e47..9987383215 100644 --- a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/TransportConstants.java +++ b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/TransportConstants.java @@ -27,36 +27,15 @@ import org.apache.activemq.api.config.ActiveMQDefaultConfiguration; * * @author Tim Fox * @author Martyn Taylor + * @author ClebertSuconic * */ public final class TransportConstants { - public static final String SERVER_ID_PROP_NAME = "server-id"; + public static final String SERVER_ID_PROP_NAME = "serverId"; public static final int DEFAULT_SERVER_ID = 0; - public static final Set ALLOWABLE_CONNECTOR_KEYS; - - public static final Set ALLOWABLE_ACCEPTOR_KEYS; - - static - { - Set allowableAcceptorKeys = new HashSet(); - allowableAcceptorKeys.add(TransportConstants.SERVER_ID_PROP_NAME); - allowableAcceptorKeys.add(org.apache.activemq.core.remoting.impl.netty.TransportConstants.CLUSTER_CONNECTION); - allowableAcceptorKeys.add(ActiveMQDefaultConfiguration.getPropMaskPassword()); - allowableAcceptorKeys.add(ActiveMQDefaultConfiguration.getPropPasswordCodec()); - - ALLOWABLE_ACCEPTOR_KEYS = Collections.unmodifiableSet(allowableAcceptorKeys); - - Set allowableConnectorKeys = new HashSet(); - allowableConnectorKeys.add(TransportConstants.SERVER_ID_PROP_NAME); - allowableConnectorKeys.add(ActiveMQDefaultConfiguration.getPropMaskPassword()); - allowableConnectorKeys.add(ActiveMQDefaultConfiguration.getPropPasswordCodec()); - - ALLOWABLE_CONNECTOR_KEYS = Collections.unmodifiableSet(allowableConnectorKeys); - } - private TransportConstants() { // Utility class diff --git a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyAcceptorFactory.java b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyAcceptorFactory.java index 502c92affd..1bb545b90a 100644 --- a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyAcceptorFactory.java +++ b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyAcceptorFactory.java @@ -46,9 +46,4 @@ public class NettyAcceptorFactory implements AcceptorFactory { return new NettyAcceptor(name, connection, configuration, handler, listener, scheduledThreadPool, protocolMap); } - - public Set getAllowableProperties() - { - return TransportConstants.ALLOWABLE_ACCEPTOR_KEYS; - } } diff --git a/activemq-server/src/main/java/org/apache/activemq/spi/core/remoting/AcceptorFactory.java b/activemq-server/src/main/java/org/apache/activemq/spi/core/remoting/AcceptorFactory.java index 04976cf837..02dbb35308 100644 --- a/activemq-server/src/main/java/org/apache/activemq/spi/core/remoting/AcceptorFactory.java +++ b/activemq-server/src/main/java/org/apache/activemq/spi/core/remoting/AcceptorFactory.java @@ -56,12 +56,4 @@ public interface AcceptorFactory ScheduledExecutorService scheduledThreadPool, Map protocolMap); - /** - * Returns the allowable properties for this acceptor. - *

- * This will differ between different acceptor implementations. - * - * @return the allowable properties. - */ - Set getAllowableProperties(); } diff --git a/pom.xml b/pom.xml index c3ae18af4d..0cf43263e3 100644 --- a/pom.xml +++ b/pom.xml @@ -410,6 +410,13 @@ 2.0.0 + + + + commons-beanutils + commons-beanutils + 1.9.2 + diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/SimpleJNDIClientTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/SimpleJNDIClientTest.java index 680d429710..9c48cc70b9 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/SimpleJNDIClientTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/SimpleJNDIClientTest.java @@ -463,7 +463,7 @@ public class SimpleJNDIClientTest extends UnitTestCase { Hashtable props = new Hashtable<>(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); - props.put(Context.PROVIDER_URL, "jgroups://test-jgroups-file_ping.xml"); + props.put(Context.PROVIDER_URL, "jgroups://test-jgroups-file_ping.xml/"); Context ctx = new InitialContext(props); ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) ctx.lookup("ConnectionFactory");