com.samskivert.velocity
Class SiteResourceManager

java.lang.Object
  extended by org.apache.velocity.runtime.resource.ResourceManagerImpl
      extended by com.samskivert.velocity.SiteResourceManager
All Implemented Interfaces:
org.apache.velocity.runtime.resource.ResourceManager

public class SiteResourceManager
extends org.apache.velocity.runtime.resource.ResourceManagerImpl

A resource manager implementation for Velocity that first loads site specific resources (via the SiteJarResourceLoader), but falls back to default resources if no site-specific resource loader is available.


Field Summary
protected  ServletContextResourceLoader _contextLoader
          We use this to load default resources.
protected  SiteIdentifier _ident
          A reference to the site identifier in use by the application.
protected  javax.servlet.ServletContext _sctx
          A reference to the servlet context through which we'll load default resources.
protected  SiteJarResourceLoader _siteLoader
          We use this to load site-specific resources.
 
Fields inherited from class org.apache.velocity.runtime.resource.ResourceManagerImpl
globalCache, log, RESOURCE_CONTENT, RESOURCE_TEMPLATE, resourceLoaders, rsvc
 
Constructor Summary
SiteResourceManager()
           
 
Method Summary
 void initialize(org.apache.velocity.runtime.RuntimeServices rsvc)
           
protected  org.apache.velocity.runtime.resource.Resource loadResource(String resourceName, int resourceType, String encoding)
           
protected  void resolveResource(org.apache.velocity.runtime.resource.Resource resource, org.apache.velocity.runtime.resource.loader.ResourceLoader loader)
           
 
Methods inherited from class org.apache.velocity.runtime.resource.ResourceManagerImpl
getLoaderNameForResource, getResource, getResource, refreshResource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_sctx

protected javax.servlet.ServletContext _sctx
A reference to the servlet context through which we'll load default resources.


_ident

protected SiteIdentifier _ident
A reference to the site identifier in use by the application.


_siteLoader

protected SiteJarResourceLoader _siteLoader
We use this to load site-specific resources.


_contextLoader

protected ServletContextResourceLoader _contextLoader
We use this to load default resources.

Constructor Detail

SiteResourceManager

public SiteResourceManager()
Method Detail

initialize

public void initialize(org.apache.velocity.runtime.RuntimeServices rsvc)
                throws Exception
Specified by:
initialize in interface org.apache.velocity.runtime.resource.ResourceManager
Overrides:
initialize in class org.apache.velocity.runtime.resource.ResourceManagerImpl
Throws:
Exception

loadResource

protected org.apache.velocity.runtime.resource.Resource loadResource(String resourceName,
                                                                     int resourceType,
                                                                     String encoding)
                                                              throws org.apache.velocity.exception.ResourceNotFoundException,
                                                                     org.apache.velocity.exception.ParseErrorException,
                                                                     Exception
Overrides:
loadResource in class org.apache.velocity.runtime.resource.ResourceManagerImpl
Throws:
org.apache.velocity.exception.ResourceNotFoundException
org.apache.velocity.exception.ParseErrorException
Exception

resolveResource

protected void resolveResource(org.apache.velocity.runtime.resource.Resource resource,
                               org.apache.velocity.runtime.resource.loader.ResourceLoader loader)
                        throws org.apache.velocity.exception.ResourceNotFoundException,
                               org.apache.velocity.exception.ParseErrorException,
                               Exception
Throws:
org.apache.velocity.exception.ResourceNotFoundException
org.apache.velocity.exception.ParseErrorException
Exception


Copyright © 2000-2008 Michael Bayne. All Rights Reserved.