activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1441064 - in /activemq/trunk: activemq-karaf/src/main/resources/ activemq-web-console/ activemq-web-console/src/main/java/org/apache/activemq/web/ activemq-web-console/src/main/java/org/apache/activemq/web/config/ activemq-web-console/src/...
Date Thu, 31 Jan 2013 16:59:49 GMT
Author: dejanb
Date: Thu Jan 31 16:59:49 2013
New Revision: 1441064

URL: http://svn.apache.org/viewvc?rev=1441064&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-4034 - osgi web console, laying down foundations
for config admin configuration

Added:
    activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/config/
    activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/config/OsgiConfiguration.java
    activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-osgi.xml
Modified:
    activemq/trunk/activemq-karaf/src/main/resources/features.xml
    activemq/trunk/activemq-web-console/pom.xml
    activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/WebConsoleStarter.java
    activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java

Modified: activemq/trunk/activemq-karaf/src/main/resources/features.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-karaf/src/main/resources/features.xml?rev=1441064&r1=1441063&r2=1441064&view=diff
==============================================================================
--- activemq/trunk/activemq-karaf/src/main/resources/features.xml (original)
+++ activemq/trunk/activemq-karaf/src/main/resources/features.xml Thu Jan 31 16:59:49 2013
@@ -66,7 +66,6 @@
         <bundle>mvn:org.apache.activemq/activemq-karaf/${project.version}</bundle>
         <bundle dependency="true">mvn:org.scala-lang/scala-library/${scala-version}</bundle>
         <feature version="${project.version}">activemq-http</feature>
-        <feature version="${project.version}">activemq-web-console</feature>
     </feature>
 
     <feature name="activemq-http" version="${project.version}" resolver="(obr)" start-level="50">
@@ -90,6 +89,7 @@
 
     <feature name="activemq-web-console" version="${project.version}" resolver="(obr)"
start-level="50">
       <feature>war</feature>
+      <feature>eventadmin</feature>
       <bundle>mvn:org.apache.activemq/activemq-web-console/${project.version}/war</bundle>
     </feature>
 

Modified: activemq/trunk/activemq-web-console/pom.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/pom.xml?rev=1441064&r1=1441063&r2=1441064&view=diff
==============================================================================
--- activemq/trunk/activemq-web-console/pom.xml (original)
+++ activemq/trunk/activemq-web-console/pom.xml Thu Jan 31 16:59:49 2013
@@ -141,6 +141,8 @@
               javax.management,
               javax.management.openmbean,
               javax.net,
+              org.osgi.framework,
+              org.osgi.service.cm,
               org.apache.commons.logging;version="[1.1,2)";resolution:=optional,
               org.slf4j;version="[1.6,2)";resolution:=optional,
               org.slf4j.spi;version="[1.6,2)";resolution:=optional,
@@ -270,11 +272,19 @@
       <scope>test</scope>
     </dependency>
 
-    <!-- Derby SQL DB used for testing JDBC message store -->
     <dependency>
-      <groupId>org.apache.derby</groupId>
-      <artifactId>derby</artifactId>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.compendium</artifactId>
+      <version>4.2.0</version>
+      <scope>provided</scope>
     </dependency>
+
   </dependencies>
 
 </project>

Modified: activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/WebConsoleStarter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/WebConsoleStarter.java?rev=1441064&r1=1441063&r2=1441064&view=diff
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/WebConsoleStarter.java
(original)
+++ activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/WebConsoleStarter.java
Thu Jan 31 16:59:49 2013
@@ -16,17 +16,26 @@
  */
 package org.apache.activemq.web;
 
+import javax.imageio.spi.ServiceRegistry;
 import javax.jms.ConnectionFactory;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
 
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.cm.ManagedService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.web.context.WebApplicationContext;
 import org.springframework.web.context.support.WebApplicationContextUtils;
 import org.springframework.web.context.support.XmlWebApplicationContext;
 
