incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r886713 - in /incubator/aries/trunk/jmx: jmx-bundle/pom.xml jmx-core/pom.xml jmx-core/src/main/java/org/apache/aries/jmx/agent/JMXAgentImpl.java jmx-core/src/main/java/org/apache/aries/jmx/framework/RegistrableStandardEmitterMBean.java pom.xml
Date Thu, 03 Dec 2009 09:04:24 GMT
Author: atk
Date: Thu Dec  3 09:04:24 2009
New Revision: 886713

URL: http://svn.apache.org/viewvc?rev=886713&view=rev
Log:
ARIES-31 ARIES-35 Implement BundleState and ServiceState MBeans

Added:
    incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/framework/RegistrableStandardEmitterMBean.java
  (with props)
Removed:
    incubator/aries/trunk/jmx/jmx-core/pom.xml
Modified:
    incubator/aries/trunk/jmx/jmx-bundle/pom.xml
    incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/agent/JMXAgentImpl.java
    incubator/aries/trunk/jmx/pom.xml

Modified: incubator/aries/trunk/jmx/jmx-bundle/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/jmx-bundle/pom.xml?rev=886713&r1=886712&r2=886713&view=diff
==============================================================================
--- incubator/aries/trunk/jmx/jmx-bundle/pom.xml (original)
+++ incubator/aries/trunk/jmx/jmx-bundle/pom.xml Thu Dec  3 09:04:24 2009
@@ -63,17 +63,17 @@
                         <Import-Package>
 							!org.apache.aries.jmx*,
 							org.osgi.framework;version="1.5.0",
-							org.osgi.service.cm;version="1.3.0",
-							org.osgi.service.permissionadmin;version="1.2.0",
-							org.osgi.service.provisioning;version="1.2.0",
-							org.osgi.service.useradmin;version="1.1.0",
-							org.osgi.jmx;version="1.0.0",
-							org.osgi.jmx.framework;version="1.5.0",
-							org.osgi.jmx.service.cm;version="1.3.0",
-							org.osgi.jmx.service.permissionadmin;version="1.2.0",
-							org.osgi.jmx.service.provisioning;version="1.2.0",
-							org.osgi.jmx.service.useradmin;version="1.1.0",
-							org.osgi.util.tracker,*
+							org.osgi.service.packageadmin;version="1.2.0",
+							org.osgi.service.startlevel;version="1.1.0",
+							org.osgi.service.cm;version="1.3.0";resolution:="optional",
+							org.osgi.service.permissionadmin;version="1.2.0";resolution:="optional",
+							org.osgi.service.provisioning;version="1.2.0";resolution:="optional",
+							org.osgi.service.useradmin;version="1.1.0";resolution:="optional",
+							org.osgi.util.tracker,
+							org.osgi.service.log,
+							javax.management,
+							javax.management.openmbean,
+							*
                         </Import-Package>
 						<Bundle-Activator>org.apache.aries.jmx.Activator</Bundle-Activator>
 						<!-- Not currently exporting from the standalone -->

Modified: incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/agent/JMXAgentImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/agent/JMXAgentImpl.java?rev=886713&r1=886712&r2=886713&view=diff
==============================================================================
--- incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/agent/JMXAgentImpl.java
(original)
+++ incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/agent/JMXAgentImpl.java
Thu Dec  3 09:04:24 2009
@@ -33,7 +33,9 @@
 import org.apache.aries.jmx.Logger;
 import org.apache.aries.jmx.MBeanHandler;
 import org.apache.aries.jmx.MBeanServiceTracker;
+import org.apache.aries.jmx.framework.BundleStateMBeanHandler;
 import org.apache.aries.jmx.framework.FrameworkMBeanHandler;
+import org.apache.aries.jmx.framework.ServiceStateMBeanHandler;
 import org.apache.aries.jmx.framework.PackageStateMBeanHandler;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.log.LogService;
@@ -83,6 +85,12 @@
         MBeanHandler frameworkHandler = new FrameworkMBeanHandler(bc, logger);
         frameworkHandler.open();
         mbeansHandlers.add(frameworkHandler);
