Cheiron Utils API 0.2.10-b${p4.change}

org.cheiron.tools.ant
Class DownloadJar

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.apache.tools.ant.taskdefs.MatchingTask
              extended by org.apache.tools.ant.taskdefs.Zip
                  extended by org.apache.tools.ant.taskdefs.Jar
                      extended by org.cheiron.tools.ant.DownloadJar
All Implemented Interfaces:
Cloneable, org.apache.tools.ant.types.selectors.SelectorContainer

public class DownloadJar
extends org.apache.tools.ant.taskdefs.Jar

Ant <dljar> task that is an extension of <jar> to create 'download' JAR files, based on dependency checking of some provided classes, also this task allows the optional computation of a preferred classes list as specified by PreferredClassLoader.

Besides creating download JAR files this tool is particular useful for creating JAR files for JSC compliant Jini™ services or any JAR file that should only contain the minimum set of required (dependent) classes. This tool extends the Ant jar tool and can also be used to include classes and resources that can't be included through dependency checking. For those that want to provide support for their own Platforms this class can be extended, however in that case they have to provide their own mechanism to load this task in Ant.

This task is based on the Class Dependency Checker and Preferred List Generator from the Jini™ Technology Starter Kit of Sun Microsystems (the explanation of their working is copyright Sun Microsystems) and relies on classes in the sun.tools.java namespace that can be found in the tools.jar of the SDK of Sun, and maybe some other vendors.

Processing options for JAR file content

The root classes for the dependency checking, that will determine the content for the JAR file, are specified by any combination of individual classes and directories of classes.

In general, you only need to specify concrete classes as roots, not interface types. When analyzing classes to be included in your final JAR file for a JSC compliant Jini™ service you typically need to include the top-level class that implements JiniService. When analyzing classes your download of that service, you typically need to include the top-level proxy classes [1] used by the service, any trust verifier classes for those proxies, and any custom entry classes used by the service for lookup service attributes. Also when analyzing classes for the download JAR file, if the service's proxy can return leases, registration objects, or other proxies, or if your service generates events, and if those objects are only referenced by interface type in the top-level proxy, not by concrete class, then you also need to include the concrete classes of those other objects. Except when these objects are provided by e.g. a Jini Service Container as that container will take care of adding these classes to your download JAR file at deployment time.

The following attributes are supported for this task, additional to the attributes supported by the <jar> task:

.
Attribute Description
preferred the preferred classes list file to include in the META-INF directory. In case a preferred element is also specified (explicitly or implicitly) this preferred list will take precedence over the one computed.
platform optional target platform identifier that will excludes classes that are part of that platform. Currently the following identifiers (platforms) are supported: jini-core, jsc, jsc-dl and jsk. The jsc and jsc-dl identifier refers to the JSC Platform API and the jsk refers to the Jini Starter Kit Platform API. jini-core will only assume the Jini Core API is available to Jini clients.

Besides the namespaces and classes to be excluded by the identified platform you are allowed to specify extra namespaces to be exclude from the JAR file created.

in [E] comma separated list of package namespaces to be included in the dependency checking. Any classes in this package or a subpackage of it are included in the dependency checking (and hence are to be included in your JAR file), unless they are explicitly excluded using out or skip. If not specified all packages are considered to be in the in namespace.
out [E] comma separated list of package namespaces to be excluded from the dependency checking. Any classes in this package or a subpackage of it are excluded from the dependency checking (and hence are to be excluded from your JAR file). This should be a subset of in.
edges indicates whether classes that are referenced outside the in namespace should be included in the JAR file instead of the classes that are part of the in namespace, defaults to false.
hide [E] comma separated list of package namespaces that suppresses the inclusion of any classes within that namespace in the JAR file. This should be a subset of in.
inroot [E] comma separated list of package namespaces to be included as roots for classes found through rootdir elements. Any found classes that is in this package or a subpackage of it are considered as root for the dependency checking (and hence are to be included in your JAR file), unless they are explicitly excluded using out, skip or outroot. If not specified all packages are considered to be in the inroot namespace.
outroot [E] comma separated list of package namespaces to exclude when selecting roots from directory trees. Within the directory trees as specified by the rootdir element, any classes that are in the given package or a subpackage of it are not treated as roots.
show [E] comma separated list of package namespaces to specify a subset of the classes to be included within the JAR file. Normally a subset of in.
failonerror Indicates whether the build will continue even if failures have been encountered during computing the dependent classes, defaults to true.

