org.apache.cayenne.velocity

## Class SQLTemplateResourceManager

- java.lang.Object
- - org.apache.velocity.runtime.resource.loader.ResourceLoader
  - - org.apache.cayenne.velocity.SQLTemplateResourceManager

- All Implemented Interfaces:
    org.apache.velocity.runtime.resource.ResourceManager

      public class SQLTemplateResourceManager
      extends org.apache.velocity.runtime.resource.loader.ResourceLoader
      implements org.apache.velocity.runtime.resource.ResourceManager

  An implementation of the Velocity ResourceManager and ResourceLoader that creates templates from in-memory Strings.
  Since:
    1.1

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Map<String,org.apache.velocity.Template>` | `templateCache`

    - ### Fields inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader

      `className, isCachingOn, log, modificationCheckInterval, rsvc`

    - ### Fields inherited from interface org.apache.velocity.runtime.resource.ResourceManager

      `RESOURCE_CONTENT, RESOURCE_TEMPLATE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SQLTemplateResourceManager()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clearCache()`
    `long` | `getLastModified(org.apache.velocity.runtime.resource.Resource resource)`
    `String` | `getLoaderNameForResource(String resourceName)`
    `org.apache.velocity.runtime.resource.Resource` | `getResource(String resourceName, int resourceType, String encoding)` Returns a Velocity Resource which is a Template for the given SQL.
    `InputStream` | `getResourceStream(String source)`
    `void` | `init(org.apache.commons.collections.ExtendedProperties configuration)`
    `void` | `initialize(org.apache.velocity.runtime.RuntimeServices rs)`
    `boolean` | `isSourceModified(org.apache.velocity.runtime.resource.Resource resource)`

    - ### Methods inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader

      `commonInit, getClassName, getModificationCheckInterval, isCachingOn, resourceExists, setCachingOn, setModificationCheckInterval`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### templateCache

          protected Map<String,org.apache.velocity.Template> templateCache

  - ### Constructor Detail

    - #### SQLTemplateResourceManager

          public SQLTemplateResourceManager()

  - ### Method Detail

    - #### initialize

          public void initialize(org.apache.velocity.runtime.RuntimeServices rs)
                          throws Exception

      Specified by:
        `initialize` in interface `org.apache.velocity.runtime.resource.ResourceManager`
      Throws:
        `Exception`

    - #### clearCache

          public void clearCache()

    - #### getResource

          public org.apache.velocity.runtime.resource.Resource getResource(String resourceName,
                                                                           int resourceType,
                                                                           String encoding)
                                                                    throws org.apache.velocity.exception.ResourceNotFoundException,
                                                                           org.apache.velocity.exception.ParseErrorException,
                                                                           Exception

      Returns a Velocity Resource which is a Template for the given SQL.
      Specified by:
        `getResource` in interface `org.apache.velocity.runtime.resource.ResourceManager`
      Throws:
        `org.apache.velocity.exception.ResourceNotFoundException`
        `org.apache.velocity.exception.ParseErrorException`
        `Exception`

    - #### getLoaderNameForResource

          public String getLoaderNameForResource(String resourceName)

      Specified by:
        `getLoaderNameForResource` in interface `org.apache.velocity.runtime.resource.ResourceManager`

    - #### getLastModified

          public long getLastModified(org.apache.velocity.runtime.resource.Resource resource)

      Specified by:
        `getLastModified` in class `org.apache.velocity.runtime.resource.loader.ResourceLoader`

    - #### getResourceStream

          public InputStream getResourceStream(String source)
                                        throws org.apache.velocity.exception.ResourceNotFoundException

      Specified by:
        `getResourceStream` in class `org.apache.velocity.runtime.resource.loader.ResourceLoader`
      Throws:
        `org.apache.velocity.exception.ResourceNotFoundException`

    - #### init

          public void init(org.apache.commons.collections.ExtendedProperties configuration)

      Specified by:
        `init` in class `org.apache.velocity.runtime.resource.loader.ResourceLoader`

    - #### isSourceModified

          public boolean isSourceModified(org.apache.velocity.runtime.resource.Resource resource)

      Specified by:
        `isSourceModified` in class `org.apache.velocity.runtime.resource.loader.ResourceLoader`

Copyright © 2001–2023 Apache Cayenne. All rights reserved.