+        MBeanHandler bundleStateHandler = new BundleStateMBeanHandler(bc, logger);
+        bundleStateHandler.open();
+        mbeansHandlers.add(bundleStateHandler);
+        MBeanHandler serviceStateHandler = new ServiceStateMBeanHandler(bc, logger);
+        serviceStateHandler.open();
+        mbeansHandlers.add(serviceStateHandler);
         MBeanHandler packageStateHandler = new PackageStateMBeanHandler(bc, logger);
         packageStateHandler.open();
         mbeansHandlers.add(packageStateHandler);

Added: incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/framework/RegistrableStandardEmitterMBean.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/framework/RegistrableStandardEmitterMBean.java?rev=886713&view=auto
==============================================================================
--- incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/framework/RegistrableStandardEmitterMBean.java
(added)
+++ incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/framework/RegistrableStandardEmitterMBean.java
Thu Dec  3 09:04:24 2009
@@ -0,0 +1,153 @@
+/**
+ *  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.aries.jmx.framework;
+
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanInfo;
+import javax.management.MBeanNotificationInfo;
+import javax.management.MBeanRegistration;
+import javax.management.MBeanServer;
+import javax.management.NotCompliantMBeanException;
+import javax.management.NotificationEmitter;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+import javax.management.StandardMBean;
+
+/**
+ * The <code>StandardMBean</code> does not appear to delegate correctly to the
underlying MBean implementation. Due to
+ * issues surrounding the <code>MBeanRegistration</code> callback methods and
<code>NotificationEmmitter</code> methods,
+ * this subclass was introduced to force the delegation
+ * 
+ * @version $Rev$ $Date$
+ */
+public class RegistrableStandardEmitterMBean extends StandardMBean implements MBeanRegistration,
NotificationEmitter {
+
+    public <T> RegistrableStandardEmitterMBean(T impl, Class<T> intf) throws
NotCompliantMBeanException {
+        super(impl, intf);
+    }
+
+    /**
+     * @see javax.management.StandardMBean#getMBeanInfo()
+     */
+    public MBeanInfo getMBeanInfo() {
+        MBeanInfo mbeanInfo = super.getMBeanInfo();
+        if (mbeanInfo != null) {
+            MBeanNotificationInfo[] notificationInfo;
+            Object impl = getImplementation();
+            if (impl instanceof NotificationEmitter) {
+                notificationInfo = ((NotificationEmitter) (impl)).getNotificationInfo();
+            } else {
+                notificationInfo = new MBeanNotificationInfo[0];
+            }
+            mbeanInfo = new MBeanInfo(mbeanInfo.getClassName(), mbeanInfo.getDescription(),
mbeanInfo.getAttributes(),
+                    mbeanInfo.getConstructors(), mbeanInfo.getOperations(), notificationInfo);
+        }
+        return mbeanInfo;
+    }
+
+    /**
+     * @see javax.management.MBeanRegistration#postDeregister()
+     */
+    public void postDeregister() {
+        Object impl = getImplementation();
+        if (impl instanceof MBeanRegistration) {
+            ((MBeanRegistration) impl).postDeregister();
+        }
+    }
+
+    /**
+     * @see javax.management.MBeanRegistration#postRegister(java.lang.Boolean)
+     */
+    public void postRegister(Boolean registrationDone) {
+        Object impl = getImplementation();
+        if (impl instanceof MBeanRegistration) {
+            ((MBeanRegistration) impl).postRegister(registrationDone);
+        }
+    }
+
+    /**
+     * @see javax.management.MBeanRegistration#preDeregister()
+     */
+    public void preDeregister() throws Exception {
+        Object impl = getImplementation();
+        if (impl instanceof MBeanRegistration) {
+            ((MBeanRegistration) impl).preDeregister();
+        }
+    }
+
+    /**
+     * @see javax.management.MBeanRegistration#preRegister(javax.management.MBeanServer,
javax.management.ObjectName)
+     */
+    public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception {
+        ObjectName result = name;
+        Object impl = getImplementation();
+        if (impl instanceof MBeanRegistration) {
+            result = ((MBeanRegistration) impl).preRegister(server, name);
+        }
+        return result;
+    }
+
+    /**
+     * @see javax.management.NotificationEmitter#removeNotificationListener(javax.management.NotificationListener,
+     *      javax.management.NotificationFilter, java.lang.Object)
+     */
+    public void removeNotificationListener(NotificationListener listener, NotificationFilter
filter, Object handback)
+            throws ListenerNotFoundException {
+        Object impl = getImplementation();
+        if (impl instanceof NotificationEmitter) {
+            ((NotificationEmitter) (impl)).removeNotificationListener(listener, filter, handback);
+        }
+    }
+
+    /**
+     * @see javax.management.NotificationBroadcaster#addNotificationListener(javax.management.NotificationListener,
+     *      javax.management.NotificationFilter, java.lang.Object)
+     */
+    public void addNotificationListener(NotificationListener listener, NotificationFilter
filter, Object handback)
+            throws IllegalArgumentException {
+        Object impl = getImplementation();
+        if (impl instanceof NotificationEmitter) {
+            ((NotificationEmitter) (impl)).addNotificationListener(listener, filter, handback);
+        }
+    }
+
+    /**
+     * @see javax.management.NotificationBroadcaster#getNotificationInfo()
+     */
+    public MBeanNotificationInfo[] getNotificationInfo() {
+        MBeanNotificationInfo[] result;
+        Object impl = getImplementation();
+        if (impl instanceof NotificationEmitter) {
+            result = ((NotificationEmitter) (impl)).getNotificationInfo();
+        } else {
+            result = new MBeanNotificationInfo[0];
+        }
+        return result;
+    }
+
+    /**
+     * @see javax.management.NotificationBroadcaster#removeNotificationListener(javax.management.NotificationListener)
+     */
+    public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException
{
+        Object impl = getImplementation();
+        if (impl instanceof NotificationEmitter) {
+            ((NotificationEmitter) (impl)).removeNotificationListener(listener);
+        }
+    }
+
+}

