org.peaseplate.service
Interface CacheService

All Known Implementing Classes:
DefaultCacheService

public interface CacheService

The cache service is responsible for caching templates and messages, to load them if they are on in the cache and to reload them if they are outdated.

Author:
Manfred Hantschel

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.
 

Method Detail

getTemplate

Template getTemplate(TemplateEngine engine,
                     java.lang.String name)
                     throws TemplateException
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.

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

Template getTemplate(TemplateEngine engine,
                     java.lang.String name,
                     java.util.Locale locale)
                     throws TemplateException
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.

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

Template getTemplate(TemplateEngine engine,
                     java.lang.String name,
                     java.lang.String encoding)
                     throws TemplateException
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.

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

Template getTemplate(TemplateEngine engine,
                     java.lang.String name,
                     java.util.Locale locale,
                     java.lang.String encoding)
                     throws TemplateException
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.

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

Template getTemplate(TemplateEngine engine,
                     ResourceKey key)
                     throws TemplateException
Throws:
TemplateException

getMessages

Messages getMessages(TemplateEngine engine,
                     java.lang.String name)
                     throws TemplateException
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.

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

Messages getMessages(TemplateEngine engine,
                     java.lang.String name,
                     java.util.Locale locale)
                     throws TemplateException
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.

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

Messages getMessages(TemplateEngine engine,
                     java.lang.String name,
                     java.lang.String encoding)
                     throws TemplateException
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.

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

Messages getMessages(TemplateEngine engine,
                     java.lang.String name,
                     java.util.Locale locale,
                     java.lang.String encoding)
                     throws TemplateException
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.

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

getMessages

Messages getMessages(TemplateEngine engine,
                     ResourceKey key)
                     throws TemplateException
Throws:
TemplateException


Copyright © 2008. All Rights Reserved.