geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r415034 - in /geronimo/trunk/modules: activemq-gbean-management/ activemq-gbean-management/src/ activemq-gbean-management/src/main/ activemq-gbean-management/src/main/java/ activemq-gbean-management/src/main/java/org/ activemq-gbean-managem...
Date Sat, 17 Jun 2006 17:37:22 GMT
Author: chirino
Date: Sat Jun 17 10:37:21 2006
New Revision: 415034

URL: http://svn.apache.org/viewvc?rev=415034&view=rev
Log:
GERONIMO-2132

Added:
    geronimo/trunk/modules/activemq-gbean/
    geronimo/trunk/modules/activemq-gbean-management/
    geronimo/trunk/modules/activemq-gbean-management/pom.xml
    geronimo/trunk/modules/activemq-gbean-management/project.properties   (with props)
    geronimo/trunk/modules/activemq-gbean-management/project.xml   (with props)
    geronimo/trunk/modules/activemq-gbean-management/src/
    geronimo/trunk/modules/activemq-gbean-management/src/main/
    geronimo/trunk/modules/activemq-gbean-management/src/main/java/
    geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/
    geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/activemq/
    geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/
    geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/
    geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/
    geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQBroker.java
    geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQConnector.java
    geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQManager.java
    geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/package.html   (with props)
    geronimo/trunk/modules/activemq-gbean/pom.xml
    geronimo/trunk/modules/activemq-gbean/project.properties   (with props)
    geronimo/trunk/modules/activemq-gbean/project.xml   (with props)
    geronimo/trunk/modules/activemq-gbean/src/
    geronimo/trunk/modules/activemq-gbean/src/main/
    geronimo/trunk/modules/activemq-gbean/src/main/java/
    geronimo/trunk/modules/activemq-gbean/src/main/java/org/
    geronimo/trunk/modules/activemq-gbean/src/main/java/org/activemq/
    geronimo/trunk/modules/activemq-gbean/src/main/java/org/activemq/gbean/
    geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/
    geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/
    geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/
    geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBean.java   (with props)
    geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBeanImpl.java   (with props)
    geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/DataSourceReference.java
    geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/TransportConnectorGBeanImpl.java   (with props)
    geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/management/
    geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/management/ActiveMQManagerGBean.java
    geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/package.html   (with props)
    geronimo/trunk/modules/activemq-gbean/src/test/
    geronimo/trunk/modules/activemq-gbean/src/test/java/
    geronimo/trunk/modules/activemq-gbean/src/test/java/org/
    geronimo/trunk/modules/activemq-gbean/src/test/java/org/activemq/
    geronimo/trunk/modules/activemq-gbean/src/test/java/org/apache/
    geronimo/trunk/modules/activemq-gbean/src/test/java/org/apache/activemq/
    geronimo/trunk/modules/activemq-gbean/src/test/java/org/apache/activemq/gbean/
    geronimo/trunk/modules/activemq-gbean/src/test/java/org/apache/activemq/gbean/ConnectorTest.java

Added: geronimo/trunk/modules/activemq-gbean-management/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/activemq-gbean-management/pom.xml?rev=415034&view=auto
==============================================================================
--- geronimo/trunk/modules/activemq-gbean-management/pom.xml (added)
+++ geronimo/trunk/modules/activemq-gbean-management/pom.xml Sat Jun 17 10:37:21 2006
@@ -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>

Added: geronimo/trunk/modules/activemq-gbean-management/project.properties
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/activemq-gbean-management/project.properties?rev=415034&view=auto
==============================================================================
--- geronimo/trunk/modules/activemq-gbean-management/project.properties (added)
+++ geronimo/trunk/modules/activemq-gbean-management/project.properties Sat Jun 17 10:37:21 2006
@@ -0,0 +1,3 @@
+# -------------------------------------------------------------------
+# Build Properties
+# -------------------------------------------------------------------

Propchange: geronimo/trunk/modules/activemq-gbean-management/project.properties
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/trunk/modules/activemq-gbean-management/project.xml
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/activemq-gbean-management/project.xml?rev=415034&view=auto
==============================================================================
--- geronimo/trunk/modules/activemq-gbean-management/project.xml (added)
+++ geronimo/trunk/modules/activemq-gbean-management/project.xml Sat Jun 17 10:37:21 2006
@@ -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>

Propchange: geronimo/trunk/modules/activemq-gbean-management/project.xml
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQBroker.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQBroker.java?rev=415034&view=auto
==============================================================================
--- geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQBroker.java (added)
+++ geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQBroker.java Sat Jun 17 10:37:21 2006
@@ -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 {
+}