Propchange: incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/framework/RegistrableStandardEmitterMBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/framework/RegistrableStandardEmitterMBean.java
------------------------------------------------------------------------------
    svn:keywords = Revision Date

Modified: incubator/aries/trunk/jmx/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/pom.xml?rev=886713&r1=886712&r2=886713&view=diff
==============================================================================
--- incubator/aries/trunk/jmx/pom.xml (original)
+++ incubator/aries/trunk/jmx/pom.xml Thu Dec  3 09:04:24 2009
@@ -1,3 +1,4 @@
+<?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
@@ -15,8 +16,7 @@
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
     <parent>
         <groupId>org.apache.aries</groupId>
@@ -71,6 +71,36 @@
                 <artifactId>junit</artifactId>
                 <version>4.5</version>
             </dependency>
+			<dependency>
+                <groupId>org.ops4j.pax.exam</groupId>
+                <artifactId>pax-exam</artifactId>
+                <version>1.1.0</version>
+            </dependency>
+            <dependency>
+                <groupId>org.ops4j.pax.exam</groupId>
+                <artifactId>pax-exam-junit</artifactId>
+                <version>1.1.0</version>
+            </dependency>
+            <dependency>
+                <groupId>org.ops4j.pax.exam</groupId>
+                <artifactId>pax-exam-container-default</artifactId>
+                <version>1.1.0</version>
+            </dependency>
+            <dependency>
+                <groupId>org.ops4j.pax.logging</groupId>
+                <artifactId>pax-logging-api</artifactId>
+                <version>1.4</version>
+            </dependency>
+            <dependency>
+                <groupId>org.ops4j.pax.logging</groupId>
+                <artifactId>pax-logging-service</artifactId>
+                <version>1.4</version>
+            </dependency>
+            <dependency>
+                <groupId>org.ops4j.pax.url</groupId>
+                <artifactId>pax-url-mvn</artifactId>
+                <version>1.0.0</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
     
@@ -107,6 +137,7 @@
         <module>jmx-api</module>
         <module>jmx-core</module>
         <module>jmx-bundle</module>
-    </modules>
+		<module>jmx-itests</module>
+  </modules>
 
-</project>
+</project>
\ No newline at end of file



Mime
View raw message