org.peaseplate.internal.service
Class DefaultCacheService

java.lang.Object
  extended by org.peaseplate.internal.service.DefaultCacheService
All Implemented Interfaces:
CacheService

public class DefaultCacheService
extends java.lang.Object
implements CacheService

The default implementation of the cache service

Author:
Manfred Hantschel

Constructor Summary
DefaultCacheService()
           
 
Method Summary
 Messages getMessages(TemplateEngine engine, ResourceKey key)
           
 Messages getMessages(TemplateEngine engine, java.lang.String name)
          Returns the messages with the specified name.
 Messages getMessages(TemplateEngine engine, java.lang.String name, java.util.Locale locale)
          Returns the messages with the specified name.
 Messages getMessages(TemplateEngine engine, java.lang.String name, java.util.Locale locale, java.lang.String encoding)
          Returns the messages with the specified name.
 Messages getMessages(TemplateEngine engine, java.lang.String name, java.lang.String encoding)
          Returns the messages with the specified name.
 Template getTemplate(TemplateEngine engine, ResourceKey key)
           
 Template getTemplate(TemplateEngine engine, java.lang.String name)
          Returns the template with the specified name.
 Template getTemplate(TemplateEngine engine, java.lang.String name, java.util.Locale locale)
          Returns the template with the specified name.
 Template getTemplate(TemplateEngine engine, java.lang.String name, java.util.Locale locale, java.lang.String encoding)
          Returns the template with the specified name.
 Template getTemplate(TemplateEngine engine, java.lang.String name, java.lang.String encoding)
          Returns the template with the specified name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCacheService

public DefaultCacheService()
Method Detail

getMessages

public Messages getMessages(TemplateEngine engine,
                            java.lang.String name)
                     throws TemplateException
Description copied from interface: CacheService
Returns the messages with the specified name. Makes use of the CacheService.

The name is usually the template name. The extension will get replaced by ".properties". But internally it depends on the resolver, which you can enhance by implementing your own.

Specified by:
getMessages in interface CacheService
Parameters:
engine - the template engine
name - the name of the template (The extension will get replaces by ".properties"
Returns:
the messages or null if not found
Throws:
TemplateException - if anything goes wrong

getMessages

public Messages getMessages(TemplateEngine engine,
                            java.lang.String name,
                            java.util.Locale locale)
                     throws TemplateException
Description copied from interface: CacheService
Returns the messages with the specified name. Makes use of the CacheService.

The name is usually the template name. The extension will get replaced by ".properties". But internally it depends on the resolver, which you can enhance by implementing your own.

Specified by:
getMessages in interface CacheService
Parameters:
engine - the template engine
name - the name of the template (The extension will get replaces by ".properties"
locale - the locale; uses the default locale if null
Returns:
the messages or null if not found
Throws:
TemplateException - if anything goes wrong

getMessages

public Messages getMessages(TemplateEngine engine,
                            java.lang.String name,
                            java.lang.String encoding)
                     throws TemplateException
Description copied from interface: CacheService
Returns the messages with the specified name. Makes use of the CacheService.

The name is usually the template name. The extension will get replaced by ".properties". But internally it depends on the resolver, which you can enhance by implementing your own.

Specified by:
getMessages in interface CacheService
Parameters:
engine - the template engine
name - the name of the template (The extension will get replaces by ".properties"
encoding - the encoding; uses the default encoding if null, but usually not needed, the messages are loaded from properties file, and properties files have their own encoding
Returns:
the messages or null if not found
Throws:
TemplateException - if anything goes wrong

getMessages

public Messages getMessages(TemplateEngine engine,
                            java.lang.String name,
                            java.util.Locale locale,
                            java.lang.String encoding)
                     throws TemplateException
Description copied from interface: CacheService
Returns the messages with the specified name. Makes use of the CacheService.

The name is usually the template name. The extension will get replaced by ".properties". But internally it depends on the resolver, which you can enhance by implementing your own.

Specified by:
getMessages in interface CacheService
Parameters:
engine - the template engine
name - the name of the template (The extension will get replaces by ".properties"
locale - the locale; uses the default locale if null
encoding - the encoding; uses the default encoding if null, but usually not needed, the messages are loaded from properties file, and properties files have their own encoding
Returns:
the messages or null if not found
Throws:
TemplateException - if anything goes wrong

getTemplate

public Template getTemplate(TemplateEngine engine,
                            java.lang.String name)
                     throws TemplateException
Description copied from interface: CacheService
Returns the template with the specified name.

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:
getTemplate in interface CacheService
Parameters:
engine - the template engine
name - the name of the template
Returns:
the template or null if not found
Throws:
TemplateException - if anything goes wrong

getTemplate

public Template getTemplate(TemplateEngine engine,
                            java.lang.String name,
                            java.util.Locale locale)
                     throws TemplateException
Description copied from interface: CacheService
Returns the template with the specified name.

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:
getTemplate in interface CacheService
Parameters:
engine - the template engine
name - the name of the template
locale - the locale; uses the default locale if null
Returns:
the template or null if not found
Throws:
TemplateException - if anything goes wrong

getTemplate

public Template getTemplate(TemplateEngine engine,
                            java.lang.String name,
                            java.lang.String encoding)
                     throws TemplateException
Description copied from interface: CacheService
Returns the template with the specified name.

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:
getTemplate in interface CacheService
Parameters:
engine - the template engine
name - the name of the template
encoding - the encoding; uses the default encoding if null
Returns:
the template or null if not found
Throws:
TemplateException - if anything goes wrong

getTemplate

public Template getTemplate(TemplateEngine engine,
                            java.lang.String name,
                            java.util.Locale locale,
                            java.lang.String encoding)
                     throws TemplateException
Description copied from interface: CacheService
Returns the template with the specified name.

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:
getTemplate in interface CacheService
Parameters:
engine - the template engine
name - the name of the template
locale - the locale; uses the default locale if null
encoding - the encoding; uses the default encoding if null
Returns:
the template or null if not found
Throws:
TemplateException - if anything goes wrong

getTemplate

public Template getTemplate(TemplateEngine engine,
                            ResourceKey key)
                     throws TemplateException
Specified by:
getTemplate in interface CacheService
Throws:
TemplateException
See Also:
CacheService.getTemplate(org.peaseplate.TemplateEngine, org.peaseplate.internal.ResourceKey)

getMessages

public Messages getMessages(TemplateEngine engine,
                            ResourceKey key)
                     throws TemplateException
Specified by:
getMessages in interface CacheService
Throws:
TemplateException


Copyright © 2008. All Rights Reserved.