activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1444965 - in /activemq/activemq-apollo/trunk: apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ apollo-jmx/src/main/resources/META-INF/services/org.apache.activemq.apol...
Date Mon, 11 Feb 2013 21:21:45 GMT
Author: chirino
Date: Mon Feb 11 21:21:44 2013
New Revision: 1444965

URL: http://svn.apache.org/r1444965
Log:
Have the JMX module actually register an MBean in JMX when the <jmx/> element is defined
in apollo config file.

Added:
    activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/META-INF/services/org.apache.activemq.apollo/custom-service-factory.index
    activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index
    activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/org/
    activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/org/apache/
    activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/org/apache/activemq/
    activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/org/apache/activemq/apollo/
    activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/org/apache/activemq/apollo/broker/
    activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/org/apache/activemq/apollo/broker/jmx/
    activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/org/apache/activemq/apollo/broker/jmx/dto/
    activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/org/apache/activemq/apollo/broker/jmx/dto/jaxb.index
    activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JMXSystemServiceFactory.scala
    activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/dto/
    activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/dto/JmxDTO.java
    activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/dto/Module.scala
      - copied, changed from r1444553, activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxWebModule.scala
    activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/dto/package-info.java
      - copied, changed from r1444553, activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxWebModule.scala
    activemq/activemq-apollo/trunk/apollo-jmx/src/test/resources/apollo-jmx.xml
    activemq/activemq-apollo/trunk/apollo-jmx/src/test/scala/
    activemq/activemq-apollo/trunk/apollo-jmx/src/test/scala/org/
    activemq/activemq-apollo/trunk/apollo-jmx/src/test/scala/org/apache/
    activemq/activemq-apollo/trunk/apollo-jmx/src/test/scala/org/apache/activemq/
    activemq/activemq-apollo/trunk/apollo-jmx/src/test/scala/org/apache/activemq/apollo/
    activemq/activemq-apollo/trunk/apollo-jmx/src/test/scala/org/apache/activemq/apollo/broker/
    activemq/activemq-apollo/trunk/apollo-jmx/src/test/scala/org/apache/activemq/apollo/broker/jmx/
    activemq/activemq-apollo/trunk/apollo-jmx/src/test/scala/org/apache/activemq/apollo/broker/jmx/JmxTest.scala
Modified:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
    activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
    activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxResource.scala
    activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxWebModule.scala

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala?rev=1444965&r1=1444964&r2=1444965&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
Mon Feb 11 21:21:44 2013
@@ -321,7 +321,7 @@ class Broker() extends BaseService with 
 
   val dispatch_queue = createQueue("broker")
 
-  def id = "default"
+  var id = "default"
 
   val connection_id_counter = new LongCounter
 
@@ -370,6 +370,7 @@ class Broker() extends BaseService with 
   override def _start(on_completed:Task) = {
 
     // create the runtime objects from the config
+    this.id = Option(config.id).getOrElse("default")
     init_logs
     log_versions
     check_file_limit
@@ -666,6 +667,14 @@ class Broker() extends BaseService with 
 
   }
 
