Skip to content

Commit

Permalink
refactoring Spring to make jetty:run work again
Browse files Browse the repository at this point in the history
  • Loading branch information
ajs6f committed Jan 31, 2013
1 parent 7d14804 commit b520319
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 36 deletions.
7 changes: 6 additions & 1 deletion pom.xml
Expand Up @@ -16,7 +16,7 @@
<netbeans.hint.j2eeVersion>1.6</netbeans.hint.j2eeVersion>
<modeshape.version>3.1.0.Final</modeshape.version>
<cxf.version>2.7.2</cxf.version>
<activemq.version>5.7.0</activemq.version>
<activemq.version>5.7.0</activemq.version>
</properties>


Expand Down Expand Up @@ -120,6 +120,11 @@
<version>${activemq.version}</version>
</dependency>

<dependency>
<groupId>org.apache.xbean</groupId>
<artifactId>xbean-spring</artifactId>
<version>3.9</version>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
Expand Down
46 changes: 20 additions & 26 deletions src/main/resources/spring/activemq.xml
@@ -1,23 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

<!-- Allows us to use system properties as variables in this configuration file -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>file:${activemq.conf}/credentials.properties</value>
</property>
</bean>


<!--
The <broker> element is used to configure the ActiveMQ broker.
-->
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}">
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost">

<!--
For better performances use VM cursor and small memory limit.
For more information, see:
Expand All @@ -28,7 +20,7 @@
For more information, see:
http://activemq.apache.org/producer-flow-control.html
-->

<destinationPolicy>
<policyMap>
<policyEntries>
Expand Down Expand Up @@ -59,8 +51,8 @@
</policyEntries>
</policyMap>
</destinationPolicy>


<!--
The managementContext is used to configure how ActiveMQ is exposed in
JMX. By default, ActiveMQ uses the MBean server that is started by
Expand All @@ -71,7 +63,7 @@
<managementContext>
<managementContext createConnector="false"/>
</managementContext>

<!--
Configure message persistence for the broker. The default persistence
mechanism is the KahaDB store (identified by the kahaDB tag).
Expand All @@ -82,8 +74,8 @@
<persistenceAdapter>
<kahaDB directory="${activemq.data}/kahadb"/>
</persistenceAdapter>


<!--
The systemUsage controls the maximum amount of space the broker will
use before slowing down producers. For more information, see:
Expand Down Expand Up @@ -117,7 +109,7 @@
</tempUsage>
</systemUsage>
</systemUsage>

<!--
The transport connectors expose ActiveMQ over a given protocol to
clients and other brokers. For more information, see:
Expand All @@ -126,22 +118,24 @@
-->
<transportConnectors>
<!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600"/>
<transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600"/>
<transportConnector name="openwire"
uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600"
/>
</transportConnectors>

<!-- destroy the spring context on shutdown to stop jetty -->
<shutdownHooks>
<bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
<bean xmlns="http://www.springframework.org/schema/beans"
class="org.apache.activemq.hooks.SpringContextHook"/>
</shutdownHooks>

</broker>

<!--
Enable web consoles, REST and Ajax APIs and demos
Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details
<import resource="jetty.xml"/>
-->
</beans>
</beans>
4 changes: 1 addition & 3 deletions src/main/resources/spring/eventing.xml
Expand Up @@ -7,9 +7,7 @@
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

<import resource="classpath:/spring/repo.xml"/>


<context:annotation-config/>

<bean class="org.fcrepo.modeshape.observer.SimpleObserver"/>
Expand Down
15 changes: 15 additions & 0 deletions src/main/resources/spring/master.xml
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">

<import resource="classpath:/spring/repo.xml"/>
<import resource="classpath:/spring/rest.xml"/>
<import resource="classpath:/spring/eventing.xml"/>

</beans>
2 changes: 0 additions & 2 deletions src/main/resources/spring/rest.xml
Expand Up @@ -11,8 +11,6 @@
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml"/>

<import resource="classpath:/spring/repo.xml"/>

<context:annotation-config/>

<jaxrs:server address="/rest">
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/web.xml
Expand Up @@ -9,7 +9,7 @@

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/classes/spring/*.xml</param-value>
<param-value>WEB-INF/classes/spring/master.xml</param-value>
</context-param>

<listener>
Expand Down
Expand Up @@ -48,9 +48,8 @@ public void TestSimpleIntegration() throws RepositoryException {
e.printStackTrace();
}

// Should be two messages:
// - add node
// - add property jcr:primaryType
// Should be two messages, for each time
// each node becomes a Fedora object

assertEquals("Where are my messages!?", (Integer) 2, messageCount);
}
Expand Down

0 comments on commit b520319

Please sign in to comment.