activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r784794 - 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/test/java/org/apache/activemq/apollo/ activemq...
Date Mon, 15 Jun 2009 14:30:33 GMT
Author: chirino
Date: Mon Jun 15 14:30:33 2009
New Revision: 784794

URL: http://svn.apache.org/viewvc?rev=784794&view=rev
Log:
Pushed the store config down into the virtual host section.


Added:
    activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/DispatcherXml.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/java/org/apache/activemq/apollo/
      - copied from r784735, activemq/sandbox/activemq-flow/activemq-broker/src/test/java/org/apache/activemq/apollo/
    activemq/sandbox/activemq-flow/activemq-broker/src/test/resources/org/
    activemq/sandbox/activemq-flow/activemq-broker/src/test/resources/org/apache/
    activemq/sandbox/activemq-flow/activemq-broker/src/test/resources/org/apache/activemq/
    activemq/sandbox/activemq-flow/activemq-broker/src/test/resources/org/apache/activemq/apollo/
    activemq/sandbox/activemq-flow/activemq-broker/src/test/resources/org/apache/activemq/apollo/jaxb/
      - copied from r784735, activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/org/apache/activemq/apollo/jaxb/
    activemq/sandbox/activemq-flow/activemq-broker/src/test/resources/org/apache/activemq/apollo/jaxb/testSimpleConfig.xml
      - copied, changed from r784735, activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/org/apache/activemq/apollo/jaxb/activemq.xml
Removed:
    activemq/sandbox/activemq-flow/activemq-broker/src/test/resources/org/apache/activemq/apollo/jaxb/activemq.xml
Modified:
    activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/Broker.java
    activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/VirtualHost.java
    activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/BrokerXml.java
    activemq/sandbox/activemq-flow/activemq-broker/src/test/java/org/apache/activemq/apollo/jaxb/JAXBConfigTest.java
    activemq/sandbox/activemq-flow/activemq-broker/src/test/java/org/apache/activemq/broker/BrokerTestBase.java
    activemq/sandbox/activemq-flow/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/AbstractPooledDispatcher.java
    activemq/sandbox/activemq-flow/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/PriorityDispatcher.java

