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

  Modified:    src/main/org/jboss/naming NamingService.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.22      +41 -17    jboss/src/main/org/jboss/naming/NamingService.java
  
  Index: NamingService.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/naming/NamingService.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- NamingService.java        2001/11/28 06:33:38     1.21
  +++ NamingService.java        2001/12/03 02:26:01     1.22
  @@ -25,15 +25,26 @@
   import org.jboss.management.j2ee.JNDI;
   import org.jboss.system.ServiceMBeanSupport;
   
  -/** A JBoss service that starts the jnp JNDI server.
  - *      
  - *   @author <a href="mailto:[EMAIL PROTECTED]";>Rickard �berg</a>
  - *   @author <a href="mailto:[EMAIL PROTECTED]";>Scott Stark</a>.
  - *   @version $Revision: 1.21 $
  +/**
  + * A JBoss service that starts the jnp JNDI server.
    *
  - * Revisions:
  - * 20010622 scott.stark: Report IntialContext env for problem tracing
  - */
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Rickard �berg</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Scott Stark</a>.
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Andreas Schaefer</a>.
  + * @version $Revision: 1.22 $
  + *   
  + * <p><b>Revisions:</b>
  + *
  + * <p><b>20010622 scott.stark:</b>
  + * <ul>
  + * <li> Report IntialContext env for problem tracing
  + * </ul>
  + * <p><b>20011202 Andreas Schaefer:</b>
  + * <ul>
  + * <li> Added JSR-77 representation, see {@liink #postRegister postRegister()}
  + *      and {@link #postDeregister postDeregister()}.
  + * </ul>
  + **/
   public class NamingService
      extends ServiceMBeanSupport
      implements NamingServiceMBean
  @@ -43,6 +54,9 @@
      // Attributes ----------------------------------------------------
      Main naming;
      
  +   /** Object Name of the JSR-77 representant of this servie **/
  +   ObjectName mJNDI;
  +   
      // Static --------------------------------------------------------
   
      // Constructors --------------------------------------------------
  @@ -173,21 +187,31 @@
         Context ctx = (Context)iniCtx.lookup("java:");
         ctx.rebind("comp", envRef);
         log.info("Naming started on port "+naming.getPort());
  -      
  -      // Finally create the JSR-77 management representation
  -      JNDI.create( getServer(), "LocalJNDI" );
      }
   
      public void stopService()
      {
  -      // First destroy the JSR-77 management representation
  -      JNDI.destroy( getServer(), "LocalJNDI" );
  -      
         naming.stop();
         log.info("JNP server stopped");
      }
  -
  +   
  +   public void postRegister( Boolean pRegistrationDone )
  +   {
  +      super.postRegister( pRegistrationDone );
  +      if( pRegistrationDone.booleanValue() ) {
  +         // Create the JSR-77 management representation
  +         mJNDI = JNDI.create( getServer(), "LocalJNDI", getServiceName() );
  +      }
  +   }
  +   
  +   public void postDeregister()
  +   {
  +      super.postDeregister();
  +      if( mJNDI != null ) {
  +         // Destroy the JSR-77 management representation
  +         JNDI.destroy( getServer(), "LocalJNDI" );
  +      }
  +   }
  +   
      // Protected -----------------------------------------------------
   }
  -
  -
  
  
  

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

Reply via email to