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

Gavin King gavin.king at jboss.com
Thu Feb 1 14:38:41 EST 2007


  User: gavin   
  Date: 07/02/01 14:38:41

  Modified:    src/main/org/jboss/seam   Component.java ComponentType.java
  Log:
  throw exception if @PersistenceContext used on JavaBean components
  
  Revision  Changes    Path
  1.227     +9 -1      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.226
  retrieving revision 1.227
  diff -u -b -r1.226 -r1.227
  --- Component.java	31 Jan 2007 14:43:08 -0000	1.226
  +++ Component.java	1 Feb 2007 19:38:41 -0000	1.227
  @@ -25,6 +25,7 @@
   import static org.jboss.seam.util.EJB.PRE_PASSIVATE;
   import static org.jboss.seam.util.EJB.REMOTE;
   import static org.jboss.seam.util.EJB.REMOVE;
  +import static org.jboss.seam.util.EJB.PERSISTENCE_CONTEXT;
   import static org.jboss.seam.util.EJB.value;
   
   import java.io.Serializable;
  @@ -123,7 +124,7 @@
    *
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
    * @author Gavin King
  - * @version $Revision: 1.226 $
  + * @version $Revision: 1.227 $
    */
   @Scope(ScopeType.APPLICATION)
   @SuppressWarnings("deprecation")
  @@ -522,6 +523,13 @@
               {
                  preDestroyMethod = method;
               }
  +            if ( method.isAnnotationPresent(PERSISTENCE_CONTEXT) )
  +            {
  +               if ( !type.isSessionBean() && type!=MESSAGE_DRIVEN_BEAN )
  +               {
  +                  throw new IllegalArgumentException("@PersistenceContext may only be used on session bean or message driven bean components: " + name);
  +               }
  +            }
   
               for ( Annotation ann: method.getAnnotations() )
               {
  
  
  
  1.6       +6 -1      jboss-seam/src/main/org/jboss/seam/ComponentType.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ComponentType.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/ComponentType.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- ComponentType.java	23 Sep 2006 15:41:39 -0000	1.5
  +++ ComponentType.java	1 Feb 2007 19:38:41 -0000	1.6
  @@ -1,4 +1,4 @@
  -//$Id: ComponentType.java,v 1.5 2006/09/23 15:41:39 gavin Exp $
  +//$Id: ComponentType.java,v 1.6 2007/02/01 19:38:41 gavin Exp $
   package org.jboss.seam;
   
   import static org.jboss.seam.ScopeType.CONVERSATION;
  @@ -27,6 +27,11 @@
         return this==STATELESS_SESSION_BEAN || this==STATEFUL_SESSION_BEAN;
      }
      
  +   public boolean isStateless()
  +   {
  +      return this==STATELESS_SESSION_BEAN || this==MESSAGE_DRIVEN_BEAN;
  +   }
  +   
      public ScopeType getDefaultScope()
      {
         switch (this)
  
  
  



More information about the jboss-cvs-commits mailing list