All the attributes with the [E] annotation can also be represented as a nested element, however this doesn't allow for comma separation of values, one should use multiple elements to achieve the same effect. The elements supported, additional to the elements of the <jar> task, will be listed below. If not stated otherwise these elements have the syntax of <element-id name="..."/>. All elements may be specified multiple times if not stated otherwise.

Element Description for name attribute
classpath classpath element that should include your classes plus any dependent classes. The classpath will also be used to extract files from to include in the JAR file, as well as for the purpose of computing a preferred classes list if required.

This element has the syntax of the classpath element.

class binary name of a class to include as a root of the dependency checking. This element can be specified zero or more times. Each class you specify with this option needs to be in a package that is defined by the in namespaces.
proxyclass for the purpose of populating the JAR file this element is equivalent to the class element and results in adding an implicit nested proxy element as part of the preferred element.
apiclass for the purpose of populating the JAR file this element is equivalent to the class element and results in adding an implicit nested api element as part of the preferred element.
implclass for the purpose of populating the JAR file this element is equivalent to the class element and results in adding an implicit nested impl element as part of the preferred element.
virtualclass for the purpose of populating the JAR file this element is equivalent to the class element, except that the class itself is excluded from the JAR file. This allows you to find all dependencies while excluding the root itself.

When for a class a virtualclass element is specified and the class has been referenced through any of the other elements as well it won't be included in the JAR file.

rootdir root directory (absolute path) of a tree of compiled class files, all of which are considered to be a class element. The directory must be one of the directories on the classpath. The inroot, outroot attributes/elements can be used to control the classes to be used as the root of the dependency checking.
skip binary name of class to be skipped in the dependency checking. This option allows an individual class to be considered out without requiring the entire package it is defined in to be considered outside.
resource name of resource(s) to include in the JAR file if available on the class path (in URI path syntax relative to the JAR file or class path directory). Wildcarding is allowed with the following patterns in the resource name:
  • '**' matches zero or more directories
  • '*' matches zero or more characters
  • '?' matches one character
In case a wildcarded resource name results in duplicate files the behavior is specified by the duplicate attribute of the task, the order in which the JAR files or directories on the classpath will be consulted is unspecified. For a regular resource name the order in which the JAR files or directories on the classpath will be consulted is that of the classpath element and only the first match will be considered.
excludejar absolute path to JAR or ZIP file for which the content will serve as an exclude filter, preventing classes and resources from being added to the final JAR file. Classes in the specified file are not considered as skip classes and therefore have no impact on the dependency checking. This filter also works on fileset and zipfileset elements. The purpose of this element is to prevent from overlapping classes (and preferred classes lists) in case of composite download JAR files.

This element has the syntax of <excludejar src="..."/> where the src attribute is an absolute path name, or a path relative to the project's basedir.

tell binary name of class for which a list of classes will be sent to the error stream that are dependent on this class, mostly used for debugging. If this option is used, all other output options are ignored.
preferred element that contains the instructions for computing the META-INF/PREFERRED.LIST for the download JAR file. If no such element is specified no preferred class information will be computed, or this element must be implicitly included. For all allowed attributes and nested elements for the preferred element see the next section computing preferred class information.

Opposed to the other elements this nested element can only be specified once.

Processing options for computing preferred class information

The META-INF/PREFERRED.LIST for inclusion in the download JAR file is computed by identifying a set or 'root' classes belonging to a public API and examining the dependencies of classes contained within a target JAR file and zero or more additional supporting JAR files.

