User: mnf999  
  Date: 01/12/18 20:55:01

  Modified:    src/main/org/jboss/ejb ContainerFactory.java
  Log:
  support for new proxyfactory and deprecate container invoker
  
  Revision  Changes    Path
  1.106     +310 -296  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.105
  retrieving revision 1.106
  diff -u -r1.105 -r1.106
  --- ContainerFactory.java     2001/12/09 07:35:15     1.105
  +++ ContainerFactory.java     2001/12/19 04:55:00     1.106
  @@ -1,9 +1,9 @@
   /*
  - * JBoss, the OpenSource J2EE webOS
  - *
  - * Distributable under LGPL license.
  - * See terms of license at gnu.org.
  - */
  +* JBoss, the OpenSource J2EE webOS
  +*
  +* Distributable under LGPL license.
  +* See terms of license at gnu.org.
  +*/
   package org.jboss.ejb;
   
   import java.net.MalformedURLException;
  @@ -55,9 +55,9 @@
   import org.jboss.management.j2ee.EjbModule;
   
   /**
  - * A ContainerFactory is used to deploy EJB applications. It can be given a
  - * URL to an EJB-jar or EJB-JAR XML file, which will be used to instantiate
  - * containers and make them available for invocation.
  +* A ContainerFactory is used to deploy EJB applications. It can be given a
  +* URL to an EJB-jar or EJB-JAR XML file, which will be used to instantiate
  +* containers and make them available for invocation.
   *
   * <p>Now also works with message driven beans.
   *
  @@ -70,311 +70,312 @@
   * @author <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>.
   * @author <a href="mailto:[EMAIL PROTECTED]";>Scott Stark</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>Sacha Labourey</a>
  -* @version $Revision: 1.105 $
  +* @version $Revision: 1.106 $ 
   */
   public class ContainerFactory
  -   extends ServiceMBeanSupport
  -   implements ContainerFactoryMBean
  +extends ServiceMBeanSupport
  +implements ContainerFactoryMBean
   {
      // Constants -----------------------------------------------------
      private static final String SERVICE_CONTROLLER_NAME = 
"JBOSS-SYSTEM:spine=ServiceController";
  -
  +   
      public static String DEFAULT_STATELESS_CONFIGURATION = "Default Stateless 
SessionBean";
      public static String DEFAULT_STATEFUL_CONFIGURATION = "Default Stateful 
SessionBean";
      public static String DEFAULT_ENTITY_BMP_CONFIGURATION = "Default BMP EntityBean";
      public static String DEFAULT_ENTITY_CMP_CONFIGURATION = "Default CMP EntityBean";
      public static String DEFAULT_MESSAGEDRIVEN_CONFIGURATION = "Default MesageDriven 
Bean";
  -
  +   
      // Constants uses with container interceptor configurations
      public static final int BMT = 1;
      public static final int CMT = 2;
      public static final int ANY = 3;
  -
  +   
      static final String BMT_VALUE = "Bean";
      static final String CMT_VALUE = "Container";
      static final String ANY_VALUE = "Both";
  -
  +   
      // Attributes ----------------------------------------------------
  -
  +   
      /**
  -    * A map of current deployments. If a deployment is made and it is
  -    * already in this map, then undeploy it first (i.e. make it a re-deploy).
  -    */
  +   * A map of current deployments. If a deployment is made and it is
  +   * already in this map, then undeploy it first (i.e. make it a re-deploy).
  +   */
      HashMap deployments = new HashMap();
  -
  +   
      /** Verify EJB-jar contents on deployments */
      boolean verifyDeployments = false;
  -
  +   
      /** Enable verbose verification. */
      boolean verifierVerbose = false;
  -
  +   
      /** Enable metrics interceptor */
      boolean metricsEnabled = false;
  -
  +   
      /** Enable JMS monitoring of the bean cache */
      private boolean m_beanCacheJMSMonitoring;
  -
  +   
      /** A flag indicating if deployment descriptors should be validated */
      private boolean validateDTDs;
  -
  +   
      // Public --------------------------------------------------------
  -
  +   
      /**
  -    * Returns the deployed applications.
  -    */
  +   * Returns the deployed applications.
  +   */
      public Iterator getDeployedApplications()
      {
         return deployments.values().iterator();
      }
  -
  +   
      /**
  -    * Implements the abstract <code>getObjectName()</code> method in superclass
  -    * to return this service's name.
  -    *
  -    * @param server
  -    * @param name
  -    * @return
  -    *
  -    * @throws MalformedObjectNameException
  -    */
  +   * Implements the abstract <code>getObjectName()</code> method in superclass
  +   * to return this service's name.
  +   *
  +   * @param server
  +   * @param name
  +   * @return
  +   *
  +   * @throws MalformedObjectNameException
  +   */
      public ObjectName getObjectName( MBeanServer server, ObjectName name )
  -      throws MalformedObjectNameException
  +   throws MalformedObjectNameException
      {
         return new ObjectName( OBJECT_NAME );
      }
  -
  +   
      /**
  -    * Implements the abstract <code>getName()</code> method in superclass to
  -    * return the name of this object.
  -    *
  -    * @return <tt>'Container factory'</code>
  -    */
  +   * Implements the abstract <code>getName()</code> method in superclass to
  +   * return the name of this object.
  +   *
  +   * @return <tt>'Container factory'</code>
  +   */
      public String getName()
      {
         return "Container factory";
      }
  -
  +   
      /**
  -    * Implements the template method in superclass. This method stops all the
  -    * applications in this server.
  -    */
  +   * Implements the template method in superclass. This method stops all the
  +   * applications in this server.
  +   */
      public void stopService()
      {
         for (Iterator apps = deployments.values().iterator(); apps.hasNext(); )
         {
            Application app = (Application) apps.next();
  -
  +         
            app.stop();
         }
         deployments.clear();
      }
  -
  +   
      /**
  -    * Implements the template method in superclass. This method destroys all
  -    * the applications in this server and clears the deployments list.
  -    */
  +   * Implements the template method in superclass. This method destroys all
  +   * the applications in this server and clears the deployments list.
  +   */
      /*
      public void destroyService()
      {
  -      Iterator apps = deployments.values().iterator();
  -
  -      while( apps.hasNext() )
  -      {
  -         Application app = (Application) apps.next();
  -
  -         app.destroy();
  -      }
  -
  -      deployments.clear();
  +   Iterator apps = deployments.values().iterator();
  +   
  +   while( apps.hasNext() )
  +   {
  +   Application app = (Application) apps.next();
  +   
  +   app.destroy();
      }
  +   
  +   deployments.clear();
  +   }
      */
      /**
  -    * Enables/disables the application bean verification upon deployment.
  -    *
  -    * @param   verify  true to enable; false to disable
  -    */
  +   * Enables/disables the application bean verification upon deployment.
  +   *
  +   * @param   verify  true to enable; false to disable
  +   */
      public void setVerifyDeployments( boolean verify )
      {
         verifyDeployments = verify;
      }
  -
  +   
      /**
  -    * Returns the state of bean verifier (on/off)
  -    *
  -    * @return   true if enabled; false otherwise
  -    */
  +   * Returns the state of bean verifier (on/off)
  +   *
  +   * @return   true if enabled; false otherwise
  +   */
      public boolean getVerifyDeployments()
      {
         return verifyDeployments;
      }
  -
  +   
      /**
  -    * Enables/disables the verbose mode on the verifier.
  -    *
  -    * @param   verbose  true to enable; false to disable
  -    */
  +   * Enables/disables the verbose mode on the verifier.
  +   *
  +   * @param   verbose  true to enable; false to disable
  +   */
      public void setVerifierVerbose( boolean verbose )
      {
         verifierVerbose = verbose;
      }
  -
  +   
      /**
  -    * Returns the state of the bean verifier (verbose/non-verbose mode)
  -    *
  -    * @return true if enabled; false otherwise
  -    */
  +   * Returns the state of the bean verifier (verbose/non-verbose mode)
  +   *
  +   * @return true if enabled; false otherwise
  +   */
      public boolean getVerifierVerbose()
      {
         return verifierVerbose;
      }
  -
  +   
      /**
  -    * Enables/disables the metrics interceptor for containers.
  -    *
  -    * @param enable  true to enable; false to disable
  -    */
  +   * Enables/disables the metrics interceptor for containers.
  +   *
  +   * @param enable  true to enable; false to disable
  +   */
      public void setMetricsEnabled( boolean enable )
      {
         metricsEnabled = enable;
      }
  -
  +   
      /**
  -    * Checks if this container factory initializes the metrics interceptor.
  -    *
  -    * @return   true if metrics are enabled; false otherwise
  -    */
  +   * Checks if this container factory initializes the metrics interceptor.
  +   *
  +   * @return   true if metrics are enabled; false otherwise
  +   */
      public boolean isMetricsEnabled()
      {
         return metricsEnabled;
      }
  -
  +   
      /**
  -    * Set JMS monitoring of the bean cache.
  -    */
  +   * Set JMS monitoring of the bean cache.
  +   */
      public void setBeanCacheJMSMonitoringEnabled( boolean enable )
      {
         m_beanCacheJMSMonitoring = enable;
      }
  -
  +   
      /**
  -    * Get the flag indicating that ejb-jar.dtd, jboss.dtd &
  -    * jboss-web.dtd conforming documents should be validated
  -    * against the DTD.
  -    */
  +   * Get the flag indicating that ejb-jar.dtd, jboss.dtd &
  +   * jboss-web.dtd conforming documents should be validated
  +   * against the DTD.
  +   */
      public boolean getValidateDTDs()
      {
         return validateDTDs;
      }
  -
  +   
      /**
  -    * Set the flag indicating that ejb-jar.dtd, jboss.dtd &
  -    * jboss-web.dtd conforming documents should be validated
  -    * against the DTD.
  -    */
  +   * Set the flag indicating that ejb-jar.dtd, jboss.dtd &
  +   * jboss-web.dtd conforming documents should be validated
  +   * against the DTD.
  +   */
      public void setValidateDTDs(boolean validate)
      {
         this.validateDTDs = validate;
      }
  -
  +   
      public void deploy( String pParentId, String url, String appId )
  -      throws MalformedURLException, DeploymentException
  +   throws MalformedURLException, DeploymentException
      {
         // Delegate to "real" deployment
         deploy( pParentId, new URL( url ), appId );
      }
  -
  +   
      //
      // Richard Gyger
      //
      public void deploy( String pParentId, String appUrl, String[] jarUrls, String 
appId )
  -      throws MalformedURLException, DeploymentException
  +   throws MalformedURLException, DeploymentException
      {
         log.debug("got to deploy in ContainerFactory");
         
         // Delegate to "real" deployment
         URL[] tmp = new URL[ jarUrls.length ];
  -
  +      
         for( int i = 0; i < tmp.length; i++ )
            tmp[ i ] = new URL( jarUrls[ i ] );
  -
  +      
         deploy( pParentId, new URL( appUrl ), tmp, appId );
      }
  -
  +   
      /**
  -    * Undeploy the file at this URL. This method is typically called from
  -    * remote administration tools that cannot handle java.net.URL's as
  -    * parameters to methods
  -    *
  -    * @param url
  -    *
  -    * @throws MalformedURLException
  -    * @throws DeploymentException
  -    */
  +   * Undeploy the file at this URL. This method is typically called from
  +   * remote administration tools that cannot handle java.net.URL's as
  +   * parameters to methods
  +   *
  +   * @param url
  +   *
  +   * @throws MalformedURLException
  +   * @throws DeploymentException
  +   */
      public void undeploy( String url )
  -      throws MalformedURLException, DeploymentException
  +   throws MalformedURLException, DeploymentException
      {
         // Delegate to "real" undeployment
         undeploy( new URL( url ) );
      }
  -
  +   
      /**
  -    * Deploy EJBs pointed to by an URL.
  -    * The URL may point to an EJB-JAR, an EAR-JAR, or an codebase
  -    * whose structure resembles that of an EJB-JAR. <p>
  -    *
  -    * The latter is useful for development since no packaging is required.
  -    *
  -    * @param url    URL where EJB deployment information is contained
  -    *
  -    * @throws DeploymentException
  -    */
  +   * Deploy EJBs pointed to by an URL.
  +   * The URL may point to an EJB-JAR, an EAR-JAR, or an codebase
  +   * whose structure resembles that of an EJB-JAR. <p>
  +   *
  +   * The latter is useful for development since no packaging is required.
  +   *
  +   * @param url    URL where EJB deployment information is contained
  +   *
  +   * @throws DeploymentException
  +   */
      public synchronized void deploy( String pParentId, URL url, String appId )
  -      throws DeploymentException
  +   throws DeploymentException
      {
         deploy( pParentId, url, new URL[]{ url }, appId );
      }
  -
  +   
      //
      // Richard Gyger
      //
      public synchronized void deploy( String pParentId, URL appUrl, URL[] jarUrls, 
String appId )
  -      throws DeploymentException
  +   throws DeploymentException
      {
         // Create application
         Application app = new Application();
  -
  +      
         try
         {
            // Check if already deployed -> undeploy first, this is re-deploy
            if( deployments.containsKey( appUrl ) )
               undeploy( appUrl );
  -
  +         
            app.setURL( appUrl );
  +         
            if (log.isDebugEnabled()) {
               log.debug( "Deploying: " + appUrl );
            }
   
            /* Create a subclass of URLClassLoader that allows for dynamic class
  -            loading via the WebServiceMBean
  +         loading via the WebServiceMBean
            */
            WebClassLoader cl = new WebClassLoader( jarUrls, 
Thread.currentThread().getContextClassLoader() );
            app.setClassLoader( cl );
  -
  +         
            // Add to webserver so client can access classes through dynamic class 
downloading
            // This needs to be done before we deploy our app, as the RMI subsystem 
will use, as a codebase, the URL we
            // set here to our WebClassLoader (when creating home proxies for example)
            WebServiceMBean webServer = (WebServiceMBean) MBeanProxy.create( 
WebServiceMBean.class, WebServiceMBean.OBJECT_NAME );
            URL[] codebase = { webServer.addClassLoader(cl) };
            cl.setWebURLs(codebase);
  -
  +         
            for( int i = 0; i < jarUrls.length; i++ )
               deploy( app, jarUrls[ i ], cl, pParentId, appId );
  -
  +         
            // Init application
  -         //app.init();
  +         //app.create();
            // Start application
            app.start();
  -
  +         
            // Done
            if (log.isDebugEnabled()) {
               log.debug( "Deployed: " + app.getName() );
  @@ -388,13 +389,13 @@
            log.error("Could not deploy " + appUrl.toString(), e);
            app.stop();
            //app.destroy();
  -
  +         
            throw new DeploymentException( "Could not deploy " + appUrl.toString(), e 
);
         }
      }
  -
  +   
      private void deploy( Application app, URL url, ClassLoader cl, String pParentId, 
String pAppId )
  -      throws NamingException, Exception
  +   throws NamingException, Exception
      {
         // Create JSR-77 EJB-Module
         int i = app.getName().lastIndexOf( "/" );
  @@ -410,10 +411,10 @@
         if( lModule != null ) {
            app.setModuleName( lModule.toString() );
         }
  -
  +      
         // Create a file loader with which to load the files
         XmlFileLoader efm = new XmlFileLoader(validateDTDs);
  -
  +      
         // the file manager gets its file from the classloader
         // create a classloader that to access the metadata
         // this one dont has the contextclassloader as parent
  @@ -423,10 +424,10 @@
         // otherwise you are going to get runtime classcasts.
         ClassLoader localCl = new URLClassLoader( new URL[]{ url } );
         efm.setClassLoader( localCl );
  -
  +      
         // Load XML
         ApplicationMetaData metaData = efm.load();
  -
  +      
         // Check validity
         NDC.push("Verifier" );
         // wrapping this into a try - catch block to prevent errors in
  @@ -436,7 +437,7 @@
            if( verifyDeployments )
            {
               BeanVerifier verifier = new BeanVerifier();
  -
  +            
               verifier.addVerificationListener( new DeployListener ());
               log.info( "Verifying " + url );
               verifier.verify( url, metaData, cl );
  @@ -446,18 +447,17 @@
         {
            log.error("Verfiy failed", t );
         }
  -
  +      
         // unset verifier log
         NDC.pop();
  -
  +      
         // Get list of beans for which we will create containers
         
         // Deploy beans
  -      Context ctx = new InitialContext();
         for (Iterator beans = metaData.getEnterpriseBeans(); beans.hasNext(); ) 
         {
            BeanMetaData bean = (BeanMetaData) beans.next();
  -
  +         
            log.info( "Deploying " + bean.getEjbName() );
            try 
            {
  @@ -468,29 +468,29 @@
               log.error("error adding container to app.", e);
               throw e;
            } // end of try-catch
  -
  +      
         }
      }
  -
  +   
      /**
  -    * Remove previously deployed EJBs.
  -    *
  -    * @param url
  -    *
  -    * @throws DeploymentException
  -    */
  +   * Remove previously deployed EJBs.
  +   *
  +   * @param url
  +   *
  +   * @throws DeploymentException
  +   */
      public void undeploy( URL url )
  -      throws DeploymentException
  +   throws DeploymentException
      {
         // Get application from table
         Application app = (Application) deployments.get( url );
  -
  +      
         // Check if deployed
         if( app == null )
         {
            throw new DeploymentException( "URL not deployed" );
         }
  -
  +      
         // Undeploy application
         log.info( "Undeploying:" + url );
         app.stop();
  @@ -514,39 +514,39 @@
            log.info( "Undeployed application: " + app.getName() );
         }
      }
  -
  +   
      /**
  -    * Is the aplication with this url deployed.
  -    *
  -    * @param url
  -    *
  -    * @throws MalformedURLException
  -    */
  +   * Is the aplication with this url deployed.
  +   *
  +   * @param url
  +   *
  +   * @throws MalformedURLException
  +   */
      public boolean isDeployed( String url )
  -      throws MalformedURLException
  +   throws MalformedURLException
      {
         return isDeployed( new URL( url ) );
      }
  -
  +   
      /**
  -    * Check if the application with this url is deployed.
  -    *
  -    * @param url
  -    * @return       true if deployed
  -    */
  +   * Check if the application with this url is deployed.
  +   *
  +   * @param url
  +   * @return       true if deployed
  +   */
      public boolean isDeployed( URL url )
      {
         return ( deployments.get( url ) != null );
      }
  -
  +   
      // ******************
      // Container Creation
      // ******************
  -
  +   
      private Container createContainer( BeanMetaData bean,
  -                                      ClassLoader cl,
  -                                      ClassLoader localCl )
  -      throws Exception
  +      ClassLoader cl,
  +      ClassLoader localCl )
  +   throws Exception
      {
         Container container = null;
         // Added message driven deployment
  @@ -572,11 +572,11 @@
         container.setMBeanServer(this.getServer());
         return container;
      }
  -
  +   
      private MessageDrivenContainer createMessageDrivenContainer( BeanMetaData bean,
  -                                                                ClassLoader cl,
  -                                                                ClassLoader localCl 
)
  -      throws Exception
  +      ClassLoader cl,
  +      ClassLoader localCl )
  +   throws Exception
      {
         // get the container configuration for this bean
         // a default configuration is now always provided
  @@ -585,18 +585,18 @@
         // Create container
         MessageDrivenContainer container = new MessageDrivenContainer();
         int transType = bean.isContainerManagedTx() ? CMT : BMT;
  -
  +      
         initializeContainer( container, conf, bean, transType, cl, localCl );
         container.setContainerInvoker( createContainerInvoker( conf, cl ) );
         container.setInstancePool( createInstancePool( conf, cl ) );
  -
  +      
         return container;
      }
  -
  +   
      private StatelessSessionContainer createStatelessSessionContainer( BeanMetaData 
bean,
  -                                                                      ClassLoader 
cl,
  -                                                                      ClassLoader 
localCl )
  -      throws Exception
  +      ClassLoader cl,
  +      ClassLoader localCl )
  +   throws Exception
      {
         // get the container configuration for this bean
         // a default configuration is now always provided
  @@ -608,14 +608,14 @@
         if (bean.getHome() != null)
            container.setContainerInvoker( createContainerInvoker( conf, cl ) );
         container.setInstancePool( createInstancePool( conf, cl ) );
  -
  +      
         return container;
      }
  -
  +   
      private StatefulSessionContainer createStatefulSessionContainer( BeanMetaData 
bean,
  -                                                                    ClassLoader cl,
  -                                                                    ClassLoader 
localCl )
  -      throws Exception
  +      ClassLoader cl,
  +      ClassLoader localCl )
  +   throws Exception
      {
         // get the container configuration for this bean
         // a default configuration is now always provided
  @@ -633,14 +633,14 @@
         container.setPersistenceManager( (StatefulSessionPersistenceManager) 
cl.loadClass( conf.getPersistenceManager() ).newInstance() );
         //Set the bean Lock Manager
         container.setLockManager(createBeanLockManager(false,conf.getLockClass(), 
cl));
  -
  +      
         return container;
      }
  -
  +   
      private EntityContainer createEntityContainer( BeanMetaData bean,
  -                                                  ClassLoader cl,
  -                                                  ClassLoader localCl )
  -      throws Exception
  +      ClassLoader cl,
  +      ClassLoader localCl )
  +   throws Exception
      {
         // get the container configuration for this bean
         // a default configuration is now always provided
  @@ -655,7 +655,7 @@
         container.setInstancePool( createInstancePool( conf, cl ) );
         //Set the bean Lock Manager
         container.setLockManager(createBeanLockManager(((EntityMetaData) 
bean).isReentrant(),conf.getLockClass(), cl));
  -
  +      
         // Set persistence manager
         if( ( (EntityMetaData) bean ).isBMP() )
         {
  @@ -666,31 +666,31 @@
         {
            // CMP takes a manager and a store
            org.jboss.ejb.plugins.CMPPersistenceManager persistenceManager =
  -            new org.jboss.ejb.plugins.CMPPersistenceManager();
  -
  +         new org.jboss.ejb.plugins.CMPPersistenceManager();
  +         
            //Load the store from configuration
            persistenceManager.setPersistenceStore( (EntityPersistenceStore) 
cl.loadClass( conf.getPersistenceManager() ).newInstance() );
            // Set the manager on the container
            container.setPersistenceManager( persistenceManager );
         }
  -
  +      
         return container;
      }
  -
  +   
      // **************
      // Helper Methods
      // **************
  -
  +   
      /**
  -    * Perform the common steps to initializing a container.
  -    */
  +   * Perform the common steps to initializing a container.
  +   */
      private void initializeContainer( Container container,
  -                                     ConfigurationMetaData conf,
  -                                     BeanMetaData bean,
  -                                     int transType,
  -                                     ClassLoader cl,
  -                                     ClassLoader localCl )
  -      throws NamingException, DeploymentException
  +      ConfigurationMetaData conf,
  +      BeanMetaData bean,
  +      int transType,
  +      ClassLoader cl,
  +      ClassLoader localCl )
  +   throws NamingException, DeploymentException
      {
         // Create classloader for this container
         // Only used to unique the bean ENC and does not augment class loading
  @@ -703,15 +703,15 @@
         // Set transaction manager
         InitialContext iniCtx = new InitialContext();
         container.setTransactionManager( (TransactionManager) iniCtx.lookup( 
"java:/TransactionManager" ) );
  -
  +      
         // Set security domain manager
         String securityDomain = bean.getApplicationMetaData().getSecurityDomain();
         String confSecurityDomain = conf.getSecurityDomain();
         /* These are deprecated.
  -         String securityManagerJNDIName = conf.getAuthenticationModule();
  -         String roleMappingManagerJNDIName = conf.getRoleMappingManager();
  +      String securityManagerJNDIName = conf.getAuthenticationModule();
  +      String roleMappingManagerJNDIName = conf.getRoleMappingManager();
         */
  -
  +      
         if( securityDomain != null || confSecurityDomain != null )
         {   // Either the application has a security domain or the container has 
security setup
            try
  @@ -730,7 +730,7 @@
               throw new DeploymentException( "Could not find the Security Manager 
specified for this container, name="+confSecurityDomain, ne);
            }
         }
  -
  +      
         // Load the security proxy instance if one was configured
         String securityProxyClassName = bean.getSecurityProxy();
         if( securityProxyClassName != null )
  @@ -747,44 +747,44 @@
               throw new DeploymentException("Failed to create SecurityProxy of type: 
" + securityProxyClassName + ", "+ conf.getContainerInvoker() +" - " + e);
            }
         }
  -
  +      
         // Install the container interceptors based on the configuration
         addInterceptors(container, transType, conf.getContainerInterceptorsConf());
      }
  -
  +   
      /**
  -    * Given a container-interceptors element of a container-configuration,
  -    * add the indicated interceptors to the container depending on the container
  -    * transcation type and metricsEnabled flag.
  -    *
  -    * FIXME marcf: frankly the transaction type stuff makes no sense to me, we have 
externalized
  -    * the container stack construction in jbossxml and I don't see why or why there 
would be a 
  -    * type missmatch on the transaction
  -    * 
  -    * @param container   the container instance to setup.
  -    * @param transType   one of the BMT, CMT or ANY constants.
  -    * @param element     the container-interceptors element from the
  -    *                    container-configuration.
  -    */
  +   * Given a container-interceptors element of a container-configuration,
  +   * add the indicated interceptors to the container depending on the container
  +   * transcation type and metricsEnabled flag.
  +   *
  +   * FIXME marcf: frankly the transaction type stuff makes no sense to me, we have 