Modified: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/Broker.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/Broker.java?rev=784794&r1=784793&r2=784794&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/Broker.java
(original)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/Broker.java
Mon Jun 15 14:30:33 2009
@@ -36,6 +36,8 @@
 
 public class Broker implements Service {
 
+	public static final AsciiBuffer DEFAULT_VIRTUAL_HOST_NAME = new AsciiBuffer("default");
+
 	static final private Log LOG = LogFactory.getLog(Broker.class);
 	
     public static final int MAX_USER_PRIORITY = 10;
@@ -47,7 +49,6 @@
 
     private final LinkedHashMap<AsciiBuffer, VirtualHost> virtualHosts = new LinkedHashMap<AsciiBuffer,
VirtualHost>();
     private VirtualHost defaultVirtualHost;
-	private String name;
     private IDispatcher dispatcher;
     
     private final class BrokerAcceptListener implements TransportAcceptListener {
@@ -114,14 +115,15 @@
     		throw new IllegalStateException("Can only start a broker that is in the "+State.CONFIGURATION
+" state.  Broker was "+state.get());
     	}
 
+		addVirtualHost(getDefaultVirtualHost());
+
 		// Don't change the state to STARTING yet as we may need to 
 		// apply some default configuration to this broker instance before it's started.
 		if( dispatcher == null ) {
 			int threads = Runtime.getRuntime().availableProcessors();
-			dispatcher = PriorityDispatcher.createPriorityDispatchPool("Broker: "+getName(), Broker.MAX_PRIORITY,
threads);
+			dispatcher = PriorityDispatcher.createPriorityDispatchPool("Broker: "+getDefaultVirtualHost().getHostName(),
Broker.MAX_PRIORITY, threads);
 		}
 		
-	    addVirtualHost(getDefaultVirtualHost());
 
 	    // Ok now we are ready to start the broker up....
 		if ( !state.compareAndSet(State.CONFIGURATION, State.STARTING) ) {
@@ -132,6 +134,7 @@
 
 	    	synchronized(virtualHosts) {
 			    for (VirtualHost virtualHost : virtualHosts.values()) {
+			    	virtualHost.setBroker(this);
 			        virtualHost.start();
 			    }
 	    	}
@@ -253,9 +256,9 @@
     public VirtualHost getDefaultVirtualHost() {
         synchronized (virtualHosts) {
             if (defaultVirtualHost == null) {
-                defaultVirtualHost = new VirtualHost(this);
+                defaultVirtualHost = new VirtualHost();
                 ArrayList<AsciiBuffer> names = new ArrayList<AsciiBuffer>(1);
-                names.add(new AsciiBuffer("default"));
+                names.add(DEFAULT_VIRTUAL_HOST_NAME);
                 defaultVirtualHost.setHostNames(names);
             }
             return defaultVirtualHost;
@@ -268,16 +271,16 @@
         }
     }
 
-    public void addVirtualHost(VirtualHost host) throws Exception {
+    public void addVirtualHost(VirtualHost host) {
         synchronized (virtualHosts) {
             // Make sure it's valid.
-            ArrayList<AsciiBuffer> hostNames = host.getHostNames();
+            List<AsciiBuffer> hostNames = host.getHostNames();
             if (hostNames.isEmpty()) {
-                throw new Exception("Virtual host must be configured with at least one host
name.");
+                throw new IllegalArgumentException("Virtual host must be configured with
at least one host name.");
             }
             for (AsciiBuffer name : hostNames) {
                 if (virtualHosts.containsKey(name)) {
-                    throw new Exception("Virtual host with host name " + name + " already
exists.");
+                    throw new IllegalArgumentException("Virtual host with host name " + name
+ " already exists.");
                 }
             }
 
@@ -293,7 +296,7 @@
         }
     }
 
-	public synchronized void removeVirtualHost(VirtualHost host) throws Exception {
+	public synchronized void removeVirtualHost(VirtualHost host) {
         synchronized (virtualHosts) {
             for (AsciiBuffer name : host.getHostNames()) {
                 virtualHosts.remove(name);
@@ -325,15 +328,6 @@
     // /////////////////////////////////////////////////////////////////
     // Property Accessors
     // /////////////////////////////////////////////////////////////////
-
-    public String getName() {
-        return name;
-    }
-    public void setName(String name) {
-    	assertInConfigurationState();
-        this.name = name;
-    }
-
     public IDispatcher getDispatcher() {
         return dispatcher;
     }
@@ -388,5 +382,9 @@
 			throw new RuntimeException(e);
 		}
 	}
+
+	public String getName() {
+		return getDefaultVirtualHost().getHostName().toString();
+	}
    
 }
\ No newline at end of file

Modified: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/VirtualHost.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/VirtualHost.java?rev=784794&r1=784793&r2=784794&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/VirtualHost.java
(original)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/VirtualHost.java
Mon Jun 15 14:30:33 2009
@@ -18,6 +18,7 @@
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 
 import org.apache.activemq.Service;
 import org.apache.activemq.apollo.broker.ProtocolHandler.ConsumerContext;
@@ -33,35 +34,43 @@
  */
 public class VirtualHost implements Service {
 
-    final private BrokerQueueStore queueStore;
-    final private Broker broker;
+    final private BrokerQueueStore queueStore = new BrokerQueueStore();
     final private HashMap<AsciiBuffer, Queue> queues = new HashMap<AsciiBuffer,
Queue>();
     final private HashMap<String, DurableSubscription> durableSubs = new HashMap<String,
DurableSubscription>();
+    final private Router router = new Router();
+    
     private ArrayList<AsciiBuffer> hostNames = new ArrayList<AsciiBuffer>();
-    private Router router;
+    private Broker broker;
     private boolean started;
     private BrokerDatabase database;
 
-    public VirtualHost(Broker broker) {
-        this.broker = broker;
-        this.router = new Router();
+    public VirtualHost() {
         this.router.setVirtualHost(this);
-        this.queueStore = new BrokerQueueStore();
     }
 
-    public AsciiBuffer getHostName() {
+    public VirtualHost(String name) {
+    	this();
+    	addHostName(new AsciiBuffer(name));
+	}
+
+	public AsciiBuffer getHostName() {
         if (hostNames.size() > 0) {
             hostNames.get(0);
         }
         return null;
     }
 
-    public ArrayList<AsciiBuffer> getHostNames() {
+    public List<AsciiBuffer> getHostNames() {
         return hostNames;
     }
-
-    public void setHostNames(ArrayList<AsciiBuffer> hostNames) {
-        this.hostNames = hostNames;
+    public void setHostNames(List<AsciiBuffer> hostNames) {
+        this.hostNames = new ArrayList<AsciiBuffer>(hostNames);
+    }
+    public void addHostName(AsciiBuffer hostName) {
+        this.hostNames.add(hostName);
+    }
+    public void removeHostName(AsciiBuffer hostName) {
+        this.hostNames.remove(hostName);
     }
 
     public Router getRouter() {
@@ -180,4 +189,12 @@
         }
         return sub;
     }
+
+	public Broker getBroker() {
+		return broker;
+	}
+
+	public void setBroker(Broker broker) {
+		this.broker = broker;
+	}
 }

Modified: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/BrokerXml.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/BrokerXml.java?rev=784794&r1=784793&r2=784794&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/BrokerXml.java
(original)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/BrokerXml.java
Mon Jun 15 14:30:33 2009
@@ -16,32 +16,95 @@
  */
 package org.apache.activemq.apollo.jaxb;
 
-import java.util.concurrent.CopyOnWriteArrayList;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
 
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
 
 import org.apache.activemq.apollo.broker.Broker;
+import org.apache.activemq.transport.TransportFactory;
+import org.apache.activemq.transport.TransportServer;
 
 @XmlRootElement(name="broker")
+@XmlAccessorType(XmlAccessType.FIELD)
 public class BrokerXml {
 	
 	@XmlAttribute(name="name")
 	String name;
 	
-	@XmlElementWrapper(name="transportServers")
-	@XmlElement(name="transportServer")
-	CopyOnWriteArrayList<TransportServerXml> transportServers = new CopyOnWriteArrayList<TransportServerXml>();
-
+    @XmlElement(name="virtual-host")
+    private List<VirtualHostXml> virtualHosts = new ArrayList<VirtualHostXml>();
+    @XmlElement(name="transport-server")
+    private List<String> transportServers = new ArrayList<String>();
+    @XmlElement(name="connect-uri")
+    private List<String> connectUris = new ArrayList<String>();
+    @XmlElement(required = false)
+    private DispatcherXml dispatcher;
+	
+	
 	public Broker createMessageBroker() throws Exception {
-		Broker broker = new Broker();
-		broker.setName(name);
-		for (TransportServerXml transportServer : transportServers) {
-			broker.addTransportServer(transportServer.createTransportServer());
+		Broker rc = new Broker();
+		if( dispatcher!=null ) {
+			rc.setDispatcher(dispatcher.createDispatcher(this));
+		}
+		for (VirtualHostXml element : virtualHosts) {
+			rc.addVirtualHost(element.createVirtualHost(this));
+		}
+		for (String element : transportServers) {
+			TransportServer server;
+			try {
+				server = TransportFactory.bind(new URI(element));
+			} catch (Exception e) {
+				throw new Exception("Unable to bind transport server '"+element+" due to: "+e.getMessage(),
e);
+			}
+			rc.addTransportServer(server);
+		}
+		for (String element : connectUris) {
+			rc.addConnectUri(element);
 		}
-		return broker;
+		
+		return rc;
+	}
+	
+	public VirtualHostXml getDefaultVirtualHost() {
+		return null;
+	}
+
+	public List<VirtualHostXml> getVirtualHosts() {
+		return virtualHosts;
+	}
+	public void setVirtualHosts(List<VirtualHostXml> virtualHosts) {
+		this.virtualHosts = virtualHosts;
+	}
+
+
+	public List<String> getTransportServers() {
+		return transportServers;
+	}
+	public void setTransportServers(List<String> transportServers) {
+		this.transportServers = transportServers;
+	}
+
+
+	public List<String> getConnectUris() {
+		return connectUris;
 	}
+	public void setConnectUris(List<String> connectUris) {
+		this.connectUris = connectUris;
+	}
+
+
+	public DispatcherXml getDispatcher() {
+		return dispatcher;
+	}
+	public void setDispatcher(DispatcherXml dispatcher) {
+		this.dispatcher = dispatcher;
+	}
+
 
 }

Added: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/DispatcherXml.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/DispatcherXml.java?rev=784794&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/DispatcherXml.java
(added)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/DispatcherXml.java
Mon Jun 15 14:30:33 2009
@@ -0,0 +1,47 @@
+/**
+ * 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.
+ */
+package org.apache.activemq.apollo.jaxb;
+
+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.apollo.broker.Broker;
+import org.apache.activemq.dispatch.IDispatcher;
+import org.apache.activemq.dispatch.PriorityDispatcher;
+
+@XmlRootElement(name="dispatcher")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class DispatcherXml {
+	
+	@XmlAttribute(required=false)
+	String name;
+	@XmlAttribute(name="max-priority", required=false)
+	int maxPriority=Broker.MAX_PRIORITY;
+	@XmlAttribute(required=false)
+	int threads = Runtime.getRuntime().availableProcessors();
+	
+	public IDispatcher createDispatcher(BrokerXml brokerXml) {
+		if( name == null ) {
+//			VirtualHostXml vh = brokerXml.getDefaultVirtualHost();
+			name = "Broker: ";
+		}
+		return PriorityDispatcher.createPriorityDispatchPool(name, maxPriority, threads);
+	}
+
+}

Added: 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=784794&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/VirtualHostXml.java
(added)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/VirtualHostXml.java
Mon Jun 15 14:30:33 2009
@@ -0,0 +1,56 @@
+/**
+ * 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.
+ */
+package org.apache.activemq.apollo.jaxb;
+
+import java.util.ArrayList;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.activemq.apollo.broker.VirtualHost;
+import org.apache.activemq.protobuf.AsciiBuffer;
+
+@XmlRootElement(name = "virtual-host")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class VirtualHostXml {
+
+	public static class AsciiBufferAdapter extends XmlAdapter<String, AsciiBuffer> {
+		@Override
+		public String marshal(AsciiBuffer v) throws Exception {
+			return v.toString();
+		}
+		@Override
+		public AsciiBuffer unmarshal(String v) throws Exception {
+			return new AsciiBuffer(v);
+		}
+	}
+	
+    @XmlJavaTypeAdapter(AsciiBufferAdapter.class)
+    @XmlElement(name="host-name", required=true)
+    private ArrayList<AsciiBuffer> hostNames = new ArrayList<AsciiBuffer>();
+
+	public VirtualHost createVirtualHost(BrokerXml brokerXml) {
+		VirtualHost rc = new VirtualHost();
+		rc.setHostNames(hostNames);
+		return rc;
+	}
+
+}

Modified: activemq/sandbox/activemq-flow/activemq-broker/src/test/java/org/apache/activemq/apollo/jaxb/JAXBConfigTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/test/java/org/apache/activemq/apollo/jaxb/JAXBConfigTest.java?rev=784794&r1=784735&r2=784794&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/test/java/org/apache/activemq/apollo/jaxb/JAXBConfigTest.java
(original)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/test/java/org/apache/activemq/apollo/jaxb/JAXBConfigTest.java
Mon Jun 15 14:30:33 2009
@@ -18,39 +18,42 @@
 
 
 import java.net.URI;
+import java.util.ArrayList;
 
 import junit.framework.TestCase;
 
-import org.apache.activemq.apollo.broker.BrokerFactory;
 import org.apache.activemq.apollo.broker.Broker;
+import org.apache.activemq.apollo.broker.BrokerFactory;
+import org.apache.activemq.dispatch.AbstractPooledDispatcher;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Test;
 
 public class JAXBConfigTest extends TestCase {
 
     private static final Log LOG = LogFactory.getLog(JAXBConfigTest.class);
 	
-    Broker broker;
-    
-	@Before
-	public void setUp() throws Exception {
-		broker = createBroker();
-	}
-
-	@After
-	public void tearDown() throws Exception {
-	}
-	
 	@Test
-	public void testBrokerConfiguredCorrectly() throws Exception {
+	public void testSimpleConfig() throws Exception {
+		Broker broker = createBroker();
+		
+		AbstractPooledDispatcher p = (AbstractPooledDispatcher)broker.getDispatcher();
+		assertEquals(4, p.getSize());
+		assertEquals("test dispatcher", p.getName());
+		
+		
+		assertEquals(1, broker.getTransportServers().size());
+		
+		ArrayList<String> expected = new ArrayList<String>();
+		expected.add("pipe://test1");
+		expected.add("tcp://127.0.0.1:61616");
+		assertEquals(expected, broker.getConnectUris());
 		
+		assertEquals(2, broker.getVirtualHosts().size());
 	}
 
     protected Broker createBroker() throws Exception {
-    	URI uri = new URI("jaxb:classpath:org/apache/activemq/apollo/jaxb/activemq.xml");
+    	URI uri = new URI("jaxb:classpath:org/apache/activemq/apollo/jaxb/" + getName()+".xml");
         LOG.info("Loading broker configuration from the classpath with URI: " + uri);
         return BrokerFactory.createBroker(uri);
     }

Modified: activemq/sandbox/activemq-flow/activemq-broker/src/test/java/org/apache/activemq/broker/BrokerTestBase.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/test/java/org/apache/activemq/broker/BrokerTestBase.java?rev=784794&r1=784793&r2=784794&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/test/java/org/apache/activemq/broker/BrokerTestBase.java
(original)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/test/java/org/apache/activemq/broker/BrokerTestBase.java
Mon Jun 15 14:30:33 2009
@@ -30,6 +30,7 @@
 import org.apache.activemq.apollo.broker.Destination;
 import org.apache.activemq.apollo.broker.Broker;
 import org.apache.activemq.apollo.broker.Router;
+import org.apache.activemq.apollo.broker.VirtualHost;
 import org.apache.activemq.broker.store.Store;
 import org.apache.activemq.broker.store.StoreFactory;
 import org.apache.activemq.dispatch.IDispatcher;
@@ -477,7 +478,7 @@
 
     private Broker createBroker(String name, String bindURI, String connectUri) throws Exception
{
         Broker broker = new Broker();
-        broker.setName(name);
+        broker.setDefaultVirtualHost(new VirtualHost(name));
         broker.addTransportServer(TransportFactory.bind(new URI(bindURI)));
         broker.addConnectUri(connectUri);
         broker.setDispatcher(dispatcher);

Copied: activemq/sandbox/activemq-flow/activemq-broker/src/test/resources/org/apache/activemq/apollo/jaxb/testSimpleConfig.xml
(from r784735, activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/org/apache/activemq/apollo/jaxb/activemq.xml)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/test/resources/org/apache/activemq/apollo/jaxb/testSimpleConfig.xml?p2=activemq/sandbox/activemq-flow/activemq-broker/src/test/resources/org/apache/activemq/apollo/jaxb/testSimpleConfig.xml&p1=activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/org/apache/activemq/apollo/jaxb/activemq.xml&r1=784735&r2=784794&rev=784794&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/org/apache/activemq/apollo/jaxb/activemq.xml
(original)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/test/resources/org/apache/activemq/apollo/jaxb/testSimpleConfig.xml
Mon Jun 15 14:30:33 2009
@@ -16,4 +16,16 @@
     limitations under the License.
 -->
 <broker>
+  <dispatcher name="test dispatcher" threads="4"/>
+
+  <transport-server>pipe://test1</transport-server>
+
+  <connect-uri>pipe://test1</connect-uri>
+  <connect-uri>tcp://127.0.0.1:61616</connect-uri>
+
+  <virtual-host>
+    <host-name>localhost</host-name>
+    <host-name>test.localhost</host-name>
+  </virtual-host>
+  
 </broker>
\ No newline at end of file

Modified: activemq/sandbox/activemq-flow/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/AbstractPooledDispatcher.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/AbstractPooledDispatcher.java?rev=784794&r1=784793&r2=784794&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/AbstractPooledDispatcher.java
(original)
+++ activemq/sandbox/activemq-flow/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/AbstractPooledDispatcher.java
Mon Jun 15 14:30:33 2009
@@ -178,4 +178,12 @@
         return name;
     }
 
+	public String getName() {
+		return name;
+	}
+
+	public int getSize() {
+		return size;
+	}
+
 }

Modified: activemq/sandbox/activemq-flow/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/PriorityDispatcher.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/PriorityDispatcher.java?rev=784794&r1=784793&r2=784794&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/PriorityDispatcher.java
(original)
+++ activemq/sandbox/activemq-flow/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/PriorityDispatcher.java
Mon Jun 15 14:30:33 2009
@@ -703,4 +703,8 @@
             return name;
         }
     }
+
+	public String getName() {
+		return name;
+	}
 }



Mime
View raw message