User: schaefera
  Date: 01/05/30 22:38:51

  Modified:    src/main/org/jboss/ejb ContainerFactory.java
  Log:
  Added a MBean Wrapper for each created Container (as mentioned earlier
  in an Email) to be able to get a handle on deployed EJBs.
  
  Revision  Changes    Path
  1.70      +31 -3     jboss/src/main/org/jboss/ejb/ContainerFactory.java
  
  Index: ContainerFactory.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/ContainerFactory.java,v
  retrieving revision 1.69
  retrieving revision 1.70
  diff -u -r1.69 -r1.70
  --- ContainerFactory.java     2001/05/22 22:30:49     1.69
  +++ ContainerFactory.java     2001/05/31 05:38:50     1.70
  @@ -82,7 +82,7 @@
   *   @author Peter Antman ([EMAIL PROTECTED])
   *   @author Scott Stark([EMAIL PROTECTED])
   *
  -*   @version $Revision: 1.69 $
  +*   @version $Revision: 1.70 $
   */
   public class ContainerFactory
     extends org.jboss.util.ServiceMBeanSupport
  @@ -611,6 +611,9 @@
       container.setContainerInvoker( createContainerInvoker( conf, cl ) );
       container.setInstancePool( createInstancePool( conf, cl ) );
   
  +    //AS Test the exposure of the Container through a MBean
  +    registerContainer( container );
  +
       return container;
       }
   
  @@ -627,6 +630,9 @@
       container.setContainerInvoker( createContainerInvoker( conf, cl ) );
       container.setInstancePool( createInstancePool( conf, cl ) );
       
  +    //AS Test the exposure of the Container through a MBean
  +    registerContainer( container );
  +
       return container;
       }
   
  @@ -647,6 +653,9 @@
       // Set persistence manager
       container.setPersistenceManager( (StatefulSessionPersistenceManager) 
cl.loadClass( conf.getPersistenceManager() ).newInstance() );
   
  +    //AS Test the exposure of the Container through a MBean
  +    registerContainer( container );
  +
       return container;
       }
   
  @@ -680,14 +689,33 @@
         // Set the manager on the container
         container.setPersistenceManager( persistenceManager );
         }
  -
  +    //AS Test the exposure of the Container through a MBean
  +    registerContainer( container );
  +      
       return container;
       }
   
     // **************
     // Helper Methods
     // **************
  -
  +  /**
  +   * Register the created container at the JMX server to make the container
  +   * available for outside management
  +   **/
  +  private void registerContainer( Container container ) {
  +     try {
  +        // Create and register the ContainerMBean
  +        ObjectName name = new ObjectName( "Management", "container", 
container.getBeanMetaData().getEjbName() );
  +        getServer().createMBean( "org.jboss.mgt.ContainerMgt", name );
  +        getServer().invoke( name, "init", new Object[] {}, new String[] {} );
  +        getServer().invoke( name, "start", new Object[] {}, new String[] {} );
  +        getServer().setAttribute( name, new javax.management.Attribute( 
"Container", container ) );
  +     }
  +     catch( Exception e ) {
  +        e.printStackTrace();
  +     }
  +  }
  +  
     private void initializeContainer( Container container, ConfigurationMetaData 
conf, BeanMetaData bean, int transType, ClassLoader cl, ClassLoader localCl )
       throws NamingException, DeploymentException
       {
  
  
  

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

Reply via email to