You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by da...@apache.org on 2011/12/22 10:46:38 UTC

svn commit: r1222133 - in /aries/trunk/sandbox/jmx-next: jmx-api/src/main/java/org/osgi/jmx/framework/ jmx-core/src/main/java/org/apache/aries/jmx/framework/ jmx-itests/src/test/java/org/apache/aries/jmx/framework/

Author: davidb
Date: Thu Dec 22 09:46:37 2011
New Revision: 1222133

URL: http://svn.apache.org/viewvc?rev=1222133&view=rev
Log:
Add support for FrameworkMBean.getProperty()

Modified:
    aries/trunk/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/FrameworkMBean.java
    aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/Framework.java
    aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/FrameworkMBeanTest.java

Modified: aries/trunk/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/FrameworkMBean.java
URL: http://svn.apache.org/viewvc/aries/trunk/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/FrameworkMBean.java?rev=1222133&r1=1222132&r2=1222133&view=diff
==============================================================================
--- aries/trunk/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/FrameworkMBean.java (original)
+++ aries/trunk/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/FrameworkMBean.java Thu Dec 22 09:46:37 2011
@@ -259,6 +259,18 @@ public interface FrameworkMBean {
 	 */
 	int getInitialBundleStartLevel() throws IOException;
 
+    /**
+     * Returns the value of the specified property. If the key is not found in
+     * the Framework properties, the system properties are then searched. The
+     * method returns {@code null} if the property is not found.
+     *
+     * @param key The name of the requested property.
+     * @return The value of the requested property, or {@code null} if the
+     *         property is undefined.
+     * @throws IOException if the operation failed
+     */
+    String getProperty(String key);
+
 	/**
      * Returns the bundles IDs that have non-current, in use bundle wirings. This
      * is typically the bundles which have been updated or uninstalled since the

Modified: aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/Framework.java
URL: http://svn.apache.org/viewvc/aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/Framework.java?rev=1222133&r1=1222132&r2=1222133&view=diff
==============================================================================
--- aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/Framework.java (original)
+++ aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/Framework.java Thu Dec 22 09:46:37 2011
@@ -104,6 +104,13 @@ public class Framework implements Framew
     }
 
     /**
+     * @see org.osgi.jmx.framework.FrameworkMBean#getProperty(java.lang.String)
+     */
+    public String getProperty(String key) {
+        return context.getProperty(key);
+    }
+
+    /**
      * @see org.osgi.jmx.framework.FrameworkMBean#getRemovalPendingBundles()
      */
     public long[] getRemovalPendingBundles() throws IOException {

Modified: aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/FrameworkMBeanTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/FrameworkMBeanTest.java?rev=1222133&r1=1222132&r2=1222133&view=diff
==============================================================================
--- aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/FrameworkMBeanTest.java (original)
+++ aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/FrameworkMBeanTest.java Thu Dec 22 09:46:37 2011
@@ -107,6 +107,18 @@ public class FrameworkMBeanTest extends 
         waitForMBean(new ObjectName(FrameworkMBean.OBJECTNAME));
     }
 
+    @Test
+    public void testGetProperty() throws Exception {
+        FrameworkMBean framework = getMBean(FrameworkMBean.OBJECTNAME, FrameworkMBean.class);
+
+        String expectedVer = context().getProperty(Constants.FRAMEWORK_VERSION);
+        String actualVer = framework.getProperty(Constants.FRAMEWORK_VERSION);
+        assertEquals(expectedVer, actualVer);
+
+        String expectedTmp = context().getProperty("java.io.tmpdir");
+        String actualTmp = framework.getProperty("java.io.tmpdir");
+        assertEquals(expectedTmp, actualTmp);
+    }
 
     @Test
     public void testGetDependencyClosure() throws Exception {