Added: geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQConnector.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQConnector.java?rev=415034&view=auto
==============================================================================
--- geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQConnector.java (added)
+++ geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQConnector.java Sat Jun 17 10:37:21 2006
@@ -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);
+}

Added: geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQManager.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQManager.java?rev=415034&view=auto
==============================================================================
--- geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQManager.java (added)
+++ geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/ActiveMQManager.java Sat Jun 17 10:37:21 2006
@@ -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 {
+}

Added: geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/package.html
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/package.html?rev=415034&view=auto
==============================================================================
--- geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/package.html (added)
+++ geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/package.html Sat Jun 17 10:37:21 2006
@@ -0,0 +1,12 @@
+<html>
+<head>
+</head>
+<body>
+
+<p>
+	The management API for ActiveMQ, when run in a
+        container like Geronimo
+</p>
+
+</body>
+</html>

Propchange: geronimo/trunk/modules/activemq-gbean-management/src/main/java/org/apache/activemq/gbean/package.html
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/trunk/modules/activemq-gbean/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/activemq-gbean/pom.xml?rev=415034&view=auto
==============================================================================
--- geronimo/trunk/modules/activemq-gbean/pom.xml (added)
+++ geronimo/trunk/modules/activemq-gbean/pom.xml Sat Jun 17 10:37:21 2006
@@ -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>

Added: geronimo/trunk/modules/activemq-gbean/project.properties
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/activemq-gbean/project.properties?rev=415034&view=auto
==============================================================================
--- geronimo/trunk/modules/activemq-gbean/project.properties (added)
+++ geronimo/trunk/modules/activemq-gbean/project.properties Sat Jun 17 10:37:21 2006
@@ -0,0 +1,3 @@
+# -------------------------------------------------------------------
+# Build Properties
+# -------------------------------------------------------------------

Propchange: geronimo/trunk/modules/activemq-gbean/project.properties
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/trunk/modules/activemq-gbean/project.xml
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/activemq-gbean/project.xml?rev=415034&view=auto
==============================================================================
--- geronimo/trunk/modules/activemq-gbean/project.xml (added)
+++ geronimo/trunk/modules/activemq-gbean/project.xml Sat Jun 17 10:37:21 2006
@@ -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>

Propchange: geronimo/trunk/modules/activemq-gbean/project.xml
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBean.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBean.java?rev=415034&view=auto
==============================================================================
--- geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBean.java (added)
+++ geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBean.java Sat Jun 17 10:37:21 2006
@@ -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

Propchange: geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBean.java
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBeanImpl.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBeanImpl.java?rev=415034&view=auto
==============================================================================
--- geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBeanImpl.java (added)
+++ geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBeanImpl.java Sat Jun 17 10:37:21 2006
@@ -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

Propchange: geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBeanImpl.java
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/DataSourceReference.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/DataSourceReference.java?rev=415034&view=auto
==============================================================================
--- geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/DataSourceReference.java (added)
+++ geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/DataSourceReference.java Sat Jun 17 10:37:21 2006
@@ -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();
+}

Added: geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/TransportConnectorGBeanImpl.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/TransportConnectorGBeanImpl.java?rev=415034&view=auto
==============================================================================
--- geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/TransportConnectorGBeanImpl.java (added)
+++ geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/TransportConnectorGBeanImpl.java Sat Jun 17 10:37:21 2006
@@ -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;
+    }
+}

Propchange: geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/TransportConnectorGBeanImpl.java
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/management/ActiveMQManagerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/management/ActiveMQManagerGBean.java?rev=415034&view=auto
==============================================================================
--- geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/management/ActiveMQManagerGBean.java (added)
+++ geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/management/ActiveMQManagerGBean.java Sat Jun 17 10:37:21 2006
@@ -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;
+    }
+}

Added: geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/package.html
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/package.html?rev=415034&view=auto
==============================================================================
--- geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/package.html (added)
+++ geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/package.html Sat Jun 17 10:37:21 2006
@@ -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>

Propchange: geronimo/trunk/modules/activemq-gbean/src/main/java/org/apache/activemq/gbean/package.html
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/trunk/modules/activemq-gbean/src/test/java/org/apache/activemq/gbean/ConnectorTest.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/activemq-gbean/src/test/java/org/apache/activemq/gbean/ConnectorTest.java?rev=415034&view=auto
==============================================================================
--- geronimo/trunk/modules/activemq-gbean/src/test/java/org/apache/activemq/gbean/ConnectorTest.java (added)
+++ geronimo/trunk/modules/activemq-gbean/src/test/java/org/apache/activemq/gbean/ConnectorTest.java Sat Jun 17 10:37:21 2006
@@ -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());
+    }
+}



Mime
View raw message