Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.3.1
    • Fix Version/s: 1.5 beta2, 1.5
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      Operating System: other
      Platform: Other

      Description

      Resource loader that works with Strings. Users should manualy add
      resources to the repository that is know by the factory of this package.

      Below is an example configuration for this loader.
      Note that 'repositoryimpl' is not mandatory;
      if not provided, the factory will fall back on using the default
      implementation of this package.

      stringres.resource.loader.description = Velocity StringResource loader
      stringres.resource.loader.class =
      org.apache.velocity.tools.stringresources.StringResourceLoader
      stringres.resource.loader.repositoryimpl =
      org.apache.velocity.tools.stringresources.StringResourceRepositoryImpl

      Resources can be added to the repository like this:

      StringResourceRepositoryFactory vsRepository = null;
      vsRepository = StringResourceRepositoryFactory.getRepository();
      String myTemplateName = "/somewhere/intherepo/name";
      String myTemplateBody = "Hi, $

      {username}

      ... this is a some template!";
      vsRepository.putStringResource(myTemplateName, myTemplateBody);

      After this, the templates can be retrieved as usual

        Activity

        Hide
        Henning Schmiedehausen added a comment -

        Close all resolved issued for 1.5 beta 2.

        Show
        Henning Schmiedehausen added a comment - Close all resolved issued for 1.5 beta 2.
        Hide
        Henning Schmiedehausen added a comment -

        added to 1.5-beta2. Thanks!

        Show
        Henning Schmiedehausen added a comment - added to 1.5-beta2. Thanks!
        Hide
        Will Glass-Husain added a comment -

        I've changed my mind about this. It should go into the core. Eventually we need to re-do most of the unit tests to remove file system dependencies and this would be really quite useful.

        Show
        Will Glass-Husain added a comment - I've changed my mind about this. It should go into the core. Eventually we need to re-do most of the unit tests to remove file system dependencies and this would be really quite useful.
        Hide
        Henning Schmiedehausen added a comment -

        Either this will be a real late-comer to 1.5 (I can see a number of nice use cases from tests to dynamic webapps) or contrib or really early in 1.6. Schedule it for 1.5 revisiting.

        Show
        Henning Schmiedehausen added a comment - Either this will be a real late-comer to 1.5 (I can see a number of nice use cases from tests to dynamic webapps) or contrib or really early in 1.6. Schedule it for 1.5 revisiting.
        Hide
        Will Glass-Husain added a comment -

        Hi Eelco,

        Going through some old issues here. Kind of a neat implementation. Thanks for contributing.

        But I'm not sure I see the use case. Why is this helpful to the Velocity user? I think this needs to be generally useful in order to go into Velocity core.

        One possibility is to stick this code into the Velocity Wiki
        http://wiki.apache.org/jakarta-velocity/ContributedCode

        Show
        Will Glass-Husain added a comment - Hi Eelco, Going through some old issues here. Kind of a neat implementation. Thanks for contributing. But I'm not sure I see the use case. Why is this helpful to the Velocity user? I think this needs to be generally useful in order to go into Velocity core. One possibility is to stick this code into the Velocity Wiki http://wiki.apache.org/jakarta-velocity/ContributedCode
        Hide
        Eelco Hillenius added a comment -

        Created an attachment (id=6756)
        StringResourceRepositoryImpl.java

        Show
        Eelco Hillenius added a comment - Created an attachment (id=6756) StringResourceRepositoryImpl.java
        Hide
        Eelco Hillenius added a comment -

        Created an attachment (id=6755)
        StringResourceRepositoryFactory.java

        Show
        Eelco Hillenius added a comment - Created an attachment (id=6755) StringResourceRepositoryFactory.java
        Hide
        Eelco Hillenius added a comment -

        Created an attachment (id=6754)
        StringResourceRepository.java

        Show
        Eelco Hillenius added a comment - Created an attachment (id=6754) StringResourceRepository.java
        Hide
        Eelco Hillenius added a comment -

        Created an attachment (id=6753)
        StringResourceLoader.java

        Show
        Eelco Hillenius added a comment - Created an attachment (id=6753) StringResourceLoader.java
        Hide
        Eelco Hillenius added a comment -

        Created an attachment (id=6752)
        StringResourceException.java

        Show
        Eelco Hillenius added a comment - Created an attachment (id=6752) StringResourceException.java
        Hide
        Eelco Hillenius added a comment -

        Created an attachment (id=6751)
        StringResource.java

        Show
        Eelco Hillenius added a comment - Created an attachment (id=6751) StringResource.java

          People

          • Assignee:
            Unassigned
            Reporter:
            Eelco Hillenius
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development