The root classes provide the starting point for recursively computing a dependency graph, finding all of the classes referenced in the public API of the root classes, finding all of the classes referenced in turn by the public API of those classes, and so on, until no new classes are found. The results of the dependency analysis are combined with the preferred classes list information in the additional supporting JAR files to compute a preferred classes list having the smallest number of entries that describes the preferred state of the classes and resources contained in all of the JAR files.

The computation implements the first guideline described in net.jini.loader.pref. Since there is no definitive set of rules for determining whether a class should be preferred or not, you should verify the correctness of the generated list. If necessary, the impl api options can be used to produce the correct result.

The following attributes are supported for the preferred element:

Attribute Description
container optional identifier for container the download JAR file will originate from when deployed. Currently the following identifiers are supported: seven.

This option can be required in case you incorporate classes in your download JAR file that are also part of the download JAR file of a container framework that will be aggregated through 'JAR wrapping' with your Jini service. Setting this option will make sure, if your container is supported, that your preferred values won't conflict with those of the container. As of Seven 0.1.0 it is no longer required to use this option as Seven will deal with these preferences conflicts at runtime, but other containers might require this option to be used.

default indicates the default preferred value to use when generating the preferred classes list, for which the value can be false or true. If this attribute is not provided, the default that produces a list with the fewest entries is used. In the event of optimization ties, a default value of false is used.
nonpublic indicates whether non-public classes matched by the api element must be included in the set of roots for dependency analysis, for which the value can be can be false or true. If this attribute is not provided it defaults to false, meaning that non-public classes are discarded.
nomerge indicates whether the classes in JAR files which do not contain preferred lists must be considered preferred (merge) or not (no merge) preferred, for which the value can be can be false or true. If this option is not specified it defaults to false, meaning all classes in the non target JAR files which do not contain preferred lists are merged with the classes supplied by the target JAR file for purposes of dependency analysis; the additional classes are not included in the generated target JAR file. The impl and api elements may be used to initialize the preferred state of the merged classes.
file absolute file path to write the content of the preferred classes list to, this is additional to writing the preferred list in the target JAR file.

The following nested elements with syntax <element-id name="..."/> are supported for this preferred element. All elements may be specified multiple times.

Element Description for name attribute
jar JAR file containing the classes to analyze. If the JAR manifest includes a Class-Path attribute, then these JAR files will also be processed recursively.

The JAR file created by this <dljar> task will be included automatically and therefore doesn't need to be specified, this file is considered the target JAR file. If this target JAR file contains a preferred classes list, that list is ignored and replaced by the newly generated, except when the preferred attribute is set for the dljar element.

proxy binary name of a proxy class in the target JAR file. All of the public interfaces implemented by the proxy, and all of the public super interfaces of any non-public interfaces implemented by the proxy, are included in the set of roots for performing dependency analysis. This element may be specified zero or more times.
api identifies a class or a JAR entry, package, or namespace that is to be considered public and therefore not preferred. The value for the name attribute of this element will be referred to as name-expression. If name-expression ends with ".class", it represents a class whose binary name is name-expression without the ".class" suffix and with each '/' character replaced with a '.'. Otherwise, if name-expression ends with "/" or "/*", it represents a directory wildcard matching all entries in the named directory. Otherwise, if name-expression ends with "/-", it represents a namespace wildcard that matches all entries in the named directory and all of its subdirectories. Otherwise name-expression represents a non-class resource in the JAR file. Alternatively, name-expression may be expressed directly as the binary name for a class. The most specific name-expression is used to match an entry. Any class in the JAR file that matches name-expression will be included in the set of roots for dependency analysis. This element may be specified zero or more times.

