com.threerings.jpkg.ant.dpkg.scripts
Class TemplateScript

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by com.threerings.antidote.field.BaseComponent
              extended by com.threerings.antidote.field.BaseField
                  extended by com.threerings.jpkg.ant.dpkg.scripts.BaseTemplateScript
                      extended by com.threerings.jpkg.ant.dpkg.scripts.TemplateScript
All Implemented Interfaces:
Field, ReferenceField, RequiresValidation, PackageScript, ValidationScript, VelocityTemplate, Cloneable
Direct Known Subclasses:
AbstractTypeScript, HelloWorld

public abstract class TemplateScript
extends BaseTemplateScript

A simple implementation of BaseTemplateScript which provides helpers to populate the velocity context and inserts the DpkgData object into the context by default.


Field Summary
protected static String DPKG_DATA_KEY
          The default key name to use when adding the DpkgData object to the context.
 
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
TemplateScript(MaintainerScript.Type type)
          Construct a TemplateScript with the single script type implemented.
TemplateScript(Set<MaintainerScript.Type> types)
          Construct a TemplateScript with a set of the script types implemented.
 
Method Summary
protected  void addSubstitution(String key, Object value)
          Add a Velocity template substitution, converting the supplied key into the supplied value.
 InputStream getSource(DpkgData data)
          Returns the script text source.
 Set<MaintainerScript.Type> getTypes()
          Returns the MaintainerScript.Type objects implemented by this script.
 void populateContext(VelocityContext context)
          Provides the template a VelocityContext to populate with e.g.
static Set<MaintainerScript.Type> typeList(MaintainerScript.Type... types)
          A static helper to pass a list of types to the constructor.
 
Methods inherited from class com.threerings.jpkg.ant.dpkg.scripts.BaseTemplateScript
mergeTemplate
 
Methods inherited from class com.threerings.antidote.field.BaseField
execute, init, reconfigure, setRefid
 
Methods inherited from class com.threerings.antidote.field.BaseComponent
appendViolation, appendViolationList, getReferencedField, isReference, registerField, reportConflictingProperties, reportUnsetDependentFields, reportUnsetDependentProperties, reportUnsetField, setReference, validate, validateChildFields, validateChildFields, validateField, validateOptionalProperties, validateProperties, validateProperties
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, log, log, maybeConfigure, perform, 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
 
Methods inherited from interface com.threerings.antidote.field.ReferenceField
getReferencedField, isReference
 
Methods inherited from interface com.threerings.antidote.field.Field
getFieldName, getLocation
 
Methods inherited from interface com.threerings.antidote.RequiresValidation
validate
 
Methods inherited from interface com.threerings.jpkg.ant.dpkg.scripts.runner.PackageScript
failOnError, getFriendlyName
 
Methods inherited from interface com.threerings.jpkg.ant.VelocityTemplate
getTemplateName
 

Field Detail

DPKG_DATA_KEY

protected static final String DPKG_DATA_KEY
The default key name to use when adding the DpkgData object to the context.

See Also:
Constant Field Values
Constructor Detail

TemplateScript

public TemplateScript(MaintainerScript.Type type)
Construct a TemplateScript with the single script type implemented.


TemplateScript

public TemplateScript(Set<MaintainerScript.Type> types)
Construct a TemplateScript with a set of the script types implemented.

See Also:
typeList(MaintainerScript.Type...)
Method Detail

typeList

public static Set<MaintainerScript.Type> typeList(MaintainerScript.Type... types)
A static helper to pass a list of types to the constructor.


getTypes

public Set<MaintainerScript.Type> getTypes()
Description copied from interface: PackageScript
Returns the MaintainerScript.Type objects implemented by this script.


getSource

public InputStream getSource(DpkgData data)
                      throws IOException
Description copied from interface: PackageScript
Returns the script text source.

Throws:
IOException

populateContext

public void populateContext(VelocityContext context)
Description copied from interface: VelocityTemplate
Provides the template a VelocityContext to populate with e.g. key/value substitutions.


addSubstitution

protected void addSubstitution(String key,
                               Object value)
Add a Velocity template substitution, converting the supplied key into the supplied value.



Copyright © 2007-2008 Three Rings Design, Inc. All Rights Reserved. Released under a BSD license.