Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 31282 invoked from network); 16 Jun 2009 16:10:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 16 Jun 2009 16:10:37 -0000 Received: (qmail 10509 invoked by uid 500); 16 Jun 2009 16:10:48 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 10477 invoked by uid 500); 16 Jun 2009 16:10:48 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 10468 invoked by uid 99); 16 Jun 2009 16:10:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Jun 2009 16:10:48 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Jun 2009 16:10:43 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 45622238888C; Tue, 16 Jun 2009 16:10:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r785274 - in /activemq/sandbox/activemq-flow: activemq-broker/src/main/java/org/apache/activemq/apollo/broker/ activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/ activemq-broker/src/main/resources/ activemq-broker/src/main/resou... Date: Tue, 16 Jun 2009 16:10:16 -0000 To: commits@activemq.apache.org From: chirino@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090616161017.45622238888C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 hostNames = new ArrayList(); - public VirtualHost createVirtualHost(BrokerXml brokerXml) { + @XmlElementWrapper(name="store", required=false) + @XmlAnyElement + private ArrayList store = new ArrayList(); + + 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 @@ + + + + + + + default + + + \ 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 @@ - pipe://test1 + pipe://test1?wireFormat=mock pipe://test1 tcp://127.0.0.1:61616 @@ -26,6 +26,10 @@ localhost test.localhost + + + + \ 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());