Author: jstrachan
Date: Wed Dec 14 04:37:34 2005
New Revision: 356775
URL: http://svn.apache.org/viewcvs?rev=356775&view=rev
Log:
fixed the SpringBrokerContextListener to spin up a broker from an ActiveMQ XML
file (or at least an XBean file)
Modified:
incubator/activemq/trunk/activemq-web/project.xml
incubator/activemq/trunk/activemq-web/src/java/org/activemq/web/SpringBrokerContextListener.java
Modified: incubator/activemq/trunk/activemq-web/project.xml
URL:
http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-web/project.xml?rev=356775&r1=356774&r2=356775&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-web/project.xml (original)
+++ incubator/activemq/trunk/activemq-web/project.xml Wed Dec 14 04:37:34 2005
@@ -43,6 +43,17 @@
<version>${pom.currentVersion}</version>
</dependency>
+ <!-- for custom XML parsing -->
+ <dependency>
+ <groupId>xbean</groupId>
+ <artifactId>xbean-spring</artifactId>
+ <version>${xbean_spring_version}</version>
+ <url>http://www.gbean.org</url>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+
<!-- For Spring servlet -->
<dependency>
<id>springframework</id>
@@ -53,11 +64,11 @@
<war.bundle>true</war.bundle>
</properties>
</dependency>
-
+
<dependency>
- <groupId>activeio</groupId>
- <artifactId>activeio</artifactId>
- <version>${activeio_version}</version>
+ <groupId>activeio</groupId>
+ <artifactId>activeio</artifactId>
+ <version>${activeio_version}</version>
</dependency>
<!-- optional used for in-web container testing -->
Modified:
incubator/activemq/trunk/activemq-web/src/java/org/activemq/web/SpringBrokerContextListener.java
URL:
http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-web/src/java/org/activemq/web/SpringBrokerContextListener.java?rev=356775&r1=356774&r2=356775&view=diff
==============================================================================
---
incubator/activemq/trunk/activemq-web/src/java/org/activemq/web/SpringBrokerContextListener.java
(original)
+++
incubator/activemq/trunk/activemq-web/src/java/org/activemq/web/SpringBrokerContextListener.java
Wed Dec 14 04:37:34 2005
@@ -17,15 +17,15 @@
**/
package org.activemq.web;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletContextListener;
-import javax.servlet.ServletContextEvent;
-import javax.jms.JMSException;
-
import org.activemq.broker.BrokerService;
+import org.activemq.xbean.BrokerFactoryBean;
import org.springframework.core.io.Resource;
import org.springframework.web.context.support.ServletContextResource;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
/**
* Used to configure and instance of ActiveMQ <tt>BrokerService</tt> using
* ActiveMQ/Spring's xml configuration. <p/> The configuration file is
specified
@@ -105,7 +105,13 @@
}
context.log("Loading ActiveMQ Broker configuration from: " +
brokerURI);
Resource resource = new ServletContextResource(context, brokerURI);
- // return SpringBrokerServiceFactory.newInstance(resource);
- return null;
+ BrokerFactoryBean factory = new BrokerFactoryBean(resource);
+ try {
+ factory.afterPropertiesSet();
+ }
+ catch (Exception e) {
+ context.log("Failed to create broker: " + e, e);
+ }
+ return factory.getBroker();
}
}