• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.apache.velocity.runtime.resource.util;
2 
3 /*
4  * Licensed to the Apache Software Foundation (ASF) under one
5  * or more contributor license agreements.  See the NOTICE file
6  * distributed with this work for additional information
7  * regarding copyright ownership.  The ASF licenses this file
8  * to you under the Apache License, Version 2.0 (the
9  * "License"); you may not use this file except in compliance
10  * with the License.  You may obtain a copy of the License at
11  *
12  *   http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing,
15  * software distributed under the License is distributed on an
16  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17  * KIND, either express or implied.  See the License for the
18  * specific language governing permissions and limitations
19  * under the License.
20  */
21 
22 /**
23  * A StringResourceRepository functions as a central repository for Velocity templates
24  * stored in Strings.
25  *
26  * @author <a href="mailto:eelco.hillenius@openedge.nl">Eelco Hillenius</a>
27  * @author <a href="mailto:henning@apache.org">Henning P. Schmiedehausen</a>
28  * @version $Id$
29  * @since 1.5
30  */
31 public interface StringResourceRepository
32 {
33     /**
34      * get the string resource that is stored with given key
35      * @param name String name to retrieve from the repository.
36      * @return A StringResource containing the template.
37      */
getStringResource(String name)38     StringResource getStringResource(String name);
39 
40     /**
41      * add a string resource with given key.
42      * @param name The String name to store the template under.
43      * @param body A String containing a template.
44      */
putStringResource(String name, String body)45     void putStringResource(String name, String body);
46 
47     /**
48      * add a string resource with given key.
49      * @param name The String name to store the template under.
50      * @param body A String containing a template.
51      * @param encoding The encoding of this string template
52      * @since 1.6
53      */
putStringResource(String name, String body, String encoding)54     void putStringResource(String name, String body, String encoding);
55 
56     /**
57      * delete a string resource with given key.
58      * @param name The string name to remove from the repository.
59      */
removeStringResource(String name)60     void removeStringResource(String name);
61 
62     /**
63      * Sets the default encoding of the repository. Encodings can also be stored per
64      * template string. The default implementation does this correctly.
65      *
66      * @param encoding The encoding to use.
67      */
setEncoding(String encoding)68     void setEncoding(String encoding);
69 
70     /**
71      * Returns the current encoding of this repository.
72      *
73      * @return The current encoding of this repository.
74      */
getEncoding()75     String getEncoding();
76 }
77