ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant IntrospectionHelper.java RuntimeConfigurable.java Task.java UnknownElement.java
Date Sun, 06 Apr 2003 09:30:57 GMT
conor       2003/04/06 01:30:57

  Modified:    src/main/org/apache/tools/ant IntrospectionHelper.java
                        RuntimeConfigurable.java Task.java
                        UnknownElement.java
  Log:
  Fix up handling of TaskContainer configuration.
  
  Revision  Changes    Path
  1.51      +2 -1      ant/src/main/org/apache/tools/ant/IntrospectionHelper.java
  
  Index: IntrospectionHelper.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/IntrospectionHelper.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -w -u -r1.50 -r1.51
  --- IntrospectionHelper.java	1 Apr 2003 14:59:58 -0000	1.50
  +++ IntrospectionHelper.java	6 Apr 2003 09:30:56 -0000	1.51
  @@ -577,7 +577,8 @@
        * @return true if the given nested element is supported
        */
       public boolean supportsNestedElement(String elementName) {
  -        return nestedCreators.containsKey(elementName);
  +        return nestedCreators.containsKey(elementName) ||
  +            DynamicConfigurator.class.isAssignableFrom(bean);
       }
       
       /**
  
  
  
  1.30      +11 -12    ant/src/main/org/apache/tools/ant/RuntimeConfigurable.java
  
  Index: RuntimeConfigurable.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/RuntimeConfigurable.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -w -u -r1.29 -r1.30
  --- RuntimeConfigurable.java	4 Apr 2003 13:51:11 -0000	1.29
  +++ RuntimeConfigurable.java	6 Apr 2003 09:30:56 -0000	1.30
  @@ -336,18 +336,9 @@
                   childTask.setRuntimeConfigurableWrapper(child);
               }
   
  -            if (configureChildren) {
  -                if (child.wrappedObject instanceof Task) {
  -                    Task childTask = (Task) child.wrappedObject;
  -                    
  -                    // we don't configure tasks of task containers These
  -                    // we be configured at the time they are used.
  -                    if (!(target instanceof TaskContainer)) {
  -                        childTask.maybeConfigure();
  -                    }
  -                } else {
  +            if (configureChildren 
  +                && ih.supportsNestedElement(child.getElementTag())) {
                       child.maybeConfigure(p);
  -                }
                   Object container = wrappedObject;
                   if (container instanceof TaskAdapter) {
                       container = ((TaskAdapter) container).getProxy();
  @@ -362,5 +353,13 @@
               p.addReference(id, wrappedObject);
           }
           proxyConfigured = true;
  +    }
  +    
  +    /**
  +     * Reconfigure the element, even if it has already been configured.
  +     */
  +    public void reconfigure(Project p) {
  +        proxyConfigured = false;
  +        maybeConfigure(p);
       }
   }
  
  
  
  1.42      +10 -0     ant/src/main/org/apache/tools/ant/Task.java
  
  Index: Task.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/Task.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -w -u -r1.41 -r1.42
  --- Task.java	10 Feb 2003 14:13:30 -0000	1.41
  +++ Task.java	6 Apr 2003 09:30:56 -0000	1.42
  @@ -294,6 +294,16 @@
       }
   
       /**
  +     * Force the task to be reconfigured from it's RuntimeConfigurable
  +     *
  +     */
  +    public void reconfigure() {
  +        if (wrapper != null) {
  +            wrapper.reconfigure(getProject());
  +        }
  +    }
  +    
  +    /**
        * Handles a line of output by logging it with the INFO priority.
        *
        * @param line The line of output to log. Should not be <code>null</code>.
  
  
  
  1.45      +17 -34    ant/src/main/org/apache/tools/ant/UnknownElement.java
  
  Index: UnknownElement.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/UnknownElement.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -w -u -r1.44 -r1.45
  --- UnknownElement.java	2 Apr 2003 11:43:41 -0000	1.44
  +++ UnknownElement.java	6 Apr 2003 09:30:56 -0000	1.45
  @@ -127,12 +127,7 @@
           if (realThing instanceof Task) {
               Task task = (Task) realThing;
   
  -            task.setProject(project);
               task.setRuntimeConfigurableWrapper(getWrapper());
  -            task.setLocation(this.getLocation());
  -            // UnknownElement always has an associated target
  -            task.setOwningTarget(this.getOwningTarget());
  -            task.init();
   
               // For Script to work. Ugly
               // The reference is replaced by RuntimeConfigurable
  @@ -272,38 +267,26 @@
               UnknownElement child = (UnknownElement) children.elementAt(i);
               Object realChild = null;
   
  -            if (!ih.supportsNestedElement(child.getTag()) 
  -                && parent instanceof TaskContainer) {
  -                realChild = makeTask(child, childWrapper);
  -
  -                if (realChild == null) {
  -                    ih.throwNotSupported(getProject(), parent, child.getTag());
  -                }
  -
  -                // XXX DataTypes will be wrapped or treated like normal components
  -                if (realChild instanceof Task) {
  -                    Task task = (Task) realChild;
  -                    ((TaskContainer) parent).addTask(task);
  -                    task.setLocation(child.getLocation());
  -                    // UnknownElement always has an associated target
  -                    task.setOwningTarget(this.getOwningTarget());
  -                    task.init();
  -                } else {
  -                    // should not happen
  -                    ih.throwNotSupported(getProject(), parent, child.getTag());
  -                }
  -            } else {
  +            if (ih.supportsNestedElement(child.getTag())) { 
                   realChild 
                       = ih.createElement(getProject(), parent, child.getTag());
  -            }
  -
               childWrapper.setProxy(realChild);
  -            if (parent instanceof TaskContainer 
  -                && realChild instanceof Task) {
  -                ((Task) realChild).setRuntimeConfigurableWrapper(childWrapper);
  +                if (realChild instanceof Task) {
  +                    Task childTask = (Task) realChild;
  +                    childTask.setRuntimeConfigurableWrapper(childWrapper);
  +                    childTask.setTaskName(child.getTag());
  +                    childTask.setTaskType(child.getTag());
               }
  -
               child.handleChildren(realChild, childWrapper);
  +
  +            } else if (!(parent instanceof TaskContainer)) {
  +                ih.throwNotSupported(getProject(), parent, child.getTag());
  +            } else {
  +                // a task container - anything could happen - just add the 
  +                // child to the container
  +                TaskContainer container = (TaskContainer) parent;
  +                container.addTask(child);
  +            }                
           }
       }
   
  
  
  

Mime
View raw message