gate.util.ant
Class ExpandIvy

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

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

An ANT task that takes a CREOLE plugin and adds local copies of Ivy managed dependencies. This involves copying JAR files into the plugin directory as well as updating the creole.xml to substitute the IVY elements with appropriate JAR elements.


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
ExpandIvy()
           
 
Method Summary
 void execute()
           
 File getDir()
          Get the CREOLE plugin directory being processed.
 boolean getFully()
          Should we fully remove the link to Ivy by removing the dependency XML files.
static org.apache.ivy.Ivy getIvy()
           
static org.apache.ivy.Ivy getIvy(File dir)
           
static org.apache.ivy.Ivy getIvy(URL settings)
           
static org.apache.ivy.Ivy getIvy(URL settings, File dir)
           
static List<org.jdom.Element> getIvyElements(org.jdom.Document doc)
          Processes the specified XML document file to extract all the <IVY> elements
static List<org.jdom.Element> getIvyElements(URL creoleXML)
          Processes the specified creole.xml file to extract all the <IVY> elements
static File getIvyFile(org.jdom.Element element, File creoleXML)
          Turns an <IVY> XML element into a File instance by resolving relative to the creole.xml file.
static String getIvyPath(org.jdom.Element element)
          Retrieve the path to the Ivy file as specified in the XML element.
 File getSettings()
          Get the Ivy settings file used to control dependency resolution.
static URL getSettingsURL()
          Attempts to find a custom Ivy settings file to use instead of the default configuration.
 boolean getVerbose()
          If true then Ivy will spit out lots of messages while resolving dependencies.
 void setDir(File dir)
          Set the CREOLE plugin directory to be processed.
 void setFully(boolean fully)
          If true Ivy files referenced in creole.xml will be removed after they have been processed.
 void setSettings(File settings)
          Specifies the settings file used to control dependency resolution.
 void setVerbose(boolean verbose)
          Controls the log level of Ivy.
 
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 Detail

ExpandIvy

public ExpandIvy()
Method Detail

getDir

public File getDir()
Get the CREOLE plugin directory being processed.

Returns:
the CREOLE plugin directory being processed.

setDir

public void setDir(File dir)
Set the CREOLE plugin directory to be processed.

Parameters:
dir - the CREOLE plugin directory to be processed.

getSettings

public File getSettings()
Get the Ivy settings file used to control dependency resolution.

Returns:
the Ivy settings file used to control dependency resolution, or null if the default settings are being used.

setSettings

public void setSettings(File settings)
Specifies the settings file used to control dependency resolution.

Parameters:
settings - the settings file used to control dependency resolution, or null to use the default settings.

getVerbose

public boolean getVerbose()
If true then Ivy will spit out lots of messages while resolving dependencies.

Returns:
if true then Ivy will spit out lots of messages while resolving dependencies.

setVerbose

public void setVerbose(boolean verbose)
Controls the log level of Ivy.

Parameters:
verbose - if true then Ivy will spit out lots of messages while resolving dependencies.

getFully

public boolean getFully()
Should we fully remove the link to Ivy by removing the dependency XML files.

Returns:
if true Ivy files referenced in creole.xml will be removed after they have been processed.

setFully

public void setFully(boolean fully)
If true Ivy files referenced in creole.xml will be removed after they have been processed.

Parameters:
fully - if true Ivy files referenced in creole.xml will be removed after they have been processed.

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

getIvyElements

public static List<org.jdom.Element> getIvyElements(URL creoleXML)
                                             throws org.jdom.JDOMException,
                                                    IOException
Processes the specified creole.xml file to extract all the <IVY> elements

Parameters:
creoleXML - the URL of the creole.xml file to process
Returns:
a list of the <IVY> XML elements
Throws:
org.jdom.JDOMException
IOException

getIvyElements

public static List<org.jdom.Element> getIvyElements(org.jdom.Document doc)
                                             throws org.jdom.JDOMException
Processes the specified XML document file to extract all the <IVY> elements

Parameters:
doc - the XML document to process
Returns:
a list of the <IVY> XML elements
Throws:
org.jdom.JDOMException

getIvyFile

public static File getIvyFile(org.jdom.Element element,
                              File creoleXML)
Turns an <IVY> XML element into a File instance by resolving relative to the creole.xml file.

Parameters:
element - the <IVY> element to convert
creoleXML - the creole.xml file to resolve relative to
Returns:
a File instance pointing to the Ivy file specified by the XML element

getIvyPath

public static String getIvyPath(org.jdom.Element element)
Retrieve the path to the Ivy file as specified in the XML element. If no path is given use the default of 'ivy.xml'.

Parameters:
element - the <IVY> XML element to process
Returns:
the path to the Ivy file as specified in the XML element, defaults to 'ivy.xml'.

getIvy

public static org.apache.ivy.Ivy getIvy()
                                 throws ParseException,
                                        IOException
Throws:
ParseException
IOException

getIvy

public static org.apache.ivy.Ivy getIvy(File dir)
                                 throws ParseException,
                                        IOException
Throws:
ParseException
IOException

getIvy

public static org.apache.ivy.Ivy getIvy(URL settings)
                                 throws ParseException,
                                        IOException
Throws:
ParseException
IOException

getIvy

public static org.apache.ivy.Ivy getIvy(URL settings,
                                        File dir)
                                 throws ParseException,
                                        IOException
Throws:
ParseException
IOException

getSettingsURL

public static URL getSettingsURL()
Attempts to find a custom Ivy settings file to use instead of the default configuration. This looks first for a system property ivy.settings.file and then ivy.settings.url. If neither exist or can be converted to a valid URL then the method returns null.

Returns:
the URL of the settings file to use or null if one was not specified or could not be correctly converted.