org.freecompany.imp

Class Index

public class Index extends Task

Models the index structure for an individual project.
Field Summary
protected List<Dependency>dependencies
protected Stringformat
protected Stringgroup
protected Stringname
protected List<Repository>repositories
protected Filesrc
protected List<AntOverride>subprojects
protected List<String>types
protected Stringversion
Method Summary
voidaddAnt(AntOverride ant)
voidaddDependency(Dependency dependency)
voidaddRepository(Repository repository)
protected voidbuildFileset(String name, Collection<Dependency> list)
This is an inoptimal solution to building filesets for use in the build system.
protected voidbuildPath(String name, Collection<Dependency> list)
For the given list of dependencies ths method builds a corresponding Ant path element which is inserted by reference into the project.
voidexecute()
Configures this index structure using the values and objects set on this index during the build initialization.
StringgetGroup()
StringgetName()
List<AntOverride>getSubprojects()
List<String>getTypes()
protected voidinclude(String name)
voidsetFormat(String format)
voidsetGroup(String group)
voidsetProject(Project project)
voidsetSrc(File src)
voidsetTypes(String types)
protected voidsetupDependencies()
protected voidsetupIndexFile()
If this index specifies a source document with the src attribute it will be parsed according to the format specified.
protected voidsetupReferences()
Takes the local object sets that have been built up by defining dependencies, resolution tasks and index file parsing and publishes them to the build project context.
protected voidsetupRepositories()
Sets up any locally defined repositories in the index element.

Field Detail

dependencies

protected List<Dependency> dependencies

format

protected String format

group

protected String group

name

protected String name

repositories

protected List<Repository> repositories

src

protected File src

subprojects

protected List<AntOverride> subprojects

types

protected List<String> types

version

protected String version

Method Detail

addAnt

public void addAnt(AntOverride ant)

addDependency

public void addDependency(Dependency dependency)

addRepository

public void addRepository(Repository repository)

buildFileset

protected void buildFileset(String name, Collection<Dependency> list)
This is an inoptimal solution to building filesets for use in the build system. Because this method assumes that all dependencies share a common filesystem root it would certainly break if this were not the case. This is not an issue on any Unix system as they have only one root, nor on Windows systems with the current URI handlers we have available. But be warned...

buildPath

protected void buildPath(String name, Collection<Dependency> list)
For the given list of dependencies ths method builds a corresponding Ant path element which is inserted by reference into the project. This allows targets and tasks in the scripts to reference them without requiring Java code.

execute

public void execute()
Configures this index structure using the values and objects set on this index during the build initialization. If the 'src' attribute is set the file is parsed and processed using the interpreter specified in the 'type' attribute. Next any subprojects of this index, whether they were directly nested in the build file or specified in the external index, are executed. Finally, the required properties for this build are set so that the local target is ready to execute.

Type targets are handled as a special case. For each type listed in the index element's type attribute, a check is made to see if a target for that type is already regsitered in the project. If not, then the index code will automatically attempt to resolve a template corresponding to the type against the base module. For example, providing the index type war will cause the index to search for any locally definined target named war or one in any imports in the build file. If none is found the index will attempt to import the uri #war.template. This fragment is resolved against the core module which, if the template is provided with Imp, will maintain an alias mapping that common name to the specific template version and URI.

After setting up the complete environment for building, this method will finally iterate through the Imp specific property types to execute them.

getGroup

public String getGroup()

getName

public String getName()

getSubprojects

public List<AntOverride> getSubprojects()

getTypes

public List<String> getTypes()

include

protected void include(String name)

setFormat

public void setFormat(String format)

setGroup

public void setGroup(String group)

setProject

public void setProject(Project project)

setSrc

public void setSrc(File src)

setTypes

public void setTypes(String types)

setupDependencies

protected void setupDependencies()

setupIndexFile

protected void setupIndexFile()
If this index specifies a source document with the src attribute it will be parsed according to the format specified. The information gathered from parsing the index file is added to that which is specified directly in the index element, except where it is contradictory, in which case the index file takes presidence.

setupReferences

protected void setupReferences()
Takes the local object sets that have been built up by defining dependencies, resolution tasks and index file parsing and publishes them to the build project context. These references will be available to both internal Ant classes as well as targets in the build script.

setupRepositories

protected void setupRepositories()
Sets up any locally defined repositories in the index element.