public class Generator extends Object
Constructor and Description |
---|
Generator() |
Generator(PDSObject pdsObject,
File templateFile,
File outputFile)
Initialize Generator object with a PDSObject.
|
Generator(PDSObject pdsObject,
File templateFile,
File outputFile,
Boolean isXML)
Initialize Generator object with a PDSObject.
|
Generator(PDSObject pdsObject,
File templateFile,
File outputFile,
File inputFile)
Initialize Generator object with a PDSObject.
|
Generator(PDSObject pdsObject,
File templateFile,
File outputFile,
File inputFile,
Boolean isXML)
Generator constructor class.
|
Modifier and Type | Method and Description |
---|---|
void |
addPdsObject(PDSObject pdsObject,
String contextStr)
addPdsObject
add an additional PDSObject
The contextStr is the variable prefix used in a velocity template
* $extra.SOMETHING if contextStr is "extra"
The pdsObject.getContext() value should be this same String
* it is used by getPdsObject
|
void |
generate(boolean toStdOut)
Functionality to generate the PDS4 Label from the Velocity Template
|
void |
generate(ImageOutputStream ios)
Functionality to generate the PDS4 Label from the Velocity Template
|
void |
generate(OutputStream os)
Functionality to generate the PDS4 Label from the Velocity Template
|
org.apache.velocity.VelocityContext |
getContext() |
ContextMappings |
getContextMappings() |
boolean |
getIsXML() |
File |
getOutputFile() |
PDSObject |
getPdsObject() |
PDSObject |
getPdsObject(String context_label)
getPdsObject
|
org.apache.velocity.Template |
getTemplate() |
File |
getTemplateFile() |
String |
getTemplatePath() |
void |
initTemplate()
Initializes and reads in the Velocity Template into the Velocity
Engine.
|
void |
setContext()
Sets the Velocity Template contexts specified by the PDSObject API and
ContextMappings object.
|
void |
setContext(org.apache.velocity.VelocityContext context) |
void |
setContextMappings(ContextMappings ctxMappings) |
void |
setInputFilePath(String inputFilePath) |
void |
setIsXML(boolean isXML) |
void |
setOutputFile(File outputFile) |
void |
setPDSObject(PDSObject pdsObject) |
void |
setTemplate(org.apache.velocity.Template template) |
void |
setTemplateFile(File templateFile) |
void |
setTemplatePath(String templatePath) |
public Generator(PDSObject pdsObject, File templateFile, File outputFile) throws Exception
pdsObject
- templateFile
- outputFile
- Exception
public Generator(PDSObject pdsObject, File templateFile, File outputFile, File inputFile) throws Exception
pdsObject
- templateFile
- outputFile
- inputFile
- Exception
public Generator(PDSObject pdsObject, File templateFile, File outputFile, Boolean isXML) throws Exception
pdsObject
- templateFile
- outputFile
- isXML
- flag to specify whether or not the output is expected to be XMLException
public Generator(PDSObject pdsObject, File templateFile, File outputFile, File inputFile, Boolean isXML) throws Exception
pdsObject
- pds object, i.e. PDS3 labeltemplateFile
- velocity template file pathoutputFile
- path to output file. can be null in cases where we output to streamsinputFile
- path to input file. can be null in cases where we don't careisXML
- flag to specify whether or not the output is expected to be XMLException
public void generate(ImageOutputStream ios) throws Exception
ImageOutputStream
- - ImageOutputStream write to
ImageOutputStream and OutputStream are NOT related so we must use one or the other
no casting allowedException
- - when output file does not exist, or error close String writerTemplateException
- - when output is null - reason needs to be found
* may be able to merge the 2 generate()s together since we actually write to a PrintWriter
which can wrap a File or OutputStreampublic void generate(OutputStream os) throws Exception
OutputStream
- - OutputStream write toException
- - when output file does not exist, or error close String writerTemplateException
- - when output is null - reason needs to be found
* may be able to merge the 2 generate()s together since we actually write to a PrintWriter
which can wrap a File or OutputStreampublic void generate(boolean toStdOut) throws Exception
toStdOut
- - Determines whether the output should be to a file or System.outException
- - when output file does not exist, or error close String writerTemplateException
- - when output is null - reason needs to be foundpublic void initTemplate() throws TemplateException
TemplateException
IOException
public void addPdsObject(PDSObject pdsObject, String contextStr) throws TemplateException, Exception
extraLabel
- contextStr
- TemplateException
Exception
public void setPDSObject(PDSObject pdsObject)
public PDSObject getPdsObject()
public void setContext() throws TemplateException, Exception
TemplateException
Exception
public org.apache.velocity.VelocityContext getContext()
public ContextMappings getContextMappings()
public File getOutputFile()
public org.apache.velocity.Template getTemplate()
public File getTemplateFile()
public String getTemplatePath()
public boolean getIsXML()
public void setContext(org.apache.velocity.VelocityContext context)
public void setContextMappings(ContextMappings ctxMappings)
public void setOutputFile(File outputFile)
public void setTemplate(org.apache.velocity.Template template)
public void setTemplateFile(File templateFile) throws TemplateException
TemplateException
public void setTemplatePath(String templatePath)
public void setInputFilePath(String inputFilePath)
public void setIsXML(boolean isXML)
Copyright © 2019. All rights reserved.