Author: chirino
Date: Tue Jun 16 16:10:16 2009
New Revision: 785274
URL: http://svn.apache.org/viewvc?rev=785274&view=rev
Log:
starting to a bits to configure the store used by the broker.
Added:
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/KahaDBStoreXml.java
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/MemoryStoreXml.java
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/StoreXml.java
activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/non-persistent-activemq.xml
activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/org/apache/activemq/apollo/jaxb/
activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/org/apache/activemq/apollo/jaxb/jaxb.index
Removed:
activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/org/apache/activemq/apollo/broker/
Modified:
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/BrokerDatabase.java
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/JAXBBrokerFactory.java
activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/VirtualHostXml.java
activemq/sandbox/activemq-flow/activemq-broker/src/test/resources/org/apache/activemq/apollo/jaxb/testSimpleConfig.xml
activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/ActiveMQConnectionFactoryTest.java
Modified: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/BrokerDatabase.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/BrokerDatabase.java?rev=785274&r1=785273&r2=785274&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/BrokerDatabase.java
(original)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/BrokerDatabase.java
Tue Jun 16 16:10:16 2009
@@ -1105,4 +1105,8 @@
this.dispatcher = dispatcher;
}
+ public Store getStore() {
+ return store;
+ }
+
}
Modified: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/JAXBBrokerFactory.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/JAXBBrokerFactory.java?rev=785274&r1=785273&r2=785274&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/JAXBBrokerFactory.java
(original)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/JAXBBrokerFactory.java
Tue Jun 16 16:10:16 2009
@@ -29,7 +29,7 @@
public class JAXBBrokerFactory implements BrokerFactory.Handler {
public Broker createBroker(URI brokerURI) throws Exception {
- JAXBContext context = JAXBContext.newInstance(BrokerXml.class);
+ JAXBContext context = JAXBContext.newInstance("org.apache.activemq.apollo.jaxb");
Unmarshaller unmarshaller = context.createUnmarshaller();
URL configURL;
Added: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/KahaDBStoreXml.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/KahaDBStoreXml.java?rev=785274&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/KahaDBStoreXml.java
(added)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/KahaDBStoreXml.java
Tue Jun 16 16:10:16 2009
@@ -0,0 +1,59 @@
+package org.apache.activemq.apollo.jaxb;
+
+import java.io.File;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.activemq.broker.store.Store;
+import org.apache.activemq.broker.store.kahadb.KahaDBStore;
+
+@XmlRootElement(name="kahadb-store")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class KahaDBStoreXml implements StoreXml {
+
+ @XmlAttribute(name="checkpoint-interval", required=false)
+ private Long checkpointInterval;
+ @XmlAttribute(name="cleanup-interval", required=false)
+ private Long cleanupInterval;
+ @XmlAttribute(name="purge-on-startup", required=false)
+ private Boolean purgeOnStartup;
+ @XmlAttribute(name="index-write-async", required=false)
+ private Boolean indexWriteAsync;
+ @XmlAttribute(name="journal-disk-syncs", required=false)
+ private Boolean journalDiskSyncs;
+ @XmlAttribute(name="fail-if-database-is-locked", required=false)
+ private Boolean failIfDatabaseIsLocked;
+ @XmlAttribute(name="index-write-batch-size", required=false)
+ private Integer indexWriteBatchSize;
+ @XmlAttribute(name="journal-max-file-length", required=false)
+ private Integer journalMaxFileLength;
+ @XmlAttribute(name="directory", required=false)
+ private File directory;
+
+ public Store createStore() {
+ KahaDBStore rc = new KahaDBStore();
+ if( checkpointInterval!=null )
+ rc.setCheckpointInterval(checkpointInterval);
+ if( cleanupInterval!=null )
+ rc.setCleanupInterval(cleanupInterval);
+ if( purgeOnStartup!=null )
+ rc.setDeleteAllMessages(purgeOnStartup);
+ if( indexWriteAsync!=null )
+ rc.setEnableIndexWriteAsync(indexWriteAsync);
+ if( journalDiskSyncs!=null )
+ rc.setEnableJournalDiskSyncs(journalDiskSyncs);
+ if( failIfDatabaseIsLocked!=null )
+ rc.setFailIfDatabaseIsLocked(failIfDatabaseIsLocked);
+ if( indexWriteBatchSize!=null )
+ rc.setIndexWriteBatchSize(indexWriteBatchSize);
+ if( journalMaxFileLength!=null )
+ rc.setJournalMaxFileLength(journalMaxFileLength);
+ if( directory!=null )
+ rc.setStoreDirectory(directory);
+ return rc;
+ }
+
+}
Added: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/MemoryStoreXml.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/MemoryStoreXml.java?rev=785274&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/MemoryStoreXml.java
(added)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/MemoryStoreXml.java
Tue Jun 16 16:10:16 2009
@@ -0,0 +1,19 @@
+package org.apache.activemq.apollo.jaxb;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.activemq.broker.store.Store;
+import org.apache.activemq.broker.store.memory.MemoryStore;
+
+@XmlRootElement(name="memory-store")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class MemoryStoreXml implements StoreXml {
+
+ public Store createStore() {
+ MemoryStore rc = new MemoryStore();
+ return rc;
+ }
+
+}
Added: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/StoreXml.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/StoreXml.java?rev=785274&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/StoreXml.java
(added)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/StoreXml.java
Tue Jun 16 16:10:16 2009
@@ -0,0 +1,13 @@
+package org.apache.activemq.apollo.jaxb;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.activemq.broker.store.Store;
+
+public interface StoreXml {
+
+ Store createStore();
+
+}
Modified: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/VirtualHostXml.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/VirtualHostXml.java?rev=785274&r1=785273&r2=785274&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/VirtualHostXml.java
(original)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/VirtualHostXml.java
Tue Jun 16 16:10:16 2009
@@ -20,7 +20,9 @@
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
@@ -47,9 +49,20 @@
@XmlElement(name="host-name", required=true)
private ArrayList<AsciiBuffer> hostNames = new ArrayList<AsciiBuffer>();
- public VirtualHost createVirtualHost(BrokerXml brokerXml) {
+ @XmlElementWrapper(name="store", required=false)
+ @XmlAnyElement
+ private ArrayList<StoreXml> store = new ArrayList<StoreXml>();
+
+ public VirtualHost createVirtualHost(BrokerXml brokerXml) throws Exception {
VirtualHost rc = new VirtualHost();
rc.setHostNames(hostNames);
+
+ if( !store.isEmpty() ) {
+ if( store.size() > 1 ) {
+ throw new Exception("Only one store is allowed.");
+ }
+ rc.setStore(store.get(0).createStore());
+ }
return rc;
}
Added: activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/non-persistent-activemq.xml
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/non-persistent-activemq.xml?rev=785274&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/non-persistent-activemq.xml
(added)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/non-persistent-activemq.xml
Tue Jun 16 16:10:16 2009
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<broker>
+ <dispatcher name="test dispatcher" threads="4"/>
+
+ <virtual-host>
+ <host-name>default</host-name>
+ </virtual-host>
+
+</broker>
\ No newline at end of file
Added: activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/org/apache/activemq/apollo/jaxb/jaxb.index
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/org/apache/activemq/apollo/jaxb/jaxb.index?rev=785274&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/org/apache/activemq/apollo/jaxb/jaxb.index
(added)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/org/apache/activemq/apollo/jaxb/jaxb.index
Tue Jun 16 16:10:16 2009
@@ -0,0 +1,19 @@
+## ------------------------------------------------------------------------
+## 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.
+## ------------------------------------------------------------------------
+BrokerXml
+KahaDBStoreXml
+MemoryStoreXml
Modified: activemq/sandbox/activemq-flow/activemq-broker/src/test/resources/org/apache/activemq/apollo/jaxb/testSimpleConfig.xml
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/test/resources/org/apache/activemq/apollo/jaxb/testSimpleConfig.xml?rev=785274&r1=785273&r2=785274&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/test/resources/org/apache/activemq/apollo/jaxb/testSimpleConfig.xml
(original)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/test/resources/org/apache/activemq/apollo/jaxb/testSimpleConfig.xml
Tue Jun 16 16:10:16 2009
@@ -18,7 +18,7 @@
<broker>
<dispatcher name="test dispatcher" threads="4"/>
- <transport-server>pipe://test1</transport-server>
+ <transport-server>pipe://test1?wireFormat=mock</transport-server>
<connect-uri>pipe://test1</connect-uri>
<connect-uri>tcp://127.0.0.1:61616</connect-uri>
@@ -26,6 +26,10 @@
<virtual-host>
<host-name>localhost</host-name>
<host-name>test.localhost</host-name>
+
+ <store>
+ <memory-store/>
+ </store>
</virtual-host>
</broker>
\ No newline at end of file
Modified: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/ActiveMQConnectionFactoryTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/ActiveMQConnectionFactoryTest.java?rev=785274&r1=785273&r2=785274&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/ActiveMQConnectionFactoryTest.java
(original)
+++ activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/ActiveMQConnectionFactoryTest.java
Tue Jun 16 16:10:16 2009
@@ -171,7 +171,7 @@
}
public void testSetExceptionListener() throws Exception {
- ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
+ ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker=jaxb:classpath:non-persistent-activemq.xml");
connection = (ActiveMQConnection)cf.createConnection();
assertNull(connection.getExceptionListener());
|