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

Gavin King gavin.king at jboss.com
Mon Jul 16 05:19:16 EDT 2007


  User: gavin   
  Date: 07/07/16 05:19:16

  Modified:    src/main/org/jboss/seam/init   ComponentDescriptor.java
                        Initialization.java
  Log:
  override startup in components.xml
  
  Revision  Changes    Path
  1.12      +11 -3     jboss-seam/src/main/org/jboss/seam/init/ComponentDescriptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ComponentDescriptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/init/ComponentDescriptor.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -b -r1.11 -r1.12
  --- ComponentDescriptor.java	25 Jun 2007 22:56:49 -0000	1.11
  +++ ComponentDescriptor.java	16 Jul 2007 09:19:16 -0000	1.12
  @@ -6,6 +6,7 @@
   import org.jboss.seam.Seam;
   import org.jboss.seam.annotations.AutoCreate;
   import org.jboss.seam.annotations.Install;
  +import org.jboss.seam.annotations.Startup;
   import org.jboss.seam.core.Init;
   import org.jboss.seam.web.AbstractResource;
   
  @@ -22,14 +23,15 @@
       protected ScopeType scope;
       protected String jndiName;
       protected Boolean installed;
  -    protected boolean autoCreate;
  +    protected Boolean autoCreate;
  +    protected Boolean startup;
       protected Integer precedence;
   
       /**
        * For components.xml
        */
       public ComponentDescriptor(String name, Class<?> componentClass, ScopeType scope,
  -            boolean autoCreate, String jndiName, Boolean installed, Integer precedence) 
  +            Boolean autoCreate, Boolean startup, String jndiName, Boolean installed, Integer precedence) 
       {
           this.name = name;
           this.componentClass = componentClass;
  @@ -38,6 +40,7 @@
           this.installed = installed;
           this.autoCreate = autoCreate;
           this.precedence = precedence;
  +        this.startup = startup;
       }
   
       /**
  @@ -88,9 +91,14 @@
           return jndiName;
       }
   
  +    public boolean isStartup()
  +    {
  +       return startup!=null ? startup : componentClass.isAnnotationPresent(Startup.class);
  +    }
  +
       public boolean isAutoCreate()
       {
  -        return autoCreate || componentClass.isAnnotationPresent(AutoCreate.class);
  +        return autoCreate!=null ? autoCreate : componentClass.isAnnotationPresent(AutoCreate.class);
       }
   
       public String[] getDependencies()
  
  
  
  1.187     +17 -7     jboss-seam/src/main/org/jboss/seam/init/Initialization.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Initialization.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/init/Initialization.java,v
  retrieving revision 1.186
  retrieving revision 1.187
  diff -u -b -r1.186 -r1.187
  --- Initialization.java	29 Jun 2007 19:19:23 -0000	1.186
  +++ Initialization.java	16 Jul 2007 09:19:16 -0000	1.187
  @@ -324,7 +324,10 @@
         String precedenceString = component.attributeValue("precedence");
         int precedence = precedenceString==null ? Install.APPLICATION : Integer.valueOf(precedenceString);
         ScopeType scope = scopeName == null ? null : ScopeType.valueOf(scopeName.toUpperCase());
  -      boolean autoCreate = "true".equals(component.attributeValue("auto-create"));
  +      String autocreateAttribute = component.attributeValue("auto-create");
  +      Boolean autoCreate = autocreateAttribute==null ? null : "true".equals(autocreateAttribute);
  +      String startupAttribute = component.attributeValue("startup");
  +      Boolean startup = startupAttribute==null ? null : "true".equals(startupAttribute);
         if (className != null)
         {
            Class<?> clazz = null;
  @@ -360,7 +363,7 @@
               name = clazz.getAnnotation(Name.class).value();
            }
   
  -         ComponentDescriptor descriptor = new ComponentDescriptor(name, clazz, scope, autoCreate, jndiName, installed, precedence);
  +         ComponentDescriptor descriptor = new ComponentDescriptor(name, clazz, scope, autoCreate, startup, jndiName, installed, precedence);
            addComponentDescriptor(descriptor);
            installedComponentClasses.add(clazz);
         }
  @@ -386,6 +389,7 @@
            boolean isProperty = !"name".equals(attributeName) && 
                  !"installed".equals(attributeName) && 
                  !"scope".equals(attributeName) &&
  +               !"startup".equals(attributeName) &&
                  !"class".equals(attributeName) &&
                  !"jndi-name".equals(attributeName) &&
                  !"precedence".equals(attributeName) &&
  @@ -834,21 +838,26 @@
         DependencyManager manager = new DependencyManager(componentDescriptors);
   
         Set<ComponentDescriptor> installable = manager.installedSet();      
  -      for (ComponentDescriptor componentDescriptor: installable) {
  +      for (ComponentDescriptor componentDescriptor: installable) 
  +      {
             String compName = componentDescriptor.getName() + COMPONENT_SUFFIX;
   
  -          if (!context.isSet(compName)) {
  +          if ( !context.isSet(compName) ) 
  +          {
                 addComponent(componentDescriptor, context, redeployStrategy);
   
  -              if (componentDescriptor.isAutoCreate()) {
  +              if ( componentDescriptor.isAutoCreate() ) 
  +              {
                     init.addAutocreateVariable( componentDescriptor.getName() );
                 }
   
  -              if (componentDescriptor.isFilter()) {
  +              if ( componentDescriptor.isFilter() ) 
  +              {
                     init.addInstalledFilter( componentDescriptor.getName() );
                 }
   
  -              if (componentDescriptor.isResourceProvider()) {
  +              if ( componentDescriptor.isResourceProvider() ) 
  +              {
                     init.addResourceProvider( componentDescriptor.getName() );
                 }
             }
  @@ -897,6 +906,7 @@
                  descriptor.getComponentClass(), 
                  name, 
                  descriptor.getScope(), 
  +               descriptor.isStartup(),
                  descriptor.getJndiName()
               );
            context.set(componentName, component);
  
  
  



More information about the jboss-cvs-commits mailing list