You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Hiram Chirino <hi...@hiramchirino.com> on 2006/06/06 01:19:20 UTC

[RTC] ActiveMQ GBean modules

Howdy folks,

Here's  a patch that brings in the activemq gbean modules into
geronimo.  It's partly what was in activemq 4.x and integrated into
geronimo 1.2-dead merged with the changes in the 3.x branch.

It compiles at least and looks like a reasonable start.  Once further
integration work gets done we may need to tweak a little more.  here's
my +1 got get this committed.  I guess I just need 3 more.


Index: modules/activemq-gbean/project.properties
===================================================================
--- modules/activemq-gbean/project.properties	(revision 0)
+++ modules/activemq-gbean/project.properties	(revision 0)
@@ -0,0 +1,3 @@
+# -------------------------------------------------------------------
+# Build Properties
+# -------------------------------------------------------------------

Property changes on: modules/activemq-gbean/project.properties
___________________________________________________________________
Name: svn:executable
   + *

Index: modules/activemq-gbean/project.xml
===================================================================
--- modules/activemq-gbean/project.xml	(revision 0)
+++ modules/activemq-gbean/project.xml	(revision 0)
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+    Copyright 2004 The Apache Software Foundation
+
+    Licensed 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.
+-->
+<!-- $Rev: 356052 $ $Date: 2005-12-11 16:41:20 -0600 (Sun, 11 Dec 2005) $ -->
+<!DOCTYPE project>
+<project>
+    <pomVersion>3</pomVersion>
+    <extend>../../etc/project.xml</extend>
+
+    <name>Geronimo :: ActiveMQ :: GBeans</name>
+    <id>geronimo-activemq-gbean</id>
+    <shortDescription>ActiveMQ Geronimo / GBean support</shortDescription>
+    <description>ActiveMQ GBeans used for integration into Apache
Geronimo</description>
+
+    <!-- ============ -->
+    <!-- Dependencies -->
+    <!-- ============ -->
+    <dependencies>
+
+      <dependency>
+        <groupId>incubator-activemq</groupId>
+        <artifactId>activemq-core</artifactId>
+        <version>4.0-SNAPSHOT</version>
+      </dependency>
+
+      <dependency>
+        <groupId>incubator-activemq</groupId>
+        <artifactId>activeio-core</artifactId>
+        <version>3.0-SNAPSHOT</version>
+      </dependency>
+
+      <dependency>
+        <groupId>geronimo</groupId>
+        <artifactId>geronimo-activemq-gbean-management</artifactId>
+        <version>${pom.currentVersion}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>geronimo</groupId>
+        <artifactId>geronimo-kernel</artifactId>
+        <version>${pom.currentVersion}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>geronimo</groupId>
+        <artifactId>geronimo-system</artifactId>
+        <version>${pom.currentVersion}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>geronimo</groupId>
+        <artifactId>geronimo-management</artifactId>
+        <version>${pom.currentVersion}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>geronimo</groupId>
+        <artifactId>geronimo-j2ee</artifactId>
+        <version>${pom.currentVersion}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>mx4j</groupId>
+        <artifactId>mx4j</artifactId>
+        <version>${mx4j_version}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>commons-logging</groupId>
+        <artifactId>commons-logging</artifactId>
+        <version>${commons_logging_version}</version>
+        <url>http://jakarta.apache.org/commons/logging/</url>
+      </dependency>
+
+
+    </dependencies>
+
+    <!-- this module is using m2 directory layout -->
+    <build>
+        <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
+        <unitTestSourceDirectory>${basedir}/src/main/test</unitTestSourceDirectory>
+
+        <unitTest>
+            <includes>
+                <include>**/*Test.java</include>
+            </includes>
+        </unitTest>
+    </build>
+
+</project>

Property changes on: modules/activemq-gbean/project.xml
___________________________________________________________________
Name: svn:executable
   + *

Index: modules/activemq-gbean/src/test/java/org/apache/activemq/gbean/ConnectorTest.java
===================================================================
--- modules/activemq-gbean/src/test/java/org/apache/activemq/gbean/ConnectorTest.java	(revision
0)
+++ modules/activemq-gbean/src/test/java/org/apache/activemq/gbean/ConnectorTest.java	(revision
0)
@@ -0,0 +1,61 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ *  Licensed 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.gbean;
+
+import org.apache.activemq.gbean.TransportConnectorGBeanImpl;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests to ensure that URL parsing and updating doesn't blow up
+ *
+ * @version $Revision: 1.0$
+ */
+public class ConnectorTest extends TestCase {
+    public TransportConnectorGBeanImpl test;
+
+    protected void setUp() throws Exception {
+    }
+
+    public void testURLManipulation() {
+        test = new TransportConnectorGBeanImpl(null, "foo", "localhost", 1234);
+        assertEquals("foo://localhost:1234", test.getUrl());
+        assertEquals("foo", test.getProtocol());
+        assertEquals("localhost", test.getHost());
+        assertEquals(1234, test.getPort());
+        test.setHost("0.0.0.0");
+        assertEquals("foo://0.0.0.0:1234", test.getUrl());
+        assertEquals("foo", test.getProtocol());
+        assertEquals("0.0.0.0", test.getHost());
+        assertEquals(1234, test.getPort());
+        test.setPort(8765);
+        assertEquals("foo://0.0.0.0:8765", test.getUrl());
+        assertEquals("foo", test.getProtocol());
+        assertEquals("0.0.0.0", test.getHost());
+        assertEquals(8765, test.getPort());
+        test.setProtocol("bar");
+        assertEquals("bar://0.0.0.0:8765", test.getUrl());
+        assertEquals("bar", test.getProtocol());
+        assertEquals("0.0.0.0", test.getHost());
+        assertEquals(8765, test.getPort());
+        test = new TransportConnectorGBeanImpl(null, "vm", "localhost", -1);
+        assertEquals("vm://localhost", test.getUrl());
+        assertEquals("vm", test.getProtocol());
+        assertEquals("localhost", test.getHost());
+        assertEquals(-1, test.getPort());
+    }
+}
Index: modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBean.java
===================================================================
--- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBean.java	(revision
0)
+++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBean.java	(revision
0)
@@ -0,0 +1,34 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ *  Licensed 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.gbean;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.gbean.ActiveMQBroker;
+
+/**
+ * An interface to the ActiveMQContainerGBean for use by the
+ * ActiveMQConnectorGBean.
+ *
+ * @version $Revision: 1.1.1.1 $
+ */
+public interface BrokerServiceGBean extends ActiveMQBroker {
+	
+	public abstract BrokerService getBrokerContainer();	
+	public String getBrokerName();
+
+	
+}
\ No newline at end of file

Property changes on:
modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBean.java
___________________________________________________________________
Name: svn:executable
   + *

