Browse Source

STart to add the ability to retrieve services from the context

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270843 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
c1459a0550
2 changed files with 30 additions and 1 deletions
  1. +14
    -1
      proposal/myrmidon/src/java/org/apache/myrmidon/api/TaskContext.java
  2. +16
    -0
      proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java

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

@@ -34,12 +34,25 @@ public interface TaskContext
String NAME = "myrmidon.task.name";

/**
* Retrieve Name of tasklet.
* Retrieve Name of task.
*
* @return the name
*/
String getName();

/**
* Retrieve a service that is offered by the runtime.
* The actual services registered and in place for the
* task is determined by the container. The returned service
* <b>MUST</b> implement the specified interface.
*
* @param serviceClass the interface class that defines the service
* @return an instance of the service implementing interface specified by parameter
* @exception TaskException is thrown when the service is unavailable or not supported
*/
Object getService( Class serviceClass )
throws TaskException;

/**
* Retrieve base directory.
*


+ 16
- 0
proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java View File

@@ -91,6 +91,22 @@ public class DefaultTaskContext
}
}

/**
* Retrieve a service that is offered by the runtime.
* The actual services registered and in place for the
* task is determined by the container. The returned service
* <b>MUST</b> implement the specified interface.
*
* @param serviceClass the interface class that defines the service
* @return an instance of the service implementing interface specified by parameter
* @exception TaskException is thrown when the service is unavailable or not supported
*/
public Object getService( final Class serviceClass )
throws TaskException
{
throw new TaskException( "No services available atm" );
}

/**
* Resolve filename.
* This involves resolving it against baseDirectory and


Loading…
Cancel
Save