+  def web_admin_url = {
+    if( config.web_admins.isEmpty ) {
+      null
+    } else {
+      config.web_admins.get(0).bind
+    }
+  }
+
   private def log_versions = {
     val location_info = Option(System.getProperty("apollo.home")).map { home=>
       " (at: "+new File(home).getCanonicalPath+")"

Modified: activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java?rev=1444965&r1=1444964&r2=1444965&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
(original)
+++ activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
Mon Feb 11 21:21:44 2013
@@ -32,6 +32,9 @@ import java.util.List;
 @JsonIgnoreProperties(ignoreUnknown = true)
 public class BrokerDTO {
 
+    @XmlAttribute
+    public String id;
+
     /**
      * Used to store any configuration notes.
      */

Added: activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/META-INF/services/org.apache.activemq.apollo/custom-service-factory.index
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/META-INF/services/org.apache.activemq.apollo/custom-service-factory.index?rev=1444965&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/META-INF/services/org.apache.activemq.apollo/custom-service-factory.index
(added)
+++ activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/META-INF/services/org.apache.activemq.apollo/custom-service-factory.index
Mon Feb 11 21:21:44 2013
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+org.apache.activemq.apollo.broker.jmx.JMXSystemServiceFactory
\ No newline at end of file

Added: activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index?rev=1444965&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index
(added)
+++ activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index
Mon Feb 11 21:21:44 2013
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+org.apache.activemq.apollo.broker.jmx.dto.Module
\ No newline at end of file

Added: activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/org/apache/activemq/apollo/broker/jmx/dto/jaxb.index
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/org/apache/activemq/apollo/broker/jmx/dto/jaxb.index?rev=1444965&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/org/apache/activemq/apollo/broker/jmx/dto/jaxb.index
(added)
+++ activemq/activemq-apollo/trunk/apollo-jmx/src/main/resources/org/apache/activemq/apollo/broker/jmx/dto/jaxb.index
Mon Feb 11 21:21:44 2013
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+JmxDTO

Added: activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JMXSystemServiceFactory.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JMXSystemServiceFactory.scala?rev=1444965&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JMXSystemServiceFactory.scala
(added)
+++ activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JMXSystemServiceFactory.scala
Mon Feb 11 21:21:44 2013
@@ -0,0 +1,78 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.apollo.broker.jmx
+
+import java.lang.management.ManagementFactory
+import javax.management.ObjectName
+import org.apache.activemq.apollo.broker.jmx.dto.JmxDTO
+import org.apache.activemq.apollo.broker.{CustomServiceFactory, Broker}
+import org.apache.activemq.apollo.dto.CustomServiceDTO
+import org.apache.activemq.apollo.util.{Log, OptionSupport, BaseService, Service}
+import org.fusesource.hawtdispatch._
+
+/**
+ */
+class JMXSystemServiceFactory extends CustomServiceFactory {
+  def create(broker: Broker, dto: CustomServiceDTO): Service = {
+    dto match {
+      case dto:JmxDTO => new JMXSystemService(broker, dto)
+      case _ => null
+    }
+  }
+}
+
+object JMXSystemService extends Log
+class JMXSystemService(val broker: Broker, val config:JmxDTO) extends BaseService {
+
+  import JMXSystemService._
+
+  val dispatch_queue: DispatchQueue = createQueue("JMXSystemService")
+
+  def enabled = OptionSupport(config.enabled).getOrElse(true)
+  def broker_object_name = new ObjectName("org.apache.apollo:type=broker,name="+ObjectName.quote(broker.id));
+
+  protected def _start(on_completed: Task) = {
+    if ( enabled && platform_mbean_server!=null ) {
+      platform_mbean_server.registerMBean(new JmxBroker(broker), broker_object_name)
+      info("Registered Broker in JMX")
+    }
+    on_completed.run()
+  }
+
+  protected def _stop(on_completed: Task) = {
+    if ( enabled && platform_mbean_server!=null ) {
+      platform_mbean_server.unregisterMBean(broker_object_name)
+      info("Unregistered Broker from JMX")
+    }
+    on_completed.run()
+  }
+
+  def platform_mbean_server = ManagementFactory.getPlatformMBeanServer()
+
+}
+
+trait JmxBrokerMBean {
+  def getVersion:String
+  def getState:String
+  def getWebAdminUrl:String
+}
+
+class JmxBroker(val broker: Broker) extends JmxBrokerMBean {
+  def getVersion = Broker.version
+  def getState = broker.service_state.toString
+  def getWebAdminUrl = broker.web_admin_url
+}

Modified: activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxResource.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxResource.scala?rev=1444965&r1=1444964&r2=1444965&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxResource.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxResource.scala
Mon Feb 11 21:21:44 2013
@@ -35,9 +35,13 @@ import org.fusesource.hawtdispatch._
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
 
+@Path("/hawtio/jolokia")
+@Produces(Array(APPLICATION_JSON))
+class JolokiaResource extends JmxResource
+
 @Path("/jmx")
 @Produces(Array(APPLICATION_JSON))
-case class JmxResource()extends Resource() {
+class JmxResource extends Resource {
 
   @GET @Path("{path:.*}")
   def get(@Context ctx:ServletContext, @Context req:HttpServletRequest, @Context resp:HttpServletResponse,
@PathParam("path") path:String) = invoke(ctx, req, resp, path)

Modified: activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxWebModule.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxWebModule.scala?rev=1444965&r1=1444964&r2=1444965&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxWebModule.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxWebModule.scala
Mon Feb 11 21:21:44 2013
@@ -18,12 +18,14 @@ package org.apache.activemq.apollo.broke
 
 import org.apache.activemq.apollo.web.WebModule
 
+
 /**
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
 
 object JmxWebModule  extends WebModule {
   override def web_resources = Set(
-    classOf[JmxResource]
+    classOf[JmxResource],
+    classOf[JolokiaResource]
   )
 }
\ No newline at end of file

Added: activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/dto/JmxDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/dto/JmxDTO.java?rev=1444965&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/dto/JmxDTO.java
(added)
+++ activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/dto/JmxDTO.java
Mon Feb 11 21:21:44 2013
@@ -0,0 +1,62 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.apollo.broker.jmx.dto;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import org.apache.activemq.apollo.dto.CustomServiceDTO;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+@XmlRootElement(name="jmx")
+@XmlAccessorType(XmlAccessType.FIELD)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class JmxDTO extends CustomServiceDTO {
+
+    /**
+     * Should the broker be listed in JMX.  Defaults to true.
+     */
+    @XmlAttribute
+    public Boolean enabled;
+
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof JmxDTO)) return false;
+        if (!super.equals(o)) return false;
+
+        JmxDTO jmxDTO = (JmxDTO) o;
+
+        if (enabled != null ? !enabled.equals(jmxDTO.enabled) : jmxDTO.enabled != null)
+            return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = super.hashCode();
+        result = 31 * result + (enabled != null ? enabled.hashCode() : 0);
+        return result;
+    }
+}
\ No newline at end of file

Copied: activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/dto/Module.scala
(from r1444553, activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxWebModule.scala)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/dto/Module.scala?p2=activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/dto/Module.scala&p1=activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxWebModule.scala&r1=1444553&r2=1444965&rev=1444965&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxWebModule.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/dto/Module.scala
Mon Feb 11 21:21:44 2013
@@ -14,16 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.activemq.apollo.broker.jmx
+package org.apache.activemq.apollo.broker.jmx.dto
 
-import org.apache.activemq.apollo.web.WebModule
+import org.apache.activemq.apollo.util.DtoModule
 
 /**
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
-
-object JmxWebModule  extends WebModule {
-  override def web_resources = Set(
-    classOf[JmxResource]
-  )
+class Module extends DtoModule {
+  def dto_package = "org.apache.activemq.apollo.broker.jmx.dto"
+  def extension_classes = Array(classOf[JmxDTO])
 }
\ No newline at end of file

Copied: activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/dto/package-info.java
(from r1444553, activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxWebModule.scala)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/dto/package-info.java?p2=activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/dto/package-info.java&p1=activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxWebModule.scala&r1=1444553&r2=1444965&rev=1444965&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/JmxWebModule.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-jmx/src/main/scala/org/apache/activemq/apollo/broker/jmx/dto/package-info.java
Mon Feb 11 21:21:44 2013
@@ -14,16 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.activemq.apollo.broker.jmx
 
-import org.apache.activemq.apollo.web.WebModule
 
 /**
- * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ * The JAXB POJOs for the
+ * <a href="http://activemq.apache.org/schema/activemq/apollo/xml-configuration.html">XML
Configuration</a>
+ * of the ActiveMQ Broker.
  */
+@javax.xml.bind.annotation.XmlSchema(
+        namespace = "http://activemq.apache.org/schema/activemq/apollo",
+        elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.apache.activemq.apollo.broker.jmx.dto;
 
-object JmxWebModule  extends WebModule {
-  override def web_resources = Set(
-    classOf[JmxResource]
-  )
-}
\ No newline at end of file

Added: activemq/activemq-apollo/trunk/apollo-jmx/src/test/resources/apollo-jmx.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jmx/src/test/resources/apollo-jmx.xml?rev=1444965&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jmx/src/test/resources/apollo-jmx.xml (added)
+++ activemq/activemq-apollo/trunk/apollo-jmx/src/test/resources/apollo-jmx.xml Mon Feb 11
21:21:44 2013
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<broker xmlns="http://activemq.apache.org/schema/activemq/apollo">
+  <notes>This broker configuration is what the unit tests in this module load up.</notes>
+
+  <virtual_host id="default" purge_on_startup="true" auto_create_queues="true">
+    <host_name>localhost</host_name>
+    <host_name>127.0.0.1</host_name>
+
+    <queue name="unified.**" unified="true"/>
+    <topic id="queued.**" slow_consumer_policy="queue">
+      <subscription tail_buffer="4k"/>
+    </topic>
+
+  </virtual_host>
+
+  <!--<web_admin bind="http://0.0.0.0:61680"/>-->
+  <jmx/>
+  <connector id="tcp" bind="tcp://0.0.0.0:0"/>
+
+</broker>
\ No newline at end of file

Added: activemq/activemq-apollo/trunk/apollo-jmx/src/test/scala/org/apache/activemq/apollo/broker/jmx/JmxTest.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jmx/src/test/scala/org/apache/activemq/apollo/broker/jmx/JmxTest.scala?rev=1444965&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jmx/src/test/scala/org/apache/activemq/apollo/broker/jmx/JmxTest.scala
(added)
+++ activemq/activemq-apollo/trunk/apollo-jmx/src/test/scala/org/apache/activemq/apollo/broker/jmx/JmxTest.scala
Mon Feb 11 21:21:44 2013
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.apollo.broker.jmx
+
+import java.lang.String
+import java.util.concurrent.TimeUnit._
+import org.apache.activemq.apollo.broker._
+import org.apache.activemq.apollo.util._
+import org.scalatest.BeforeAndAfterEach
+import org.scalatest.matchers.ShouldMatchers
+import java.lang.management.ManagementFactory
+import javax.management.ObjectName
+import org.apache.activemq.apollo.util.OptionSupport.AnyToOption
+
+class JmxTest extends BrokerFunSuiteSupport with ShouldMatchers with BeforeAndAfterEach with
Logging {
+
+  override def broker_config_uri = "xml:classpath:apollo-jmx.xml"
+
+  def platform_mbean_server = ManagementFactory.getPlatformMBeanServer()
+
+  test("Broker registered") {
+    val version = platform_mbean_server.getAttribute(new ObjectName("org.apache.apollo:type=broker,name=\"default\""),
"Version")
+    info should not be(null)
+    info should not be(Broker.version)
+  }
+}



Mime
View raw message