org.peaseplate.internal.locator
Class URLBasedTemplateLocator

java.lang.Object
  extended by org.peaseplate.locator.AbstractLocator
      extended by org.peaseplate.locator.AbstractURLBasedLocator
          extended by org.peaseplate.internal.locator.URLBasedTemplateLocator
All Implemented Interfaces:
java.io.Serializable, Locator, TemplateLocator

public class URLBasedTemplateLocator
extends AbstractURLBasedLocator
implements TemplateLocator

A template locator that is based on an URL

Author:
Manfred HANTSCHEL
See Also:
Serialized Form

Constructor Summary
URLBasedTemplateLocator(java.net.URL url, java.lang.String name, java.util.Locale locale, java.lang.String encoding)
           
 
Method Summary
 java.lang.String highlight(java.lang.String message, int line, int column)
          Create a highlight from the resource with the position at line and column highlighted :) May return null.
 char[] load()
          Returns a char array with the raw template data Don't forget to update the timestamp and the rawSize properties when loading the data.
 Template resolve(TemplateEngine engine, java.lang.String name, java.util.Locale locale, java.lang.String encoding)
          Resolves the template with the specified name relative to this template.
 
Methods inherited from class org.peaseplate.locator.AbstractURLBasedLocator
getUrl, isOutdated, toString, updateMetadata
 
Methods inherited from class org.peaseplate.locator.AbstractLocator
getKey, getRawSize, getTimestamp, setRawSize, setTimestamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.peaseplate.locator.Locator
getKey, getRawSize, getTimestamp, isOutdated, setRawSize, setTimestamp, toString
 

Constructor Detail

URLBasedTemplateLocator

public URLBasedTemplateLocator(java.net.URL url,
                               java.lang.String name,
                               java.util.Locale locale,
                               java.lang.String encoding)
Method Detail

load

public char[] load()
            throws TemplateException
Description copied from interface: TemplateLocator
Returns a char array with the raw template data Don't forget to update the timestamp and the rawSize properties when loading the data.

Specified by:
load in interface TemplateLocator
Returns:
a char array with the raw template data
Throws:
TemplateException - on occasion
See Also:
TemplateLocator.load()

resolve

public Template resolve(TemplateEngine engine,
                        java.lang.String name,
                        java.util.Locale locale,
                        java.lang.String encoding)
                 throws TemplateException
Description copied from interface: TemplateLocator
Resolves the template with the specified name relative to this template. If it can't find the template it tries to resolve the template with the absolute name, usually by asking the engine.

Specified by:
resolve in interface TemplateLocator
Parameters:
engine - the engine
name - the name, relative or absolute
locale - the locale
encoding - the locale for loading
Returns:
the template or null if not found
Throws:
TemplateException - on occasion
See Also:
TemplateLocator.resolve(org.peaseplate.TemplateEngine, java.lang.String, java.util.Locale, java.lang.String)

highlight

public java.lang.String highlight(java.lang.String message,
                                  int line,
                                  int column)
Description copied from interface: TemplateLocator
Create a highlight from the resource with the position at line and column highlighted :) May return null.

Specified by:
highlight in interface TemplateLocator
Parameters:
message - TODO
line - the line
column - the column
Returns:
the highlight or null
See Also:
TemplateLocator.highlight(String, int, int)


Copyright © 2008. All Rights Reserved.