com.threerings.jpkg.ant.dpkg.scripts.runner
Class ScriptRunner

java.lang.Object
  extended by com.threerings.jpkg.ant.dpkg.scripts.runner.ScriptRunner
All Implemented Interfaces:
VelocityTemplate, MaintainerScript

public class ScriptRunner
extends Object
implements MaintainerScript, VelocityTemplate

Handles compiling PackageScript maintainer scripts into a single master script which executes each individual script in turn.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.threerings.jpkg.debian.MaintainerScript
MaintainerScript.Type
 
Constructor Summary
ScriptRunner(MaintainerScript.Type type, List<PackageScript> scripts, DpkgData data)
          Construct a new ScriptRunner for the associated Type, using the list of PackageScript scripts.
 
Method Summary
 long getSize()
          Returns the number of bytes of data in the InputStream.
 InputStream getStream()
          Returns the InputStream with the script contents for this type.
 String getTemplateName()
          Returns the name of the template, as found in the classpath.
 MaintainerScript.Type getType()
          Returns the MaintainerScript.Type of script this instance is.
 void populateContext(VelocityContext context)
          Provides the template a VelocityContext to populate with e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptRunner

public ScriptRunner(MaintainerScript.Type type,
                    List<PackageScript> scripts,
                    DpkgData data)
             throws IOException,
                    UnexpectedScriptTypeException
Construct a new ScriptRunner for the associated Type, using the list of PackageScript scripts. The class will verify all supplied scripts match the type given.

Parameters:
type - The Type of all scripts being encoded.
scripts - The list of PackageScript scripts to encode.
data - The DpkgData to pass to each script being encoded.
Throws:
IOException - If any i/o errors occur.
UnexpectedScriptTypeException - If any script type in the supplied list does not match the type provided as the first parameter to the constructor.
Method Detail

getType

public MaintainerScript.Type getType()
Description copied from interface: MaintainerScript
Returns the MaintainerScript.Type of script this instance is.

Specified by:
getType in interface MaintainerScript

getStream

public InputStream getStream()
                      throws IOException
Description copied from interface: MaintainerScript
Returns the InputStream with the script contents for this type.

Specified by:
getStream in interface MaintainerScript
Throws:
IOException

getSize

public long getSize()
Description copied from interface: MaintainerScript
Returns the number of bytes of data in the InputStream.

Specified by:
getSize in interface MaintainerScript

getTemplateName

public String getTemplateName()
Description copied from interface: VelocityTemplate
Returns the name of the template, as found in the classpath.

Specified by:
getTemplateName in interface VelocityTemplate

populateContext

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

Specified by:
populateContext in interface VelocityTemplate


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