Class ProtectedTask

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
com.sun.istack.tools.ProtectedTask
All Implemented Interfaces:
Cloneable, org.apache.tools.ant.DynamicAttribute, org.apache.tools.ant.DynamicConfigurator, org.apache.tools.ant.DynamicElement
Direct Known Subclasses:
WrapperTask, XJCTask

public abstract class ProtectedTask extends org.apache.tools.ant.Task implements org.apache.tools.ant.DynamicConfigurator
Executes a Task in a special class loader that allows us to control where to load particular APIs.
Author:
Kohsuke Kawaguchi, Bhakti Mehta
  • Field Summary

    Fields inherited from class org.apache.tools.ant.Task

    target, taskName, taskType, wrapper

    Fields inherited from class org.apache.tools.ant.ProjectComponent

    description, location, project
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract ClassLoader
    Creates a protective class loader that will host the actual task.
     
    void
     
    protected abstract String
    Returns the name of the class that extends Task.This class will be loaded int the protected classloader.
    void
     

    Methods inherited from class org.apache.tools.ant.Task

    bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType

    Methods inherited from class org.apache.tools.ant.ProjectComponent

    clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ProtectedTask

      public ProtectedTask()
  • Method Details

    • setDynamicAttribute

      public void setDynamicAttribute(String name, String value) throws org.apache.tools.ant.BuildException
      Specified by:
      setDynamicAttribute in interface org.apache.tools.ant.DynamicAttribute
      Throws:
      org.apache.tools.ant.BuildException
    • createDynamicElement

      public Object createDynamicElement(String name) throws org.apache.tools.ant.BuildException
      Specified by:
      createDynamicElement in interface org.apache.tools.ant.DynamicElement
      Throws:
      org.apache.tools.ant.BuildException
    • execute

      public void execute() throws org.apache.tools.ant.BuildException
      Overrides:
      execute in class org.apache.tools.ant.Task
      Throws:
      org.apache.tools.ant.BuildException
    • getCoreClassName

      protected abstract String getCoreClassName()
      Returns the name of the class that extends Task.This class will be loaded int the protected classloader.
      Returns:
      Task class name
    • createClassLoader

      protected abstract ClassLoader createClassLoader() throws ClassNotFoundException, IOException
      Creates a protective class loader that will host the actual task.
      Returns:
      ClassLoader use d for task execution
      Throws:
      ClassNotFoundException - if required APIs are not found
      IOException - if error happens