db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r628866 - in /db/derby/code/trunk/java/engine/org/apache/derby: impl/services/jmx/JMXManagementService.java mbeans/JDBCMBean.java mbeans/Management.java mbeans/ManagementMBean.java mbeans/VersionMBean.java mbeans/package.html
Date Mon, 18 Feb 2008 21:05:59 GMT
Author: djd
Date: Mon Feb 18 13:05:54 2008
New Revision: 628866

URL: http://svn.apache.org/viewvc?rev=628866&view=rev
Log:
DERBY-1378 DERBY-3424 Hide the implementation class for Derby's MBeans from JMX clients and
add more information to the javadoc under org.apache.derby.mbeans

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/jmx/JMXManagementService.java
    db/derby/code/trunk/java/engine/org/apache/derby/mbeans/JDBCMBean.java
    db/derby/code/trunk/java/engine/org/apache/derby/mbeans/Management.java
    db/derby/code/trunk/java/engine/org/apache/derby/mbeans/ManagementMBean.java
    db/derby/code/trunk/java/engine/org/apache/derby/mbeans/VersionMBean.java
    db/derby/code/trunk/java/engine/org/apache/derby/mbeans/package.html

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/jmx/JMXManagementService.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/jmx/JMXManagementService.java?rev=628866&r1=628865&r2=628866&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/jmx/JMXManagementService.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/jmx/JMXManagementService.java
Mon Feb 18 13:05:54 2008
@@ -28,6 +28,7 @@
 import java.util.Properties;
 
 import javax.management.JMException;
+import javax.management.MBeanInfo;
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 import javax.management.StandardMBean;
@@ -188,8 +189,23 @@
         try {
             final ObjectName beanName = new ObjectName(
                     DERBY_JMX_DOMAIN + ":" + keyProperties);
+            
             final StandardMBean standardMBean =
-                new StandardMBean(bean, beanInterface);
+                new StandardMBean(bean, beanInterface) {
+                
+                /**
+                 * Hide the implementation name from JMX clients
+                 * by providing the interface name as the class
+                 * name for the MBean. Allows the permissions
+                 * in a policy file to be granted to the public
+                 * MBean interfaces.
+                 */
+                protected String getClassName(MBeanInfo info) {
+                    return beanInterface.getName();
+                }
+                
+            };
+                // new StandardMBean(bean, beanInterface);
             
             registeredMbeans.put(beanName, standardMBean);
             if (mbeanServer != null)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/mbeans/JDBCMBean.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/mbeans/JDBCMBean.java?rev=628866&r1=628865&r2=628866&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/mbeans/JDBCMBean.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/mbeans/JDBCMBean.java Mon Feb 18 13:05:54
2008
@@ -23,6 +23,11 @@
 
 /** 
  * Management and information for the embedded JDBC driver.
+ * <P>
+ * Key properties for registered MBean:
+ * <UL>
+ * <LI> type=JDBC
+ * </UL>
 */
 public interface JDBCMBean {
     

Modified: db/derby/code/trunk/java/engine/org/apache/derby/mbeans/Management.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/mbeans/Management.java?rev=628866&r1=628865&r2=628866&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/mbeans/Management.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/mbeans/Management.java Mon Feb 18 13:05:54
2008
@@ -25,7 +25,15 @@
 import org.apache.derby.iapi.services.monitor.Monitor;
 
 /** 
- * Management and information for the embedded JDBC driver.
+ * Management MBean to allow applications to dynamically
+ * control visibility of Derby's MBeans.
+ * If Derby does not register its ManagementMBean then an
+ * application may register this implementation
+ * of ManagementMBean itself and use it to start Derby's
+ * JMX management.
+ * <P>
+ * If Derby is not booted then invoking startManagement will
+ * do nothing.
 */
 public class Management implements ManagementMBean {
     

Modified: db/derby/code/trunk/java/engine/org/apache/derby/mbeans/ManagementMBean.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/mbeans/ManagementMBean.java?rev=628866&r1=628865&r2=628866&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/mbeans/ManagementMBean.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/mbeans/ManagementMBean.java Mon Feb 18
13:05:54 2008
@@ -23,6 +23,20 @@
 
 /**
  * JMX MBean inteface to control visibility of Derby's MBeans.
+ * When Derby boots it attempts to register an MBean
+ * implementing ManagementMBean if derby.system.jmx is true.
+ * It may fail due to lack of valid permissions.
+ * If Derby does not register its ManagementMBean then an
+ * application may register the Management implementation
+ * of ManagementMBean itself and use it to start Derby's
+ * JMX management.
+ * <P>
+ * Key properties for registered MBean when registered by Derby:
+ * <UL>
+ * <LI> type=Management
+ * </UL>
+ * 
+ * @see Management
  */
 public interface ManagementMBean {
     

Modified: db/derby/code/trunk/java/engine/org/apache/derby/mbeans/VersionMBean.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/mbeans/VersionMBean.java?rev=628866&r1=628865&r2=628866&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/mbeans/VersionMBean.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/mbeans/VersionMBean.java Mon Feb 18 13:05:54
2008
@@ -29,6 +29,12 @@
 * are read-only.
 *
 * The MBean does not define any operations.
+ * <P>
+ * Key properties for registered MBean:
+ * <UL>
+ * <LI> type=Version
+ * <LI> jar={derby.jar|derbynet.jar}
+ * </UL>
 */
 public interface VersionMBean {
     // attributes

Modified: db/derby/code/trunk/java/engine/org/apache/derby/mbeans/package.html
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/mbeans/package.html?rev=628866&r1=628865&r2=628866&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/mbeans/package.html (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/mbeans/package.html Mon Feb 18 13:05:54
2008
@@ -16,4 +16,33 @@
 -->
 <body>
 <h2> JMX MBeans. </h2>
+If <code>derby.system.jmx</code> is true then when Derby (the embedded engine)
+is booted it will attempt to connect to the PlatformMBeanServer and register
+a number of MBeans to monitor and manage Derby.
+<P>
+Derby registers its JMX MBeans in the <code>org.apache.derby</code> domain and
+always includes a value for <code>type</code> in the MBean's ObjectName's key
+properties. Other key properties are described in the interface class for the MBean.
+<P>
+Derby registers the class name for any MBean to be the interface class for the MBean
+(i.e. <code>org.apache.derby.mbeans.*MBean</code>) to hide the implementation
class
+(which is subject to change). Permissions in policy files therefore need to
+use the MBean interface to define fine grained access. E.g. the permission 
+to allow a invoking the <code>startManagement</code> of the <code>ManagementMBean</code>
+may be written as:
+<pre>
+permission javax.management.MBeanPermission
+    "org.apache.derby.mbeans.ManagementMBean#startManagement[org.apache.derby:*]",
+    "invoke";
+</pre>
+<P>
+If Derby cannot connect to the PlatformMBeanServer then no MBeans will be registered.
+Applications may use the <code>org.apache.derby.mbeans.Management</code> MBean
to
+later enable Derby's JMX management.
+<P>
+If Derby cannot register a specific MBean (e.g. due to no permission to register
+that MBean) then it will simply be ignored. Subsequent re-starts of Derby's
+management service through <code>org.apache.derby.mbeans.ManagementMBean</code>
will
+attempt to register such an MBean again (assuming it is still valid),
+in case the security policy has been updated.
 </body>



Mime
View raw message