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

Gavin King gavin.king at jboss.com
Wed Nov 29 21:09:10 EST 2006


  User: gavin   
  Date: 06/11/29 21:09:10

  Modified:    src/main/org/jboss/seam  Component.java
  Log:
  qualified names with . instead of $ in EL
  
  Revision  Changes    Path
  1.214     +28 -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.213
  retrieving revision 1.214
  diff -u -b -r1.213 -r1.214
  --- Component.java	24 Nov 2006 23:51:22 -0000	1.213
  +++ Component.java	30 Nov 2006 02:09:10 -0000	1.214
  @@ -42,6 +42,7 @@
   import java.util.Locale;
   import java.util.Map;
   import java.util.Set;
  +import java.util.StringTokenizer;
   
   import javax.naming.NamingException;
   import javax.servlet.http.HttpSessionActivationListener;
  @@ -120,7 +121,7 @@
    *
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
    * @author Gavin King
  - * @version $Revision: 1.213 $
  + * @version $Revision: 1.214 $
    */
   @Scope(ScopeType.APPLICATION)
   @SuppressWarnings("deprecation")
  @@ -211,6 +212,8 @@
         type = Seam.getComponentType(beanClass);
         interceptionType = Seam.getInterceptionType(beanClass);
         
  +      initNamespaces(componentName, applicationContext);
  +      
         checkScopeForComponentType();
   
         jndiName = componentJndiName == null ? 
  @@ -263,6 +266,30 @@
   
      }
   
  +   private void initNamespaces(String componentName, Context applicationContext)
  +   {
  +      if (applicationContext!=null) //for unit tests!
  +      {
  +         Init init = (Init) applicationContext.get( Seam.getComponentName(Init.class) );
  +         if (init!=null)
  +         {
  +            Namespace namespace = init.getRootNamespace();
  +            StringTokenizer tokens = new StringTokenizer(componentName, ".");
  +            StringBuffer path = new StringBuffer();
  +            while ( tokens.hasMoreTokens() )
  +            {
  +               String token = tokens.nextToken();
  +               path.append(token).append('.');
  +               if ( tokens.hasMoreTokens() && !namespace.hasChild(token) )
  +               {
  +                  namespace.addChild( token, new Namespace(path.toString()) );
  +               }
  +               namespace = namespace.getChild(token);
  +            }
  +         }
  +      }
  +   }
  +
      private void checkScopeForComponentType()
      {
         if ( scope==STATELESS && (type==STATEFUL_SESSION_BEAN || type==ENTITY_BEAN) )
  
  
  



More information about the jboss-cvs-commits mailing list