jcarman     2005/05/05 05:44:22

  Modified:    jmx/src/documentation/resources/images
                        jConsoleLoggerMBean.png loggerView.png
                        jConsoleConnectLocal.png loggerMBeansView.png
               jmx/src/java/org/apache/hivemind/management/impl
                        ObjectNameBuilderImpl.java ObjectNameEditor.java
               jmx/src/test/org/apache/hivemind/management
                        TestPerformanceMonitorFactory.java
                        testMBeanRegistry.xml TestMBeanRegistry.java
               jmx/src/documentation/content/xdocs/hivemind-jmx
                        setupMBeanServer.xml quickstart.xml
                        setupConnectors.xml setupJMXImplementation.xml
                        measurePerformance.xml monitorServices.xml
                        manageLog4j.xml multipleApps.xml
               jmx/src/java/org/apache/hivemind/management/mbeans
                        PerformanceMonitorMBean.java
               .        status.xml
  Added:       jmx/src/documentation/resources/images
                        performanceInterceptorMBean.png
               jmx/src/test/org/apache/hivemind/management/mbeans
                        ConcreteMBean.java TestAbstractDynamicMBean.java
               jmx/src/test/org/apache/hivemind/management/impl
                        TestObjectNameEditor.java
               jmx/src/java/org/apache/hivemind/management/mbeans
                        AbstractDynamicMBean.java
  Log:
  JMX Enhancements
  PR: HIVEMIND-107
  Submitted by: Achim Hügen
  
  Revision  Changes    Path
  1.2       +66 -151   
jakarta-hivemind/jmx/src/documentation/resources/images/jConsoleLoggerMBean.png
  
        <<Binary file>>
  
  
  1.2       +39 -118   
jakarta-hivemind/jmx/src/documentation/resources/images/loggerView.png
  
        <<Binary file>>
  
  
  1.2       +48 -79    
jakarta-hivemind/jmx/src/documentation/resources/images/jConsoleConnectLocal.png
  
        <<Binary file>>
  
  
  1.2       +59 -82    
jakarta-hivemind/jmx/src/documentation/resources/images/loggerMBeansView.png
  
        <<Binary file>>
  
  
  1.1                  
jakarta-hivemind/jmx/src/documentation/resources/images/performanceInterceptorMBean.png
  
        <<Binary file>>
  
  
  1.3       +1 -1      
