Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E258A100B8 for ; Tue, 18 Nov 2014 23:37:59 +0000 (UTC) Received: (qmail 99224 invoked by uid 500); 18 Nov 2014 23:37:58 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 99131 invoked by uid 500); 18 Nov 2014 23:37:58 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 98715 invoked by uid 99); 18 Nov 2014 23:37:58 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Nov 2014 23:37:58 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 00D4E9A95D5; Tue, 18 Nov 2014 23:37:57 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: clebertsuconic@apache.org To: commits@activemq.apache.org Date: Tue, 18 Nov 2014 23:38:36 -0000 Message-Id: <8c3310e059404d32b7e369a521413fe4@git.apache.org> In-Reply-To: <02d06507438644d0a31b17f687b6b82f@git.apache.org> References: <02d06507438644d0a31b17f687b6b82f@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [43/52] [abbrv] [partial] activemq-6 git commit: ACTIVEMQ6-4 Rename HornetQ* classes to ActiveMQ* http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyConnector.java ---------------------------------------------------------------------- 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 f6defe9..b4ea7b5 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 @@ -97,12 +97,12 @@ import io.netty.util.concurrent.Future; import io.netty.util.concurrent.GlobalEventExecutor; import org.apache.activemq.api.core.ActiveMQException; import org.apache.activemq.api.config.ActiveMQDefaultConfiguration; -import org.apache.activemq.core.client.HornetQClientLogger; -import org.apache.activemq.core.client.HornetQClientMessageBundle; +import org.apache.activemq.core.client.ActiveMQClientLogger; +import org.apache.activemq.core.client.ActiveMQClientMessageBundle; import org.apache.activemq.core.client.impl.ClientSessionFactoryImpl; -import org.apache.activemq.core.protocol.core.impl.HornetQClientProtocolManager; +import org.apache.activemq.core.protocol.core.impl.ActiveMQClientProtocolManager; import org.apache.activemq.core.remoting.impl.ssl.SSLSupport; -import org.apache.activemq.core.server.HornetQComponent; +import org.apache.activemq.core.server.ActiveMQComponent; import org.apache.activemq.spi.core.remoting.AbstractConnector; import org.apache.activemq.spi.core.remoting.BufferHandler; import org.apache.activemq.spi.core.remoting.ClientProtocolManager; @@ -128,22 +128,22 @@ public class NettyConnector extends AbstractConnector public static final String JAVAX_KEYSTORE_PASSWORD_PROP_NAME = "javax.net.ssl.keyStorePassword"; public static final String JAVAX_TRUSTSTORE_PATH_PROP_NAME = "javax.net.ssl.trustStore"; public static final String JAVAX_TRUSTSTORE_PASSWORD_PROP_NAME = "javax.net.ssl.trustStorePassword"; - public static final String HORNETQ_KEYSTORE_PROVIDER_PROP_NAME = "org.apache.activemq.ssl.keyStoreProvider"; - public static final String HORNETQ_KEYSTORE_PATH_PROP_NAME = "org.apache.activemq.ssl.keyStore"; - public static final String HORNETQ_KEYSTORE_PASSWORD_PROP_NAME = "org.apache.activemq.ssl.keyStorePassword"; - public static final String HORNETQ_TRUSTSTORE_PROVIDER_PROP_NAME = "org.apache.activemq.ssl.trustStoreProvider"; - public static final String HORNETQ_TRUSTSTORE_PATH_PROP_NAME = "org.apache.activemq.ssl.trustStore"; - public static final String HORNETQ_TRUSTSTORE_PASSWORD_PROP_NAME = "org.apache.activemq.ssl.trustStorePassword"; + public static final String ACTIVEMQ_KEYSTORE_PROVIDER_PROP_NAME = "org.apache.activemq.ssl.keyStoreProvider"; + public static final String ACTIVEMQ_KEYSTORE_PATH_PROP_NAME = "org.apache.activemq.ssl.keyStore"; + public static final String ACTIVEMQ_KEYSTORE_PASSWORD_PROP_NAME = "org.apache.activemq.ssl.keyStorePassword"; + public static final String ACTIVEMQ_TRUSTSTORE_PROVIDER_PROP_NAME = "org.apache.activemq.ssl.trustStoreProvider"; + public static final String ACTIVEMQ_TRUSTSTORE_PATH_PROP_NAME = "org.apache.activemq.ssl.trustStore"; + public static final String ACTIVEMQ_TRUSTSTORE_PASSWORD_PROP_NAME = "org.apache.activemq.ssl.trustStorePassword"; // Constants for HTTP upgrade // These constants are exposed publicly as they are used on the server-side to fetch // headers from the HTTP request, compute some values and fill the HTTP response public static final String MAGIC_NUMBER = "CF70DEB8-70F9-4FBA-8B4F-DFC3E723B4CD"; - public static final String SEC_HORNETQ_REMOTING_KEY = "Sec-HornetQRemoting-Key"; - public static final String SEC_HORNETQ_REMOTING_ACCEPT = "Sec-HornetQRemoting-Accept"; - public static final String HORNETQ_REMOTING = "hornetq-remoting"; + public static final String SEC_ACTIVEMQ_REMOTING_KEY = "Sec-ActiveMQRemoting-Key"; + public static final String SEC_ACTIVEMQ_REMOTING_ACCEPT = "Sec-ActiveMQRemoting-Accept"; + public static final String ACTIVEMQ_REMOTING = "activemq-remoting"; - private static final AttributeKey REMOTING_KEY = AttributeKey.valueOf(SEC_HORNETQ_REMOTING_KEY); + private static final AttributeKey REMOTING_KEY = AttributeKey.valueOf(SEC_ACTIVEMQ_REMOTING_KEY); // Default Configuration public static final Map DEFAULT_CONFIG; @@ -183,7 +183,7 @@ public class NettyConnector extends AbstractConnector private final boolean httpRequiresSessionId; // if true, after the connection, the connector will send - // a HTTP GET request (+ Upgrade: hornetq-remoting) that + // a HTTP GET request (+ Upgrade: activemq-remoting) that // will be handled by the server's http server. private final boolean httpUpgradeEnabled; @@ -255,7 +255,7 @@ public class NettyConnector extends AbstractConnector final Executor threadPool, final ScheduledExecutorService scheduledThreadPool) { - this(configuration, handler, listener, closeExecutor, threadPool, scheduledThreadPool, new HornetQClientProtocolManager()); + this(configuration, handler, listener, closeExecutor, threadPool, scheduledThreadPool, new ActiveMQClientProtocolManager()); } @@ -273,12 +273,12 @@ public class NettyConnector extends AbstractConnector if (listener == null) { - throw HornetQClientMessageBundle.BUNDLE.nullListener(); + throw ActiveMQClientMessageBundle.BUNDLE.nullListener(); } if (handler == null) { - throw HornetQClientMessageBundle.BUNDLE.nullHandler(); + throw ActiveMQClientMessageBundle.BUNDLE.nullHandler(); } this.listener = listener; @@ -487,7 +487,7 @@ public class NettyConnector extends AbstractConnector bootstrap.option(ChannelOption.SO_KEEPALIVE, true); bootstrap.option(ChannelOption.SO_REUSEADDR, true); bootstrap.option(ChannelOption.ALLOCATOR, new UnpooledByteBufAllocator(false)); - channelGroup = new DefaultChannelGroup("hornetq-connector", GlobalEventExecutor.INSTANCE); + channelGroup = new DefaultChannelGroup("activemq-connector", GlobalEventExecutor.INSTANCE); final SSLContext context; if (sslEnabled) @@ -507,17 +507,17 @@ public class NettyConnector extends AbstractConnector realKeyStorePassword = System.getProperty(JAVAX_KEYSTORE_PASSWORD_PROP_NAME); } - if (System.getProperty(HORNETQ_KEYSTORE_PROVIDER_PROP_NAME) != null) + if (System.getProperty(ACTIVEMQ_KEYSTORE_PROVIDER_PROP_NAME) != null) { - realKeyStoreProvider = System.getProperty(HORNETQ_KEYSTORE_PROVIDER_PROP_NAME); + realKeyStoreProvider = System.getProperty(ACTIVEMQ_KEYSTORE_PROVIDER_PROP_NAME); } - if (System.getProperty(HORNETQ_KEYSTORE_PATH_PROP_NAME) != null) + if (System.getProperty(ACTIVEMQ_KEYSTORE_PATH_PROP_NAME) != null) { - realKeyStorePath = System.getProperty(HORNETQ_KEYSTORE_PATH_PROP_NAME); + realKeyStorePath = System.getProperty(ACTIVEMQ_KEYSTORE_PATH_PROP_NAME); } - if (System.getProperty(HORNETQ_KEYSTORE_PASSWORD_PROP_NAME) != null) + if (System.getProperty(ACTIVEMQ_KEYSTORE_PASSWORD_PROP_NAME) != null) { - realKeyStorePassword = System.getProperty(HORNETQ_KEYSTORE_PASSWORD_PROP_NAME); + realKeyStorePassword = System.getProperty(ACTIVEMQ_KEYSTORE_PASSWORD_PROP_NAME); } String realTrustStorePath = trustStorePath; @@ -532,17 +532,17 @@ public class NettyConnector extends AbstractConnector realTrustStorePassword = System.getProperty(JAVAX_TRUSTSTORE_PASSWORD_PROP_NAME); } - if (System.getProperty(HORNETQ_TRUSTSTORE_PROVIDER_PROP_NAME) != null) + if (System.getProperty(ACTIVEMQ_TRUSTSTORE_PROVIDER_PROP_NAME) != null) { - realTrustStoreProvider = System.getProperty(HORNETQ_TRUSTSTORE_PROVIDER_PROP_NAME); + realTrustStoreProvider = System.getProperty(ACTIVEMQ_TRUSTSTORE_PROVIDER_PROP_NAME); } - if (System.getProperty(HORNETQ_TRUSTSTORE_PATH_PROP_NAME) != null) + if (System.getProperty(ACTIVEMQ_TRUSTSTORE_PATH_PROP_NAME) != null) { - realTrustStorePath = System.getProperty(HORNETQ_TRUSTSTORE_PATH_PROP_NAME); + realTrustStorePath = System.getProperty(ACTIVEMQ_TRUSTSTORE_PATH_PROP_NAME); } - if (System.getProperty(HORNETQ_TRUSTSTORE_PASSWORD_PROP_NAME) != null) + if (System.getProperty(ACTIVEMQ_TRUSTSTORE_PASSWORD_PROP_NAME) != null) { - realTrustStorePassword = System.getProperty(HORNETQ_TRUSTSTORE_PASSWORD_PROP_NAME); + realTrustStorePassword = System.getProperty(ACTIVEMQ_TRUSTSTORE_PASSWORD_PROP_NAME); } context = SSLSupport.createContext(realKeyStoreProvider, realKeyStorePath, realKeyStorePassword, realTrustStoreProvider, realTrustStorePath, realTrustStorePassword); } @@ -591,7 +591,7 @@ public class NettyConnector extends AbstractConnector } catch (IllegalArgumentException e) { - HornetQClientLogger.LOGGER.invalidCipherSuite(SSLSupport.parseArrayIntoCommandSeparatedList(engine.getSupportedCipherSuites())); + ActiveMQClientLogger.LOGGER.invalidCipherSuite(SSLSupport.parseArrayIntoCommandSeparatedList(engine.getSupportedCipherSuites())); throw e; } } @@ -604,7 +604,7 @@ public class NettyConnector extends AbstractConnector } catch (IllegalArgumentException e) { - HornetQClientLogger.LOGGER.invalidProtocol(SSLSupport.parseArrayIntoCommandSeparatedList(engine.getSupportedProtocols())); + ActiveMQClientLogger.LOGGER.invalidProtocol(SSLSupport.parseArrayIntoCommandSeparatedList(engine.getSupportedProtocols())); throw e; } } @@ -639,7 +639,7 @@ public class NettyConnector extends AbstractConnector protocolManager.addChannelHandlers(pipeline); - pipeline.addLast(new HornetQClientChannelHandler(channelGroup, handler, new Listener())); + pipeline.addLast(new ActiveMQClientChannelHandler(channelGroup, handler, new Listener())); } }); @@ -650,7 +650,7 @@ public class NettyConnector extends AbstractConnector batchFlusherFuture = scheduledThreadPool.scheduleWithFixedDelay(flusher, batchDelay, batchDelay, TimeUnit.MILLISECONDS); } - HornetQClientLogger.LOGGER.debug("Started Netty Connector version " + TransportConstants.NETTY_VERSION); + ActiveMQClientLogger.LOGGER.debug("Started Netty Connector version " + TransportConstants.NETTY_VERSION); } public synchronized void close() @@ -719,7 +719,7 @@ public class NettyConnector extends AbstractConnector } } - HornetQClientLogger.LOGGER.debug("Remote destination: " + remoteDestination); + ActiveMQClientLogger.LOGGER.debug("Remote destination: " + remoteDestination); ChannelFuture future; //port 0 does not work so only use local address if set @@ -755,13 +755,13 @@ public class NettyConnector extends AbstractConnector if (handshakeFuture.isSuccess()) { ChannelPipeline channelPipeline = ch.pipeline(); - HornetQChannelHandler channelHandler = channelPipeline.get(HornetQChannelHandler.class); + ActiveMQChannelHandler channelHandler = channelPipeline.get(ActiveMQChannelHandler.class); channelHandler.active = true; } else { ch.close().awaitUninterruptibly(); - HornetQClientLogger.LOGGER.errorCreatingNettyConnection(handshakeFuture.cause()); + ActiveMQClientLogger.LOGGER.errorCreatingNettyConnection(handshakeFuture.cause()); return null; } } @@ -783,7 +783,7 @@ public class NettyConnector extends AbstractConnector URI uri = new URI("http", null, host, port, null, null, null); HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, uri.getRawPath()); request.headers().set(HttpHeaders.Names.HOST, host); - request.headers().set(HttpHeaders.Names.UPGRADE, HORNETQ_REMOTING); + request.headers().set(HttpHeaders.Names.UPGRADE, ACTIVEMQ_REMOTING); request.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.UPGRADE); final String endpoint = ConfigurationHelper.getStringProperty(TransportConstants.HTTP_UPGRADE_ENDPOINT_PROP_NAME, @@ -797,10 +797,10 @@ public class NettyConnector extends AbstractConnector // Get 16 bit nonce and base 64 encode it byte[] nonce = randomBytes(16); String key = base64(nonce); - request.headers().set(SEC_HORNETQ_REMOTING_KEY, key); + request.headers().set(SEC_ACTIVEMQ_REMOTING_KEY, key); ch.attr(REMOTING_KEY).set(key); - HornetQClientLogger.LOGGER.debugf("Sending HTTP request %s", request); + ActiveMQClientLogger.LOGGER.debugf("Sending HTTP request %s", request); // Send the HTTP request. ch.writeAndFlush(request); @@ -812,14 +812,14 @@ public class NettyConnector extends AbstractConnector } catch (URISyntaxException e) { - HornetQClientLogger.LOGGER.errorCreatingNettyConnection(e); + ActiveMQClientLogger.LOGGER.errorCreatingNettyConnection(e); return null; } } else { ChannelPipeline channelPipeline = ch.pipeline(); - HornetQChannelHandler channelHandler = channelPipeline.get(HornetQChannelHandler.class); + ActiveMQChannelHandler channelHandler = channelPipeline.get(ActiveMQChannelHandler.class); channelHandler.active = true; } @@ -835,7 +835,7 @@ public class NettyConnector extends AbstractConnector if (t != null && !(t instanceof ConnectException)) { - HornetQClientLogger.LOGGER.errorCreatingNettyConnection(future.cause()); + ActiveMQClientLogger.LOGGER.errorCreatingNettyConnection(future.cause()); } return null; @@ -852,11 +852,11 @@ public class NettyConnector extends AbstractConnector // Inner classes ------------------------------------------------- - private static final class HornetQClientChannelHandler extends HornetQChannelHandler + private static final class ActiveMQClientChannelHandler extends ActiveMQChannelHandler { - HornetQClientChannelHandler(final ChannelGroup group, - final BufferHandler handler, - final ConnectionLifeCycleListener listener) + ActiveMQClientChannelHandler(final ChannelGroup group, + final BufferHandler handler, + final ConnectionLifeCycleListener listener) { super(group, handler, listener); } @@ -882,29 +882,29 @@ public class NettyConnector extends AbstractConnector { HttpResponse response = (HttpResponse) msg; if (response.getStatus().code() == HttpResponseStatus.SWITCHING_PROTOCOLS.code() - && response.headers().get(HttpHeaders.Names.UPGRADE).equals(HORNETQ_REMOTING)) + && response.headers().get(HttpHeaders.Names.UPGRADE).equals(ACTIVEMQ_REMOTING)) { - String accept = response.headers().get(SEC_HORNETQ_REMOTING_ACCEPT); + String accept = response.headers().get(SEC_ACTIVEMQ_REMOTING_ACCEPT); String expectedResponse = createExpectedResponse(MAGIC_NUMBER, ctx.channel().attr(REMOTING_KEY).get()); if (expectedResponse.equals(accept)) { - // remove the http handlers and flag the hornetq channel handler as active + // remove the http handlers and flag the activemq channel handler as active pipeline.remove(httpClientCodec); pipeline.remove(this); handshakeComplete = true; - HornetQChannelHandler channelHandler = pipeline.get(HornetQChannelHandler.class); + ActiveMQChannelHandler channelHandler = pipeline.get(ActiveMQChannelHandler.class); channelHandler.active = true; } else { - HornetQClientLogger.LOGGER.httpHandshakeFailed(accept, expectedResponse); + ActiveMQClientLogger.LOGGER.httpHandshakeFailed(accept, expectedResponse); ctx.close(); } } else if (response.getStatus().code() == HttpResponseStatus.FORBIDDEN.code()) { - HornetQClientLogger.LOGGER.httpUpgradeNotSupportedByRemoteAcceptor(); + ActiveMQClientLogger.LOGGER.httpUpgradeNotSupportedByRemoteAcceptor(); ctx.close(); } latch.countDown(); @@ -914,7 +914,7 @@ public class NettyConnector extends AbstractConnector @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { - HornetQClientLogger.LOGGER.errorCreatingNettyConnection(cause); + ActiveMQClientLogger.LOGGER.errorCreatingNettyConnection(cause); ctx.close(); } @@ -1087,11 +1087,11 @@ public class NettyConnector extends AbstractConnector private class Listener implements ConnectionLifeCycleListener { - public void connectionCreated(final HornetQComponent component, final Connection connection, final String protocol) + public void connectionCreated(final ActiveMQComponent component, final Connection connection, final String protocol) { if (connections.putIfAbsent(connection.getID(), connection) != null) { - throw HornetQClientMessageBundle.BUNDLE.connectionExists(connection.getID()); + throw ActiveMQClientMessageBundle.BUNDLE.connectionExists(connection.getID()); } } @@ -1173,13 +1173,13 @@ public class NettyConnector extends AbstractConnector InetAddress inetAddr2 = InetAddress.getByName(this.host); String ip1 = inetAddr1.getHostAddress(); String ip2 = inetAddr2.getHostAddress(); - HornetQClientLogger.LOGGER.debug(this + " host 1: " + host + " ip address: " + ip1 + " host 2: " + this.host + " ip address: " + ip2); + ActiveMQClientLogger.LOGGER.debug(this + " host 1: " + host + " ip address: " + ip1 + " host 2: " + this.host + " ip address: " + ip2); result = ip1.equals(ip2); } catch (UnknownHostException e) { - HornetQClientLogger.LOGGER.error("Cannot resolve host", e); + ActiveMQClientLogger.LOGGER.error("Cannot resolve host", e); } return result; http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/SharedNioEventLoopGroup.java ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/SharedNioEventLoopGroup.java b/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/SharedNioEventLoopGroup.java index 07fc89b..c7ce7f9 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/SharedNioEventLoopGroup.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/SharedNioEventLoopGroup.java @@ -31,7 +31,7 @@ import io.netty.util.concurrent.FutureListener; import io.netty.util.concurrent.ImmediateEventExecutor; import io.netty.util.concurrent.Promise; import org.apache.activemq.core.client.impl.ClientSessionFactoryImpl; -import org.apache.activemq.utils.HornetQThreadFactory; +import org.apache.activemq.utils.ActiveMQThreadFactory; import java.security.AccessController; import java.security.PrivilegedAction; @@ -90,7 +90,7 @@ public class SharedNioEventLoopGroup extends NioEventLoopGroup } else { - instance = new SharedNioEventLoopGroup(numThreads, new HornetQThreadFactory("HornetQ-client-netty-threads", true, getThisClassLoader())); + instance = new SharedNioEventLoopGroup(numThreads, new ActiveMQThreadFactory("ActiveMQ-client-netty-threads", true, getThisClassLoader())); } instance.nioChannelFactoryCount.incrementAndGet(); return instance; http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/TransportConstants.java ---------------------------------------------------------------------- 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 172ce8c..4c38dad 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 @@ -172,7 +172,7 @@ public class TransportConstants public static final boolean DEFAULT_HTTP_UPGRADE_ENABLED = false; - public static final String DEFAULT_SERVLET_PATH = "/messaging/HornetQServlet"; + public static final String DEFAULT_SERVLET_PATH = "/messaging/ActiveMQServlet"; public static final long DEFAULT_BATCH_DELAY = 0; http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/ssl/SSLSupport.java ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/ssl/SSLSupport.java b/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/ssl/SSLSupport.java index 7fab3cf..4d89779 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/ssl/SSLSupport.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/ssl/SSLSupport.java @@ -34,7 +34,7 @@ import org.apache.activemq.utils.ClassloadingUtil; * @author Jeff Mesnil * @author Justin Bertram * - * Please note, this class supports PKCS#11 keystores, but there are no specific tests in the HornetQ test-suite to + * Please note, this class supports PKCS#11 keystores, but there are no specific tests in the ActiveMQ test-suite to * validate/verify this works because this requires a functioning PKCS#11 provider which is not available by default * (see java.security.Security#getProviders()). The main thing to keep in mind is that PKCS#11 keystores will have a * null keystore path. http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/package-info.java ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/package-info.java b/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/package-info.java index 38339fc..3de0e2e 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/package-info.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/package-info.java @@ -13,7 +13,7 @@ /** * Remoting API. *
- * This package defines the API used by HornetQ for remoting. + * This package defines the API used by ActiveMQ for remoting. */ package org.apache.activemq.core.remoting; http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/core/security/ActiveMQPrincipal.java ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/java/org/apache/activemq/core/security/ActiveMQPrincipal.java b/activemq-core-client/src/main/java/org/apache/activemq/core/security/ActiveMQPrincipal.java new file mode 100644 index 0000000..e8e9462 --- /dev/null +++ b/activemq-core-client/src/main/java/org/apache/activemq/core/security/ActiveMQPrincipal.java @@ -0,0 +1,41 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.core.security; + +/** + * @author Andy Taylor + * 1/30/12 + */ +public class ActiveMQPrincipal +{ + private final String userName; + + private final String password; + + public ActiveMQPrincipal(String userName, String password) + { + this.userName = userName; + this.password = password; + } + + public String getUserName() + { + return userName; + } + + public String getPassword() + { + return password; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/core/security/HornetQPrincipal.java ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/java/org/apache/activemq/core/security/HornetQPrincipal.java b/activemq-core-client/src/main/java/org/apache/activemq/core/security/HornetQPrincipal.java deleted file mode 100644 index b3e16fa..0000000 --- a/activemq-core-client/src/main/java/org/apache/activemq/core/security/HornetQPrincipal.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2005-2014 Red Hat, Inc. - * Red Hat 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.core.security; - -/** - * @author Andy Taylor - * 1/30/12 - */ -public class HornetQPrincipal -{ - private final String userName; - - private final String password; - - public HornetQPrincipal(String userName, String password) - { - this.userName = userName; - this.password = password; - } - - public String getUserName() - { - return userName; - } - - public String getPassword() - { - return password; - } -} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/spi/core/protocol/AbstractRemotingConnection.java ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/java/org/apache/activemq/spi/core/protocol/AbstractRemotingConnection.java b/activemq-core-client/src/main/java/org/apache/activemq/spi/core/protocol/AbstractRemotingConnection.java index 28b3c90..5911c3d 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/spi/core/protocol/AbstractRemotingConnection.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/spi/core/protocol/AbstractRemotingConnection.java @@ -21,8 +21,8 @@ import java.util.concurrent.Executor; import org.apache.activemq.api.core.ActiveMQBuffer; import org.apache.activemq.api.core.ActiveMQException; import org.apache.activemq.api.core.ActiveMQInterruptedException; -import org.apache.activemq.core.client.HornetQClientLogger; -import org.apache.activemq.core.client.HornetQClientMessageBundle; +import org.apache.activemq.core.client.ActiveMQClientLogger; +import org.apache.activemq.core.client.ActiveMQClientMessageBundle; import org.apache.activemq.core.remoting.CloseListener; import org.apache.activemq.core.remoting.FailureListener; import org.apache.activemq.spi.core.remoting.Connection; @@ -65,14 +65,14 @@ public abstract class AbstractRemotingConnection implements RemotingConnection catch (ActiveMQInterruptedException interrupted) { // this is an expected behaviour.. no warn or error here - HornetQClientLogger.LOGGER.debug("thread interrupted", interrupted); + ActiveMQClientLogger.LOGGER.debug("thread interrupted", interrupted); } catch (final Throwable t) { // Failure of one listener to execute shouldn't prevent others // from // executing - HornetQClientLogger.LOGGER.errorCallingFailureListener(t); + ActiveMQClientLogger.LOGGER.errorCallingFailureListener(t); } } } @@ -93,7 +93,7 @@ public abstract class AbstractRemotingConnection implements RemotingConnection // Failure of one listener to execute shouldn't prevent others // from // executing - HornetQClientLogger.LOGGER.errorCallingFailureListener(t); + ActiveMQClientLogger.LOGGER.errorCallingFailureListener(t); } } } @@ -119,7 +119,7 @@ public abstract class AbstractRemotingConnection implements RemotingConnection { if (listener == null) { - throw HornetQClientMessageBundle.BUNDLE.failListenerCannotBeNull(); + throw ActiveMQClientMessageBundle.BUNDLE.failListenerCannotBeNull(); } failureListeners.add(listener); } @@ -128,7 +128,7 @@ public abstract class AbstractRemotingConnection implements RemotingConnection { if (listener == null) { - throw HornetQClientMessageBundle.BUNDLE.failListenerCannotBeNull(); + throw ActiveMQClientMessageBundle.BUNDLE.failListenerCannotBeNull(); } return failureListeners.remove(listener); @@ -138,7 +138,7 @@ public abstract class AbstractRemotingConnection implements RemotingConnection { if (listener == null) { - throw HornetQClientMessageBundle.BUNDLE.closeListenerCannotBeNull(); + throw ActiveMQClientMessageBundle.BUNDLE.closeListenerCannotBeNull(); } closeListeners.add(listener); @@ -148,7 +148,7 @@ public abstract class AbstractRemotingConnection implements RemotingConnection { if (listener == null) { - throw HornetQClientMessageBundle.BUNDLE.closeListenerCannotBeNull(); + throw ActiveMQClientMessageBundle.BUNDLE.closeListenerCannotBeNull(); } return closeListeners.remove(listener); http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/spi/core/protocol/RemotingConnection.java ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/java/org/apache/activemq/spi/core/protocol/RemotingConnection.java b/activemq-core-client/src/main/java/org/apache/activemq/spi/core/protocol/RemotingConnection.java index 95d7dc6..7547b4c 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/spi/core/protocol/RemotingConnection.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/spi/core/protocol/RemotingConnection.java @@ -110,7 +110,7 @@ public interface RemotingConnection extends BufferHandler void setFailureListeners(List listeners); /** - * creates a new HornetQBuffer of the specified size. + * creates a new ActiveMQBuffer of the specified size. * * @param size the size of buffer required * @return the buffer http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/Connection.java ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/Connection.java b/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/Connection.java index ae2db0b..5f4656c 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/Connection.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/Connection.java @@ -15,7 +15,7 @@ package org.apache.activemq.spi.core.remoting; import io.netty.channel.ChannelFutureListener; import org.apache.activemq.api.core.ActiveMQBuffer; import org.apache.activemq.api.core.TransportConfiguration; -import org.apache.activemq.core.security.HornetQPrincipal; +import org.apache.activemq.core.security.ActiveMQPrincipal; import org.apache.activemq.spi.core.protocol.RemotingConnection; /** @@ -27,7 +27,7 @@ import org.apache.activemq.spi.core.protocol.RemotingConnection; public interface Connection { /** - * Create a new HornetQBuffer of the given size. + * Create a new ActiveMQBuffer of the given size. * * @param size the size of buffer to create * @return the new buffer. @@ -106,7 +106,7 @@ public interface Connection */ TransportConfiguration getConnectorConfig(); - HornetQPrincipal getDefaultHornetQPrincipal(); + ActiveMQPrincipal getDefaultActiveMQPrincipal(); /** * the InVM Connection has some special handling as it doesn't use Netty ProtocolChannel http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/ConnectionLifeCycleListener.java ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/ConnectionLifeCycleListener.java b/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/ConnectionLifeCycleListener.java index f079bcd..a1b287a 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/ConnectionLifeCycleListener.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/ConnectionLifeCycleListener.java @@ -13,7 +13,7 @@ package org.apache.activemq.spi.core.remoting; import org.apache.activemq.api.core.ActiveMQException; -import org.apache.activemq.core.server.HornetQComponent; +import org.apache.activemq.core.server.ActiveMQComponent; /** * A ConnectionLifeCycleListener is called by the remoting implementation to notify of connection events. @@ -29,14 +29,14 @@ public interface ConnectionLifeCycleListener *

* Leaving this method here and adding a different one at * {@code ServerConnectionLifeCycleListener} is a compromise for a reasonable split between the - * hornetq-server and hornetq-client packages while avoiding to pull too much into hornetq-core. + * activemq-server and activemq-client packages while avoiding to pull too much into activemq-core. * The pivotal point keeping us from removing the method is {@link ConnectorFactory} and the * usage of it. * @param component This will probably be an {@code Acceptor} and only used on the server side. * @param connection the connection that has been created * @param protocol the messaging protocol type this connection uses */ - void connectionCreated(HornetQComponent component, Connection connection, String protocol); + void connectionCreated(ActiveMQComponent component, Connection connection, String protocol); /** * Called when a connection is destroyed. http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/package-info.java ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/package-info.java b/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/package-info.java index d51337d..c235a38 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/package-info.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/package-info.java @@ -14,7 +14,7 @@ * Remoting SPI. *
* This package defines the Service Provide Interface that - * remoting providers must implement to be supported by HornetQ. + * remoting providers must implement to be supported by ActiveMQ. */ package org.apache.activemq.spi.core.remoting; http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/utils/ActiveMQBufferInputStream.java ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/java/org/apache/activemq/utils/ActiveMQBufferInputStream.java b/activemq-core-client/src/main/java/org/apache/activemq/utils/ActiveMQBufferInputStream.java new file mode 100644 index 0000000..81fa38e --- /dev/null +++ b/activemq-core-client/src/main/java/org/apache/activemq/utils/ActiveMQBufferInputStream.java @@ -0,0 +1,181 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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 java.io.IOException; +import java.io.InputStream; + +import org.apache.activemq.api.core.ActiveMQBuffer; + +/** + * Used to send large messages + * + * @author Clebert Suconic + * + * + */ +public class ActiveMQBufferInputStream extends InputStream +{ + + /* (non-Javadoc) + * @see java.io.InputStream#read() + */ + // Constants ----------------------------------------------------- + + // Attributes ---------------------------------------------------- + private ActiveMQBuffer bb; + + // Static -------------------------------------------------------- + + // Constructors -------------------------------------------------- + + // Public -------------------------------------------------------- + + public ActiveMQBufferInputStream(final ActiveMQBuffer paramByteBuffer) + { + bb = paramByteBuffer; + } + + @Override + public int read() throws IOException + { + if (bb == null) + { + throw new IOException("read on a closed InputStream"); + } + + if (remainingBytes() == 0) + { + return -1; + } + else + { + return bb.readByte() & 0xFF; + } + } + + @Override + public int read(final byte[] byteArray) throws IOException + { + if (bb == null) + { + throw new IOException("read on a closed InputStream"); + } + + return read(byteArray, 0, byteArray.length); + } + + @Override + public int read(final byte[] byteArray, final int off, final int len) throws IOException + { + if (bb == null) + { + throw new IOException("read on a closed InputStream"); + } + + if (byteArray == null) + { + throw new NullPointerException(); + } + if (off < 0 || off > byteArray.length || len < 0 || off + len > byteArray.length || off + len < 0) + { + throw new IndexOutOfBoundsException(); + } + if (len == 0) + { + return 0; + } + + int size = Math.min(remainingBytes(), len); + + if (size == 0) + { + return -1; + } + + bb.readBytes(byteArray, off, size); + return size; + } + + @Override + public long skip(final long len) throws IOException + { + if (bb == null) + { + throw new IOException("skip on a closed InputStream"); + } + + if (len <= 0L) + { + return 0L; + } + + int size = Math.min(remainingBytes(), (int) len); + + bb.skipBytes(size); + + return size; + } + + @Override + public int available() throws IOException + { + if (bb == null) + { + throw new IOException("available on a closed InputStream"); + } + + return remainingBytes(); + } + + @Override + public void close() throws IOException + { + bb = null; + } + + @Override + public synchronized void mark(final int paramInt) + { + } + + @Override + public synchronized void reset() throws IOException + { + throw new IOException("mark/reset not supported"); + } + + @Override + public boolean markSupported() + { + return false; + } + + // Package protected --------------------------------------------- + + // Protected ----------------------------------------------------- + + // Private ------------------------------------------------------- + + /** + * @return + */ + private int remainingBytes() + { + return bb.writerIndex() - bb.readerIndex(); + } + + + // Inner classes ------------------------------------------------- + +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/utils/BufferHelper.java ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/java/org/apache/activemq/utils/BufferHelper.java b/activemq-core-client/src/main/java/org/apache/activemq/utils/BufferHelper.java index ca741fa..bb64f0f 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/utils/BufferHelper.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/utils/BufferHelper.java @@ -16,7 +16,7 @@ import org.apache.activemq.api.core.ActiveMQBuffer; import org.apache.activemq.api.core.SimpleString; /** - * Helper methods to read and write from HornetQBuffer. + * Helper methods to read and write from ActiveMQBuffer. * * @author Clebert Suconic * http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/utils/ConfigurationHelper.java ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/java/org/apache/activemq/utils/ConfigurationHelper.java b/activemq-core-client/src/main/java/org/apache/activemq/utils/ConfigurationHelper.java index 90f3a89..712f606 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/utils/ConfigurationHelper.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/utils/ConfigurationHelper.java @@ -13,8 +13,8 @@ package org.apache.activemq.utils; import org.apache.activemq.api.core.ActiveMQException; -import org.apache.activemq.core.client.HornetQClientLogger; -import org.apache.activemq.core.client.HornetQClientMessageBundle; +import org.apache.activemq.core.client.ActiveMQClientLogger; +import org.apache.activemq.core.client.ActiveMQClientMessageBundle; import java.util.HashSet; import java.util.Map; @@ -76,7 +76,7 @@ public class ConfigurationHelper } else if (prop instanceof Number == false) { - HornetQClientLogger.LOGGER.propertyNotInteger(propName, prop.getClass().getName()); + ActiveMQClientLogger.LOGGER.propertyNotInteger(propName, prop.getClass().getName()); return def; } @@ -109,7 +109,7 @@ public class ConfigurationHelper } else if (prop instanceof Number == false) { - HornetQClientLogger.LOGGER.propertyNotLong(propName, prop.getClass().getName()); + ActiveMQClientLogger.LOGGER.propertyNotLong(propName, prop.getClass().getName()); return def; } @@ -142,7 +142,7 @@ public class ConfigurationHelper } else if (prop instanceof Boolean == false) { - HornetQClientLogger.LOGGER.propertyNotBoolean(propName, prop.getClass().getName()); + ActiveMQClientLogger.LOGGER.propertyNotBoolean(propName, prop.getClass().getName()); return def; } @@ -224,7 +224,7 @@ public class ConfigurationHelper if (classImpl == null) { - throw HornetQClientMessageBundle.BUNDLE.noCodec(); + throw ActiveMQClientMessageBundle.BUNDLE.noCodec(); } SensitiveDataCodec codec = null; @@ -234,7 +234,7 @@ public class ConfigurationHelper } catch (ActiveMQException e1) { - throw HornetQClientMessageBundle.BUNDLE.failedToGetDecoder(e1); + throw ActiveMQClientMessageBundle.BUNDLE.failedToGetDecoder(e1); } try @@ -243,7 +243,7 @@ public class ConfigurationHelper } catch (Exception e) { - throw HornetQClientMessageBundle.BUNDLE.errordecodingPassword(e); + throw ActiveMQClientMessageBundle.BUNDLE.errordecodingPassword(e); } } http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/utils/HornetQBufferInputStream.java ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/java/org/apache/activemq/utils/HornetQBufferInputStream.java b/activemq-core-client/src/main/java/org/apache/activemq/utils/HornetQBufferInputStream.java deleted file mode 100644 index a5ef9d2..0000000 --- a/activemq-core-client/src/main/java/org/apache/activemq/utils/HornetQBufferInputStream.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright 2005-2014 Red Hat, Inc. - * Red Hat 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 java.io.IOException; -import java.io.InputStream; - -import org.apache.activemq.api.core.ActiveMQBuffer; - -/** - * Used to send large messages - * - * @author Clebert Suconic - * - * - */ -public class HornetQBufferInputStream extends InputStream -{ - - /* (non-Javadoc) - * @see java.io.InputStream#read() - */ - // Constants ----------------------------------------------------- - - // Attributes ---------------------------------------------------- - private ActiveMQBuffer bb; - - // Static -------------------------------------------------------- - - // Constructors -------------------------------------------------- - - // Public -------------------------------------------------------- - - public HornetQBufferInputStream(final ActiveMQBuffer paramByteBuffer) - { - bb = paramByteBuffer; - } - - @Override - public int read() throws IOException - { - if (bb == null) - { - throw new IOException("read on a closed InputStream"); - } - - if (remainingBytes() == 0) - { - return -1; - } - else - { - return bb.readByte() & 0xFF; - } - } - - @Override - public int read(final byte[] byteArray) throws IOException - { - if (bb == null) - { - throw new IOException("read on a closed InputStream"); - } - - return read(byteArray, 0, byteArray.length); - } - - @Override - public int read(final byte[] byteArray, final int off, final int len) throws IOException - { - if (bb == null) - { - throw new IOException("read on a closed InputStream"); - } - - if (byteArray == null) - { - throw new NullPointerException(); - } - if (off < 0 || off > byteArray.length || len < 0 || off + len > byteArray.length || off + len < 0) - { - throw new IndexOutOfBoundsException(); - } - if (len == 0) - { - return 0; - } - - int size = Math.min(remainingBytes(), len); - - if (size == 0) - { - return -1; - } - - bb.readBytes(byteArray, off, size); - return size; - } - - @Override - public long skip(final long len) throws IOException - { - if (bb == null) - { - throw new IOException("skip on a closed InputStream"); - } - - if (len <= 0L) - { - return 0L; - } - - int size = Math.min(remainingBytes(), (int) len); - - bb.skipBytes(size); - - return size; - } - - @Override - public int available() throws IOException - { - if (bb == null) - { - throw new IOException("available on a closed InputStream"); - } - - return remainingBytes(); - } - - @Override - public void close() throws IOException - { - bb = null; - } - - @Override - public synchronized void mark(final int paramInt) - { - } - - @Override - public synchronized void reset() throws IOException - { - throw new IOException("mark/reset not supported"); - } - - @Override - public boolean markSupported() - { - return false; - } - - // Package protected --------------------------------------------- - - // Protected ----------------------------------------------------- - - // Private ------------------------------------------------------- - - /** - * @return - */ - private int remainingBytes() - { - return bb.writerIndex() - bb.readerIndex(); - } - - - // Inner classes ------------------------------------------------- - -} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/utils/MemorySize.java ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/java/org/apache/activemq/utils/MemorySize.java b/activemq-core-client/src/main/java/org/apache/activemq/utils/MemorySize.java index e1e6f40..5ca3152 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/utils/MemorySize.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/utils/MemorySize.java @@ -12,7 +12,7 @@ */ package org.apache.activemq.utils; -import org.apache.activemq.core.client.HornetQClientLogger; +import org.apache.activemq.core.client.ActiveMQClientLogger; import java.lang.ref.WeakReference; @@ -105,7 +105,7 @@ public class MemorySize // throw new IllegalStateException("Warning: JVM allocated more data what would make results invalid " + // totalMemory1 + ":" + totalMemory2); - HornetQClientLogger.LOGGER.jvmAllocatedMoreMemory(totalMemory1, totalMemory2); + ActiveMQClientLogger.LOGGER.jvmAllocatedMoreMemory(totalMemory1, totalMemory2); } return size; http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/utils/OrderedExecutorFactory.java ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/java/org/apache/activemq/utils/OrderedExecutorFactory.java b/activemq-core-client/src/main/java/org/apache/activemq/utils/OrderedExecutorFactory.java index e6debde..991e72e 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/utils/OrderedExecutorFactory.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/utils/OrderedExecutorFactory.java @@ -16,7 +16,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.Executor; import org.apache.activemq.api.core.ActiveMQInterruptedException; -import org.apache.activemq.core.client.HornetQClientLogger; +import org.apache.activemq.core.client.ActiveMQClientLogger; /** @@ -106,11 +106,11 @@ public final class OrderedExecutorFactory implements ExecutorFactory catch (ActiveMQInterruptedException e) { // This could happen during shutdowns. Nothing to be concerned about here - HornetQClientLogger.LOGGER.debug("Interrupted Thread", e); + ActiveMQClientLogger.LOGGER.debug("Interrupted Thread", e); } catch (Throwable t) { - HornetQClientLogger.LOGGER.caughtunexpectedThrowable(t); + ActiveMQClientLogger.LOGGER.caughtunexpectedThrowable(t); } } } http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/utils/SoftValueHashMap.java ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/java/org/apache/activemq/utils/SoftValueHashMap.java b/activemq-core-client/src/main/java/org/apache/activemq/utils/SoftValueHashMap.java index d0eef04..304fddf 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/utils/SoftValueHashMap.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/utils/SoftValueHashMap.java @@ -24,7 +24,7 @@ import java.util.Set; import java.util.TreeSet; import java.util.concurrent.atomic.AtomicLong; -import org.apache.activemq.core.client.HornetQClientLogger; +import org.apache.activemq.core.client.ActiveMQClientLogger; /** * A SoftValueHashMap @@ -35,7 +35,7 @@ import org.apache.activemq.core.client.HornetQClientLogger; */ public class SoftValueHashMap implements Map { - private final boolean isTrace = HornetQClientLogger.LOGGER.isTraceEnabled(); + private final boolean isTrace = ActiveMQClientLogger.LOGGER.isTraceEnabled(); // The soft references that are already good. // too bad there's no way to override the queue method on ReferenceQueue, so I wouldn't need this @@ -190,7 +190,7 @@ public class SoftValueHashMap implemen if (isTrace) { - HornetQClientLogger.LOGGER.trace("Removing " + removed + " with id = " + ref.key + " from SoftValueHashMap"); + ActiveMQClientLogger.LOGGER.trace("Removing " + removed + " with id = " + ref.key + " from SoftValueHashMap"); } if (mapDelegate.size() <= maxElements) http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/utils/VersionLoader.java ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/java/org/apache/activemq/utils/VersionLoader.java b/activemq-core-client/src/main/java/org/apache/activemq/utils/VersionLoader.java index 2710d8f..a9fb2c6 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/utils/VersionLoader.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/utils/VersionLoader.java @@ -25,7 +25,7 @@ import java.util.List; import java.util.Properties; import java.util.StringTokenizer; -import org.apache.activemq.core.client.HornetQClientLogger; +import org.apache.activemq.core.client.ActiveMQClientLogger; import org.apache.activemq.core.version.Version; import org.apache.activemq.core.version.impl.VersionImpl; @@ -38,9 +38,9 @@ import org.apache.activemq.core.version.impl.VersionImpl; */ public final class VersionLoader { - public static final String VERSION_PROP_FILE_KEY = "hornetq.version.property.filename"; + public static final String VERSION_PROP_FILE_KEY = "activemq.version.property.filename"; - public static final String DEFAULT_PROP_FILE_NAME = "hornetq-version.properties"; + public static final String DEFAULT_PROP_FILE_NAME = "activemq-version.properties"; private static String PROP_FILE_NAME; @@ -63,7 +63,7 @@ public final class VersionLoader } catch (Throwable e) { - HornetQClientLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQClientLogger.LOGGER.warn(e.getMessage(), e); PROP_FILE_NAME = null; } @@ -77,7 +77,7 @@ public final class VersionLoader catch (Throwable e) { VersionLoader.versions = null; - HornetQClientLogger.LOGGER.error(e.getMessage(), e); + ActiveMQClientLogger.LOGGER.error(e.getMessage(), e); } } @@ -123,19 +123,19 @@ public final class VersionLoader { if (in == null) { - HornetQClientLogger.LOGGER.noVersionOnClasspath(getClasspathString()); + ActiveMQClientLogger.LOGGER.noVersionOnClasspath(getClasspathString()); throw new RuntimeException(VersionLoader.PROP_FILE_NAME + " is not available"); } try { versionProps.load(in); - String versionName = versionProps.getProperty("hornetq.version.versionName"); - int majorVersion = Integer.valueOf(versionProps.getProperty("hornetq.version.majorVersion")); - int minorVersion = Integer.valueOf(versionProps.getProperty("hornetq.version.minorVersion")); - int microVersion = Integer.valueOf(versionProps.getProperty("hornetq.version.microVersion")); - int[] incrementingVersions = parseCompatibleVersionList(versionProps.getProperty("hornetq.version.incrementingVersion")); - String versionSuffix = versionProps.getProperty("hornetq.version.versionSuffix"); - int[] compatibleVersionArray = parseCompatibleVersionList(versionProps.getProperty("hornetq.version.compatibleVersionList")); + String versionName = versionProps.getProperty("activemq.version.versionName"); + int majorVersion = Integer.valueOf(versionProps.getProperty("activemq.version.majorVersion")); + int minorVersion = Integer.valueOf(versionProps.getProperty("activemq.version.minorVersion")); + int microVersion = Integer.valueOf(versionProps.getProperty("activemq.version.microVersion")); + int[] incrementingVersions = parseCompatibleVersionList(versionProps.getProperty("activemq.version.incrementingVersion")); + String versionSuffix = versionProps.getProperty("activemq.version.versionSuffix"); + int[] compatibleVersionArray = parseCompatibleVersionList(versionProps.getProperty("activemq.version.compatibleVersionList")); List definedVersions = new ArrayList(incrementingVersions.length); for (int incrementingVersion : incrementingVersions) { http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/utils/XMLUtil.java ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/java/org/apache/activemq/utils/XMLUtil.java b/activemq-core-client/src/main/java/org/apache/activemq/utils/XMLUtil.java index 48bdec4..5f1fa7e 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/utils/XMLUtil.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/utils/XMLUtil.java @@ -29,8 +29,8 @@ import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.List; -import org.apache.activemq.core.client.HornetQClientLogger; -import org.apache.activemq.core.client.HornetQClientMessageBundle; +import org.apache.activemq.core.client.ActiveMQClientLogger; +import org.apache.activemq.core.client.ActiveMQClientMessageBundle; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; @@ -210,7 +210,7 @@ public final class XMLUtil } catch (Exception e) { - HornetQClientLogger.LOGGER.errorOnXMLTransform(e, n); + ActiveMQClientLogger.LOGGER.errorOnXMLTransform(e, n); return null; } } @@ -265,17 +265,17 @@ public final class XMLUtil { if (node == null) { - throw HornetQClientMessageBundle.BUNDLE.firstNodeNull(); + throw ActiveMQClientMessageBundle.BUNDLE.firstNodeNull(); } if (node2 == null) { - throw HornetQClientMessageBundle.BUNDLE.secondNodeNull(); + throw ActiveMQClientMessageBundle.BUNDLE.secondNodeNull(); } if (!node.getNodeName().equals(node2.getNodeName())) { - throw HornetQClientMessageBundle.BUNDLE.nodeHaveDifferentNames(); + throw ActiveMQClientMessageBundle.BUNDLE.nodeHaveDifferentNames(); } int attrCount = 0; @@ -294,7 +294,7 @@ public final class XMLUtil if (attrCount != attrCount2) { - throw HornetQClientMessageBundle.BUNDLE.nodeHaveDifferentAttNumber(); + throw ActiveMQClientMessageBundle.BUNDLE.nodeHaveDifferentAttNumber(); } outer: @@ -315,14 +315,14 @@ public final class XMLUtil continue outer; } } - throw HornetQClientMessageBundle.BUNDLE.attsDontMatch(name, value); + throw ActiveMQClientMessageBundle.BUNDLE.attsDontMatch(name, value); } boolean hasChildren = node.hasChildNodes(); if (hasChildren != node2.hasChildNodes()) { - throw HornetQClientMessageBundle.BUNDLE.oneNodeHasChildren(); + throw ActiveMQClientMessageBundle.BUNDLE.oneNodeHasChildren(); } if (hasChildren) @@ -338,7 +338,7 @@ public final class XMLUtil if (length != nodes2.size()) { - throw HornetQClientMessageBundle.BUNDLE.nodeHasDifferentChildNumber(); + throw ActiveMQClientMessageBundle.BUNDLE.nodeHasDifferentChildNumber(); } for (int i = 0; i < length; i++) @@ -402,7 +402,7 @@ public final class XMLUtil val = parts[1].trim(); } String sysProp = System.getProperty(prop, val); - HornetQClientLogger.LOGGER.debug("replacing " + subString + " with " + sysProp); + ActiveMQClientLogger.LOGGER.debug("replacing " + subString + " with " + sysProp); xml = xml.replace(subString, sysProp); } @@ -419,7 +419,7 @@ public final class XMLUtil } catch (NumberFormatException e) { - throw HornetQClientMessageBundle.BUNDLE.mustBeLong(elem, value); + throw ActiveMQClientMessageBundle.BUNDLE.mustBeLong(elem, value); } } @@ -433,7 +433,7 @@ public final class XMLUtil } catch (NumberFormatException e) { - throw HornetQClientMessageBundle.BUNDLE.mustBeInteger(elem, value); + throw ActiveMQClientMessageBundle.BUNDLE.mustBeInteger(elem, value); } } @@ -447,7 +447,7 @@ public final class XMLUtil } catch (NumberFormatException e) { - throw HornetQClientMessageBundle.BUNDLE.mustBeBoolean(elem, value); + throw ActiveMQClientMessageBundle.BUNDLE.mustBeBoolean(elem, value); } } @@ -461,7 +461,7 @@ public final class XMLUtil } catch (NumberFormatException e) { - throw HornetQClientMessageBundle.BUNDLE.mustBeDouble(elem, value); + throw ActiveMQClientMessageBundle.BUNDLE.mustBeDouble(elem, value); } } @@ -479,7 +479,7 @@ public final class XMLUtil } catch (SAXException e) { - HornetQClientLogger.LOGGER.errorOnXMLTransformInvalidConf(e); + ActiveMQClientLogger.LOGGER.errorOnXMLTransformInvalidConf(e); throw new IllegalStateException("Invalid configuration", e); } http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/java/org/apache/activemq/utils/package-info.java ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/java/org/apache/activemq/utils/package-info.java b/activemq-core-client/src/main/java/org/apache/activemq/utils/package-info.java index eef54c6..df23f67 100644 --- a/activemq-core-client/src/main/java/org/apache/activemq/utils/package-info.java +++ b/activemq-core-client/src/main/java/org/apache/activemq/utils/package-info.java @@ -13,7 +13,7 @@ /** * Utilities and helper classes. *
- * This package defines the utilities class used by HornetQ. + * This package defines the utilities class used by ActiveMQ. */ package org.apache.activemq.utils; http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/resources/activemq-version.properties ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/resources/activemq-version.properties b/activemq-core-client/src/main/resources/activemq-version.properties new file mode 100644 index 0000000..860a573 --- /dev/null +++ b/activemq-core-client/src/main/resources/activemq-version.properties @@ -0,0 +1,9 @@ +activemq.version.versionName=${activemq.version.versionName} +activemq.version.majorVersion=${activemq.version.majorVersion} +activemq.version.minorVersion=${activemq.version.minorVersion} +activemq.version.microVersion=${activemq.version.microVersion} +activemq.version.incrementingVersion=${activemq.version.incrementingVersion} +activemq.version.versionSuffix=${activemq.version.versionSuffix} +activemq.version.versionTag=${activemq.version.versionTag} +activemq.netty.version=${netty.version.string} +activemq.version.compatibleVersionList=121,122,123,124,125 http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/main/resources/hornetq-version.properties ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/main/resources/hornetq-version.properties b/activemq-core-client/src/main/resources/hornetq-version.properties deleted file mode 100644 index 53cf7c7..0000000 --- a/activemq-core-client/src/main/resources/hornetq-version.properties +++ /dev/null @@ -1,9 +0,0 @@ -hornetq.version.versionName=${hornetq.version.versionName} -hornetq.version.majorVersion=${hornetq.version.majorVersion} -hornetq.version.minorVersion=${hornetq.version.minorVersion} -hornetq.version.microVersion=${hornetq.version.microVersion} -hornetq.version.incrementingVersion=${hornetq.version.incrementingVersion} -hornetq.version.versionSuffix=${hornetq.version.versionSuffix} -hornetq.version.versionTag=${hornetq.version.versionTag} -hornetq.netty.version=${netty.version.string} -hornetq.version.compatibleVersionList=121,122,123,124,125 http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-core-client/src/test/java/org/apache/activemq/tests/CoreUnitTestCase.java ---------------------------------------------------------------------- diff --git a/activemq-core-client/src/test/java/org/apache/activemq/tests/CoreUnitTestCase.java b/activemq-core-client/src/test/java/org/apache/activemq/tests/CoreUnitTestCase.java index 327325a..c067882 100644 --- a/activemq-core-client/src/test/java/org/apache/activemq/tests/CoreUnitTestCase.java +++ b/activemq-core-client/src/test/java/org/apache/activemq/tests/CoreUnitTestCase.java @@ -16,7 +16,7 @@ package org.apache.activemq.tests; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.apache.activemq.core.client.HornetQClientLogger; +import org.apache.activemq.core.client.ActiveMQClientLogger; import org.junit.Assert; import org.junit.Rule; import org.junit.rules.TestRule; @@ -33,7 +33,7 @@ public abstract class CoreUnitTestCase extends Assert } } - private static final HornetQClientLogger log = HornetQClientLogger.LOGGER; + private static final ActiveMQClientLogger log = ActiveMQClientLogger.LOGGER; @Rule public TestRule watcher = new TestWatcher() http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-dto/src/main/java/org/apache/activemq/dto/XmlUtil.java ---------------------------------------------------------------------- diff --git a/activemq-dto/src/main/java/org/apache/activemq/dto/XmlUtil.java b/activemq-dto/src/main/java/org/apache/activemq/dto/XmlUtil.java index 32ae14a..eb1cec0 100644 --- a/activemq-dto/src/main/java/org/apache/activemq/dto/XmlUtil.java +++ b/activemq-dto/src/main/java/org/apache/activemq/dto/XmlUtil.java @@ -86,7 +86,7 @@ public class XmlUtil Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); sf.setFeature("http://apache.org/xml/features/validation/schema-full-checking", false); - InputStream xsdStream = XmlUtil.class.getClassLoader().getResourceAsStream("org.apache.activemq/dto/hornetq.xsd"); + InputStream xsdStream = XmlUtil.class.getClassLoader().getResourceAsStream("org.apache.activemq/dto/activemq.xsd"); StreamSource xsdSource = new StreamSource(xsdStream); Schema schema = sf.newSchema(xsdSource); unmarshaller.setSchema(schema); http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-dto/src/main/java/org/apache/activemq/dto/package-info.java ---------------------------------------------------------------------- diff --git a/activemq-dto/src/main/java/org/apache/activemq/dto/package-info.java b/activemq-dto/src/main/java/org/apache/activemq/dto/package-info.java index 4900d55..5be7441 100644 --- a/activemq-dto/src/main/java/org/apache/activemq/dto/package-info.java +++ b/activemq-dto/src/main/java/org/apache/activemq/dto/package-info.java @@ -11,9 +11,9 @@ * permissions and limitations under the License. */ /** - * The JAXB POJOs for the XML configuration of HornetQ broker + * The JAXB POJOs for the XML configuration of ActiveMQ broker */ @javax.xml.bind.annotation.XmlSchema( - namespace = "http://hornetq.org/schema", + namespace = "http://activemq.org/schema", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package org.apache.activemq.dto; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/ActiveMQJMSClient.java ---------------------------------------------------------------------- diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/ActiveMQJMSClient.java b/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/ActiveMQJMSClient.java new file mode 100644 index 0000000..dcc4dc6 --- /dev/null +++ b/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/ActiveMQJMSClient.java @@ -0,0 +1,234 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.api.jms; + +import javax.jms.Queue; +import javax.jms.Topic; + +import org.apache.activemq.api.core.DiscoveryGroupConfiguration; +import org.apache.activemq.api.core.TransportConfiguration; +import org.apache.activemq.jms.client.ActiveMQConnectionFactory; +import org.apache.activemq.jms.client.ActiveMQDestination; +import org.apache.activemq.jms.client.ActiveMQJMSConnectionFactory; +import org.apache.activemq.jms.client.ActiveMQQueueConnectionFactory; +import org.apache.activemq.jms.client.ActiveMQTopicConnectionFactory; +import org.apache.activemq.jms.client.ActiveMQXAConnectionFactory; +import org.apache.activemq.jms.client.ActiveMQXAQueueConnectionFactory; +import org.apache.activemq.jms.client.ActiveMQXATopicConnectionFactory; + +/** + * A utility class for creating ActiveMQ client-side JMS managed resources. + * + * @author Andy Taylor + */ +public class ActiveMQJMSClient +{ + + /** + * Creates a ActiveMQConnectionFactory that receives cluster topology updates from the cluster as + * servers leave or join and new backups are appointed or removed. + *

+ * The discoveryAddress and discoveryPort parameters in this method are used to listen for UDP + * broadcasts which contain connection information for members of the cluster. The broadcasted + * connection information is simply used to make an initial connection to the cluster, once that + * connection is made, up to date cluster topology information is downloaded and automatically + * updated whenever the cluster topology changes. If the topology includes backup servers that + * information is also propagated to the client so that it can know which server to failover onto + * in case of live server failure. + * @param discoveryAddress The UDP group address to listen for updates + * @param discoveryPort the UDP port to listen for updates + * @return the ActiveMQConnectionFactory + */ + public static ActiveMQConnectionFactory createConnectionFactoryWithHA(final DiscoveryGroupConfiguration groupConfiguration, JMSFactoryType jmsFactoryType) + { + ActiveMQConnectionFactory factory = null; + if (jmsFactoryType.equals(JMSFactoryType.CF)) + { + factory = new ActiveMQJMSConnectionFactory(true, groupConfiguration); + } + else if (jmsFactoryType.equals(JMSFactoryType.QUEUE_CF)) + { + factory = new ActiveMQQueueConnectionFactory(true, groupConfiguration); + } + else if (jmsFactoryType.equals(JMSFactoryType.TOPIC_CF)) + { + factory = new ActiveMQTopicConnectionFactory(true, groupConfiguration); + } + else if (jmsFactoryType.equals(JMSFactoryType.XA_CF)) + { + factory = new ActiveMQXAConnectionFactory(true, groupConfiguration); + } + else if (jmsFactoryType.equals(JMSFactoryType.QUEUE_XA_CF)) + { + factory = new ActiveMQXAQueueConnectionFactory(true, groupConfiguration); + } + else if (jmsFactoryType.equals(JMSFactoryType.TOPIC_XA_CF)) + { + factory = new ActiveMQXATopicConnectionFactory(true, groupConfiguration); + } + + return factory; + } + + /** + * Create a ActiveMQConnectionFactory which creates session factories from a set of live servers, no HA backup information is propagated to the client + * + * The UDP address and port are used to listen for live servers in the cluster + * + * @param discoveryAddress The UDP group address to listen for updates + * @param discoveryPort the UDP port to listen for updates + * @return the ActiveMQConnectionFactory + */ + public static ActiveMQConnectionFactory createConnectionFactoryWithoutHA(final DiscoveryGroupConfiguration groupConfiguration, JMSFactoryType jmsFactoryType) + { + ActiveMQConnectionFactory factory = null; + if (jmsFactoryType.equals(JMSFactoryType.CF)) + { + factory = new ActiveMQJMSConnectionFactory(false, groupConfiguration); + } + else if (jmsFactoryType.equals(JMSFactoryType.QUEUE_CF)) + { + factory = new ActiveMQQueueConnectionFactory(false, groupConfiguration); + } + else if (jmsFactoryType.equals(JMSFactoryType.TOPIC_CF)) + { + factory = new ActiveMQTopicConnectionFactory(false, groupConfiguration); + } + else if (jmsFactoryType.equals(JMSFactoryType.XA_CF)) + { + factory = new ActiveMQXAConnectionFactory(false, groupConfiguration); + } + else if (jmsFactoryType.equals(JMSFactoryType.QUEUE_XA_CF)) + { + factory = new ActiveMQXAQueueConnectionFactory(false, groupConfiguration); + } + else if (jmsFactoryType.equals(JMSFactoryType.TOPIC_XA_CF)) + { + factory = new ActiveMQXATopicConnectionFactory(false, groupConfiguration); + } + + return factory; + } + + /** + * Create a ActiveMQConnectionFactory which will receive cluster topology updates from the cluster + * as servers leave or join and new backups are appointed or removed. + *

+ * The initial list of servers supplied in this method is simply to make an initial connection to + * the cluster, once that connection is made, up to date cluster topology information is + * downloaded and automatically updated whenever the cluster topology changes. If the topology + * includes backup servers that information is also propagated to the client so that it can know + * which server to failover onto in case of live server failure. + * @param initialServers The initial set of servers used to make a connection to the cluster. + * Each one is tried in turn until a successful connection is made. Once a connection + * is made, the cluster topology is downloaded and the rest of the list is ignored. + * @return the ActiveMQConnectionFactory + */ + public static ActiveMQConnectionFactory createConnectionFactoryWithHA(JMSFactoryType jmsFactoryType, final TransportConfiguration... initialServers) + { + ActiveMQConnectionFactory factory = null; + if (jmsFactoryType.equals(JMSFactoryType.CF)) + { + factory = new ActiveMQJMSConnectionFactory(true, initialServers); + } + else if (jmsFactoryType.equals(JMSFactoryType.QUEUE_CF)) + { + factory = new ActiveMQQueueConnectionFactory(true, initialServers); + } + else if (jmsFactoryType.equals(JMSFactoryType.TOPIC_CF)) + { + factory = new ActiveMQTopicConnectionFactory(true, initialServers); + } + else if (jmsFactoryType.equals(JMSFactoryType.XA_CF)) + { + factory = new ActiveMQXAConnectionFactory(true, initialServers); + } + else if (jmsFactoryType.equals(JMSFactoryType.QUEUE_XA_CF)) + { + factory = new ActiveMQXAQueueConnectionFactory(true, initialServers); + } + else if (jmsFactoryType.equals(JMSFactoryType.TOPIC_XA_CF)) + { + factory = new ActiveMQXATopicConnectionFactory(true, initialServers); + } + + return factory; + } + + /** + * Create a ActiveMQConnectionFactory which creates session factories using a static list of + * transportConfigurations. + *

+ * The ActiveMQConnectionFactory is not updated automatically as the cluster topology changes, and + * no HA backup information is propagated to the client + * @param transportConfigurations + * @return the ActiveMQConnectionFactory + */ + public static ActiveMQConnectionFactory createConnectionFactoryWithoutHA(JMSFactoryType jmsFactoryType, final TransportConfiguration... transportConfigurations) + { + ActiveMQConnectionFactory factory = null; + if (jmsFactoryType.equals(JMSFactoryType.CF)) + { + factory = new ActiveMQJMSConnectionFactory(false, transportConfigurations); + } + else if (jmsFactoryType.equals(JMSFactoryType.QUEUE_CF)) + { + factory = new ActiveMQQueueConnectionFactory(false, transportConfigurations); + } + else if (jmsFactoryType.equals(JMSFactoryType.TOPIC_CF)) + { + factory = new ActiveMQTopicConnectionFactory(false, transportConfigurations); + } + else if (jmsFactoryType.equals(JMSFactoryType.XA_CF)) + { + factory = new ActiveMQXAConnectionFactory(false, transportConfigurations); + } + else if (jmsFactoryType.equals(JMSFactoryType.QUEUE_XA_CF)) + { + factory = new ActiveMQXAQueueConnectionFactory(false, transportConfigurations); + } + else if (jmsFactoryType.equals(JMSFactoryType.TOPIC_XA_CF)) + { + factory = new ActiveMQXATopicConnectionFactory(false, transportConfigurations); + } + + return factory; + } + + /** + * Creates a client-side representation of a JMS Topic. + * + * @param name the name of the topic + * @return The Topic + */ + public static Topic createTopic(final String name) + { + return ActiveMQDestination.createTopic(name); + } + + /** + * Creates a client-side representation of a JMS Queue. + * + * @param name the name of the queue + * @return The Queue + */ + public static Queue createQueue(final String name) + { + return ActiveMQDestination.createQueue(name); + } + + private ActiveMQJMSClient() + { + // Utility class + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/034adfbf/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/ActiveMQJMSConstants.java ---------------------------------------------------------------------- diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/ActiveMQJMSConstants.java b/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/ActiveMQJMSConstants.java new file mode 100644 index 0000000..7a7acf1 --- /dev/null +++ b/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/ActiveMQJMSConstants.java @@ -0,0 +1,38 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.api.jms; + +/** + * Constants for ActiveMQ for property keys used for ActiveMQ specific extensions to JMS. + * + * @author Tim Fox + * + * + */ +public class ActiveMQJMSConstants +{ + public static final String JMS_ACTIVEMQ_INPUT_STREAM = "JMS_HQ_InputStream"; + + public static final String JMS_ACTIVEMQ_OUTPUT_STREAM = "JMS_HQ_OutputStream"; + + public static final String JMS_ACTIVEMQ_SAVE_STREAM = "JMS_HQ_SaveStream"; + + public static final String JBOSS_MESSAGING_BRIDGE_MESSAGE_ID_LIST = "HQ_BRIDGE_MSG_ID_LIST"; + + public static final int PRE_ACKNOWLEDGE = 100; + + public static final int INDIVIDUAL_ACKNOWLEDGE = 101; + + public static final String JMS_ACTIVEMQ_ENABLE_BYTE_ARRAY_JMS_CORRELATION_ID_PROPERTY_NAME = + "amq.jms.support-bytes-id"; +}