externalized
  +   * the container stack construction in jbossxml and I don't see why or why there 
would be a 
  +   * type missmatch on the transaction
  +   * 
  +   * @param container   the container instance to setup.
  +   * @param transType   one of the BMT, CMT or ANY constants.
  +   * @param element     the container-interceptors element from the
  +   *                    container-configuration.
  +   */
      private void addInterceptors(Container container,
  -                                int transType,
  -                                Element element)
  +      int transType,
  +      Element element)
      {
         // Get the interceptor stack(either jboss.xml or standardjboss.xml)
         Iterator interceptorElements = MetaData.getChildrenByTagName(element, 
"interceptor");
         String transTypeString = stringTransactionValue(transType);
         ClassLoader loader = container.getClassLoader();
         /* First build the container interceptor stack from interceptorElements
  -         match transType and metricsEnabled values
  +      match transType and metricsEnabled values
         */
         ArrayList istack = new ArrayList();
         while( interceptorElements != null && interceptorElements.hasNext() )
         {
            Element ielement = (Element) interceptorElements.next();
            /* Check that the interceptor is configured for the transaction mode of 
the bean
  -            by comparing its 'transaction' attribute to the string representation
  -            of transType
  -            FIXME: marcf, WHY???????
  +         by comparing its 'transaction' attribute to the string representation
  +         of transType
  +         FIXME: marcf, WHY???????
            */
            String transAttr = ielement.getAttribute("transaction");
            if( transAttr == null || transAttr.length() == 0 )
  @@ -795,7 +795,7 @@
               boolean metricsInterceptor = metricsAttr.equalsIgnoreCase("true");
               if( metricsEnabled == false && metricsInterceptor == true )
                  continue;
  -
  +            
               String className = null;
               try
               {
  @@ -810,73 +810,87 @@
               }
            }
         }
  -
  +      
         if( istack.size() == 0 )
            log.warn("There are no interceptors configured. Check the 
standardjboss.xml file");
  -
  +      
         // Now add the interceptors to the container
         for(int i = 0; i < istack.size(); i ++)
         {
            Interceptor interceptor = (Interceptor) istack.get(i);
            container.addInterceptor(interceptor);
         }
  -
  +      
         /* If there is a security proxy associated with the container add its
  -         interceptor just before the container interceptor
  +      interceptor just before the container interceptor
         */
         if( container.getSecurityProxy() != null )
            container.addInterceptor(new SecurityProxyInterceptor());
  -
  +      
         // Finally we add the last interceptor from the container
         container.addInterceptor(container.createContainerInterceptor());
      }
  -
  +   
      private static String stringTransactionValue(int transType)
      {
         String transaction = ANY_VALUE;
         switch( transType )
         {
  -       case BMT:
  -          transaction = BMT_VALUE;
  -          break;
  -       case CMT:
  -          transaction = CMT_VALUE;
  -          break;
  +         case BMT:
  +            transaction = BMT_VALUE;
  +         break;
  +         case CMT:
  +            transaction = CMT_VALUE;
  +         break;
         }
         return transaction;
      }
  -
  +   
  +   /**
  +   * createCOntainerInvoker DEPRACATED CONTAINER INVOKER DOES NOTHING BUT 
MANUFACTURE EJBs
  +   *
  +   * Move to EJBFactory, implement with ProxyFactory.   The EJBFactory must be made 
aware of invocation type
  +   *
  +   * FIXME : TEMPORARY 
  +   */
      private static ContainerInvoker createContainerInvoker( ConfigurationMetaData 
conf,
  -                                                           ClassLoader cl )
  -      throws Exception
  +      ClassLoader cl )
  +   throws Exception
      {
         // Set container invoker
         ContainerInvoker ci = null;
  -
  +      
  +      String invoker =conf.getContainerInvoker();
  +      
  +      // Just a nicety for 2.4 legacy users
  +      if (invoker.equals("org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker"))
  +         invoker = "org.jboss.proxy.ejb.ProxyFactory";
  +         
         try
         {
  -         ci = (ContainerInvoker) cl.loadClass( conf.getContainerInvoker() 
).newInstance();
  +         
  +         ci = (ContainerInvoker) cl.loadClass(invoker).newInstance();
         }
         catch( Exception e )
         {
  -         throw new DeploymentException( "Missing or invalid Container Invoker (in 
jboss.xml or standardjboss.xml): " + conf.getContainerInvoker() + " - " + e );
  +         throw new DeploymentException( "Missing or invalid Container Invoker (in 
jboss.xml or standardjboss.xml): " + invoker+ " - " + e );
         }
  -
  +      
         if( ci instanceof XmlLoadable )
            // the container invoker can load its configuration from the jboss.xml 
element
  -         ( (XmlLoadable) ci ).importXml( conf.getContainerInvokerConf() );
  -
  +      ( (XmlLoadable) ci ).importXml( conf.getContainerInvokerConf() );
  +      
         return ci;
      }
  -
  -
  +   
  +   
      private static BeanLockManager createBeanLockManager( boolean reentrant, String 
beanLock,
  -                                                         ClassLoader cl )
  -      throws Exception
  +      ClassLoader cl )
  +   throws Exception
      {
         // The bean lock manager
         BeanLockManager lockManager = new BeanLockManager();
  -
  +      
         Class lockClass = null;
         try
         {
  @@ -886,20 +900,20 @@
         {
            throw new DeploymentException( "Missing or invalid lock class (in 
jboss.xml or standardjboss.xml): " + beanLock+ " - " + e );
         }
  -
  +      
         lockManager.setLockCLass(lockClass);
         lockManager.setReentrant(reentrant);
  -
  +      
         return lockManager;
      }
  -
  +   
      private static InstancePool createInstancePool( ConfigurationMetaData conf,
  -                                                   ClassLoader cl )
  -      throws Exception
  +      ClassLoader cl )
  +   throws Exception
      {
         // Set instance pool
         InstancePool ip = null;
  -
  +      
         try
         {
            ip = (InstancePool) cl.loadClass( conf.getInstancePool() ).newInstance();
  @@ -908,25 +922,25 @@
         {
            throw new DeploymentException( "Missing or invalid Instance Pool (in 
jboss.xml or standardjboss.xml)" );
         }
  -
  +      
         if( ip instanceof XmlLoadable )
            ( (XmlLoadable) ip ).importXml( conf.getContainerPoolConf() );
  -
  +      
         return ip;
      }
  -
  +   
      private static InstanceCache createInstanceCache( ConfigurationMetaData conf,
  -                                                     boolean jmsMonitoring,
  -                                                     ClassLoader cl )
  -      throws Exception
  +      boolean jmsMonitoring,
  +      ClassLoader cl )
  +   throws Exception
      {
         // Set instance cache
         InstanceCache ic = null;
  -
  +      
         try
         {
            ic = (InstanceCache) cl.loadClass( conf.getInstanceCache() ).newInstance();
  -
  +         
            if( ic instanceof AbstractInstanceCache )
               ( (AbstractInstanceCache) ic ).setJMSMonitoringEnabled( jmsMonitoring );
         }
  @@ -934,21 +948,21 @@
         {
            throw new DeploymentException( "Missing or invalid Instance Cache (in 
jboss.xml or standardjboss.xml)" );
         }
  -
  +      
         if( ic instanceof XmlLoadable )
            ( (XmlLoadable) ic ).importXml( conf.getContainerCacheConf() );
  -
  +      
         return ic;
      }
  -
  +   
      /** A callback listener for the EJB verifier.
      */
      class DeployListener implements VerificationListener
      {
         /* Accessing the ContainerFactory.log directory is
  -         causing a NoSuchMethodError when the log is used
  -         so obtain it via the getLog() method and then use
  -         logger
  +      causing a NoSuchMethodError when the log is used
  +      so obtain it via the getLog() method and then use
  +      logger
         */
         final Logger logger = ContainerFactory.this.getLog();
         public void beanChecked( VerificationEvent event )
  @@ -962,8 +976,8 @@
            else
               logger.info( event.getMessage() );
         }
  -  }
  -
  +   }
  +   
      protected ObjectName getServiceControllerName() throws DeploymentException
      {
         try 
  
  
  

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

Reply via email to