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

Norman Richards norman.richards at jboss.com
Fri Oct 12 01:07:46 EDT 2007


  User: nrichards
  Date: 07/10/12 01:07:46

  Modified:    src/main/org/jboss/seam  Component.java
  Log:
  JBSEAM-2076
  
  Revision  Changes    Path
  1.286     +17 -30    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.285
  retrieving revision 1.286
  diff -u -b -r1.285 -r1.286
  --- Component.java	1 Oct 2007 06:21:51 -0000	1.285
  +++ Component.java	12 Oct 2007 05:07:44 -0000	1.286
  @@ -45,7 +45,6 @@
   import java.util.List;
   import java.util.Map;
   import java.util.Set;
  -import java.util.StringTokenizer;
   
   import javassist.util.proxy.MethodFilter;
   import javassist.util.proxy.MethodHandler;
  @@ -344,22 +343,10 @@
   
      private void initNamespace(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, ".");
  -            while ( tokens.hasMoreTokens() )
  -            {
  -               String token = tokens.nextToken();
  -               if ( tokens.hasMoreTokens() ) //we don't want to create a namespace for the name
  -               {
  -                  namespace = namespace.getOrCreateChild(token);
  -               }
  -            }
  -            this.namespace = namespace;
  +      if (applicationContext!=null) { //for unit tests!
  +         Init init = (Init) applicationContext.get(Seam.getComponentName(Init.class));
  +         if (init!=null) {
  +            this.namespace = init.initNamespaceForName(componentName, true);
            }
         }
      }
  @@ -387,15 +374,8 @@
   
      private void addImport(Init init, Import imp)
      {
  -      for ( String ns: imp.value() )
  -      {
  -         Namespace namespace = init.getRootNamespace();
  -         StringTokenizer tokens = new StringTokenizer(ns, ".");
  -         while ( tokens.hasMoreTokens() )
  -         {
  -            namespace = namespace.getOrCreateChild( tokens.nextToken() );
  -         }
  -         imports.add(namespace);
  +       for (String ns: imp.value()) {
  +           imports.add(init.initNamespaceForName(ns, false));
         }
      }
   
  @@ -691,6 +671,10 @@
            Out out = method.getAnnotation(Out.class);
            String name = toName( out.value(), method );
            outAttributes.add( new BijectedMethod(name, method, out) );
  +         
  +         //can't use Init.instance() here because of unit tests
  +         Init init = (Init) applicationContext.get(Seam.getComponentName(Init.class));
  +         init.initNamespaceForName(name, true);
         }
         
         if ( method.isAnnotationPresent(Unwrap.class) )
  @@ -712,7 +696,8 @@
         
         if ( method.isAnnotationPresent(org.jboss.seam.annotations.Factory.class) )
         {
  -         Init init = (Init) applicationContext.get( Seam.getComponentName(Init.class) ); //can't use Init.instance() here 'cos of unit tests
  +         //can't use Init.instance() here because of unit tests
  +         Init init = (Init) applicationContext.get(Seam.getComponentName(Init.class));
            String contextVariable = toName( method.getAnnotation(org.jboss.seam.annotations.Factory.class).value(), method );
            init.addFactoryMethod(contextVariable, method, this);
            if ( method.getAnnotation(org.jboss.seam.annotations.Factory.class).autoCreate() )
  @@ -723,7 +708,9 @@
         
         if ( method.isAnnotationPresent(Observer.class) )
         {
  -         Init init = (Init) applicationContext.get( Seam.getComponentName(Init.class) ); //can't use Init.instance() here 'cos of unit tests
  +         //can't use Init.instance() here because of unit tests
  +         Init init = (Init) applicationContext.get(Seam.getComponentName(Init.class));
  +          
            Observer observer = method.getAnnotation(Observer.class);
            for ( String eventType : observer.value() )
            {
  
  
  



More information about the jboss-cvs-commits mailing list