Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.6
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      Operating System: All
      Platform: All

      Description

      The class org.apache.velocity.runtime.resource.ResourceFactory provides
      no mechanism for allowing sub-classes of Template or ContentResources
      to be returned.

      Since ResourceManagerImpl makes a call to ResourceFactory.getResource(),
      the only way to override the behavior is to subclass ResourceManagerImpl
      and cut-paste-then-modify the code for loadResource().

      At the very least, moving the ResourceFactory.getResource() call into
      a separate, protected method in ResourceManagerImpl would greatly simplify
      sub-classing Templates and/or ContentResources.

        Activity

        Hide
        Nathan Bubna added a comment -

        Trivial... not sure why this wasn't done earlier.

        Show
        Nathan Bubna added a comment - Trivial... not sure why this wasn't done earlier.
        Hide
        Nathan Bubna added a comment -

        I don't think so. I believe the request is for a change in the ResourceManagerImpl to make it more easily extendable, not the ResourceManager interface. Breaking part of a larger method of an implementation out into another protected method should never break classes that override the implemenation and is irrelevant for other implemenations of the same interface.

        Show
        Nathan Bubna added a comment - I don't think so. I believe the request is for a change in the ResourceManagerImpl to make it more easily extendable, not the ResourceManager interface. Breaking part of a larger method of an implementation out into another protected method should never break classes that override the implemenation and is irrelevant for other implemenations of the same interface.
        Hide
        Will Glass-Husain added a comment -

        Since you can choose the implementation via velocity.properties, wouldn't this fall under a prohibited 'not-backwards-compatible' change?

        Show
        Will Glass-Husain added a comment - Since you can choose the implementation via velocity.properties, wouldn't this fall under a prohibited 'not-backwards-compatible' change?
        Hide
        Henning Schmiedehausen added a comment -

        Should be easily doable even for 1.5. Moving it forward, will look into it unless Will beats me to it.

        Show
        Henning Schmiedehausen added a comment - Should be easily doable even for 1.5. Moving it forward, will look into it unless Will beats me to it.
        Hide
        Will Glass-Husain added a comment -

        Looking at this old issue. Seems reasonable. If you or anyone wants to submit a patch, I'll commit it.

        Show
        Will Glass-Husain added a comment - Looking at this old issue. Seems reasonable. If you or anyone wants to submit a patch, I'll commit it.

          People

          • Assignee:
            Unassigned
            Reporter:
            Charles Morehead
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development