As an example, presuming the class org.cheiron.quote.Quote was included in the target JAR file, then the following would all cause that class to be included in the public API:

    org/cheiron/quote/Quote.class
    org.cheiron.quote.Quote
    org/cheiron/quote/*
    org/cheiron/quote/-
impl identifies a class or a JAR entry, package, or namespace that is to be considered private and therefore preferred. The value for the name attribute of this element will be referred to as name-expression. name-expression is interpreted as described for the api element. If name-expression is a binary name for a class name or a class JAR entry name, that class will be considered preferred and will not be selected by or included in the dependency analysis even if it was included in the set of roots as a result of processing the proxy and api elements. This element may be specified zero or more times.

Algorithm for computing preferred classes list

Using the values from the api and impl elements, a graph is constructed that defines initial preferred values to be inherited by the target JAR entries as they are loaded into the graph. If there were no such options specified, all entries from the target JAR file loaded into the graph initially will be marked as preferred. The classes and resources identified by the JAR file created by this <dljar> task (the target JAR file) are then loaded into this graph and are assigned their initial preferred values. The remaining JAR files are loaded into the graph and the entries assigned preferred values based on the preferred classes list contained in the JAR file being loaded. If a non-target JAR file does not contain a preferred classes list, the default behavior is to merge the classes and resources in the file with those of the target JAR file (for the purposes of dependency analysis only), making them subject to the api and impl elements. The nomerge element can be used to override the default behavior, causing all such classes to be assigned a value of not preferred. The set of root classes is constructed by finding all of the classes from the target JAR file that are marked as not preferred in the graph, and by adding all of the public interfaces, or any public superinterfaces of non-public interfaces implemented by the proxy classes specified via the proxy elements. Starting with the root classes, dependent classes are identified by examining the compiled class file for the class, finding all of the public and protected fields, methods, constructors, interfaces, and super classes it references, and then in turn examining those classes. Any dependent classes found that also exist in the graph will be marked not preferred, unless that class was explicitly named by a impl element. Any root class or dependent class named by a impl element retains its original preferred valued and no further dependency analysis is performed for the class. The range of the dependency analysis is restricted to the set of classes included in the graph.

The tool then processes the graph to find the smallest number of preferred list entries that describes the preferred state of all classes and resources in the graph. The resulting preferred classes list may be written to file and/or included in the download JAR file.

[1] If a static nested class is included in the dependency graph, all references from that static nested class to its immediate lexically enclosing class are ignored (except when the static nested class extends its outer class), to avoid inadvertent inclusion of the enclosing class (the compiled class file of a static nested class always contains a reference to the immediate lexically enclosing class). If no other references to this outer class exist it will not be included in the download JAR file, in these cases one must include the outer class explicitly.

Examples

Below you will find a snippet of an Ant build file that shows the usage of the <dljar> task:

    <dljar
        destfile="${lib}/whois-dl.jar"
        platform="jsc-dl">

        <manifest>
            <attribute name="Implementation-Vendor-Id" value="org.cheiron"/>
            <attribute name="Implementation-Vendor" value="Cheiron"/>
            <attribute name="Implementation-Version" value="1.0"/>
        </manifest>

        <classpath refid="classpath"/>

        <proxyclass name="org.cheiron.examples.seven.whois.WhoisServiceProxy"/>
        <proxyclass name="org.cheiron.examples.seven.whois.MainUIFactory"/>

        <apiclass name="net.jini.lookup.entry.Name"/>
        <apiclass name="net.jini.lookup.entry.ServiceInfo"/>

        <preferred default="false">
            <api name="net.jini.lookup.entry.UIDescriptor"/>
            <api name="net/jini/lookup/ui/attribute/*"/>
        </preferred>
    </dljar>
See org.cheiron.tools.ant for how to make this task available to Ant.

Version:
$Revision: #8 $ $Date: 2007/09/27 $
See Also:
Jar

Nested Class Summary
static class DownloadJar.BasicFileElement
          Represents a nested basic file element for an Ant task, the element can be of any type and has support for a single src attribute of type File.
static class DownloadJar.PlatformDefinition
          Defines a Platform in terms of out and skip filters.
static class DownloadJar.PreferredSet
          Represents a nested element for the download jar task, that takes all parameters for computing a preferred classes list.
 
Nested classes/interfaces inherited from class org.apache.tools.ant.taskdefs.Jar
org.apache.tools.ant.taskdefs.Jar.FilesetManifestConfig
 
Nested classes/interfaces inherited from class org.apache.tools.ant.taskdefs.Zip
org.apache.tools.ant.taskdefs.Zip.ArchiveState, org.apache.tools.ant.taskdefs.Zip.Duplicate, org.apache.tools.ant.taskdefs.Zip.WhenEmpty
 
Field Summary
 
Fields inherited from class org.apache.tools.ant.taskdefs.Jar
emptyBehavior
 
Fields inherited from class org.apache.tools.ant.taskdefs.Zip
addedDirs, archiveType, doubleFilePass, duplicate, entries, skipWriting, zipFile
 
Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask
fileset
 
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
DownloadJar()
          Constructs a DownloadJar task.
 
Method Summary
 void addApiclass(BasicElement value)
          Adds an apiclass element.
 void addClass(BasicElement value)
          Adds a class element.
 void addConfiguredPreferred(DownloadJar.PreferredSet value)
          Adds a populated preferred element.
 void addDir(BasicElement value)
          Deprecated.  
 void addExcludejar(DownloadJar.BasicFileElement value)
          Adds a excludejar element.
 void addHide(BasicElement value)
          Adds a hide element.
 void addImplclass(BasicElement value)
          Adds an implclass element.
 void addIn(BasicElement value)
          Adds an in element.
 void addInroot(BasicElement value)
          Adds an inroot element.
 void addOut(BasicElement value)
          Adds an out element.
 void addOutroot(BasicElement value)
          Adds an outroot element.
 void addProxyclass(BasicElement value)
          Adds a proxyclass element.
 void addPrune(BasicElement value)
          Deprecated.  
 void addResource(BasicElement value)
          Adds a resources element.
 void addRootdir(BasicElement value)
          Adds a rootdir element.
 void addShow(BasicElement value)
          Adds a show element.
 void addSkip(BasicElement value)
          Adds a skip element.
 void addTell(BasicElement value)
          Adds a tell element.
 void addVirtualclass(BasicElement value)
          Adds a virtualclass element.
 org.apache.tools.ant.types.Path createClasspath()
          Adds a nested classpath element.
 void execute()
          Executes the download jar task.
protected  List getContainerAPIClasses(String container)
          Allows a subclass to indicate the binary names of those classes that should be considered public API by a container framework for which the computed preferred classes list as part of a download JAR file must not conflict with.
protected  DownloadJar.PlatformDefinition getPlatformDefinition(String platform)
          Allows a subclass to indicate the out and skip filter for the purpose of establishing a Platform definition, the provided filters will implicitly added to the total set of out and skip elements for this task.
protected  boolean isContainerSupported(String container)
          Allows a subclass to indicate it supports containers additional to the ones that are supported by the default implementation for the purpose of computing a preferred classes list.
protected  boolean isPlatformSupported(String platform)
          Allows a subclass to indicate it supports Platforms additional to the ones that are supported by the default implementation.
 void setEdges(boolean value)
          Sets the edges attribute.
 void setFailonerror(boolean fail)
          Indicates whether the build will continue even if there are failures when computing the dependent classes, defaults to true.
 void setHide(String value)
          Sets the hide attribute.
 void setIn(String value)
          Sets in attribute.
 void setInroot(String value)
          Sets inroot attribute.
 void setOut(String value)
          Sets the out attribute.
 void setOutroot(String value)
          Sets the outroot attribute.
 void setPlatform(String value)
          Sets the platform attribute.
 void setPreferred(File file)
          Sets the preferred attribute.
 void setPrune(String value)
          Deprecated.  
 void setShow(String value)
          Sets the show attribute.
protected  void zipFile(File file, org.apache.tools.zip.ZipOutputStream out, String path, int mode)
          Method that gets called when adding files, will check if the preferred list is being misused.
protected  void zipFile(InputStream is, org.apache.tools.zip.ZipOutputStream zOut, String vPath, long lastModified, File fromArchive, int mode)
          Delegates to the super class in case the file for the vPath being added is not part of the files to exclude.
 
Methods inherited from class org.apache.tools.ant.taskdefs.Jar
addConfiguredIndexJars, addConfiguredManifest, addConfiguredService, addMetainf, cleanUp, createEmptyZip, finalizeZipOutputStream, findJarName, getResourcesToAdd, grabFilesAndDirs, initZipOutputStream, reset, setFilesetmanifest, setIndex, setJarfile, setManifest, setManifestEncoding, setWhenempty, setWhenmanifestonly, writeIndexLikeList
 
Methods inherited from class org.apache.tools.ant.taskdefs.Zip
add, addFileset, addParentDirs, addResources, addResources, addZipfileset, addZipGroupFileset, executeMain, getComment, getDestFile, getEncoding, getLevel, getNonFileSetResourcesToAdd, getResourcesToAdd, grabNonFileSetResources, grabResources, isAddingNewFiles, isCompress, isEmpty, isInUpdateMode, selectFileResources, setBasedir, setComment, setCompress, setDestFile, setDuplicate, setEncoding, setFile, setFilesonly, setKeepCompression, setLevel, setRoundUp, setUpdate, setZipfile, zipDir, zipDir
 
Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask
add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems
 
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
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DownloadJar

public DownloadJar()
Constructs a DownloadJar task.

Method Detail

addApiclass

public void addApiclass(BasicElement value)
Adds an apiclass element.

Parameters:
value - element to add

addClass

public void addClass(BasicElement value)
Adds a class element.

Parameters:
value - element to add

addConfiguredPreferred

public void addConfiguredPreferred(DownloadJar.PreferredSet value)
Adds a populated preferred element.

Parameters:
value - fully populated nested element to add

addDir

public void addDir(BasicElement value)
Deprecated. 

Adds a dir element.

Parameters:
value - element to add

addExcludejar

public void addExcludejar(DownloadJar.BasicFileElement value)
Adds a excludejar element.

Parameters:
value - element to add

addHide

public void addHide(BasicElement value)
Adds a hide element.

Parameters:
value - element to add

addImplclass

public void addImplclass(BasicElement value)
Adds an implclass element.

Parameters:
value - element to add

addIn

public void addIn(BasicElement value)
Adds an in element.

Parameters:
value - element to add

addInroot

public void addInroot(BasicElement value)
Adds an inroot element.

Parameters:
value - element to add

addOut

public void addOut(BasicElement value)
Adds an out element.

Parameters:
value - element to add

addOutroot

public void addOutroot(BasicElement value)
Adds an outroot element.

Parameters:
value - element to add

addProxyclass

public void addProxyclass(BasicElement value)
Adds a proxyclass element.

Parameters:
value - element to add

addPrune

public void addPrune(BasicElement value)
Deprecated. 

Adds a prune element.

Parameters:
value - element to add

addResource

public void addResource(BasicElement value)
Adds a resources element.

Parameters:
value - element to add

addRootdir

public void addRootdir(BasicElement value)
Adds a rootdir element.

Parameters:
value - element to add

addShow

public void addShow(BasicElement value)
Adds a show element.

Parameters:
value - element to add

addSkip

public void addSkip(BasicElement value)
Adds a skip element.

Parameters:
value - element to add

addTell

public void addTell(BasicElement value)
Adds a tell element.

Parameters:
value - element to add

addVirtualclass

public void addVirtualclass(BasicElement value)
Adds a virtualclass element.

Parameters:
value - element to add

createClasspath

public org.apache.tools.ant.types.Path createClasspath()
Adds a nested classpath element.

Returns:
path element to set

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Executes the download jar task.

Overrides:
execute in class org.apache.tools.ant.taskdefs.Zip
Throws:
org.apache.tools.ant.BuildException - unable to perform task

setEdges

public void setEdges(boolean value)
Sets the edges attribute.

Parameters:
value - attribute value

setFailonerror

public void setFailonerror(boolean fail)
Indicates whether the build will continue even if there are failures when computing the dependent classes, defaults to true.

Parameters:
fail - indicates whether the build must halt upon a failure

setHide

public void setHide(String value)
Sets the hide attribute.

Parameters:
value - attribute value

setIn

public void setIn(String value)
Sets in attribute.

Parameters:
value - attribute value

setInroot

public void setInroot(String value)
Sets inroot attribute.

Parameters:
value - attribute value

setOut

public void setOut(String value)
Sets the out attribute.

Parameters:
value - attribute value

setOutroot

public void setOutroot(String value)
Sets the outroot attribute.

Parameters:
value - attribute value

setPlatform

public void setPlatform(String value)
Sets the platform attribute.

Parameters:
value - attribute value

setPreferred

public void setPreferred(File file)
Sets the preferred attribute.

This attribute will be ignored in case the nested preferred element is used.

Parameters:
file - PREFERRED.LIST file

setPrune

public void setPrune(String value)
Deprecated. 

Sets the prune attribute.

Parameters:
value - attribute value

setShow

public void setShow(String value)
Sets the show attribute.

Parameters:
value - attribute value

getContainerAPIClasses

protected List getContainerAPIClasses(String container)
Allows a subclass to indicate the binary names of those classes that should be considered public API by a container framework for which the computed preferred classes list as part of a download JAR file must not conflict with.

This method will be called in case isContainerSupported(String) for the specified container attribute returns true.

The default DownloadJar implementation will return an empty set.

Parameters:
container - value (converted to lower-case) for the container attribute of the preferred element
Returns:
a list of binary names of classes that are not considered preferred by a container framework and therefore are considered public API for computing the preferred classes list
See Also:
isContainerSupported(String)

getPlatformDefinition

protected DownloadJar.PlatformDefinition getPlatformDefinition(String platform)
Allows a subclass to indicate the out and skip filter for the purpose of establishing a Platform definition, the provided filters will implicitly added to the total set of out and skip elements for this task.

This method will be called in case isPlatformSupported(String) for the specified platform attribute returns true.

The default DownloadJar implementation will return an empty platform definition.

Parameters:
platform - value (converted to lower-case) for the platform attribute
Returns:
platform definition used to implicitly set the out and skip filter
See Also:
isPlatformSupported(String)

isPlatformSupported

protected boolean isPlatformSupported(String platform)
Allows a subclass to indicate it supports Platforms additional to the ones that are supported by the default implementation.

This method wil be called in case the Platform specified is not jini-core, jsc, jsc-dl or jsk.

The default DownloadJar implementation will return false.

Parameters:
platform - value (converted to lower-case) for the platform attribute
Returns:
true if the specified Platform is supported, false otherwise

isContainerSupported

protected boolean isContainerSupported(String container)
Allows a subclass to indicate it supports containers additional to the ones that are supported by the default implementation for the purpose of computing a preferred classes list.

This method wil be called in case the value for the container attribute of the nested preferred element is not seven.

The default DownloadJar implementation will return false.

Note: in case this method is overridden getContainerAPIClasses(String) should also be overridden.

Parameters:
container - value (converted to lower-case) for the container attribute of the preferred element
Returns:
true if the specified container is supported, false otherwise

zipFile

protected void zipFile(File file,
                       org.apache.tools.zip.ZipOutputStream out,
                       String path,
                       int mode)
                throws IOException
Method that gets called when adding files, will check if the preferred list is being misused.

Overrides:
zipFile in class org.apache.tools.ant.taskdefs.Zip
Parameters:
file - file to add to the archive
out - stream to write to
path - name this entry shall have in the archive
mode - the Unix permissions to set
Throws:
IOException - if an I/O error occurs

zipFile

protected void zipFile(InputStream is,
                       org.apache.tools.zip.ZipOutputStream zOut,
                       String vPath,
                       long lastModified,
                       File fromArchive,
                       int mode)
                throws IOException
Delegates to the super class in case the file for the vPath being added is not part of the files to exclude.

Overrides:
zipFile in class org.apache.tools.ant.taskdefs.Jar
Throws:
IOException

Cheiron Utils API 0.2.10-b${p4.change}

Bugs or problems related to this documentation can be reported to the Cheiron Utils issue tracking system.

Copyright 2002-2007 Virgil BV.

Licensed under the Apache License, Version 2.0.