jakarta-hivemind/jmx/src/java/org/apache/hivemind/management/impl/ObjectNameBuilderImpl.java
  
  Index: ObjectNameBuilderImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/jmx/src/java/org/apache/hivemind/management/impl/ObjectNameBuilderImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ObjectNameBuilderImpl.java        29 Apr 2005 07:40:53 -0000      1.2
  +++ ObjectNameBuilderImpl.java        5 May 2005 12:44:21 -0000       1.3
  @@ -58,7 +58,7 @@
           ObjectName objectName;
           try
           {
  -            objectName = ObjectName.getInstance(name);
  +            objectName = new ObjectName(name);
           }
           catch (MalformedObjectNameException e)
           {
  
  
  
  1.2       +1 -1      
jakarta-hivemind/jmx/src/java/org/apache/hivemind/management/impl/ObjectNameEditor.java
  
  Index: ObjectNameEditor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/jmx/src/java/org/apache/hivemind/management/impl/ObjectNameEditor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ObjectNameEditor.java     16 Apr 2005 14:41:38 -0000      1.1
  +++ ObjectNameEditor.java     5 May 2005 12:44:21 -0000       1.2
  @@ -20,7 +20,7 @@
   import javax.management.ObjectName;
   
   /**
  - * PropertyEditor for JMX ObjectNames Converts strings to ObjectNames
  + * PropertyEditor for JMX ObjectNames. Converts strings to ObjectNames
    * 
    * @author Achim Huegen
    * @since 1.1
  
  
  
  1.2       +3 -3      
jakarta-hivemind/jmx/src/test/org/apache/hivemind/management/TestPerformanceMonitorFactory.java
  
  Index: TestPerformanceMonitorFactory.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/jmx/src/test/org/apache/hivemind/management/TestPerformanceMonitorFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestPerformanceMonitorFactory.java        16 Apr 2005 14:41:38 -0000      
1.1
  +++ TestPerformanceMonitorFactory.java        5 May 2005 12:44:21 -0000       
1.2
  @@ -42,13 +42,13 @@
   
           // Look for the mbean that collects the performance data
           MBeanServer mbeanServer = (MBeanServer) 
registry.getService(MBeanServer.class);
  -
  -        registry.getService(ObjectNameBuilder.class);
  -
           ObjectName objectName = new ObjectName(
                   
"hivemind:module=test.management,type=service,id=Calculator,decorator=PerformanceCollector");
           ObjectInstance instance = mbeanServer.getObjectInstance(objectName);
           assertNotNull(instance);
   
  +        // Execute some operations for code coverage
  +        calculator.add(123);
       }
  +
   }
  \ No newline at end of file
  
  
  
  1.2       +5 -1      
jakarta-hivemind/jmx/src/test/org/apache/hivemind/management/testMBeanRegistry.xml
  
  Index: testMBeanRegistry.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/jmx/src/test/org/apache/hivemind/management/testMBeanRegistry.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- testMBeanRegistry.xml     16 Apr 2005 14:41:38 -0000      1.1
  +++ testMBeanRegistry.xml     5 May 2005 12:44:21 -0000       1.2
  @@ -21,9 +21,13 @@
       <create-instance class="MBeanTestService" model="primitive" />
     </service-point>
   
  +  <service-point id="MBean2" interface="java.lang.Runnable">
  +    <create-instance class="MBeanTestService" model="primitive" />
  +  </service-point>
  +
     <contribution configuration-id="hivemind.management.MBeans">
        <mbean service-id="MBean1" start-method="start" />
  -     <mbean service-id="MBean1" object-name="hivemind:name=bean1" />
  +     <mbean service-id="MBean2" object-name="hivemind:name=bean2" />
     </contribution>
    
   </module>
  
  
  
  1.3       +73 -8     
jakarta-hivemind/jmx/src/test/org/apache/hivemind/management/TestMBeanRegistry.java
  
  Index: TestMBeanRegistry.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/jmx/src/test/org/apache/hivemind/management/TestMBeanRegistry.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestMBeanRegistry.java    29 Apr 2005 01:47:33 -0000      1.2
  +++ TestMBeanRegistry.java    5 May 2005 12:44:21 -0000       1.3
  @@ -16,6 +16,7 @@
   
   import java.util.List;
   
  +import javax.management.MBeanRegistrationException;
   import javax.management.MBeanServer;
   import javax.management.NotCompliantMBeanException;
   import javax.management.ObjectInstance;
  @@ -26,6 +27,11 @@
   import org.apache.commons.logging.LogFactory;
   import org.apache.hivemind.ErrorHandler;
   import org.apache.hivemind.Registry;
  +import org.apache.hivemind.events.RegistryShutdownListener;
  +import org.apache.hivemind.impl.DefaultClassResolver;
  +import org.apache.hivemind.impl.DefaultErrorHandler;
  +import org.apache.hivemind.impl.ModuleImpl;
  +import org.apache.hivemind.internal.Module;
   import org.apache.hivemind.internal.ServicePoint;
   import org.apache.hivemind.management.impl.MBeanRegistrationContribution;
   import org.apache.hivemind.management.impl.MBeanRegistryImpl;
  @@ -33,6 +39,7 @@
   import org.apache.hivemind.test.HiveMindTestCase;
   import org.easymock.ArgumentsMatcher;
   import org.easymock.MockControl;
  +import org.easymock.internal.AlwaysMatcher;
   import org.easymock.internal.EqualsMatcher;
   
   /**
  @@ -45,6 +52,8 @@
   {
       private ErrorHandler errorHandler;
   
  +    private MockControl logControl;
  +
       private Log log;
   
       private MockControl serverControl;
  @@ -55,7 +64,8 @@
   
       public void setUp()
       {
  -        errorHandler = (ErrorHandler) newMock(ErrorHandler.class);
  +        errorHandler = new DefaultErrorHandler();
  +        logControl = (MockControl) newControl(Log.class);
           log = LogFactory.getLog(MBeanRegistry.class);
           serverControl = newControl(MBeanServer.class);
           server = (MBeanServer) serverControl.getMock();
  @@ -75,15 +85,29 @@
           Object mBean1 = registry.getService("test.management.MBean1", 
Runnable.class);
           ObjectName on1 = objectNameBuilder.createServiceObjectName(sp1);
           server.registerMBean(mBean1, on1);
  -        serverControl.setReturnValue(new ObjectInstance(on1, 
mBean1.getClass().getName()));
  +        ObjectInstance oin1 = new ObjectInstance(on1, 
mBean1.getClass().getName());
  +        serverControl.setReturnValue(oin1);
  +
  +        Object mBean2 = registry.getService("test.management.MBean2", 
Runnable.class);
  +        ObjectName on2 = new ObjectName("hivemind:name=bean2");
  +        server.registerMBean(mBean2, on2);
  +        serverControl.setReturnValue(new ObjectInstance(on2, 
mBean2.getClass().getName()));
  +
  +        // Call from unregisterBean
  +        server.getObjectInstance(on1);
  +        serverControl.setReturnValue(oin1);
   
  -        ObjectName on2 = new ObjectName("hivemind:name=bean1");
  -        server.registerMBean(mBean1, on2);
  -        serverControl.setReturnValue(new ObjectInstance(on1, 
mBean1.getClass().getName()));
  +        server.unregisterMBean(on1);
  +        server.unregisterMBean(on2);
   
           replayControls();
   
  -        new MBeanRegistryImpl(errorHandler, log, server, objectNameBuilder, 
mBeanList);
  +        MBeanRegistry mbeanRegistry = new MBeanRegistryImpl(errorHandler, 
log, server,
  +                objectNameBuilder, mBeanList);
  +
  +        // Unregister one bean manually the other one during registry 
shutdown
  +        mbeanRegistry.unregisterMBean(on1);
  +        ((RegistryShutdownListener) mbeanRegistry).registryDidShutdown();
   
           verifyControls();
   
  @@ -122,6 +146,36 @@
       }
   
       /**
  +     * Tests the handling of registrations errors during processing of the 
contributed mbeans
  +     */
  +    public void testRegistrationException() throws Exception
  +    {
  +        Registry registry = buildFrameworkRegistry("testMBeanRegistry.xml");
  +        List mBeanList = 
registry.getConfiguration("hivemind.management.MBeans");
  +
  +        ServicePoint sp1 = ((MBeanRegistrationContribution) 
mBeanList.get(0)).getServicePoint();
  +        ObjectName on1 = objectNameBuilder.createServiceObjectName(sp1);
  +
  +        // Training
  +        server.registerMBean(null, null);
  +        serverControl.setThrowable(new MBeanRegistrationException(new 
Exception(
  +                "Registration failed")));
  +        serverControl.setDefaultMatcher(new AlwaysMatcher());
  +        server.registerMBean(null, null);
  +        serverControl.setThrowable(new MBeanRegistrationException(new 
Exception(
  +                "Registration failed")));
  +
  +        replayControls();
  +
  +        interceptLogging(MBeanRegistry.class.getName());
  +
  +        MBeanRegistry mbeanRegistry = new MBeanRegistryImpl(errorHandler, 
log, server,
  +                objectNameBuilder, mBeanList);
  +
  +        assertLoggedMessage("Registering MBean " + on1.toString() + " 
failed");
  +    }
  +
  +    /**
        * Ensures that a bean with management interface is registered as 
StandardMBean
        */
       public void testStandardMBean() throws Exception
  @@ -148,8 +202,8 @@
                       EqualsMatcher matcher = new EqualsMatcher();
                       return matcher.matches(arg0, arg1);
                   }
  -
  -                return arg1[0].getClass().equals(StandardMBean.class);
  +                else
  +                    return arg1[0].getClass().equals(StandardMBean.class);
               }
   
               public String toString(Object[] arg0)
  @@ -169,4 +223,15 @@
   
           verifyControls();
       }
  +
  +    private Module newModule()
  +    {
  +        ModuleImpl result = new ModuleImpl();
  +
  +        result.setClassResolver(new DefaultClassResolver());
  +        result.setPackageName("");
  +
  +        return result;
  +    }
  +
   }
  \ No newline at end of file
  
  
  
  1.1                  
