From 7c9fec6e252ff16cc22112780da7b8d67bdddd58 Mon Sep 17 00:00:00 2001 From: "Hiram R. Chirino" Date: Wed, 7 Nov 2012 22:53:41 +0000 Subject: [PATCH] Removed all un-needed dependencies from the activemq-broker pom. Moved the remaining spring support classes into activemq-spring. git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1406852 13f79535-47bb-0310-9956-ffa450edef68 --- activemq-broker/pom.xml | 313 +----------------- .../activemq/network/jms/JmsConnector.java | 17 +- .../network/jms/JndiLookupFactory.java | 35 ++ ...ctor.java => SimpleJmsQueueConnector.java} | 7 +- ...ctor.java => SimpleJmsTopicConnector.java} | 6 +- ... => SimpleCachedLDAPAuthorizationMap.java} | 36 +- .../QueueBridgeStandaloneReconnectTest.java | 4 +- .../jms/QueueOutboundBridgeReconnectTest.java | 2 +- .../TopicBridgeStandaloneReconnectTest.java | 4 +- .../jms/TopicOutboundBridgeReconnectTest.java | 2 +- ...tCachedLDAPAuthorizationMapLegacyTest.java | 6 +- ...ractCachedLDAPAuthorizationModuleTest.java | 4 +- ...AuthorizationModuleLegacyOpenLDAPTest.java | 6 +- ...chedLDAPAuthorizationModuleLegacyTest.java | 4 +- ...edLDAPAuthorizationModuleOpenLDAPTest.java | 6 +- .../CachedLDAPAuthorizationModuleTest.java | 4 +- .../activemq/network/jms/queue-config.xml | 2 +- .../activemq/network/jms/topic-config.xml | 2 +- .../activemq/network/jms/topic-spring.xml | 2 +- activemq-spring/pom.xml | 13 +- .../network/jms/JmsQueueConnector.java | 36 ++ .../network/jms/JmsTopicConnector.java | 36 ++ .../jms/JndiTemplateLookupFactory.java | 37 +++ .../security/CachedLDAPAuthorizationMap.java | 26 ++ .../activemq/spring/SpringBrokerContext.java | 0 .../activemq/spring/SpringSslContext.java | 0 .../org/apache/activemq/spring/Utils.java | 0 .../store/PersistenceAdapterFactoryBean.java | 0 .../activemq/xbean/BrokerFactoryBean.java | 0 .../activemq/xbean/XBeanBrokerFactory.java | 0 .../activemq/xbean/XBeanBrokerService.java | 0 .../org/apache/activemq/xbean/package.html | 0 32 files changed, 233 insertions(+), 377 deletions(-) create mode 100644 activemq-broker/src/main/java/org/apache/activemq/network/jms/JndiLookupFactory.java rename activemq-broker/src/main/java/org/apache/activemq/network/jms/{JmsQueueConnector.java => SimpleJmsQueueConnector.java} (98%) rename activemq-broker/src/main/java/org/apache/activemq/network/jms/{JmsTopicConnector.java => SimpleJmsTopicConnector.java} (99%) rename activemq-broker/src/main/java/org/apache/activemq/security/{CachedLDAPAuthorizationMap.java => SimpleCachedLDAPAuthorizationMap.java} (97%) create mode 100644 activemq-spring/src/main/java/org/apache/activemq/network/jms/JmsQueueConnector.java create mode 100644 activemq-spring/src/main/java/org/apache/activemq/network/jms/JmsTopicConnector.java create mode 100644 activemq-spring/src/main/java/org/apache/activemq/network/jms/JndiTemplateLookupFactory.java create mode 100644 activemq-spring/src/main/java/org/apache/activemq/security/CachedLDAPAuthorizationMap.java rename {activemq-broker => activemq-spring}/src/main/java/org/apache/activemq/spring/SpringBrokerContext.java (100%) rename {activemq-broker => activemq-spring}/src/main/java/org/apache/activemq/spring/SpringSslContext.java (100%) rename {activemq-broker => activemq-spring}/src/main/java/org/apache/activemq/spring/Utils.java (100%) rename {activemq-jdbc-store => activemq-spring}/src/main/java/org/apache/activemq/store/PersistenceAdapterFactoryBean.java (100%) rename {activemq-broker => activemq-spring}/src/main/java/org/apache/activemq/xbean/BrokerFactoryBean.java (100%) rename {activemq-broker => activemq-spring}/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java (100%) rename {activemq-broker => activemq-spring}/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java (100%) rename {activemq-broker => activemq-spring}/src/main/java/org/apache/activemq/xbean/package.html (100%) diff --git a/activemq-broker/pom.xml b/activemq-broker/pom.xml index f10f562891..4f20de019d 100755 --- a/activemq-broker/pom.xml +++ b/activemq-broker/pom.xml @@ -39,30 +39,12 @@ - org.slf4j - slf4j-api - - - org.apache.geronimo.specs - geronimo-jms_1.1_spec - - - ${project.groupId} - activeio-core - true - - - org.apache.activemq.protobuf - activemq-protobuf - false - - - org.fusesource.mqtt-client - mqtt-client + org.apache.activemq + activemq-client org.apache.activemq - activemq-client + activemq-openwire-legacy @@ -80,67 +62,17 @@ activemq-jaas true - - org.apache.geronimo.specs - geronimo-jta_1.0.1B_spec - true - - - org.apache.geronimo.specs - geronimo-j2ee-management_1.1_spec - - - org.apache.geronimo.specs - geronimo-annotation_1.0_spec - true - - - org.apache.geronimo.specs - geronimo-jacc_1.1_spec - true - - - com.thoughtworks.xstream - xstream - true - - - org.codehaus.jettison - jettison - true - + + + + - - - org.apache.xbean - xbean-spring - true - - - org.springframework - spring-context - - - org.apache.derby - derby - true - + xalan xalan true - - commons-net - commons-net - - - - - org.apache.activemq - activemq-openwire-generator - true - @@ -150,123 +82,11 @@ junit test - - org.hamcrest - hamcrest-all - test - org.slf4j slf4j-log4j12 test - - log4j - log4j - test - - - org.springframework - spring-jms - test - - - org.springframework - spring-test - test - - - commons-io - commons-io - test - - - javax.jmdns - jmdns - true - - - org.jasypt - jasypt - - - org.jasypt - jasypt-spring3 - ${jasypt-version} - true - - - org.mortbay.jetty - jetty-util - 6.1.26 - test - - - - - commons-collections - commons-collections - test - - - commons-primitives - commons-primitives - test - - - axion - axion - test - - - regexp - regexp - test - - - - - org.fusesource.joram-jms-tests - joram-jms-tests - 1.0 - test - - - - org.eclipse.jetty.aggregate - jetty-all-server - test - - - - - org.apache.directory.server - apacheds-core-integ - ${directory-version} - test - - - org.apache.directory.server - apacheds-server-integ - ${directory-version} - test - - - org.jmock - jmock-junit4 - test - - - org.jmock - jmock-legacy - test - - - org.apache.ftpserver - ftpserver-core - ${ftpserver-version} - test - @@ -354,52 +174,6 @@ - - - ${project.basedir}/src/main/resources - - **/* - - - - ${project.basedir}/src/main/filtered-resources - true - - **/* - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.apache.activemq.protobuf - activemq-protobuf - [0.0.0,) - - compile - - - - - - - - - - - - maven-surefire-plugin @@ -430,18 +204,6 @@ - - - org.apache.activemq.protobuf - activemq-protobuf - - - - compile - - - - org.apache.maven.plugins maven-clean-plugin @@ -453,52 +215,6 @@ - - org.apache.maven.plugins - maven-antrun-plugin - - - package - package - - - Deleting unwanted resources from the test-jar - - - - - - - run - - - - site - site - - - Running the XSDDoc task - - - - - - - - run - - - - - - xsddoc - maven-xsddoc-plugin - 1.0 - - - maven-jar-plugin @@ -510,19 +226,6 @@ - - org.codehaus.mojo - cobertura-maven-plugin - - - 50 - 50 - true - 50 - 50 - - - diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/jms/JmsConnector.java b/activemq-broker/src/main/java/org/apache/activemq/network/jms/JmsConnector.java index 9b5fdd3178..5abdf8bdcd 100755 --- a/activemq-broker/src/main/java/org/apache/activemq/network/jms/JmsConnector.java +++ b/activemq-broker/src/main/java/org/apache/activemq/network/jms/JmsConnector.java @@ -38,7 +38,6 @@ import org.apache.activemq.util.LRUCache; import org.apache.activemq.util.ThreadPoolUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.jndi.JndiTemplate; /** * This bridge joins the gap between foreign JMS providers and ActiveMQ As some @@ -51,8 +50,8 @@ public abstract class JmsConnector implements Service { private static final Logger LOG = LoggerFactory.getLogger(JmsConnector.class); protected boolean preferJndiDestinationLookup = false; - protected JndiTemplate jndiLocalTemplate; - protected JndiTemplate jndiOutboundTemplate; + protected JndiLookupFactory jndiLocalTemplate; + protected JndiLookupFactory jndiOutboundTemplate; protected JmsMesageConvertor inboundMessageConvertor; protected JmsMesageConvertor outboundMessageConvertor; protected AtomicBoolean initialized = new AtomicBoolean(false); @@ -104,10 +103,10 @@ public abstract class JmsConnector implements Service { boolean result = initialized.compareAndSet(false, true); if (result) { if (jndiLocalTemplate == null) { - jndiLocalTemplate = new JndiTemplate(); + jndiLocalTemplate = new JndiLookupFactory(); } if (jndiOutboundTemplate == null) { - jndiOutboundTemplate = new JndiTemplate(); + jndiOutboundTemplate = new JndiLookupFactory(); } if (inboundMessageConvertor == null) { inboundMessageConvertor = new SimpleJmsMessageConvertor(); @@ -210,28 +209,28 @@ public abstract class JmsConnector implements Service { /** * @return Returns the jndiTemplate. */ - public JndiTemplate getJndiLocalTemplate() { + public JndiLookupFactory getJndiLocalTemplate() { return jndiLocalTemplate; } /** * @param jndiTemplate The jndiTemplate to set. */ - public void setJndiLocalTemplate(JndiTemplate jndiTemplate) { + public void setJndiLocalTemplate(JndiLookupFactory jndiTemplate) { this.jndiLocalTemplate = jndiTemplate; } /** * @return Returns the jndiOutboundTemplate. */ - public JndiTemplate getJndiOutboundTemplate() { + public JndiLookupFactory getJndiOutboundTemplate() { return jndiOutboundTemplate; } /** * @param jndiOutboundTemplate The jndiOutboundTemplate to set. */ - public void setJndiOutboundTemplate(JndiTemplate jndiOutboundTemplate) { + public void setJndiOutboundTemplate(JndiLookupFactory jndiOutboundTemplate) { this.jndiOutboundTemplate = jndiOutboundTemplate; } diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/jms/JndiLookupFactory.java b/activemq-broker/src/main/java/org/apache/activemq/network/jms/JndiLookupFactory.java new file mode 100644 index 0000000000..12cb3160fa --- /dev/null +++ b/activemq-broker/src/main/java/org/apache/activemq/network/jms/JndiLookupFactory.java @@ -0,0 +1,35 @@ +/** + * 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.network.jms; + +import javax.naming.InitialContext; +import javax.naming.NamingException; + +/** + * @author Hiram Chirino + */ +public class JndiLookupFactory { + + public T lookup(String name, Class clazz) throws NamingException { + InitialContext ctx = new InitialContext(); + try { + return clazz.cast(ctx.lookup(name)); + } finally { + ctx.close(); + } + } +} diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/jms/JmsQueueConnector.java b/activemq-broker/src/main/java/org/apache/activemq/network/jms/SimpleJmsQueueConnector.java similarity index 98% rename from activemq-broker/src/main/java/org/apache/activemq/network/jms/JmsQueueConnector.java rename to activemq-broker/src/main/java/org/apache/activemq/network/jms/SimpleJmsQueueConnector.java index 930831dec6..2825434ddf 100755 --- a/activemq-broker/src/main/java/org/apache/activemq/network/jms/JmsQueueConnector.java +++ b/activemq-broker/src/main/java/org/apache/activemq/network/jms/SimpleJmsQueueConnector.java @@ -31,12 +31,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * A Bridge to other JMS Queue providers - * - * @org.apache.xbean.XBean */ -public class JmsQueueConnector extends JmsConnector { - private static final Logger LOG = LoggerFactory.getLogger(JmsQueueConnector.class); +public class SimpleJmsQueueConnector extends JmsConnector { + private static final Logger LOG = LoggerFactory.getLogger(SimpleJmsQueueConnector.class); private String outboundQueueConnectionFactoryName; private String localConnectionFactoryName; private QueueConnectionFactory outboundQueueConnectionFactory; diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/jms/JmsTopicConnector.java b/activemq-broker/src/main/java/org/apache/activemq/network/jms/SimpleJmsTopicConnector.java similarity index 99% rename from activemq-broker/src/main/java/org/apache/activemq/network/jms/JmsTopicConnector.java rename to activemq-broker/src/main/java/org/apache/activemq/network/jms/SimpleJmsTopicConnector.java index db49539945..b21a7604aa 100755 --- a/activemq-broker/src/main/java/org/apache/activemq/network/jms/JmsTopicConnector.java +++ b/activemq-broker/src/main/java/org/apache/activemq/network/jms/SimpleJmsTopicConnector.java @@ -32,11 +32,9 @@ import org.slf4j.LoggerFactory; /** * A Bridge to other JMS Topic providers - * - * @org.apache.xbean.XBean */ -public class JmsTopicConnector extends JmsConnector { - private static final Logger LOG = LoggerFactory.getLogger(JmsTopicConnector.class); +public class SimpleJmsTopicConnector extends JmsConnector { + private static final Logger LOG = LoggerFactory.getLogger(SimpleJmsTopicConnector.class); private String outboundTopicConnectionFactoryName; private String localConnectionFactoryName; private TopicConnectionFactory outboundTopicConnectionFactory; diff --git a/activemq-broker/src/main/java/org/apache/activemq/security/CachedLDAPAuthorizationMap.java b/activemq-broker/src/main/java/org/apache/activemq/security/SimpleCachedLDAPAuthorizationMap.java similarity index 97% rename from activemq-broker/src/main/java/org/apache/activemq/security/CachedLDAPAuthorizationMap.java rename to activemq-broker/src/main/java/org/apache/activemq/security/SimpleCachedLDAPAuthorizationMap.java index e2e13da705..9707773a7e 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/security/CachedLDAPAuthorizationMap.java +++ b/activemq-broker/src/main/java/org/apache/activemq/security/SimpleCachedLDAPAuthorizationMap.java @@ -24,30 +24,19 @@ import org.apache.activemq.jaas.GroupPrincipal; import org.apache.activemq.jaas.UserPrincipal; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.DisposableBean; -import org.springframework.beans.factory.InitializingBean; -import javax.naming.Binding; -import javax.naming.Context; -import javax.naming.InvalidNameException; -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; +import javax.naming.*; import javax.naming.directory.*; import javax.naming.event.*; import javax.naming.ldap.LdapName; import javax.naming.ldap.Rdn; - import java.util.*; /** - * A {@link DefaultAuthorizationMap} implementation which uses LDAP to initialize and update authorization - * policy. - * - * @org.apache.xbean.XBean */ -public class CachedLDAPAuthorizationMap extends DefaultAuthorizationMap implements InitializingBean, DisposableBean { +public class SimpleCachedLDAPAuthorizationMap extends DefaultAuthorizationMap { - private static final Logger LOG = LoggerFactory.getLogger(CachedLDAPAuthorizationMap.class); + private static final Logger LOG = LoggerFactory.getLogger(SimpleCachedLDAPAuthorizationMap.class); // Configuration Options private String initialContextFactory = "com.sun.jndi.ldap.LdapCtxFactory"; @@ -876,21 +865,18 @@ public class CachedLDAPAuthorizationMap extends DefaultAuthorizationMap implemen context = null; LOG.error("Caught unexpected exception.", namingExceptionEvent.getException()); } - + // Init / Destroy - - @Override public void afterPropertiesSet() throws Exception { query(); } - - @Override + public void destroy() throws Exception { if (eventContext != null) { eventContext.close(); eventContext = null; } - + if (context != null) { context.close(); context = null; @@ -1112,7 +1098,7 @@ public class CachedLDAPAuthorizationMap extends DefaultAuthorizationMap implemen @Override public void namingExceptionThrown(NamingExceptionEvent evt) { - CachedLDAPAuthorizationMap.this.namingExceptionThrown(evt); + SimpleCachedLDAPAuthorizationMap.this.namingExceptionThrown(evt); } @Override @@ -1120,7 +1106,7 @@ public class CachedLDAPAuthorizationMap extends DefaultAuthorizationMap implemen // This test is a hack to work around the fact that Apache DS 2.0 seems to trigger notifications // for the entire sub-tree even when one-level is the selected search scope. if (permissionType != null) { - CachedLDAPAuthorizationMap.this.objectAdded(evt, destinationType, permissionType); + SimpleCachedLDAPAuthorizationMap.this.objectAdded(evt, destinationType, permissionType); } } @@ -1129,13 +1115,13 @@ public class CachedLDAPAuthorizationMap extends DefaultAuthorizationMap implemen // This test is a hack to work around the fact that Apache DS 2.0 seems to trigger notifications // for the entire sub-tree even when one-level is the selected search scope. if (permissionType != null) { - CachedLDAPAuthorizationMap.this.objectRemoved(evt, destinationType, permissionType); + SimpleCachedLDAPAuthorizationMap.this.objectRemoved(evt, destinationType, permissionType); } } @Override public void objectRenamed(NamingEvent evt) { - CachedLDAPAuthorizationMap.this.objectRenamed(evt, destinationType, permissionType); + SimpleCachedLDAPAuthorizationMap.this.objectRenamed(evt, destinationType, permissionType); } @Override @@ -1143,7 +1129,7 @@ public class CachedLDAPAuthorizationMap extends DefaultAuthorizationMap implemen // This test is a hack to work around the fact that Apache DS 2.0 seems to trigger notifications // for the entire sub-tree even when one-level is the selected search scope. if (permissionType != null) { - CachedLDAPAuthorizationMap.this.objectChanged(evt, destinationType, permissionType); + SimpleCachedLDAPAuthorizationMap.this.objectChanged(evt, destinationType, permissionType); } } } diff --git a/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeStandaloneReconnectTest.java b/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeStandaloneReconnectTest.java index 3004884a42..a0066cb3df 100644 --- a/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeStandaloneReconnectTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeStandaloneReconnectTest.java @@ -36,7 +36,7 @@ public class QueueBridgeStandaloneReconnectTest { private static final Logger LOG = LoggerFactory.getLogger(QueueBridgeStandaloneReconnectTest.class); - private JmsQueueConnector jmsQueueConnector; + private SimpleJmsQueueConnector jmsQueueConnector; private BrokerService localBroker; private BrokerService foreignBroker; @@ -206,7 +206,7 @@ public class QueueBridgeStandaloneReconnectTest { outbound = new ActiveMQQueue("RECONNECT.TEST.OUT.QUEUE"); inbound = new ActiveMQQueue("RECONNECT.TEST.IN.QUEUE"); - jmsQueueConnector = new JmsQueueConnector(); + jmsQueueConnector = new SimpleJmsQueueConnector(); // Wire the bridges. jmsQueueConnector.setOutboundQueueBridges( diff --git a/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueOutboundBridgeReconnectTest.java b/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueOutboundBridgeReconnectTest.java index 5895ccab6e..3a4d92abac 100644 --- a/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueOutboundBridgeReconnectTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueOutboundBridgeReconnectTest.java @@ -279,7 +279,7 @@ public class QueueOutboundBridgeReconnectTest { broker.addConnector("tcp://localhost:61616"); broker.addConnector("vm://broker1"); - JmsQueueConnector jmsQueueConnector = new JmsQueueConnector(); + SimpleJmsQueueConnector jmsQueueConnector = new SimpleJmsQueueConnector(); jmsQueueConnector.setOutboundQueueBridges( new OutboundQueueBridge[] {new OutboundQueueBridge("RECONNECT.TEST.QUEUE")}); jmsQueueConnector.setOutboundQueueConnectionFactory( diff --git a/activemq-core/src/test/java/org/apache/activemq/network/jms/TopicBridgeStandaloneReconnectTest.java b/activemq-core/src/test/java/org/apache/activemq/network/jms/TopicBridgeStandaloneReconnectTest.java index 49360125b0..e1e6039066 100644 --- a/activemq-core/src/test/java/org/apache/activemq/network/jms/TopicBridgeStandaloneReconnectTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/network/jms/TopicBridgeStandaloneReconnectTest.java @@ -36,7 +36,7 @@ public class TopicBridgeStandaloneReconnectTest { private static final Logger LOG = LoggerFactory.getLogger(TopicBridgeStandaloneReconnectTest.class); - private JmsTopicConnector jmsTopicConnector; + private SimpleJmsTopicConnector jmsTopicConnector; private BrokerService localBroker; private BrokerService foreignBroker; @@ -203,7 +203,7 @@ public class TopicBridgeStandaloneReconnectTest { outbound = new ActiveMQTopic("RECONNECT.TEST.OUT.TOPIC"); inbound = new ActiveMQTopic("RECONNECT.TEST.IN.TOPIC"); - jmsTopicConnector = new JmsTopicConnector(); + jmsTopicConnector = new SimpleJmsTopicConnector(); // Wire the bridges. jmsTopicConnector.setOutboundTopicBridges( diff --git a/activemq-core/src/test/java/org/apache/activemq/network/jms/TopicOutboundBridgeReconnectTest.java b/activemq-core/src/test/java/org/apache/activemq/network/jms/TopicOutboundBridgeReconnectTest.java index 27e7a636d6..f6fee5da28 100644 --- a/activemq-core/src/test/java/org/apache/activemq/network/jms/TopicOutboundBridgeReconnectTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/network/jms/TopicOutboundBridgeReconnectTest.java @@ -268,7 +268,7 @@ public class TopicOutboundBridgeReconnectTest { broker.addConnector("tcp://localhost:61616"); broker.addConnector("vm://broker1"); - JmsTopicConnector jmsTopicConnector = new JmsTopicConnector(); + SimpleJmsTopicConnector jmsTopicConnector = new SimpleJmsTopicConnector(); jmsTopicConnector.setOutboundTopicBridges( new OutboundTopicBridge[] {new OutboundTopicBridge("RECONNECT.TEST.TOPIC")}); jmsTopicConnector.setOutboundTopicConnectionFactory( diff --git a/activemq-core/src/test/java/org/apache/activemq/security/AbstractCachedLDAPAuthorizationMapLegacyTest.java b/activemq-core/src/test/java/org/apache/activemq/security/AbstractCachedLDAPAuthorizationMapLegacyTest.java index be65eebb32..51f86e3ca6 100755 --- a/activemq-core/src/test/java/org/apache/activemq/security/AbstractCachedLDAPAuthorizationMapLegacyTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/security/AbstractCachedLDAPAuthorizationMapLegacyTest.java @@ -57,7 +57,7 @@ public abstract class AbstractCachedLDAPAuthorizationMapLegacyTest extends Abstr static final GroupPrincipal ADMINS = new GroupPrincipal("admins"); protected LdapConnection connection; - protected CachedLDAPAuthorizationMap map; + protected SimpleCachedLDAPAuthorizationMap map; @Before public void setup() throws Exception { @@ -334,8 +334,8 @@ public abstract class AbstractCachedLDAPAuthorizationMapLegacyTest extends Abstr assertEquals("set size: " + failedACLs, 2, failedACLs.size()); } - protected CachedLDAPAuthorizationMap createMap() { - return new CachedLDAPAuthorizationMap(); + protected SimpleCachedLDAPAuthorizationMap createMap() { + return new SimpleCachedLDAPAuthorizationMap(); } protected abstract InputStream getAddLdif(); diff --git a/activemq-core/src/test/java/org/apache/activemq/security/AbstractCachedLDAPAuthorizationModuleTest.java b/activemq-core/src/test/java/org/apache/activemq/security/AbstractCachedLDAPAuthorizationModuleTest.java index 7c2af05093..3f52ed3ee8 100644 --- a/activemq-core/src/test/java/org/apache/activemq/security/AbstractCachedLDAPAuthorizationModuleTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/security/AbstractCachedLDAPAuthorizationModuleTest.java @@ -54,8 +54,8 @@ public abstract class AbstractCachedLDAPAuthorizationModuleTest protected abstract String getMemberAttributeValueForModifyRequest(); @Override - protected CachedLDAPAuthorizationMap createMap() { - CachedLDAPAuthorizationMap map = super.createMap(); + protected SimpleCachedLDAPAuthorizationMap createMap() { + SimpleCachedLDAPAuthorizationMap map = super.createMap(); map.setLegacyGroupMapping(false); return map; } diff --git a/activemq-core/src/test/java/org/apache/activemq/security/CachedLDAPAuthorizationModuleLegacyOpenLDAPTest.java b/activemq-core/src/test/java/org/apache/activemq/security/CachedLDAPAuthorizationModuleLegacyOpenLDAPTest.java index 2b381cdb12..5c2764a21c 100644 --- a/activemq-core/src/test/java/org/apache/activemq/security/CachedLDAPAuthorizationModuleLegacyOpenLDAPTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/security/CachedLDAPAuthorizationModuleLegacyOpenLDAPTest.java @@ -28,7 +28,7 @@ import org.junit.Ignore; import org.junit.Test; /** - * Test of the {@link CachedLDAPAuthorizationMap} that tests against a basic OpenLDAP instance. + * Test of the {@link SimpleCachedLDAPAuthorizationMap} that tests against a basic OpenLDAP instance. * Disabled by default because it requires external setup to provide the OpenLDAP instance. * * To enable, you need an OpenLDAP with a minimum of the following in the slapd.conf file: @@ -64,8 +64,8 @@ public class CachedLDAPAuthorizationModuleLegacyOpenLDAPTest extends // Subtree rename not implemented by OpenLDAP. } - protected CachedLDAPAuthorizationMap createMap() { - CachedLDAPAuthorizationMap newMap = super.createMap(); + protected SimpleCachedLDAPAuthorizationMap createMap() { + SimpleCachedLDAPAuthorizationMap newMap = super.createMap(); newMap.setConnectionURL("ldap://" + LDAP_HOST + ":" + String.valueOf(LDAP_PORT)); newMap.setConnectionUsername(LDAP_USER); newMap.setConnectionPassword(LDAP_PASS); diff --git a/activemq-core/src/test/java/org/apache/activemq/security/CachedLDAPAuthorizationModuleLegacyTest.java b/activemq-core/src/test/java/org/apache/activemq/security/CachedLDAPAuthorizationModuleLegacyTest.java index a8d9fc5d13..f696cb306f 100644 --- a/activemq-core/src/test/java/org/apache/activemq/security/CachedLDAPAuthorizationModuleLegacyTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/security/CachedLDAPAuthorizationModuleLegacyTest.java @@ -38,8 +38,8 @@ import java.io.InputStream; public class CachedLDAPAuthorizationModuleLegacyTest extends AbstractCachedLDAPAuthorizationMapLegacyTest { @Override - protected CachedLDAPAuthorizationMap createMap() { - CachedLDAPAuthorizationMap map = super.createMap(); + protected SimpleCachedLDAPAuthorizationMap createMap() { + SimpleCachedLDAPAuthorizationMap map = super.createMap(); map.setConnectionURL("ldap://localhost:" + getLdapServer().getPort()); return map; } diff --git a/activemq-core/src/test/java/org/apache/activemq/security/CachedLDAPAuthorizationModuleOpenLDAPTest.java b/activemq-core/src/test/java/org/apache/activemq/security/CachedLDAPAuthorizationModuleOpenLDAPTest.java index 4314bb1843..6d0ca9339d 100644 --- a/activemq-core/src/test/java/org/apache/activemq/security/CachedLDAPAuthorizationModuleOpenLDAPTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/security/CachedLDAPAuthorizationModuleOpenLDAPTest.java @@ -28,7 +28,7 @@ import java.io.IOException; import java.io.InputStream; /** - * Test of the {@link CachedLDAPAuthorizationMap} that tests against a basic OpenLDAP instance. + * Test of the {@link SimpleCachedLDAPAuthorizationMap} that tests against a basic OpenLDAP instance. * Disabled by default because it requires external setup to provide the OpenLDAP instance. * * To enable, you need an OpenLDAP with a minimum of the following in the slapd.conf file: @@ -64,8 +64,8 @@ public class CachedLDAPAuthorizationModuleOpenLDAPTest extends AbstractCachedLDA } @Override - protected CachedLDAPAuthorizationMap createMap() { - CachedLDAPAuthorizationMap newMap = super.createMap(); + protected SimpleCachedLDAPAuthorizationMap createMap() { + SimpleCachedLDAPAuthorizationMap newMap = super.createMap(); newMap.setConnectionURL("ldap://" + LDAP_HOST + ":" + String.valueOf(LDAP_PORT)); newMap.setConnectionUsername(LDAP_USER); newMap.setConnectionPassword(LDAP_PASS); diff --git a/activemq-core/src/test/java/org/apache/activemq/security/CachedLDAPAuthorizationModuleTest.java b/activemq-core/src/test/java/org/apache/activemq/security/CachedLDAPAuthorizationModuleTest.java index 627176ec90..5d6f2e734f 100644 --- a/activemq-core/src/test/java/org/apache/activemq/security/CachedLDAPAuthorizationModuleTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/security/CachedLDAPAuthorizationModuleTest.java @@ -36,8 +36,8 @@ import java.io.InputStream; public class CachedLDAPAuthorizationModuleTest extends AbstractCachedLDAPAuthorizationModuleTest { @Override - protected CachedLDAPAuthorizationMap createMap() { - CachedLDAPAuthorizationMap map = super.createMap(); + protected SimpleCachedLDAPAuthorizationMap createMap() { + SimpleCachedLDAPAuthorizationMap map = super.createMap(); map.setConnectionURL("ldap://localhost:" + getLdapServer().getPort()); return map; } diff --git a/activemq-core/src/test/resources/org/apache/activemq/network/jms/queue-config.xml b/activemq-core/src/test/resources/org/apache/activemq/network/jms/queue-config.xml index 8a730689dc..a1bc29900e 100644 --- a/activemq-core/src/test/resources/org/apache/activemq/network/jms/queue-config.xml +++ b/activemq-core/src/test/resources/org/apache/activemq/network/jms/queue-config.xml @@ -65,7 +65,7 @@ + class="org.apache.activemq.network.jms.SimpleJmsQueueConnector"> diff --git a/activemq-core/src/test/resources/org/apache/activemq/network/jms/topic-config.xml b/activemq-core/src/test/resources/org/apache/activemq/network/jms/topic-config.xml index b898750ca9..228274d311 100644 --- a/activemq-core/src/test/resources/org/apache/activemq/network/jms/topic-config.xml +++ b/activemq-core/src/test/resources/org/apache/activemq/network/jms/topic-config.xml @@ -65,7 +65,7 @@ + class="org.apache.activemq.network.jms.SimpleJmsTopicConnector"> diff --git a/activemq-core/src/test/resources/org/apache/activemq/network/jms/topic-spring.xml b/activemq-core/src/test/resources/org/apache/activemq/network/jms/topic-spring.xml index f94fcd39fc..fcb3ec5e2c 100644 --- a/activemq-core/src/test/resources/org/apache/activemq/network/jms/topic-spring.xml +++ b/activemq-core/src/test/resources/org/apache/activemq/network/jms/topic-spring.xml @@ -65,7 +65,7 @@ + class="org.apache.activemq.network.jms.SimpleJmsTopicConnector"> diff --git a/activemq-spring/pom.xml b/activemq-spring/pom.xml index 35f28cbbfa..476d5b1385 100755 --- a/activemq-spring/pom.xml +++ b/activemq-spring/pom.xml @@ -38,6 +38,9 @@ * + org.apache.activemq.store*;version=${project.version};-noimport:=;-split-package:=merge-last, + org.apache.activemq.security*;version=${project.version};-noimport:=;-split-package:=merge-last, + org.apache.activemq.network*;version=${project.version};-noimport:=;-split-package:=merge-last, org.apache.activemq.spring*;version=${project.version};-noimport:=;-split-package:=merge-last, org.apache.activemq.pool*;version=${project.version};-noimport:=;-split-package:=merge-last, org.apache.activemq.xbean*;version=${project.version};-noimport:=true;-split-package:=merge-last, @@ -54,6 +57,11 @@ org.slf4j slf4j-api + + org.apache.xbean + xbean-spring + true + org.apache.activemq activemq-broker @@ -134,11 +142,6 @@ spring-jms test - - org.apache.xbean - xbean-spring - test - log4j log4j diff --git a/activemq-spring/src/main/java/org/apache/activemq/network/jms/JmsQueueConnector.java b/activemq-spring/src/main/java/org/apache/activemq/network/jms/JmsQueueConnector.java new file mode 100644 index 0000000000..6a6c209a51 --- /dev/null +++ b/activemq-spring/src/main/java/org/apache/activemq/network/jms/JmsQueueConnector.java @@ -0,0 +1,36 @@ +/** + * 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.network.jms; + +import org.springframework.jndi.JndiTemplate; + +/** + * A Bridge to other JMS Queue providers + * + * @org.apache.xbean.XBean + * @author Hiram Chirino + */ +public class JmsQueueConnector extends SimpleJmsQueueConnector { + public void setJndiLocalTemplate(JndiTemplate template) { + super.setJndiLocalTemplate(new JndiTemplateLookupFactory(template)); + } + + public void setJndiOutboundTemplate(JndiTemplate template) { + super.setJndiOutboundTemplate(new JndiTemplateLookupFactory(template)); + } + +} diff --git a/activemq-spring/src/main/java/org/apache/activemq/network/jms/JmsTopicConnector.java b/activemq-spring/src/main/java/org/apache/activemq/network/jms/JmsTopicConnector.java new file mode 100644 index 0000000000..209e4c3c35 --- /dev/null +++ b/activemq-spring/src/main/java/org/apache/activemq/network/jms/JmsTopicConnector.java @@ -0,0 +1,36 @@ +/** + * 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.network.jms; + +import org.springframework.jndi.JndiTemplate; + +/** + * A Bridge to other JMS Topic providers + * + * @org.apache.xbean.XBean + * @author Hiram Chirino + */ +public class JmsTopicConnector extends SimpleJmsTopicConnector { + + public void setJndiLocalTemplate(JndiTemplate template) { + super.setJndiLocalTemplate(new JndiTemplateLookupFactory(template)); + } + + public void setJndiOutboundTemplate(JndiTemplate template) { + super.setJndiOutboundTemplate(new JndiTemplateLookupFactory(template)); + } +} diff --git a/activemq-spring/src/main/java/org/apache/activemq/network/jms/JndiTemplateLookupFactory.java b/activemq-spring/src/main/java/org/apache/activemq/network/jms/JndiTemplateLookupFactory.java new file mode 100644 index 0000000000..194754060d --- /dev/null +++ b/activemq-spring/src/main/java/org/apache/activemq/network/jms/JndiTemplateLookupFactory.java @@ -0,0 +1,37 @@ +/** + * 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.network.jms; + +import org.springframework.jndi.JndiTemplate; + +import javax.naming.NamingException; + +/** +* @author Hiram Chirino +*/ +public class JndiTemplateLookupFactory extends JndiLookupFactory { + private final JndiTemplate template; + + public JndiTemplateLookupFactory(JndiTemplate template) { + this.template = template; + } + + @Override + public T lookup(String name, Class clazz) throws NamingException { + return template.lookup(name, clazz); + } +} diff --git a/activemq-spring/src/main/java/org/apache/activemq/security/CachedLDAPAuthorizationMap.java b/activemq-spring/src/main/java/org/apache/activemq/security/CachedLDAPAuthorizationMap.java new file mode 100644 index 0000000000..3e151f7377 --- /dev/null +++ b/activemq-spring/src/main/java/org/apache/activemq/security/CachedLDAPAuthorizationMap.java @@ -0,0 +1,26 @@ +package org.apache.activemq.security; + +import org.springframework.beans.factory.DisposableBean; +import org.springframework.beans.factory.InitializingBean; + +/** + * A {@link DefaultAuthorizationMap} implementation which uses LDAP to initialize and update authorization + * policy. + * + * @org.apache.xbean.XBean + * + * @author Hiram Chirino + */ +public class CachedLDAPAuthorizationMap extends SimpleCachedLDAPAuthorizationMap implements InitializingBean, DisposableBean { + + @Override + public void afterPropertiesSet() throws Exception { + super.afterPropertiesSet(); + } + + @Override + public void destroy() throws Exception { + super.destroy(); + } + +} diff --git a/activemq-broker/src/main/java/org/apache/activemq/spring/SpringBrokerContext.java b/activemq-spring/src/main/java/org/apache/activemq/spring/SpringBrokerContext.java similarity index 100% rename from activemq-broker/src/main/java/org/apache/activemq/spring/SpringBrokerContext.java rename to activemq-spring/src/main/java/org/apache/activemq/spring/SpringBrokerContext.java diff --git a/activemq-broker/src/main/java/org/apache/activemq/spring/SpringSslContext.java b/activemq-spring/src/main/java/org/apache/activemq/spring/SpringSslContext.java similarity index 100% rename from activemq-broker/src/main/java/org/apache/activemq/spring/SpringSslContext.java rename to activemq-spring/src/main/java/org/apache/activemq/spring/SpringSslContext.java diff --git a/activemq-broker/src/main/java/org/apache/activemq/spring/Utils.java b/activemq-spring/src/main/java/org/apache/activemq/spring/Utils.java similarity index 100% rename from activemq-broker/src/main/java/org/apache/activemq/spring/Utils.java rename to activemq-spring/src/main/java/org/apache/activemq/spring/Utils.java diff --git a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/PersistenceAdapterFactoryBean.java b/activemq-spring/src/main/java/org/apache/activemq/store/PersistenceAdapterFactoryBean.java similarity index 100% rename from activemq-jdbc-store/src/main/java/org/apache/activemq/store/PersistenceAdapterFactoryBean.java rename to activemq-spring/src/main/java/org/apache/activemq/store/PersistenceAdapterFactoryBean.java diff --git a/activemq-broker/src/main/java/org/apache/activemq/xbean/BrokerFactoryBean.java b/activemq-spring/src/main/java/org/apache/activemq/xbean/BrokerFactoryBean.java similarity index 100% rename from activemq-broker/src/main/java/org/apache/activemq/xbean/BrokerFactoryBean.java rename to activemq-spring/src/main/java/org/apache/activemq/xbean/BrokerFactoryBean.java diff --git a/activemq-broker/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java b/activemq-spring/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java similarity index 100% rename from activemq-broker/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java rename to activemq-spring/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java diff --git a/activemq-broker/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java b/activemq-spring/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java similarity index 100% rename from activemq-broker/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java rename to activemq-spring/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java diff --git a/activemq-broker/src/main/java/org/apache/activemq/xbean/package.html b/activemq-spring/src/main/java/org/apache/activemq/xbean/package.html similarity index 100% rename from activemq-broker/src/main/java/org/apache/activemq/xbean/package.html rename to activemq-spring/src/main/java/org/apache/activemq/xbean/package.html