org.peaseplate
Class PeasePlateEngine

java.lang.Object
  extended by org.peaseplate.PeasePlateEngine
All Implemented Interfaces:
IPeasePlateEngine, TemplateEngine

public class PeasePlateEngine
extends java.lang.Object
implements IPeasePlateEngine

The default implementation of the Pease Plate engine.

Author:
Manfred HANTSCHEL

Constructor Summary
PeasePlateEngine(java.lang.ClassLoader... classLoaders)
           
 
Method Summary
 void addClassLoader(java.lang.ClassLoader... classLoaders)
          Adds the specified class loaders to the facotry.
 Template compile(char[] source)
          Compiles the template defined by the source.
 Template compile(java.lang.String source)
          Compiles the template defined by the source.
 Template compile(TemplateLocator locator)
          Compiles the template defined by the specified locator.
 CacheService getCacheService()
          The default service is the DefaultCacheService
 java.util.Collection<java.lang.ClassLoader> getClassLoaders()
          Returns all the class loaders in an unmodifiable collection.
 ConversionService getConversionService()
          The default service is the DefaultConversionService.
 java.lang.String getDefaultEncoding()
          The default value is the default encoding of your operating system, provided in Java by the system property "file.encoding"
 LineSeparator getDefaultLineSeparator()
          Returns the default line separator
 java.util.Locale getDefaultLocale()
          The default value is default locale of your operating systen, provided in Java by the Locale.getDefault() method
 DesignatorService getDesignatorService()
          The default service is the DefaultDesignatorService
 MacroService getMacroService()
          Returns the macro service used to resolve and handle predefined macros
 ResolverService getResolverService()
          The default service is the DefaultResolverService
 TransformerService getTransformerService()
          The default service is the DefaultTransformerService
 void render(java.io.Writer writer, java.lang.Object workingObject, ResourceKey key)
          Renders the template specified by the descriptor

The workingObject is just any object or bean, that contains the data that should be integrated in the template.
 void render(java.io.Writer writer, java.lang.Object workingObject, java.lang.String name)
          Renders the template with the specified name to the specified writer.
 void render(java.io.Writer writer, java.lang.Object workingObject, java.lang.String name, java.util.Locale locale)
          Renders the template with the specified name to the specified writer.
 void render(java.io.Writer writer, java.lang.Object workingObject, java.lang.String name, java.util.Locale locale, java.lang.String encoding)
          Renders the template with the specified name to the specified writer.
 void render(java.io.Writer writer, java.lang.Object workingObject, java.lang.String name, java.lang.String encoding)
          Renders the template with the specified name to the specified writer.
 void setCacheService(CacheService cacheService)
          Sets the cache service used to cache templates and messages
 void setConversionService(ConversionService conversionService)
          Sets the conversion service used to convert objects from one type to another
 void setDefaultEncoding(java.lang.String defaultEncoding)
          Sets the default encoding used when no encoding is specified somewhere where needed
 void setDefaultLineSeparator(LineSeparator defaultLineSeparator)
          Sets the default line separator
 void setDefaultLocale(java.util.Locale defaultLocale)
          Sets the default locale used when no locale is specified somewhere where needed
 void setDesignatorService(DesignatorService designatorService)
          Sets the designator service used to resolve and handle designators
 void setMacroService(MacroService macroService)
          Sets the macro service used to resolve and handle predefined macros
 void setResolverService(ResolverService resolverService)
          Sets the resolver service used to resolver templates and messages
 void setTransformerService(TransformerService transformerService)
          Sets the transformer service used to resolve and handle transformers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PeasePlateEngine

public PeasePlateEngine(java.lang.ClassLoader... classLoaders)
Method Detail

addClassLoader

public void addClassLoader(java.lang.ClassLoader... classLoaders)
Description copied from interface: TemplateEngine
Adds the specified class loaders to the facotry. The class loader is used for multiple purposes, like initializing the services. The there is a new class loader added, the services will get initialized with it.

