org.apache.cocoon.generation
public static class: VelocityGenerator.TemplateLoader [javadoc |
source]
java.lang.Object
org.apache.velocity.runtime.resource.loader.ResourceLoader
org.apache.cocoon.generation.VelocityGenerator$TemplateLoader
Velocity
org.apache.velocity.runtime.resource.loader.ResourceLoader
implementation to load template resources using Cocoon's
SourceResolver . This class is created by the Velocity
framework via the ResourceLoaderFactory.
| Method from org.apache.cocoon.generation.VelocityGenerator$TemplateLoader Detail: |
public long getLastModified(Resource resource) {
long lastModified = 0;
try {
lastModified = resolveSource(resource.getName()).getLastModified();
} catch (Exception ex) {
super.rsvc.warn("Unable to determine last modified for resource: "
+ resource.getName() + ": " + ex);
}
return lastModified;
}
|
public InputStream getResourceStream(String systemId) throws ResourceNotFoundException {
try {
return resolveSource(systemId).getInputStream();
} catch (org.apache.velocity.exception.ResourceNotFoundException ex) {
throw ex;
} catch (Exception ex) {
throw new org.apache.velocity.exception.ResourceNotFoundException("Unable to resolve source: " + ex);
}
}
|
public void init(ExtendedProperties config) {
this.resolverContext = (org.apache.avalon.framework.context.Context) config.get("context");
if (this.resolverContext == null) {
throw new IllegalArgumentException("Runtime Cocoon resolver context not specified in resource loader configuration.");
}
}
Initialize this resource loader. The 'context' property is
required and must be of type Context . The context
is used to pass the Cocoon SourceResolver for the current
pipeline. |
public boolean isSourceModified(Resource resource) {
long lastModified = 0;
try {
lastModified = resolveSource(resource.getName()).getLastModified();
} catch (Exception ex) {
super.rsvc.warn("Unable to determine last modified for resource: "
+ resource.getName() + ": " + ex);
}
return lastModified > 0 ? lastModified != resource.getLastModified() : true;
}
|