+import java.util.Dictionary;
+import java.util.Hashtable;
+
 /**
  * Starts the WebConsole.
  * 
@@ -48,7 +57,15 @@ public class WebConsoleStarter implement
     }
 
     private WebApplicationContext createWebapplicationContext(ServletContext servletContext)
{
+
         String webconsoleType = System.getProperty("webconsole.type", "embedded");
+
+        // detect osgi
+        if (FrameworkUtil.getBundle(getClass()) != null) {
+            webconsoleType = "osgi";
+        }
+
+
         String configuration = "/WEB-INF/webconsole-" + webconsoleType + ".xml";
 
         XmlWebApplicationContext context = new XmlWebApplicationContext();

Added: activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/config/OsgiConfiguration.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/config/OsgiConfiguration.java?rev=1441064&view=auto
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/config/OsgiConfiguration.java
(added)
+++ activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/config/OsgiConfiguration.java
Thu Jan 31 16:59:49 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.web.config;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedService;
+
+import javax.jms.ConnectionFactory;
+import javax.management.remote.JMXServiceURL;
+import java.util.Collection;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+public class OsgiConfiguration extends AbstractConfiguration implements ManagedService {
+
+    private ServiceRegistration service;
+
+    private String jmxUrl = "service:jmx:rmi:///jndi/rmi://localhost:1099/karaf-root";
+    private String jmxUser = "karaf";
+    private String jmxPassword = "karaf";
+
+    private String jmsUrl = "tcp://localhost:61616";
+    private String jmsUser = "karaf";
+    private String jmsPassword = "karaf";
+
+    public OsgiConfiguration() {
+
+        BundleContext context = FrameworkUtil.getBundle(getClass()).getBundleContext();
+        Dictionary properties = new Hashtable();
+        properties.put(Constants.SERVICE_PID, "org.apache.activemq.server");
+        service = context.registerService(ManagedService.class.getName(),
+            this, properties);
+
+    }
+
+    @Override
+    public String getJmxPassword() {
+        return jmxPassword;
+    }
+
+    @Override
+    public Collection<JMXServiceURL> getJmxUrls() {
+        return makeJmxUrls(jmxUrl);
+    }
+
+    @Override
+    public String getJmxUser() {
+        return jmxUser;
+    }
+
+    @Override
+    public ConnectionFactory getConnectionFactory() {
+        return makeConnectionFactory(jmsUrl, jmsUser, jmsPassword);
+    }
+
+    @Override
+    public void updated(Dictionary dictionary) throws ConfigurationException {
+        //TODO update properties
+    }
+}

Added: activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-osgi.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-osgi.xml?rev=1441064&view=auto
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-osgi.xml (added)
+++ activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-osgi.xml Thu Jan
31 16:59:49 2013
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+    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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:aop="http://www.springframework.org/schema/aop"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+                           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
+
+  <import resource="webconsole-query.xml"/>
+  <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
/>
+
+  <bean id="sessionPool" class="org.apache.activemq.web.SessionPool">
+  	<property name="connectionFactory" ref="connectionFactory"/>
+  </bean>
+
+  <bean id="configuration" class="org.apache.activemq.web.config.OsgiConfiguration"/>
+
+  <bean id="brokerQuery" class="org.apache.activemq.web.RemoteJMXBrokerFacade" autowire="constructor"
destroy-method="shutdown">
+  	<property name="configuration" ref="configuration"/>
+  	<property name="brokerName"><null/></property>
+  </bean>
+
+  <bean id="connectionFactory" factory-bean="configuration" factory-method="getConnectionFactory"/>
+
+</beans>

Modified: activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java?rev=1441064&r1=1441063&r2=1441064&view=diff
==============================================================================
--- activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java
(original)
+++ activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java
Thu Jan 31 16:59:49 2013
@@ -73,7 +73,7 @@ public class RemoteJMXBrokerFacade exten
     public void shutdown() {
         closeConnection();
     }
-    
+
     private ObjectName getBrokerObjectName(MBeanServerConnection connection)
 			throws IOException, MalformedObjectNameException {
 		Set<ObjectName> brokers = findBrokers(connection);
@@ -197,7 +197,7 @@ public class RemoteJMXBrokerFacade exten
 			throws IOException, MalformedObjectNameException {
 		ObjectName name;
 		if (this.brokerName == null) {
-			name = new ObjectName("org.apache.activemq:type=Broker,*");
+			name = new ObjectName("org.apache.activemq:type=Broker,brokerName=*");
 		} else {
 			name = new ObjectName("org.apache.activemq:brokerName="
 					+ this.brokerName + ",Type=broker");



Mime
View raw message