Author: djencks
Date: Tue Feb 9 19:56:21 2010
New Revision: 908182
URL: http://svn.apache.org/viewvc?rev=908182&view=rev
Log:
AMQ-2601 Make amq more blueprint-friendly, move away from spring lifecycle
interfaces
Modified:
activemq/trunk/activemq-all/pom.xml
activemq/trunk/activemq-camel/pom.xml
activemq/trunk/activemq-camel/src/main/java/org/apache/activemq/camel/component/CamelEndpointLoader.java
activemq/trunk/activemq-core/pom.xml
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandAgent.java
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/LoggingBrokerPlugin.java
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/DestinationMapEntry.java
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactory.java
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQXAConnectionFactory.java
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/SpringSslContext.java
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/osgi/Activator.java
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java
activemq/trunk/activemq-pool/pom.xml
activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactoryBean.java
activemq/trunk/pom.xml
Modified: activemq/trunk/activemq-all/pom.xml
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-all/pom.xml?rev=908182&r1=908181&r2=908182&view=diff
==============================================================================
--- activemq/trunk/activemq-all/pom.xml (original)
+++ activemq/trunk/activemq-all/pom.xml Tue Feb 9 19:56:21 2010
@@ -49,6 +49,10 @@
<groupId>${pom.groupId}</groupId>
<artifactId>kahadb</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-annotation_1.0_spec</artifactId>
+ </dependency>
</dependencies>
<build>
@@ -78,6 +82,7 @@
<include>org.apache.geronimo.specs:geronimo-jms_1.1_spec</include>
<include>org.apache.geronimo.specs:geronimo-jta_1.0.1B_spec</include>
<include>org.apache.geronimo.specs:geronimo-j2ee-management_1.0_spec</include>
+
<include>org.apache.geronimo.specs:geronimo-annotation_1.0_spec</include>
<include>commons-logging:commons-logging-api</include>
</includes>
</artifactSet>
Modified: activemq/trunk/activemq-camel/pom.xml
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-camel/pom.xml?rev=908182&r1=908181&r2=908182&view=diff
==============================================================================
--- activemq/trunk/activemq-camel/pom.xml (original)
+++ activemq/trunk/activemq-camel/pom.xml Tue Feb 9 19:56:21 2010
@@ -106,6 +106,11 @@
<groupId>${pom.groupId}</groupId>
<artifactId>activemq-pool</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-annotation_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
<!-- testing helpers -->
<dependency>
Modified:
activemq/trunk/activemq-camel/src/main/java/org/apache/activemq/camel/component/CamelEndpointLoader.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-camel/src/main/java/org/apache/activemq/camel/component/CamelEndpointLoader.java?rev=908182&r1=908181&r2=908182&view=diff
==============================================================================
---
activemq/trunk/activemq-camel/src/main/java/org/apache/activemq/camel/component/CamelEndpointLoader.java
(original)
+++
activemq/trunk/activemq-camel/src/main/java/org/apache/activemq/camel/component/CamelEndpointLoader.java
Tue Feb 9 19:56:21 2010
@@ -19,6 +19,8 @@
import java.util.Set;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
@@ -37,15 +39,14 @@
import org.apache.camel.util.ObjectHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.InitializingBean;
/**
* A helper bean which populates a {...@link CamelContext} with ActiveMQ Queue
endpoints
*
* @version $Revision: 1.1 $
+ * @org.apache.xbean.XBean
*/
-public class CamelEndpointLoader implements InitializingBean, DisposableBean,
CamelContextAware {
+public class CamelEndpointLoader implements CamelContextAware {
private static final transient Log LOG =
LogFactory.getLog(CamelEndpointLoader.class);
private CamelContext camelContext;
private EnhancedConnection connection;
@@ -59,6 +60,12 @@
this.camelContext = camelContext;
}
+ /**
+ *
+ * @throws Exception
+ * @org.apache.xbean.InitMethod
+ */
+ @PostConstruct
public void afterPropertiesSet() throws Exception {
ObjectHelper.notNull(camelContext, "camelContext");
if (connection == null) {
@@ -112,6 +119,13 @@
}
}
+
+ /**
+ *
+ * @throws Exception
+ * @org.apache.xbean.DestroyMethod
+ */
+ @PreDestroy
public void destroy() throws Exception {
if (connection != null) {
connection.close();
Modified: activemq/trunk/activemq-core/pom.xml
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/pom.xml?rev=908182&r1=908181&r2=908182&view=diff
==============================================================================
--- activemq/trunk/activemq-core/pom.xml (original)
+++ activemq/trunk/activemq-core/pom.xml Tue Feb 9 19:56:21 2010
@@ -137,6 +137,11 @@
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-annotation_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jacc_1.1_spec</artifactId>
<optional>true</optional>
</dependency>
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=908182&r1=908181&r2=908182&view=diff
==============================================================================
---
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
(original)
+++
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
Tue Feb 9 19:56:21 2010
@@ -31,6 +31,9 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import org.apache.activemq.ActiveMQConnectionMetaData;
@@ -99,6 +102,7 @@
* which can be used to configure the broker as its lazily created.
*
* @version $Revision: 1.1 $
+ * @org.apache.xbean.XBean
*/
public class BrokerService implements Service {
protected CountDownLatch slaveStartSignal = new CountDownLatch(1);
@@ -432,6 +436,13 @@
// Service interface
//
-------------------------------------------------------------------------
+
+ /**
+ *
+ * @throws Exception
+ * @org. apache.xbean.InitMethod
+ */
+ @PostConstruct
public void start() throws Exception {
if (stopped.get() || !started.compareAndSet(false, true)) {
// lets just ignore redundant start() calls
@@ -507,6 +518,12 @@
}
}
+ /**
+ *
+ * @throws Exception
+ * @org.apache .xbean.DestroyMethod
+ */
+ @PreDestroy
public void stop() throws Exception {
if (!started.get()) {
return;
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandAgent.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandAgent.java?rev=908182&r1=908181&r2=908182&view=diff
==============================================================================
---
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandAgent.java
(original)
+++
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandAgent.java
Tue Feb 9 19:56:21 2010
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.broker.util;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
@@ -23,16 +25,12 @@
import javax.jms.JMSException;
import javax.jms.MessageConsumer;
import javax.jms.Session;
-
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.Service;
import org.apache.activemq.advisory.AdvisorySupport;
import org.apache.activemq.util.ServiceStopper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.FactoryBean;
-import org.springframework.beans.factory.InitializingBean;
/**
* An agent which listens to commands on a JMS destination
@@ -40,7 +38,7 @@
* @version $Revision$
* @org.apache.xbean.XBean
*/
-public class CommandAgent implements Service, InitializingBean,
DisposableBean, FactoryBean, ExceptionListener {
+public class CommandAgent implements Service, ExceptionListener {
private static final Log LOG = LogFactory.getLog(CommandAgent.class);
private String brokerUrl = "vm://localhost";
@@ -53,6 +51,12 @@
private Session session;
private MessageConsumer consumer;
+ /**
+ *
+ * @throws Exception
+ * @org.apache.xbean.InitMethod
+ */
+ @PostConstruct
public void start() throws Exception {
session = getConnection().createSession(false,
Session.AUTO_ACKNOWLEDGE);
listener = new CommandMessageListener(session);
@@ -64,6 +68,12 @@
consumer.setMessageListener(listener);
}
+ /**
+ *
+ * @throws Exception
+ * @org.apache.xbean.DestroyMethod
+ */
+ @PreDestroy
public void stop() throws Exception {
ServiceStopper stopper = new ServiceStopper();
if (consumer != null) {
@@ -93,29 +103,6 @@
stopper.throwFirstException();
}
- // the following methods ensure that we are created on startup and the
- // lifecycles respected
- // TODO there must be a simpler way?
- public void afterPropertiesSet() throws Exception {
- start();
- }
-
- public void destroy() throws Exception {
- stop();
- }
-
- public Object getObject() throws Exception {
- return this;
- }
-
- public Class getObjectType() {
- return getClass();
- }
-
- public boolean isSingleton() {
- return true;
- }
-
// Properties
//
-------------------------------------------------------------------------
public String getBrokerUrl() {
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/LoggingBrokerPlugin.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/LoggingBrokerPlugin.java?rev=908182&r1=908181&r2=908182&view=diff
==============================================================================
---
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/LoggingBrokerPlugin.java
(original)
+++
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/LoggingBrokerPlugin.java
Tue Feb 9 19:56:21 2010
@@ -18,6 +18,8 @@
import java.io.IOException;
import java.util.Set;
+
+import javax.annotation.PostConstruct;
import org.apache.activemq.broker.BrokerPluginSupport;
import org.apache.activemq.broker.Connection;
import org.apache.activemq.broker.ConnectionContext;
@@ -44,7 +46,6 @@
import org.apache.activemq.usage.Usage;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.InitializingBean;
/**
* A simple Broker intercepter which allows you to enable/disable logging.
@@ -52,8 +53,7 @@
* @org.apache.xbean.XBean
*/
-public class LoggingBrokerPlugin extends BrokerPluginSupport implements
- InitializingBean {
+public class LoggingBrokerPlugin extends BrokerPluginSupport {
private static final Log LOG =
LogFactory.getLog(LoggingBrokerPlugin.class);
@@ -65,6 +65,12 @@
private boolean logProducerEvents = false;
private boolean logInternalEvents = false;
+ /**
+ *
+ * @throws Exception
+ * @org.apache.xbean.InitMethod
+ */
+ @PostConstruct
public void afterPropertiesSet() throws Exception {
LOG.info("Created LoggingBrokerPlugin: " + this.toString());
}
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/DestinationMapEntry.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/DestinationMapEntry.java?rev=908182&r1=908181&r2=908182&view=diff
==============================================================================
---
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/DestinationMapEntry.java
(original)
+++
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/filter/DestinationMapEntry.java
Tue Feb 9 19:56:21 2010
@@ -16,18 +16,19 @@
*/
package org.apache.activemq.filter;
+import javax.annotation.PostConstruct;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTopic;
-import org.springframework.beans.factory.InitializingBean;
/**
* A base class for entry objects used to construct a destination based policy
* map.
*
* @version $Revision: 1.1 $
+ * @org.apache.xbean.XBean
*/
-public abstract class DestinationMapEntry implements InitializingBean,
Comparable {
+public abstract class DestinationMapEntry implements Comparable {
private ActiveMQDestination destination;
@@ -64,6 +65,12 @@
this.destination = destination;
}
+ /**
+ *
+ * @throws Exception
+ * @org.apache.xbean.InitMethod
+ */
+ @PostConstruct
public void afterPropertiesSet() throws Exception {
if (destination == null) {
throw new IllegalArgumentException("You must specify the
'destination' property");
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactory.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactory.java?rev=908182&r1=908181&r2=908182&view=diff
==============================================================================
---
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactory.java
(original)
+++
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQConnectionFactory.java
Tue Feb 9 19:56:21 2010
@@ -16,8 +16,8 @@
*/
package org.apache.activemq.spring;
+import javax.annotation.PostConstruct;
import org.springframework.beans.factory.BeanNameAware;
-import org.springframework.beans.factory.InitializingBean;
/**
* A <a href="http://www.springframework.org/">Spring</a> enhanced connection
@@ -29,11 +29,17 @@
*
* @version $Revision: $
*/
-public class ActiveMQConnectionFactory extends
org.apache.activemq.ActiveMQConnectionFactory implements InitializingBean,
BeanNameAware {
+public class ActiveMQConnectionFactory extends
org.apache.activemq.ActiveMQConnectionFactory implements BeanNameAware {
private String beanName;
private boolean useBeanNameAsClientIdPrefix;
+ /**
+ *
+ * @throws Exception
+ * @org.apache.xbean.InitMethod
+ */
+ @PostConstruct
public void afterPropertiesSet() throws Exception {
if (isUseBeanNameAsClientIdPrefix() && getClientIDPrefix() == null) {
setClientIDPrefix(getBeanName());
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQXAConnectionFactory.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQXAConnectionFactory.java?rev=908182&r1=908181&r2=908182&view=diff
==============================================================================
---
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQXAConnectionFactory.java
(original)
+++
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/ActiveMQXAConnectionFactory.java
Tue Feb 9 19:56:21 2010
@@ -16,8 +16,8 @@
*/
package org.apache.activemq.spring;
+import javax.annotation.PostConstruct;
import org.springframework.beans.factory.BeanNameAware;
-import org.springframework.beans.factory.InitializingBean;
/**
* A <a href="http://www.springframework.org/">Spring</a> enhanced XA
connection
@@ -29,11 +29,17 @@
*
* @version $Revision: $
*/
-public class ActiveMQXAConnectionFactory extends
org.apache.activemq.ActiveMQXAConnectionFactory implements InitializingBean,
BeanNameAware {
+public class ActiveMQXAConnectionFactory extends
org.apache.activemq.ActiveMQXAConnectionFactory implements BeanNameAware {
private String beanName;
private boolean useBeanNameAsClientIdPrefix;
+ /**
+ *
+ * @throws Exception
+ * @org.apache.xbean.InitMethod
+ */
+ @PostConstruct
public void afterPropertiesSet() throws Exception {
if (isUseBeanNameAsClientIdPrefix() && getClientIDPrefix() == null) {
setClientIDPrefix(getBeanName());
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/SpringSslContext.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/SpringSslContext.java?rev=908182&r1=908181&r2=908182&view=diff
==============================================================================
---
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/SpringSslContext.java
(original)
+++
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/spring/SpringSslContext.java
Tue Feb 9 19:56:21 2010
@@ -24,13 +24,12 @@
import java.util.Arrays;
import java.util.Collection;
+import javax.annotation.PostConstruct;
import javax.net.ssl.KeyManager;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
-
import org.apache.activemq.broker.SslContext;
-import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.io.Resource;
/**
@@ -40,7 +39,7 @@
*
* @version $Revision$
*/
-public class SpringSslContext extends SslContext implements InitializingBean {
+public class SpringSslContext extends SslContext {
private String keyStoreType="jks";
private String trustStoreType="jks";
@@ -55,6 +54,12 @@
private String keyStorePassword;
private String trustStorePassword;
+ /**
+ *
+ * @throws Exception
+ * @org.apache.xbean.InitMethod
+ */
+ @PostConstruct
public void afterPropertiesSet() throws Exception {
keyManagers.addAll(createKeyManagers());
trustManagers.addAll(createTrustManagers());
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/osgi/Activator.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/osgi/Activator.java?rev=908182&r1=908181&r2=908182&view=diff
==============================================================================
---
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/osgi/Activator.java
(original)
+++
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/osgi/Activator.java
Tue Feb 9 19:56:21 2010
@@ -39,7 +39,7 @@
/**
* An OSGi bundle activator for ActiveMQ which adapts the {...@link
org.apache.activemq.util.FactoryFinder}
- * to the OSGi enviorment.
+ * to the OSGi environment.
*
*/
public class Activator implements BundleActivator, SynchronousBundleListener,
ObjectFactory {
@@ -50,6 +50,15 @@
private final ConcurrentMap<Long, BundleWrapper> bundleWrappers = new
ConcurrentHashMap<Long, BundleWrapper>();
private BundleContext bundleContext;
+ /**
+ * constructor for use as a blueprint bean rather than bundle activator
+ * @param bundleContext
+ */
+ public Activator(BundleContext bundleContext) throws Exception {
+ start(bundleContext);
+ }
+
+
// ================================================================
// BundleActivator interface impl
// ================================================================
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java?rev=908182&r1=908181&r2=908182&view=diff
==============================================================================
---
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java
(original)
+++
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java
Tue Feb 9 19:56:21 2010
@@ -18,6 +18,8 @@
import java.io.IOException;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.usage.SystemUsage;
import org.apache.commons.logging.Log;
@@ -45,7 +47,7 @@
* {code}
* @version $Revision: 1.1 $
*/
-public class XBeanBrokerService extends BrokerService implements
InitializingBean, DisposableBean, ApplicationContextAware {
+public class XBeanBrokerService extends BrokerService implements
ApplicationContextAware {
private static final transient Log LOG =
LogFactory.getLog(XBeanBrokerService.class);
private boolean start = true;
@@ -55,6 +57,12 @@
public XBeanBrokerService() {
}
+ /**
+ *
+ * @throws Exception
+ * @org.apache.xbean.InitMethod
+ */
+ @PostConstruct
public void afterPropertiesSet() throws Exception {
ensureSystemUsageHasStore();
if (start) {
@@ -89,6 +97,12 @@
}
}
+ /**
+ *
+ * @throws Exception
+ * @org.apache.xbean.DestroyMethod
+ */
+ @PreDestroy
public void destroy() throws Exception {
stop();
}
Modified: activemq/trunk/activemq-pool/pom.xml
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-pool/pom.xml?rev=908182&r1=908181&r2=908182&view=diff
==============================================================================
--- activemq/trunk/activemq-pool/pom.xml (original)
+++ activemq/trunk/activemq-pool/pom.xml Tue Feb 9 19:56:21 2010
@@ -71,6 +71,11 @@
<artifactId>geronimo-jta_1.0.1B_spec</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-annotation_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
</dependency>
Modified:
activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactoryBean.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactoryBean.java?rev=908182&r1=908181&r2=908182&view=diff
==============================================================================
---
activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactoryBean.java
(original)
+++
activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactoryBean.java
Tue Feb 9 19:56:21 2010
@@ -16,15 +16,13 @@
*/
package org.apache.activemq.pool;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
import javax.jms.ConnectionFactory;
import javax.transaction.TransactionManager;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.pool.ObjectPoolFactory;
-import org.springframework.beans.factory.FactoryBean;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.DisposableBean;
/**
* Simple factory bean used to create a jencks connection pool.
@@ -43,8 +41,9 @@
* the same value than its <code>resourceName</code> property. This will make
sure the transaction manager
* maps correctly the connection factory to the recovery process.
*
+ * @org.apache.xbean.XBean
*/
-public class PooledConnectionFactoryBean implements FactoryBean,
InitializingBean, DisposableBean {
+public class PooledConnectionFactoryBean {
private static final Log LOGGER =
LogFactory.getLog(PooledConnectionFactoryBean.class);
@@ -56,18 +55,6 @@
private String resourceName;
private ObjectPoolFactory poolFactory;
- public Object getObject() throws Exception {
- return pooledConnectionFactory;
- }
-
- public Class getObjectType() {
- return ConnectionFactory.class;
- }
-
- public boolean isSingleton() {
- return true;
- }
-
public int getMaxConnections() {
return maxConnections;
}
@@ -116,6 +103,12 @@
this.poolFactory = poolFactory;
}
+ /**
+ *
+ * @throws Exception
+ * @org.apache.xbean.InitMethod
+ */
+ @PostConstruct
public void afterPropertiesSet() throws Exception {
if (pooledConnectionFactory == null && transactionManager != null &&
resourceName != null) {
try {
@@ -164,6 +157,12 @@
}
}
+ /**
+ *
+ * @throws Exception
+ * @org.apache.xbean.DestroyMethod
+ */
+ @PreDestroy
public void destroy() throws Exception {
if (pooledConnectionFactory != null) {
pooledConnectionFactory.stop();
Modified: activemq/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/activemq/trunk/pom.xml?rev=908182&r1=908181&r2=908182&view=diff
==============================================================================
--- activemq/trunk/pom.xml (original)
+++ activemq/trunk/pom.xml Tue Feb 9 19:56:21 2010
@@ -368,6 +368,12 @@
<artifactId>geronimo-servlet_2.5_spec</artifactId>
<version>1.2</version>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-annotation_1.0_spec</artifactId>
+ <version>1.1.1</version>
+ </dependency>
<!-- =============================== -->