/*
* jBoss, the OpenSource EJB server
*
* Distributable under GPL license.
* See terms of license at gnu.org.
*/
package org.jboss.ejb;

import org.jboss.ejb.plugins.*;
import org.jboss.metadata.*;

/**
 * StatefulSessionDeployer provides implementations of BeanDeployer methods
 * that are specific to Stateful Session Beans.
 *
 * @see BeanDeployer
 * @author <a href="mailto:[EMAIL PROTECTED]">Jack Bolles</a>
 */
public class StatefulSessionDeployer extends BeanDeployer {

       protected StatefulSessionDeployer(BeanMetaData bmd, ClassLoader
loader, boolean enableMetrics){
         super(bmd, loader, enableMetrics);
         container = new StatefulSessionContainer();
      }

      protected void setInstancePool() throws DeploymentException{
         // No real instance pool, use the shadow class
         container.setInstancePool(new StatefulSessionInstancePool());
      }

      protected void setInstanceCache() throws DeploymentException {
         // Set instance cache
         InstanceCache ic = null;
         try {
            ic = (InstanceCache)cl.loadClass(conf.getInstanceCache
()).newInstance();
            if(ic instanceof XmlLoadable) {
               ((XmlLoadable)ic).importXml(conf.getContainerCacheConf());
            }
         } catch(Exception e) {
            throw new DeploymentException("Missing or invalid Instance
Cache (in jboss.xml or standardjboss.xml)", e);
         }
         container.setInstanceCache(ic);
      }

      protected void setPersistenceManager() throws DeploymentException{
         // Set persistence manager
         try {
            ((StatefulSessionContainer)container).setPersistenceManager
((StatefulSessionPersistenceManager)cl.loadClass(conf.getPersistenceManager
()).newInstance());
         } catch(Exception e) {
            throw new DeploymentException("Missing or invalid Perisitence
Manager (in jboss.xml or standardjboss.xml)", e);
         }
      }

      protected void setInterceptors() throws DeploymentException {
         super.setInterceptors();
         container.addInterceptor(new StatefulSessionInstanceInterceptor
());
      }
   }



Reply via email to