Browse Source

Added TaskContext.createSubContext( String name ) so that it is no longer necessary at all to know the underlying implementation - even when creating container tasks.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269643 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 24 years ago
parent
commit
83dcf695df
2 changed files with 22 additions and 2 deletions
  1. +20
    -0
      proposal/myrmidon/src/java/org/apache/myrmidon/api/DefaultTaskContext.java
  2. +2
    -2
      proposal/myrmidon/src/java/org/apache/myrmidon/api/TaskContext.java

+ 20
- 0
proposal/myrmidon/src/java/org/apache/myrmidon/api/DefaultTaskContext.java View File

@@ -173,6 +173,26 @@ public class DefaultTaskContext
} }
} }


/**
* Create a Child Context.
* This allows separate hierarchly contexts to be easily constructed.
*
* @param name the name of sub-context
* @return the created TaskContext
* @exception TaskException if an error occurs
*/
public TaskContext createSubContext( final String name )
throws TaskException
{
final DefaultTaskContext context = new DefaultTaskContext( this );

context.setProperty( TaskContext.NAME, getName() + "." + name );
context.setProperty( TaskContext.BASE_DIRECTORY, getBaseDirectory() );
context.setProperty( TaskContext.JAVA_VERSION, getJavaVersion() );

return context;
}

/** /**
* Make sure property is valid if it is one of the "magic" properties. * Make sure property is valid if it is one of the "magic" properties.
* *


+ 2
- 2
proposal/myrmidon/src/java/org/apache/myrmidon/api/TaskContext.java View File

@@ -103,8 +103,8 @@ public interface TaskContext
* @return the created TaskContext * @return the created TaskContext
* @exception TaskException if an error occurs * @exception TaskException if an error occurs
*/ */
//TaskContext createSubContext( String name )
//throws TaskException;
TaskContext createSubContext( String name )
throws TaskException;


/** /**
* Safe wrapper class for Scope enums. * Safe wrapper class for Scope enums.


Loading…
Cancel
Save