incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r896111 - in /incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx: agent/JMXAgentImpl.java permissionadmin/PermissionAdminMBeanHandler.java useradmin/UserAdminMBeanHandler.java
Date Tue, 05 Jan 2010 16:04:50 GMT
Author: gnodet
Date: Tue Jan  5 16:04:49 2010
New Revision: 896111

URL: http://svn.apache.org/viewvc?rev=896111&view=rev
Log:
ARIES-106: The JMX bundle should work even if all compendium specs are not available

Modified:
    incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/agent/JMXAgentImpl.java
    incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/permissionadmin/PermissionAdminMBeanHandler.java
    incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/useradmin/UserAdminMBeanHandler.java

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=896111&r1=896110&r2=896111&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
Tue Jan  5 16:04:49 2010
@@ -96,7 +96,7 @@
         MBeanHandler packageStateHandler = new PackageStateMBeanHandler(bc, logger);
         packageStateHandler.open();
         mbeansHandlers.add(packageStateHandler);
-        MBeanHandler permissionAdminHandler = new PermissionAdminMBeanHandler(bc, logger);
+        MBeanHandler permissionAdminHandler = new PermissionAdminMBeanHandler(agentContext);
         permissionAdminHandler.open();
         mbeansHandlers.add(permissionAdminHandler);
         MBeanHandler userAdminHandler = new UserAdminMBeanHandler(agentContext);

Modified: incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/permissionadmin/PermissionAdminMBeanHandler.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/permissionadmin/PermissionAdminMBeanHandler.java?rev=896111&r1=896110&r2=896111&view=diff
==============================================================================
--- incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/permissionadmin/PermissionAdminMBeanHandler.java
(original)
+++ incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/permissionadmin/PermissionAdminMBeanHandler.java
Tue Jan  5 16:04:49 2010
@@ -19,10 +19,10 @@
 import javax.management.NotCompliantMBeanException;
 import javax.management.StandardMBean;
 
+import org.apache.aries.jmx.AbstractCompendiumHandler;
 import org.apache.aries.jmx.Logger;
 import org.apache.aries.jmx.MBeanHandler;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
+import org.apache.aries.jmx.agent.JMXAgentContext;
 import org.osgi.jmx.service.permissionadmin.PermissionAdminMBean;
 import org.osgi.service.log.LogService;
 
@@ -34,61 +34,38 @@
  * 
  * @version $Rev$ $Date$
  */
-public class PermissionAdminMBeanHandler implements MBeanHandler {
-
-    private String name;
-    private StandardMBean mbean;
-    private BundleContext context;
-    private Logger logger;
+public class PermissionAdminMBeanHandler extends AbstractCompendiumHandler {
 
     /**
      * Constructs new PermissionAdminMBeanHandler.
      * 
-     * @param context
-     *            bundle context of JMX bundle.
-     * @param logger
-     *            @see {@link Logger}.
-     */
-    public PermissionAdminMBeanHandler(BundleContext context, Logger logger) {
-        this.context = context;
-        this.name = PermissionAdminMBean.OBJECTNAME;
-        this.logger = logger;
-    }
-
-    /**
-     * @see org.apache.aries.jmx.MBeanHandler#getMbean()
+     * @param agentContext JMXAgentContext instance.
      */
-    public StandardMBean getMbean() {
-        return mbean;
+    public PermissionAdminMBeanHandler(JMXAgentContext agentContext) {
+        super(agentContext, "org.osgi.service.permissionadmin.PermissionAdmin");
     }
 
     /**
-     * @see org.apache.aries.jmx.MBeanHandler#open()
+     * @see org.apache.aries.jmx.AbstractCompendiumHandler#constructInjectMBean(java.lang.Object)
      */
-    public void open() {
-        ServiceReference adminRef = context.getServiceReference(org.osgi.service.permissionadmin.PermissionAdmin.class
-                .getCanonicalName());
-        org.osgi.service.permissionadmin.PermissionAdmin permissionAdmin = (org.osgi.service.permissionadmin.PermissionAdmin)
context
-                .getService(adminRef);
-        PermissionAdminMBean paMBean = new PermissionAdmin(permissionAdmin);
+    @Override
+    protected StandardMBean constructInjectMBean(Object targetService) {
+        PermissionAdminMBean paMBean = new PermissionAdmin((org.osgi.service.permissionadmin.PermissionAdmin)
targetService);
+        StandardMBean mbean = null;
         try {
             mbean = new StandardMBean(paMBean, PermissionAdminMBean.class);
         } catch (NotCompliantMBeanException e) {
+            Logger logger = agentContext.getLogger();
             logger.log(LogService.LOG_ERROR, "Not compliant MBean", e);
         }
+        return mbean;
     }
 
-    /**
-     * @see org.apache.aries.jmx.MBeanHandler#close()
-     */
-    public void close() {
-        // not used
-    }
 
     /**
      * @see org.apache.aries.jmx.MBeanHandler#getName()
      */
     public String getName() {
-        return name;
+        return PermissionAdminMBean.OBJECTNAME;
     }
 }
\ No newline at end of file

Modified: incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/useradmin/UserAdminMBeanHandler.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/useradmin/UserAdminMBeanHandler.java?rev=896111&r1=896110&r2=896111&view=diff
==============================================================================
--- incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/useradmin/UserAdminMBeanHandler.java
(original)
+++ incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/useradmin/UserAdminMBeanHandler.java
Tue Jan  5 16:04:49 2010
@@ -44,7 +44,7 @@
      * @param agentContext JMXAgentContext instance.
      */
     public UserAdminMBeanHandler(JMXAgentContext agentContext) {
-        super(agentContext, org.osgi.service.useradmin.UserAdmin.class.getCanonicalName());
+        super(agentContext, "org.osgi.service.useradmin.UserAdmin");
     }
 
     /**



Mime
View raw message