jakarta-hivemind/jmx/src/test/org/apache/hivemind/management/mbeans/ConcreteMBean.java
  
  Index: ConcreteMBean.java
  ===================================================================
  //Copyright 2005 The Apache Software Foundation
  //
  // Licensed 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.hivemind.management.mbeans;
  
  import javax.management.Attribute;
  import javax.management.AttributeNotFoundException;
  import javax.management.InvalidAttributeValueException;
  import javax.management.MBeanAttributeInfo;
  import javax.management.MBeanConstructorInfo;
  import javax.management.MBeanException;
  import javax.management.MBeanNotificationInfo;
  import javax.management.MBeanOperationInfo;
  import javax.management.MBeanParameterInfo;
  import javax.management.ReflectionException;
  
  /**
   * Test MBean
   * 
   * @author Achim Huegen
   */
  public class ConcreteMBean extends AbstractDynamicMBean
  {
      private String attribute1 = "value1";
  
      private String attribute2 = "value2";
  
      public boolean isSetAttribute1Called;
  
      public boolean isSetAttribute2Called;
  
      public ConcreteMBean()
      {
      }
  
      protected MBeanAttributeInfo[] createMBeanAttributeInfo()
      {
          MBeanAttributeInfo att1 = new MBeanAttributeInfo("attribute1", 
"String", "", true,
                  true, false);
          MBeanAttributeInfo att2 = new MBeanAttributeInfo("attribute2", 
"String", "", true,
                  true, false);
          return new MBeanAttributeInfo[]
          { att1, att2 };
      }
  
      protected MBeanConstructorInfo[] createMBeanConstructorInfo()
      {
          MBeanConstructorInfo constructor = new 
MBeanConstructorInfo("constructor", "",
                  new MBeanParameterInfo[] {});
          return new MBeanConstructorInfo[]
          { constructor };
      }
  
      protected MBeanNotificationInfo[] createMBeanNotificationInfo()
      {
          MBeanNotificationInfo notification = new MBeanNotificationInfo(new 
String[0],
                  "notification", "");
          return new MBeanNotificationInfo[]
          { notification };
      }
  
      protected MBeanOperationInfo[] createMBeanOperationInfo()
      {
          MBeanOperationInfo operation = new MBeanOperationInfo("operation", "",
                  new MBeanParameterInfo[0], "String", 0);
          return new MBeanOperationInfo[]
          { operation };
      }
  
      public Object getAttribute(String name) throws 
AttributeNotFoundException, MBeanException,
              ReflectionException
      {
          if (name.equals("attribute1"))
              return attribute1;
          if (name.equals("attribute2"))
              return attribute2;
          throw new AttributeNotFoundException();
      }
  
      public void setAttribute(Attribute attribute) throws 
AttributeNotFoundException,
              InvalidAttributeValueException, MBeanException, 
ReflectionException
      {
          if (attribute.getName().equals("attribute1"))
              attribute1 = (String) attribute.getValue();
          if (attribute.getName().equals("attribute2"))
              attribute2 = (String) attribute.getValue();
          throw new AttributeNotFoundException();
      }
  }
  
  
  
  1.1                  
