Author: jbonofre
Date: Mon Sep 17 09:45:47 2012
New Revision: 1386531

URL: http://svn.apache.org/viewvc?rev=1386531&view=rev
Log:
[KARAF-1832] ServicesMBean support Services attribute and getServices() in 
addition of list() for migration purpose

Modified:
    
karaf/branches/karaf-2.3.x/management/mbeans/services/src/main/java/org/apache/karaf/management/mbeans/services/ServicesMBean.java
    
karaf/branches/karaf-2.3.x/management/mbeans/services/src/main/java/org/apache/karaf/management/mbeans/services/internal/ServicesMBeanImpl.java

Modified: 
karaf/branches/karaf-2.3.x/management/mbeans/services/src/main/java/org/apache/karaf/management/mbeans/services/ServicesMBean.java
URL: 
http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/management/mbeans/services/src/main/java/org/apache/karaf/management/mbeans/services/ServicesMBean.java?rev=1386531&r1=1386530&r2=1386531&view=diff
==============================================================================
--- 
karaf/branches/karaf-2.3.x/management/mbeans/services/src/main/java/org/apache/karaf/management/mbeans/services/ServicesMBean.java
 (original)
+++ 
karaf/branches/karaf-2.3.x/management/mbeans/services/src/main/java/org/apache/karaf/management/mbeans/services/ServicesMBean.java
 Mon Sep 17 09:45:47 2012
@@ -23,9 +23,60 @@ import javax.management.openmbean.Tabula
  */
 public interface ServicesMBean {
 
+    /**
+     * Get the list of services.
+     *
+     * @return the list of services.
+     * @throws Exception
+     */
+    TabularData getServices() throws Exception;
+
+    /**
+     * Get the list of services, eventually currently in use.
+     *
+     * @param inUse true to list only the services in use, false else.
+     * @return the list of services.
+     * @throws Exception
+     */
+    TabularData getServices(boolean inUse) throws Exception;
+
+    /**
+     * Get the list of services provided by a given bundle.
+     *
+     * @param bundleId the bundle ID.
+     * @return the list of services provided by the given bundle.
+     * @throws Exception
+     */
+    TabularData getServices(long bundleId) throws Exception;
+
+    /**
+     * Get the list of services provided by a given bundle and eventually in 
use.
+     *
+     * @param bundleId the bundle ID.
+     * @param inUse true to list only the services in use, false else.
+     * @return the list of services.
+     * @throws Exception
+     */
+    TabularData getServices(long bundleId, boolean inUse) throws Exception;
+
+    /**
+     * @deprecated use the Services attribute instead
+     */
     TabularData list() throws Exception;
+
+    /**
+     * @deprecated use getServices() instead
+     */
     TabularData list(boolean inUse) throws Exception;
+
+    /**
+     * @deprecated use getServices() instead
+     */
     TabularData list(long bundleId) throws Exception;
+
+    /**
+     * @deprecated use getServices() instead
+     */
     TabularData list(long bundleId, boolean inUse) throws Exception;
 
 }

Modified: 
karaf/branches/karaf-2.3.x/management/mbeans/services/src/main/java/org/apache/karaf/management/mbeans/services/internal/ServicesMBeanImpl.java
URL: 
http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/management/mbeans/services/src/main/java/org/apache/karaf/management/mbeans/services/internal/ServicesMBeanImpl.java?rev=1386531&r1=1386530&r2=1386531&view=diff
==============================================================================
--- 
karaf/branches/karaf-2.3.x/management/mbeans/services/src/main/java/org/apache/karaf/management/mbeans/services/internal/ServicesMBeanImpl.java
 (original)
+++ 
karaf/branches/karaf-2.3.x/management/mbeans/services/src/main/java/org/apache/karaf/management/mbeans/services/internal/ServicesMBeanImpl.java
 Mon Sep 17 09:45:47 2012
@@ -38,19 +38,19 @@ public class ServicesMBeanImpl extends S
         super(ServicesMBean.class);
     }
 
-    public TabularData list() throws Exception {
-        return list(-1, false);
+    public TabularData getServices() throws Exception {
+        return getServices(-1, false);
     }
 
-    public TabularData list(boolean inUse) throws Exception {
-        return list(-1, inUse);
+    public TabularData getServices(boolean inUse) throws Exception {
+        return getServices(-1, inUse);
     }
 
-    public TabularData list(long bundleId) throws Exception {
-        return list(bundleId, false);
+    public TabularData getServices(long bundleId) throws Exception {
+        return getServices(bundleId, false);
     }
 
-    public TabularData list(long bundleId, boolean inUse) throws Exception {
+    public TabularData getServices(long bundleId, boolean inUse) throws 
Exception {
         CompositeType serviceType = new CompositeType("Service", "OSGi 
Service",
                 new String[]{"Interfaces", "Properties"},
                 new String[]{"Interfaces class name of the service", 
"Properties of the service"},
@@ -93,6 +93,24 @@ public class ServicesMBeanImpl extends S
         return table;
     }
 
+    /* for backward compatibility */
+
+    public TabularData list() throws Exception {
+        return getServices();
+    }
+
+    public TabularData list(boolean inUse) throws Exception {
+        return getServices(inUse);
+    }
+
+    public TabularData list(long bundleId) throws Exception {
+        return getServices(bundleId);
+    }
+
+    public TabularData list(long bundleId, boolean inUse) throws Exception {
+        return getServices(bundleId, inUse);
+    }
+
     public BundleContext getBundleContext() {
         return this.bundleContext;
     }


Reply via email to