[jboss-cvs] jboss-seam/src/main/org/jboss/seam ...

Gavin King gavin.king at jboss.com
Wed Oct 4 18:31:32 EDT 2006


  User: gavin   
  Date: 06/10/04 18:31:32

  Modified:    src/main/org/jboss/seam  Component.java
  Log:
  minor refactor
  
  Revision  Changes    Path
  1.172     +34 -18    jboss-seam/src/main/org/jboss/seam/Component.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Component.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/Component.java,v
  retrieving revision 1.171
  retrieving revision 1.172
  diff -u -b -r1.171 -r1.172
  --- Component.java	3 Oct 2006 17:16:44 -0000	1.171
  +++ Component.java	4 Oct 2006 22:31:32 -0000	1.172
  @@ -42,6 +42,7 @@
   import javax.ejb.Remote;
   import javax.ejb.Remove;
   import javax.interceptor.Interceptors;
  +import javax.naming.NamingException;
   import javax.servlet.http.HttpSessionActivationListener;
   
   import net.sf.cglib.proxy.Enhancer;
  @@ -105,7 +106,7 @@
    *
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
    * @author Gavin King
  - * @version $Revision: 1.171 $
  + * @version $Revision: 1.172 $
    */
   @Scope(ScopeType.APPLICATION)
   public class Component
  @@ -878,6 +879,31 @@
       {
           switch(type) {
              case JAVA_BEAN:
  +              return instantiateJavaBean();
  +           case ENTITY_BEAN:
  +              return instantiateEntityBean();
  +           case STATELESS_SESSION_BEAN:
  +           case STATEFUL_SESSION_BEAN:
  +              return instantiateSessionBean();
  +           case MESSAGE_DRIVEN_BEAN:
  +              throw new UnsupportedOperationException("Message-driven beans may not be called: " + name);
  +           default:
  +              throw new IllegalStateException();
  +        }
  +    }
  +    
  +   protected Object instantiateSessionBean() throws Exception, NamingException
  +   {
  +      return wrap( Naming.getInitialContext().lookup(jndiName) );
  +   }
  +
  +   protected Object instantiateEntityBean() throws Exception
  +   {
  +      return beanClass.newInstance();
  +   }
  +
  +   protected Object instantiateJavaBean() throws Exception
  +   {
                 if (interceptionType==InterceptionType.NEVER)
                 {
                    Object bean = beanClass.newInstance();
  @@ -893,16 +919,6 @@
                    callPostConstructMethod(bean);
                    return bean;
                 }
  -           case ENTITY_BEAN:
  -              return beanClass.newInstance();
  -           case STATELESS_SESSION_BEAN:
  -           case STATEFUL_SESSION_BEAN:
  -              return wrap( Naming.getInitialContext().lookup(jndiName) );
  -           case MESSAGE_DRIVEN_BEAN:
  -              throw new UnsupportedOperationException("Message-driven beans may not be called: " + name);
  -           default:
  -              throw new IllegalStateException();
  -        }
       }
   
       private Object wrap(Object bean) throws Exception
  
  
  



More information about the jboss-cvs-commits mailing list