gate.util.ant.packager
Class PackageGappTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by gate.util.ant.packager.PackageGappTask
All Implemented Interfaces:
Cloneable

public class PackageGappTask
extends org.apache.tools.ant.Task

Ant task to copy a gapp file, rewriting any relative paths it contains to point within the same directory as the target file location and copy the referenced files into the right locations. The resulting structure is self-contained and can be packaged up (e.g. in a zip file) to send to a third party.

Author:
Ian Roberts

Nested Class Summary
 class PackageGappTask.MappingHint
          Class to represent a nested hint element.
static class PackageGappTask.UnresolvedAction
          Enumeration of the actions to take when there are unresolved resources.
 
Field Summary
static Comparator<URL> PATH_COMPARATOR
          Comparator to compare URLs by lexicographic ordering of their getPath() values.
 
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
PackageGappTask()
           
 
Method Summary
 void addExtraResourcesPath(org.apache.tools.ant.types.Path path)
          Add a path containing extra resources that should be treated as if they had been referenced by relpaths within the gapp file.
 PackageGappTask.MappingHint createHint()
          Create and add the representation for a nested <hint from="X" to="Y" /> element.
 void execute()
           
 File getDestFile()
          Get the destination file to which the modified gapp will be written.
 boolean getExpandIvy()
           
 File getGateHome()
          Get the location of the GATE home directory, used to resolve $gatehome$ relative paths in the GAPP file.
 PackageGappTask.UnresolvedAction getOnUnresolved()
          Get the action performed when there are unresolved resources.
 File getSrc()
          Get the original gapp file that is to be modified.
 boolean isCopyPlugins()
          Will the task copy the complete contents of referenced plugins into the target location?
 boolean isCopyResourceDirs()
          Will the task copy the complete contents of directories containing referenced resources into the target location or just the referenced resources themselves?
 void setCopyPlugins(boolean copyPlugins)
          Will the task copy the complete contents of referenced plugins into the target location?
 void setCopyResourceDirs(boolean copyResourceDirs)
          Will the task copy the complete contents of directories containing referenced resources into the target location?
 void setDestFile(File destFile)
          Set the destination file to which the modified gapp will be written.
 void setExpandIvy(boolean expandIvy)
           
 void setGateHome(File gateHome)
          Set the location of the GATE home directory, used to resolve $gatehome$ relative paths in the GAPP file.
 void setOnUnresolved(PackageGappTask.UnresolvedAction onUnresolved)
          What should we do if there are unresolved relpaths within the gapp file?
 void setSrc(File src)
          Set the location of the original gapp file which is to be modified.
 
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
 

Field Detail

PATH_COMPARATOR

public static final Comparator<URL> PATH_COMPARATOR
Comparator to compare URLs by lexicographic ordering of their getPath() values. null compares less-than anything not null.

Constructor Detail

PackageGappTask

public PackageGappTask()
Method Detail

getDestFile

public File getDestFile()
Get the destination file to which the modified gapp will be written.


setDestFile

public void setDestFile(File destFile)
Set the destination file to which the modified gapp will be written.


getSrc

public File getSrc()
Get the original gapp file that is to be modified.


setSrc

public void setSrc(File src)
Set the location of the original gapp file which is to be modified.


getGateHome

public File getGateHome()
Get the location of the GATE home directory, used to resolve $gatehome$ relative paths in the GAPP file.


setGateHome

public void setGateHome(File gateHome)
Set the location of the GATE home directory, used to resolve $gatehome$ relative paths in the GAPP file.


isCopyPlugins

public boolean isCopyPlugins()
Will the task copy the complete contents of referenced plugins into the target location?


setCopyPlugins

public void setCopyPlugins(boolean copyPlugins)
Will the task copy the complete contents of referenced plugins into the target location? If false, only the bare minimum will be copied (the creole.xml files, any JARs referenced therein, and any directly referenced resource files). Anything extra must be copied in separately, typically with extra <copy> tasks after the <packagegapp> one.


setExpandIvy

public void setExpandIvy(boolean expandIvy)

getExpandIvy

public boolean getExpandIvy()

isCopyResourceDirs

public boolean isCopyResourceDirs()
Will the task copy the complete contents of directories containing referenced resources into the target location or just the referenced resources themselves?


setCopyResourceDirs

public void setCopyResourceDirs(boolean copyResourceDirs)
Will the task copy the complete contents of directories containing referenced resources into the target location? By default it does not do this, but only includes the directly-referenced resource files - for example, if the gapp refers to a .def file defining gazetteer lists, the lists themselves will not be included. If copyResourceDirs is false, the additional resources will need to be included using an appropriate <extraresourcespath>.


getOnUnresolved

public PackageGappTask.UnresolvedAction getOnUnresolved()
Get the action performed when there are unresolved resources.


setOnUnresolved

public void setOnUnresolved(PackageGappTask.UnresolvedAction onUnresolved)
What should we do if there are unresolved relpaths within the gapp file? By default the build will fail, but instead you can opt to have the relative paths replaced by absolute paths to the same URL, or to have the task recover by putting the files into an "application-resources" directory.


createHint

public PackageGappTask.MappingHint createHint()
Create and add the representation for a nested <hint from="X" to="Y" /> element.


addExtraResourcesPath

public void addExtraResourcesPath(org.apache.tools.ant.types.Path path)
Add a path containing extra resources that should be treated as if they had been referenced by relpaths within the gapp file. The locations to which these extra resources will be copied are determined by the plugins and mapping hints in the usual way.


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