Specified by:
addClassLoader in interface TemplateEngine
Parameters:
classLoaders - the class loaders
See Also:
TemplateEngine.addClassLoader(java.lang.ClassLoader[])

getClassLoaders

public java.util.Collection<java.lang.ClassLoader> getClassLoaders()
Description copied from interface: TemplateEngine
Returns all the class loaders in an unmodifiable collection.

Specified by:
getClassLoaders in interface TemplateEngine
Returns:
the classLoaders
See Also:
TemplateEngine.getClassLoaders()

getCacheService

public CacheService getCacheService()
The default service is the DefaultCacheService

Specified by:
getCacheService in interface TemplateEngine
Returns:
the cache service
See Also:
TemplateEngine.getCacheService()

setCacheService

public void setCacheService(CacheService cacheService)
Description copied from interface: IPeasePlateEngine
Sets the cache service used to cache templates and messages

Specified by:
setCacheService in interface IPeasePlateEngine
Parameters:
cacheService - the cache service
See Also:
org.peaseplate.TemplateEngine#setCacheService(org.peaseplate.service.CacheService)

getResolverService

public ResolverService getResolverService()
The default service is the DefaultResolverService

Specified by:
getResolverService in interface TemplateEngine
Returns:
the resolver service
See Also:
TemplateEngine.getResolverService()

setResolverService

public void setResolverService(ResolverService resolverService)
Description copied from interface: IPeasePlateEngine
Sets the resolver service used to resolver templates and messages

Specified by:
setResolverService in interface IPeasePlateEngine
Parameters:
resolverService - the resolver service
See Also:
org.peaseplate.TemplateEngine#setResolverService(org.peaseplate.service.ResolverService)

getDesignatorService

public DesignatorService getDesignatorService()
The default service is the DefaultDesignatorService

Specified by:
getDesignatorService in interface TemplateEngine
Returns:
the designator service
See Also:
TemplateEngine.getDesignatorService()

setDesignatorService

public void setDesignatorService(DesignatorService designatorService)
Description copied from interface: IPeasePlateEngine
Sets the designator service used to resolve and handle designators

Specified by:
setDesignatorService in interface IPeasePlateEngine
Parameters:
designatorService - the designator service
See Also:
org.peaseplate.TemplateEngine#setDesignatorService(org.peaseplate.service.DesignatorService)

getTransformerService

public TransformerService getTransformerService()
The default service is the DefaultTransformerService

Specified by:
getTransformerService in interface TemplateEngine
Returns:
the transformer service
See Also:
TemplateEngine.getTransformerService()

setTransformerService

public void setTransformerService(TransformerService transformerService)
Description copied from interface: IPeasePlateEngine
Sets the transformer service used to resolve and handle transformers

Specified by:
setTransformerService in interface IPeasePlateEngine
Parameters:
transformerService - the transformer service
See Also:
org.peaseplate.TemplateEngine#setTransformerService(org.peaseplate.service.TransformerService)

getMacroService

public MacroService getMacroService()
Description copied from interface: TemplateEngine
Returns the macro service used to resolve and handle predefined macros

Specified by:
getMacroService in interface TemplateEngine
Returns:
the macro service
See Also:
TemplateEngine.getMacroService()

setMacroService

public void setMacroService(MacroService macroService)
Description copied from interface: IPeasePlateEngine
Sets the macro service used to resolve and handle predefined macros

Specified by:
setMacroService in interface IPeasePlateEngine
Parameters:
macroService - the macro service
See Also:
org.peaseplate.TemplateEngine#setMacroService(org.peaseplate.service.MacroService)

getConversionService

public ConversionService getConversionService()
The default service is the DefaultConversionService.

Specified by:
getConversionService in interface TemplateEngine
Returns:
the conversion service
See Also:
TemplateEngine.getConversionService()

