Class TemplateOutletImpl
- java.lang.Object
-
- org.apache.torque.generator.outlet.OutletImpl
-
- org.apache.torque.generator.template.TemplateOutletImpl
-
- All Implemented Interfaces:
Outlet,TemplateOutlet
- Direct Known Subclasses:
GroovyOutlet,VelocityOutlet
public abstract class TemplateOutletImpl extends OutletImpl implements TemplateOutlet
An implementation of the TemplateOutlet interface.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedTemplateOutletImpl(QualifiedName name, ConfigurationProvider configurationProvider, String path, String encoding, TemplateFilter templateFilter)Constructs a TemplateOutletImpl with the given name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetContent(ControllerState controllerState)Returns the contents as a Template as a String.protected StringgetDetokenizedPath(ControllerState controllerState)StringgetPath()Returns the path to the template.protected Stringload(InputStream inputStream, String encoding, TemplateFilter filter)Loads the template, possibly filtering the content..StringtoString()Returns a String representation of this outlet for debugging purposes.-
Methods inherited from class org.apache.torque.generator.outlet.OutletImpl
addMergepointMapping, afterExecute, beforeExecute, execute, getInputClass, getInputElementName, getMergepointMapping, getMergepointMappings, getName, getVariable, mergepoint, setInputClass, setInputElementName, setMergepointMapping, setVariable, setVariable
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.torque.generator.outlet.Outlet
addMergepointMapping, afterExecute, beforeExecute, execute, getInputClass, getInputElementName, getMergepointMapping, getMergepointMappings, getName, setInputClass, setInputElementName, setMergepointMapping
-
-
-
-
Constructor Detail
-
TemplateOutletImpl
protected TemplateOutletImpl(QualifiedName name, ConfigurationProvider configurationProvider, String path, String encoding, TemplateFilter templateFilter) throws ConfigurationException
Constructs a TemplateOutletImpl with the given name.- Parameters:
name- the name of this outlet, not null.configurationProvider- the provider for reading the templates, not null.path- the path to the templates, not null. May contain tokens of the form ${....}, these are parsed.encoding- the encoding of the file, or null if the system's default encoding should be used.templateFilter- a possible filter for preprocessing the template, not null.- Throws:
NullPointerException- if name or inputStream are null.ConfigurationException- if the template cannot be loaded.
-
-
Method Detail
-
getContent
public String getContent(ControllerState controllerState) throws ConfigurationException
Description copied from interface:TemplateOutletReturns the contents as a Template as a String.- Specified by:
getContentin interfaceTemplateOutlet- Parameters:
controllerState- the state of the controller, not null.- Returns:
- the template as a String.
- Throws:
ConfigurationException- if the template cannot be read.
-
getDetokenizedPath
protected String getDetokenizedPath(ControllerState controllerState)
-
load
protected String load(InputStream inputStream, String encoding, TemplateFilter filter) throws IOException
Loads the template, possibly filtering the content..- Parameters:
inputStream- the stream to read from.encoding- the encoding of the template, or null for auto detection.filter- a filter for modifying the template, or null for no filtering.- Returns:
- the content of the read and filtered template.
- Throws:
IOException- if an error occurs while reading the template.
-
getPath
public String getPath()
Returns the path to the template.- Returns:
- the path to the template, not null.
-
toString
public String toString()
Returns a String representation of this outlet for debugging purposes.- Overrides:
toStringin classOutletImpl- Returns:
- a String representation of this outlet, never null.
- See Also:
Object.toString()
-
-