jakarta-hivemind/jmx/src/test/org/apache/hivemind/management/mbeans/TestAbstractDynamicMBean.java
  
  Index: TestAbstractDynamicMBean.java
  ===================================================================
  //Copyright 2005 The Apache Software Foundation
  //
  // Licensed 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.hivemind.management.mbeans;
  
  import javax.management.Attribute;
  import javax.management.AttributeList;
  import javax.management.MBeanInfo;
  
  import junit.framework.TestCase;
  
  /**
   * Test of [EMAIL PROTECTED] 
org.apache.hivemind.management.mbeans.AbstractDynamicMBean}
   * 
   * @author Achim Huegen
   */
  public class TestAbstractDynamicMBean extends TestCase
  {
      public void testMBeanInfo()
      {
          ConcreteMBean mbean = new ConcreteMBean();
          MBeanInfo beanInfo = mbean.getMBeanInfo();
          assertEquals(2, beanInfo.getAttributes().length);
          assertEquals("attribute1", beanInfo.getAttributes()[0].getName());
          assertEquals("attribute2", beanInfo.getAttributes()[1].getName());
          assertEquals("constructor", beanInfo.getConstructors()[0].getName());
          assertEquals("notification", 
beanInfo.getNotifications()[0].getName());
          assertEquals("operation", beanInfo.getOperations()[0].getName());
      }
  
      public void testGetAttributes() throws Exception
      {
          ConcreteMBean mbean = new ConcreteMBean();
          AttributeList list = mbean.getAttributes(new String[]
          { "attribute1", "attribute2" });
          assertEquals("value1", ((Attribute) list.get(0)).getValue());
          assertEquals("value2", ((Attribute) list.get(1)).getValue());
      }
  
      public void testSetAttributes() throws Exception
      {
          ConcreteMBean mbean = new ConcreteMBean();
  
          AttributeList list = new AttributeList();
          list.add(new Attribute("attribute1", "newvalue1"));
          list.add(new Attribute("attribute2", "newvalue2"));
          mbean.setAttributes(list);
          assertEquals("newvalue1", mbean.getAttribute("attribute1"));
          assertEquals("newvalue2", mbean.getAttribute("attribute2"));
      }
  }
  
  
  
  
  1.2       +10 -4     
jakarta-hivemind/jmx/src/documentation/content/xdocs/hivemind-jmx/setupMBeanServer.xml
  
  Index: setupMBeanServer.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/jmx/src/documentation/content/xdocs/hivemind-jmx/setupMBeanServer.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- setupMBeanServer.xml      16 Apr 2005 14:41:38 -0000      1.1
  +++ setupMBeanServer.xml      5 May 2005 12:44:21 -0000       1.2
  @@ -29,10 +29,16 @@
     <p>
        A running MBean Server is needed in your application. It is
        the central registry for all MBeans of your application. 
  -     Fortunately, since JMX 1.2 there is a standardized factory for finding 
