User: schaefera
  Date: 01/12/02 18:26:02

  Modified:    src/main/org/jboss/system ServiceMBeanSupport.java
  Log:
  Added the State-Management to the JSR-77 JNDI component as well as
  adding the proper creation in the NamingService of this component.
  Now postRegister() and postDeregister() create/destroy the JSR-77
  representant because then start() and stop() works as expected.
  I also added a ServiceName which is the actual name of the MBean
  to the ServiceMBeanSupport therefore the MBean itself can hand its
  name over to another MBean (necessary for JSR-77).
  
  Revision  Changes    Path
  1.7       +40 -10    jboss/src/main/org/jboss/system/ServiceMBeanSupport.java
  
  Index: ServiceMBeanSupport.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/system/ServiceMBeanSupport.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ServiceMBeanSupport.java  2001/11/26 03:19:46     1.6
  +++ ServiceMBeanSupport.java  2001/12/03 02:26:01     1.7
  @@ -23,17 +23,24 @@
    * service that conforms to the ServiceMBean interface. Subclasses must
    * override {@link #getName} method and should override 
    * {@link #startService}, and {@link #stopService} as approriate.
  - * 
  - * 
  + *
    * @see ServiceMBean
    * 
    * @author <a href="mailto:[EMAIL PROTECTED]";>Rickard �berg</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Scott Stark</a>
  - * @version $Revision: 1.6 $
  - * 
  - * Revisions:
  - * 20010619 scott.stark: use the full service class name as the log4j
  - *                       log name
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Andreas Schaefer</a>
  + * @version $Revision: 1.7 $
  + *   
  + * <p><b>Revisions:</b>
  + *
  + * <p><b>20010619 scott.stark:</b>
  + * <ul>
  + * <li> use the full service class name as the log4j log name
  + * </ul>
  + * <p><b>20011202 Andreas Schaefer:</b>
  + * <ul>
  + * <li> Add the own MBean Service Name to be remembered in an attribute
  + * </ul>
    */
   public abstract class ServiceMBeanSupport
      extends NotificationBroadcasterSupport
  @@ -43,6 +50,8 @@
   
      private int state;
      private MBeanServer server;
  +   /** Own Object Name this MBean is registered with, see {@link #preRegister 
preRegister()}. **/
  +   private ObjectName mServiceName;
      private int id = 0;
   
      protected Logger log;
  @@ -60,6 +69,10 @@
   
      public abstract String getName();
   
  +     public ObjectName getServiceName() {
  +      return mServiceName;
  +   }
  +   
      public MBeanServer getServer()
      {
         return server;
  @@ -187,12 +200,30 @@
         NDC.pop();
      }
      */
  +   
  +   /**
  +   * Callback method of {@link javax.management.MBeanRegistration MBeanRegistration}
  +   * before the MBean is registered at the JMX Agent.
  +   * <br>
  +   * <b>Attention</b>: Always call this method when you overwrite it in a subclass
  +   *                   because it saves the Object Name of the MBean.
  +   *
  +   * @param server Reference to the JMX Agent this MBean is registered on
  +   * @param name Name specified by the creator of the MBean. Note that you can
  +   *             overwrite it when the given ObjectName is null otherwise the
  +   *             change is discarded (maybe a bug in JMX-RI).
  +   **/
      public ObjectName preRegister(MBeanServer server, ObjectName name)
         throws Exception
      {
  -      name = getObjectName(server, name);
  +      ObjectName lName = getObjectName(server, name);
  +      if( name == null ) {
  +         mServiceName = lName;
  +      } else {
  +         mServiceName = name;
  +      }
         this.server = server;
  -      return name;
  +      return lName;
      }
   
      public void postRegister(Boolean registrationDone)
  @@ -223,7 +254,6 @@
         return name;
      }
      
  -     
      protected void startService()
         throws Exception
      {
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to