Index: modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBeanImpl.java
===================================================================
--- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBeanImpl.java	(revision
0)
+++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBeanImpl.java	(revision
0)
@@ -0,0 +1,209 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ *  Licensed 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.gbean;
+
+import java.net.URI;
+
+import javax.sql.DataSource;
+
+import org.apache.activemq.broker.BrokerFactory;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.store.DefaultPersistenceAdapterFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.management.geronimo.JMSManager;
+import org.apache.geronimo.management.geronimo.NetworkConnector;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
+
+
+/**
+ * Default implementation of the ActiveMQ Message Server
+ *
+ * @version $Revision: 1.1.1.1 $
+ */
+public class BrokerServiceGBeanImpl implements GBeanLifecycle,
BrokerServiceGBean {
+
+    private Log log = LogFactory.getLog(getClass().getName());
+
+    private String brokerName;
+    private String brokerUri;
+    private BrokerService brokerService;
+    private ServerInfo serverInfo;
+    private String dataDirectory;
+    private DataSourceReference dataSource;
+
+    private String objectName;
+    private JMSManager manager;
+
+    public BrokerServiceGBeanImpl() {
+    }
+
+    public synchronized BrokerService getBrokerContainer() {
+        return brokerService;
+    }
+
+    public synchronized void doStart() throws Exception {
+        	ClassLoader old = Thread.currentThread().getContextClassLoader();
+        	Thread.currentThread().setContextClassLoader(BrokerServiceGBeanImpl.class.getClassLoader());
+        	try {
+    	        if (brokerService == null) {
+    	            brokerService = createContainer();
+    	        }
+                DefaultPersistenceAdapterFactory persistenceFactory =
(DefaultPersistenceAdapterFactory)
brokerService.getPersistenceFactory();
+
persistenceFactory.setDataDirectory(serverInfo.resolve(dataDirectory));
+                persistenceFactory.setDataSource((DataSource)
dataSource.$getResource());
+                brokerService.start();
+        	} finally {
+            	Thread.currentThread().setContextClassLoader(old);
+        	}
+    }
+
+    protected BrokerService createContainer() throws Exception {
+        if( brokerUri!=null ) {
+            BrokerService answer = BrokerFactory.createBroker(new
URI(brokerUri));
+            brokerName = answer.getBrokerName();
+            return answer;
+        } else {
+            BrokerService answer = new BrokerService();
+            answer.setBrokerName(brokerName);
+            return answer;
+        }
+    }
+
+    public synchronized void doStop() throws Exception {
+        if (brokerService != null) {
+            BrokerService temp = brokerService;
+            brokerService = null;
+            temp.stop();
+        }
+    }
+
+    public synchronized void doFail() {
+        if (brokerService != null) {
+            BrokerService temp = brokerService;
+            brokerService = null;
+            try {
+                temp.stop();
+            } catch (Exception e) {
+                log.info("Caught while closing due to failure: " + e, e);
+            }
+        }
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("ActiveMQ
Message Broker", BrokerServiceGBeanImpl.class, "JMSServer");
+        infoFactory.addReference("serverInfo", ServerInfo.class);
+        infoFactory.addAttribute("brokerName", String.class, true);
+        infoFactory.addAttribute("brokerUri", String.class, true);
+        infoFactory.addAttribute("dataDirectory", String.class, true);
+        infoFactory.addReference("dataSource", DataSourceReference.class);
+        infoFactory.addAttribute("objectName", String.class, false);
+        infoFactory.addReference("manager", JMSManager.class);
+        infoFactory.addInterface(BrokerServiceGBean.class);
+        // infoFactory.setConstructor(new String[]{"brokerName, brokerUri"});
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+	/**
+	 * @return Returns the brokerName.
+	 */
+	public String getBrokerName() {
+		return brokerName;
+	}
+
+    public String getBrokerUri() {
+        return brokerUri;
+    }
+
+    public void setBrokerName(String brokerName) {
+        this.brokerName = brokerName;
+    }
+
+    public void setBrokerUri(String brokerUri) {
+        this.brokerUri = brokerUri;
+    }
+
+    public ServerInfo getServerInfo() {
+        return serverInfo;
+    }
+
+    public void setServerInfo(ServerInfo serverInfo) {
+        this.serverInfo = serverInfo;
+    }
+
+    public String getDataDirectory() {
+        return dataDirectory;
+    }
+
+    public void setDataDirectory(String dataDir) {
+        this.dataDirectory = dataDir;
+    }
+
+    public DataSourceReference getDataSource() {
+        return dataSource;
+    }
+
+    public void setDataSource(DataSourceReference dataSource) {
+        this.dataSource = dataSource;
+    }
+
+    public String getObjectName() {
+        return objectName;
+    }
+
+    public boolean isStateManageable() {
+        return true;
+    }
+
+    public boolean isStatisticsProvider() {
+        return false; // todo: return true once stats are integrated
+    }
+
+    public boolean isEventProvider() {
+        return true;
+    }
+
+    public NetworkConnector[] getConnectors() {
+        return manager.getConnectorsForContainer(this);
+    }
+
+    public NetworkConnector[] getConnectors(String protocol) {
+        return manager.getConnectorsForContainer(this, protocol);
+    }
+
+    public JMSManager getManager() {
+        return manager;
+    }
+
+    public void setManager(JMSManager manager) {
+        this.manager = manager;
+    }
+
+    public void setObjectName(String objectName) {
+        this.objectName = objectName;
+    }
+	
+}
\ No newline at end of file

Property changes on:
modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBeanImpl.java
___________________________________________________________________
Name: svn:executable
   + *

Index: modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/TransportConnectorGBeanImpl.java
===================================================================
--- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/TransportConnectorGBeanImpl.java	(revision
0)
+++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/TransportConnectorGBeanImpl.java	(revision
0)
@@ -0,0 +1,168 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ *  Licensed 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.gbean;
+
+import java.net.InetSocketAddress;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.apache.activemq.broker.TransportConnector;
+import org.apache.activemq.gbean.ActiveMQConnector;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.GConstructorInfo;
+
+/**
+ * Default implementation of the ActiveMQ connector
+ *
+ * @version $Revision: 1.1.1.1 $
+ */
+public class TransportConnectorGBeanImpl implements GBeanLifecycle,
ActiveMQConnector {
+    private Log log = LogFactory.getLog(getClass().getName());
+
+    private TransportConnector transportConnector;
+    private BrokerServiceGBean brokerService;
+
+    private String protocol;
+    private String host;
+    private int port;
+    private String path;
+    private String query;
+    private String urlAsStarted;
+
+    public TransportConnectorGBeanImpl(BrokerServiceGBean
brokerService, String protocol, String host, int port) {
+        this.brokerService = brokerService;
+        this.protocol = protocol;
+        this.host = host;
+        this.port = port;
+    }
+
+    public String getProtocol() {
+        return protocol;
+    }
+
+    public void setProtocol(String protocol) {
+        this.protocol = protocol;
+    }
+
+    public String getHost() {
+        return host;
+    }
+
+    public void setHost(String host) {
+        this.host = host;
+    }
+
+    public int getPort() {
+        return port;
+    }
+
+    public void setPort(int port) {
+        this.port = port;
+    }
+
+    public String getPath() {
+        return path;
+    }
+
+    public void setPath(String path) {
+        this.path = path;
+    }
+
+    public String getQuery() {
+        return query;
+    }
+
+    public void setQuery(String query) {
+        this.query = query;
+    }
+
+    public String getUrl() {
+        try {
+            return new URI(protocol, null, host, port, path, query,
null).toString();
+        } catch (URISyntaxException e) {
+            throw new IllegalStateException("Attributes don't form a
valid URI: "+protocol+"://"+host+":"+port+"/"+path+"?"+query);
+        }
+    }
+
+    public InetSocketAddress getListenAddress() {
+        try {
+            return transportConnector.getServer().getSocketAddress();
+        } catch (Throwable e) {
+            log.debug("Failure to determine ListenAddress: "+e,e);
+            return null;
+        }
+    }
+
+    public synchronized void doStart() throws Exception {
+    	ClassLoader old = Thread.currentThread().getContextClassLoader();
+    	Thread.currentThread().setContextClassLoader(BrokerServiceGBeanImpl.class.getClassLoader());
+    	try {
+	        if (transportConnector == null) {
+                urlAsStarted = getUrl();
+	            transportConnector = createBrokerConnector(urlAsStarted);
+	            transportConnector.start();
+	        }
+    	} finally {
+        	Thread.currentThread().setContextClassLoader(old);
+    	}
+    }
+
+    public synchronized void doStop() throws Exception {
+        if (transportConnector != null) {
+            TransportConnector temp = transportConnector;
+            transportConnector = null;
+            temp.stop();
+        }
+    }
+
+    public synchronized void doFail() {
+        if (transportConnector != null) {
+            TransportConnector temp = transportConnector;
+            transportConnector = null;
+            try {
+                temp.stop();
+            }
+            catch (Exception e) {
+                log.info("Caught while closing due to failure: " + e, e);
+            }
+        }
+    }
+
+    protected TransportConnector createBrokerConnector(String url)
throws Exception {
+        return brokerService.getBrokerContainer().addConnector(url);
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("ActiveMQ
Transport Connector", TransportConnectorGBeanImpl.class,
CONNECTOR_J2EE_TYPE);
+        infoFactory.addAttribute("url", String.class.getName(), false);
+        infoFactory.addReference("brokerService", BrokerServiceGBean.class);
+        infoFactory.addInterface(ActiveMQConnector.class, new
String[]{"host","port","protocol","path","query"},
+                new String[]{"host","port"});
+        infoFactory.setConstructor(new GConstructorInfo(new
String[]{"brokerService", "protocol", "host", "port"}));
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}

Property changes on:
modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/TransportConnectorGBeanImpl.java
___________________________________________________________________
Name: svn:executable
   + *

Index: modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/DataSourceReference.java
===================================================================
--- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/DataSourceReference.java	(revision
0)
+++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/DataSourceReference.java	(revision
0)
@@ -0,0 +1,21 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ *  Licensed 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.gbean;
+
+public interface DataSourceReference {
+    public Object $getResource();
+}
Index: modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/management/ActiveMQManagerGBean.java
===================================================================
--- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/management/ActiveMQManagerGBean.java	(revision
0)
+++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/management/ActiveMQManagerGBean.java	(revision
0)
@@ -0,0 +1,266 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ *  Licensed 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.gbean.management;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.activemq.gbean.ActiveMQBroker;
+import org.apache.activemq.gbean.ActiveMQConnector;
+import org.apache.activemq.gbean.ActiveMQManager;
+import org.apache.activemq.gbean.TransportConnectorGBeanImpl;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.ReferencePatterns;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.EditableConfigurationManager;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.proxy.ProxyManager;
+import org.apache.geronimo.management.geronimo.JMSBroker;
+import org.apache.geronimo.management.geronimo.JMSConnector;
+import org.apache.geronimo.management.geronimo.NetworkConnector;
+
+/**
+ * Implementation of the ActiveMQ management interface.  These are the ActiveMQ
+ * management features available at runtime.
+ *
+ * @version $Revision: 1.0$
+ */
+public class ActiveMQManagerGBean implements ActiveMQManager {
+    private static final Log log =
LogFactory.getLog(ActiveMQManagerGBean.class.getName());
+    private Kernel kernel;
+    private String objectName;
+
+    public ActiveMQManagerGBean(Kernel kernel, String objectName) {
+        this.kernel = kernel;
+        this.objectName = objectName;
+    }
+
+    public String getProductName() {
+        return "ActiveMQ";
+    }
+
+    public String getObjectName() {
+        return objectName;
+    }
+
+    public boolean isEventProvider() {
+        return false;
+    }
+
+    public boolean isStateManageable() {
+        return true;
+    }
+
+    public boolean isStatisticsProvider() {
+        return false;
+    }
+
+    public Object[] getContainers() {
+        ProxyManager proxyManager = kernel.getProxyManager();
+        AbstractNameQuery query = new
AbstractNameQuery(ActiveMQBroker.class.getName());
+        Set names = kernel.listGBeans(query);
+        ActiveMQBroker[] results = new ActiveMQBroker[names.size()];
+        int i=0;
+        for (Iterator it = names.iterator(); it.hasNext(); i++) {
+            AbstractName name = (AbstractName) it.next();
+            results[i] = (ActiveMQBroker)
proxyManager.createProxy(name, ActiveMQBroker.class.getClassLoader());
+        }
+        return results;
+    }
+
+    public String[] getSupportedProtocols() {
+        // see files in
modules/core/src/conf/META-INF/services/org/activemq/transport/server/
+        return new String[]{ "tcp", "stomp", "vm", "peer", "udp",
"multicast", "failover"};
+    }
+
+    public NetworkConnector[] getConnectors() {
+        ProxyManager proxyManager = kernel.getProxyManager();
+        AbstractNameQuery query = new
AbstractNameQuery(ActiveMQConnector.class.getName());
+        Set names = kernel.listGBeans(query);
+        ActiveMQConnector[] results = new ActiveMQConnector[names.size()];
+        int i=0;
+        for (Iterator it = names.iterator(); it.hasNext(); i++) {
+            AbstractName name = (AbstractName) it.next();
+            results[i] = (ActiveMQConnector)
proxyManager.createProxy(name,
ActiveMQConnector.class.getClassLoader());
+        }
+        return results;
+    }
+
+    public NetworkConnector[] getConnectors(String protocol) {
+        if(protocol == null) {
+            return getConnectors();
+        }
+        List result = new ArrayList();
+        ProxyManager proxyManager = kernel.getProxyManager();
+        AbstractNameQuery query = new
AbstractNameQuery(ActiveMQConnector.class.getName());
+        Set names = kernel.listGBeans(query);
+        for (Iterator it = names.iterator(); it.hasNext();) {
+            AbstractName name = (AbstractName) it.next();
+            try {
+                if (kernel.getAttribute(name, "protocol").equals(protocol)) {
+                    result.add(proxyManager.createProxy(name,
ActiveMQConnector.class.getClassLoader()));
+                }
+            } catch (Exception e) {
+                log.error("Unable to check the protocol for a connector", e);
+            }
+        }
+        return (ActiveMQConnector[]) result.toArray(new
ActiveMQConnector[names.size()]);
+    }
+
+    public NetworkConnector[] getConnectorsForContainer(Object broker) {
+        AbstractName containerName = kernel.getAbstractNameFor(broker);
+        ProxyManager mgr = kernel.getProxyManager();
+        try {
+            List results = new ArrayList();
+            AbstractNameQuery query = new
AbstractNameQuery(ActiveMQConnector.class.getName());
+            Set set = kernel.listGBeans(query); // all Jetty connectors
+            for (Iterator it = set.iterator(); it.hasNext();) {
+                AbstractName name = (AbstractName) it.next(); // a
single Jetty connector
+                GBeanData data = kernel.getGBeanData(name);
+                ReferencePatterns refs =
data.getReferencePatterns("activeMQContainer");
+                if (containerName.equals(refs.getAbstractName())) {
+                    results.add(mgr.createProxy(name,
ActiveMQConnector.class.getClassLoader()));
+                }
+            }
+            return (ActiveMQConnector[]) results.toArray(new
ActiveMQConnector[results.size()]);
+        } catch (Exception e) {
+            throw (IllegalArgumentException) new
IllegalArgumentException("Unable to look up connectors for ActiveMQ
broker '"+containerName).initCause(e);
+        }
+    }
+
+    public NetworkConnector[] getConnectorsForContainer(Object
broker, String protocol) {
+        if(protocol == null) {
+            return getConnectorsForContainer(broker);
+        }
+        AbstractName containerName = kernel.getAbstractNameFor(broker);
+        ProxyManager mgr = kernel.getProxyManager();
+        try {
+            List results = new ArrayList();
+            AbstractNameQuery query = new
AbstractNameQuery(ActiveMQConnector.class.getName());
+            Set set = kernel.listGBeans(query); // all Jetty connectors
+            for (Iterator it = set.iterator(); it.hasNext();) {
+                AbstractName name = (AbstractName) it.next(); // a
single Jetty connector
+                GBeanData data = kernel.getGBeanData(name);
+                ReferencePatterns refs =
data.getReferencePatterns("activeMQContainer");
+                if(containerName.equals(refs.getAbstractName())) {
+                    try {
+                        String testProtocol = (String)
kernel.getAttribute(name, "protocol");
+                        if(testProtocol != null &&
testProtocol.equals(protocol)) {
+                            results.add(mgr.createProxy(name,
ActiveMQConnector.class.getClassLoader()));
+                        }
+                    } catch (Exception e) {
+                        log.error("Unable to look up protocol for
connector '"+name+"'",e);
+                    }
+                    break;
+                }
+            }
+            return (ActiveMQConnector[]) results.toArray(new
ActiveMQConnector[results.size()]);
+        } catch (Exception e) {
+            throw (IllegalArgumentException)new
IllegalArgumentException("Unable to look up connectors for ActiveMQ
broker '"+containerName +"': ").initCause(e);
+        }
+    }
+
+    /**
+     * Creates a new connector, and returns the ObjectName for it.  Note that
+     * the connector may well require further customization before being fully
+     * functional (e.g. SSL settings for a secure connector).
+     */
+    public JMSConnector addConnector(JMSBroker broker, String
uniqueName, String protocol, String host, int port) {
+        AbstractName brokerAbstractName = kernel.getAbstractNameFor(broker);
+        AbstractName name =
kernel.getNaming().createChildName(brokerAbstractName, uniqueName,
NameFactory.GERONIMO_SERVICE);
+        GBeanData connector = new GBeanData(name,
TransportConnectorGBeanImpl.GBEAN_INFO);
+        //todo: if SSL is supported, need to add more properties or
use a different GBean?
+        connector.setAttribute("protocol", protocol);
+        connector.setAttribute("host", host);
+        connector.setAttribute("port", new Integer(port));
+        connector.setReferencePattern("activeMQContainer", brokerAbstractName);
+        EditableConfigurationManager mgr =
ConfigurationUtil.getEditableConfigurationManager(kernel);
+        if(mgr != null) {
+            try {
+
mgr.addGBeanToConfiguration(brokerAbstractName.getArtifact(),
connector, false);
+                return (JMSConnector)
kernel.getProxyManager().createProxy(name,
ActiveMQConnector.class.getClassLoader());
+            } catch (InvalidConfigException e) {
+                log.error("Unable to add GBean", e);
+                return null;
+            } finally {
+                ConfigurationUtil.releaseConfigurationManager(kernel, mgr);
+            }
+        } else {
+            log.warn("The ConfigurationManager in the kernel does not
allow editing");
+            return null;
+        }
+    }
+
+    public void removeConnector(AbstractName connectorName) {
+        try {
+            GBeanInfo info = kernel.getGBeanInfo(connectorName);
+            boolean found = false;
+            Set intfs = info.getInterfaces();
+            for (Iterator it = intfs.iterator(); it.hasNext();) {
+                String intf = (String) it.next();
+                if (intf.equals(ActiveMQConnector.class.getName())) {
+                    found = true;
+                }
+            }
+            if (!found) {
+                throw new GBeanNotFoundException(connectorName);
+            }
+            EditableConfigurationManager mgr =
ConfigurationUtil.getEditableConfigurationManager(kernel);
+            if (mgr != null) {
+                try {
+
mgr.removeGBeanFromConfiguration(connectorName.getArtifact(),
connectorName);
+                } catch (InvalidConfigException e) {
+                    log.error("Unable to add GBean", e);
+                } finally {
+                    ConfigurationUtil.releaseConfigurationManager(kernel, mgr);
+                }
+            } else {
+                log.warn("The ConfigurationManager in the kernel does
not allow editing");
+            }
+        } catch (GBeanNotFoundException e) {
+            log.warn("No such GBean '" + connectorName + "'");
//todo: what if we want to remove a failed GBean?
+        } catch (Exception e) {
+            log.error(e);
+        }
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("ActiveMQ
Manager", ActiveMQManagerGBean.class);
+        infoFactory.addAttribute("kernel", Kernel.class, false);
+        infoFactory.addAttribute("objectName", String.class, false);
+        infoFactory.addInterface(ActiveMQManager.class);
+        infoFactory.setConstructor(new String[]{"kernel", "objectName"});
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}
Index: modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/package.html
===================================================================
--- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/package.html	(revision
0)
+++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/package.html	(revision
0)
@@ -0,0 +1,11 @@
+<html>
+<head>
+</head>
+<body>
+
+<p>
+	The JMS container using GBeaps for deployment in Geronimo or other
JSR 77/88 based containers
+</p>
+
+</body>
+</html>

Property changes on:
modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/package.html
___________________________________________________________________
Name: svn:executable
   + *

Index: modules/activemq-gbean/pom.xml
===================================================================
--- modules/activemq-gbean/pom.xml	(revision 0)
+++ modules/activemq-gbean/pom.xml	(revision 0)
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Copyright 2005-2006 The Apache Software Foundation
+
+    Licensed 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.
+-->
+<!-- $Rev: 411333 $ $Date: 2006-06-02 18:35:57 -0500 (Fri, 02 Jun 2006) $ -->
+<project
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns="http://maven.apache.org/POM/4.0.0">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.geronimo.modules</groupId>
+        <artifactId>modules-parent</artifactId>
+        <version>1.2-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>geronimo-activemq-gbean</artifactId>
+    <version>${geronimoVersion}</version>
+    <name>ActiveMQ :: GBeans</name>
+    <description>Geronimo ActiveMQ Integration</description>
+
+    <dependencies>
+
+      <dependency>
+        <groupId>incubator-activemq</groupId>
+        <artifactId>activemq-core</artifactId>
+        <version>4.0-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>incubator-activemq</groupId>
+        <artifactId>activeio-core</artifactId>
+        <version>3.0-SNAPSHOT</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.apache.geronimo.modules</groupId>
+        <artifactId>geronimo-activemq-gbean-management</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.geronimo.modules</groupId>
+        <artifactId>geronimo-kernel</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.geronimo.modules</groupId>
+        <artifactId>geronimo-system</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.geronimo.modules</groupId>
+        <artifactId>geronimo-management</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.geronimo.modules</groupId>
+        <artifactId>geronimo-j2ee</artifactId>
+      </dependency>
+
+      <dependency>
+        <groupId>commons-logging</groupId>
+        <artifactId>commons-logging</artifactId>
+      </dependency>
+
+      <dependency>
+        <groupId>mx4j</groupId>
+        <artifactId>mx4j</artifactId>
+      </dependency>
+
+    </dependencies>
+
+</project>
Index: modules/activemq-gbean-management/project.properties
===================================================================
--- modules/activemq-gbean-management/project.properties	(revision 0)
+++ modules/activemq-gbean-management/project.properties	(revision 0)
@@ -0,0 +1,3 @@
+# -------------------------------------------------------------------
+# Build Properties
+# -------------------------------------------------------------------

Property changes on: modules/activemq-gbean-management/project.properties
___________________________________________________________________
Name: svn:executable
   + *

Index: modules/activemq-gbean-management/project.xml
===================================================================
--- modules/activemq-gbean-management/project.xml	(revision 0)
+++ modules/activemq-gbean-management/project.xml	(revision 0)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE project>
+<project>
+    <pomVersion>3</pomVersion>
+    <extend>../../etc/project.xml</extend>
+
+    <name>Geronimo :: ActiveMQ :: GBean Interfaces</name>
+    <id>geronimo-activemq-gbean-management</id>
+    <shortDescription>Geronimo / GBean management support</shortDescription>
+    <description>ActiveMQ management interfaces used for integration
into Apache Geronimo</description>
+
+    <!-- ============ -->
+    <!-- Dependencies -->
+    <!-- ============ -->
+    <dependencies>
+
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-management</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+
+    </dependencies>
+
+    <!-- this module is using m2 directory layout -->
+    <build>
+        <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
+        <unitTestSourceDirectory>${basedir}/src/main/test</unitTestSourceDirectory>
+
+        <unitTest>
+            <includes>
+                <include>**/*Test.java</include>
+            </includes>
+        </unitTest>
+    </build>
+
+</project>

Property changes on: modules/activemq-gbean-management/project.xml
___________________________________________________________________
Name: svn:executable
   + *

Index: modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQConnector.java
===================================================================
--- modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQConnector.java	(revision
0)
+++ modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQConnector.java	(revision
0)
@@ -0,0 +1,34 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ *  Licensed 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.gbean;
+
+import org.apache.geronimo.management.geronimo.JMSConnector;
+
+/**
+ * The GBean interface for the ActiveMQ network connector GBean
+ *
+ * @version $Revision: 1.0$
+ */
+public interface ActiveMQConnector extends JMSConnector {
+    public final static String CONNECTOR_J2EE_TYPE = "JMSConnector";
+
+    // Additional stuff you can add to an ActiveMQ connector URI
+    public String getPath();
+    public void setPath(String path);
+    public String getQuery();
+    public void setQuery(String query);
+}
Index: modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQManager.java
===================================================================
--- modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQManager.java	(revision
0)
+++ modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQManager.java	(revision
0)
@@ -0,0 +1,29 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ *  Licensed 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.gbean;
+
+import org.apache.geronimo.management.J2EEManagedObject;
+import org.apache.geronimo.management.geronimo.JMSManager;
+
+/**
+ * The GBean interface for the ActiveMQ management GBean.  This defines the
+ * features that should be available to the management interface at runtime.
+ *
+ * @version $Revision: 1.0$
+ */
+public interface ActiveMQManager extends JMSManager, J2EEManagedObject {
+}
Index: modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQBroker.java
===================================================================
--- modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQBroker.java	(revision
0)
+++ modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQBroker.java	(revision
0)
@@ -0,0 +1,30 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ *  Licensed 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.gbean;
+
+import org.apache.geronimo.management.geronimo.JMSBroker;
+
+/**
+ * The management interface for the ActiveMQ broker GBean.
+ * This is separate from ActiveMQContainer because that interface has hard
+ * links to code in activemq-core, yet we still want to be able to
+ * distinguish ActiveMQ brokers from non-ActiveMQ JMS brokers.
+ *
+ * @version $Revision: 1.0$
+ */
+public interface ActiveMQBroker extends JMSBroker {
+}
Index: modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/package.html
===================================================================
--- modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/package.html	(revision
0)
+++ modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/package.html	(revision
0)
@@ -0,0 +1,12 @@
+<html>
+<head>
+</head>
+<body>
+
+<p>
+	The management API for ActiveMQ, when run in a
+        container like Geronimo
+</p>
+
+</body>
+</html>

Property changes on:
modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/package.html
___________________________________________________________________
Name: svn:executable
   + *

Index: modules/activemq-gbean-management/pom.xml
===================================================================
--- modules/activemq-gbean-management/pom.xml	(revision 0)
+++ modules/activemq-gbean-management/pom.xml	(revision 0)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Copyright 2005-2006 The Apache Software Foundation
+
+    Licensed 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.
+-->
+<!-- $Rev: 411333 $ $Date: 2006-06-02 18:35:57 -0500 (Fri, 02 Jun 2006) $ -->
+<project
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns="http://maven.apache.org/POM/4.0.0">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.geronimo.modules</groupId>
+        <artifactId>modules-parent</artifactId>
+        <version>1.2-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>geronimo-activemq-gbean-management</artifactId>
+    <version>${geronimoVersion}</version>
+    <name>Geronimo :: ActiveMQ :: GBean Interfaces</name>
+    <description>ActiveMQ Management Interfaces used by Geronimo</description>
+
+    <dependencies>
+
+      <dependency>
+          <groupId>org.apache.geronimo.modules</groupId>
+          <artifactId>geronimo-management</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>backport-util-concurrent</groupId>
+        <artifactId>backport-util-concurrent</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>log4j</groupId>
+        <artifactId>log4j</artifactId>
+      </dependency>
+
+   </dependencies>
+</project>


-- 
Regards,
Hiram

Re: [RTC] ActiveMQ GBean modules

Posted by Dain Sundstrom <da...@iq80.com>.
I've read the patch over and it looks good to me.

+1 from me, but I'm not sure it should get counted since I didn't  
apply the patch.

-dain

On Jun 5, 2006, at 4:19 PM, Hiram Chirino wrote:

> Howdy folks,
>
> Here's  a patch that brings in the activemq gbean modules into
> geronimo.  It's partly what was in activemq 4.x and integrated into
> geronimo 1.2-dead merged with the changes in the 3.x branch.
>
> It compiles at least and looks like a reasonable start.  Once further
> integration work gets done we may need to tweak a little more.  here's
> my +1 got get this committed.  I guess I just need 3 more.
>
>
> Index: modules/activemq-gbean/project.properties
> ===================================================================
> --- modules/activemq-gbean/project.properties	(revision 0)
> +++ modules/activemq-gbean/project.properties	(revision 0)
> @@ -0,0 +1,3 @@
> +# -------------------------------------------------------------------
> +# Build Properties
> +# -------------------------------------------------------------------
>
> Property changes on: modules/activemq-gbean/project.properties
> ___________________________________________________________________
> Name: svn:executable
>   + *
>
> Index: modules/activemq-gbean/project.xml
> ===================================================================
> --- modules/activemq-gbean/project.xml	(revision 0)
> +++ modules/activemq-gbean/project.xml	(revision 0)
> @@ -0,0 +1,104 @@
> +<?xml version="1.0" encoding="ISO-8859-1"?>
> +<!--
> +
> +    Copyright 2004 The Apache Software Foundation
> +
> +    Licensed 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.
> +-->
> +<!-- $Rev: 356052 $ $Date: 2005-12-11 16:41:20 -0600 (Sun, 11 Dec  
> 2005) $ -->
> +<!DOCTYPE project>
> +<project>
> +    <pomVersion>3</pomVersion>
> +    <extend>../../etc/project.xml</extend>
> +
> +    <name>Geronimo :: ActiveMQ :: GBeans</name>
> +    <id>geronimo-activemq-gbean</id>
> +    <shortDescription>ActiveMQ Geronimo / GBean support</ 
> shortDescription>
> +    <description>ActiveMQ GBeans used for integration into Apache
> Geronimo</description>
> +
> +    <!-- ============ -->
> +    <!-- Dependencies -->
> +    <!-- ============ -->
> +    <dependencies>
> +
> +      <dependency>
> +        <groupId>incubator-activemq</groupId>
> +        <artifactId>activemq-core</artifactId>
> +        <version>4.0-SNAPSHOT</version>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>incubator-activemq</groupId>
> +        <artifactId>activeio-core</artifactId>
> +        <version>3.0-SNAPSHOT</version>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>geronimo</groupId>
> +        <artifactId>geronimo-activemq-gbean-management</artifactId>
> +        <version>${pom.currentVersion}</version>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>geronimo</groupId>
> +        <artifactId>geronimo-kernel</artifactId>
> +        <version>${pom.currentVersion}</version>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>geronimo</groupId>
> +        <artifactId>geronimo-system</artifactId>
> +        <version>${pom.currentVersion}</version>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>geronimo</groupId>
> +        <artifactId>geronimo-management</artifactId>
> +        <version>${pom.currentVersion}</version>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>geronimo</groupId>
> +        <artifactId>geronimo-j2ee</artifactId>
> +        <version>${pom.currentVersion}</version>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>mx4j</groupId>
> +        <artifactId>mx4j</artifactId>
> +        <version>${mx4j_version}</version>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>commons-logging</groupId>
> +        <artifactId>commons-logging</artifactId>
> +        <version>${commons_logging_version}</version>
> +        <url>http://jakarta.apache.org/commons/logging/</url>
> +      </dependency>
> +
> +
> +    </dependencies>
> +
> +    <!-- this module is using m2 directory layout -->
> +    <build>
> +        <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
> +        <unitTestSourceDirectory>${basedir}/src/main/test</ 
> unitTestSourceDirectory>
> +
> +        <unitTest>
> +            <includes>
> +                <include>**/*Test.java</include>
> +            </includes>
> +        </unitTest>
> +    </build>
> +
> +</project>
>
> Property changes on: modules/activemq-gbean/project.xml
> ___________________________________________________________________
> Name: svn:executable
>   + *
>
> Index: modules/activemq-gbean/src/test/java/org/apache/activemq/ 
> gbean/ConnectorTest.java
> ===================================================================
> --- modules/activemq-gbean/src/test/java/org/apache/activemq/gbean/ 
> ConnectorTest.java	(revision
> 0)
> +++ modules/activemq-gbean/src/test/java/org/apache/activemq/gbean/ 
> ConnectorTest.java	(revision
> 0)
> @@ -0,0 +1,61 @@
> +/**
> + *
> + * Copyright 2005-2006 The Apache Software Foundation
> + *
> + *  Licensed 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.gbean;
> +
> +import org.apache.activemq.gbean.TransportConnectorGBeanImpl;
> +
> +import junit.framework.TestCase;
> +
> +/**
> + * Tests to ensure that URL parsing and updating doesn't blow up
> + *
> + * @version $Revision: 1.0$
> + */
> +public class ConnectorTest extends TestCase {
> +    public TransportConnectorGBeanImpl test;
> +
> +    protected void setUp() throws Exception {
> +    }
> +
> +    public void testURLManipulation() {
> +        test = new TransportConnectorGBeanImpl(null, "foo",  
> "localhost", 1234);
> +        assertEquals("foo://localhost:1234", test.getUrl());
> +        assertEquals("foo", test.getProtocol());
> +        assertEquals("localhost", test.getHost());
> +        assertEquals(1234, test.getPort());
> +        test.setHost("0.0.0.0");
> +        assertEquals("foo://0.0.0.0:1234", test.getUrl());
> +        assertEquals("foo", test.getProtocol());
> +        assertEquals("0.0.0.0", test.getHost());
> +        assertEquals(1234, test.getPort());
> +        test.setPort(8765);
> +        assertEquals("foo://0.0.0.0:8765", test.getUrl());
> +        assertEquals("foo", test.getProtocol());
> +        assertEquals("0.0.0.0", test.getHost());
> +        assertEquals(8765, test.getPort());
> +        test.setProtocol("bar");
> +        assertEquals("bar://0.0.0.0:8765", test.getUrl());
> +        assertEquals("bar", test.getProtocol());
> +        assertEquals("0.0.0.0", test.getHost());
> +        assertEquals(8765, test.getPort());
> +        test = new TransportConnectorGBeanImpl(null, "vm",  
> "localhost", -1);
> +        assertEquals("vm://localhost", test.getUrl());
> +        assertEquals("vm", test.getProtocol());
> +        assertEquals("localhost", test.getHost());
> +        assertEquals(-1, test.getPort());
> +    }
> +}
> Index: modules/activemq-gbean/src/main/java/org/apache/activemq/ 
> gbean/BrokerServiceGBean.java
> ===================================================================
> --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> BrokerServiceGBean.java	(revision
> 0)
> +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> BrokerServiceGBean.java	(revision
> 0)
> @@ -0,0 +1,34 @@
> +/**
> + *
> + * Copyright 2005-2006 The Apache Software Foundation
> + *
> + *  Licensed 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.gbean;
> +
> +import org.apache.activemq.broker.BrokerService;
> +import org.apache.activemq.gbean.ActiveMQBroker;
> +
> +/**
> + * An interface to the ActiveMQContainerGBean for use by the
> + * ActiveMQConnectorGBean.
> + *
> + * @version $Revision: 1.1.1.1 $
> + */
> +public interface BrokerServiceGBean extends ActiveMQBroker {
> +	
> +	public abstract BrokerService getBrokerContainer();	
> +	public String getBrokerName();
> +
> +	
> +}
> \ No newline at end of file
>
> Property changes on:
> modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> BrokerServiceGBean.java
> ___________________________________________________________________
> Name: svn:executable
>   + *
>
> Index: modules/activemq-gbean/src/main/java/org/apache/activemq/ 
> gbean/BrokerServiceGBeanImpl.java
> ===================================================================
> --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> BrokerServiceGBeanImpl.java	(revision
> 0)
> +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> BrokerServiceGBeanImpl.java	(revision
> 0)
> @@ -0,0 +1,209 @@
> +/**
> + *
> + * Copyright 2005-2006 The Apache Software Foundation
> + *
> + *  Licensed 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.gbean;
> +
> +import java.net.URI;
> +
> +import javax.sql.DataSource;
> +
> +import org.apache.activemq.broker.BrokerFactory;
> +import org.apache.activemq.broker.BrokerService;
> +import org.apache.activemq.store.DefaultPersistenceAdapterFactory;
> +import org.apache.commons.logging.Log;
> +import org.apache.commons.logging.LogFactory;
> +import org.apache.geronimo.gbean.GBeanInfo;
> +import org.apache.geronimo.gbean.GBeanInfoBuilder;
> +import org.apache.geronimo.gbean.GBeanLifecycle;
> +import org.apache.geronimo.management.geronimo.JMSManager;
> +import org.apache.geronimo.management.geronimo.NetworkConnector;
> +import org.apache.geronimo.system.serverinfo.ServerInfo;
> +
> +
> +/**
> + * Default implementation of the ActiveMQ Message Server
> + *
> + * @version $Revision: 1.1.1.1 $
> + */
> +public class BrokerServiceGBeanImpl implements GBeanLifecycle,
> BrokerServiceGBean {
> +
> +    private Log log = LogFactory.getLog(getClass().getName());
> +
> +    private String brokerName;
> +    private String brokerUri;
> +    private BrokerService brokerService;
> +    private ServerInfo serverInfo;
> +    private String dataDirectory;
> +    private DataSourceReference dataSource;
> +
> +    private String objectName;
> +    private JMSManager manager;
> +
> +    public BrokerServiceGBeanImpl() {
> +    }
> +
> +    public synchronized BrokerService getBrokerContainer() {
> +        return brokerService;
> +    }
> +
> +    public synchronized void doStart() throws Exception {
> +        	ClassLoader old = Thread.currentThread 
> ().getContextClassLoader();
> +        	Thread.currentThread().setContextClassLoader 
> (BrokerServiceGBeanImpl.class.getClassLoader());
> +        	try {
> +    	        if (brokerService == null) {
> +    	            brokerService = createContainer();
> +    	        }
> +                DefaultPersistenceAdapterFactory persistenceFactory =
> (DefaultPersistenceAdapterFactory)
> brokerService.getPersistenceFactory();
> +
> persistenceFactory.setDataDirectory(serverInfo.resolve 
> (dataDirectory));
> +                persistenceFactory.setDataSource((DataSource)
> dataSource.$getResource());
> +                brokerService.start();
> +        	} finally {
> +            	Thread.currentThread().setContextClassLoader(old);
> +        	}
> +    }
> +
> +    protected BrokerService createContainer() throws Exception {
> +        if( brokerUri!=null ) {
> +            BrokerService answer = BrokerFactory.createBroker(new
> URI(brokerUri));
> +            brokerName = answer.getBrokerName();
> +            return answer;
> +        } else {
> +            BrokerService answer = new BrokerService();
> +            answer.setBrokerName(brokerName);
> +            return answer;
> +        }
> +    }
> +
> +    public synchronized void doStop() throws Exception {
> +        if (brokerService != null) {
> +            BrokerService temp = brokerService;
> +            brokerService = null;
> +            temp.stop();
> +        }
> +    }
> +
> +    public synchronized void doFail() {
> +        if (brokerService != null) {
> +            BrokerService temp = brokerService;
> +            brokerService = null;
> +            try {
> +                temp.stop();
> +            } catch (Exception e) {
> +                log.info("Caught while closing due to failure: " +  
> e, e);
> +            }
> +        }
> +    }
> +
> +    public static final GBeanInfo GBEAN_INFO;
> +
> +    static {
> +        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("ActiveMQ
> Message Broker", BrokerServiceGBeanImpl.class, "JMSServer");
> +        infoFactory.addReference("serverInfo", ServerInfo.class);
> +        infoFactory.addAttribute("brokerName", String.class, true);
> +        infoFactory.addAttribute("brokerUri", String.class, true);
> +        infoFactory.addAttribute("dataDirectory", String.class,  
> true);
> +        infoFactory.addReference("dataSource",  
> DataSourceReference.class);
> +        infoFactory.addAttribute("objectName", String.class, false);
> +        infoFactory.addReference("manager", JMSManager.class);
> +        infoFactory.addInterface(BrokerServiceGBean.class);
> +        // infoFactory.setConstructor(new String[]{"brokerName,  
> brokerUri"});
> +        GBEAN_INFO = infoFactory.getBeanInfo();
> +    }
> +
> +    public static GBeanInfo getGBeanInfo() {
> +        return GBEAN_INFO;
> +    }
> +
> +	/**
> +	 * @return Returns the brokerName.
> +	 */
> +	public String getBrokerName() {
> +		return brokerName;
> +	}
> +
> +    public String getBrokerUri() {
> +        return brokerUri;
> +    }
> +
> +    public void setBrokerName(String brokerName) {
> +        this.brokerName = brokerName;
> +    }
> +
> +    public void setBrokerUri(String brokerUri) {
> +        this.brokerUri = brokerUri;
> +    }
> +
> +    public ServerInfo getServerInfo() {
> +        return serverInfo;
> +    }
> +
> +    public void setServerInfo(ServerInfo serverInfo) {
> +        this.serverInfo = serverInfo;
> +    }
> +
> +    public String getDataDirectory() {
> +        return dataDirectory;
> +    }
> +
> +    public void setDataDirectory(String dataDir) {
> +        this.dataDirectory = dataDir;
> +    }
> +
> +    public DataSourceReference getDataSource() {
> +        return dataSource;
> +    }
> +
> +    public void setDataSource(DataSourceReference dataSource) {
> +        this.dataSource = dataSource;
> +    }
> +
> +    public String getObjectName() {
> +        return objectName;
> +    }
> +
> +    public boolean isStateManageable() {
> +        return true;
> +    }
> +
> +    public boolean isStatisticsProvider() {
> +        return false; // todo: return true once stats are integrated
> +    }
> +
> +    public boolean isEventProvider() {
> +        return true;
> +    }
> +
> +    public NetworkConnector[] getConnectors() {
> +        return manager.getConnectorsForContainer(this);
> +    }
> +
> +    public NetworkConnector[] getConnectors(String protocol) {
> +        return manager.getConnectorsForContainer(this, protocol);
> +    }
> +
> +    public JMSManager getManager() {
> +        return manager;
> +    }
> +
> +    public void setManager(JMSManager manager) {
> +        this.manager = manager;
> +    }
> +
> +    public void setObjectName(String objectName) {
> +        this.objectName = objectName;
> +    }
> +	
> +}
> \ No newline at end of file
>
> Property changes on:
> modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> BrokerServiceGBeanImpl.java
> ___________________________________________________________________
> Name: svn:executable
>   + *
>
> Index: modules/activemq-gbean/src/main/java/org/apache/activemq/ 
> gbean/TransportConnectorGBeanImpl.java
> ===================================================================
> --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> TransportConnectorGBeanImpl.java	(revision
> 0)
> +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> TransportConnectorGBeanImpl.java	(revision
> 0)
> @@ -0,0 +1,168 @@
> +/**
> + *
> + * Copyright 2005-2006 The Apache Software Foundation
> + *
> + *  Licensed 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.gbean;
> +
> +import java.net.InetSocketAddress;
> +import java.net.URI;
> +import java.net.URISyntaxException;
> +
> +import org.apache.activemq.broker.TransportConnector;
> +import org.apache.activemq.gbean.ActiveMQConnector;
> +import org.apache.commons.logging.Log;
> +import org.apache.commons.logging.LogFactory;
> +import org.apache.geronimo.gbean.GBeanInfo;
> +import org.apache.geronimo.gbean.GBeanInfoBuilder;
> +import org.apache.geronimo.gbean.GBeanLifecycle;
> +import org.apache.geronimo.gbean.GConstructorInfo;
> +
> +/**
> + * Default implementation of the ActiveMQ connector
> + *
> + * @version $Revision: 1.1.1.1 $
> + */
> +public class TransportConnectorGBeanImpl implements GBeanLifecycle,
> ActiveMQConnector {
> +    private Log log = LogFactory.getLog(getClass().getName());
> +
> +    private TransportConnector transportConnector;
> +    private BrokerServiceGBean brokerService;
> +
> +    private String protocol;
> +    private String host;
> +    private int port;
> +    private String path;
> +    private String query;
> +    private String urlAsStarted;
> +
> +    public TransportConnectorGBeanImpl(BrokerServiceGBean
> brokerService, String protocol, String host, int port) {
> +        this.brokerService = brokerService;
> +        this.protocol = protocol;
> +        this.host = host;
> +        this.port = port;
> +    }
> +
> +    public String getProtocol() {
> +        return protocol;
> +    }
> +
> +    public void setProtocol(String protocol) {
> +        this.protocol = protocol;
> +    }
> +
> +    public String getHost() {
> +        return host;
> +    }
> +
> +    public void setHost(String host) {
> +        this.host = host;
> +    }
> +
> +    public int getPort() {
> +        return port;
> +    }
> +
> +    public void setPort(int port) {
> +        this.port = port;
> +    }
> +
> +    public String getPath() {
> +        return path;
> +    }
> +
> +    public void setPath(String path) {
> +        this.path = path;
> +    }
> +
> +    public String getQuery() {
> +        return query;
> +    }
> +
> +    public void setQuery(String query) {
> +        this.query = query;
> +    }
> +
> +    public String getUrl() {
> +        try {
> +            return new URI(protocol, null, host, port, path, query,
> null).toString();
> +        } catch (URISyntaxException e) {
> +            throw new IllegalStateException("Attributes don't form a
> valid URI: "+protocol+"://"+host+":"+port+"/"+path+"?"+query);
> +        }
> +    }
> +
> +    public InetSocketAddress getListenAddress() {
> +        try {
> +            return transportConnector.getServer().getSocketAddress();
> +        } catch (Throwable e) {
> +            log.debug("Failure to determine ListenAddress: "+e,e);
> +            return null;
> +        }
> +    }
> +
> +    public synchronized void doStart() throws Exception {
> +    	ClassLoader old = Thread.currentThread().getContextClassLoader 
> ();
> +    	Thread.currentThread().setContextClassLoader 
> (BrokerServiceGBeanImpl.class.getClassLoader());
> +    	try {
> +	        if (transportConnector == null) {
> +                urlAsStarted = getUrl();
> +	            transportConnector = createBrokerConnector 
> (urlAsStarted);
> +	            transportConnector.start();
> +	        }
> +    	} finally {
> +        	Thread.currentThread().setContextClassLoader(old);
> +    	}
> +    }
> +
> +    public synchronized void doStop() throws Exception {
> +        if (transportConnector != null) {
> +            TransportConnector temp = transportConnector;
> +            transportConnector = null;
> +            temp.stop();
> +        }
> +    }
> +
> +    public synchronized void doFail() {
> +        if (transportConnector != null) {
> +            TransportConnector temp = transportConnector;
> +            transportConnector = null;
> +            try {
> +                temp.stop();
> +            }
> +            catch (Exception e) {
> +                log.info("Caught while closing due to failure: " +  
> e, e);
> +            }
> +        }
> +    }
> +
> +    protected TransportConnector createBrokerConnector(String url)
> throws Exception {
> +        return brokerService.getBrokerContainer().addConnector(url);
> +    }
> +
> +    public static final GBeanInfo GBEAN_INFO;
> +
> +    static {
> +        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("ActiveMQ
> Transport Connector", TransportConnectorGBeanImpl.class,
> CONNECTOR_J2EE_TYPE);
> +        infoFactory.addAttribute("url", String.class.getName(),  
> false);
> +        infoFactory.addReference("brokerService",  
> BrokerServiceGBean.class);
> +        infoFactory.addInterface(ActiveMQConnector.class, new
> String[]{"host","port","protocol","path","query"},
> +                new String[]{"host","port"});
> +        infoFactory.setConstructor(new GConstructorInfo(new
> String[]{"brokerService", "protocol", "host", "port"}));
> +        GBEAN_INFO = infoFactory.getBeanInfo();
> +    }
> +
> +    public static GBeanInfo getGBeanInfo() {
> +        return GBEAN_INFO;
> +    }
> +}
>
> Property changes on:
> modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> TransportConnectorGBeanImpl.java
> ___________________________________________________________________
> Name: svn:executable
>   + *
>
> Index: modules/activemq-gbean/src/main/java/org/apache/activemq/ 
> gbean/DataSourceReference.java
> ===================================================================
> --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> DataSourceReference.java	(revision
> 0)
> +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> DataSourceReference.java	(revision
> 0)
> @@ -0,0 +1,21 @@
> +/**
> + *
> + * Copyright 2005-2006 The Apache Software Foundation
> + *
> + *  Licensed 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.gbean;
> +
> +public interface DataSourceReference {
> +    public Object $getResource();
> +}
> Index: modules/activemq-gbean/src/main/java/org/apache/activemq/ 
> gbean/management/ActiveMQManagerGBean.java
> ===================================================================
> --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> management/ActiveMQManagerGBean.java	(revision
> 0)
> +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> management/ActiveMQManagerGBean.java	(revision
> 0)
> @@ -0,0 +1,266 @@
> +/**
> + *
> + * Copyright 2005-2006 The Apache Software Foundation
> + *
> + *  Licensed 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.gbean.management;
> +
> +import java.util.ArrayList;
> +import java.util.Iterator;
> +import java.util.List;
> +import java.util.Set;
> +
> +import org.apache.activemq.gbean.ActiveMQBroker;
> +import org.apache.activemq.gbean.ActiveMQConnector;
> +import org.apache.activemq.gbean.ActiveMQManager;
> +import org.apache.activemq.gbean.TransportConnectorGBeanImpl;
> +import org.apache.commons.logging.Log;
> +import org.apache.commons.logging.LogFactory;
> +import org.apache.geronimo.gbean.AbstractName;
> +import org.apache.geronimo.gbean.AbstractNameQuery;
> +import org.apache.geronimo.gbean.GBeanData;
> +import org.apache.geronimo.gbean.GBeanInfo;
> +import org.apache.geronimo.gbean.GBeanInfoBuilder;
> +import org.apache.geronimo.gbean.ReferencePatterns;
> +import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
> +import org.apache.geronimo.kernel.GBeanNotFoundException;
> +import org.apache.geronimo.kernel.Kernel;
> +import org.apache.geronimo.kernel.config.ConfigurationUtil;
> +import  
> org.apache.geronimo.kernel.config.EditableConfigurationManager;
> +import org.apache.geronimo.kernel.config.InvalidConfigException;
> +import org.apache.geronimo.kernel.proxy.ProxyManager;
> +import org.apache.geronimo.management.geronimo.JMSBroker;
> +import org.apache.geronimo.management.geronimo.JMSConnector;
> +import org.apache.geronimo.management.geronimo.NetworkConnector;
> +
> +/**
> + * Implementation of the ActiveMQ management interface.  These are  
> the ActiveMQ
> + * management features available at runtime.
> + *
> + * @version $Revision: 1.0$
> + */
> +public class ActiveMQManagerGBean implements ActiveMQManager {
> +    private static final Log log =
> LogFactory.getLog(ActiveMQManagerGBean.class.getName());
> +    private Kernel kernel;
> +    private String objectName;
> +
> +    public ActiveMQManagerGBean(Kernel kernel, String objectName) {
> +        this.kernel = kernel;
> +        this.objectName = objectName;
> +    }
> +
> +    public String getProductName() {
> +        return "ActiveMQ";
> +    }
> +
> +    public String getObjectName() {
> +        return objectName;
> +    }
> +
> +    public boolean isEventProvider() {
> +        return false;
> +    }
> +
> +    public boolean isStateManageable() {
> +        return true;
> +    }
> +
> +    public boolean isStatisticsProvider() {
> +        return false;
> +    }
> +
> +    public Object[] getContainers() {
> +        ProxyManager proxyManager = kernel.getProxyManager();
> +        AbstractNameQuery query = new
> AbstractNameQuery(ActiveMQBroker.class.getName());
> +        Set names = kernel.listGBeans(query);
> +        ActiveMQBroker[] results = new ActiveMQBroker[names.size()];
> +        int i=0;
> +        for (Iterator it = names.iterator(); it.hasNext(); i++) {
> +            AbstractName name = (AbstractName) it.next();
> +            results[i] = (ActiveMQBroker)
> proxyManager.createProxy(name, ActiveMQBroker.class.getClassLoader());
> +        }
> +        return results;
> +    }
> +
> +    public String[] getSupportedProtocols() {
> +        // see files in
> modules/core/src/conf/META-INF/services/org/activemq/transport/server/
> +        return new String[]{ "tcp", "stomp", "vm", "peer", "udp",
> "multicast", "failover"};
> +    }
> +
> +    public NetworkConnector[] getConnectors() {
> +        ProxyManager proxyManager = kernel.getProxyManager();
> +        AbstractNameQuery query = new
> AbstractNameQuery(ActiveMQConnector.class.getName());
> +        Set names = kernel.listGBeans(query);
> +        ActiveMQConnector[] results = new ActiveMQConnector 
> [names.size()];
> +        int i=0;
> +        for (Iterator it = names.iterator(); it.hasNext(); i++) {
> +            AbstractName name = (AbstractName) it.next();
> +            results[i] = (ActiveMQConnector)
> proxyManager.createProxy(name,
> ActiveMQConnector.class.getClassLoader());
> +        }
> +        return results;
> +    }
> +
> +    public NetworkConnector[] getConnectors(String protocol) {
> +        if(protocol == null) {
> +            return getConnectors();
> +        }
> +        List result = new ArrayList();
> +        ProxyManager proxyManager = kernel.getProxyManager();
> +        AbstractNameQuery query = new
> AbstractNameQuery(ActiveMQConnector.class.getName());
> +        Set names = kernel.listGBeans(query);
> +        for (Iterator it = names.iterator(); it.hasNext();) {
> +            AbstractName name = (AbstractName) it.next();
> +            try {
> +                if (kernel.getAttribute(name, "protocol").equals 
> (protocol)) {
> +                    result.add(proxyManager.createProxy(name,
> ActiveMQConnector.class.getClassLoader()));
> +                }
> +            } catch (Exception e) {
> +                log.error("Unable to check the protocol for a  
> connector", e);
> +            }
> +        }
> +        return (ActiveMQConnector[]) result.toArray(new
> ActiveMQConnector[names.size()]);
> +    }
> +
> +    public NetworkConnector[] getConnectorsForContainer(Object  
> broker) {
> +        AbstractName containerName = kernel.getAbstractNameFor 
> (broker);
> +        ProxyManager mgr = kernel.getProxyManager();
> +        try {
> +            List results = new ArrayList();
> +            AbstractNameQuery query = new
> AbstractNameQuery(ActiveMQConnector.class.getName());
> +            Set set = kernel.listGBeans(query); // all Jetty  
> connectors
> +            for (Iterator it = set.iterator(); it.hasNext();) {
> +                AbstractName name = (AbstractName) it.next(); // a
> single Jetty connector
> +                GBeanData data = kernel.getGBeanData(name);
> +                ReferencePatterns refs =
> data.getReferencePatterns("activeMQContainer");
> +                if (containerName.equals(refs.getAbstractName())) {
> +                    results.add(mgr.createProxy(name,
> ActiveMQConnector.class.getClassLoader()));
> +                }
> +            }
> +            return (ActiveMQConnector[]) results.toArray(new
> ActiveMQConnector[results.size()]);
> +        } catch (Exception e) {
> +            throw (IllegalArgumentException) new
> IllegalArgumentException("Unable to look up connectors for ActiveMQ
> broker '"+containerName).initCause(e);
> +        }
> +    }
> +
> +    public NetworkConnector[] getConnectorsForContainer(Object
> broker, String protocol) {
> +        if(protocol == null) {
> +            return getConnectorsForContainer(broker);
> +        }
> +        AbstractName containerName = kernel.getAbstractNameFor 
> (broker);
> +        ProxyManager mgr = kernel.getProxyManager();
> +        try {
> +            List results = new ArrayList();
> +            AbstractNameQuery query = new
> AbstractNameQuery(ActiveMQConnector.class.getName());
> +            Set set = kernel.listGBeans(query); // all Jetty  
> connectors
> +            for (Iterator it = set.iterator(); it.hasNext();) {
> +                AbstractName name = (AbstractName) it.next(); // a
> single Jetty connector
> +                GBeanData data = kernel.getGBeanData(name);
> +                ReferencePatterns refs =
> data.getReferencePatterns("activeMQContainer");
> +                if(containerName.equals(refs.getAbstractName())) {
> +                    try {
> +                        String testProtocol = (String)
> kernel.getAttribute(name, "protocol");
> +                        if(testProtocol != null &&
> testProtocol.equals(protocol)) {
> +                            results.add(mgr.createProxy(name,
> ActiveMQConnector.class.getClassLoader()));
> +                        }
> +                    } catch (Exception e) {
> +                        log.error("Unable to look up protocol for
> connector '"+name+"'",e);
> +                    }
> +                    break;
> +                }
> +            }
> +            return (ActiveMQConnector[]) results.toArray(new
> ActiveMQConnector[results.size()]);
> +        } catch (Exception e) {
> +            throw (IllegalArgumentException)new
> IllegalArgumentException("Unable to look up connectors for ActiveMQ
> broker '"+containerName +"': ").initCause(e);
> +        }
> +    }
> +
> +    /**
> +     * Creates a new connector, and returns the ObjectName for  
> it.  Note that
> +     * the connector may well require further customization before  
> being fully
> +     * functional (e.g. SSL settings for a secure connector).
> +     */
> +    public JMSConnector addConnector(JMSBroker broker, String
> uniqueName, String protocol, String host, int port) {
> +        AbstractName brokerAbstractName = kernel.getAbstractNameFor 
> (broker);
> +        AbstractName name =
> kernel.getNaming().createChildName(brokerAbstractName, uniqueName,
> NameFactory.GERONIMO_SERVICE);
> +        GBeanData connector = new GBeanData(name,
> TransportConnectorGBeanImpl.GBEAN_INFO);
> +        //todo: if SSL is supported, need to add more properties or
> use a different GBean?
> +        connector.setAttribute("protocol", protocol);
> +        connector.setAttribute("host", host);
> +        connector.setAttribute("port", new Integer(port));
> +        connector.setReferencePattern("activeMQContainer",  
> brokerAbstractName);
> +        EditableConfigurationManager mgr =
> ConfigurationUtil.getEditableConfigurationManager(kernel);
> +        if(mgr != null) {
> +            try {
> +
> mgr.addGBeanToConfiguration(brokerAbstractName.getArtifact(),
> connector, false);
> +                return (JMSConnector)
> kernel.getProxyManager().createProxy(name,
> ActiveMQConnector.class.getClassLoader());
> +            } catch (InvalidConfigException e) {
> +                log.error("Unable to add GBean", e);
> +                return null;
> +            } finally {
> +                ConfigurationUtil.releaseConfigurationManager 
> (kernel, mgr);
> +            }
> +        } else {
> +            log.warn("The ConfigurationManager in the kernel does not
> allow editing");
> +            return null;
> +        }
> +    }
> +
> +    public void removeConnector(AbstractName connectorName) {
> +        try {
> +            GBeanInfo info = kernel.getGBeanInfo(connectorName);
> +            boolean found = false;
> +            Set intfs = info.getInterfaces();
> +            for (Iterator it = intfs.iterator(); it.hasNext();) {
> +                String intf = (String) it.next();
> +                if (intf.equals(ActiveMQConnector.class.getName())) {
> +                    found = true;
> +                }
> +            }
> +            if (!found) {
> +                throw new GBeanNotFoundException(connectorName);
> +            }
> +            EditableConfigurationManager mgr =
> ConfigurationUtil.getEditableConfigurationManager(kernel);
> +            if (mgr != null) {
> +                try {
> +
> mgr.removeGBeanFromConfiguration(connectorName.getArtifact(),
> connectorName);
> +                } catch (InvalidConfigException e) {
> +                    log.error("Unable to add GBean", e);
> +                } finally {
> +                    ConfigurationUtil.releaseConfigurationManager 
> (kernel, mgr);
> +                }
> +            } else {
> +                log.warn("The ConfigurationManager in the kernel does
> not allow editing");
> +            }
> +        } catch (GBeanNotFoundException e) {
> +            log.warn("No such GBean '" + connectorName + "'");
> //todo: what if we want to remove a failed GBean?
> +        } catch (Exception e) {
> +            log.error(e);
> +        }
> +    }
> +
> +    public static final GBeanInfo GBEAN_INFO;
> +
> +    static {
> +        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("ActiveMQ
> Manager", ActiveMQManagerGBean.class);
> +        infoFactory.addAttribute("kernel", Kernel.class, false);
> +        infoFactory.addAttribute("objectName", String.class, false);
> +        infoFactory.addInterface(ActiveMQManager.class);
> +        infoFactory.setConstructor(new String[]{"kernel",  
> "objectName"});
> +        GBEAN_INFO = infoFactory.getBeanInfo();
> +    }
> +
> +    public static GBeanInfo getGBeanInfo() {
> +        return GBEAN_INFO;
> +    }
> +}
> Index: modules/activemq-gbean/src/main/java/org/apache/activemq/ 
> gbean/package.html
> ===================================================================
> --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> package.html	(revision
> 0)
> +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> package.html	(revision
> 0)
> @@ -0,0 +1,11 @@
> +<html>
> +<head>
> +</head>
> +<body>
> +
> +<p>
> +	The JMS container using GBeaps for deployment in Geronimo or other
> JSR 77/88 based containers
> +</p>
> +
> +</body>
> +</html>
>
> Property changes on:
> modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> package.html
> ___________________________________________________________________
> Name: svn:executable
>   + *
>
> Index: modules/activemq-gbean/pom.xml
> ===================================================================
> --- modules/activemq-gbean/pom.xml	(revision 0)
> +++ modules/activemq-gbean/pom.xml	(revision 0)
> @@ -0,0 +1,83 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<!--
> +    Copyright 2005-2006 The Apache Software Foundation
> +
> +    Licensed 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.
> +-->
> +<!-- $Rev: 411333 $ $Date: 2006-06-02 18:35:57 -0500 (Fri, 02 Jun  
> 2006) $ -->
> +<project
> +  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd"
> +  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> +  xmlns="http://maven.apache.org/POM/4.0.0">
> +
> +    <modelVersion>4.0.0</modelVersion>
> +
> +    <parent>
> +        <groupId>org.apache.geronimo.modules</groupId>
> +        <artifactId>modules-parent</artifactId>
> +        <version>1.2-SNAPSHOT</version>
> +        <relativePath>../pom.xml</relativePath>
> +    </parent>
> +
> +    <artifactId>geronimo-activemq-gbean</artifactId>
> +    <version>${geronimoVersion}</version>
> +    <name>ActiveMQ :: GBeans</name>
> +    <description>Geronimo ActiveMQ Integration</description>
> +
> +    <dependencies>
> +
> +      <dependency>
> +        <groupId>incubator-activemq</groupId>
> +        <artifactId>activemq-core</artifactId>
> +        <version>4.0-SNAPSHOT</version>
> +      </dependency>
> +      <dependency>
> +        <groupId>incubator-activemq</groupId>
> +        <artifactId>activeio-core</artifactId>
> +        <version>3.0-SNAPSHOT</version>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>org.apache.geronimo.modules</groupId>
> +        <artifactId>geronimo-activemq-gbean-management</artifactId>
> +      </dependency>
> +      <dependency>
> +        <groupId>org.apache.geronimo.modules</groupId>
> +        <artifactId>geronimo-kernel</artifactId>
> +      </dependency>
> +      <dependency>
> +        <groupId>org.apache.geronimo.modules</groupId>
> +        <artifactId>geronimo-system</artifactId>
> +      </dependency>
> +      <dependency>
> +        <groupId>org.apache.geronimo.modules</groupId>
> +        <artifactId>geronimo-management</artifactId>
> +      </dependency>
> +      <dependency>
> +        <groupId>org.apache.geronimo.modules</groupId>
> +        <artifactId>geronimo-j2ee</artifactId>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>commons-logging</groupId>
> +        <artifactId>commons-logging</artifactId>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>mx4j</groupId>
> +        <artifactId>mx4j</artifactId>
> +      </dependency>
> +
> +    </dependencies>
> +
> +</project>
> Index: modules/activemq-gbean-management/project.properties
> ===================================================================
> --- modules/activemq-gbean-management/project.properties	(revision 0)
> +++ modules/activemq-gbean-management/project.properties	(revision 0)
> @@ -0,0 +1,3 @@
> +# -------------------------------------------------------------------
> +# Build Properties
> +# -------------------------------------------------------------------
>
> Property changes on: modules/activemq-gbean-management/ 
> project.properties
> ___________________________________________________________________
> Name: svn:executable
>   + *
>
> Index: modules/activemq-gbean-management/project.xml
> ===================================================================
> --- modules/activemq-gbean-management/project.xml	(revision 0)
> +++ modules/activemq-gbean-management/project.xml	(revision 0)
> @@ -0,0 +1,37 @@
> +<?xml version="1.0" encoding="ISO-8859-1"?>
> +<!DOCTYPE project>
> +<project>
> +    <pomVersion>3</pomVersion>
> +    <extend>../../etc/project.xml</extend>
> +
> +    <name>Geronimo :: ActiveMQ :: GBean Interfaces</name>
> +    <id>geronimo-activemq-gbean-management</id>
> +    <shortDescription>Geronimo / GBean management support</ 
> shortDescription>
> +    <description>ActiveMQ management interfaces used for integration
> into Apache Geronimo</description>
> +
> +    <!-- ============ -->
> +    <!-- Dependencies -->
> +    <!-- ============ -->
> +    <dependencies>
> +
> +        <dependency>
> +            <groupId>geronimo</groupId>
> +            <artifactId>geronimo-management</artifactId>
> +            <version>${pom.currentVersion}</version>
> +        </dependency>
> +
> +    </dependencies>
> +
> +    <!-- this module is using m2 directory layout -->
> +    <build>
> +        <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
> +        <unitTestSourceDirectory>${basedir}/src/main/test</ 
> unitTestSourceDirectory>
> +
> +        <unitTest>
> +            <includes>
> +                <include>**/*Test.java</include>
> +            </includes>
> +        </unitTest>
> +    </build>
> +
> +</project>
>
> Property changes on: modules/activemq-gbean-management/project.xml
> ___________________________________________________________________
> Name: svn:executable
>   + *
>
> Index: modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/ActiveMQConnector.java
> ===================================================================
> --- modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/ActiveMQConnector.java	(revision
> 0)
> +++ modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/ActiveMQConnector.java	(revision
> 0)
> @@ -0,0 +1,34 @@
> +/**
> + *
> + * Copyright 2005-2006 The Apache Software Foundation
> + *
> + *  Licensed 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.gbean;
> +
> +import org.apache.geronimo.management.geronimo.JMSConnector;
> +
> +/**
> + * The GBean interface for the ActiveMQ network connector GBean
> + *
> + * @version $Revision: 1.0$
> + */
> +public interface ActiveMQConnector extends JMSConnector {
> +    public final static String CONNECTOR_J2EE_TYPE = "JMSConnector";
> +
> +    // Additional stuff you can add to an ActiveMQ connector URI
> +    public String getPath();
> +    public void setPath(String path);
> +    public String getQuery();
> +    public void setQuery(String query);
> +}
> Index: modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/ActiveMQManager.java
> ===================================================================
> --- modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/ActiveMQManager.java	(revision
> 0)
> +++ modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/ActiveMQManager.java	(revision
> 0)
> @@ -0,0 +1,29 @@
> +/**
> + *
> + * Copyright 2005-2006 The Apache Software Foundation
> + *
> + *  Licensed 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.gbean;
> +
> +import org.apache.geronimo.management.J2EEManagedObject;
> +import org.apache.geronimo.management.geronimo.JMSManager;
> +
> +/**
> + * The GBean interface for the ActiveMQ management GBean.  This  
> defines the
> + * features that should be available to the management interface  
> at runtime.
> + *
> + * @version $Revision: 1.0$
> + */
> +public interface ActiveMQManager extends JMSManager,  
> J2EEManagedObject {
> +}
> Index: modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/ActiveMQBroker.java
> ===================================================================
> --- modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/ActiveMQBroker.java	(revision
> 0)
> +++ modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/ActiveMQBroker.java	(revision
> 0)
> @@ -0,0 +1,30 @@
> +/**
> + *
> + * Copyright 2005-2006 The Apache Software Foundation
> + *
> + *  Licensed 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.gbean;
> +
> +import org.apache.geronimo.management.geronimo.JMSBroker;
> +
> +/**
> + * The management interface for the ActiveMQ broker GBean.
> + * This is separate from ActiveMQContainer because that interface  
> has hard
> + * links to code in activemq-core, yet we still want to be able to
> + * distinguish ActiveMQ brokers from non-ActiveMQ JMS brokers.
> + *
> + * @version $Revision: 1.0$
> + */
> +public interface ActiveMQBroker extends JMSBroker {
> +}
> Index: modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/package.html
> ===================================================================
> --- modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/package.html	(revision
> 0)
> +++ modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/package.html	(revision
> 0)
> @@ -0,0 +1,12 @@
> +<html>
> +<head>
> +</head>
> +<body>
> +
> +<p>
> +	The management API for ActiveMQ, when run in a
> +        container like Geronimo
> +</p>
> +
> +</body>
> +</html>
>
> Property changes on:
> modules/activemq-gbean-management/src/main/java/org/apache/activemq/ 
> gbean/package.html
> ___________________________________________________________________
> Name: svn:executable
>   + *
>
> Index: modules/activemq-gbean-management/pom.xml
> ===================================================================
> --- modules/activemq-gbean-management/pom.xml	(revision 0)
> +++ modules/activemq-gbean-management/pom.xml	(revision 0)
> @@ -0,0 +1,53 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<!--
> +    Copyright 2005-2006 The Apache Software Foundation
> +
> +    Licensed 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.
> +-->
> +<!-- $Rev: 411333 $ $Date: 2006-06-02 18:35:57 -0500 (Fri, 02 Jun  
> 2006) $ -->
> +<project
> +  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd"
> +  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> +  xmlns="http://maven.apache.org/POM/4.0.0">
> +
> +    <modelVersion>4.0.0</modelVersion>
> +
> +    <parent>
> +        <groupId>org.apache.geronimo.modules</groupId>
> +        <artifactId>modules-parent</artifactId>
> +        <version>1.2-SNAPSHOT</version>
> +        <relativePath>../pom.xml</relativePath>
> +    </parent>
> +
> +    <artifactId>geronimo-activemq-gbean-management</artifactId>
> +    <version>${geronimoVersion}</version>
> +    <name>Geronimo :: ActiveMQ :: GBean Interfaces</name>
> +    <description>ActiveMQ Management Interfaces used by Geronimo</ 
> description>
> +
> +    <dependencies>
> +
> +      <dependency>
> +          <groupId>org.apache.geronimo.modules</groupId>
> +          <artifactId>geronimo-management</artifactId>
> +      </dependency>
> +      <dependency>
> +        <groupId>backport-util-concurrent</groupId>
> +        <artifactId>backport-util-concurrent</artifactId>
> +      </dependency>
> +      <dependency>
> +        <groupId>log4j</groupId>
> +        <artifactId>log4j</artifactId>
> +      </dependency>
> +
> +   </dependencies>
> +</project>
>
>
> -- 
> Regards,
> Hiram


Re: [RTC] ActiveMQ GBean modules

Posted by David Jencks <da...@yahoo.com>.
On Jun 8, 2006, at 8:17 AM, Hiram Chirino wrote:

> So in terms the of the RTC process, is this RTC patch dead since it
> did not get the 3 +1's

I'll say it again, please attach the patch to a jira and I will be  
happy to review it.  I don't think changes of this size should occur  
without a jira for tracking purposes.

thanks
david jencks

>
> I kinda would have preferred to get some -1's instead of not getting
> any comments on the patch.  Is it that there are not enough folks that
> are interested in the activemq integration aspects of geronimo?
>
> Regards,
> Hiram
>
> On 6/6/06, Hiram Chirino <hi...@hiramchirino.com> wrote:
>> m2 poms are included in the patch.  But for some reason the  
>> current m2
>> build does not seem to let you run mvn from a submodule, some
>> dependency variables do not get evaluated.  weird.
>>
>> On 6/5/06, David Jencks <da...@yahoo.com> wrote:
>> >
>> > On Jun 5, 2006, at 4:19 PM, Hiram Chirino wrote:
>> >
>> > > Howdy folks,
>> > >
>> > > Here's  a patch that brings in the activemq gbean modules into
>> > > geronimo.  It's partly what was in activemq 4.x and integrated  
>> into
>> > > geronimo 1.2-dead merged with the changes in the 3.x branch.
>> > >
>> > > It compiles at least and looks like a reasonable start.  Once  
>> further
>> > > integration work gets done we may need to tweak a little  
>> more.  here's
>> > > my +1 got get this committed.  I guess I just need 3 more.
>> > >
>> >
>> > I'd find it a lot easier to review, apply, and test this patch  
>> if you
>> > attached it to  a jira entry.
>> >
>> > Is there any chance of you coming up with a pom.xml for the m2  
>> build?
>> >
>> > thanks
>> > david jencks
>> >
>> >
>>
>>
>> --
>> Regards,
>> Hiram
>>
>
>
> -- 
> Regards,
> Hiram


Re: [RTC] ActiveMQ GBean modules

Posted by Matt Hogstrom <ma...@hogstrom.org>.
I was going to defer to others that had time.  Personally I'd like to get 1.1 out :)

Hiram Chirino wrote:
> So in terms the of the RTC process, is this RTC patch dead since it
> did not get the 3 +1's
> 
> I kinda would have preferred to get some -1's instead of not getting
> any comments on the patch.  Is it that there are not enough folks that
> are interested in the activemq integration aspects of geronimo?
> 
> Regards,
> Hiram
> 
> On 6/6/06, Hiram Chirino <hi...@hiramchirino.com> wrote:
>> m2 poms are included in the patch.  But for some reason the current m2
>> build does not seem to let you run mvn from a submodule, some
>> dependency variables do not get evaluated.  weird.
>>
>> On 6/5/06, David Jencks <da...@yahoo.com> wrote:
>> >
>> > On Jun 5, 2006, at 4:19 PM, Hiram Chirino wrote:
>> >
>> > > Howdy folks,
>> > >
>> > > Here's  a patch that brings in the activemq gbean modules into
>> > > geronimo.  It's partly what was in activemq 4.x and integrated into
>> > > geronimo 1.2-dead merged with the changes in the 3.x branch.
>> > >
>> > > It compiles at least and looks like a reasonable start.  Once further
>> > > integration work gets done we may need to tweak a little more.  
>> here's
>> > > my +1 got get this committed.  I guess I just need 3 more.
>> > >
>> >
>> > I'd find it a lot easier to review, apply, and test this patch if you
>> > attached it to  a jira entry.
>> >
>> > Is there any chance of you coming up with a pom.xml for the m2 build?
>> >
>> > thanks
>> > david jencks
>> >
>> >
>>
>>
>> -- 
>> Regards,
>> Hiram
>>
> 
> 

Re: [RTC] ActiveMQ GBean modules

Posted by James Strachan <ja...@gmail.com>.
+1, looks fine to me. The sooner Geronimo moves to Apache ActiveMQ the
better IMHO


On 6/8/06, Hiram Chirino <hi...@hiramchirino.com> wrote:
> So in terms the of the RTC process, is this RTC patch dead since it
> did not get the 3 +1's
>
> I kinda would have preferred to get some -1's instead of not getting
> any comments on the patch.  Is it that there are not enough folks that
> are interested in the activemq integration aspects of geronimo?
>
> Regards,
> Hiram
>
> On 6/6/06, Hiram Chirino <hi...@hiramchirino.com> wrote:
> > m2 poms are included in the patch.  But for some reason the current m2
> > build does not seem to let you run mvn from a submodule, some
> > dependency variables do not get evaluated.  weird.
> >
> > On 6/5/06, David Jencks <da...@yahoo.com> wrote:
> > >
> > > On Jun 5, 2006, at 4:19 PM, Hiram Chirino wrote:
> > >
> > > > Howdy folks,
> > > >
> > > > Here's  a patch that brings in the activemq gbean modules into
> > > > geronimo.  It's partly what was in activemq 4.x and integrated into
> > > > geronimo 1.2-dead merged with the changes in the 3.x branch.
> > > >
> > > > It compiles at least and looks like a reasonable start.  Once further
> > > > integration work gets done we may need to tweak a little more.  here's
> > > > my +1 got get this committed.  I guess I just need 3 more.
> > > >
> > >
> > > I'd find it a lot easier to review, apply, and test this patch if you
> > > attached it to  a jira entry.
> > >
> > > Is there any chance of you coming up with a pom.xml for the m2 build?
> > >
> > > thanks
> > > david jencks
> > >
> > >
> >
> >
> > --
> > Regards,
> > Hiram
> >
>
>
> --
> Regards,
> Hiram
>


-- 

James
-------
http://radio.weblogs.com/0112098/

Re: [RTC] ActiveMQ GBean modules

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
The spirit of the patch is great.  I haven't had the time to review it
in detail.  So I think that's a +0?

Thanks,
     Aaron

On 6/8/06, Hiram Chirino <hi...@hiramchirino.com> wrote:
> So in terms the of the RTC process, is this RTC patch dead since it
> did not get the 3 +1's
>
> I kinda would have preferred to get some -1's instead of not getting
> any comments on the patch.  Is it that there are not enough folks that
> are interested in the activemq integration aspects of geronimo?
>
> Regards,
> Hiram
>
> On 6/6/06, Hiram Chirino <hi...@hiramchirino.com> wrote:
> > m2 poms are included in the patch.  But for some reason the current m2
> > build does not seem to let you run mvn from a submodule, some
> > dependency variables do not get evaluated.  weird.
> >
> > On 6/5/06, David Jencks <da...@yahoo.com> wrote:
> > >
> > > On Jun 5, 2006, at 4:19 PM, Hiram Chirino wrote:
> > >
> > > > Howdy folks,
> > > >
> > > > Here's  a patch that brings in the activemq gbean modules into
> > > > geronimo.  It's partly what was in activemq 4.x and integrated into
> > > > geronimo 1.2-dead merged with the changes in the 3.x branch.
> > > >
> > > > It compiles at least and looks like a reasonable start.  Once further
> > > > integration work gets done we may need to tweak a little more.  here's
> > > > my +1 got get this committed.  I guess I just need 3 more.
> > > >
> > >
> > > I'd find it a lot easier to review, apply, and test this patch if you
> > > attached it to  a jira entry.
> > >
> > > Is there any chance of you coming up with a pom.xml for the m2 build?
> > >
> > > thanks
> > > david jencks
> > >
> > >
> >
> >
> > --
> > Regards,
> > Hiram
> >
>
>
> --
> Regards,
> Hiram
>

Re: [RTC] ActiveMQ GBean modules

Posted by Hiram Chirino <hi...@hiramchirino.com>.
So in terms the of the RTC process, is this RTC patch dead since it
did not get the 3 +1's

I kinda would have preferred to get some -1's instead of not getting
any comments on the patch.  Is it that there are not enough folks that
are interested in the activemq integration aspects of geronimo?

Regards,
Hiram

On 6/6/06, Hiram Chirino <hi...@hiramchirino.com> wrote:
> m2 poms are included in the patch.  But for some reason the current m2
> build does not seem to let you run mvn from a submodule, some
> dependency variables do not get evaluated.  weird.
>
> On 6/5/06, David Jencks <da...@yahoo.com> wrote:
> >
> > On Jun 5, 2006, at 4:19 PM, Hiram Chirino wrote:
> >
> > > Howdy folks,
> > >
> > > Here's  a patch that brings in the activemq gbean modules into
> > > geronimo.  It's partly what was in activemq 4.x and integrated into
> > > geronimo 1.2-dead merged with the changes in the 3.x branch.
> > >
> > > It compiles at least and looks like a reasonable start.  Once further
> > > integration work gets done we may need to tweak a little more.  here's
> > > my +1 got get this committed.  I guess I just need 3 more.
> > >
> >
> > I'd find it a lot easier to review, apply, and test this patch if you
> > attached it to  a jira entry.
> >
> > Is there any chance of you coming up with a pom.xml for the m2 build?
> >
> > thanks
> > david jencks
> >
> >
>
>
> --
> Regards,
> Hiram
>


-- 
Regards,
Hiram

Re: [RTC] ActiveMQ GBean modules

Posted by Hiram Chirino <hi...@hiramchirino.com>.
m2 poms are included in the patch.  But for some reason the current m2
build does not seem to let you run mvn from a submodule, some
dependency variables do not get evaluated.  weird.

On 6/5/06, David Jencks <da...@yahoo.com> wrote:
>
> On Jun 5, 2006, at 4:19 PM, Hiram Chirino wrote:
>
> > Howdy folks,
> >
> > Here's  a patch that brings in the activemq gbean modules into
> > geronimo.  It's partly what was in activemq 4.x and integrated into
> > geronimo 1.2-dead merged with the changes in the 3.x branch.
> >
> > It compiles at least and looks like a reasonable start.  Once further
> > integration work gets done we may need to tweak a little more.  here's
> > my +1 got get this committed.  I guess I just need 3 more.
> >
>
> I'd find it a lot easier to review, apply, and test this patch if you
> attached it to  a jira entry.
>
> Is there any chance of you coming up with a pom.xml for the m2 build?
>
> thanks
> david jencks
>
>


-- 
Regards,
Hiram

Re: [RTC] ActiveMQ GBean modules

Posted by David Jencks <da...@yahoo.com>.
On Jun 5, 2006, at 4:19 PM, Hiram Chirino wrote:

> Howdy folks,
>
> Here's  a patch that brings in the activemq gbean modules into
> geronimo.  It's partly what was in activemq 4.x and integrated into
> geronimo 1.2-dead merged with the changes in the 3.x branch.
>
> It compiles at least and looks like a reasonable start.  Once further
> integration work gets done we may need to tweak a little more.  here's
> my +1 got get this committed.  I guess I just need 3 more.
>

I'd find it a lot easier to review, apply, and test this patch if you  
attached it to  a jira entry.

Is there any chance of you coming up with a pom.xml for the m2 build?

thanks
david jencks


Re: [RTC] ActiveMQ GBean modules

Posted by Hiram Chirino <hi...@hiramchirino.com>.
Ok.

That looks like 3 +1s now.  Committing patch shortly.  Thanks everybody!

On 6/17/06, Aaron Mulder <am...@alumni.princeton.edu> wrote:
> To clarify, I think David's comments are important, but I think the
> patch should go in and then be adjusted further.  I'd rather see
> iterative development in 1.2 and more effort to make the patch right
> the first time in 1.1.1.  There's no reason we couldn't open David's
> comments in a Jira when this patch is committed just to make sure we
> don't forget.
>
> We should also talk about whether to maintain this code in AMQ or
> Geronimo, but in parallel with any actual work on the code.
>
> Thanks,
>     Aaron
>
> On 6/17/06, Aaron Mulder <am...@alumni.princeton.edu> wrote:
> > +1 to your comment, +1 to the patch.  Let's get it in!  :)
> >
> > Thanks,
> >     Aaron
> >
> > On 6/17/06, Hiram Chirino <hi...@hiramchirino.com> wrote:
> > > HI,
> > >
> > > On 6/14/06, Aaron Mulder <am...@alumni.princeton.edu> wrote:
> > > > +1
> > > >
> > >
> > > Is this a vote for the patch or whas that a +1 on my last comment?
> > >
> > > Anyways.. I want to recap where the vote on this RTC is at.  After 12
> > > days, we have:
> > >
> > > +1 "from me, but I'm not sure it should get counted since I didn't
> > > apply the patch." - Dain
> > > +1, "looks fine to me." - James
> > > +0 "The spirit of the patch is great.  I haven't had the time to
> > > review it in detail." - Aaron
> > >
> > > And possibly a +1 from Aaron but I'm not sure what you were doing a +1 to.
> > >
> > > I don't understand how we can let such a small and simple gbean
> > > implementation sit so long.  I understand Geronimo is a big best and
> > > not everyone can be looking at everything all the time.  But if we
> > > don't make efforts to get the simple stuff done, we will never get
> > > past 1.1.
> > >
> > > --
> > > Regards,
> > > Hiram
> > >
> > > Blog: http://hiramchirino.com
> > >
> >
>


-- 
Regards,
Hiram

Blog: http://hiramchirino.com

Re: [RTC] ActiveMQ GBean modules

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
To clarify, I think David's comments are important, but I think the
patch should go in and then be adjusted further.  I'd rather see
iterative development in 1.2 and more effort to make the patch right
the first time in 1.1.1.  There's no reason we couldn't open David's
comments in a Jira when this patch is committed just to make sure we
don't forget.

We should also talk about whether to maintain this code in AMQ or
Geronimo, but in parallel with any actual work on the code.

Thanks,
    Aaron

On 6/17/06, Aaron Mulder <am...@alumni.princeton.edu> wrote:
> +1 to your comment, +1 to the patch.  Let's get it in!  :)
>
> Thanks,
>     Aaron
>
> On 6/17/06, Hiram Chirino <hi...@hiramchirino.com> wrote:
> > HI,
> >
> > On 6/14/06, Aaron Mulder <am...@alumni.princeton.edu> wrote:
> > > +1
> > >
> >
> > Is this a vote for the patch or whas that a +1 on my last comment?
> >
> > Anyways.. I want to recap where the vote on this RTC is at.  After 12
> > days, we have:
> >
> > +1 "from me, but I'm not sure it should get counted since I didn't
> > apply the patch." - Dain
> > +1, "looks fine to me." - James
> > +0 "The spirit of the patch is great.  I haven't had the time to
> > review it in detail." - Aaron
> >
> > And possibly a +1 from Aaron but I'm not sure what you were doing a +1 to.
> >
> > I don't understand how we can let such a small and simple gbean
> > implementation sit so long.  I understand Geronimo is a big best and
> > not everyone can be looking at everything all the time.  But if we
> > don't make efforts to get the simple stuff done, we will never get
> > past 1.1.
> >
> > --
> > Regards,
> > Hiram
> >
> > Blog: http://hiramchirino.com
> >
>

Re: [RTC] ActiveMQ GBean modules

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
+1 to your comment, +1 to the patch.  Let's get it in!  :)

Thanks,
    Aaron

On 6/17/06, Hiram Chirino <hi...@hiramchirino.com> wrote:
> HI,
>
> On 6/14/06, Aaron Mulder <am...@alumni.princeton.edu> wrote:
> > +1
> >
>
> Is this a vote for the patch or whas that a +1 on my last comment?
>
> Anyways.. I want to recap where the vote on this RTC is at.  After 12
> days, we have:
>
> +1 "from me, but I'm not sure it should get counted since I didn't
> apply the patch." - Dain
> +1, "looks fine to me." - James
> +0 "The spirit of the patch is great.  I haven't had the time to
> review it in detail." - Aaron
>
> And possibly a +1 from Aaron but I'm not sure what you were doing a +1 to.
>
> I don't understand how we can let such a small and simple gbean
> implementation sit so long.  I understand Geronimo is a big best and
> not everyone can be looking at everything all the time.  But if we
> don't make efforts to get the simple stuff done, we will never get
> past 1.1.
>
> --
> Regards,
> Hiram
>
> Blog: http://hiramchirino.com
>

Re: [RTC] ActiveMQ GBean modules

Posted by Hiram Chirino <hi...@hiramchirino.com>.
HI,

On 6/14/06, Aaron Mulder <am...@alumni.princeton.edu> wrote:
> +1
>

Is this a vote for the patch or whas that a +1 on my last comment?

Anyways.. I want to recap where the vote on this RTC is at.  After 12
days, we have:

+1 "from me, but I'm not sure it should get counted since I didn't
apply the patch." - Dain
+1, "looks fine to me." - James
+0 "The spirit of the patch is great.  I haven't had the time to
review it in detail." - Aaron

And possibly a +1 from Aaron but I'm not sure what you were doing a +1 to.

I don't understand how we can let such a small and simple gbean
implementation sit so long.  I understand Geronimo is a big best and
not everyone can be looking at everything all the time.  But if we
don't make efforts to get the simple stuff done, we will never get
past 1.1.

-- 
Regards,
Hiram

Blog: http://hiramchirino.com

Re: [RTC] ActiveMQ GBean modules

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
+1

On 6/14/06, Hiram Chirino <hi...@hiramchirino.com> wrote:
> Hi David,
>
> That's a great review and set of issue.  Once I commit the patch could
> you create JIRA for each of those?  lol, j/k.
>
> Perhaps I should start a new thread on this thought, but I just wanted
> to comment that we need to be careful about how critical and the level
> of perfection that we expect from the contributed patches.  I would
> say that if a patch does not regress the project and it moves it
> forward in the right direction, the patch should be accepted even if
> it's not perfect.
>
> It kind of reminds me of something David B told me once, if the code
> is perfect and stable, you won't be able to build a community around
> the project it since it just works.  This makes sense to me.  If the
> code is 80% of the way there, then you give an opportunity for folks
> to join your community by submitting additional patches that help it
> get to the 100% mark. In short, I guess I would prefer to see a steady
> stream of small patches that 1 large patch not so often.
>
> And so to tie it back to the original thread, I think that patch that
> I submitted is large enough to start with :)  Lets fix the rest of the
> issues incrementally.
>
> Regards,
> Hiram
>
> On 6/13/06, David Jencks <da...@yahoo.com> wrote:
> > I think that this gbean adaptation code should be in geronimo rather
> > than amq.  I'm OK with applying it as is but would prefer some issues
> > to be addressed first or, even better,  immediately after the
> > transfer (assuming it is done with svn mv).
> >
> > 1. DataSourceReference should be replaced by the geronimo class that
> > does the same thing, ConnectionFactorySource.
> >
> > 2. I think it would be preferable to get the module/configuration
> > classloader in the constructor as a magic attribute and use it in
> > BrokerServiceGBeanImpl.doStart rather than the classloader of
> > BrokerServiceGBeanImpl.
> >
> > 3. Same for TransportConnectorGBeanImpl.
> >
> > 4. This is a question, not really an issue, about this code:
> > +    protected TransportConnector createBrokerConnector(String url)
> > throws Exception {
> > +        return brokerService.getBrokerContainer().addConnector(url);
> > +    }
> >
> > To me it seems like this code is combining the functions of factory
> > object and container.  Is this necessary and appropriate?  I'd be
> > more comfortable with
> > Connector connector = ConnectorFactory.createConnector(url);
> > brokerService.getBrokerContainer().addConnector(connector);
> >
> > I find that the combination style typically creates problems whenever
> > trying to extend stuff, say by wrapping the connector.  What do you
> > think?
> >
> > 5. hardcoding the protocols in ActiveMQManagerGBean seems like a
> > temporary expedient at best.
> >
> > 6. javadoc on public JMSConnector addConnector( ... in the manager
> > gbean seems wrong... does not appear to return an object name.
> >
> > 7. Typo and innaccuracies in the first package.html... this stuff is
> > only going to work in geronimo, jsr77/88 is not enough.
> >
> > 8. I'm not sure exactly what our official policy is but I prefer to
> > remove "public" from methods in interfaces since it is the only
> > choice and implied.
> >
> > +1 if the above are addressed before or right after commit.  I only
> > insist on (1), the others are more like suggestions.
> >
> > thanks
> > david jencks
> >
> >
> >
> >
> >
> > On Jun 5, 2006, at 4:19 PM, Hiram Chirino wrote:
> >
> > > Howdy folks,
> > >
> > > Here's  a patch that brings in the activemq gbean modules into
> > > geronimo.  It's partly what was in activemq 4.x and integrated into
> > > geronimo 1.2-dead merged with the changes in the 3.x branch.
> > >
> > > It compiles at least and looks like a reasonable start.  Once further
> > > integration work gets done we may need to tweak a little more.  here's
> > > my +1 got get this committed.  I guess I just need 3 more.
> > >
> > >
> > > Index: modules/activemq-gbean/project.properties
> > > ===================================================================
> > > --- modules/activemq-gbean/project.properties (revision 0)
> > > +++ modules/activemq-gbean/project.properties (revision 0)
> > > @@ -0,0 +1,3 @@
> > > +# -------------------------------------------------------------------
> > > +# Build Properties
> > > +# -------------------------------------------------------------------
> > >
> > > Property changes on: modules/activemq-gbean/project.properties
> > > ___________________________________________________________________
> > > Name: svn:executable
> > >   + *
> > >
> > > Index: modules/activemq-gbean/project.xml
> > > ===================================================================
> > > --- modules/activemq-gbean/project.xml        (revision 0)
> > > +++ modules/activemq-gbean/project.xml        (revision 0)
> > > @@ -0,0 +1,104 @@
> > > +<?xml version="1.0" encoding="ISO-8859-1"?>
> > > +<!--
> > > +
> > > +    Copyright 2004 The Apache Software Foundation
> > > +
> > > +    Licensed 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.
> > > +-->
> > > +<!-- $Rev: 356052 $ $Date: 2005-12-11 16:41:20 -0600 (Sun, 11 Dec
> > > 2005) $ -->
> > > +<!DOCTYPE project>
> > > +<project>
> > > +    <pomVersion>3</pomVersion>
> > > +    <extend>../../etc/project.xml</extend>
> > > +
> > > +    <name>Geronimo :: ActiveMQ :: GBeans</name>
> > > +    <id>geronimo-activemq-gbean</id>
> > > +    <shortDescription>ActiveMQ Geronimo / GBean support</
> > > shortDescription>
> > > +    <description>ActiveMQ GBeans used for integration into Apache
> > > Geronimo</description>
> > > +
> > > +    <!-- ============ -->
> > > +    <!-- Dependencies -->
> > > +    <!-- ============ -->
> > > +    <dependencies>
> > > +
> > > +      <dependency>
> > > +        <groupId>incubator-activemq</groupId>
> > > +        <artifactId>activemq-core</artifactId>
> > > +        <version>4.0-SNAPSHOT</version>
> > > +      </dependency>
> > > +
> > > +      <dependency>
> > > +        <groupId>incubator-activemq</groupId>
> > > +        <artifactId>activeio-core</artifactId>
> > > +        <version>3.0-SNAPSHOT</version>
> > > +      </dependency>
> > > +
> > > +      <dependency>
> > > +        <groupId>geronimo</groupId>
> > > +        <artifactId>geronimo-activemq-gbean-management</artifactId>
> > > +        <version>${pom.currentVersion}</version>
> > > +      </dependency>
> > > +
> > > +      <dependency>
> > > +        <groupId>geronimo</groupId>
> > > +        <artifactId>geronimo-kernel</artifactId>
> > > +        <version>${pom.currentVersion}</version>
> > > +      </dependency>
> > > +
> > > +      <dependency>
> > > +        <groupId>geronimo</groupId>
> > > +        <artifactId>geronimo-system</artifactId>
> > > +        <version>${pom.currentVersion}</version>
> > > +      </dependency>
> > > +
> > > +      <dependency>
> > > +        <groupId>geronimo</groupId>
> > > +        <artifactId>geronimo-management</artifactId>
> > > +        <version>${pom.currentVersion}</version>
> > > +      </dependency>
> > > +
> > > +      <dependency>
> > > +        <groupId>geronimo</groupId>
> > > +        <artifactId>geronimo-j2ee</artifactId>
> > > +        <version>${pom.currentVersion}</version>
> > > +      </dependency>
> > > +
> > > +      <dependency>
> > > +        <groupId>mx4j</groupId>
> > > +        <artifactId>mx4j</artifactId>
> > > +        <version>${mx4j_version}</version>
> > > +      </dependency>
> > > +
> > > +      <dependency>
> > > +        <groupId>commons-logging</groupId>
> > > +        <artifactId>commons-logging</artifactId>
> > > +        <version>${commons_logging_version}</version>
> > > +        <url>http://jakarta.apache.org/commons/logging/</url>
> > > +      </dependency>
> > > +
> > > +
> > > +    </dependencies>
> > > +
> > > +    <!-- this module is using m2 directory layout -->
> > > +    <build>
> > > +        <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
> > > +        <unitTestSourceDirectory>${basedir}/src/main/test</
> > > unitTestSourceDirectory>
> > > +
> > > +        <unitTest>
> > > +            <includes>
> > > +                <include>**/*Test.java</include>
> > > +            </includes>
> > > +        </unitTest>
> > > +    </build>
> > > +
> > > +</project>
> > >
> > > Property changes on: modules/activemq-gbean/project.xml
> > > ___________________________________________________________________
> > > Name: svn:executable
> > >   + *
> > >
> > > Index: modules/activemq-gbean/src/test/java/org/apache/activemq/
> > > gbean/ConnectorTest.java
> > > ===================================================================
> > > --- modules/activemq-gbean/src/test/java/org/apache/activemq/gbean/
> > > ConnectorTest.java    (revision
> > > 0)
> > > +++ modules/activemq-gbean/src/test/java/org/apache/activemq/gbean/
> > > ConnectorTest.java    (revision
> > > 0)
> > > @@ -0,0 +1,61 @@
> > > +/**
> > > + *
> > > + * Copyright 2005-2006 The Apache Software Foundation
> > > + *
> > > + *  Licensed 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.gbean;
> > > +
> > > +import org.apache.activemq.gbean.TransportConnectorGBeanImpl;
> > > +
> > > +import junit.framework.TestCase;
> > > +
> > > +/**
> > > + * Tests to ensure that URL parsing and updating doesn't blow up
> > > + *
> > > + * @version $Revision: 1.0$
> > > + */
> > > +public class ConnectorTest extends TestCase {
> > > +    public TransportConnectorGBeanImpl test;
> > > +
> > > +    protected void setUp() throws Exception {
> > > +    }
> > > +
> > > +    public void testURLManipulation() {
> > > +        test = new TransportConnectorGBeanImpl(null, "foo",
> > > "localhost", 1234);
> > > +        assertEquals("foo://localhost:1234", test.getUrl());
> > > +        assertEquals("foo", test.getProtocol());
> > > +        assertEquals("localhost", test.getHost());
> > > +        assertEquals(1234, test.getPort());
> > > +        test.setHost("0.0.0.0");
> > > +        assertEquals("foo://0.0.0.0:1234", test.getUrl());
> > > +        assertEquals("foo", test.getProtocol());
> > > +        assertEquals("0.0.0.0", test.getHost());
> > > +        assertEquals(1234, test.getPort());
> > > +        test.setPort(8765);
> > > +        assertEquals("foo://0.0.0.0:8765", test.getUrl());
> > > +        assertEquals("foo", test.getProtocol());
> > > +        assertEquals("0.0.0.0", test.getHost());
> > > +        assertEquals(8765, test.getPort());
> > > +        test.setProtocol("bar");
> > > +        assertEquals("bar://0.0.0.0:8765", test.getUrl());
> > > +        assertEquals("bar", test.getProtocol());
> > > +        assertEquals("0.0.0.0", test.getHost());
> > > +        assertEquals(8765, test.getPort());
> > > +        test = new TransportConnectorGBeanImpl(null, "vm",
> > > "localhost", -1);
> > > +        assertEquals("vm://localhost", test.getUrl());
> > > +        assertEquals("vm", test.getProtocol());
> > > +        assertEquals("localhost", test.getHost());
> > > +        assertEquals(-1, test.getPort());
> > > +    }
> > > +}
> > > Index: modules/activemq-gbean/src/main/java/org/apache/activemq/
> > > gbean/BrokerServiceGBean.java
> > > ===================================================================
> > > --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > > BrokerServiceGBean.java       (revision
> > > 0)
> > > +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > > BrokerServiceGBean.java       (revision
> > > 0)
> > > @@ -0,0 +1,34 @@
> > > +/**
> > > + *
> > > + * Copyright 2005-2006 The Apache Software Foundation
> > > + *
> > > + *  Licensed 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.gbean;
> > > +
> > > +import org.apache.activemq.broker.BrokerService;
> > > +import org.apache.activemq.gbean.ActiveMQBroker;
> > > +
> > > +/**
> > > + * An interface to the ActiveMQContainerGBean for use by the
> > > + * ActiveMQConnectorGBean.
> > > + *
> > > + * @version $Revision: 1.1.1.1 $
> > > + */
> > > +public interface BrokerServiceGBean extends ActiveMQBroker {
> > > +
> > > +     public abstract BrokerService getBrokerContainer();
> > > +     public String getBrokerName();
> > > +
> > > +
> > > +}
> > > \ No newline at end of file
> > >
> > > Property changes on:
> > > modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > > BrokerServiceGBean.java
> > > ___________________________________________________________________
> > > Name: svn:executable
> > >   + *
> > >
> > > Index: modules/activemq-gbean/src/main/java/org/apache/activemq/
> > > gbean/BrokerServiceGBeanImpl.java
> > > ===================================================================
> > > --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > > BrokerServiceGBeanImpl.java   (revision
> > > 0)
> > > +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > > BrokerServiceGBeanImpl.java   (revision
> > > 0)
> > > @@ -0,0 +1,209 @@
> > > +/**
> > > + *
> > > + * Copyright 2005-2006 The Apache Software Foundation
> > > + *
> > > + *  Licensed 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.gbean;
> > > +
> > > +import java.net.URI;
> > > +
> > > +import javax.sql.DataSource;
> > > +
> > > +import org.apache.activemq.broker.BrokerFactory;
> > > +import org.apache.activemq.broker.BrokerService;
> > > +import org.apache.activemq.store.DefaultPersistenceAdapterFactory;
> > > +import org.apache.commons.logging.Log;
> > > +import org.apache.commons.logging.LogFactory;
> > > +import org.apache.geronimo.gbean.GBeanInfo;
> > > +import org.apache.geronimo.gbean.GBeanInfoBuilder;
> > > +import org.apache.geronimo.gbean.GBeanLifecycle;
> > > +import org.apache.geronimo.management.geronimo.JMSManager;
> > > +import org.apache.geronimo.management.geronimo.NetworkConnector;
> > > +import org.apache.geronimo.system.serverinfo.ServerInfo;
> > > +
> > > +
> > > +/**
> > > + * Default implementation of the ActiveMQ Message Server
> > > + *
> > > + * @version $Revision: 1.1.1.1 $
> > > + */
> > > +public class BrokerServiceGBeanImpl implements GBeanLifecycle,
> > > BrokerServiceGBean {
> > > +
> > > +    private Log log = LogFactory.getLog(getClass().getName());
> > > +
> > > +    private String brokerName;
> > > +    private String brokerUri;
> > > +    private BrokerService brokerService;
> > > +    private ServerInfo serverInfo;
> > > +    private String dataDirectory;
> > > +    private DataSourceReference dataSource;
> > > +
> > > +    private String objectName;
> > > +    private JMSManager manager;
> > > +
> > > +    public BrokerServiceGBeanImpl() {
> > > +    }
> > > +
> > > +    public synchronized BrokerService getBrokerContainer() {
> > > +        return brokerService;
> > > +    }
> > > +
> > > +    public synchronized void doStart() throws Exception {
> > > +             ClassLoader old = Thread.currentThread
> > > ().getContextClassLoader();
> > > +             Thread.currentThread().setContextClassLoader
> > > (BrokerServiceGBeanImpl.class.getClassLoader());
> > > +             try {
> > > +             if (brokerService == null) {
> > > +                 brokerService = createContainer();
> > > +             }
> > > +                DefaultPersistenceAdapterFactory persistenceFactory =
> > > (DefaultPersistenceAdapterFactory)
> > > brokerService.getPersistenceFactory();
> > > +
> > > persistenceFactory.setDataDirectory(serverInfo.resolve
> > > (dataDirectory));
> > > +                persistenceFactory.setDataSource((DataSource)
> > > dataSource.$getResource());
> > > +                brokerService.start();
> > > +             } finally {
> > > +             Thread.currentThread().setContextClassLoader(old);
> > > +             }
> > > +    }
> > > +
> > > +    protected BrokerService createContainer() throws Exception {
> > > +        if( brokerUri!=null ) {
> > > +            BrokerService answer = BrokerFactory.createBroker(new
> > > URI(brokerUri));
> > > +            brokerName = answer.getBrokerName();
> > > +            return answer;
> > > +        } else {
> > > +            BrokerService answer = new BrokerService();
> > > +            answer.setBrokerName(brokerName);
> > > +            return answer;
> > > +        }
> > > +    }
> > > +
> > > +    public synchronized void doStop() throws Exception {
> > > +        if (brokerService != null) {
> > > +            BrokerService temp = brokerService;
> > > +            brokerService = null;
> > > +            temp.stop();
> > > +        }
> > > +    }
> > > +
> > > +    public synchronized void doFail() {
> > > +        if (brokerService != null) {
> > > +            BrokerService temp = brokerService;
> > > +            brokerService = null;
> > > +            try {
> > > +                temp.stop();
> > > +            } catch (Exception e) {
> > > +                log.info("Caught while closing due to failure: " +
> > > e, e);
> > > +            }
> > > +        }
> > > +    }
> > > +
> > > +    public static final GBeanInfo GBEAN_INFO;
> > > +
> > > +    static {
> > > +        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("ActiveMQ
> > > Message Broker", BrokerServiceGBeanImpl.class, "JMSServer");
> > > +        infoFactory.addReference("serverInfo", ServerInfo.class);
> > > +        infoFactory.addAttribute("brokerName", String.class, true);
> > > +        infoFactory.addAttribute("brokerUri", String.class, true);
> > > +        infoFactory.addAttribute("dataDirectory", String.class,
> > > true);
> > > +        infoFactory.addReference("dataSource",
> > > DataSourceReference.class);
> > > +        infoFactory.addAttribute("objectName", String.class, false);
> > > +        infoFactory.addReference("manager", JMSManager.class);
> > > +        infoFactory.addInterface(BrokerServiceGBean.class);
> > > +        // infoFactory.setConstructor(new String[]{"brokerName,
> > > brokerUri"});
> > > +        GBEAN_INFO = infoFactory.getBeanInfo();
> > > +    }
> > > +
> > > +    public static GBeanInfo getGBeanInfo() {
> > > +        return GBEAN_INFO;
> > > +    }
> > > +
> > > +     /**
> > > +      * @return Returns the brokerName.
> > > +      */
> > > +     public String getBrokerName() {
> > > +             return brokerName;
> > > +     }
> > > +
> > > +    public String getBrokerUri() {
> > > +        return brokerUri;
> > > +    }
> > > +
> > > +    public void setBrokerName(String brokerName) {
> > > +        this.brokerName = brokerName;
> > > +    }
> > > +
> > > +    public void setBrokerUri(String brokerUri) {
> > > +        this.brokerUri = brokerUri;
> > > +    }
> > > +
> > > +    public ServerInfo getServerInfo() {
> > > +        return serverInfo;
> > > +    }
> > > +
> > > +    public void setServerInfo(ServerInfo serverInfo) {
> > > +        this.serverInfo = serverInfo;
> > > +    }
> > > +
> > > +    public String getDataDirectory() {
> > > +        return dataDirectory;
> > > +    }
> > > +
> > > +    public void setDataDirectory(String dataDir) {
> > > +        this.dataDirectory = dataDir;
> > > +    }
> > > +
> > > +    public DataSourceReference getDataSource() {
> > > +        return dataSource;
> > > +    }
> > > +
> > > +    public void setDataSource(DataSourceReference dataSource) {
> > > +        this.dataSource = dataSource;
> > > +    }
> > > +
> > > +    public String getObjectName() {
> > > +        return objectName;
> > > +    }
> > > +
> > > +    public boolean isStateManageable() {
> > > +        return true;
> > > +    }
> > > +
> > > +    public boolean isStatisticsProvider() {
> > > +        return false; // todo: return true once stats are integrated
> > > +    }
> > > +
> > > +    public boolean isEventProvider() {
> > > +        return true;
> > > +    }
> > > +
> > > +    public NetworkConnector[] getConnectors() {
> > > +        return manager.getConnectorsForContainer(this);
> > > +    }
> > > +
> > > +    public NetworkConnector[] getConnectors(String protocol) {
> > > +        return manager.getConnectorsForContainer(this, protocol);
> > > +    }
> > > +
> > > +    public JMSManager getManager() {
> > > +        return manager;
> > > +    }
> > > +
> > > +    public void setManager(JMSManager manager) {
> > > +        this.manager = manager;
> > > +    }
> > > +
> > > +    public void setObjectName(String objectName) {
> > > +        this.objectName = objectName;
> > > +    }
> > > +
> > > +}
> > > \ No newline at end of file
> > >
> > > Property changes on:
> > > modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > > BrokerServiceGBeanImpl.java
> > > ___________________________________________________________________
> > > Name: svn:executable
> > >   + *
> > >
> > > Index: modules/activemq-gbean/src/main/java/org/apache/activemq/
> > > gbean/TransportConnectorGBeanImpl.java
> > > ===================================================================
> > > --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > > TransportConnectorGBeanImpl.java      (revision
> > > 0)
> > > +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > > TransportConnectorGBeanImpl.java      (revision
> > > 0)
> > > @@ -0,0 +1,168 @@
> > > +/**
> > > + *
> > > + * Copyright 2005-2006 The Apache Software Foundation
> > > + *
> > > + *  Licensed 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.gbean;
> > > +
> > > +import java.net.InetSocketAddress;
> > > +import java.net.URI;
> > > +import java.net.URISyntaxException;
> > > +
> > > +import org.apache.activemq.broker.TransportConnector;
> > > +import org.apache.activemq.gbean.ActiveMQConnector;
> > > +import org.apache.commons.logging.Log;
> > > +import org.apache.commons.logging.LogFactory;
> > > +import org.apache.geronimo.gbean.GBeanInfo;
> > > +import org.apache.geronimo.gbean.GBeanInfoBuilder;
> > > +import org.apache.geronimo.gbean.GBeanLifecycle;
> > > +import org.apache.geronimo.gbean.GConstructorInfo;
> > > +
> > > +/**
> > > + * Default implementation of the ActiveMQ connector
> > > + *
> > > + * @version $Revision: 1.1.1.1 $
> > > + */
> > > +public class TransportConnectorGBeanImpl implements GBeanLifecycle,
> > > ActiveMQConnector {
> > > +    private Log log = LogFactory.getLog(getClass().getName());
> > > +
> > > +    private TransportConnector transportConnector;
> > > +    private BrokerServiceGBean brokerService;
> > > +
> > > +    private String protocol;
> > > +    private String host;
> > > +    private int port;
> > > +    private String path;
> > > +    private String query;
> > > +    private String urlAsStarted;
> > > +
> > > +    public TransportConnectorGBeanImpl(BrokerServiceGBean
> > > brokerService, String protocol, String host, int port) {
> > > +        this.brokerService = brokerService;
> > > +        this.protocol = protocol;
> > > +        this.host = host;
> > > +        this.port = port;
> > > +    }
> > > +
> > > +    public String getProtocol() {
> > > +        return protocol;
> > > +    }
> > > +
> > > +    public void setProtocol(String protocol) {
> > > +        this.protocol = protocol;
> > > +    }
> > > +
> > > +    public String getHost() {
> > > +        return host;
> > > +    }
> > > +
> > > +    public void setHost(String host) {
> > > +        this.host = host;
> > > +    }
> > > +
> > > +    public int getPort() {
> > > +        return port;
> > > +    }
> > > +
> > > +    public void setPort(int port) {
> > > +        this.port = port;
> > > +    }
> > > +
> > > +    public String getPath() {
> > > +        return path;
> > > +    }
> > > +
> > > +    public void setPath(String path) {
> > > +        this.path = path;
> > > +    }
> > > +
> > > +    public String getQuery() {
> > > +        return query;
> > > +    }
> > > +
> > > +    public void setQuery(String query) {
> > > +        this.query = query;
> > > +    }
> > > +
> > > +    public String getUrl() {
> > > +        try {
> > > +            return new URI(protocol, null, host, port, path, query,
> > > null).toString();
> > > +        } catch (URISyntaxException e) {
> > > +            throw new IllegalStateException("Attributes don't form a
> > > valid URI: "+protocol+"://"+host+":"+port+"/"+path+"?"+query);
> > > +        }
> > > +    }
> > > +
> > > +    public InetSocketAddress getListenAddress() {
> > > +        try {
> > > +            return transportConnector.getServer().getSocketAddress();
> > > +        } catch (Throwable e) {
> > > +            log.debug("Failure to determine ListenAddress: "+e,e);
> > > +            return null;
> > > +        }
> > > +    }
> > > +
> > > +    public synchronized void doStart() throws Exception {
> > > +     ClassLoader old = Thread.currentThread().getContextClassLoader
> > > ();
> > > +     Thread.currentThread().setContextClassLoader
> > > (BrokerServiceGBeanImpl.class.getClassLoader());
> > > +     try {
> > > +             if (transportConnector == null) {
> > > +                urlAsStarted = getUrl();
> > > +                 transportConnector = createBrokerConnector
> > > (urlAsStarted);
> > > +                 transportConnector.start();
> > > +             }
> > > +     } finally {
> > > +             Thread.currentThread().setContextClassLoader(old);
> > > +     }
> > > +    }
> > > +
> > > +    public synchronized void doStop() throws Exception {
> > > +        if (transportConnector != null) {
> > > +            TransportConnector temp = transportConnector;
> > > +            transportConnector = null;
> > > +            temp.stop();
> > > +        }
> > > +    }
> > > +
> > > +    public synchronized void doFail() {
> > > +        if (transportConnector != null) {
> > > +            TransportConnector temp = transportConnector;
> > > +            transportConnector = null;
> > > +            try {
> > > +                temp.stop();
> > > +            }
> > > +            catch (Exception e) {
> > > +                log.info("Caught while closing due to failure: " +
> > > e, e);
> > > +            }
> > > +        }
> > > +    }
> > > +
> > > +    protected TransportConnector createBrokerConnector(String url)
> > > throws Exception {
> > > +        return brokerService.getBrokerContainer().addConnector(url);
> > > +    }
> > > +
> > > +    public static final GBeanInfo GBEAN_INFO;
> > > +
> > > +    static {
> > > +        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("ActiveMQ
> > > Transport Connector", TransportConnectorGBeanImpl.class,
> > > CONNECTOR_J2EE_TYPE);
> > > +        infoFactory.addAttribute("url", String.class.getName(),
> > > false);
> > > +        infoFactory.addReference("brokerService",
> > > BrokerServiceGBean.class);
> > > +        infoFactory.addInterface(ActiveMQConnector.class, new
> > > String[]{"host","port","protocol","path","query"},
> > > +                new String[]{"host","port"});
> > > +        infoFactory.setConstructor(new GConstructorInfo(new
> > > String[]{"brokerService", "protocol", "host", "port"}));
> > > +        GBEAN_INFO = infoFactory.getBeanInfo();
> > > +    }
> > > +
> > > +    public static GBeanInfo getGBeanInfo() {
> > > +        return GBEAN_INFO;
> > > +    }
> > > +}
> > >
> > > Property changes on:
> > > modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > > TransportConnectorGBeanImpl.java
> > > ___________________________________________________________________
> > > Name: svn:executable
> > >   + *
> > >
> > > Index: modules/activemq-gbean/src/main/java/org/apache/activemq/
> > > gbean/DataSourceReference.java
> > > ===================================================================
> > > --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > > DataSourceReference.java      (revision
> > > 0)
> > > +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > > DataSourceReference.java      (revision
> > > 0)
> > > @@ -0,0 +1,21 @@
> > > +/**
> > > + *
> > > + * Copyright 2005-2006 The Apache Software Foundation
> > > + *
> > > + *  Licensed 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.gbean;
> > > +
> > > +public interface DataSourceReference {
> > > +    public Object $getResource();
> > > +}
> > > Index: modules/activemq-gbean/src/main/java/org/apache/activemq/
> > > gbean/management/ActiveMQManagerGBean.java
> > > ===================================================================
> > > --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > > management/ActiveMQManagerGBean.java  (revision
> > > 0)
> > > +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > > management/ActiveMQManagerGBean.java  (revision
> > > 0)
> > > @@ -0,0 +1,266 @@
> > > +/**
> > > + *
> > > + * Copyright 2005-2006 The Apache Software Foundation
> > > + *
> > > + *  Licensed 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.gbean.management;
> > > +
> > > +import java.util.ArrayList;
> > > +import java.util.Iterator;
> > > +import java.util.List;
> > > +import java.util.Set;
> > > +
> > > +import org.apache.activemq.gbean.ActiveMQBroker;
> > > +import org.apache.activemq.gbean.ActiveMQConnector;
> > > +import org.apache.activemq.gbean.ActiveMQManager;
> > > +import org.apache.activemq.gbean.TransportConnectorGBeanImpl;
> > > +import org.apache.commons.logging.Log;
> > > +import org.apache.commons.logging.LogFactory;
> > > +import org.apache.geronimo.gbean.AbstractName;
> > > +import org.apache.geronimo.gbean.AbstractNameQuery;
> > > +import org.apache.geronimo.gbean.GBeanData;
> > > +import org.apache.geronimo.gbean.GBeanInfo;
> > > +import org.apache.geronimo.gbean.GBeanInfoBuilder;
> > > +import org.apache.geronimo.gbean.ReferencePatterns;
> > > +import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
> > > +import org.apache.geronimo.kernel.GBeanNotFoundException;
> > > +import org.apache.geronimo.kernel.Kernel;
> > > +import org.apache.geronimo.kernel.config.ConfigurationUtil;
> > > +import
> > > org.apache.geronimo.kernel.config.EditableConfigurationManager;
> > > +import org.apache.geronimo.kernel.config.InvalidConfigException;
> > > +import org.apache.geronimo.kernel.proxy.ProxyManager;
> > > +import org.apache.geronimo.management.geronimo.JMSBroker;
> > > +import org.apache.geronimo.management.geronimo.JMSConnector;
> > > +import org.apache.geronimo.management.geronimo.NetworkConnector;
> > > +
> > > +/**
> > > + * Implementation of the ActiveMQ management interface.  These are
> > > the ActiveMQ
> > > + * management features available at runtime.
> > > + *
> > > + * @version $Revision: 1.0$
> > > + */
> > > +public class ActiveMQManagerGBean implements ActiveMQManager {
> > > +    private static final Log log =
> > > LogFactory.getLog(ActiveMQManagerGBean.class.getName());
> > > +    private Kernel kernel;
> > > +    private String objectName;
> > > +
> > > +    public ActiveMQManagerGBean(Kernel kernel, String objectName) {
> > > +        this.kernel = kernel;
> > > +        this.objectName = objectName;
> > > +    }
> > > +
> > > +    public String getProductName() {
> > > +        return "ActiveMQ";
> > > +    }
> > > +
> > > +    public String getObjectName() {
> > > +        return objectName;
> > > +    }
> > > +
> > > +    public boolean isEventProvider() {
> > > +        return false;
> > > +    }
> > > +
> > > +    public boolean isStateManageable() {
> > > +        return true;
> > > +    }
> > > +
> > > +    public boolean isStatisticsProvider() {
> > > +        return false;
> > > +    }
> > > +
> > > +    public Object[] getContainers() {
> > > +        ProxyManager proxyManager = kernel.getProxyManager();
> > > +        AbstractNameQuery query = new
> > > AbstractNameQuery(ActiveMQBroker.class.getName());
> > > +        Set names = kernel.listGBeans(query);
> > > +        ActiveMQBroker[] results = new ActiveMQBroker[names.size()];
> > > +        int i=0;
> > > +        for (Iterator it = names.iterator(); it.hasNext(); i++) {
> > > +            AbstractName name = (AbstractName) it.next();
> > > +            results[i] = (ActiveMQBroker)
> > > proxyManager.createProxy(name, ActiveMQBroker.class.getClassLoader());
> > > +        }
> > > +        return results;
> > > +    }
> > > +
> > > +    public String[] getSupportedProtocols() {
> > > +        // see files in
> > > modules/core/src/conf/META-INF/services/org/activemq/transport/server/
> > > +        return new String[]{ "tcp", "stomp", "vm", "peer", "udp",
> > > "multicast", "failover"};
> > > +    }
> > > +
> > > +    public NetworkConnector[] getConnectors() {
> > > +        ProxyManager proxyManager = kernel.getProxyManager();
> > > +        AbstractNameQuery query = new
> > > AbstractNameQuery(ActiveMQConnector.class.getName());
> > > +        Set names = kernel.listGBeans(query);
> > > +        ActiveMQConnector[] results = new ActiveMQConnector
> > > [names.size()];
> > > +        int i=0;
> > > +        for (Iterator it = names.iterator(); it.hasNext(); i++) {
> > > +            AbstractName name = (AbstractName) it.next();
> > > +            results[i] = (ActiveMQConnector)
> > > proxyManager.createProxy(name,
> > > ActiveMQConnector.class.getClassLoader());
> > > +        }
> > > +        return results;
> > > +    }
> > > +
> > > +    public NetworkConnector[] getConnectors(String protocol) {
> > > +        if(protocol == null) {
> > > +            return getConnectors();
> > > +        }
> > > +        List result = new ArrayList();
> > > +        ProxyManager proxyManager = kernel.getProxyManager();
> > > +        AbstractNameQuery query = new
> > > AbstractNameQuery(ActiveMQConnector.class.getName());
> > > +        Set names = kernel.listGBeans(query);
> > > +        for (Iterator it = names.iterator(); it.hasNext();) {
> > > +            AbstractName name = (AbstractName) it.next();
> > > +            try {
> > > +                if (kernel.getAttribute(name, "protocol").equals
> > > (protocol)) {
> > > +                    result.add(proxyManager.createProxy(name,
> > > ActiveMQConnector.class.getClassLoader()));
> > > +                }
> > > +            } catch (Exception e) {
> > > +                log.error("Unable to check the protocol for a
> > > connector", e);
> > > +            }
> > > +        }
> > > +        return (ActiveMQConnector[]) result.toArray(new
> > > ActiveMQConnector[names.size()]);
> > > +    }
> > > +
> > > +    public NetworkConnector[] getConnectorsForContainer(Object
> > > broker) {
> > > +        AbstractName containerName = kernel.getAbstractNameFor
> > > (broker);
> > > +        ProxyManager mgr = kernel.getProxyManager();
> > > +        try {
> > > +            List results = new ArrayList();
> > > +            AbstractNameQuery query = new
> > > AbstractNameQuery(ActiveMQConnector.class.getName());
> > > +            Set set = kernel.listGBeans(query); // all Jetty
> > > connectors
> > > +            for (Iterator it = set.iterator(); it.hasNext();) {
> > > +                AbstractName name = (AbstractName) it.next(); // a
> > > single Jetty connector
> > > +                GBeanData data = kernel.getGBeanData(name);
> > > +                ReferencePatterns refs =
> > > data.getReferencePatterns("activeMQContainer");
> > > +                if (containerName.equals(refs.getAbstractName())) {
> > > +                    results.add(mgr.createProxy(name,
> > > ActiveMQConnector.class.getClassLoader()));
> > > +                }
> > > +            }
> > > +            return (ActiveMQConnector[]) results.toArray(new
> > > ActiveMQConnector[results.size()]);
> > > +        } catch (Exception e) {
> > > +            throw (IllegalArgumentException) new
> > > IllegalArgumentException("Unable to look up connectors for ActiveMQ
> > > broker '"+containerName).initCause(e);
> > > +        }
> > > +    }
> > > +
> > > +    public NetworkConnector[] getConnectorsForContainer(Object
> > > broker, String protocol) {
> > > +        if(protocol == null) {
> > > +            return getConnectorsForContainer(broker);
> > > +        }
> > > +        AbstractName containerName = kernel.getAbstractNameFor
> > > (broker);
> > > +        ProxyManager mgr = kernel.getProxyManager();
> > > +        try {
> > > +            List results = new ArrayList();
> > > +            AbstractNameQuery query = new
> > > AbstractNameQuery(ActiveMQConnector.class.getName());
> > > +            Set set = kernel.listGBeans(query); // all Jetty
> > > connectors
> > > +            for (Iterator it = set.iterator(); it.hasNext();) {
> > > +                AbstractName name = (AbstractName) it.next(); // a
> > > single Jetty connector
> > > +                GBeanData data = kernel.getGBeanData(name);
> > > +                ReferencePatterns refs =
> > > data.getReferencePatterns("activeMQContainer");
> > > +                if(containerName.equals(refs.getAbstractName())) {
> > > +                    try {
> > > +                        String testProtocol = (String)
> > > kernel.getAttribute(name, "protocol");
> > > +                        if(testProtocol != null &&
> > > testProtocol.equals(protocol)) {
> > > +                            results.add(mgr.createProxy(name,
> > > ActiveMQConnector.class.getClassLoader()));
> > > +                        }
> > > +                    } catch (Exception e) {
> > > +                        log.error("Unable to look up protocol for
> > > connector '"+name+"'",e);
> > > +                    }
> > > +                    break;
> > > +                }
> > > +            }
> > > +            return (ActiveMQConnector[]) results.toArray(new
> > > ActiveMQConnector[results.size()]);
> > > +        } catch (Exception e) {
> > > +            throw (IllegalArgumentException)new
> > > IllegalArgumentException("Unable to look up connectors for ActiveMQ
> > > broker '"+containerName +"': ").initCause(e);
> > > +        }
> > > +    }
> > > +
> > > +    /**
> > > +     * Creates a new connector, and returns the ObjectName for
> > > it.  Note that
> > > +     * the connector may well require further customization before
> > > being fully
> > > +     * functional (e.g. SSL settings for a secure connector).
> > > +     */
> > > +    public JMSConnector addConnector(JMSBroker broker, String
> > > uniqueName, String protocol, String host, int port) {
> > > +        AbstractName brokerAbstractName = kernel.getAbstractNameFor
> > > (broker);
> > > +        AbstractName name =
> > > kernel.getNaming().createChildName(brokerAbstractName, uniqueName,
> > > NameFactory.GERONIMO_SERVICE);
> > > +        GBeanData connector = new GBeanData(name,
> > > TransportConnectorGBeanImpl.GBEAN_INFO);
> > > +        //todo: if SSL is supported, need to add more properties or
> > > use a different GBean?
> > > +        connector.setAttribute("protocol", protocol);
> > > +        connector.setAttribute("host", host);
> > > +        connector.setAttribute("port", new Integer(port));
> > > +        connector.setReferencePattern("activeMQContainer",
> > > brokerAbstractName);
> > > +        EditableConfigurationManager mgr =
> > > ConfigurationUtil.getEditableConfigurationManager(kernel);
> > > +        if(mgr != null) {
> > > +            try {
> > > +
> > > mgr.addGBeanToConfiguration(brokerAbstractName.getArtifact(),
> > > connector, false);
> > > +                return (JMSConnector)
> > > kernel.getProxyManager().createProxy(name,
> > > ActiveMQConnector.class.getClassLoader());
> > > +            } catch (InvalidConfigException e) {
> > > +                log.error("Unable to add GBean", e);
> > > +                return null;
> > > +            } finally {
> > > +                ConfigurationUtil.releaseConfigurationManager
> > > (kernel, mgr);
> > > +            }
> > > +        } else {
> > > +            log.warn("The ConfigurationManager in the kernel does not
> > > allow editing");
> > > +            return null;
> > > +        }
> > > +    }
> > > +
> > > +    public void removeConnector(AbstractName connectorName) {
> > > +        try {
> > > +            GBeanInfo info = kernel.getGBeanInfo(connectorName);
> > > +            boolean found = false;
> > > +            Set intfs = info.getInterfaces();
> > > +            for (Iterator it = intfs.iterator(); it.hasNext();) {
> > > +                String intf = (String) it.next();
> > > +                if (intf.equals(ActiveMQConnector.class.getName())) {
> > > +                    found = true;
> > > +                }
> > > +            }
> > > +            if (!found) {
> > > +                throw new GBeanNotFoundException(connectorName);
> > > +            }
> > > +            EditableConfigurationManager mgr =
> > > ConfigurationUtil.getEditableConfigurationManager(kernel);
> > > +            if (mgr != null) {
> > > +                try {
> > > +
> > > mgr.removeGBeanFromConfiguration(connectorName.getArtifact(),
> > > connectorName);
> > > +                } catch (InvalidConfigException e) {
> > > +                    log.error("Unable to add GBean", e);
> > > +                } finally {
> > > +                    ConfigurationUtil.releaseConfigurationManager
> > > (kernel, mgr);
> > > +                }
> > > +            } else {
> > > +                log.warn("The ConfigurationManager in the kernel does
> > > not allow editing");
> > > +            }
> > > +        } catch (GBeanNotFoundException e) {
> > > +            log.warn("No such GBean '" + connectorName + "'");
> > > //todo: what if we want to remove a failed GBean?
> > > +        } catch (Exception e) {
> > > +            log.error(e);
> > > +        }
> > > +    }
> > > +
> > > +    public static final GBeanInfo GBEAN_INFO;
> > > +
> > > +    static {
> > > +        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("ActiveMQ
> > > Manager", ActiveMQManagerGBean.class);
> > > +        infoFactory.addAttribute("kernel", Kernel.class, false);
> > > +        infoFactory.addAttribute("objectName", String.class, false);
> > > +        infoFactory.addInterface(ActiveMQManager.class);
> > > +        infoFactory.setConstructor(new String[]{"kernel",
> > > "objectName"});
> > > +        GBEAN_INFO = infoFactory.getBeanInfo();
> > > +    }
> > > +
> > > +    public static GBeanInfo getGBeanInfo() {
> > > +        return GBEAN_INFO;
> > > +    }
> > > +}
> > > Index: modules/activemq-gbean/src/main/java/org/apache/activemq/
> > > gbean/package.html
> > > ===================================================================
> > > --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > > package.html  (revision
> > > 0)
> > > +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > > package.html  (revision
> > > 0)
> > > @@ -0,0 +1,11 @@
> > > +<html>
> > > +<head>
> > > +</head>
> > > +<body>
> > > +
> > > +<p>
> > > +     The JMS container using GBeaps for deployment in Geronimo or other
> > > JSR 77/88 based containers
> > > +</p>
> > > +
> > > +</body>
> > > +</html>
> > >
> > > Property changes on:
> > > modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > > package.html
> > > ___________________________________________________________________
> > > Name: svn:executable
> > >   + *
> > >
> > > Index: modules/activemq-gbean/pom.xml
> > > ===================================================================
> > > --- modules/activemq-gbean/pom.xml    (revision 0)
> > > +++ modules/activemq-gbean/pom.xml    (revision 0)
> > > @@ -0,0 +1,83 @@
> > > +<?xml version="1.0" encoding="UTF-8"?>
> > > +<!--
> > > +    Copyright 2005-2006 The Apache Software Foundation
> > > +
> > > +    Licensed 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.
> > > +-->
> > > +<!-- $Rev: 411333 $ $Date: 2006-06-02 18:35:57 -0500 (Fri, 02 Jun
> > > 2006) $ -->
> > > +<project
> > > +  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> > > http://maven.apache.org/maven-v4_0_0.xsd"
> > > +  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > +  xmlns="http://maven.apache.org/POM/4.0.0">
> > > +
> > > +    <modelVersion>4.0.0</modelVersion>
> > > +
> > > +    <parent>
> > > +        <groupId>org.apache.geronimo.modules</groupId>
> > > +        <artifactId>modules-parent</artifactId>
> > > +        <version>1.2-SNAPSHOT</version>
> > > +        <relativePath>../pom.xml</relativePath>
> > > +    </parent>
> > > +
> > > +    <artifactId>geronimo-activemq-gbean</artifactId>
> > > +    <version>${geronimoVersion}</version>
> > > +    <name>ActiveMQ :: GBeans</name>
> > > +    <description>Geronimo ActiveMQ Integration</description>
> > > +
> > > +    <dependencies>
> > > +
> > > +      <dependency>
> > > +        <groupId>incubator-activemq</groupId>
> > > +        <artifactId>activemq-core</artifactId>
> > > +        <version>4.0-SNAPSHOT</version>
> > > +      </dependency>
> > > +      <dependency>
> > > +        <groupId>incubator-activemq</groupId>
> > > +        <artifactId>activeio-core</artifactId>
> > > +        <version>3.0-SNAPSHOT</version>
> > > +      </dependency>
> > > +
> > > +      <dependency>
> > > +        <groupId>org.apache.geronimo.modules</groupId>
> > > +        <artifactId>geronimo-activemq-gbean-management</artifactId>
> > > +      </dependency>
> > > +      <dependency>
> > > +        <groupId>org.apache.geronimo.modules</groupId>
> > > +        <artifactId>geronimo-kernel</artifactId>
> > > +      </dependency>
> > > +      <dependency>
> > > +        <groupId>org.apache.geronimo.modules</groupId>
> > > +        <artifactId>geronimo-system</artifactId>
> > > +      </dependency>
> > > +      <dependency>
> > > +        <groupId>org.apache.geronimo.modules</groupId>
> > > +        <artifactId>geronimo-management</artifactId>
> > > +      </dependency>
> > > +      <dependency>
> > > +        <groupId>org.apache.geronimo.modules</groupId>
> > > +        <artifactId>geronimo-j2ee</artifactId>
> > > +      </dependency>
> > > +
> > > +      <dependency>
> > > +        <groupId>commons-logging</groupId>
> > > +        <artifactId>commons-logging</artifactId>
> > > +      </dependency>
> > > +
> > > +      <dependency>
> > > +        <groupId>mx4j</groupId>
> > > +        <artifactId>mx4j</artifactId>
> > > +      </dependency>
> > > +
> > > +    </dependencies>
> > > +
> > > +</project>
> > > Index: modules/activemq-gbean-management/project.properties
> > > ===================================================================
> > > --- modules/activemq-gbean-management/project.properties      (revision 0)
> > > +++ modules/activemq-gbean-management/project.properties      (revision 0)
> > > @@ -0,0 +1,3 @@
> > > +# -------------------------------------------------------------------
> > > +# Build Properties
> > > +# -------------------------------------------------------------------
> > >
> > > Property changes on: modules/activemq-gbean-management/
> > > project.properties
> > > ___________________________________________________________________
> > > Name: svn:executable
> > >   + *
> > >
> > > Index: modules/activemq-gbean-management/project.xml
> > > ===================================================================
> > > --- modules/activemq-gbean-management/project.xml     (revision 0)
> > > +++ modules/activemq-gbean-management/project.xml     (revision 0)
> > > @@ -0,0 +1,37 @@
> > > +<?xml version="1.0" encoding="ISO-8859-1"?>
> > > +<!DOCTYPE project>
> > > +<project>
> > > +    <pomVersion>3</pomVersion>
> > > +    <extend>../../etc/project.xml</extend>
> > > +
> > > +    <name>Geronimo :: ActiveMQ :: GBean Interfaces</name>
> > > +    <id>geronimo-activemq-gbean-management</id>
> > > +    <shortDescription>Geronimo / GBean management support</
> > > shortDescription>
> > > +    <description>ActiveMQ management interfaces used for integration
> > > into Apache Geronimo</description>
> > > +
> > > +    <!-- ============ -->
> > > +    <!-- Dependencies -->
> > > +    <!-- ============ -->
> > > +    <dependencies>
> > > +
> > > +        <dependency>
> > > +            <groupId>geronimo</groupId>
> > > +            <artifactId>geronimo-management</artifactId>
> > > +            <version>${pom.currentVersion}</version>
> > > +        </dependency>
> > > +
> > > +    </dependencies>
> > > +
> > > +    <!-- this module is using m2 directory layout -->
> > > +    <build>
> > > +        <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
> > > +        <unitTestSourceDirectory>${basedir}/src/main/test</
> > > unitTestSourceDirectory>
> > > +
> > > +        <unitTest>
> > > +            <includes>
> > > +                <include>**/*Test.java</include>
> > > +            </includes>
> > > +        </unitTest>
> > > +    </build>
> > > +
> > > +</project>
> > >
> > > Property changes on: modules/activemq-gbean-management/project.xml
> > > ___________________________________________________________________
> > > Name: svn:executable
> > >   + *
> > >
> > > Index: modules/activemq-gbean-management/src/main/java/org/apache/
> > > activemq/gbean/ActiveMQConnector.java
> > > ===================================================================
> > > --- modules/activemq-gbean-management/src/main/java/org/apache/
> > > activemq/gbean/ActiveMQConnector.java (revision
> > > 0)
> > > +++ modules/activemq-gbean-management/src/main/java/org/apache/
> > > activemq/gbean/ActiveMQConnector.java (revision
> > > 0)
> > > @@ -0,0 +1,34 @@
> > > +/**
> > > + *
> > > + * Copyright 2005-2006 The Apache Software Foundation
> > > + *
> > > + *  Licensed 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.gbean;
> > > +
> > > +import org.apache.geronimo.management.geronimo.JMSConnector;
> > > +
> > > +/**
> > > + * The GBean interface for the ActiveMQ network connector GBean
> > > + *
> > > + * @version $Revision: 1.0$
> > > + */
> > > +public interface ActiveMQConnector extends JMSConnector {
> > > +    public final static String CONNECTOR_J2EE_TYPE = "JMSConnector";
> > > +
> > > +    // Additional stuff you can add to an ActiveMQ connector URI
> > > +    public String getPath();
> > > +    public void setPath(String path);
> > > +    public String getQuery();
> > > +    public void setQuery(String query);
> > > +}
> > > Index: modules/activemq-gbean-management/src/main/java/org/apache/
> > > activemq/gbean/ActiveMQManager.java
> > > ===================================================================
> > > --- modules/activemq-gbean-management/src/main/java/org/apache/
> > > activemq/gbean/ActiveMQManager.java   (revision
> > > 0)
> > > +++ modules/activemq-gbean-management/src/main/java/org/apache/
> > > activemq/gbean/ActiveMQManager.java   (revision
> > > 0)
> > > @@ -0,0 +1,29 @@
> > > +/**
> > > + *
> > > + * Copyright 2005-2006 The Apache Software Foundation
> > > + *
> > > + *  Licensed 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.gbean;
> > > +
> > > +import org.apache.geronimo.management.J2EEManagedObject;
> > > +import org.apache.geronimo.management.geronimo.JMSManager;
> > > +
> > > +/**
> > > + * The GBean interface for the ActiveMQ management GBean.  This
> > > defines the
> > > + * features that should be available to the management interface
> > > at runtime.
> > > + *
> > > + * @version $Revision: 1.0$
> > > + */
> > > +public interface ActiveMQManager extends JMSManager,
> > > J2EEManagedObject {
> > > +}
> > > Index: modules/activemq-gbean-management/src/main/java/org/apache/
> > > activemq/gbean/ActiveMQBroker.java
> > > ===================================================================
> > > --- modules/activemq-gbean-management/src/main/java/org/apache/
> > > activemq/gbean/ActiveMQBroker.java    (revision
> > > 0)
> > > +++ modules/activemq-gbean-management/src/main/java/org/apache/
> > > activemq/gbean/ActiveMQBroker.java    (revision
> > > 0)
> > > @@ -0,0 +1,30 @@
> > > +/**
> > > + *
> > > + * Copyright 2005-2006 The Apache Software Foundation
> > > + *
> > > + *  Licensed 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.gbean;
> > > +
> > > +import org.apache.geronimo.management.geronimo.JMSBroker;
> > > +
> > > +/**
> > > + * The management interface for the ActiveMQ broker GBean.
> > > + * This is separate from ActiveMQContainer because that interface
> > > has hard
> > > + * links to code in activemq-core, yet we still want to be able to
> > > + * distinguish ActiveMQ brokers from non-ActiveMQ JMS brokers.
> > > + *
> > > + * @version $Revision: 1.0$
> > > + */
> > > +public interface ActiveMQBroker extends JMSBroker {
> > > +}
> > > Index: modules/activemq-gbean-management/src/main/java/org/apache/
> > > activemq/gbean/package.html
> > > ===================================================================
> > > --- modules/activemq-gbean-management/src/main/java/org/apache/
> > > activemq/gbean/package.html   (revision
> > > 0)
> > > +++ modules/activemq-gbean-management/src/main/java/org/apache/
> > > activemq/gbean/package.html   (revision
> > > 0)
> > > @@ -0,0 +1,12 @@
> > > +<html>
> > > +<head>
> > > +</head>
> > > +<body>
> > > +
> > > +<p>
> > > +     The management API for ActiveMQ, when run in a
> > > +        container like Geronimo
> > > +</p>
> > > +
> > > +</body>
> > > +</html>
> > >
> > > Property changes on:
> > > modules/activemq-gbean-management/src/main/java/org/apache/activemq/
> > > gbean/package.html
> > > ___________________________________________________________________
> > > Name: svn:executable
> > >   + *
> > >
> > > Index: modules/activemq-gbean-management/pom.xml
> > > ===================================================================
> > > --- modules/activemq-gbean-management/pom.xml (revision 0)
> > > +++ modules/activemq-gbean-management/pom.xml (revision 0)
> > > @@ -0,0 +1,53 @@
> > > +<?xml version="1.0" encoding="UTF-8"?>
> > > +<!--
> > > +    Copyright 2005-2006 The Apache Software Foundation
> > > +
> > > +    Licensed 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.
> > > +-->
> > > +<!-- $Rev: 411333 $ $Date: 2006-06-02 18:35:57 -0500 (Fri, 02 Jun
> > > 2006) $ -->
> > > +<project
> > > +  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> > > http://maven.apache.org/maven-v4_0_0.xsd"
> > > +  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > +  xmlns="http://maven.apache.org/POM/4.0.0">
> > > +
> > > +    <modelVersion>4.0.0</modelVersion>
> > > +
> > > +    <parent>
> > > +        <groupId>org.apache.geronimo.modules</groupId>
> > > +        <artifactId>modules-parent</artifactId>
> > > +        <version>1.2-SNAPSHOT</version>
> > > +        <relativePath>../pom.xml</relativePath>
> > > +    </parent>
> > > +
> > > +    <artifactId>geronimo-activemq-gbean-management</artifactId>
> > > +    <version>${geronimoVersion}</version>
> > > +    <name>Geronimo :: ActiveMQ :: GBean Interfaces</name>
> > > +    <description>ActiveMQ Management Interfaces used by Geronimo</
> > > description>
> > > +
> > > +    <dependencies>
> > > +
> > > +      <dependency>
> > > +          <groupId>org.apache.geronimo.modules</groupId>
> > > +          <artifactId>geronimo-management</artifactId>
> > > +      </dependency>
> > > +      <dependency>
> > > +        <groupId>backport-util-concurrent</groupId>
> > > +        <artifactId>backport-util-concurrent</artifactId>
> > > +      </dependency>
> > > +      <dependency>
> > > +        <groupId>log4j</groupId>
> > > +        <artifactId>log4j</artifactId>
> > > +      </dependency>
> > > +
> > > +   </dependencies>
> > > +</project>
> > >
> > >
> > > --
> > > Regards,
> > > Hiram
> >
> >
>
>
> --
> Regards,
> Hiram
>

Re: [RTC] ActiveMQ GBean modules

Posted by Hiram Chirino <hi...@hiramchirino.com>.
Hi David,

That's a great review and set of issue.  Once I commit the patch could
you create JIRA for each of those?  lol, j/k.

Perhaps I should start a new thread on this thought, but I just wanted
to comment that we need to be careful about how critical and the level
of perfection that we expect from the contributed patches.  I would
say that if a patch does not regress the project and it moves it
forward in the right direction, the patch should be accepted even if
it's not perfect.

It kind of reminds me of something David B told me once, if the code
is perfect and stable, you won't be able to build a community around
the project it since it just works.  This makes sense to me.  If the
code is 80% of the way there, then you give an opportunity for folks
to join your community by submitting additional patches that help it
get to the 100% mark. In short, I guess I would prefer to see a steady
stream of small patches that 1 large patch not so often.

And so to tie it back to the original thread, I think that patch that
I submitted is large enough to start with :)  Lets fix the rest of the
issues incrementally.

Regards,
Hiram

On 6/13/06, David Jencks <da...@yahoo.com> wrote:
> I think that this gbean adaptation code should be in geronimo rather
> than amq.  I'm OK with applying it as is but would prefer some issues
> to be addressed first or, even better,  immediately after the
> transfer (assuming it is done with svn mv).
>
> 1. DataSourceReference should be replaced by the geronimo class that
> does the same thing, ConnectionFactorySource.
>
> 2. I think it would be preferable to get the module/configuration
> classloader in the constructor as a magic attribute and use it in
> BrokerServiceGBeanImpl.doStart rather than the classloader of
> BrokerServiceGBeanImpl.
>
> 3. Same for TransportConnectorGBeanImpl.
>
> 4. This is a question, not really an issue, about this code:
> +    protected TransportConnector createBrokerConnector(String url)
> throws Exception {
> +        return brokerService.getBrokerContainer().addConnector(url);
> +    }
>
> To me it seems like this code is combining the functions of factory
> object and container.  Is this necessary and appropriate?  I'd be
> more comfortable with
> Connector connector = ConnectorFactory.createConnector(url);
> brokerService.getBrokerContainer().addConnector(connector);
>
> I find that the combination style typically creates problems whenever
> trying to extend stuff, say by wrapping the connector.  What do you
> think?
>
> 5. hardcoding the protocols in ActiveMQManagerGBean seems like a
> temporary expedient at best.
>
> 6. javadoc on public JMSConnector addConnector( ... in the manager
> gbean seems wrong... does not appear to return an object name.
>
> 7. Typo and innaccuracies in the first package.html... this stuff is
> only going to work in geronimo, jsr77/88 is not enough.
>
> 8. I'm not sure exactly what our official policy is but I prefer to
> remove "public" from methods in interfaces since it is the only
> choice and implied.
>
> +1 if the above are addressed before or right after commit.  I only
> insist on (1), the others are more like suggestions.
>
> thanks
> david jencks
>
>
>
>
>
> On Jun 5, 2006, at 4:19 PM, Hiram Chirino wrote:
>
> > Howdy folks,
> >
> > Here's  a patch that brings in the activemq gbean modules into
> > geronimo.  It's partly what was in activemq 4.x and integrated into
> > geronimo 1.2-dead merged with the changes in the 3.x branch.
> >
> > It compiles at least and looks like a reasonable start.  Once further
> > integration work gets done we may need to tweak a little more.  here's
> > my +1 got get this committed.  I guess I just need 3 more.
> >
> >
> > Index: modules/activemq-gbean/project.properties
> > ===================================================================
> > --- modules/activemq-gbean/project.properties (revision 0)
> > +++ modules/activemq-gbean/project.properties (revision 0)
> > @@ -0,0 +1,3 @@
> > +# -------------------------------------------------------------------
> > +# Build Properties
> > +# -------------------------------------------------------------------
> >
> > Property changes on: modules/activemq-gbean/project.properties
> > ___________________________________________________________________
> > Name: svn:executable
> >   + *
> >
> > Index: modules/activemq-gbean/project.xml
> > ===================================================================
> > --- modules/activemq-gbean/project.xml        (revision 0)
> > +++ modules/activemq-gbean/project.xml        (revision 0)
> > @@ -0,0 +1,104 @@
> > +<?xml version="1.0" encoding="ISO-8859-1"?>
> > +<!--
> > +
> > +    Copyright 2004 The Apache Software Foundation
> > +
> > +    Licensed 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.
> > +-->
> > +<!-- $Rev: 356052 $ $Date: 2005-12-11 16:41:20 -0600 (Sun, 11 Dec
> > 2005) $ -->
> > +<!DOCTYPE project>
> > +<project>
> > +    <pomVersion>3</pomVersion>
> > +    <extend>../../etc/project.xml</extend>
> > +
> > +    <name>Geronimo :: ActiveMQ :: GBeans</name>
> > +    <id>geronimo-activemq-gbean</id>
> > +    <shortDescription>ActiveMQ Geronimo / GBean support</
> > shortDescription>
> > +    <description>ActiveMQ GBeans used for integration into Apache
> > Geronimo</description>
> > +
> > +    <!-- ============ -->
> > +    <!-- Dependencies -->
> > +    <!-- ============ -->
> > +    <dependencies>
> > +
> > +      <dependency>
> > +        <groupId>incubator-activemq</groupId>
> > +        <artifactId>activemq-core</artifactId>
> > +        <version>4.0-SNAPSHOT</version>
> > +      </dependency>
> > +
> > +      <dependency>
> > +        <groupId>incubator-activemq</groupId>
> > +        <artifactId>activeio-core</artifactId>
> > +        <version>3.0-SNAPSHOT</version>
> > +      </dependency>
> > +
> > +      <dependency>
> > +        <groupId>geronimo</groupId>
> > +        <artifactId>geronimo-activemq-gbean-management</artifactId>
> > +        <version>${pom.currentVersion}</version>
> > +      </dependency>
> > +
> > +      <dependency>
> > +        <groupId>geronimo</groupId>
> > +        <artifactId>geronimo-kernel</artifactId>
> > +        <version>${pom.currentVersion}</version>
> > +      </dependency>
> > +
> > +      <dependency>
> > +        <groupId>geronimo</groupId>
> > +        <artifactId>geronimo-system</artifactId>
> > +        <version>${pom.currentVersion}</version>
> > +      </dependency>
> > +
> > +      <dependency>
> > +        <groupId>geronimo</groupId>
> > +        <artifactId>geronimo-management</artifactId>
> > +        <version>${pom.currentVersion}</version>
> > +      </dependency>
> > +
> > +      <dependency>
> > +        <groupId>geronimo</groupId>
> > +        <artifactId>geronimo-j2ee</artifactId>
> > +        <version>${pom.currentVersion}</version>
> > +      </dependency>
> > +
> > +      <dependency>
> > +        <groupId>mx4j</groupId>
> > +        <artifactId>mx4j</artifactId>
> > +        <version>${mx4j_version}</version>
> > +      </dependency>
> > +
> > +      <dependency>
> > +        <groupId>commons-logging</groupId>
> > +        <artifactId>commons-logging</artifactId>
> > +        <version>${commons_logging_version}</version>
> > +        <url>http://jakarta.apache.org/commons/logging/</url>
> > +      </dependency>
> > +
> > +
> > +    </dependencies>
> > +
> > +    <!-- this module is using m2 directory layout -->
> > +    <build>
> > +        <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
> > +        <unitTestSourceDirectory>${basedir}/src/main/test</
> > unitTestSourceDirectory>
> > +
> > +        <unitTest>
> > +            <includes>
> > +                <include>**/*Test.java</include>
> > +            </includes>
> > +        </unitTest>
> > +    </build>
> > +
> > +</project>
> >
> > Property changes on: modules/activemq-gbean/project.xml
> > ___________________________________________________________________
> > Name: svn:executable
> >   + *
> >
> > Index: modules/activemq-gbean/src/test/java/org/apache/activemq/
> > gbean/ConnectorTest.java
> > ===================================================================
> > --- modules/activemq-gbean/src/test/java/org/apache/activemq/gbean/
> > ConnectorTest.java    (revision
> > 0)
> > +++ modules/activemq-gbean/src/test/java/org/apache/activemq/gbean/
> > ConnectorTest.java    (revision
> > 0)
> > @@ -0,0 +1,61 @@
> > +/**
> > + *
> > + * Copyright 2005-2006 The Apache Software Foundation
> > + *
> > + *  Licensed 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.gbean;
> > +
> > +import org.apache.activemq.gbean.TransportConnectorGBeanImpl;
> > +
> > +import junit.framework.TestCase;
> > +
> > +/**
> > + * Tests to ensure that URL parsing and updating doesn't blow up
> > + *
> > + * @version $Revision: 1.0$
> > + */
> > +public class ConnectorTest extends TestCase {
> > +    public TransportConnectorGBeanImpl test;
> > +
> > +    protected void setUp() throws Exception {
> > +    }
> > +
> > +    public void testURLManipulation() {
> > +        test = new TransportConnectorGBeanImpl(null, "foo",
> > "localhost", 1234);
> > +        assertEquals("foo://localhost:1234", test.getUrl());
> > +        assertEquals("foo", test.getProtocol());
> > +        assertEquals("localhost", test.getHost());
> > +        assertEquals(1234, test.getPort());
> > +        test.setHost("0.0.0.0");
> > +        assertEquals("foo://0.0.0.0:1234", test.getUrl());
> > +        assertEquals("foo", test.getProtocol());
> > +        assertEquals("0.0.0.0", test.getHost());
> > +        assertEquals(1234, test.getPort());
> > +        test.setPort(8765);
> > +        assertEquals("foo://0.0.0.0:8765", test.getUrl());
> > +        assertEquals("foo", test.getProtocol());
> > +        assertEquals("0.0.0.0", test.getHost());
> > +        assertEquals(8765, test.getPort());
> > +        test.setProtocol("bar");
> > +        assertEquals("bar://0.0.0.0:8765", test.getUrl());
> > +        assertEquals("bar", test.getProtocol());
> > +        assertEquals("0.0.0.0", test.getHost());
> > +        assertEquals(8765, test.getPort());
> > +        test = new TransportConnectorGBeanImpl(null, "vm",
> > "localhost", -1);
> > +        assertEquals("vm://localhost", test.getUrl());
> > +        assertEquals("vm", test.getProtocol());
> > +        assertEquals("localhost", test.getHost());
> > +        assertEquals(-1, test.getPort());
> > +    }
> > +}
> > Index: modules/activemq-gbean/src/main/java/org/apache/activemq/
> > gbean/BrokerServiceGBean.java
> > ===================================================================
> > --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > BrokerServiceGBean.java       (revision
> > 0)
> > +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > BrokerServiceGBean.java       (revision
> > 0)
> > @@ -0,0 +1,34 @@
> > +/**
> > + *
> > + * Copyright 2005-2006 The Apache Software Foundation
> > + *
> > + *  Licensed 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.gbean;
> > +
> > +import org.apache.activemq.broker.BrokerService;
> > +import org.apache.activemq.gbean.ActiveMQBroker;
> > +
> > +/**
> > + * An interface to the ActiveMQContainerGBean for use by the
> > + * ActiveMQConnectorGBean.
> > + *
> > + * @version $Revision: 1.1.1.1 $
> > + */
> > +public interface BrokerServiceGBean extends ActiveMQBroker {
> > +
> > +     public abstract BrokerService getBrokerContainer();
> > +     public String getBrokerName();
> > +
> > +
> > +}
> > \ No newline at end of file
> >
> > Property changes on:
> > modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > BrokerServiceGBean.java
> > ___________________________________________________________________
> > Name: svn:executable
> >   + *
> >
> > Index: modules/activemq-gbean/src/main/java/org/apache/activemq/
> > gbean/BrokerServiceGBeanImpl.java
> > ===================================================================
> > --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > BrokerServiceGBeanImpl.java   (revision
> > 0)
> > +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > BrokerServiceGBeanImpl.java   (revision
> > 0)
> > @@ -0,0 +1,209 @@
> > +/**
> > + *
> > + * Copyright 2005-2006 The Apache Software Foundation
> > + *
> > + *  Licensed 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.gbean;
> > +
> > +import java.net.URI;
> > +
> > +import javax.sql.DataSource;
> > +
> > +import org.apache.activemq.broker.BrokerFactory;
> > +import org.apache.activemq.broker.BrokerService;
> > +import org.apache.activemq.store.DefaultPersistenceAdapterFactory;
> > +import org.apache.commons.logging.Log;
> > +import org.apache.commons.logging.LogFactory;
> > +import org.apache.geronimo.gbean.GBeanInfo;
> > +import org.apache.geronimo.gbean.GBeanInfoBuilder;
> > +import org.apache.geronimo.gbean.GBeanLifecycle;
> > +import org.apache.geronimo.management.geronimo.JMSManager;
> > +import org.apache.geronimo.management.geronimo.NetworkConnector;
> > +import org.apache.geronimo.system.serverinfo.ServerInfo;
> > +
> > +
> > +/**
> > + * Default implementation of the ActiveMQ Message Server
> > + *
> > + * @version $Revision: 1.1.1.1 $
> > + */
> > +public class BrokerServiceGBeanImpl implements GBeanLifecycle,
> > BrokerServiceGBean {
> > +
> > +    private Log log = LogFactory.getLog(getClass().getName());
> > +
> > +    private String brokerName;
> > +    private String brokerUri;
> > +    private BrokerService brokerService;
> > +    private ServerInfo serverInfo;
> > +    private String dataDirectory;
> > +    private DataSourceReference dataSource;
> > +
> > +    private String objectName;
> > +    private JMSManager manager;
> > +
> > +    public BrokerServiceGBeanImpl() {
> > +    }
> > +
> > +    public synchronized BrokerService getBrokerContainer() {
> > +        return brokerService;
> > +    }
> > +
> > +    public synchronized void doStart() throws Exception {
> > +             ClassLoader old = Thread.currentThread
> > ().getContextClassLoader();
> > +             Thread.currentThread().setContextClassLoader
> > (BrokerServiceGBeanImpl.class.getClassLoader());
> > +             try {
> > +             if (brokerService == null) {
> > +                 brokerService = createContainer();
> > +             }
> > +                DefaultPersistenceAdapterFactory persistenceFactory =
> > (DefaultPersistenceAdapterFactory)
> > brokerService.getPersistenceFactory();
> > +
> > persistenceFactory.setDataDirectory(serverInfo.resolve
> > (dataDirectory));
> > +                persistenceFactory.setDataSource((DataSource)
> > dataSource.$getResource());
> > +                brokerService.start();
> > +             } finally {
> > +             Thread.currentThread().setContextClassLoader(old);
> > +             }
> > +    }
> > +
> > +    protected BrokerService createContainer() throws Exception {
> > +        if( brokerUri!=null ) {
> > +            BrokerService answer = BrokerFactory.createBroker(new
> > URI(brokerUri));
> > +            brokerName = answer.getBrokerName();
> > +            return answer;
> > +        } else {
> > +            BrokerService answer = new BrokerService();
> > +            answer.setBrokerName(brokerName);
> > +            return answer;
> > +        }
> > +    }
> > +
> > +    public synchronized void doStop() throws Exception {
> > +        if (brokerService != null) {
> > +            BrokerService temp = brokerService;
> > +            brokerService = null;
> > +            temp.stop();
> > +        }
> > +    }
> > +
> > +    public synchronized void doFail() {
> > +        if (brokerService != null) {
> > +            BrokerService temp = brokerService;
> > +            brokerService = null;
> > +            try {
> > +                temp.stop();
> > +            } catch (Exception e) {
> > +                log.info("Caught while closing due to failure: " +
> > e, e);
> > +            }
> > +        }
> > +    }
> > +
> > +    public static final GBeanInfo GBEAN_INFO;
> > +
> > +    static {
> > +        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("ActiveMQ
> > Message Broker", BrokerServiceGBeanImpl.class, "JMSServer");
> > +        infoFactory.addReference("serverInfo", ServerInfo.class);
> > +        infoFactory.addAttribute("brokerName", String.class, true);
> > +        infoFactory.addAttribute("brokerUri", String.class, true);
> > +        infoFactory.addAttribute("dataDirectory", String.class,
> > true);
> > +        infoFactory.addReference("dataSource",
> > DataSourceReference.class);
> > +        infoFactory.addAttribute("objectName", String.class, false);
> > +        infoFactory.addReference("manager", JMSManager.class);
> > +        infoFactory.addInterface(BrokerServiceGBean.class);
> > +        // infoFactory.setConstructor(new String[]{"brokerName,
> > brokerUri"});
> > +        GBEAN_INFO = infoFactory.getBeanInfo();
> > +    }
> > +
> > +    public static GBeanInfo getGBeanInfo() {
> > +        return GBEAN_INFO;
> > +    }
> > +
> > +     /**
> > +      * @return Returns the brokerName.
> > +      */
> > +     public String getBrokerName() {
> > +             return brokerName;
> > +     }
> > +
> > +    public String getBrokerUri() {
> > +        return brokerUri;
> > +    }
> > +
> > +    public void setBrokerName(String brokerName) {
> > +        this.brokerName = brokerName;
> > +    }
> > +
> > +    public void setBrokerUri(String brokerUri) {
> > +        this.brokerUri = brokerUri;
> > +    }
> > +
> > +    public ServerInfo getServerInfo() {
> > +        return serverInfo;
> > +    }
> > +
> > +    public void setServerInfo(ServerInfo serverInfo) {
> > +        this.serverInfo = serverInfo;
> > +    }
> > +
> > +    public String getDataDirectory() {
> > +        return dataDirectory;
> > +    }
> > +
> > +    public void setDataDirectory(String dataDir) {
> > +        this.dataDirectory = dataDir;
> > +    }
> > +
> > +    public DataSourceReference getDataSource() {
> > +        return dataSource;
> > +    }
> > +
> > +    public void setDataSource(DataSourceReference dataSource) {
> > +        this.dataSource = dataSource;
> > +    }
> > +
> > +    public String getObjectName() {
> > +        return objectName;
> > +    }
> > +
> > +    public boolean isStateManageable() {
> > +        return true;
> > +    }
> > +
> > +    public boolean isStatisticsProvider() {
> > +        return false; // todo: return true once stats are integrated
> > +    }
> > +
> > +    public boolean isEventProvider() {
> > +        return true;
> > +    }
> > +
> > +    public NetworkConnector[] getConnectors() {
> > +        return manager.getConnectorsForContainer(this);
> > +    }
> > +
> > +    public NetworkConnector[] getConnectors(String protocol) {
> > +        return manager.getConnectorsForContainer(this, protocol);
> > +    }
> > +
> > +    public JMSManager getManager() {
> > +        return manager;
> > +    }
> > +
> > +    public void setManager(JMSManager manager) {
> > +        this.manager = manager;
> > +    }
> > +
> > +    public void setObjectName(String objectName) {
> > +        this.objectName = objectName;
> > +    }
> > +
> > +}
> > \ No newline at end of file
> >
> > Property changes on:
> > modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > BrokerServiceGBeanImpl.java
> > ___________________________________________________________________
> > Name: svn:executable
> >   + *
> >
> > Index: modules/activemq-gbean/src/main/java/org/apache/activemq/
> > gbean/TransportConnectorGBeanImpl.java
> > ===================================================================
> > --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > TransportConnectorGBeanImpl.java      (revision
> > 0)
> > +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > TransportConnectorGBeanImpl.java      (revision
> > 0)
> > @@ -0,0 +1,168 @@
> > +/**
> > + *
> > + * Copyright 2005-2006 The Apache Software Foundation
> > + *
> > + *  Licensed 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.gbean;
> > +
> > +import java.net.InetSocketAddress;
> > +import java.net.URI;
> > +import java.net.URISyntaxException;
> > +
> > +import org.apache.activemq.broker.TransportConnector;
> > +import org.apache.activemq.gbean.ActiveMQConnector;
> > +import org.apache.commons.logging.Log;
> > +import org.apache.commons.logging.LogFactory;
> > +import org.apache.geronimo.gbean.GBeanInfo;
> > +import org.apache.geronimo.gbean.GBeanInfoBuilder;
> > +import org.apache.geronimo.gbean.GBeanLifecycle;
> > +import org.apache.geronimo.gbean.GConstructorInfo;
> > +
> > +/**
> > + * Default implementation of the ActiveMQ connector
> > + *
> > + * @version $Revision: 1.1.1.1 $
> > + */
> > +public class TransportConnectorGBeanImpl implements GBeanLifecycle,
> > ActiveMQConnector {
> > +    private Log log = LogFactory.getLog(getClass().getName());
> > +
> > +    private TransportConnector transportConnector;
> > +    private BrokerServiceGBean brokerService;
> > +
> > +    private String protocol;
> > +    private String host;
> > +    private int port;
> > +    private String path;
> > +    private String query;
> > +    private String urlAsStarted;
> > +
> > +    public TransportConnectorGBeanImpl(BrokerServiceGBean
> > brokerService, String protocol, String host, int port) {
> > +        this.brokerService = brokerService;
> > +        this.protocol = protocol;
> > +        this.host = host;
> > +        this.port = port;
> > +    }
> > +
> > +    public String getProtocol() {
> > +        return protocol;
> > +    }
> > +
> > +    public void setProtocol(String protocol) {
> > +        this.protocol = protocol;
> > +    }
> > +
> > +    public String getHost() {
> > +        return host;
> > +    }
> > +
> > +    public void setHost(String host) {
> > +        this.host = host;
> > +    }
> > +
> > +    public int getPort() {
> > +        return port;
> > +    }
> > +
> > +    public void setPort(int port) {
> > +        this.port = port;
> > +    }
> > +
> > +    public String getPath() {
> > +        return path;
> > +    }
> > +
> > +    public void setPath(String path) {
> > +        this.path = path;
> > +    }
> > +
> > +    public String getQuery() {
> > +        return query;
> > +    }
> > +
> > +    public void setQuery(String query) {
> > +        this.query = query;
> > +    }
> > +
> > +    public String getUrl() {
> > +        try {
> > +            return new URI(protocol, null, host, port, path, query,
> > null).toString();
> > +        } catch (URISyntaxException e) {
> > +            throw new IllegalStateException("Attributes don't form a
> > valid URI: "+protocol+"://"+host+":"+port+"/"+path+"?"+query);
> > +        }
> > +    }
> > +
> > +    public InetSocketAddress getListenAddress() {
> > +        try {
> > +            return transportConnector.getServer().getSocketAddress();
> > +        } catch (Throwable e) {
> > +            log.debug("Failure to determine ListenAddress: "+e,e);
> > +            return null;
> > +        }
> > +    }
> > +
> > +    public synchronized void doStart() throws Exception {
> > +     ClassLoader old = Thread.currentThread().getContextClassLoader
> > ();
> > +     Thread.currentThread().setContextClassLoader
> > (BrokerServiceGBeanImpl.class.getClassLoader());
> > +     try {
> > +             if (transportConnector == null) {
> > +                urlAsStarted = getUrl();
> > +                 transportConnector = createBrokerConnector
> > (urlAsStarted);
> > +                 transportConnector.start();
> > +             }
> > +     } finally {
> > +             Thread.currentThread().setContextClassLoader(old);
> > +     }
> > +    }
> > +
> > +    public synchronized void doStop() throws Exception {
> > +        if (transportConnector != null) {
> > +            TransportConnector temp = transportConnector;
> > +            transportConnector = null;
> > +            temp.stop();
> > +        }
> > +    }
> > +
> > +    public synchronized void doFail() {
> > +        if (transportConnector != null) {
> > +            TransportConnector temp = transportConnector;
> > +            transportConnector = null;
> > +            try {
> > +                temp.stop();
> > +            }
> > +            catch (Exception e) {
> > +                log.info("Caught while closing due to failure: " +
> > e, e);
> > +            }
> > +        }
> > +    }
> > +
> > +    protected TransportConnector createBrokerConnector(String url)
> > throws Exception {
> > +        return brokerService.getBrokerContainer().addConnector(url);
> > +    }
> > +
> > +    public static final GBeanInfo GBEAN_INFO;
> > +
> > +    static {
> > +        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("ActiveMQ
> > Transport Connector", TransportConnectorGBeanImpl.class,
> > CONNECTOR_J2EE_TYPE);
> > +        infoFactory.addAttribute("url", String.class.getName(),
> > false);
> > +        infoFactory.addReference("brokerService",
> > BrokerServiceGBean.class);
> > +        infoFactory.addInterface(ActiveMQConnector.class, new
> > String[]{"host","port","protocol","path","query"},
> > +                new String[]{"host","port"});
> > +        infoFactory.setConstructor(new GConstructorInfo(new
> > String[]{"brokerService", "protocol", "host", "port"}));
> > +        GBEAN_INFO = infoFactory.getBeanInfo();
> > +    }
> > +
> > +    public static GBeanInfo getGBeanInfo() {
> > +        return GBEAN_INFO;
> > +    }
> > +}
> >
> > Property changes on:
> > modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > TransportConnectorGBeanImpl.java
> > ___________________________________________________________________
> > Name: svn:executable
> >   + *
> >
> > Index: modules/activemq-gbean/src/main/java/org/apache/activemq/
> > gbean/DataSourceReference.java
> > ===================================================================
> > --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > DataSourceReference.java      (revision
> > 0)
> > +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > DataSourceReference.java      (revision
> > 0)
> > @@ -0,0 +1,21 @@
> > +/**
> > + *
> > + * Copyright 2005-2006 The Apache Software Foundation
> > + *
> > + *  Licensed 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.gbean;
> > +
> > +public interface DataSourceReference {
> > +    public Object $getResource();
> > +}
> > Index: modules/activemq-gbean/src/main/java/org/apache/activemq/
> > gbean/management/ActiveMQManagerGBean.java
> > ===================================================================
> > --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > management/ActiveMQManagerGBean.java  (revision
> > 0)
> > +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > management/ActiveMQManagerGBean.java  (revision
> > 0)
> > @@ -0,0 +1,266 @@
> > +/**
> > + *
> > + * Copyright 2005-2006 The Apache Software Foundation
> > + *
> > + *  Licensed 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.gbean.management;
> > +
> > +import java.util.ArrayList;
> > +import java.util.Iterator;
> > +import java.util.List;
> > +import java.util.Set;
> > +
> > +import org.apache.activemq.gbean.ActiveMQBroker;
> > +import org.apache.activemq.gbean.ActiveMQConnector;
> > +import org.apache.activemq.gbean.ActiveMQManager;
> > +import org.apache.activemq.gbean.TransportConnectorGBeanImpl;
> > +import org.apache.commons.logging.Log;
> > +import org.apache.commons.logging.LogFactory;
> > +import org.apache.geronimo.gbean.AbstractName;
> > +import org.apache.geronimo.gbean.AbstractNameQuery;
> > +import org.apache.geronimo.gbean.GBeanData;
> > +import org.apache.geronimo.gbean.GBeanInfo;
> > +import org.apache.geronimo.gbean.GBeanInfoBuilder;
> > +import org.apache.geronimo.gbean.ReferencePatterns;
> > +import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
> > +import org.apache.geronimo.kernel.GBeanNotFoundException;
> > +import org.apache.geronimo.kernel.Kernel;
> > +import org.apache.geronimo.kernel.config.ConfigurationUtil;
> > +import
> > org.apache.geronimo.kernel.config.EditableConfigurationManager;
> > +import org.apache.geronimo.kernel.config.InvalidConfigException;
> > +import org.apache.geronimo.kernel.proxy.ProxyManager;
> > +import org.apache.geronimo.management.geronimo.JMSBroker;
> > +import org.apache.geronimo.management.geronimo.JMSConnector;
> > +import org.apache.geronimo.management.geronimo.NetworkConnector;
> > +
> > +/**
> > + * Implementation of the ActiveMQ management interface.  These are
> > the ActiveMQ
> > + * management features available at runtime.
> > + *
> > + * @version $Revision: 1.0$
> > + */
> > +public class ActiveMQManagerGBean implements ActiveMQManager {
> > +    private static final Log log =
> > LogFactory.getLog(ActiveMQManagerGBean.class.getName());
> > +    private Kernel kernel;
> > +    private String objectName;
> > +
> > +    public ActiveMQManagerGBean(Kernel kernel, String objectName) {
> > +        this.kernel = kernel;
> > +        this.objectName = objectName;
> > +    }
> > +
> > +    public String getProductName() {
> > +        return "ActiveMQ";
> > +    }
> > +
> > +    public String getObjectName() {
> > +        return objectName;
> > +    }
> > +
> > +    public boolean isEventProvider() {
> > +        return false;
> > +    }
> > +
> > +    public boolean isStateManageable() {
> > +        return true;
> > +    }
> > +
> > +    public boolean isStatisticsProvider() {
> > +        return false;
> > +    }
> > +
> > +    public Object[] getContainers() {
> > +        ProxyManager proxyManager = kernel.getProxyManager();
> > +        AbstractNameQuery query = new
> > AbstractNameQuery(ActiveMQBroker.class.getName());
> > +        Set names = kernel.listGBeans(query);
> > +        ActiveMQBroker[] results = new ActiveMQBroker[names.size()];
> > +        int i=0;
> > +        for (Iterator it = names.iterator(); it.hasNext(); i++) {
> > +            AbstractName name = (AbstractName) it.next();
> > +            results[i] = (ActiveMQBroker)
> > proxyManager.createProxy(name, ActiveMQBroker.class.getClassLoader());
> > +        }
> > +        return results;
> > +    }
> > +
> > +    public String[] getSupportedProtocols() {
> > +        // see files in
> > modules/core/src/conf/META-INF/services/org/activemq/transport/server/
> > +        return new String[]{ "tcp", "stomp", "vm", "peer", "udp",
> > "multicast", "failover"};
> > +    }
> > +
> > +    public NetworkConnector[] getConnectors() {
> > +        ProxyManager proxyManager = kernel.getProxyManager();
> > +        AbstractNameQuery query = new
> > AbstractNameQuery(ActiveMQConnector.class.getName());
> > +        Set names = kernel.listGBeans(query);
> > +        ActiveMQConnector[] results = new ActiveMQConnector
> > [names.size()];
> > +        int i=0;
> > +        for (Iterator it = names.iterator(); it.hasNext(); i++) {
> > +            AbstractName name = (AbstractName) it.next();
> > +            results[i] = (ActiveMQConnector)
> > proxyManager.createProxy(name,
> > ActiveMQConnector.class.getClassLoader());
> > +        }
> > +        return results;
> > +    }
> > +
> > +    public NetworkConnector[] getConnectors(String protocol) {
> > +        if(protocol == null) {
> > +            return getConnectors();
> > +        }
> > +        List result = new ArrayList();
> > +        ProxyManager proxyManager = kernel.getProxyManager();
> > +        AbstractNameQuery query = new
> > AbstractNameQuery(ActiveMQConnector.class.getName());
> > +        Set names = kernel.listGBeans(query);
> > +        for (Iterator it = names.iterator(); it.hasNext();) {
> > +            AbstractName name = (AbstractName) it.next();
> > +            try {
> > +                if (kernel.getAttribute(name, "protocol").equals
> > (protocol)) {
> > +                    result.add(proxyManager.createProxy(name,
> > ActiveMQConnector.class.getClassLoader()));
> > +                }
> > +            } catch (Exception e) {
> > +                log.error("Unable to check the protocol for a
> > connector", e);
> > +            }
> > +        }
> > +        return (ActiveMQConnector[]) result.toArray(new
> > ActiveMQConnector[names.size()]);
> > +    }
> > +
> > +    public NetworkConnector[] getConnectorsForContainer(Object
> > broker) {
> > +        AbstractName containerName = kernel.getAbstractNameFor
> > (broker);
> > +        ProxyManager mgr = kernel.getProxyManager();
> > +        try {
> > +            List results = new ArrayList();
> > +            AbstractNameQuery query = new
> > AbstractNameQuery(ActiveMQConnector.class.getName());
> > +            Set set = kernel.listGBeans(query); // all Jetty
> > connectors
> > +            for (Iterator it = set.iterator(); it.hasNext();) {
> > +                AbstractName name = (AbstractName) it.next(); // a
> > single Jetty connector
> > +                GBeanData data = kernel.getGBeanData(name);
> > +                ReferencePatterns refs =
> > data.getReferencePatterns("activeMQContainer");
> > +                if (containerName.equals(refs.getAbstractName())) {
> > +                    results.add(mgr.createProxy(name,
> > ActiveMQConnector.class.getClassLoader()));
> > +                }
> > +            }
> > +            return (ActiveMQConnector[]) results.toArray(new
> > ActiveMQConnector[results.size()]);
> > +        } catch (Exception e) {
> > +            throw (IllegalArgumentException) new
> > IllegalArgumentException("Unable to look up connectors for ActiveMQ
> > broker '"+containerName).initCause(e);
> > +        }
> > +    }
> > +
> > +    public NetworkConnector[] getConnectorsForContainer(Object
> > broker, String protocol) {
> > +        if(protocol == null) {
> > +            return getConnectorsForContainer(broker);
> > +        }
> > +        AbstractName containerName = kernel.getAbstractNameFor
> > (broker);
> > +        ProxyManager mgr = kernel.getProxyManager();
> > +        try {
> > +            List results = new ArrayList();
> > +            AbstractNameQuery query = new
> > AbstractNameQuery(ActiveMQConnector.class.getName());
> > +            Set set = kernel.listGBeans(query); // all Jetty
> > connectors
> > +            for (Iterator it = set.iterator(); it.hasNext();) {
> > +                AbstractName name = (AbstractName) it.next(); // a
> > single Jetty connector
> > +                GBeanData data = kernel.getGBeanData(name);
> > +                ReferencePatterns refs =
> > data.getReferencePatterns("activeMQContainer");
> > +                if(containerName.equals(refs.getAbstractName())) {
> > +                    try {
> > +                        String testProtocol = (String)
> > kernel.getAttribute(name, "protocol");
> > +                        if(testProtocol != null &&
> > testProtocol.equals(protocol)) {
> > +                            results.add(mgr.createProxy(name,
> > ActiveMQConnector.class.getClassLoader()));
> > +                        }
> > +                    } catch (Exception e) {
> > +                        log.error("Unable to look up protocol for
> > connector '"+name+"'",e);
> > +                    }
> > +                    break;
> > +                }
> > +            }
> > +            return (ActiveMQConnector[]) results.toArray(new
> > ActiveMQConnector[results.size()]);
> > +        } catch (Exception e) {
> > +            throw (IllegalArgumentException)new
> > IllegalArgumentException("Unable to look up connectors for ActiveMQ
> > broker '"+containerName +"': ").initCause(e);
> > +        }
> > +    }
> > +
> > +    /**
> > +     * Creates a new connector, and returns the ObjectName for
> > it.  Note that
> > +     * the connector may well require further customization before
> > being fully
> > +     * functional (e.g. SSL settings for a secure connector).
> > +     */
> > +    public JMSConnector addConnector(JMSBroker broker, String
> > uniqueName, String protocol, String host, int port) {
> > +        AbstractName brokerAbstractName = kernel.getAbstractNameFor
> > (broker);
> > +        AbstractName name =
> > kernel.getNaming().createChildName(brokerAbstractName, uniqueName,
> > NameFactory.GERONIMO_SERVICE);
> > +        GBeanData connector = new GBeanData(name,
> > TransportConnectorGBeanImpl.GBEAN_INFO);
> > +        //todo: if SSL is supported, need to add more properties or
> > use a different GBean?
> > +        connector.setAttribute("protocol", protocol);
> > +        connector.setAttribute("host", host);
> > +        connector.setAttribute("port", new Integer(port));
> > +        connector.setReferencePattern("activeMQContainer",
> > brokerAbstractName);
> > +        EditableConfigurationManager mgr =
> > ConfigurationUtil.getEditableConfigurationManager(kernel);
> > +        if(mgr != null) {
> > +            try {
> > +
> > mgr.addGBeanToConfiguration(brokerAbstractName.getArtifact(),
> > connector, false);
> > +                return (JMSConnector)
> > kernel.getProxyManager().createProxy(name,
> > ActiveMQConnector.class.getClassLoader());
> > +            } catch (InvalidConfigException e) {
> > +                log.error("Unable to add GBean", e);
> > +                return null;
> > +            } finally {
> > +                ConfigurationUtil.releaseConfigurationManager
> > (kernel, mgr);
> > +            }
> > +        } else {
> > +            log.warn("The ConfigurationManager in the kernel does not
> > allow editing");
> > +            return null;
> > +        }
> > +    }
> > +
> > +    public void removeConnector(AbstractName connectorName) {
> > +        try {
> > +            GBeanInfo info = kernel.getGBeanInfo(connectorName);
> > +            boolean found = false;
> > +            Set intfs = info.getInterfaces();
> > +            for (Iterator it = intfs.iterator(); it.hasNext();) {
> > +                String intf = (String) it.next();
> > +                if (intf.equals(ActiveMQConnector.class.getName())) {
> > +                    found = true;
> > +                }
> > +            }
> > +            if (!found) {
> > +                throw new GBeanNotFoundException(connectorName);
> > +            }
> > +            EditableConfigurationManager mgr =
> > ConfigurationUtil.getEditableConfigurationManager(kernel);
> > +            if (mgr != null) {
> > +                try {
> > +
> > mgr.removeGBeanFromConfiguration(connectorName.getArtifact(),
> > connectorName);
> > +                } catch (InvalidConfigException e) {
> > +                    log.error("Unable to add GBean", e);
> > +                } finally {
> > +                    ConfigurationUtil.releaseConfigurationManager
> > (kernel, mgr);
> > +                }
> > +            } else {
> > +                log.warn("The ConfigurationManager in the kernel does
> > not allow editing");
> > +            }
> > +        } catch (GBeanNotFoundException e) {
> > +            log.warn("No such GBean '" + connectorName + "'");
> > //todo: what if we want to remove a failed GBean?
> > +        } catch (Exception e) {
> > +            log.error(e);
> > +        }
> > +    }
> > +
> > +    public static final GBeanInfo GBEAN_INFO;
> > +
> > +    static {
> > +        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("ActiveMQ
> > Manager", ActiveMQManagerGBean.class);
> > +        infoFactory.addAttribute("kernel", Kernel.class, false);
> > +        infoFactory.addAttribute("objectName", String.class, false);
> > +        infoFactory.addInterface(ActiveMQManager.class);
> > +        infoFactory.setConstructor(new String[]{"kernel",
> > "objectName"});
> > +        GBEAN_INFO = infoFactory.getBeanInfo();
> > +    }
> > +
> > +    public static GBeanInfo getGBeanInfo() {
> > +        return GBEAN_INFO;
> > +    }
> > +}
> > Index: modules/activemq-gbean/src/main/java/org/apache/activemq/
> > gbean/package.html
> > ===================================================================
> > --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > package.html  (revision
> > 0)
> > +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > package.html  (revision
> > 0)
> > @@ -0,0 +1,11 @@
> > +<html>
> > +<head>
> > +</head>
> > +<body>
> > +
> > +<p>
> > +     The JMS container using GBeaps for deployment in Geronimo or other
> > JSR 77/88 based containers
> > +</p>
> > +
> > +</body>
> > +</html>
> >
> > Property changes on:
> > modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
> > package.html
> > ___________________________________________________________________
> > Name: svn:executable
> >   + *
> >
> > Index: modules/activemq-gbean/pom.xml
> > ===================================================================
> > --- modules/activemq-gbean/pom.xml    (revision 0)
> > +++ modules/activemq-gbean/pom.xml    (revision 0)
> > @@ -0,0 +1,83 @@
> > +<?xml version="1.0" encoding="UTF-8"?>
> > +<!--
> > +    Copyright 2005-2006 The Apache Software Foundation
> > +
> > +    Licensed 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.
> > +-->
> > +<!-- $Rev: 411333 $ $Date: 2006-06-02 18:35:57 -0500 (Fri, 02 Jun
> > 2006) $ -->
> > +<project
> > +  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> > http://maven.apache.org/maven-v4_0_0.xsd"
> > +  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > +  xmlns="http://maven.apache.org/POM/4.0.0">
> > +
> > +    <modelVersion>4.0.0</modelVersion>
> > +
> > +    <parent>
> > +        <groupId>org.apache.geronimo.modules</groupId>
> > +        <artifactId>modules-parent</artifactId>
> > +        <version>1.2-SNAPSHOT</version>
> > +        <relativePath>../pom.xml</relativePath>
> > +    </parent>
> > +
> > +    <artifactId>geronimo-activemq-gbean</artifactId>
> > +    <version>${geronimoVersion}</version>
> > +    <name>ActiveMQ :: GBeans</name>
> > +    <description>Geronimo ActiveMQ Integration</description>
> > +
> > +    <dependencies>
> > +
> > +      <dependency>
> > +        <groupId>incubator-activemq</groupId>
> > +        <artifactId>activemq-core</artifactId>
> > +        <version>4.0-SNAPSHOT</version>
> > +      </dependency>
> > +      <dependency>
> > +        <groupId>incubator-activemq</groupId>
> > +        <artifactId>activeio-core</artifactId>
> > +        <version>3.0-SNAPSHOT</version>
> > +      </dependency>
> > +
> > +      <dependency>
> > +        <groupId>org.apache.geronimo.modules</groupId>
> > +        <artifactId>geronimo-activemq-gbean-management</artifactId>
> > +      </dependency>
> > +      <dependency>
> > +        <groupId>org.apache.geronimo.modules</groupId>
> > +        <artifactId>geronimo-kernel</artifactId>
> > +      </dependency>
> > +      <dependency>
> > +        <groupId>org.apache.geronimo.modules</groupId>
> > +        <artifactId>geronimo-system</artifactId>
> > +      </dependency>
> > +      <dependency>
> > +        <groupId>org.apache.geronimo.modules</groupId>
> > +        <artifactId>geronimo-management</artifactId>
> > +      </dependency>
> > +      <dependency>
> > +        <groupId>org.apache.geronimo.modules</groupId>
> > +        <artifactId>geronimo-j2ee</artifactId>
> > +      </dependency>
> > +
> > +      <dependency>
> > +        <groupId>commons-logging</groupId>
> > +        <artifactId>commons-logging</artifactId>
> > +      </dependency>
> > +
> > +      <dependency>
> > +        <groupId>mx4j</groupId>
> > +        <artifactId>mx4j</artifactId>
> > +      </dependency>
> > +
> > +    </dependencies>
> > +
> > +</project>
> > Index: modules/activemq-gbean-management/project.properties
> > ===================================================================
> > --- modules/activemq-gbean-management/project.properties      (revision 0)
> > +++ modules/activemq-gbean-management/project.properties      (revision 0)
> > @@ -0,0 +1,3 @@
> > +# -------------------------------------------------------------------
> > +# Build Properties
> > +# -------------------------------------------------------------------
> >
> > Property changes on: modules/activemq-gbean-management/
> > project.properties
> > ___________________________________________________________________
> > Name: svn:executable
> >   + *
> >
> > Index: modules/activemq-gbean-management/project.xml
> > ===================================================================
> > --- modules/activemq-gbean-management/project.xml     (revision 0)
> > +++ modules/activemq-gbean-management/project.xml     (revision 0)
> > @@ -0,0 +1,37 @@
> > +<?xml version="1.0" encoding="ISO-8859-1"?>
> > +<!DOCTYPE project>
> > +<project>
> > +    <pomVersion>3</pomVersion>
> > +    <extend>../../etc/project.xml</extend>
> > +
> > +    <name>Geronimo :: ActiveMQ :: GBean Interfaces</name>
> > +    <id>geronimo-activemq-gbean-management</id>
> > +    <shortDescription>Geronimo / GBean management support</
> > shortDescription>
> > +    <description>ActiveMQ management interfaces used for integration
> > into Apache Geronimo</description>
> > +
> > +    <!-- ============ -->
> > +    <!-- Dependencies -->
> > +    <!-- ============ -->
> > +    <dependencies>
> > +
> > +        <dependency>
> > +            <groupId>geronimo</groupId>
> > +            <artifactId>geronimo-management</artifactId>
> > +            <version>${pom.currentVersion}</version>
> > +        </dependency>
> > +
> > +    </dependencies>
> > +
> > +    <!-- this module is using m2 directory layout -->
> > +    <build>
> > +        <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
> > +        <unitTestSourceDirectory>${basedir}/src/main/test</
> > unitTestSourceDirectory>
> > +
> > +        <unitTest>
> > +            <includes>
> > +                <include>**/*Test.java</include>
> > +            </includes>
> > +        </unitTest>
> > +    </build>
> > +
> > +</project>
> >
> > Property changes on: modules/activemq-gbean-management/project.xml
> > ___________________________________________________________________
> > Name: svn:executable
> >   + *
> >
> > Index: modules/activemq-gbean-management/src/main/java/org/apache/
> > activemq/gbean/ActiveMQConnector.java
> > ===================================================================
> > --- modules/activemq-gbean-management/src/main/java/org/apache/
> > activemq/gbean/ActiveMQConnector.java (revision
> > 0)
> > +++ modules/activemq-gbean-management/src/main/java/org/apache/
> > activemq/gbean/ActiveMQConnector.java (revision
> > 0)
> > @@ -0,0 +1,34 @@
> > +/**
> > + *
> > + * Copyright 2005-2006 The Apache Software Foundation
> > + *
> > + *  Licensed 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.gbean;
> > +
> > +import org.apache.geronimo.management.geronimo.JMSConnector;
> > +
> > +/**
> > + * The GBean interface for the ActiveMQ network connector GBean
> > + *
> > + * @version $Revision: 1.0$
> > + */
> > +public interface ActiveMQConnector extends JMSConnector {
> > +    public final static String CONNECTOR_J2EE_TYPE = "JMSConnector";
> > +
> > +    // Additional stuff you can add to an ActiveMQ connector URI
> > +    public String getPath();
> > +    public void setPath(String path);
> > +    public String getQuery();
> > +    public void setQuery(String query);
> > +}
> > Index: modules/activemq-gbean-management/src/main/java/org/apache/
> > activemq/gbean/ActiveMQManager.java
> > ===================================================================
> > --- modules/activemq-gbean-management/src/main/java/org/apache/
> > activemq/gbean/ActiveMQManager.java   (revision
> > 0)
> > +++ modules/activemq-gbean-management/src/main/java/org/apache/
> > activemq/gbean/ActiveMQManager.java   (revision
> > 0)
> > @@ -0,0 +1,29 @@
> > +/**
> > + *
> > + * Copyright 2005-2006 The Apache Software Foundation
> > + *
> > + *  Licensed 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.gbean;
> > +
> > +import org.apache.geronimo.management.J2EEManagedObject;
> > +import org.apache.geronimo.management.geronimo.JMSManager;
> > +
> > +/**
> > + * The GBean interface for the ActiveMQ management GBean.  This
> > defines the
> > + * features that should be available to the management interface
> > at runtime.
> > + *
> > + * @version $Revision: 1.0$
> > + */
> > +public interface ActiveMQManager extends JMSManager,
> > J2EEManagedObject {
> > +}
> > Index: modules/activemq-gbean-management/src/main/java/org/apache/
> > activemq/gbean/ActiveMQBroker.java
> > ===================================================================
> > --- modules/activemq-gbean-management/src/main/java/org/apache/
> > activemq/gbean/ActiveMQBroker.java    (revision
> > 0)
> > +++ modules/activemq-gbean-management/src/main/java/org/apache/
> > activemq/gbean/ActiveMQBroker.java    (revision
> > 0)
> > @@ -0,0 +1,30 @@
> > +/**
> > + *
> > + * Copyright 2005-2006 The Apache Software Foundation
> > + *
> > + *  Licensed 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.gbean;
> > +
> > +import org.apache.geronimo.management.geronimo.JMSBroker;
> > +
> > +/**
> > + * The management interface for the ActiveMQ broker GBean.
> > + * This is separate from ActiveMQContainer because that interface
> > has hard
> > + * links to code in activemq-core, yet we still want to be able to
> > + * distinguish ActiveMQ brokers from non-ActiveMQ JMS brokers.
> > + *
> > + * @version $Revision: 1.0$
> > + */
> > +public interface ActiveMQBroker extends JMSBroker {
> > +}
> > Index: modules/activemq-gbean-management/src/main/java/org/apache/
> > activemq/gbean/package.html
> > ===================================================================
> > --- modules/activemq-gbean-management/src/main/java/org/apache/
> > activemq/gbean/package.html   (revision
> > 0)
> > +++ modules/activemq-gbean-management/src/main/java/org/apache/
> > activemq/gbean/package.html   (revision
> > 0)
> > @@ -0,0 +1,12 @@
> > +<html>
> > +<head>
> > +</head>
> > +<body>
> > +
> > +<p>
> > +     The management API for ActiveMQ, when run in a
> > +        container like Geronimo
> > +</p>
> > +
> > +</body>
> > +</html>
> >
> > Property changes on:
> > modules/activemq-gbean-management/src/main/java/org/apache/activemq/
> > gbean/package.html
> > ___________________________________________________________________
> > Name: svn:executable
> >   + *
> >
> > Index: modules/activemq-gbean-management/pom.xml
> > ===================================================================
> > --- modules/activemq-gbean-management/pom.xml (revision 0)
> > +++ modules/activemq-gbean-management/pom.xml (revision 0)
> > @@ -0,0 +1,53 @@
> > +<?xml version="1.0" encoding="UTF-8"?>
> > +<!--
> > +    Copyright 2005-2006 The Apache Software Foundation
> > +
> > +    Licensed 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.
> > +-->
> > +<!-- $Rev: 411333 $ $Date: 2006-06-02 18:35:57 -0500 (Fri, 02 Jun
> > 2006) $ -->
> > +<project
> > +  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> > http://maven.apache.org/maven-v4_0_0.xsd"
> > +  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > +  xmlns="http://maven.apache.org/POM/4.0.0">
> > +
> > +    <modelVersion>4.0.0</modelVersion>
> > +
> > +    <parent>
> > +        <groupId>org.apache.geronimo.modules</groupId>
> > +        <artifactId>modules-parent</artifactId>
> > +        <version>1.2-SNAPSHOT</version>
> > +        <relativePath>../pom.xml</relativePath>
> > +    </parent>
> > +
> > +    <artifactId>geronimo-activemq-gbean-management</artifactId>
> > +    <version>${geronimoVersion}</version>
> > +    <name>Geronimo :: ActiveMQ :: GBean Interfaces</name>
> > +    <description>ActiveMQ Management Interfaces used by Geronimo</
> > description>
> > +
> > +    <dependencies>
> > +
> > +      <dependency>
> > +          <groupId>org.apache.geronimo.modules</groupId>
> > +          <artifactId>geronimo-management</artifactId>
> > +      </dependency>
> > +      <dependency>
> > +        <groupId>backport-util-concurrent</groupId>
> > +        <artifactId>backport-util-concurrent</artifactId>
> > +      </dependency>
> > +      <dependency>
> > +        <groupId>log4j</groupId>
> > +        <artifactId>log4j</artifactId>
> > +      </dependency>
> > +
> > +   </dependencies>
> > +</project>
> >
> >
> > --
> > Regards,
> > Hiram
>
>


-- 
Regards,
Hiram

Re: [RTC] ActiveMQ GBean modules

Posted by David Jencks <da...@yahoo.com>.
My first sentence is supposed to mean "I support moving this code to  
geronimo" :-).  I went ahead and reviewed it even without it being  
attached to a jira issue, but I would like there to be a jira issue  
for this for tracking purposes: the patch doesn't need to be attached  
to it.

thanks
david jencks

On Jun 13, 2006, at 11:31 AM, David Jencks wrote:

> I think that this gbean adaptation code should be in geronimo  
> rather than amq.  I'm OK with applying it as is but would prefer  
> some issues to be addressed first or, even better,  immediately  
> after the transfer (assuming it is done with svn mv).
>
> 1. DataSourceReference should be replaced by the geronimo class  
> that does the same thing, ConnectionFactorySource.
>
> 2. I think it would be preferable to get the module/configuration  
> classloader in the constructor as a magic attribute and use it in  
> BrokerServiceGBeanImpl.doStart rather than the classloader of  
> BrokerServiceGBeanImpl.
>
> 3. Same for TransportConnectorGBeanImpl.
>
> 4. This is a question, not really an issue, about this code:
> +    protected TransportConnector createBrokerConnector(String url)
> throws Exception {
> +        return brokerService.getBrokerContainer().addConnector(url);
> +    }
>
> To me it seems like this code is combining the functions of factory  
> object and container.  Is this necessary and appropriate?  I'd be  
> more comfortable with
> Connector connector = ConnectorFactory.createConnector(url);
> brokerService.getBrokerContainer().addConnector(connector);
>
> I find that the combination style typically creates problems  
> whenever trying to extend stuff, say by wrapping the connector.   
> What do you think?
>
> 5. hardcoding the protocols in ActiveMQManagerGBean seems like a  
> temporary expedient at best.
>
> 6. javadoc on public JMSConnector addConnector( ... in the manager  
> gbean seems wrong... does not appear to return an object name.
>
> 7. Typo and innaccuracies in the first package.html... this stuff  
> is only going to work in geronimo, jsr77/88 is not enough.
>
> 8. I'm not sure exactly what our official policy is but I prefer to  
> remove "public" from methods in interfaces since it is the only  
> choice and implied.
>
> +1 if the above are addressed before or right after commit.  I only  
> insist on (1), the others are more like suggestions.
>
> thanks
> david jencks
>
>
>
>
>
> On Jun 5, 2006, at 4:19 PM, Hiram Chirino wrote:
>
>> Howdy folks,
>>
>> Here's  a patch that brings in the activemq gbean modules into
>> geronimo.  It's partly what was in activemq 4.x and integrated into
>> geronimo 1.2-dead merged with the changes in the 3.x branch.
>>
>> It compiles at least and looks like a reasonable start.  Once further
>> integration work gets done we may need to tweak a little more.   
>> here's
>> my +1 got get this committed.  I guess I just need 3 more.
>>
>>
>> Index: modules/activemq-gbean/project.properties
>> ===================================================================
>> --- modules/activemq-gbean/project.properties	(revision 0)
>> +++ modules/activemq-gbean/project.properties	(revision 0)
>> @@ -0,0 +1,3 @@
>> +#  
>> -------------------------------------------------------------------
>> +# Build Properties
>> +#  
>> -------------------------------------------------------------------
>>
>> Property changes on: modules/activemq-gbean/project.properties
>> ___________________________________________________________________
>> Name: svn:executable
>>   + *
>>
>> Index: modules/activemq-gbean/project.xml
>> ===================================================================
>> --- modules/activemq-gbean/project.xml	(revision 0)
>> +++ modules/activemq-gbean/project.xml	(revision 0)
>> @@ -0,0 +1,104 @@
>> +<?xml version="1.0" encoding="ISO-8859-1"?>
>> +<!--
>> +
>> +    Copyright 2004 The Apache Software Foundation
>> +
>> +    Licensed 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.
>> +-->
>> +<!-- $Rev: 356052 $ $Date: 2005-12-11 16:41:20 -0600 (Sun, 11 Dec  
>> 2005) $ -->
>> +<!DOCTYPE project>
>> +<project>
>> +    <pomVersion>3</pomVersion>
>> +    <extend>../../etc/project.xml</extend>
>> +
>> +    <name>Geronimo :: ActiveMQ :: GBeans</name>
>> +    <id>geronimo-activemq-gbean</id>
>> +    <shortDescription>ActiveMQ Geronimo / GBean support</ 
>> shortDescription>
>> +    <description>ActiveMQ GBeans used for integration into Apache
>> Geronimo</description>
>> +
>> +    <!-- ============ -->
>> +    <!-- Dependencies -->
>> +    <!-- ============ -->
>> +    <dependencies>
>> +
>> +      <dependency>
>> +        <groupId>incubator-activemq</groupId>
>> +        <artifactId>activemq-core</artifactId>
>> +        <version>4.0-SNAPSHOT</version>
>> +      </dependency>
>> +
>> +      <dependency>
>> +        <groupId>incubator-activemq</groupId>
>> +        <artifactId>activeio-core</artifactId>
>> +        <version>3.0-SNAPSHOT</version>
>> +      </dependency>
>> +
>> +      <dependency>
>> +        <groupId>geronimo</groupId>
>> +        <artifactId>geronimo-activemq-gbean-management</artifactId>
>> +        <version>${pom.currentVersion}</version>
>> +      </dependency>
>> +
>> +      <dependency>
>> +        <groupId>geronimo</groupId>
>> +        <artifactId>geronimo-kernel</artifactId>
>> +        <version>${pom.currentVersion}</version>
>> +      </dependency>
>> +
>> +      <dependency>
>> +        <groupId>geronimo</groupId>
>> +        <artifactId>geronimo-system</artifactId>
>> +        <version>${pom.currentVersion}</version>
>> +      </dependency>
>> +
>> +      <dependency>
>> +        <groupId>geronimo</groupId>
>> +        <artifactId>geronimo-management</artifactId>
>> +        <version>${pom.currentVersion}</version>
>> +      </dependency>
>> +
>> +      <dependency>
>> +        <groupId>geronimo</groupId>
>> +        <artifactId>geronimo-j2ee</artifactId>
>> +        <version>${pom.currentVersion}</version>
>> +      </dependency>
>> +
>> +      <dependency>
>> +        <groupId>mx4j</groupId>
>> +        <artifactId>mx4j</artifactId>
>> +        <version>${mx4j_version}</version>
>> +      </dependency>
>> +
>> +      <dependency>
>> +        <groupId>commons-logging</groupId>
>> +        <artifactId>commons-logging</artifactId>
>> +        <version>${commons_logging_version}</version>
>> +        <url>http://jakarta.apache.org/commons/logging/</url>
>> +      </dependency>
>> +
>> +
>> +    </dependencies>
>> +
>> +    <!-- this module is using m2 directory layout -->
>> +    <build>
>> +        <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
>> +        <unitTestSourceDirectory>${basedir}/src/main/test</ 
>> unitTestSourceDirectory>
>> +
>> +        <unitTest>
>> +            <includes>
>> +                <include>**/*Test.java</include>
>> +            </includes>
>> +        </unitTest>
>> +    </build>
>> +
>> +</project>
>>
>> Property changes on: modules/activemq-gbean/project.xml
>> ___________________________________________________________________
>> Name: svn:executable
>>   + *
>>
>> Index: modules/activemq-gbean/src/test/java/org/apache/activemq/ 
>> gbean/ConnectorTest.java
>> ===================================================================
>> --- modules/activemq-gbean/src/test/java/org/apache/activemq/gbean/ 
>> ConnectorTest.java	(revision
>> 0)
>> +++ modules/activemq-gbean/src/test/java/org/apache/activemq/gbean/ 
>> ConnectorTest.java	(revision
>> 0)
>> @@ -0,0 +1,61 @@
>> +/**
>> + *
>> + * Copyright 2005-2006 The Apache Software Foundation
>> + *
>> + *  Licensed 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.gbean;
>> +
>> +import org.apache.activemq.gbean.TransportConnectorGBeanImpl;
>> +
>> +import junit.framework.TestCase;
>> +
>> +/**
>> + * Tests to ensure that URL parsing and updating doesn't blow up
>> + *
>> + * @version $Revision: 1.0$
>> + */
>> +public class ConnectorTest extends TestCase {
>> +    public TransportConnectorGBeanImpl test;
>> +
>> +    protected void setUp() throws Exception {
>> +    }
>> +
>> +    public void testURLManipulation() {
>> +        test = new TransportConnectorGBeanImpl(null, "foo",  
>> "localhost", 1234);
>> +        assertEquals("foo://localhost:1234", test.getUrl());
>> +        assertEquals("foo", test.getProtocol());
>> +        assertEquals("localhost", test.getHost());
>> +        assertEquals(1234, test.getPort());
>> +        test.setHost("0.0.0.0");
>> +        assertEquals("foo://0.0.0.0:1234", test.getUrl());
>> +        assertEquals("foo", test.getProtocol());
>> +        assertEquals("0.0.0.0", test.getHost());
>> +        assertEquals(1234, test.getPort());
>> +        test.setPort(8765);
>> +        assertEquals("foo://0.0.0.0:8765", test.getUrl());
>> +        assertEquals("foo", test.getProtocol());
>> +        assertEquals("0.0.0.0", test.getHost());
>> +        assertEquals(8765, test.getPort());
>> +        test.setProtocol("bar");
>> +        assertEquals("bar://0.0.0.0:8765", test.getUrl());
>> +        assertEquals("bar", test.getProtocol());
>> +        assertEquals("0.0.0.0", test.getHost());
>> +        assertEquals(8765, test.getPort());
>> +        test = new TransportConnectorGBeanImpl(null, "vm",  
>> "localhost", -1);
>> +        assertEquals("vm://localhost", test.getUrl());
>> +        assertEquals("vm", test.getProtocol());
>> +        assertEquals("localhost", test.getHost());
>> +        assertEquals(-1, test.getPort());
>> +    }
>> +}
>> Index: modules/activemq-gbean/src/main/java/org/apache/activemq/ 
>> gbean/BrokerServiceGBean.java
>> ===================================================================
>> --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
>> BrokerServiceGBean.java	(revision
>> 0)
>> +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
>> BrokerServiceGBean.java	(revision
>> 0)
>> @@ -0,0 +1,34 @@
>> +/**
>> + *
>> + * Copyright 2005-2006 The Apache Software Foundation
>> + *
>> + *  Licensed 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.gbean;
>> +
>> +import org.apache.activemq.broker.BrokerService;
>> +import org.apache.activemq.gbean.ActiveMQBroker;
>> +
>> +/**
>> + * An interface to the ActiveMQContainerGBean for use by the
>> + * ActiveMQConnectorGBean.
>> + *
>> + * @version $Revision: 1.1.1.1 $
>> + */
>> +public interface BrokerServiceGBean extends ActiveMQBroker {
>> +	
>> +	public abstract BrokerService getBrokerContainer();	
>> +	public String getBrokerName();
>> +
>> +	
>> +}
>> \ No newline at end of file
>>
>> Property changes on:
>> modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
>> BrokerServiceGBean.java
>> ___________________________________________________________________
>> Name: svn:executable
>>   + *
>>
>> Index: modules/activemq-gbean/src/main/java/org/apache/activemq/ 
>> gbean/BrokerServiceGBeanImpl.java
>> ===================================================================
>> --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
>> BrokerServiceGBeanImpl.java	(revision
>> 0)
>> +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
>> BrokerServiceGBeanImpl.java	(revision
>> 0)
>> @@ -0,0 +1,209 @@
>> +/**
>> + *
>> + * Copyright 2005-2006 The Apache Software Foundation
>> + *
>> + *  Licensed 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.gbean;
>> +
>> +import java.net.URI;
>> +
>> +import javax.sql.DataSource;
>> +
>> +import org.apache.activemq.broker.BrokerFactory;
>> +import org.apache.activemq.broker.BrokerService;
>> +import org.apache.activemq.store.DefaultPersistenceAdapterFactory;
>> +import org.apache.commons.logging.Log;
>> +import org.apache.commons.logging.LogFactory;
>> +import org.apache.geronimo.gbean.GBeanInfo;
>> +import org.apache.geronimo.gbean.GBeanInfoBuilder;
>> +import org.apache.geronimo.gbean.GBeanLifecycle;
>> +import org.apache.geronimo.management.geronimo.JMSManager;
>> +import org.apache.geronimo.management.geronimo.NetworkConnector;
>> +import org.apache.geronimo.system.serverinfo.ServerInfo;
>> +
>> +
>> +/**
>> + * Default implementation of the ActiveMQ Message Server
>> + *
>> + * @version $Revision: 1.1.1.1 $
>> + */
>> +public class BrokerServiceGBeanImpl implements GBeanLifecycle,
>> BrokerServiceGBean {
>> +
>> +    private Log log = LogFactory.getLog(getClass().getName());
>> +
>> +    private String brokerName;
>> +    private String brokerUri;
>> +    private BrokerService brokerService;
>> +    private ServerInfo serverInfo;
>> +    private String dataDirectory;
>> +    private DataSourceReference dataSource;
>> +
>> +    private String objectName;
>> +    private JMSManager manager;
>> +
>> +    public BrokerServiceGBeanImpl() {
>> +    }
>> +
>> +    public synchronized BrokerService getBrokerContainer() {
>> +        return brokerService;
>> +    }
>> +
>> +    public synchronized void doStart() throws Exception {
>> +        	ClassLoader old = Thread.currentThread 
>> ().getContextClassLoader();
>> +        	Thread.currentThread().setContextClassLoader 
>> (BrokerServiceGBeanImpl.class.getClassLoader());
>> +        	try {
>> +    	        if (brokerService == null) {
>> +    	            brokerService = createContainer();
>> +    	        }
>> +                DefaultPersistenceAdapterFactory  
>> persistenceFactory =
>> (DefaultPersistenceAdapterFactory)
>> brokerService.getPersistenceFactory();
>> +
>> persistenceFactory.setDataDirectory(serverInfo.resolve 
>> (dataDirectory));
>> +                persistenceFactory.setDataSource((DataSource)
>> dataSource.$getResource());
>> +                brokerService.start();
>> +        	} finally {
>> +            	Thread.currentThread().setContextClassLoader(old);
>> +        	}
>> +    }
>> +
>> +    protected BrokerService createContainer() throws Exception {
>> +        if( brokerUri!=null ) {
>> +            BrokerService answer = BrokerFactory.createBroker(new
>> URI(brokerUri));
>> +            brokerName = answer.getBrokerName();
>> +            return answer;
>> +        } else {
>> +            BrokerService answer = new BrokerService();
>> +            answer.setBrokerName(brokerName);
>> +            return answer;
>> +        }
>> +    }
>> +
>> +    public synchronized void doStop() throws Exception {
>> +        if (brokerService != null) {
>> +            BrokerService temp = brokerService;
>> +            brokerService = null;
>> +            temp.stop();
>> +        }
>> +    }
>> +
>> +    public synchronized void doFail() {
>> +        if (brokerService != null) {
>> +            BrokerService temp = brokerService;
>> +            brokerService = null;
>> +            try {
>> +                temp.stop();
>> +            } catch (Exception e) {
>> +                log.info("Caught while closing due to failure: "  
>> + e, e);
>> +            }
>> +        }
>> +    }
>> +
>> +    public static final GBeanInfo GBEAN_INFO;
>> +
>> +    static {
>> +        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder 
>> ("ActiveMQ
>> Message Broker", BrokerServiceGBeanImpl.class, "JMSServer");
>> +        infoFactory.addReference("serverInfo", ServerInfo.class);
>> +        infoFactory.addAttribute("brokerName", String.class, true);
>> +        infoFactory.addAttribute("brokerUri", String.class, true);
>> +        infoFactory.addAttribute("dataDirectory", String.class,  
>> true);
>> +        infoFactory.addReference("dataSource",  
>> DataSourceReference.class);
>> +        infoFactory.addAttribute("objectName", String.class, false);
>> +        infoFactory.addReference("manager", JMSManager.class);
>> +        infoFactory.addInterface(BrokerServiceGBean.class);
>> +        // infoFactory.setConstructor(new String[]{"brokerName,  
>> brokerUri"});
>> +        GBEAN_INFO = infoFactory.getBeanInfo();
>> +    }
>> +
>> +    public static GBeanInfo getGBeanInfo() {
>> +        return GBEAN_INFO;
>> +    }
>> +
>> +	/**
>> +	 * @return Returns the brokerName.
>> +	 */
>> +	public String getBrokerName() {
>> +		return brokerName;
>> +	}
>> +
>> +    public String getBrokerUri() {
>> +        return brokerUri;
>> +    }
>> +
>> +    public void setBrokerName(String brokerName) {
>> +        this.brokerName = brokerName;
>> +    }
>> +
>> +    public void setBrokerUri(String brokerUri) {
>> +        this.brokerUri = brokerUri;
>> +    }
>> +
>> +    public ServerInfo getServerInfo() {
>> +        return serverInfo;
>> +    }
>> +
>> +    public void setServerInfo(ServerInfo serverInfo) {
>> +        this.serverInfo = serverInfo;
>> +    }
>> +
>> +    public String getDataDirectory() {
>> +        return dataDirectory;
>> +    }
>> +
>> +    public void setDataDirectory(String dataDir) {
>> +        this.dataDirectory = dataDir;
>> +    }
>> +
>> +    public DataSourceReference getDataSource() {
>> +        return dataSource;
>> +    }
>> +
>> +    public void setDataSource(DataSourceReference dataSource) {
>> +        this.dataSource = dataSource;
>> +    }
>> +
>> +    public String getObjectName() {
>> +        return objectName;
>> +    }
>> +
>> +    public boolean isStateManageable() {
>> +        return true;
>> +    }
>> +
>> +    public boolean isStatisticsProvider() {
>> +        return false; // todo: return true once stats are integrated
>> +    }
>> +
>> +    public boolean isEventProvider() {
>> +        return true;
>> +    }
>> +
>> +    public NetworkConnector[] getConnectors() {
>> +        return manager.getConnectorsForContainer(this);
>> +    }
>> +
>> +    public NetworkConnector[] getConnectors(String protocol) {
>> +        return manager.getConnectorsForContainer(this, protocol);
>> +    }
>> +
>> +    public JMSManager getManager() {
>> +        return manager;
>> +    }
>> +
>> +    public void setManager(JMSManager manager) {
>> +        this.manager = manager;
>> +    }
>> +
>> +    public void setObjectName(String objectName) {
>> +        this.objectName = objectName;
>> +    }
>> +	
>> +}
>> \ No newline at end of file
>>
>> Property changes on:
>> modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
>> BrokerServiceGBeanImpl.java
>> ___________________________________________________________________
>> Name: svn:executable
>>   + *
>>
>> Index: modules/activemq-gbean/src/main/java/org/apache/activemq/ 
>> gbean/TransportConnectorGBeanImpl.java
>> ===================================================================
>> --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
>> TransportConnectorGBeanImpl.java	(revision
>> 0)
>> +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
>> TransportConnectorGBeanImpl.java	(revision
>> 0)
>> @@ -0,0 +1,168 @@
>> +/**
>> + *
>> + * Copyright 2005-2006 The Apache Software Foundation
>> + *
>> + *  Licensed 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.gbean;
>> +
>> +import java.net.InetSocketAddress;
>> +import java.net.URI;
>> +import java.net.URISyntaxException;
>> +
>> +import org.apache.activemq.broker.TransportConnector;
>> +import org.apache.activemq.gbean.ActiveMQConnector;
>> +import org.apache.commons.logging.Log;
>> +import org.apache.commons.logging.LogFactory;
>> +import org.apache.geronimo.gbean.GBeanInfo;
>> +import org.apache.geronimo.gbean.GBeanInfoBuilder;
>> +import org.apache.geronimo.gbean.GBeanLifecycle;
>> +import org.apache.geronimo.gbean.GConstructorInfo;
>> +
>> +/**
>> + * Default implementation of the ActiveMQ connector
>> + *
>> + * @version $Revision: 1.1.1.1 $
>> + */
>> +public class TransportConnectorGBeanImpl implements GBeanLifecycle,
>> ActiveMQConnector {
>> +    private Log log = LogFactory.getLog(getClass().getName());
>> +
>> +    private TransportConnector transportConnector;
>> +    private BrokerServiceGBean brokerService;
>> +
>> +    private String protocol;
>> +    private String host;
>> +    private int port;
>> +    private String path;
>> +    private String query;
>> +    private String urlAsStarted;
>> +
>> +    public TransportConnectorGBeanImpl(BrokerServiceGBean
>> brokerService, String protocol, String host, int port) {
>> +        this.brokerService = brokerService;
>> +        this.protocol = protocol;
>> +        this.host = host;
>> +        this.port = port;
>> +    }
>> +
>> +    public String getProtocol() {
>> +        return protocol;
>> +    }
>> +
>> +    public void setProtocol(String protocol) {
>> +        this.protocol = protocol;
>> +    }
>> +
>> +    public String getHost() {
>> +        return host;
>> +    }
>> +
>> +    public void setHost(String host) {
>> +        this.host = host;
>> +    }
>> +
>> +    public int getPort() {
>> +        return port;
>> +    }
>> +
>> +    public void setPort(int port) {
>> +        this.port = port;
>> +    }
>> +
>> +    public String getPath() {
>> +        return path;
>> +    }
>> +
>> +    public void setPath(String path) {
>> +        this.path = path;
>> +    }
>> +
>> +    public String getQuery() {
>> +        return query;
>> +    }
>> +
>> +    public void setQuery(String query) {
>> +        this.query = query;
>> +    }
>> +
>> +    public String getUrl() {
>> +        try {
>> +            return new URI(protocol, null, host, port, path, query,
>> null).toString();
>> +        } catch (URISyntaxException e) {
>> +            throw new IllegalStateException("Attributes don't form a
>> valid URI: "+protocol+"://"+host+":"+port+"/"+path+"?"+query);
>> +        }
>> +    }
>> +
>> +    public InetSocketAddress getListenAddress() {
>> +        try {
>> +            return transportConnector.getServer().getSocketAddress 
>> ();
>> +        } catch (Throwable e) {
>> +            log.debug("Failure to determine ListenAddress: "+e,e);
>> +            return null;
>> +        }
>> +    }
>> +
>> +    public synchronized void doStart() throws Exception {
>> +    	ClassLoader old = Thread.currentThread 
>> ().getContextClassLoader();
>> +    	Thread.currentThread().setContextClassLoader 
>> (BrokerServiceGBeanImpl.class.getClassLoader());
>> +    	try {
>> +	        if (transportConnector == null) {
>> +                urlAsStarted = getUrl();
>> +	            transportConnector = createBrokerConnector 
>> (urlAsStarted);
>> +	            transportConnector.start();
>> +	        }
>> +    	} finally {
>> +        	Thread.currentThread().setContextClassLoader(old);
>> +    	}
>> +    }
>> +
>> +    public synchronized void doStop() throws Exception {
>> +        if (transportConnector != null) {
>> +            TransportConnector temp = transportConnector;
>> +            transportConnector = null;
>> +            temp.stop();
>> +        }
>> +    }
>> +
>> +    public synchronized void doFail() {
>> +        if (transportConnector != null) {
>> +            TransportConnector temp = transportConnector;
>> +            transportConnector = null;
>> +            try {
>> +                temp.stop();
>> +            }
>> +            catch (Exception e) {
>> +                log.info("Caught while closing due to failure: "  
>> + e, e);
>> +            }
>> +        }
>> +    }
>> +
>> +    protected TransportConnector createBrokerConnector(String url)
>> throws Exception {
>> +        return brokerService.getBrokerContainer().addConnector(url);
>> +    }
>> +
>> +    public static final GBeanInfo GBEAN_INFO;
>> +
>> +    static {
>> +        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder 
>> ("ActiveMQ
>> Transport Connector", TransportConnectorGBeanImpl.class,
>> CONNECTOR_J2EE_TYPE);
>> +        infoFactory.addAttribute("url", String.class.getName(),  
>> false);
>> +        infoFactory.addReference("brokerService",  
>> BrokerServiceGBean.class);
>> +        infoFactory.addInterface(ActiveMQConnector.class, new
>> String[]{"host","port","protocol","path","query"},
>> +                new String[]{"host","port"});
>> +        infoFactory.setConstructor(new GConstructorInfo(new
>> String[]{"brokerService", "protocol", "host", "port"}));
>> +        GBEAN_INFO = infoFactory.getBeanInfo();
>> +    }
>> +
>> +    public static GBeanInfo getGBeanInfo() {
>> +        return GBEAN_INFO;
>> +    }
>> +}
>>
>> Property changes on:
>> modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
>> TransportConnectorGBeanImpl.java
>> ___________________________________________________________________
>> Name: svn:executable
>>   + *
>>
>> Index: modules/activemq-gbean/src/main/java/org/apache/activemq/ 
>> gbean/DataSourceReference.java
>> ===================================================================
>> --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
>> DataSourceReference.java	(revision
>> 0)
>> +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
>> DataSourceReference.java	(revision
>> 0)
>> @@ -0,0 +1,21 @@
>> +/**
>> + *
>> + * Copyright 2005-2006 The Apache Software Foundation
>> + *
>> + *  Licensed 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.gbean;
>> +
>> +public interface DataSourceReference {
>> +    public Object $getResource();
>> +}
>> Index: modules/activemq-gbean/src/main/java/org/apache/activemq/ 
>> gbean/management/ActiveMQManagerGBean.java
>> ===================================================================
>> --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
>> management/ActiveMQManagerGBean.java	(revision
>> 0)
>> +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
>> management/ActiveMQManagerGBean.java	(revision
>> 0)
>> @@ -0,0 +1,266 @@
>> +/**
>> + *
>> + * Copyright 2005-2006 The Apache Software Foundation
>> + *
>> + *  Licensed 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.gbean.management;
>> +
>> +import java.util.ArrayList;
>> +import java.util.Iterator;
>> +import java.util.List;
>> +import java.util.Set;
>> +
>> +import org.apache.activemq.gbean.ActiveMQBroker;
>> +import org.apache.activemq.gbean.ActiveMQConnector;
>> +import org.apache.activemq.gbean.ActiveMQManager;
>> +import org.apache.activemq.gbean.TransportConnectorGBeanImpl;
>> +import org.apache.commons.logging.Log;
>> +import org.apache.commons.logging.LogFactory;
>> +import org.apache.geronimo.gbean.AbstractName;
>> +import org.apache.geronimo.gbean.AbstractNameQuery;
>> +import org.apache.geronimo.gbean.GBeanData;
>> +import org.apache.geronimo.gbean.GBeanInfo;
>> +import org.apache.geronimo.gbean.GBeanInfoBuilder;
>> +import org.apache.geronimo.gbean.ReferencePatterns;
>> +import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
>> +import org.apache.geronimo.kernel.GBeanNotFoundException;
>> +import org.apache.geronimo.kernel.Kernel;
>> +import org.apache.geronimo.kernel.config.ConfigurationUtil;
>> +import  
>> org.apache.geronimo.kernel.config.EditableConfigurationManager;
>> +import org.apache.geronimo.kernel.config.InvalidConfigException;
>> +import org.apache.geronimo.kernel.proxy.ProxyManager;
>> +import org.apache.geronimo.management.geronimo.JMSBroker;
>> +import org.apache.geronimo.management.geronimo.JMSConnector;
>> +import org.apache.geronimo.management.geronimo.NetworkConnector;
>> +
>> +/**
>> + * Implementation of the ActiveMQ management interface.  These  
>> are the ActiveMQ
>> + * management features available at runtime.
>> + *
>> + * @version $Revision: 1.0$
>> + */
>> +public class ActiveMQManagerGBean implements ActiveMQManager {
>> +    private static final Log log =
>> LogFactory.getLog(ActiveMQManagerGBean.class.getName());
>> +    private Kernel kernel;
>> +    private String objectName;
>> +
>> +    public ActiveMQManagerGBean(Kernel kernel, String objectName) {
>> +        this.kernel = kernel;
>> +        this.objectName = objectName;
>> +    }
>> +
>> +    public String getProductName() {
>> +        return "ActiveMQ";
>> +    }
>> +
>> +    public String getObjectName() {
>> +        return objectName;
>> +    }
>> +
>> +    public boolean isEventProvider() {
>> +        return false;
>> +    }
>> +
>> +    public boolean isStateManageable() {
>> +        return true;
>> +    }
>> +
>> +    public boolean isStatisticsProvider() {
>> +        return false;
>> +    }
>> +
>> +    public Object[] getContainers() {
>> +        ProxyManager proxyManager = kernel.getProxyManager();
>> +        AbstractNameQuery query = new
>> AbstractNameQuery(ActiveMQBroker.class.getName());
>> +        Set names = kernel.listGBeans(query);
>> +        ActiveMQBroker[] results = new ActiveMQBroker[names.size()];
>> +        int i=0;
>> +        for (Iterator it = names.iterator(); it.hasNext(); i++) {
>> +            AbstractName name = (AbstractName) it.next();
>> +            results[i] = (ActiveMQBroker)
>> proxyManager.createProxy(name, ActiveMQBroker.class.getClassLoader 
>> ());
>> +        }
>> +        return results;
>> +    }
>> +
>> +    public String[] getSupportedProtocols() {
>> +        // see files in
>> modules/core/src/conf/META-INF/services/org/activemq/transport/ 
>> server/
>> +        return new String[]{ "tcp", "stomp", "vm", "peer", "udp",
>> "multicast", "failover"};
>> +    }
>> +
>> +    public NetworkConnector[] getConnectors() {
>> +        ProxyManager proxyManager = kernel.getProxyManager();
>> +        AbstractNameQuery query = new
>> AbstractNameQuery(ActiveMQConnector.class.getName());
>> +        Set names = kernel.listGBeans(query);
>> +        ActiveMQConnector[] results = new ActiveMQConnector 
>> [names.size()];
>> +        int i=0;
>> +        for (Iterator it = names.iterator(); it.hasNext(); i++) {
>> +            AbstractName name = (AbstractName) it.next();
>> +            results[i] = (ActiveMQConnector)
>> proxyManager.createProxy(name,
>> ActiveMQConnector.class.getClassLoader());
>> +        }
>> +        return results;
>> +    }
>> +
>> +    public NetworkConnector[] getConnectors(String protocol) {
>> +        if(protocol == null) {
>> +            return getConnectors();
>> +        }
>> +        List result = new ArrayList();
>> +        ProxyManager proxyManager = kernel.getProxyManager();
>> +        AbstractNameQuery query = new
>> AbstractNameQuery(ActiveMQConnector.class.getName());
>> +        Set names = kernel.listGBeans(query);
>> +        for (Iterator it = names.iterator(); it.hasNext();) {
>> +            AbstractName name = (AbstractName) it.next();
>> +            try {
>> +                if (kernel.getAttribute(name, "protocol").equals 
>> (protocol)) {
>> +                    result.add(proxyManager.createProxy(name,
>> ActiveMQConnector.class.getClassLoader()));
>> +                }
>> +            } catch (Exception e) {
>> +                log.error("Unable to check the protocol for a  
>> connector", e);
>> +            }
>> +        }
>> +        return (ActiveMQConnector[]) result.toArray(new
>> ActiveMQConnector[names.size()]);
>> +    }
>> +
>> +    public NetworkConnector[] getConnectorsForContainer(Object  
>> broker) {
>> +        AbstractName containerName = kernel.getAbstractNameFor 
>> (broker);
>> +        ProxyManager mgr = kernel.getProxyManager();
>> +        try {
>> +            List results = new ArrayList();
>> +            AbstractNameQuery query = new
>> AbstractNameQuery(ActiveMQConnector.class.getName());
>> +            Set set = kernel.listGBeans(query); // all Jetty  
>> connectors
>> +            for (Iterator it = set.iterator(); it.hasNext();) {
>> +                AbstractName name = (AbstractName) it.next(); // a
>> single Jetty connector
>> +                GBeanData data = kernel.getGBeanData(name);
>> +                ReferencePatterns refs =
>> data.getReferencePatterns("activeMQContainer");
>> +                if (containerName.equals(refs.getAbstractName())) {
>> +                    results.add(mgr.createProxy(name,
>> ActiveMQConnector.class.getClassLoader()));
>> +                }
>> +            }
>> +            return (ActiveMQConnector[]) results.toArray(new
>> ActiveMQConnector[results.size()]);
>> +        } catch (Exception e) {
>> +            throw (IllegalArgumentException) new
>> IllegalArgumentException("Unable to look up connectors for ActiveMQ
>> broker '"+containerName).initCause(e);
>> +        }
>> +    }
>> +
>> +    public NetworkConnector[] getConnectorsForContainer(Object
>> broker, String protocol) {
>> +        if(protocol == null) {
>> +            return getConnectorsForContainer(broker);
>> +        }
>> +        AbstractName containerName = kernel.getAbstractNameFor 
>> (broker);
>> +        ProxyManager mgr = kernel.getProxyManager();
>> +        try {
>> +            List results = new ArrayList();
>> +            AbstractNameQuery query = new
>> AbstractNameQuery(ActiveMQConnector.class.getName());
>> +            Set set = kernel.listGBeans(query); // all Jetty  
>> connectors
>> +            for (Iterator it = set.iterator(); it.hasNext();) {
>> +                AbstractName name = (AbstractName) it.next(); // a
>> single Jetty connector
>> +                GBeanData data = kernel.getGBeanData(name);
>> +                ReferencePatterns refs =
>> data.getReferencePatterns("activeMQContainer");
>> +                if(containerName.equals(refs.getAbstractName())) {
>> +                    try {
>> +                        String testProtocol = (String)
>> kernel.getAttribute(name, "protocol");
>> +                        if(testProtocol != null &&
>> testProtocol.equals(protocol)) {
>> +                            results.add(mgr.createProxy(name,
>> ActiveMQConnector.class.getClassLoader()));
>> +                        }
>> +                    } catch (Exception e) {
>> +                        log.error("Unable to look up protocol for
>> connector '"+name+"'",e);
>> +                    }
>> +                    break;
>> +                }
>> +            }
>> +            return (ActiveMQConnector[]) results.toArray(new
>> ActiveMQConnector[results.size()]);
>> +        } catch (Exception e) {
>> +            throw (IllegalArgumentException)new
>> IllegalArgumentException("Unable to look up connectors for ActiveMQ
>> broker '"+containerName +"': ").initCause(e);
>> +        }
>> +    }
>> +
>> +    /**
>> +     * Creates a new connector, and returns the ObjectName for  
>> it.  Note that
>> +     * the connector may well require further customization  
>> before being fully
>> +     * functional (e.g. SSL settings for a secure connector).
>> +     */
>> +    public JMSConnector addConnector(JMSBroker broker, String
>> uniqueName, String protocol, String host, int port) {
>> +        AbstractName brokerAbstractName =  
>> kernel.getAbstractNameFor(broker);
>> +        AbstractName name =
>> kernel.getNaming().createChildName(brokerAbstractName, uniqueName,
>> NameFactory.GERONIMO_SERVICE);
>> +        GBeanData connector = new GBeanData(name,
>> TransportConnectorGBeanImpl.GBEAN_INFO);
>> +        //todo: if SSL is supported, need to add more properties or
>> use a different GBean?
>> +        connector.setAttribute("protocol", protocol);
>> +        connector.setAttribute("host", host);
>> +        connector.setAttribute("port", new Integer(port));
>> +        connector.setReferencePattern("activeMQContainer",  
>> brokerAbstractName);
>> +        EditableConfigurationManager mgr =
>> ConfigurationUtil.getEditableConfigurationManager(kernel);
>> +        if(mgr != null) {
>> +            try {
>> +
>> mgr.addGBeanToConfiguration(brokerAbstractName.getArtifact(),
>> connector, false);
>> +                return (JMSConnector)
>> kernel.getProxyManager().createProxy(name,
>> ActiveMQConnector.class.getClassLoader());
>> +            } catch (InvalidConfigException e) {
>> +                log.error("Unable to add GBean", e);
>> +                return null;
>> +            } finally {
>> +                ConfigurationUtil.releaseConfigurationManager 
>> (kernel, mgr);
>> +            }
>> +        } else {
>> +            log.warn("The ConfigurationManager in the kernel does  
>> not
>> allow editing");
>> +            return null;
>> +        }
>> +    }
>> +
>> +    public void removeConnector(AbstractName connectorName) {
>> +        try {
>> +            GBeanInfo info = kernel.getGBeanInfo(connectorName);
>> +            boolean found = false;
>> +            Set intfs = info.getInterfaces();
>> +            for (Iterator it = intfs.iterator(); it.hasNext();) {
>> +                String intf = (String) it.next();
>> +                if (intf.equals(ActiveMQConnector.class.getName 
>> ())) {
>> +                    found = true;
>> +                }
>> +            }
>> +            if (!found) {
>> +                throw new GBeanNotFoundException(connectorName);
>> +            }
>> +            EditableConfigurationManager mgr =
>> ConfigurationUtil.getEditableConfigurationManager(kernel);
>> +            if (mgr != null) {
>> +                try {
>> +
>> mgr.removeGBeanFromConfiguration(connectorName.getArtifact(),
>> connectorName);
>> +                } catch (InvalidConfigException e) {
>> +                    log.error("Unable to add GBean", e);
>> +                } finally {
>> +                    ConfigurationUtil.releaseConfigurationManager 
>> (kernel, mgr);
>> +                }
>> +            } else {
>> +                log.warn("The ConfigurationManager in the kernel  
>> does
>> not allow editing");
>> +            }
>> +        } catch (GBeanNotFoundException e) {
>> +            log.warn("No such GBean '" + connectorName + "'");
>> //todo: what if we want to remove a failed GBean?
>> +        } catch (Exception e) {
>> +            log.error(e);
>> +        }
>> +    }
>> +
>> +    public static final GBeanInfo GBEAN_INFO;
>> +
>> +    static {
>> +        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder 
>> ("ActiveMQ
>> Manager", ActiveMQManagerGBean.class);
>> +        infoFactory.addAttribute("kernel", Kernel.class, false);
>> +        infoFactory.addAttribute("objectName", String.class, false);
>> +        infoFactory.addInterface(ActiveMQManager.class);
>> +        infoFactory.setConstructor(new String[]{"kernel",  
>> "objectName"});
>> +        GBEAN_INFO = infoFactory.getBeanInfo();
>> +    }
>> +
>> +    public static GBeanInfo getGBeanInfo() {
>> +        return GBEAN_INFO;
>> +    }
>> +}
>> Index: modules/activemq-gbean/src/main/java/org/apache/activemq/ 
>> gbean/package.html
>> ===================================================================
>> --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
>> package.html	(revision
>> 0)
>> +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
>> package.html	(revision
>> 0)
>> @@ -0,0 +1,11 @@
>> +<html>
>> +<head>
>> +</head>
>> +<body>
>> +
>> +<p>
>> +	The JMS container using GBeaps for deployment in Geronimo or other
>> JSR 77/88 based containers
>> +</p>
>> +
>> +</body>
>> +</html>
>>
>> Property changes on:
>> modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
>> package.html
>> ___________________________________________________________________
>> Name: svn:executable
>>   + *
>>
>> Index: modules/activemq-gbean/pom.xml
>> ===================================================================
>> --- modules/activemq-gbean/pom.xml	(revision 0)
>> +++ modules/activemq-gbean/pom.xml	(revision 0)
>> @@ -0,0 +1,83 @@
>> +<?xml version="1.0" encoding="UTF-8"?>
>> +<!--
>> +    Copyright 2005-2006 The Apache Software Foundation
>> +
>> +    Licensed 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.
>> +-->
>> +<!-- $Rev: 411333 $ $Date: 2006-06-02 18:35:57 -0500 (Fri, 02 Jun  
>> 2006) $ -->
>> +<project
>> +  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>> http://maven.apache.org/maven-v4_0_0.xsd"
>> +  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> +  xmlns="http://maven.apache.org/POM/4.0.0">
>> +
>> +    <modelVersion>4.0.0</modelVersion>
>> +
>> +    <parent>
>> +        <groupId>org.apache.geronimo.modules</groupId>
>> +        <artifactId>modules-parent</artifactId>
>> +        <version>1.2-SNAPSHOT</version>
>> +        <relativePath>../pom.xml</relativePath>
>> +    </parent>
>> +
>> +    <artifactId>geronimo-activemq-gbean</artifactId>
>> +    <version>${geronimoVersion}</version>
>> +    <name>ActiveMQ :: GBeans</name>
>> +    <description>Geronimo ActiveMQ Integration</description>
>> +
>> +    <dependencies>
>> +
>> +      <dependency>
>> +        <groupId>incubator-activemq</groupId>
>> +        <artifactId>activemq-core</artifactId>
>> +        <version>4.0-SNAPSHOT</version>
>> +      </dependency>
>> +      <dependency>
>> +        <groupId>incubator-activemq</groupId>
>> +        <artifactId>activeio-core</artifactId>
>> +        <version>3.0-SNAPSHOT</version>
>> +      </dependency>
>> +
>> +      <dependency>
>> +        <groupId>org.apache.geronimo.modules</groupId>
>> +        <artifactId>geronimo-activemq-gbean-management</artifactId>
>> +      </dependency>
>> +      <dependency>
>> +        <groupId>org.apache.geronimo.modules</groupId>
>> +        <artifactId>geronimo-kernel</artifactId>
>> +      </dependency>
>> +      <dependency>
>> +        <groupId>org.apache.geronimo.modules</groupId>
>> +        <artifactId>geronimo-system</artifactId>
>> +      </dependency>
>> +      <dependency>
>> +        <groupId>org.apache.geronimo.modules</groupId>
>> +        <artifactId>geronimo-management</artifactId>
>> +      </dependency>
>> +      <dependency>
>> +        <groupId>org.apache.geronimo.modules</groupId>
>> +        <artifactId>geronimo-j2ee</artifactId>
>> +      </dependency>
>> +
>> +      <dependency>
>> +        <groupId>commons-logging</groupId>
>> +        <artifactId>commons-logging</artifactId>
>> +      </dependency>
>> +
>> +      <dependency>
>> +        <groupId>mx4j</groupId>
>> +        <artifactId>mx4j</artifactId>
>> +      </dependency>
>> +
>> +    </dependencies>
>> +
>> +</project>
>> Index: modules/activemq-gbean-management/project.properties
>> ===================================================================
>> --- modules/activemq-gbean-management/project.properties	(revision 0)
>> +++ modules/activemq-gbean-management/project.properties	(revision 0)
>> @@ -0,0 +1,3 @@
>> +#  
>> -------------------------------------------------------------------
>> +# Build Properties
>> +#  
>> -------------------------------------------------------------------
>>
>> Property changes on: modules/activemq-gbean-management/ 
>> project.properties
>> ___________________________________________________________________
>> Name: svn:executable
>>   + *
>>
>> Index: modules/activemq-gbean-management/project.xml
>> ===================================================================
>> --- modules/activemq-gbean-management/project.xml	(revision 0)
>> +++ modules/activemq-gbean-management/project.xml	(revision 0)
>> @@ -0,0 +1,37 @@
>> +<?xml version="1.0" encoding="ISO-8859-1"?>
>> +<!DOCTYPE project>
>> +<project>
>> +    <pomVersion>3</pomVersion>
>> +    <extend>../../etc/project.xml</extend>
>> +
>> +    <name>Geronimo :: ActiveMQ :: GBean Interfaces</name>
>> +    <id>geronimo-activemq-gbean-management</id>
>> +    <shortDescription>Geronimo / GBean management support</ 
>> shortDescription>
>> +    <description>ActiveMQ management interfaces used for integration
>> into Apache Geronimo</description>
>> +
>> +    <!-- ============ -->
>> +    <!-- Dependencies -->
>> +    <!-- ============ -->
>> +    <dependencies>
>> +
>> +        <dependency>
>> +            <groupId>geronimo</groupId>
>> +            <artifactId>geronimo-management</artifactId>
>> +            <version>${pom.currentVersion}</version>
>> +        </dependency>
>> +
>> +    </dependencies>
>> +
>> +    <!-- this module is using m2 directory layout -->
>> +    <build>
>> +        <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
>> +        <unitTestSourceDirectory>${basedir}/src/main/test</ 
>> unitTestSourceDirectory>
>> +
>> +        <unitTest>
>> +            <includes>
>> +                <include>**/*Test.java</include>
>> +            </includes>
>> +        </unitTest>
>> +    </build>
>> +
>> +</project>
>>
>> Property changes on: modules/activemq-gbean-management/project.xml
>> ___________________________________________________________________
>> Name: svn:executable
>>   + *
>>
>> Index: modules/activemq-gbean-management/src/main/java/org/apache/ 
>> activemq/gbean/ActiveMQConnector.java
>> ===================================================================
>> --- modules/activemq-gbean-management/src/main/java/org/apache/ 
>> activemq/gbean/ActiveMQConnector.java	(revision
>> 0)
>> +++ modules/activemq-gbean-management/src/main/java/org/apache/ 
>> activemq/gbean/ActiveMQConnector.java	(revision
>> 0)
>> @@ -0,0 +1,34 @@
>> +/**
>> + *
>> + * Copyright 2005-2006 The Apache Software Foundation
>> + *
>> + *  Licensed 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.gbean;
>> +
>> +import org.apache.geronimo.management.geronimo.JMSConnector;
>> +
>> +/**
>> + * The GBean interface for the ActiveMQ network connector GBean
>> + *
>> + * @version $Revision: 1.0$
>> + */
>> +public interface ActiveMQConnector extends JMSConnector {
>> +    public final static String CONNECTOR_J2EE_TYPE = "JMSConnector";
>> +
>> +    // Additional stuff you can add to an ActiveMQ connector URI
>> +    public String getPath();
>> +    public void setPath(String path);
>> +    public String getQuery();
>> +    public void setQuery(String query);
>> +}
>> Index: modules/activemq-gbean-management/src/main/java/org/apache/ 
>> activemq/gbean/ActiveMQManager.java
>> ===================================================================
>> --- modules/activemq-gbean-management/src/main/java/org/apache/ 
>> activemq/gbean/ActiveMQManager.java	(revision
>> 0)
>> +++ modules/activemq-gbean-management/src/main/java/org/apache/ 
>> activemq/gbean/ActiveMQManager.java	(revision
>> 0)
>> @@ -0,0 +1,29 @@
>> +/**
>> + *
>> + * Copyright 2005-2006 The Apache Software Foundation
>> + *
>> + *  Licensed 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.gbean;
>> +
>> +import org.apache.geronimo.management.J2EEManagedObject;
>> +import org.apache.geronimo.management.geronimo.JMSManager;
>> +
>> +/**
>> + * The GBean interface for the ActiveMQ management GBean.  This  
>> defines the
>> + * features that should be available to the management interface  
>> at runtime.
>> + *
>> + * @version $Revision: 1.0$
>> + */
>> +public interface ActiveMQManager extends JMSManager,  
>> J2EEManagedObject {
>> +}
>> Index: modules/activemq-gbean-management/src/main/java/org/apache/ 
>> activemq/gbean/ActiveMQBroker.java
>> ===================================================================
>> --- modules/activemq-gbean-management/src/main/java/org/apache/ 
>> activemq/gbean/ActiveMQBroker.java	(revision
>> 0)
>> +++ modules/activemq-gbean-management/src/main/java/org/apache/ 
>> activemq/gbean/ActiveMQBroker.java	(revision
>> 0)
>> @@ -0,0 +1,30 @@
>> +/**
>> + *
>> + * Copyright 2005-2006 The Apache Software Foundation
>> + *
>> + *  Licensed 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.gbean;
>> +
>> +import org.apache.geronimo.management.geronimo.JMSBroker;
>> +
>> +/**
>> + * The management interface for the ActiveMQ broker GBean.
>> + * This is separate from ActiveMQContainer because that interface  
>> has hard
>> + * links to code in activemq-core, yet we still want to be able to
>> + * distinguish ActiveMQ brokers from non-ActiveMQ JMS brokers.
>> + *
>> + * @version $Revision: 1.0$
>> + */
>> +public interface ActiveMQBroker extends JMSBroker {
>> +}
>> Index: modules/activemq-gbean-management/src/main/java/org/apache/ 
>> activemq/gbean/package.html
>> ===================================================================
>> --- modules/activemq-gbean-management/src/main/java/org/apache/ 
>> activemq/gbean/package.html	(revision
>> 0)
>> +++ modules/activemq-gbean-management/src/main/java/org/apache/ 
>> activemq/gbean/package.html	(revision
>> 0)
>> @@ -0,0 +1,12 @@
>> +<html>
>> +<head>
>> +</head>
>> +<body>
>> +
>> +<p>
>> +	The management API for ActiveMQ, when run in a
>> +        container like Geronimo
>> +</p>
>> +
>> +</body>
>> +</html>
>>
>> Property changes on:
>> modules/activemq-gbean-management/src/main/java/org/apache/ 
>> activemq/gbean/package.html
>> ___________________________________________________________________
>> Name: svn:executable
>>   + *
>>
>> Index: modules/activemq-gbean-management/pom.xml
>> ===================================================================
>> --- modules/activemq-gbean-management/pom.xml	(revision 0)
>> +++ modules/activemq-gbean-management/pom.xml	(revision 0)
>> @@ -0,0 +1,53 @@
>> +<?xml version="1.0" encoding="UTF-8"?>
>> +<!--
>> +    Copyright 2005-2006 The Apache Software Foundation
>> +
>> +    Licensed 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.
>> +-->
>> +<!-- $Rev: 411333 $ $Date: 2006-06-02 18:35:57 -0500 (Fri, 02 Jun  
>> 2006) $ -->
>> +<project
>> +  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>> http://maven.apache.org/maven-v4_0_0.xsd"
>> +  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> +  xmlns="http://maven.apache.org/POM/4.0.0">
>> +
>> +    <modelVersion>4.0.0</modelVersion>
>> +
>> +    <parent>
>> +        <groupId>org.apache.geronimo.modules</groupId>
>> +        <artifactId>modules-parent</artifactId>
>> +        <version>1.2-SNAPSHOT</version>
>> +        <relativePath>../pom.xml</relativePath>
>> +    </parent>
>> +
>> +    <artifactId>geronimo-activemq-gbean-management</artifactId>
>> +    <version>${geronimoVersion}</version>
>> +    <name>Geronimo :: ActiveMQ :: GBean Interfaces</name>
>> +    <description>ActiveMQ Management Interfaces used by Geronimo</ 
>> description>
>> +
>> +    <dependencies>
>> +
>> +      <dependency>
>> +          <groupId>org.apache.geronimo.modules</groupId>
>> +          <artifactId>geronimo-management</artifactId>
>> +      </dependency>
>> +      <dependency>
>> +        <groupId>backport-util-concurrent</groupId>
>> +        <artifactId>backport-util-concurrent</artifactId>
>> +      </dependency>
>> +      <dependency>
>> +        <groupId>log4j</groupId>
>> +        <artifactId>log4j</artifactId>
>> +      </dependency>
>> +
>> +   </dependencies>
>> +</project>
>>
>>
>> -- 
>> Regards,
>> Hiram
>


Re: [RTC] ActiveMQ GBean modules

Posted by David Jencks <da...@yahoo.com>.
I think that this gbean adaptation code should be in geronimo rather  
than amq.  I'm OK with applying it as is but would prefer some issues  
to be addressed first or, even better,  immediately after the  
transfer (assuming it is done with svn mv).

1. DataSourceReference should be replaced by the geronimo class that  
does the same thing, ConnectionFactorySource.

2. I think it would be preferable to get the module/configuration  
classloader in the constructor as a magic attribute and use it in  
BrokerServiceGBeanImpl.doStart rather than the classloader of  
BrokerServiceGBeanImpl.

3. Same for TransportConnectorGBeanImpl.

4. This is a question, not really an issue, about this code:
+    protected TransportConnector createBrokerConnector(String url)
throws Exception {
+        return brokerService.getBrokerContainer().addConnector(url);
+    }

To me it seems like this code is combining the functions of factory  
object and container.  Is this necessary and appropriate?  I'd be  
more comfortable with
Connector connector = ConnectorFactory.createConnector(url);
brokerService.getBrokerContainer().addConnector(connector);

I find that the combination style typically creates problems whenever  
trying to extend stuff, say by wrapping the connector.  What do you  
think?

5. hardcoding the protocols in ActiveMQManagerGBean seems like a  
temporary expedient at best.

6. javadoc on public JMSConnector addConnector( ... in the manager  
gbean seems wrong... does not appear to return an object name.

7. Typo and innaccuracies in the first package.html... this stuff is  
only going to work in geronimo, jsr77/88 is not enough.

8. I'm not sure exactly what our official policy is but I prefer to  
remove "public" from methods in interfaces since it is the only  
choice and implied.

+1 if the above are addressed before or right after commit.  I only  
insist on (1), the others are more like suggestions.

thanks
david jencks





On Jun 5, 2006, at 4:19 PM, Hiram Chirino wrote:

> Howdy folks,
>
> Here's  a patch that brings in the activemq gbean modules into
> geronimo.  It's partly what was in activemq 4.x and integrated into
> geronimo 1.2-dead merged with the changes in the 3.x branch.
>
> It compiles at least and looks like a reasonable start.  Once further
> integration work gets done we may need to tweak a little more.  here's
> my +1 got get this committed.  I guess I just need 3 more.
>
>
> Index: modules/activemq-gbean/project.properties
> ===================================================================
> --- modules/activemq-gbean/project.properties	(revision 0)
> +++ modules/activemq-gbean/project.properties	(revision 0)
> @@ -0,0 +1,3 @@
> +# -------------------------------------------------------------------
> +# Build Properties
> +# -------------------------------------------------------------------
>
> Property changes on: modules/activemq-gbean/project.properties
> ___________________________________________________________________
> Name: svn:executable
>   + *
>
> Index: modules/activemq-gbean/project.xml
> ===================================================================
> --- modules/activemq-gbean/project.xml	(revision 0)
> +++ modules/activemq-gbean/project.xml	(revision 0)
> @@ -0,0 +1,104 @@
> +<?xml version="1.0" encoding="ISO-8859-1"?>
> +<!--
> +
> +    Copyright 2004 The Apache Software Foundation
> +
> +    Licensed 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.
> +-->
> +<!-- $Rev: 356052 $ $Date: 2005-12-11 16:41:20 -0600 (Sun, 11 Dec  
> 2005) $ -->
> +<!DOCTYPE project>
> +<project>
> +    <pomVersion>3</pomVersion>
> +    <extend>../../etc/project.xml</extend>
> +
> +    <name>Geronimo :: ActiveMQ :: GBeans</name>
> +    <id>geronimo-activemq-gbean</id>
> +    <shortDescription>ActiveMQ Geronimo / GBean support</ 
> shortDescription>
> +    <description>ActiveMQ GBeans used for integration into Apache
> Geronimo</description>
> +
> +    <!-- ============ -->
> +    <!-- Dependencies -->
> +    <!-- ============ -->
> +    <dependencies>
> +
> +      <dependency>
> +        <groupId>incubator-activemq</groupId>
> +        <artifactId>activemq-core</artifactId>
> +        <version>4.0-SNAPSHOT</version>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>incubator-activemq</groupId>
> +        <artifactId>activeio-core</artifactId>
> +        <version>3.0-SNAPSHOT</version>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>geronimo</groupId>
> +        <artifactId>geronimo-activemq-gbean-management</artifactId>
> +        <version>${pom.currentVersion}</version>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>geronimo</groupId>
> +        <artifactId>geronimo-kernel</artifactId>
> +        <version>${pom.currentVersion}</version>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>geronimo</groupId>
> +        <artifactId>geronimo-system</artifactId>
> +        <version>${pom.currentVersion}</version>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>geronimo</groupId>
> +        <artifactId>geronimo-management</artifactId>
> +        <version>${pom.currentVersion}</version>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>geronimo</groupId>
> +        <artifactId>geronimo-j2ee</artifactId>
> +        <version>${pom.currentVersion}</version>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>mx4j</groupId>
> +        <artifactId>mx4j</artifactId>
> +        <version>${mx4j_version}</version>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>commons-logging</groupId>
> +        <artifactId>commons-logging</artifactId>
> +        <version>${commons_logging_version}</version>
> +        <url>http://jakarta.apache.org/commons/logging/</url>
> +      </dependency>
> +
> +
> +    </dependencies>
> +
> +    <!-- this module is using m2 directory layout -->
> +    <build>
> +        <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
> +        <unitTestSourceDirectory>${basedir}/src/main/test</ 
> unitTestSourceDirectory>
> +
> +        <unitTest>
> +            <includes>
> +                <include>**/*Test.java</include>
> +            </includes>
> +        </unitTest>
> +    </build>
> +
> +</project>
>
> Property changes on: modules/activemq-gbean/project.xml
> ___________________________________________________________________
> Name: svn:executable
>   + *
>
> Index: modules/activemq-gbean/src/test/java/org/apache/activemq/ 
> gbean/ConnectorTest.java
> ===================================================================
> --- modules/activemq-gbean/src/test/java/org/apache/activemq/gbean/ 
> ConnectorTest.java	(revision
> 0)
> +++ modules/activemq-gbean/src/test/java/org/apache/activemq/gbean/ 
> ConnectorTest.java	(revision
> 0)
> @@ -0,0 +1,61 @@
> +/**
> + *
> + * Copyright 2005-2006 The Apache Software Foundation
> + *
> + *  Licensed 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.gbean;
> +
> +import org.apache.activemq.gbean.TransportConnectorGBeanImpl;
> +
> +import junit.framework.TestCase;
> +
> +/**
> + * Tests to ensure that URL parsing and updating doesn't blow up
> + *
> + * @version $Revision: 1.0$
> + */
> +public class ConnectorTest extends TestCase {
> +    public TransportConnectorGBeanImpl test;
> +
> +    protected void setUp() throws Exception {
> +    }
> +
> +    public void testURLManipulation() {
> +        test = new TransportConnectorGBeanImpl(null, "foo",  
> "localhost", 1234);
> +        assertEquals("foo://localhost:1234", test.getUrl());
> +        assertEquals("foo", test.getProtocol());
> +        assertEquals("localhost", test.getHost());
> +        assertEquals(1234, test.getPort());
> +        test.setHost("0.0.0.0");
> +        assertEquals("foo://0.0.0.0:1234", test.getUrl());
> +        assertEquals("foo", test.getProtocol());
> +        assertEquals("0.0.0.0", test.getHost());
> +        assertEquals(1234, test.getPort());
> +        test.setPort(8765);
> +        assertEquals("foo://0.0.0.0:8765", test.getUrl());
> +        assertEquals("foo", test.getProtocol());
> +        assertEquals("0.0.0.0", test.getHost());
> +        assertEquals(8765, test.getPort());
> +        test.setProtocol("bar");
> +        assertEquals("bar://0.0.0.0:8765", test.getUrl());
> +        assertEquals("bar", test.getProtocol());
> +        assertEquals("0.0.0.0", test.getHost());
> +        assertEquals(8765, test.getPort());
> +        test = new TransportConnectorGBeanImpl(null, "vm",  
> "localhost", -1);
> +        assertEquals("vm://localhost", test.getUrl());
> +        assertEquals("vm", test.getProtocol());
> +        assertEquals("localhost", test.getHost());
> +        assertEquals(-1, test.getPort());
> +    }
> +}
> Index: modules/activemq-gbean/src/main/java/org/apache/activemq/ 
> gbean/BrokerServiceGBean.java
> ===================================================================
> --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> BrokerServiceGBean.java	(revision
> 0)
> +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> BrokerServiceGBean.java	(revision
> 0)
> @@ -0,0 +1,34 @@
> +/**
> + *
> + * Copyright 2005-2006 The Apache Software Foundation
> + *
> + *  Licensed 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.gbean;
> +
> +import org.apache.activemq.broker.BrokerService;
> +import org.apache.activemq.gbean.ActiveMQBroker;
> +
> +/**
> + * An interface to the ActiveMQContainerGBean for use by the
> + * ActiveMQConnectorGBean.
> + *
> + * @version $Revision: 1.1.1.1 $
> + */
> +public interface BrokerServiceGBean extends ActiveMQBroker {
> +	
> +	public abstract BrokerService getBrokerContainer();	
> +	public String getBrokerName();
> +
> +	
> +}
> \ No newline at end of file
>
> Property changes on:
> modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> BrokerServiceGBean.java
> ___________________________________________________________________
> Name: svn:executable
>   + *
>
> Index: modules/activemq-gbean/src/main/java/org/apache/activemq/ 
> gbean/BrokerServiceGBeanImpl.java
> ===================================================================
> --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> BrokerServiceGBeanImpl.java	(revision
> 0)
> +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> BrokerServiceGBeanImpl.java	(revision
> 0)
> @@ -0,0 +1,209 @@
> +/**
> + *
> + * Copyright 2005-2006 The Apache Software Foundation
> + *
> + *  Licensed 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.gbean;
> +
> +import java.net.URI;
> +
> +import javax.sql.DataSource;
> +
> +import org.apache.activemq.broker.BrokerFactory;
> +import org.apache.activemq.broker.BrokerService;
> +import org.apache.activemq.store.DefaultPersistenceAdapterFactory;
> +import org.apache.commons.logging.Log;
> +import org.apache.commons.logging.LogFactory;
> +import org.apache.geronimo.gbean.GBeanInfo;
> +import org.apache.geronimo.gbean.GBeanInfoBuilder;
> +import org.apache.geronimo.gbean.GBeanLifecycle;
> +import org.apache.geronimo.management.geronimo.JMSManager;
> +import org.apache.geronimo.management.geronimo.NetworkConnector;
> +import org.apache.geronimo.system.serverinfo.ServerInfo;
> +
> +
> +/**
> + * Default implementation of the ActiveMQ Message Server
> + *
> + * @version $Revision: 1.1.1.1 $
> + */
> +public class BrokerServiceGBeanImpl implements GBeanLifecycle,
> BrokerServiceGBean {
> +
> +    private Log log = LogFactory.getLog(getClass().getName());
> +
> +    private String brokerName;
> +    private String brokerUri;
> +    private BrokerService brokerService;
> +    private ServerInfo serverInfo;
> +    private String dataDirectory;
> +    private DataSourceReference dataSource;
> +
> +    private String objectName;
> +    private JMSManager manager;
> +
> +    public BrokerServiceGBeanImpl() {
> +    }
> +
> +    public synchronized BrokerService getBrokerContainer() {
> +        return brokerService;
> +    }
> +
> +    public synchronized void doStart() throws Exception {
> +        	ClassLoader old = Thread.currentThread 
> ().getContextClassLoader();
> +        	Thread.currentThread().setContextClassLoader 
> (BrokerServiceGBeanImpl.class.getClassLoader());
> +        	try {
> +    	        if (brokerService == null) {
> +    	            brokerService = createContainer();
> +    	        }
> +                DefaultPersistenceAdapterFactory persistenceFactory =
> (DefaultPersistenceAdapterFactory)
> brokerService.getPersistenceFactory();
> +
> persistenceFactory.setDataDirectory(serverInfo.resolve 
> (dataDirectory));
> +                persistenceFactory.setDataSource((DataSource)
> dataSource.$getResource());
> +                brokerService.start();
> +        	} finally {
> +            	Thread.currentThread().setContextClassLoader(old);
> +        	}
> +    }
> +
> +    protected BrokerService createContainer() throws Exception {
> +        if( brokerUri!=null ) {
> +            BrokerService answer = BrokerFactory.createBroker(new
> URI(brokerUri));
> +            brokerName = answer.getBrokerName();
> +            return answer;
> +        } else {
> +            BrokerService answer = new BrokerService();
> +            answer.setBrokerName(brokerName);
> +            return answer;
> +        }
> +    }
> +
> +    public synchronized void doStop() throws Exception {
> +        if (brokerService != null) {
> +            BrokerService temp = brokerService;
> +            brokerService = null;
> +            temp.stop();
> +        }
> +    }
> +
> +    public synchronized void doFail() {
> +        if (brokerService != null) {
> +            BrokerService temp = brokerService;
> +            brokerService = null;
> +            try {
> +                temp.stop();
> +            } catch (Exception e) {
> +                log.info("Caught while closing due to failure: " +  
> e, e);
> +            }
> +        }
> +    }
> +
> +    public static final GBeanInfo GBEAN_INFO;
> +
> +    static {
> +        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("ActiveMQ
> Message Broker", BrokerServiceGBeanImpl.class, "JMSServer");
> +        infoFactory.addReference("serverInfo", ServerInfo.class);
> +        infoFactory.addAttribute("brokerName", String.class, true);
> +        infoFactory.addAttribute("brokerUri", String.class, true);
> +        infoFactory.addAttribute("dataDirectory", String.class,  
> true);
> +        infoFactory.addReference("dataSource",  
> DataSourceReference.class);
> +        infoFactory.addAttribute("objectName", String.class, false);
> +        infoFactory.addReference("manager", JMSManager.class);
> +        infoFactory.addInterface(BrokerServiceGBean.class);
> +        // infoFactory.setConstructor(new String[]{"brokerName,  
> brokerUri"});
> +        GBEAN_INFO = infoFactory.getBeanInfo();
> +    }
> +
> +    public static GBeanInfo getGBeanInfo() {
> +        return GBEAN_INFO;
> +    }
> +
> +	/**
> +	 * @return Returns the brokerName.
> +	 */
> +	public String getBrokerName() {
> +		return brokerName;
> +	}
> +
> +    public String getBrokerUri() {
> +        return brokerUri;
> +    }
> +
> +    public void setBrokerName(String brokerName) {
> +        this.brokerName = brokerName;
> +    }
> +
> +    public void setBrokerUri(String brokerUri) {
> +        this.brokerUri = brokerUri;
> +    }
> +
> +    public ServerInfo getServerInfo() {
> +        return serverInfo;
> +    }
> +
> +    public void setServerInfo(ServerInfo serverInfo) {
> +        this.serverInfo = serverInfo;
> +    }
> +
> +    public String getDataDirectory() {
> +        return dataDirectory;
> +    }
> +
> +    public void setDataDirectory(String dataDir) {
> +        this.dataDirectory = dataDir;
> +    }
> +
> +    public DataSourceReference getDataSource() {
> +        return dataSource;
> +    }
> +
> +    public void setDataSource(DataSourceReference dataSource) {
> +        this.dataSource = dataSource;
> +    }
> +
> +    public String getObjectName() {
> +        return objectName;
> +    }
> +
> +    public boolean isStateManageable() {
> +        return true;
> +    }
> +
> +    public boolean isStatisticsProvider() {
> +        return false; // todo: return true once stats are integrated
> +    }
> +
> +    public boolean isEventProvider() {
> +        return true;
> +    }
> +
> +    public NetworkConnector[] getConnectors() {
> +        return manager.getConnectorsForContainer(this);
> +    }
> +
> +    public NetworkConnector[] getConnectors(String protocol) {
> +        return manager.getConnectorsForContainer(this, protocol);
> +    }
> +
> +    public JMSManager getManager() {
> +        return manager;
> +    }
> +
> +    public void setManager(JMSManager manager) {
> +        this.manager = manager;
> +    }
> +
> +    public void setObjectName(String objectName) {
> +        this.objectName = objectName;
> +    }
> +	
> +}
> \ No newline at end of file
>
> Property changes on:
> modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> BrokerServiceGBeanImpl.java
> ___________________________________________________________________
> Name: svn:executable
>   + *
>
> Index: modules/activemq-gbean/src/main/java/org/apache/activemq/ 
> gbean/TransportConnectorGBeanImpl.java
> ===================================================================
> --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> TransportConnectorGBeanImpl.java	(revision
> 0)
> +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> TransportConnectorGBeanImpl.java	(revision
> 0)
> @@ -0,0 +1,168 @@
> +/**
> + *
> + * Copyright 2005-2006 The Apache Software Foundation
> + *
> + *  Licensed 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.gbean;
> +
> +import java.net.InetSocketAddress;
> +import java.net.URI;
> +import java.net.URISyntaxException;
> +
> +import org.apache.activemq.broker.TransportConnector;
> +import org.apache.activemq.gbean.ActiveMQConnector;
> +import org.apache.commons.logging.Log;
> +import org.apache.commons.logging.LogFactory;
> +import org.apache.geronimo.gbean.GBeanInfo;
> +import org.apache.geronimo.gbean.GBeanInfoBuilder;
> +import org.apache.geronimo.gbean.GBeanLifecycle;
> +import org.apache.geronimo.gbean.GConstructorInfo;
> +
> +/**
> + * Default implementation of the ActiveMQ connector
> + *
> + * @version $Revision: 1.1.1.1 $
> + */
> +public class TransportConnectorGBeanImpl implements GBeanLifecycle,
> ActiveMQConnector {
> +    private Log log = LogFactory.getLog(getClass().getName());
> +
> +    private TransportConnector transportConnector;
> +    private BrokerServiceGBean brokerService;
> +
> +    private String protocol;
> +    private String host;
> +    private int port;
> +    private String path;
> +    private String query;
> +    private String urlAsStarted;
> +
> +    public TransportConnectorGBeanImpl(BrokerServiceGBean
> brokerService, String protocol, String host, int port) {
> +        this.brokerService = brokerService;
> +        this.protocol = protocol;
> +        this.host = host;
> +        this.port = port;
> +    }
> +
> +    public String getProtocol() {
> +        return protocol;
> +    }
> +
> +    public void setProtocol(String protocol) {
> +        this.protocol = protocol;
> +    }
> +
> +    public String getHost() {
> +        return host;
> +    }
> +
> +    public void setHost(String host) {
> +        this.host = host;
> +    }
> +
> +    public int getPort() {
> +        return port;
> +    }
> +
> +    public void setPort(int port) {
> +        this.port = port;
> +    }
> +
> +    public String getPath() {
> +        return path;
> +    }
> +
> +    public void setPath(String path) {
> +        this.path = path;
> +    }
> +
> +    public String getQuery() {
> +        return query;
> +    }
> +
> +    public void setQuery(String query) {
> +        this.query = query;
> +    }
> +
> +    public String getUrl() {
> +        try {
> +            return new URI(protocol, null, host, port, path, query,
> null).toString();
> +        } catch (URISyntaxException e) {
> +            throw new IllegalStateException("Attributes don't form a
> valid URI: "+protocol+"://"+host+":"+port+"/"+path+"?"+query);
> +        }
> +    }
> +
> +    public InetSocketAddress getListenAddress() {
> +        try {
> +            return transportConnector.getServer().getSocketAddress();
> +        } catch (Throwable e) {
> +            log.debug("Failure to determine ListenAddress: "+e,e);
> +            return null;
> +        }
> +    }
> +
> +    public synchronized void doStart() throws Exception {
> +    	ClassLoader old = Thread.currentThread().getContextClassLoader 
> ();
> +    	Thread.currentThread().setContextClassLoader 
> (BrokerServiceGBeanImpl.class.getClassLoader());
> +    	try {
> +	        if (transportConnector == null) {
> +                urlAsStarted = getUrl();
> +	            transportConnector = createBrokerConnector 
> (urlAsStarted);
> +	            transportConnector.start();
> +	        }
> +    	} finally {
> +        	Thread.currentThread().setContextClassLoader(old);
> +    	}
> +    }
> +
> +    public synchronized void doStop() throws Exception {
> +        if (transportConnector != null) {
> +            TransportConnector temp = transportConnector;
> +            transportConnector = null;
> +            temp.stop();
> +        }
> +    }
> +
> +    public synchronized void doFail() {
> +        if (transportConnector != null) {
> +            TransportConnector temp = transportConnector;
> +            transportConnector = null;
> +            try {
> +                temp.stop();
> +            }
> +            catch (Exception e) {
> +                log.info("Caught while closing due to failure: " +  
> e, e);
> +            }
> +        }
> +    }
> +
> +    protected TransportConnector createBrokerConnector(String url)
> throws Exception {
> +        return brokerService.getBrokerContainer().addConnector(url);
> +    }
> +
> +    public static final GBeanInfo GBEAN_INFO;
> +
> +    static {
> +        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("ActiveMQ
> Transport Connector", TransportConnectorGBeanImpl.class,
> CONNECTOR_J2EE_TYPE);
> +        infoFactory.addAttribute("url", String.class.getName(),  
> false);
> +        infoFactory.addReference("brokerService",  
> BrokerServiceGBean.class);
> +        infoFactory.addInterface(ActiveMQConnector.class, new
> String[]{"host","port","protocol","path","query"},
> +                new String[]{"host","port"});
> +        infoFactory.setConstructor(new GConstructorInfo(new
> String[]{"brokerService", "protocol", "host", "port"}));
> +        GBEAN_INFO = infoFactory.getBeanInfo();
> +    }
> +
> +    public static GBeanInfo getGBeanInfo() {
> +        return GBEAN_INFO;
> +    }
> +}
>
> Property changes on:
> modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> TransportConnectorGBeanImpl.java
> ___________________________________________________________________
> Name: svn:executable
>   + *
>
> Index: modules/activemq-gbean/src/main/java/org/apache/activemq/ 
> gbean/DataSourceReference.java
> ===================================================================
> --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> DataSourceReference.java	(revision
> 0)
> +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> DataSourceReference.java	(revision
> 0)
> @@ -0,0 +1,21 @@
> +/**
> + *
> + * Copyright 2005-2006 The Apache Software Foundation
> + *
> + *  Licensed 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.gbean;
> +
> +public interface DataSourceReference {
> +    public Object $getResource();
> +}
> Index: modules/activemq-gbean/src/main/java/org/apache/activemq/ 
> gbean/management/ActiveMQManagerGBean.java
> ===================================================================
> --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> management/ActiveMQManagerGBean.java	(revision
> 0)
> +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> management/ActiveMQManagerGBean.java	(revision
> 0)
> @@ -0,0 +1,266 @@
> +/**
> + *
> + * Copyright 2005-2006 The Apache Software Foundation
> + *
> + *  Licensed 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.gbean.management;
> +
> +import java.util.ArrayList;
> +import java.util.Iterator;
> +import java.util.List;
> +import java.util.Set;
> +
> +import org.apache.activemq.gbean.ActiveMQBroker;
> +import org.apache.activemq.gbean.ActiveMQConnector;
> +import org.apache.activemq.gbean.ActiveMQManager;
> +import org.apache.activemq.gbean.TransportConnectorGBeanImpl;
> +import org.apache.commons.logging.Log;
> +import org.apache.commons.logging.LogFactory;
> +import org.apache.geronimo.gbean.AbstractName;
> +import org.apache.geronimo.gbean.AbstractNameQuery;
> +import org.apache.geronimo.gbean.GBeanData;
> +import org.apache.geronimo.gbean.GBeanInfo;
> +import org.apache.geronimo.gbean.GBeanInfoBuilder;
> +import org.apache.geronimo.gbean.ReferencePatterns;
> +import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
> +import org.apache.geronimo.kernel.GBeanNotFoundException;
> +import org.apache.geronimo.kernel.Kernel;
> +import org.apache.geronimo.kernel.config.ConfigurationUtil;
> +import  
> org.apache.geronimo.kernel.config.EditableConfigurationManager;
> +import org.apache.geronimo.kernel.config.InvalidConfigException;
> +import org.apache.geronimo.kernel.proxy.ProxyManager;
> +import org.apache.geronimo.management.geronimo.JMSBroker;
> +import org.apache.geronimo.management.geronimo.JMSConnector;
> +import org.apache.geronimo.management.geronimo.NetworkConnector;
> +
> +/**
> + * Implementation of the ActiveMQ management interface.  These are  
> the ActiveMQ
> + * management features available at runtime.
> + *
> + * @version $Revision: 1.0$
> + */
> +public class ActiveMQManagerGBean implements ActiveMQManager {
> +    private static final Log log =
> LogFactory.getLog(ActiveMQManagerGBean.class.getName());
> +    private Kernel kernel;
> +    private String objectName;
> +
> +    public ActiveMQManagerGBean(Kernel kernel, String objectName) {
> +        this.kernel = kernel;
> +        this.objectName = objectName;
> +    }
> +
> +    public String getProductName() {
> +        return "ActiveMQ";
> +    }
> +
> +    public String getObjectName() {
> +        return objectName;
> +    }
> +
> +    public boolean isEventProvider() {
> +        return false;
> +    }
> +
> +    public boolean isStateManageable() {
> +        return true;
> +    }
> +
> +    public boolean isStatisticsProvider() {
> +        return false;
> +    }
> +
> +    public Object[] getContainers() {
> +        ProxyManager proxyManager = kernel.getProxyManager();
> +        AbstractNameQuery query = new
> AbstractNameQuery(ActiveMQBroker.class.getName());
> +        Set names = kernel.listGBeans(query);
> +        ActiveMQBroker[] results = new ActiveMQBroker[names.size()];
> +        int i=0;
> +        for (Iterator it = names.iterator(); it.hasNext(); i++) {
> +            AbstractName name = (AbstractName) it.next();
> +            results[i] = (ActiveMQBroker)
> proxyManager.createProxy(name, ActiveMQBroker.class.getClassLoader());
> +        }
> +        return results;
> +    }
> +
> +    public String[] getSupportedProtocols() {
> +        // see files in
> modules/core/src/conf/META-INF/services/org/activemq/transport/server/
> +        return new String[]{ "tcp", "stomp", "vm", "peer", "udp",
> "multicast", "failover"};
> +    }
> +
> +    public NetworkConnector[] getConnectors() {
> +        ProxyManager proxyManager = kernel.getProxyManager();
> +        AbstractNameQuery query = new
> AbstractNameQuery(ActiveMQConnector.class.getName());
> +        Set names = kernel.listGBeans(query);
> +        ActiveMQConnector[] results = new ActiveMQConnector 
> [names.size()];
> +        int i=0;
> +        for (Iterator it = names.iterator(); it.hasNext(); i++) {
> +            AbstractName name = (AbstractName) it.next();
> +            results[i] = (ActiveMQConnector)
> proxyManager.createProxy(name,
> ActiveMQConnector.class.getClassLoader());
> +        }
> +        return results;
> +    }
> +
> +    public NetworkConnector[] getConnectors(String protocol) {
> +        if(protocol == null) {
> +            return getConnectors();
> +        }
> +        List result = new ArrayList();
> +        ProxyManager proxyManager = kernel.getProxyManager();
> +        AbstractNameQuery query = new
> AbstractNameQuery(ActiveMQConnector.class.getName());
> +        Set names = kernel.listGBeans(query);
> +        for (Iterator it = names.iterator(); it.hasNext();) {
> +            AbstractName name = (AbstractName) it.next();
> +            try {
> +                if (kernel.getAttribute(name, "protocol").equals 
> (protocol)) {
> +                    result.add(proxyManager.createProxy(name,
> ActiveMQConnector.class.getClassLoader()));
> +                }
> +            } catch (Exception e) {
> +                log.error("Unable to check the protocol for a  
> connector", e);
> +            }
> +        }
> +        return (ActiveMQConnector[]) result.toArray(new
> ActiveMQConnector[names.size()]);
> +    }
> +
> +    public NetworkConnector[] getConnectorsForContainer(Object  
> broker) {
> +        AbstractName containerName = kernel.getAbstractNameFor 
> (broker);
> +        ProxyManager mgr = kernel.getProxyManager();
> +        try {
> +            List results = new ArrayList();
> +            AbstractNameQuery query = new
> AbstractNameQuery(ActiveMQConnector.class.getName());
> +            Set set = kernel.listGBeans(query); // all Jetty  
> connectors
> +            for (Iterator it = set.iterator(); it.hasNext();) {
> +                AbstractName name = (AbstractName) it.next(); // a
> single Jetty connector
> +                GBeanData data = kernel.getGBeanData(name);
> +                ReferencePatterns refs =
> data.getReferencePatterns("activeMQContainer");
> +                if (containerName.equals(refs.getAbstractName())) {
> +                    results.add(mgr.createProxy(name,
> ActiveMQConnector.class.getClassLoader()));
> +                }
> +            }
> +            return (ActiveMQConnector[]) results.toArray(new
> ActiveMQConnector[results.size()]);
> +        } catch (Exception e) {
> +            throw (IllegalArgumentException) new
> IllegalArgumentException("Unable to look up connectors for ActiveMQ
> broker '"+containerName).initCause(e);
> +        }
> +    }
> +
> +    public NetworkConnector[] getConnectorsForContainer(Object
> broker, String protocol) {
> +        if(protocol == null) {
> +            return getConnectorsForContainer(broker);
> +        }
> +        AbstractName containerName = kernel.getAbstractNameFor 
> (broker);
> +        ProxyManager mgr = kernel.getProxyManager();
> +        try {
> +            List results = new ArrayList();
> +            AbstractNameQuery query = new
> AbstractNameQuery(ActiveMQConnector.class.getName());
> +            Set set = kernel.listGBeans(query); // all Jetty  
> connectors
> +            for (Iterator it = set.iterator(); it.hasNext();) {
> +                AbstractName name = (AbstractName) it.next(); // a
> single Jetty connector
> +                GBeanData data = kernel.getGBeanData(name);
> +                ReferencePatterns refs =
> data.getReferencePatterns("activeMQContainer");
> +                if(containerName.equals(refs.getAbstractName())) {
> +                    try {
> +                        String testProtocol = (String)
> kernel.getAttribute(name, "protocol");
> +                        if(testProtocol != null &&
> testProtocol.equals(protocol)) {
> +                            results.add(mgr.createProxy(name,
> ActiveMQConnector.class.getClassLoader()));
> +                        }
> +                    } catch (Exception e) {
> +                        log.error("Unable to look up protocol for
> connector '"+name+"'",e);
> +                    }
> +                    break;
> +                }
> +            }
> +            return (ActiveMQConnector[]) results.toArray(new
> ActiveMQConnector[results.size()]);
> +        } catch (Exception e) {
> +            throw (IllegalArgumentException)new
> IllegalArgumentException("Unable to look up connectors for ActiveMQ
> broker '"+containerName +"': ").initCause(e);
> +        }
> +    }
> +
> +    /**
> +     * Creates a new connector, and returns the ObjectName for  
> it.  Note that
> +     * the connector may well require further customization before  
> being fully
> +     * functional (e.g. SSL settings for a secure connector).
> +     */
> +    public JMSConnector addConnector(JMSBroker broker, String
> uniqueName, String protocol, String host, int port) {
> +        AbstractName brokerAbstractName = kernel.getAbstractNameFor 
> (broker);
> +        AbstractName name =
> kernel.getNaming().createChildName(brokerAbstractName, uniqueName,
> NameFactory.GERONIMO_SERVICE);
> +        GBeanData connector = new GBeanData(name,
> TransportConnectorGBeanImpl.GBEAN_INFO);
> +        //todo: if SSL is supported, need to add more properties or
> use a different GBean?
> +        connector.setAttribute("protocol", protocol);
> +        connector.setAttribute("host", host);
> +        connector.setAttribute("port", new Integer(port));
> +        connector.setReferencePattern("activeMQContainer",  
> brokerAbstractName);
> +        EditableConfigurationManager mgr =
> ConfigurationUtil.getEditableConfigurationManager(kernel);
> +        if(mgr != null) {
> +            try {
> +
> mgr.addGBeanToConfiguration(brokerAbstractName.getArtifact(),
> connector, false);
> +                return (JMSConnector)
> kernel.getProxyManager().createProxy(name,
> ActiveMQConnector.class.getClassLoader());
> +            } catch (InvalidConfigException e) {
> +                log.error("Unable to add GBean", e);
> +                return null;
> +            } finally {
> +                ConfigurationUtil.releaseConfigurationManager 
> (kernel, mgr);
> +            }
> +        } else {
> +            log.warn("The ConfigurationManager in the kernel does not
> allow editing");
> +            return null;
> +        }
> +    }
> +
> +    public void removeConnector(AbstractName connectorName) {
> +        try {
> +            GBeanInfo info = kernel.getGBeanInfo(connectorName);
> +            boolean found = false;
> +            Set intfs = info.getInterfaces();
> +            for (Iterator it = intfs.iterator(); it.hasNext();) {
> +                String intf = (String) it.next();
> +                if (intf.equals(ActiveMQConnector.class.getName())) {
> +                    found = true;
> +                }
> +            }
> +            if (!found) {
> +                throw new GBeanNotFoundException(connectorName);
> +            }
> +            EditableConfigurationManager mgr =
> ConfigurationUtil.getEditableConfigurationManager(kernel);
> +            if (mgr != null) {
> +                try {
> +
> mgr.removeGBeanFromConfiguration(connectorName.getArtifact(),
> connectorName);
> +                } catch (InvalidConfigException e) {
> +                    log.error("Unable to add GBean", e);
> +                } finally {
> +                    ConfigurationUtil.releaseConfigurationManager 
> (kernel, mgr);
> +                }
> +            } else {
> +                log.warn("The ConfigurationManager in the kernel does
> not allow editing");
> +            }
> +        } catch (GBeanNotFoundException e) {
> +            log.warn("No such GBean '" + connectorName + "'");
> //todo: what if we want to remove a failed GBean?
> +        } catch (Exception e) {
> +            log.error(e);
> +        }
> +    }
> +
> +    public static final GBeanInfo GBEAN_INFO;
> +
> +    static {
> +        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("ActiveMQ
> Manager", ActiveMQManagerGBean.class);
> +        infoFactory.addAttribute("kernel", Kernel.class, false);
> +        infoFactory.addAttribute("objectName", String.class, false);
> +        infoFactory.addInterface(ActiveMQManager.class);
> +        infoFactory.setConstructor(new String[]{"kernel",  
> "objectName"});
> +        GBEAN_INFO = infoFactory.getBeanInfo();
> +    }
> +
> +    public static GBeanInfo getGBeanInfo() {
> +        return GBEAN_INFO;
> +    }
> +}
> Index: modules/activemq-gbean/src/main/java/org/apache/activemq/ 
> gbean/package.html
> ===================================================================
> --- modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> package.html	(revision
> 0)
> +++ modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> package.html	(revision
> 0)
> @@ -0,0 +1,11 @@
> +<html>
> +<head>
> +</head>
> +<body>
> +
> +<p>
> +	The JMS container using GBeaps for deployment in Geronimo or other
> JSR 77/88 based containers
> +</p>
> +
> +</body>
> +</html>
>
> Property changes on:
> modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/ 
> package.html
> ___________________________________________________________________
> Name: svn:executable
>   + *
>
> Index: modules/activemq-gbean/pom.xml
> ===================================================================
> --- modules/activemq-gbean/pom.xml	(revision 0)
> +++ modules/activemq-gbean/pom.xml	(revision 0)
> @@ -0,0 +1,83 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<!--
> +    Copyright 2005-2006 The Apache Software Foundation
> +
> +    Licensed 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.
> +-->
> +<!-- $Rev: 411333 $ $Date: 2006-06-02 18:35:57 -0500 (Fri, 02 Jun  
> 2006) $ -->
> +<project
> +  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd"
> +  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> +  xmlns="http://maven.apache.org/POM/4.0.0">
> +
> +    <modelVersion>4.0.0</modelVersion>
> +
> +    <parent>
> +        <groupId>org.apache.geronimo.modules</groupId>
> +        <artifactId>modules-parent</artifactId>
> +        <version>1.2-SNAPSHOT</version>
> +        <relativePath>../pom.xml</relativePath>
> +    </parent>
> +
> +    <artifactId>geronimo-activemq-gbean</artifactId>
> +    <version>${geronimoVersion}</version>
> +    <name>ActiveMQ :: GBeans</name>
> +    <description>Geronimo ActiveMQ Integration</description>
> +
> +    <dependencies>
> +
> +      <dependency>
> +        <groupId>incubator-activemq</groupId>
> +        <artifactId>activemq-core</artifactId>
> +        <version>4.0-SNAPSHOT</version>
> +      </dependency>
> +      <dependency>
> +        <groupId>incubator-activemq</groupId>
> +        <artifactId>activeio-core</artifactId>
> +        <version>3.0-SNAPSHOT</version>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>org.apache.geronimo.modules</groupId>
> +        <artifactId>geronimo-activemq-gbean-management</artifactId>
> +      </dependency>
> +      <dependency>
> +        <groupId>org.apache.geronimo.modules</groupId>
> +        <artifactId>geronimo-kernel</artifactId>
> +      </dependency>
> +      <dependency>
> +        <groupId>org.apache.geronimo.modules</groupId>
> +        <artifactId>geronimo-system</artifactId>
> +      </dependency>
> +      <dependency>
> +        <groupId>org.apache.geronimo.modules</groupId>
> +        <artifactId>geronimo-management</artifactId>
> +      </dependency>
> +      <dependency>
> +        <groupId>org.apache.geronimo.modules</groupId>
> +        <artifactId>geronimo-j2ee</artifactId>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>commons-logging</groupId>
> +        <artifactId>commons-logging</artifactId>
> +      </dependency>
> +
> +      <dependency>
> +        <groupId>mx4j</groupId>
> +        <artifactId>mx4j</artifactId>
> +      </dependency>
> +
> +    </dependencies>
> +
> +</project>
> Index: modules/activemq-gbean-management/project.properties
> ===================================================================
> --- modules/activemq-gbean-management/project.properties	(revision 0)
> +++ modules/activemq-gbean-management/project.properties	(revision 0)
> @@ -0,0 +1,3 @@
> +# -------------------------------------------------------------------
> +# Build Properties
> +# -------------------------------------------------------------------
>
> Property changes on: modules/activemq-gbean-management/ 
> project.properties
> ___________________________________________________________________
> Name: svn:executable
>   + *
>
> Index: modules/activemq-gbean-management/project.xml
> ===================================================================
> --- modules/activemq-gbean-management/project.xml	(revision 0)
> +++ modules/activemq-gbean-management/project.xml	(revision 0)
> @@ -0,0 +1,37 @@
> +<?xml version="1.0" encoding="ISO-8859-1"?>
> +<!DOCTYPE project>
> +<project>
> +    <pomVersion>3</pomVersion>
> +    <extend>../../etc/project.xml</extend>
> +
> +    <name>Geronimo :: ActiveMQ :: GBean Interfaces</name>
> +    <id>geronimo-activemq-gbean-management</id>
> +    <shortDescription>Geronimo / GBean management support</ 
> shortDescription>
> +    <description>ActiveMQ management interfaces used for integration
> into Apache Geronimo</description>
> +
> +    <!-- ============ -->
> +    <!-- Dependencies -->
> +    <!-- ============ -->
> +    <dependencies>
> +
> +        <dependency>
> +            <groupId>geronimo</groupId>
> +            <artifactId>geronimo-management</artifactId>
> +            <version>${pom.currentVersion}</version>
> +        </dependency>
> +
> +    </dependencies>
> +
> +    <!-- this module is using m2 directory layout -->
> +    <build>
> +        <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
> +        <unitTestSourceDirectory>${basedir}/src/main/test</ 
> unitTestSourceDirectory>
> +
> +        <unitTest>
> +            <includes>
> +                <include>**/*Test.java</include>
> +            </includes>
> +        </unitTest>
> +    </build>
> +
> +</project>
>
> Property changes on: modules/activemq-gbean-management/project.xml
> ___________________________________________________________________
> Name: svn:executable
>   + *
>
> Index: modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/ActiveMQConnector.java
> ===================================================================
> --- modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/ActiveMQConnector.java	(revision
> 0)
> +++ modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/ActiveMQConnector.java	(revision
> 0)
> @@ -0,0 +1,34 @@
> +/**
> + *
> + * Copyright 2005-2006 The Apache Software Foundation
> + *
> + *  Licensed 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.gbean;
> +
> +import org.apache.geronimo.management.geronimo.JMSConnector;
> +
> +/**
> + * The GBean interface for the ActiveMQ network connector GBean
> + *
> + * @version $Revision: 1.0$
> + */
> +public interface ActiveMQConnector extends JMSConnector {
> +    public final static String CONNECTOR_J2EE_TYPE = "JMSConnector";
> +
> +    // Additional stuff you can add to an ActiveMQ connector URI
> +    public String getPath();
> +    public void setPath(String path);
> +    public String getQuery();
> +    public void setQuery(String query);
> +}
> Index: modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/ActiveMQManager.java
> ===================================================================
> --- modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/ActiveMQManager.java	(revision
> 0)
> +++ modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/ActiveMQManager.java	(revision
> 0)
> @@ -0,0 +1,29 @@
> +/**
> + *
> + * Copyright 2005-2006 The Apache Software Foundation
> + *
> + *  Licensed 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.gbean;
> +
> +import org.apache.geronimo.management.J2EEManagedObject;
> +import org.apache.geronimo.management.geronimo.JMSManager;
> +
> +/**
> + * The GBean interface for the ActiveMQ management GBean.  This  
> defines the
> + * features that should be available to the management interface  
> at runtime.
> + *
> + * @version $Revision: 1.0$
> + */
> +public interface ActiveMQManager extends JMSManager,  
> J2EEManagedObject {
> +}
> Index: modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/ActiveMQBroker.java
> ===================================================================
> --- modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/ActiveMQBroker.java	(revision
> 0)
> +++ modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/ActiveMQBroker.java	(revision
> 0)
> @@ -0,0 +1,30 @@
> +/**
> + *
> + * Copyright 2005-2006 The Apache Software Foundation
> + *
> + *  Licensed 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.gbean;
> +
> +import org.apache.geronimo.management.geronimo.JMSBroker;
> +
> +/**
> + * The management interface for the ActiveMQ broker GBean.
> + * This is separate from ActiveMQContainer because that interface  
> has hard
> + * links to code in activemq-core, yet we still want to be able to
> + * distinguish ActiveMQ brokers from non-ActiveMQ JMS brokers.
> + *
> + * @version $Revision: 1.0$
> + */
> +public interface ActiveMQBroker extends JMSBroker {
> +}
> Index: modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/package.html
> ===================================================================
> --- modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/package.html	(revision
> 0)
> +++ modules/activemq-gbean-management/src/main/java/org/apache/ 
> activemq/gbean/package.html	(revision
> 0)
> @@ -0,0 +1,12 @@
> +<html>
> +<head>
> +</head>
> +<body>
> +
> +<p>
> +	The management API for ActiveMQ, when run in a
> +        container like Geronimo
> +</p>
> +
> +</body>
> +</html>
>
> Property changes on:
> modules/activemq-gbean-management/src/main/java/org/apache/activemq/ 
> gbean/package.html
> ___________________________________________________________________
> Name: svn:executable
>   + *
>
> Index: modules/activemq-gbean-management/pom.xml
> ===================================================================
> --- modules/activemq-gbean-management/pom.xml	(revision 0)
> +++ modules/activemq-gbean-management/pom.xml	(revision 0)
> @@ -0,0 +1,53 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<!--
> +    Copyright 2005-2006 The Apache Software Foundation
> +
> +    Licensed 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.
> +-->
> +<!-- $Rev: 411333 $ $Date: 2006-06-02 18:35:57 -0500 (Fri, 02 Jun  
> 2006) $ -->
> +<project
> +  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd"
> +  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> +  xmlns="http://maven.apache.org/POM/4.0.0">
> +
> +    <modelVersion>4.0.0</modelVersion>
> +
> +    <parent>
> +        <groupId>org.apache.geronimo.modules</groupId>
> +        <artifactId>modules-parent</artifactId>
> +        <version>1.2-SNAPSHOT</version>
> +        <relativePath>../pom.xml</relativePath>
> +    </parent>
> +
> +    <artifactId>geronimo-activemq-gbean-management</artifactId>
> +    <version>${geronimoVersion}</version>
> +    <name>Geronimo :: ActiveMQ :: GBean Interfaces</name>
> +    <description>ActiveMQ Management Interfaces used by Geronimo</ 
> description>
> +
> +    <dependencies>
> +
> +      <dependency>
> +          <groupId>org.apache.geronimo.modules</groupId>
> +          <artifactId>geronimo-management</artifactId>
> +      </dependency>
> +      <dependency>
> +        <groupId>backport-util-concurrent</groupId>
> +        <artifactId>backport-util-concurrent</artifactId>
> +      </dependency>
> +      <dependency>
> +        <groupId>log4j</groupId>
> +        <artifactId>log4j</artifactId>
> +      </dependency>
> +
> +   </dependencies>
> +</project>
>
>
> -- 
> Regards,
> Hiram