Package org.appng.core.model
Class PlatformTransformer
- java.lang.Object
-
- org.appng.core.model.PlatformTransformer
-
-
Constructor Summary
Constructors Constructor Description PlatformTransformer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTemplates(List<Template> templates)
Adds the givenTemplate
s to the upcoming transformation.static void
clearCache(Site site)
Clears the internal template-cache, which must be done if aSite
is being reloaded.String
getContentType()
Returns the content-type of the transformation result.protected String
getDebugFilePrefix(Date now)
Environment
getEnvironment()
OutputFormat
getOutputFormat()
Returns theOutputFormat
used during transformationOutputType
getOutputType()
Returns theOutputType
used during transformationPlatform
getPlatform(MarshallService marshallService, Path path)
Returns thePlatform
-object unmarshalled from the template's "conf/platform.xml"-file.StyleSheetProvider
getStyleSheetProvider()
void
setEnvironment(Environment environment)
void
setOutputFormat(OutputFormat outputFormat)
void
setOutputType(OutputType outputType)
void
setStyleSheetProvider(StyleSheetProvider styleSheetProvider)
void
setTemplatePath(String templatePath)
Sets the path to the active template of the currentSite
.String
transform(ApplicationProvider applicationProvider, Properties platformProperties, String platformXML, String charSet, File debugFolder)
Performs the transformation.protected void
writeDebugFiles(File outFolder, String platformXML, org.appng.core.model.PlatformTransformer.SourceAwareTemplate sourceAwareTemplate, TransformerException te)
-
-
-
Method Detail
-
transform
public String transform(ApplicationProvider applicationProvider, Properties platformProperties, String platformXML, String charSet, File debugFolder) throws IOException, TransformerException
Performs the transformation. Therefore a composite XSL-template is used, that is build from theTemplate
s of the usedOutputType
and those previously added viaaddTemplates(List)
(assumed theOutputType
matches).- Parameters:
applicationProvider
- the currentApplicationProvider
platformProperties
- the platform-Properties
platformXML
- an XML-string retrieved from aPlatform
-objectcharSet
- the character-set to used in the returned content-type (seegetContentType()
)debugFolder
- the folder to write debug files to- Returns:
- the result of the transformation
- Throws:
FileNotFoundException
- if a template XSL-file could not be foundTransformerException
- when parsing or applying the XSLT template failsIOException
-
writeDebugFiles
protected void writeDebugFiles(File outFolder, String platformXML, org.appng.core.model.PlatformTransformer.SourceAwareTemplate sourceAwareTemplate, TransformerException te)
-
getStyleSheetProvider
public StyleSheetProvider getStyleSheetProvider()
-
setStyleSheetProvider
public void setStyleSheetProvider(StyleSheetProvider styleSheetProvider)
-
addTemplates
public void addTemplates(List<Template> templates)
Adds the givenTemplate
s to the upcoming transformation.- Parameters:
templates
- a list ofTemplate
s
-
getEnvironment
public Environment getEnvironment()
-
setEnvironment
public void setEnvironment(Environment environment)
-
getPlatform
public Platform getPlatform(MarshallService marshallService, Path path) throws InvalidConfigurationException
Returns thePlatform
-object unmarshalled from the template's "conf/platform.xml"-file. Also determines theOutputType
andOutputFormat
for the upcoming transformation.- Parameters:
marshallService
- theMarshallService
to use for unmarshallingpath
- the currentPath
-object- Returns:
- the
Platform
-object - Throws:
InvalidConfigurationException
- if the "conf/platform.xml"-file could net be found or unmarshalled.- See Also:
getOutputFormat()
,getOutputType()
-
getContentType
public String getContentType()
Returns the content-type of the transformation result.- Returns:
- the content-type
-
setTemplatePath
public void setTemplatePath(String templatePath)
Sets the path to the active template of the currentSite
.- Parameters:
templatePath
- the absolute path to the directory where template of theSite
resides
-
clearCache
public static void clearCache(Site site)
Clears the internal template-cache, which must be done if aSite
is being reloaded.
-
getOutputFormat
public OutputFormat getOutputFormat()
Returns theOutputFormat
used during transformation- Returns:
- the
OutputFormat
-
setOutputFormat
public void setOutputFormat(OutputFormat outputFormat)
-
getOutputType
public OutputType getOutputType()
Returns theOutputType
used during transformation- Returns:
- the
OutputType
-
setOutputType
public void setOutputType(OutputType outputType)
-
-