User: schaefera
  Date: 01/06/15 22:53:38

  Modified:    src/main/org/jboss/ejb Application.java
                        ContainerFactory.java
  Log:
  Added the support for classes with a single string as only argument for
  the constructor to the ConfigurationService. Some fixes and additional
  methods for the JBoss management.
  
  Revision  Changes    Path
  1.11      +2 -1      jboss/src/main/org/jboss/ejb/Application.java
  
  Index: Application.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/Application.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Application.java  2001/06/03 20:59:40     1.10
  +++ Application.java  2001/06/16 05:53:38     1.11
  @@ -10,6 +10,7 @@
   import java.util.Iterator;
   import java.util.Collection;
   import java.util.HashMap;
  +import java.util.Hashtable;
   
   import javax.ejb.EJBLocalHome;
   
  @@ -22,7 +23,7 @@
    *   @see Container
    *   @see ContainerFactory
    *   @author Rickard Öberg ([EMAIL PROTECTED])
  - *   @version $Revision: 1.10 $
  + *   @version $Revision: 1.11 $
    */
   public class Application
        implements Service
  
  
  
  1.77      +49 -57    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.76
  retrieving revision 1.77
  diff -u -r1.76 -r1.77
  --- ContainerFactory.java     2001/06/14 23:44:31     1.76
  +++ ContainerFactory.java     2001/06/16 05:53:38     1.77
  @@ -23,6 +23,7 @@
   import java.util.Properties;
   import java.util.Iterator;
   import java.util.HashMap;
  +import java.util.Hashtable;
   import java.util.ArrayList;
   import java.util.StringTokenizer;
   import java.util.jar.JarFile;
  @@ -56,8 +57,6 @@
   import org.jboss.metadata.ConfigurationMetaData;
   import org.jboss.metadata.XmlLoadable;
   import org.jboss.metadata.XmlFileLoader;
  -import org.jboss.mgt.EJB;
  -import org.jboss.mgt.Module;
   import org.jboss.security.EJBSecurityManager;
   import org.jboss.security.RealmMapping;
   import org.jboss.util.MBeanProxy;
  @@ -82,7 +81,7 @@
   *   @author Peter Antman ([EMAIL PROTECTED])
   *   @author Scott Stark([EMAIL PROTECTED])
   *
  -*   @version $Revision: 1.76 $
  +*   @version $Revision: 1.77 $
   */
   public class ContainerFactory
     extends org.jboss.util.ServiceMBeanSupport
  @@ -369,6 +368,11 @@
         app.init();
         // Start application
         app.start();
  +      // Startup the Management MBean Wrapper for the containers
  +      Iterator i = app.containers.values().iterator();
  +      while( i.hasNext() ) {
  +         handleContainerManagement( (Container) i.next(), true );
  +      }
   
         // Add to webserver so client can access classes through dynamic class 
downloading
         WebServiceMBean webServer = (WebServiceMBean) MBeanProxy.create( 
WebServiceMBean.class, WebServiceMBean.OBJECT_NAME );
  @@ -401,6 +405,20 @@
         {
         Log.unsetLog();
         }
  +      // Inform the Data Collector that new/old EJBs were deployed
  +      try
  +        {
  +        getServer().invoke(
  +          new ObjectName( "Management", "service", "Collector" ),
  +          "refresh",
  +          new Object[] {},
  +          new String[] {}
  +        );
  +        }
  +      catch( Exception e )
  +        {
  +        e.printStackTrace();
  +        }
       }
   
     private void deploy( Application app, URL url, ClassLoader cl )
  @@ -470,20 +488,6 @@
           log.log( "Deploying " + bean.getEjbName() );
           app.addContainer( createContainer( bean, cl, localCl ) );
           }
  -      // Inform the Data Collector that new/old EJBs were deployed
  -      try
  -        {
  -        getServer().invoke(
  -          new ObjectName( "Management", "service", "Collector" ),
  -          "refresh",
  -          new Object[] {},
  -          new String[] {}
  -        );
  -        }
  -      catch( Exception e )
  -        {
  -        e.printStackTrace();
  -        }
       }
   
     /**
  @@ -508,28 +512,13 @@
       // Undeploy application
       Log.setLog( log );
       log.log( "Undeploying:" + url );
  +    // Shutdown the Management MBean Wrapper for the containers
  +    Iterator i = app.containers.values().iterator();
  +    while( i.hasNext() ) {
  +       handleContainerManagement( (Container) i.next(), false );
  +    }
       app.stop();
       app.destroy();
  -    try
  -       {
  -       // Remove EJBs management data
  -       getServer().invoke(
  -          new ObjectName( "Management", "service", "Collector" ),
  -          "removeModule",
  -          new Object[] {
  -             url.toString(),
  -             new Integer( org.jboss.mgt.Application.EJBS )
  -          },
  -          new String[] {
  -             "".getClass().getName(),
  -             Integer.TYPE.getName()
  -          }
  -       );
  -       }
  -    catch( Exception e )
  -       {
  -       log.exception( e );
  -       }
       try {
           if ( app.getClassLoader() != null ) {
               // Remove from webserver 
  @@ -615,9 +604,6 @@
       container.setContainerInvoker( createContainerInvoker( conf, cl ) );
       container.setInstancePool( createInstancePool( conf, cl ) );
   
  -    //AS Test the exposure of the Container through a MBean
  -    registerContainer( container );
  -
       return container;
       }
   
  @@ -635,9 +621,6 @@
         container.setContainerInvoker( createContainerInvoker( conf, cl ) );
       container.setInstancePool( createInstancePool( conf, cl ) );
       
  -    //AS Test the exposure of the Container through a MBean
  -    registerContainer( container );
  -
       return container;
       }
   
  @@ -659,9 +642,6 @@
       // 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;
       }
   
  @@ -696,8 +676,6 @@
         // Set the manager on the container
         container.setPersistenceManager( persistenceManager );
         }
  -    //AS Test the exposure of the Container through a MBean
  -    registerContainer( container );
         
       return container;
       }
  @@ -705,18 +683,32 @@
     // **************
     // Helper Methods
     // **************
  +
     /**
  -   * Register the created container at the JMX server to make the container
  -   * available for outside management
  +   * Either creates the Management MBean wrapper for a container and start
  +   * it or it destroy it.
      **/
  -  private void registerContainer( Container container ) {
  +  private void handleContainerManagement( Container container, boolean doStart ) {
        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 ) );
  +        ObjectName name = new ObjectName( "Management", "jnidName", 
container.getBeanMetaData().getJndiName() );
  +        if( doStart ) {
  +           getServer().createMBean(
  +              "org.jboss.management.ContainerManagement",
  +              name,
  +              new Object[] { container },
  +              new String[] { "org.jboss.ejb.Container" }
  +           );
  +           getServer().invoke( name, "init", new Object[] {}, new String[] {} );
  +           getServer().invoke( name, "start", new Object[] {}, new String[] {} );
  +        }
  +        else {
  +           // If not startup then assume that the MBean is there
  +           getServer().invoke( name, "stop", new Object[] {}, new String[] {} );
  +           getServer().invoke( name, "destroy", new Object[] {}, new String[] {} );
  +           // Unregister the MBean to avoid future name conflicts
  +           getServer().unregisterMBean( name );
  +        }
        }
        catch( Exception e )
        {
  @@ -955,4 +947,4 @@
   
   * Thu Jun 14 23:28:58  2001 UTC, starksm
    Added support for validation of the j2ee related deployment descriptors.
  - */
  \ No newline at end of file
  + */
  
  
  

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

Reply via email to