public class TemplateMapLoader
extends java.lang.Object
Copyright (C) 2012-2015 JIOWA Business Solutions GmbH, Bettinastr. 30 , 60325 Frankfurt am Main, Germany
Homepage: www.jiowa.de
All rights reserved.
Download: www.jiowa.de/download.html
License: www.jiowa.de/license.html
Modifier and Type | Field and Description |
---|---|
protected TemplateFileFilter |
filter |
protected TemplateNotation |
notation |
protected TemplateParser |
parser |
protected java.util.Set<java.lang.String> |
progressSet |
protected java.util.Collection<java.io.File> |
templateDirs |
protected java.util.jar.JarFile |
templateJarFile |
protected TemplateMap |
templateMap |
protected java.util.Map<java.lang.String,java.lang.String> |
templateTextMap |
protected java.util.Map<java.lang.String,RedefinitionTokenList> |
templateTokenMap |
Constructor and Description |
---|
TemplateMapLoader(java.util.Collection<java.io.File> templateDirs,
TemplateFileFilter filter,
TemplateNotation notation)
Creates a template map loader which loads all templates from a collection of template directories.
|
TemplateMapLoader(java.util.jar.JarFile templateJarFile,
TemplateFileFilter filter,
TemplateNotation notation)
Creates a template map loader to laod a template map from jar file.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addToTextMap(java.lang.String filename,
java.lang.String text)
Adds a filename and its text contents to the template text map.
|
RedefinitionTokenList |
getRedefTokenList(java.lang.String filename)
Returns the redefintion token list for a given template file.
|
TemplateNotation |
getTemplateNotation()
Returns the template notation.
|
boolean |
isAlreadyInProgress(java.lang.String filename)
Returns true if this template filename is already being parsed.
|
TemplateMap |
load()
This methods returns the completely parsed templates within a template map.
|
protected void |
loadFromJarFile(java.util.jar.JarFile jarfile)
Loads all template files from a jar file.
|
protected void |
loadRecursively(java.util.Collection<java.io.File> dirs)
Loads recursively all template files within the collection of directories.
|
protected void |
loadRecursively(java.io.File dir)
Loads recursively all template files from a directory.
|
protected void |
loadTemplate(java.lang.String filename)
Parses the template with the given filename and returns the
Template reference. |
void |
markTemplate(java.lang.String filename)
Marks template as being parsed.
|
void |
putRedefTokenList(java.lang.String filename,
RedefinitionTokenList list)
Stores the redefinition token list for a given template filename.
|
protected java.lang.String |
readFile(java.io.File file)
Reads a template file and returns its text contents as string.
|
void |
removeMark(java.lang.String filename)
Remove the mark for a template after it has been parsed correctly.
|
protected java.util.Collection<java.io.File> templateDirs
protected java.util.jar.JarFile templateJarFile
protected TemplateFileFilter filter
protected TemplateMap templateMap
protected java.util.Map<java.lang.String,java.lang.String> templateTextMap
protected java.util.Map<java.lang.String,RedefinitionTokenList> templateTokenMap
protected TemplateNotation notation
protected TemplateParser parser
protected java.util.Set<java.lang.String> progressSet
public TemplateMapLoader(java.util.Collection<java.io.File> templateDirs, TemplateFileFilter filter, TemplateNotation notation)
templateDirs
- template directoriesfilter
- template file filternotation
- template notationpublic TemplateMapLoader(java.util.jar.JarFile templateJarFile, TemplateFileFilter filter, TemplateNotation notation)
templateJarFile
- jar filefilter
- template file filternotation
- template notationpublic TemplateMap load() throws java.io.IOException
TemplateMap
java.io.IOException
- in case of I/O errorspublic TemplateNotation getTemplateNotation()
public RedefinitionTokenList getRedefTokenList(java.lang.String filename)
filename
- the template filenamepublic void putRedefTokenList(java.lang.String filename, RedefinitionTokenList list)
filename
- the template filenamelist
- the list of redefinition tokenspublic boolean isAlreadyInProgress(java.lang.String filename)
filename
- template filenamepublic void markTemplate(java.lang.String filename)
filename
- template filenamepublic void removeMark(java.lang.String filename)
filename
- template fileprotected void loadTemplate(java.lang.String filename)
Template
reference.filename
- the name of the file without path, i.e. Attribute.jgt for example.protected void loadRecursively(java.util.Collection<java.io.File> dirs) throws java.io.IOException
dirs
- list of directoriesjava.io.IOException
- if the files or directories could not been accessedprotected void loadRecursively(java.io.File dir) throws java.io.IOException
dir
- the directoryjava.io.IOException
- if the files or directories were not accessableprotected void loadFromJarFile(java.util.jar.JarFile jarfile) throws java.io.IOException
jarfile
- the jar filejava.io.IOException
protected void addToTextMap(java.lang.String filename, java.lang.String text)
filename
- the filenametext
- the textprotected java.lang.String readFile(java.io.File file) throws java.io.IOException
file
- the filejava.io.IOException