setConversionService

public void setConversionService(ConversionService conversionService)
Description copied from interface: IPeasePlateEngine
Sets the conversion service used to convert objects from one type to another

Specified by:
setConversionService in interface IPeasePlateEngine
Parameters:
conversionService - the conversion service
See Also:
org.peaseplate.TemplateEngine#setConversionService(org.peaseplate.service.ConversionService)

getDefaultLocale

public java.util.Locale getDefaultLocale()
The default value is default locale of your operating systen, provided in Java by the Locale.getDefault() method

Specified by:
getDefaultLocale in interface TemplateEngine
Returns:
teh default locale
See Also:
TemplateEngine.getDefaultLocale()

setDefaultLocale

public void setDefaultLocale(java.util.Locale defaultLocale)
Description copied from interface: TemplateEngine
Sets the default locale used when no locale is specified somewhere where needed

Specified by:
setDefaultLocale in interface TemplateEngine
Parameters:
defaultLocale - the default locale
See Also:
TemplateEngine.setDefaultLocale(java.util.Locale)

getDefaultEncoding

public java.lang.String getDefaultEncoding()
The default value is the default encoding of your operating system, provided in Java by the system property "file.encoding"

Specified by:
getDefaultEncoding in interface TemplateEngine
Returns:
the default encoding
See Also:
TemplateEngine.getDefaultEncoding()

setDefaultEncoding

public void setDefaultEncoding(java.lang.String defaultEncoding)
Description copied from interface: TemplateEngine
Sets the default encoding used when no encoding is specified somewhere where needed

Specified by:
setDefaultEncoding in interface TemplateEngine
Parameters:
defaultEncoding - the default encoding
See Also:
TemplateEngine.setDefaultEncoding(java.lang.String)

getDefaultLineSeparator

public LineSeparator getDefaultLineSeparator()
Description copied from interface: TemplateEngine
Returns the default line separator

Specified by:
getDefaultLineSeparator in interface TemplateEngine
Returns:
the default line separator
See Also:
TemplateEngine.getDefaultLineSeparator()

setDefaultLineSeparator

public void setDefaultLineSeparator(LineSeparator defaultLineSeparator)
Description copied from interface: TemplateEngine
Sets the default line separator

Specified by:
setDefaultLineSeparator in interface TemplateEngine
Parameters:
defaultLineSeparator - the default line separator
See Also:
org.peaseplate.TemplateEngine#setDefaultLineSeparator(java.lang.String)

compile

public Template compile(TemplateLocator locator)
                 throws TemplateException
Description copied from interface: TemplateEngine
Compiles the template defined by the specified locator. This is the base method for compiling templates.

Specified by:
compile in interface TemplateEngine
Parameters:
locator - the locator
Returns:
the compiled template
Throws:
TemplateException - on occasion
See Also:
TemplateEngine.compile(org.peaseplate.locator.TemplateLocator)

compile

public Template compile(java.lang.String source)
                 throws TemplateException
Description copied from interface: TemplateEngine
Compiles the template defined by the source. Makes use of the InMemoryTemplateLocator, which stores the source in memory.

Specified by:
compile in interface TemplateEngine
Parameters:
source - the source
Returns:
the compiled template
Throws:
TemplateException
See Also:
TemplateEngine.compile(java.lang.String)

compile

public Template compile(char[] source)
                 throws TemplateException
Description copied from interface: TemplateEngine
Compiles the template defined by the source. Makes use of the InMemoryTemplateLocator, which stores the source in memory.

Specified by:
compile in interface TemplateEngine
Parameters:
source - the source
Returns:
the compiled template
Throws:
TemplateException
See Also:
TemplateEngine.compile(char[])

render

public void render(java.io.Writer writer,
                   java.lang.Object workingObject,
                   java.lang.String name)
            throws TemplateException,
                   java.io.IOException
Description copied from interface: TemplateEngine
Renders the template with the specified name to the specified writer.