running 
  -     servers and starting new ones. HiveMind first tries to find a running 
  -     server. That could be provided by an application server or servlet 
  +     The JMX specification requires a JMX implementation to provide 
  +     a factory (javax.management.MBeanServerFactory) for finding running 
  +     servers and starting new ones.  
  +     </p>
  +     <p>HiveMind uses MBeanServerFactory to find a running server at first. 
  +     That one could be provided by an application server or servlet 
        engine (like Tomcat 5) or your J2SE 1.5 runtime environment. 
  +     If multiple implementations are available in your environment 
  +     the classpath and classloader hierarchy finally decide which 
  +     implementation is used. 
        Add these lines to your module descriptor: 
        </p>
        <source><![CDATA[
  @@ -47,4 +53,4 @@
        If no running server is found, a new one is started.
     </p>       
     </body>
  -</document>
  +</document>
  \ No newline at end of file
  
  
  
  1.2       +1 -1      
jakarta-hivemind/jmx/src/documentation/content/xdocs/hivemind-jmx/quickstart.xml
  
  Index: quickstart.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/jmx/src/documentation/content/xdocs/hivemind-jmx/quickstart.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- quickstart.xml    16 Apr 2005 14:41:38 -0000      1.1
  +++ quickstart.xml    5 May 2005 12:44:21 -0000       1.2
  @@ -117,4 +117,4 @@
                for one of your services or just make a service manageable.</p>
       </section>
     </body>
  -</document>
  +</document>
  \ No newline at end of file
  
  
  
  1.2       +2 -2      
jakarta-hivemind/jmx/src/documentation/content/xdocs/hivemind-jmx/setupConnectors.xml
  
  Index: setupConnectors.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/jmx/src/documentation/content/xdocs/hivemind-jmx/setupConnectors.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- setupConnectors.xml       16 Apr 2005 14:41:38 -0000      1.1
  +++ setupConnectors.xml       5 May 2005 12:44:21 -0000       1.2
  @@ -104,7 +104,7 @@
                                <p>Now you can connect to the application with 
jconsole or MC4J 
                                        using this url: 
service:jmx:rmi://localhost/jndi/rmi://localhost:1099/jmx .
                                </p>
  -                             <p>NYou can change RMI port and the service url 
this way:
  +                             <p>You can change RMI port and the service url 
this way:
                                </p>
                                <source><![CDATA[
   <contribution configuration-id="hivemind.ApplicationDefaults">
  @@ -123,4 +123,4 @@
   java -Dcom.sun.management.jmxremote ...]]></source> 
                </section>
     </body>
  -</document>
  +</document>
  \ No newline at end of file
  
  
  
  1.2       +2 -8      
jakarta-hivemind/jmx/src/documentation/content/xdocs/hivemind-jmx/setupJMXImplementation.xml
  
  Index: setupJMXImplementation.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/jmx/src/documentation/content/xdocs/hivemind-jmx/setupJMXImplementation.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- setupJMXImplementation.xml        16 Apr 2005 14:41:38 -0000      1.1
  +++ setupJMXImplementation.xml        5 May 2005 12:44:21 -0000       1.2
  @@ -31,11 +31,8 @@
        <p>HiveMind uses <link href="http://mx4j.sourceforge.net"; >MX4J</link>  
                        for development and testing, but it can run with any 
other JMX 1.2 
                        implementation. HiveMind has additionally been tested 
with 
  -                     the Sun Reference Implementation and J2SE 1.5.
  +                     J2SE 1.5 and the Sun Reference Implementation of JMX.
                </p>
  -             <note>Since HiveMind MBeans use MX4J AbstractDynamicMBean as 
ancestor 
  -                     the mx4j.jar from the MX4J library is 
<strong>always</strong> needed in your classpath. <br/>
  -             </note>
                <section>
                        <title>MX4J</title>
                        <p>Get MX4J <link href="http://mx4j.sourceforge.net"; 
>here</link>
  @@ -47,8 +44,7 @@
                <section>
                        <title>J2SE 1.5</title>
                        <p>If your application runs with Sun J2SE 1.5 no 
additional libraries are needed
  -                             (besides mx4j.jar, see note above). This can 
change later if you
  -                             decide to use HTTP to manage your application.
  +                             This can change later if you decide to use HTTP 
to manage your application.
                        </p>
                </section>
                <section>
  @@ -57,8 +53,6 @@
                                in version 1.2.1
                        </p>
                        <p>Add jmxri.jar and jmxtools.jar to the classpath.
  -                             Add mx4j.jar to your classpath (see note above) 
and ensure
  -                             that it's behind the SUN jars. 
                        </p>
                </section>
     </body>
  
  
  
  1.2       +8 -2      
jakarta-hivemind/jmx/src/documentation/content/xdocs/hivemind-jmx/measurePerformance.xml
  
  Index: measurePerformance.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/jmx/src/documentation/content/xdocs/hivemind-jmx/measurePerformance.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- measurePerformance.xml    16 Apr 2005 14:41:38 -0000      1.1
  +++ measurePerformance.xml    5 May 2005 12:44:21 -0000       1.2
  @@ -33,7 +33,8 @@
                Add the Interceptor to your service and choose which methods
                are to be intercepted by inclusion and exclusion:</p>
                        <source><![CDATA[
  -<service-point id="Calculator" 
interface="org.apache.hivemind.management.Calculator">
  +<service-point id="Calculator" 
  +    interface="org.apache.hivemind.management.Calculator">
     <invoke-factory>
       <construct class="org.apache.hivemind.management.CalculatorImpl" />
     </invoke-factory>
  @@ -48,5 +49,10 @@
                with an additional name part 
"decorator=PerformanceCollector":<br/><br/>
                <img src="images/performanceInterceptorMBean.png" 
alt="Performance Interceptor MBean"></img>
        </p>
  +     <note>
  +             By default a service - and thus it's interceptors - is created 
  +             on the first call of a service method. If you want to get the
  +             performance mbean at startup, add your service to the EagerLoad 
contribution.
  +     </note>
     </body>
  -</document>
  +</document>
  \ No newline at end of file
  
  
  
  1.2       +25 -2     
jakarta-hivemind/jmx/src/documentation/content/xdocs/hivemind-jmx/monitorServices.xml
  
  Index: monitorServices.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/jmx/src/documentation/content/xdocs/hivemind-jmx/monitorServices.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- monitorServices.xml       16 Apr 2005 14:41:38 -0000      1.1
  +++ monitorServices.xml       5 May 2005 12:44:21 -0000       1.2
  @@ -26,6 +26,29 @@
       <title>Monitor services</title>
     </header>
     <body>
  -    <p> Documentation coming soon. </p> 
  +     <p>
  +     Though creation of jmx monitors is not automated a monitor can 
  +     easily defining as service point using the standard BuilderFactory 
  +     functionality. Such a monitor can watch the attribute of another 
  +     MBean (for example the average execution time of a service method
  +     when using an <link href="site:use.MeasurePerformance">Performance 
Interceptor</link> 
  +     and send notifications, if a treshold is crossed.
  +     </p>
  +             <source><![CDATA[
  +<service-point id="CalculatorSumMonitor" 
  +      interface="javax.management.monitor.GaugeMonitorMBean">
  +  <invoke-factory model="primitive" >
  +  
  +    <construct class="javax.management.monitor.GaugeMonitor" >
  +      <set property="granularityPeriod" value="1000" />
  +      <set property="observedObject" 
  +        value="HiveMind:module=test.management,type=service,
  +           id=Calculator,decorator=PerformanceCollector" />
  +      <set property="observedAttribute" 
  +        value="add(int) : Average Time" />
  +    </construct>     
  +    
  +  </invoke-factory>          
  +</service-point>]]></source> 
     </body>
  -</document>
  +</document>
  \ No newline at end of file
  
  
  
  1.2       +32 -3     
jakarta-hivemind/jmx/src/documentation/content/xdocs/hivemind-jmx/manageLog4j.xml
  
  Index: manageLog4j.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/jmx/src/documentation/content/xdocs/hivemind-jmx/manageLog4j.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- manageLog4j.xml   16 Apr 2005 14:41:38 -0000      1.1
  +++ manageLog4j.xml   5 May 2005 12:44:21 -0000       1.2
  @@ -26,7 +26,36 @@
       <title>Manage Log4J loggers via JMX</title>
     </header>
     <body>
  -     
  -    <p> Documentation coming soon. </p>
  +     <p>HiveMind JMX includes support for the management of Log4J. 
  +             HiveMind uses the basic MBeans already provided by Log4J
  +             and adds configurable and dynamic registration of new loggers
  +             for management.
  +             The MBeans can be used to change log levels, add new
  +             appenders and set log thresholds.
  +             </p>  
  +             <p>             
  +             Add these lines to your descriptor to activate the
  +             Log4j management and create MBeans for all loggers named
  +             "hivemind.*" (* is a wildcard ).
  +     </p>
  +             <source><![CDATA[
  +<contribution configuration-id="hivemind.management.MBeans">
  +  <mbean service-id="hivemind.management.log4j.LogManagementMBean" />
  +</contribution>
  +
  +<contribution 
  +    configuration-id="hivemind.management.log4j.ManagedLog4jLoggers">
  +    
  +  <logger name="hivemind.*" />
  +</contribution>
  +]]></source> 
  +     <note>
  +             At startup HiveMind searches for known loggers that match the
  +             configured name patterns. It's quite likeley, that some
  +             of the loggers that should be managed doesn't exist in this
  +             early phase, since usually loggers are create when a class gets 
loaded.
  +             If loggers are missing try to add them using the addLoggerMBean
  +             method of the LogManagementMBean on runtime.            
  +     </note>         
     </body>
  -</document>
  +</document>
  \ No newline at end of file
  
  
  
  1.2       +21 -2     
jakarta-hivemind/jmx/src/documentation/content/xdocs/hivemind-jmx/multipleApps.xml
  
  Index: multipleApps.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/jmx/src/documentation/content/xdocs/hivemind-jmx/multipleApps.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- multipleApps.xml  16 Apr 2005 14:41:38 -0000      1.1
  +++ multipleApps.xml  5 May 2005 12:44:21 -0000       1.2
  @@ -26,6 +26,25 @@
       <title>Multiple applications in one MBeanServer</title>
     </header>
     <body>
  -         <p> Documentation coming soon. </p>
  +     <p>
  +             If you want to run multiple HiveMind applications which
  +             use JMX in a single JVM or application server, then there is
  +             a chance of getting naming collisions. 
  +     </p>
  +     <p>
  +             By default HiveMind prepends "HiveMind:" as domain name to
  +             the names of all MBeans. For example the service 
  +             "test.management.Calculator" gets registered using the
  +             ObjectName 
"hivemind:module=test.management,type=service,id=Calculator".
  +             </p>
  +             <p>
  +             If multiple applications export the same service you
  +             should must choose unique domain names for each application.
  +             The domain name is configured as ApplicationSymbol:
  +     </p>
  +             <source><![CDATA[
  +<contribution configuration-id="hivemind.ApplicationDefaults">
  +  <default symbol="management.naming.domain" value="myDomain" />
  +</contribution>]]></source>          
     </body>
  -</document>
  +</document>
  \ No newline at end of file
  
  
  
  1.1                  
jakarta-hivemind/jmx/src/test/org/apache/hivemind/management/impl/TestObjectNameEditor.java
  
  Index: TestObjectNameEditor.java
  ===================================================================
  //Copyright 2005 The Apache Software Foundation
  //
  // Licensed 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.hivemind.management.impl;
  
  import javax.management.ObjectName;
  
  import junit.framework.TestCase;
  
  /**
   * Test of [EMAIL PROTECTED] 
org.apache.hivemind.management.impl.ObjectNameEditor}
   * 
   * @author Achim Huegen
   */
  public class TestObjectNameEditor extends TestCase
  {
      public void testSetAsText()
      {
          ObjectNameEditor editor = new ObjectNameEditor();
          editor.setAsText("Hivemind:name=test");
          ObjectName objectName = (ObjectName) editor.getValue();
  
          assertEquals("Hivemind:name=test", objectName.toString());
      }
  
      public void testMalformed()
      {
          ObjectNameEditor editor = new ObjectNameEditor();
          try
          {
              editor.setAsText("Hivemind=test:fail");
              fail();
          }
          catch (IllegalArgumentException ignore)
          {
          }
      }
  
      public void testGetAsText() throws Exception
      {
          ObjectNameEditor editor = new ObjectNameEditor();
          editor.setValue(new ObjectName("Hivemind:name=test"));
  
          assertEquals("Hivemind:name=test", editor.getAsText());
      }
  }
  
  
  
  1.3       +0 -2      
jakarta-hivemind/jmx/src/java/org/apache/hivemind/management/mbeans/PerformanceMonitorMBean.java
  
  Index: PerformanceMonitorMBean.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/jmx/src/java/org/apache/hivemind/management/mbeans/PerformanceMonitorMBean.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PerformanceMonitorMBean.java      29 Apr 2005 07:40:56 -0000      1.2
  +++ PerformanceMonitorMBean.java      5 May 2005 12:44:22 -0000       1.3
  @@ -26,8 +26,6 @@
   import javax.management.MBeanException;
   import javax.management.ReflectionException;
   
  -import mx4j.AbstractDynamicMBean;
  -
   import org.apache.hivemind.management.impl.PerformanceCollector;
   import org.apache.hivemind.service.MethodSignature;
   
  
  
  
  1.1                  
jakarta-hivemind/jmx/src/java/org/apache/hivemind/management/mbeans/AbstractDynamicMBean.java
  
  Index: AbstractDynamicMBean.java
  ===================================================================
  //Copyright 2005 The Apache Software Foundation
  //
  // Licensed 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.hivemind.management.mbeans;
  
  import javax.management.Attribute;
  import javax.management.AttributeList;
  import javax.management.AttributeNotFoundException;
  import javax.management.DynamicMBean;
  import javax.management.InvalidAttributeValueException;
  import javax.management.MBeanAttributeInfo;
  import javax.management.MBeanConstructorInfo;
  import javax.management.MBeanException;
  import javax.management.MBeanInfo;
  import javax.management.MBeanNotificationInfo;
  import javax.management.MBeanOperationInfo;
  import javax.management.ReflectionException;
  
  /**
   * Ancestor for MBeans. Eases implementation of the [EMAIL PROTECTED] 
javax.management.DynamicMBean} interface.
   * Provides empty method implementations and implements [EMAIL PROTECTED] 
#getAttributes(String[])} and
   * [EMAIL PROTECTED] #setAttributes(AttributeList)}
   * 
   * @author Achim Huegen
   */
  public abstract class AbstractDynamicMBean implements DynamicMBean
  {
  
      private MBeanInfo _mBeanInfo;
  
      /**
       * @see javax.management.DynamicMBean#getMBeanInfo()
       */
      public MBeanInfo getMBeanInfo()
      {
          if (_mBeanInfo == null)
              setMBeanInfo(createMBeanInfo());
          return _mBeanInfo;
      }
  
      /**
       * Sets the MBeanInfo
       * 
       * @param info
       *            the info
       */
      protected void setMBeanInfo(MBeanInfo info)
      {
          _mBeanInfo = info;
      }
  
      /**
       * Delegates the MBeanInfo retrieval to various methods
       * 
       * @return the MBeanInfo of the MBean
       */
      private MBeanInfo createMBeanInfo()
      {
          MBeanAttributeInfo attrs[] = createMBeanAttributeInfo();
          MBeanConstructorInfo ctors[] = createMBeanConstructorInfo();
          MBeanOperationInfo opers[] = createMBeanOperationInfo();
          MBeanNotificationInfo notifs[] = createMBeanNotificationInfo();
          String className = getMBeanClassName();
          String description = getMBeanDescription();
          return new MBeanInfo(className, description, attrs, ctors, opers, 
notifs);
      }
  
      /**
       * Provides the info which attributes the MBean has. Should be 
overwritten by the descendants
       */
      protected MBeanAttributeInfo[] createMBeanAttributeInfo()
      {
          return null;
      }
  
      /**
       * Provides the info which constructors MBean has. Should be overwritten 
by the descendants
       */
      protected MBeanConstructorInfo[] createMBeanConstructorInfo()
      {
          return null;
      }
  
      /**
       * Provides the info which operations can be called on the MBean. Should 
be overwritten by the
       * descendants
       */
      protected MBeanOperationInfo[] createMBeanOperationInfo()
      {
          return null;
      }
  
      /**
       * Provides the info which notifications the MBean supports. Should be 
overwritten by the
       * descendants
       */
      protected MBeanNotificationInfo[] createMBeanNotificationInfo()
      {
          return null;
      }
  
      protected String getMBeanClassName()
      {
          return getClass().getName();
      }
  
      /**
       * @return Textual description of the MBean
       */
      protected String getMBeanDescription()
      {
          return null;
      }
  
      /**
       * @see javax.management.DynamicMBean#getAttribute(java.lang.String)
       */
      public Object getAttribute(String name) throws 
AttributeNotFoundException, MBeanException,
              ReflectionException
      {
          return null;
      }
  
      /**
       * @see 
javax.management.DynamicMBean#setAttribute(javax.management.Attribute)
       */
      public void setAttribute(Attribute attribute) throws 
AttributeNotFoundException,
              InvalidAttributeValueException, MBeanException, 
ReflectionException
      {
      }
  
      /**
       * Gets a list of attributes using [EMAIL PROTECTED] 
#getAttribute(String)}
       * 
       * @see javax.management.DynamicMBean#getAttributes(java.lang.String[])
       */
      public AttributeList getAttributes(String[] attributes)
      {
          AttributeList list = new AttributeList();
          if (attributes != null)
          {
              for (int i = 0; i < attributes.length; i++)
              {
                  String attribute = attributes[i];
                  try
                  {
                      Object result = getAttribute(attribute);
                      list.add(new Attribute(attribute, result));
                  }
                  catch (AttributeNotFoundException ignored)
                  {
                  }
                  catch (MBeanException ignored)
                  {
                  }
                  catch (ReflectionException ignored)
                  {
                  }
              }
  
          }
          return list;
      }
  
      /**
       * @see 
javax.management.DynamicMBean#setAttributes(javax.management.AttributeList)
       */
      public AttributeList setAttributes(AttributeList attributes)
      {
          AttributeList list = new AttributeList();
  
          if (attributes != null)
          {
              for (int i = 0; i < attributes.size(); ++i)
              {
                  Attribute attribute = (Attribute) attributes.get(i);
                  try
                  {
                      setAttribute(attribute);
                      list.add(attribute);
                  }
                  catch (AttributeNotFoundException ignored)
                  {
                  }
                  catch (InvalidAttributeValueException ignored)
                  {
                  }
                  catch (MBeanException ignored)
                  {
                  }
                  catch (ReflectionException ignored)
                  {
                  }
              }
          }
  
          return list;
      }
  
      /**
       * @see javax.management.DynamicMBean#invoke(java.lang.String, 
java.lang.Object[],
       *      java.lang.String[])
       */
      public Object invoke(String method, Object[] arguments, String[] params) 
throws MBeanException,
              ReflectionException
      {
          return null;
      }
  
  }
  
  
  
  1.135     +1 -0      jakarta-hivemind/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/status.xml,v
  retrieving revision 1.134
  retrieving revision 1.135
  diff -u -r1.134 -r1.135
  --- status.xml        4 May 2005 15:17:45 -0000       1.134
  +++ status.xml        5 May 2005 12:44:22 -0000       1.135
  @@ -31,6 +31,7 @@
     </todo>
     <changes>
       <release version="1.1-beta-2" date="unreleased">
  +      <action type="add" dev="JC" due-to="Achim Hügen" 
fixes-bug="HIVEMIND-107">JMX Enhancements </action>
         <action type="fix" dev="JC" fixes-bug="HIVEMIND-73" >BuilderFactory 
attempts to autowire java.util.List.</action>
         <action type="fix" dev="JC" fixes-bug="HIVEMIND-78" >Certain 
classloaders (AntClassLoader for example) cause NullPointerException in 
impl.MessageFormatter.</action>
         <action type="add" dev="JC" fixes-bug="HIVEMIND-91" >Add 
getModuleMessages() to Registry.</action>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to