org.rythmengine.resource
Class TemplateResourceBase

java.lang.Object
  extended by org.rythmengine.resource.TemplateResourceBase
All Implemented Interfaces:
Serializable, ITemplateResource
Direct Known Subclasses:
ClasspathTemplateResource, FileTemplateResource, StringTemplateResource, ToStringTemplateResource

public abstract class TemplateResourceBase
extends Object
implements ITemplateResource

Created by IntelliJ IDEA. User: luog Date: 20/01/12 Time: 11:48 PM To change this template use File | Settings | File Templates.

See Also:
Serialized Form

Field Summary
protected  String cache
           
protected static ILogger logger
           
protected  long nextCheckPoint
           
 
Constructor Summary
TemplateResourceBase()
           
TemplateResourceBase(RythmEngine engine)
           
 
Method Summary
 String asTemplateContent()
          Return template content as a string.
 ICodeType codeType()
          Return code type suggested by this resource, e.g.
protected abstract  long defCheckInterval()
           
protected  RythmEngine engine()
           
 boolean equals(Object obj)
           
 String getSuggestedClassName()
          Propose a name of generated java class for this resource
static ICodeType getTypeOfPath(RythmEngine engine, String s)
           
 int hashCode()
           
protected abstract  long lastModified()
           
protected static String path2CN(String path)
           
 boolean refresh()
          Refresh resource if necessary
protected abstract  String reload()
           
 void setEngine(RythmEngine engine)
          Set engine instance to the resource
 String tagName()
          Return non-null value if this resource present a tag
protected  Long userCheckInterval()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.rythmengine.resource.ITemplateResource
getKey, isValid
 

Field Detail

logger

protected static final ILogger logger

cache

protected String cache

nextCheckPoint

protected long nextCheckPoint
Constructor Detail

TemplateResourceBase

public TemplateResourceBase()

TemplateResourceBase

public TemplateResourceBase(RythmEngine engine)
Method Detail

setEngine

public void setEngine(RythmEngine engine)
Description copied from interface: ITemplateResource
Set engine instance to the resource

Specified by:
setEngine in interface ITemplateResource

engine

protected RythmEngine engine()

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

defCheckInterval

protected abstract long defCheckInterval()

userCheckInterval

protected Long userCheckInterval()

lastModified

protected abstract long lastModified()

reload

protected abstract String reload()

asTemplateContent

public String asTemplateContent()
Description copied from interface: ITemplateResource
Return template content as a string. Call refresh() first to check if the resource has been modified

Specified by:
asTemplateContent in interface ITemplateResource
Returns:
resource content

refresh

public final boolean refresh()
Description copied from interface: ITemplateResource
Refresh resource if necessary

Specified by:
refresh in interface ITemplateResource
Returns:
true if resource is modified false otherwise

getSuggestedClassName

public String getSuggestedClassName()
Description copied from interface: ITemplateResource
Propose a name of generated java class for this resource

Specified by:
getSuggestedClassName in interface ITemplateResource
Returns:
suggested class name

tagName

public String tagName()
Description copied from interface: ITemplateResource
Return non-null value if this resource present a tag

Specified by:
tagName in interface ITemplateResource
Returns:
tag name

getTypeOfPath

public static ICodeType getTypeOfPath(RythmEngine engine,
                                      String s)

codeType

public ICodeType codeType()
Description copied from interface: ITemplateResource
Return code type suggested by this resource, e.g. html or js etc

Specified by:
codeType in interface ITemplateResource
Returns:
code type suggested

path2CN

protected static String path2CN(String path)


Copyright © 2013. All Rights Reserved.