com.sun.istack.tools
Class ProtectedTask

java.lang.Object
  extended by Task
      extended by com.sun.istack.tools.ProtectedTask
Direct Known Subclasses:
WrapperTask, XJCTask

public abstract class ProtectedTask
extends Task

Executes a Task in a special class loader that allows us to control where to load 2.1 APIs, even if we run in Java 6.

No JDK 1.5 code here, please. This allows us to detect "require JDK5" bug nicely.

Author:
Kohsuke Kawaguchi, Bhakti Mehta

Constructor Summary
ProtectedTask()
           
 
Method Summary
protected abstract  java.lang.ClassLoader createClassLoader()
          Creates a protective class loader that will host the actual task.
 java.lang.Object createDynamicElement(java.lang.String name)
           
 void execute()
           
protected abstract  java.lang.String getCoreClassName()
          Returns the name of the class that extends Task.
 void setDynamicAttribute(java.lang.String name, java.lang.String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProtectedTask

public ProtectedTask()
Method Detail

setDynamicAttribute

public void setDynamicAttribute(java.lang.String name,
                                java.lang.String value)
                         throws BuildException
Throws:
BuildException

createDynamicElement

public java.lang.Object createDynamicElement(java.lang.String name)
                                      throws BuildException
Throws:
BuildException

execute

public void execute()
             throws BuildException
Throws:
BuildException

getCoreClassName

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


createClassLoader

protected abstract java.lang.ClassLoader createClassLoader()
                                                    throws java.lang.ClassNotFoundException,
                                                           java.io.IOException
Creates a protective class loader that will host the actual task.

Throws:
java.lang.ClassNotFoundException
java.io.IOException


Copyright © 2005-2011 Oracle Corporation. All Rights Reserved.