The workingObject is just any object or bean, that contains the data that should be integrated in the template.

The name of the template is usually some path on the file system or the resources but you can enhance this by implementing an own Resolver.

Specified by:
render in interface TemplateEngine
Parameters:
writer - the writer
workingObject - the working object
name - the name of the template
Throws:
TemplateException - if anything goes wrong
java.io.IOException - if it cannot write to the writer
See Also:
TemplateEngine.render(java.io.Writer, java.lang.Object, java.lang.String)

render

public void render(java.io.Writer writer,
                   java.lang.Object workingObject,
                   java.lang.String name,
                   java.util.Locale locale)
            throws TemplateException,
                   java.io.IOException
Description copied from interface: TemplateEngine
Renders the template with the specified name to the specified writer.

The workingObject is just any object or bean, that contains the data that should be integrated in the template.

The name of the template is usually some path on the file system or the resources but you can enhance this by implementing an own Resolver.

Specified by:
render in interface TemplateEngine
Parameters:
writer - the writer
workingObject - the working object
name - the name of the template
locale - the locale; uses the default locale if null
Throws:
TemplateException - if anything goes wrong
java.io.IOException - if it cannot write to the writer
See Also:
TemplateEngine.render(java.io.Writer, java.lang.Object, java.lang.String, java.util.Locale)

render

public void render(java.io.Writer writer,
                   java.lang.Object workingObject,
                   java.lang.String name,
                   java.lang.String encoding)
            throws TemplateException,
                   java.io.IOException
Description copied from interface: TemplateEngine
Renders the template with the specified name to the specified writer.

The workingObject is just any object or bean, that contains the data that should be integrated in the template.

The name of the template is usually some path on the file system or the resources but you can enhance this by implementing an own Resolver.

Specified by:
render in interface TemplateEngine
Parameters:
writer - the writer
workingObject - the working object
name - the name of the template
encoding - the encoding; uses the default encoding if null
Throws:
TemplateException - if anything goes wrong
java.io.IOException - if it cannot write to the writer
See Also:
TemplateEngine.render(java.io.Writer, java.lang.Object, java.lang.String, java.lang.String)

render

public void render(java.io.Writer writer,
                   java.lang.Object workingObject,
                   java.lang.String name,
                   java.util.Locale locale,
                   java.lang.String encoding)
            throws TemplateException,
                   java.io.IOException
Description copied from interface: TemplateEngine
Renders the template with the specified name to the specified writer.

The workingObject is just any object or bean, that contains the data that should be integrated in the template.

The name of the template is usually some path on the file system or the resources but you can enhance this by implementing an own Resolver.

Specified by:
render in interface TemplateEngine
Parameters:
writer - the writer
workingObject - the working object
name - the name of the template
locale - the locale; uses the default locale if null
encoding - the encoding; uses the default encoding if null
Throws:
TemplateException - if anything goes wrong
java.io.IOException - if it cannot write to the writer
See Also:
TemplateEngine.render(java.io.Writer, java.lang.Object, java.lang.String, java.util.Locale, java.lang.String)

render

public void render(java.io.Writer writer,
                   java.lang.Object workingObject,
                   ResourceKey key)
            throws TemplateException,
                   java.io.IOException
Description copied from interface: TemplateEngine
Renders the template specified by the descriptor

The workingObject is just any object or bean, that contains the data that should be integrated in the template.

The name of the template is usually some path on the file system or the resources but you can enhance this by implementing an own Resolver.

Specified by:
render in interface TemplateEngine
Parameters:
writer - the writer
workingObject - the working object
key - the key
Throws:
TemplateException - if anything goes wrong
java.io.IOException - if it cannot write to the writer
See Also:
TemplateEngine.render(java.io.Writer, java.lang.Object, org.peaseplate.internal.ResourceKey)


Copyright © 2008. All Rights Reserved.