View Javadoc

1   package org.apache.velocity.runtime;
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   * This class defines the keys that are used in the velocity.properties file so that they can be referenced as a constant within
24   * Java code.
25   *
26   * @author  <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
27   * @author  <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
28   * @author  <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
29   * @version  $Id: RuntimeConstants.java 522414 2007-03-26 04:42:35Z wglass $
30   */
31  public interface RuntimeConstants
32  {
33      /*
34       * ----------------------------------------------------------------------
35       * These are public constants that are used as handles for the
36       * properties that can be specified in your typical
37       * velocity.properties file.
38       * ----------------------------------------------------------------------
39       */
40  
41      /*
42       * ----------------------------------------------------------------------
43       * L O G G I N G  C O N F I G U R A T I O N
44       * ----------------------------------------------------------------------
45       */
46  
47      /** Location of the velocity log file. */
48      String RUNTIME_LOG = "runtime.log";
49  
50      /** externally provided logger. */
51      String RUNTIME_LOG_LOGSYSTEM = "runtime.log.logsystem";
52  
53      /** class of log system to use. */
54      String RUNTIME_LOG_LOGSYSTEM_CLASS = "runtime.log.logsystem.class";
55  
56      /**
57       * @deprecated  This appears to have always been meaningless.
58       */
59      String RUNTIME_LOG_ERROR_STACKTRACE = "runtime.log.error.stacktrace";
60  
61      /**
62       * @deprecated  The functionality this controlled is confusing and no longer necessary.
63       */
64      String RUNTIME_LOG_WARN_STACKTRACE = "runtime.log.warn.stacktrace";
65  
66      /**
67       * @deprecated  This appears to have always been meaningless.
68       */
69      String RUNTIME_LOG_INFO_STACKTRACE = "runtime.log.info.stacktrace";
70  
71      /** Logging of invalid references. */
72      String RUNTIME_LOG_REFERENCE_LOG_INVALID = "runtime.log.invalid.references";
73  
74      /**
75       * @deprecated  Use LogChute.TRACE_PREFIX instead
76       */
77      String TRACE_PREFIX = " [trace] ";
78  
79      /**
80       * @deprecated  Use LogChute.DEBUG_PREFIX instead
81       */
82      String DEBUG_PREFIX = " [debug] ";
83  
84      /**
85       * @deprecated  Use LogChute.INFO_PREFIX instead
86       */
87      String INFO_PREFIX = "  [info] ";
88  
89      /**
90       * @deprecated  Use LogChute.WARN_PREFIX instead
91       */
92      String WARN_PREFIX = "  [warn] ";
93  
94      /**
95       * @deprecated  Use LogChute.ERROR_PREFIX instead
96       */
97      String ERROR_PREFIX = " [error] ";
98  
99      /**
100      * @deprecated  This will be removed in a future version
101      */
102     String UNKNOWN_PREFIX = " [unknown] ";
103 
104     /*
105      * ----------------------------------------------------------------------
106      * D I R E C T I V E  C O N F I G U R A T I O N
107      * ----------------------------------------------------------------------
108      * Directive properties are of the form:
109      *
110      * directive.<directive-name>.<property>
111      * ----------------------------------------------------------------------
112      */
113 
114     /** Counter reference name in #foreach directives. */
115     String COUNTER_NAME = "directive.foreach.counter.name";
116 
117     /** Initial counter value in #foreach directives. */
118     String COUNTER_INITIAL_VALUE = "directive.foreach.counter.initial.value";
119 
120     /** Maximum allowed number of loops. */
121     String MAX_NUMBER_LOOPS = "directive.foreach.maxloops";
122 
123     /** if set to true then allows #set to accept null values in the right hand side. */
124     String SET_NULL_ALLOWED = "directive.set.null.allowed";
125 
126     /**
127      * Starting tag for error messages triggered by passing a parameter not allowed in the #include directive. Only string literals,
128      * and references are allowed.
129      */
130     String ERRORMSG_START = "directive.include.output.errormsg.start";
131 
132     /**
133      * Ending tag for error messages triggered by passing a parameter not allowed in the #include directive. Only string literals,
134      * and references are allowed.
135      */
136     String ERRORMSG_END = "directive.include.output.errormsg.end";
137 
138     /** Maximum recursion depth allowed for the #parse directive. */
139     String PARSE_DIRECTIVE_MAXDEPTH = "directive.parse.max.depth";
140 
141     /** class to use for local context with #evaluate() **/
142     String EVALUATE_CONTEXT_CLASS = "directive.evaluate.context.class";
143 
144 
145     /*
146      * ----------------------------------------------------------------------
147      *  R E S O U R C E   M A N A G E R   C O N F I G U R A T I O N
148      * ----------------------------------------------------------------------
149      */
150 
151     /**  */
152     String RESOURCE_MANAGER_CLASS = "resource.manager.class";
153 
154     /**
155      * The <code>resource.manager.cache.class</code> property specifies the name of the
156      * {@link org.apache.velocity.runtime.resource.ResourceCache} implementation to use.
157      */
158     String RESOURCE_MANAGER_CACHE_CLASS = "resource.manager.cache.class";
159 
160     /** The <code>resource.manager.cache.size</code> property specifies the cache upper bound (if relevant). */
161     String RESOURCE_MANAGER_DEFAULTCACHE_SIZE = "resource.manager.defaultcache.size";
162 
163     /*
164      * ----------------------------------------------------------------------
165      * R E S O U R C E  L O A D E R  C O N F I G U R A T I O N
166      * ----------------------------------------------------------------------
167      */
168 
169     /** controls if the finding of a resource is logged. */
170     String RESOURCE_MANAGER_LOGWHENFOUND = "resource.manager.logwhenfound";
171 
172     /**
173      * Key used to retrieve the names of the resource loaders to be used. In a properties file they may appear as the following:
174      *
175      * <p>resource.loader = file,classpath</p>
176      */
177     String RESOURCE_LOADER = "resource.loader";
178 
179     /** The public handle for setting a path in the FileResourceLoader. */
180     String FILE_RESOURCE_LOADER_PATH = "file.resource.loader.path";
181 
182     /** The public handle for turning the caching on in the FileResourceLoader. */
183     String FILE_RESOURCE_LOADER_CACHE = "file.resource.loader.cache";
184 
185     /*
186      * ----------------------------------------------------------------------
187      *  E V E N T  H A N D L E R  C O N F I G U R A T I O N
188      * ----------------------------------------------------------------------
189      */
190 
191     /**
192      * The <code>eventhandler.referenceinsertion.class</code> property specifies a list of the
193      * {@link org.apache.velocity.app.event.ReferenceInsertionEventHandler} implementations to use.
194      */
195     String EVENTHANDLER_REFERENCEINSERTION = "eventhandler.referenceinsertion.class";
196 
197     /**
198      * The <code>eventhandler.nullset.class</code> property specifies a list of the
199      * {@link org.apache.velocity.app.event.NullSetEventHandler} implementations to use.
200      */
201     String EVENTHANDLER_NULLSET = "eventhandler.nullset.class";
202 
203     /**
204      * The <code>eventhandler.methodexception.class</code> property specifies a list of the
205      * {@link org.apache.velocity.app.event.MethodExceptionEventHandler} implementations to use.
206      */
207     String EVENTHANDLER_METHODEXCEPTION = "eventhandler.methodexception.class";
208 
209     /**
210      * The <code>eventhandler.include.class</code> property specifies a list of the
211      * {@link org.apache.velocity.app.event.IncludeEventHandler} implementations to use.
212      */
213     String EVENTHANDLER_INCLUDE = "eventhandler.include.class";
214 
215     /**
216      * The <code>eventhandler.invalidreferences.class</code> property specifies a list of the
217      * {@link org.apache.velocity.app.event.InvalidReferenceEventHandler} implementations to use.
218      */
219     String EVENTHANDLER_INVALIDREFERENCES = "eventhandler.invalidreferences.class";
220 
221 
222     /*
223      * ----------------------------------------------------------------------
224      * V E L O C I M A C R O  C O N F I G U R A T I O N
225      * ----------------------------------------------------------------------
226      */
227 
228     /** Name of local Velocimacro library template. */
229     String VM_LIBRARY = "velocimacro.library";
230 
231     /** Default Velocimacro library template. */
232     String VM_LIBRARY_DEFAULT = "VM_global_library.vm";
233 
234     /** switch for autoloading library-sourced VMs (for development). */
235     String VM_LIBRARY_AUTORELOAD = "velocimacro.library.autoreload";
236 
237     /** boolean (true/false) default true : allow inline (in-template) macro definitions. */
238     String VM_PERM_ALLOW_INLINE = "velocimacro.permissions.allow.inline";
239 
240     /** boolean (true/false) default false : allow inline (in-template) macro definitions to replace existing. */
241     String VM_PERM_ALLOW_INLINE_REPLACE_GLOBAL = "velocimacro.permissions.allow.inline.to.replace.global";
242 
243     /** Switch for forcing inline macros to be local : default false. */
244     String VM_PERM_INLINE_LOCAL = "velocimacro.permissions.allow.inline.local.scope";
245 
246     /** Switch for VM blather : default true. */
247     String VM_MESSAGES_ON = "velocimacro.messages.on";
248 
249     /** switch for local context in VM : default false. */
250     String VM_CONTEXT_LOCALSCOPE = "velocimacro.context.localscope";
251 
252     /** if true, throw an exception for wrong number of arguments **/
253     String VM_ARGUMENTS_STRICT = "velocimacro.arguments.strict";
254     
255     /*
256      * ----------------------------------------------------------------------
257      * G E N E R A L  R U N T I M E  C O N F I G U R A T I O N
258      * ----------------------------------------------------------------------
259      */
260 
261     /** Switch for the interpolation facility for string literals. */
262     String INTERPOLATE_STRINGLITERALS = "runtime.interpolate.string.literals";
263 
264     /** The character encoding for the templates. Used by the parser in processing the input streams. */
265     String INPUT_ENCODING = "input.encoding";
266 
267     /** Encoding for the output stream. Currently used by Anakia and VelocityServlet */
268     String OUTPUT_ENCODING = "output.encoding";
269 
270     /** Default Encoding is ISO-8859-1. */
271     String ENCODING_DEFAULT = "ISO-8859-1";
272 
273     /** key name for uberspector. */
274     String UBERSPECT_CLASSNAME = "runtime.introspector.uberspect";
275 
276     /** A comma separated list of packages to restrict access to in the SecureIntrospector. */
277     String INTROSPECTOR_RESTRICT_PACKAGES = "introspector.restrict.packages";
278 
279     /** A comma separated list of classes to restrict access to in the SecureIntrospector. */
280     String INTROSPECTOR_RESTRICT_CLASSES = "introspector.restrict.classes";
281 
282     /**
283      * The <code>parser.pool.class</code> property specifies the name of the {@link org.apache.velocity.util.SimplePool}
284      * implementation to use.
285      */
286     String PARSER_POOL_CLASS = "parser.pool.class";
287 
288     /**
289      * @see  #NUMBER_OF_PARSERS
290      */
291     String PARSER_POOL_SIZE = "parser.pool.size";
292     
293     /*
294      * ----------------------------------------------------------------------
295      * These constants are used internally by the Velocity runtime i.e.
296      * the constants listed below are strictly used in the Runtime
297      * class itself.
298      * ----------------------------------------------------------------------
299      */
300 
301     /** Default Runtime properties. */
302     String DEFAULT_RUNTIME_PROPERTIES = "org/apache/velocity/runtime/defaults/velocity.properties";
303 
304     /** Default Runtime properties. */
305     String DEFAULT_RUNTIME_DIRECTIVES = "org/apache/velocity/runtime/defaults/directive.properties";
306 
307     /**
308      * The default number of parser instances to create. Configurable via the parameter named by the {@link #PARSER_POOL_SIZE}
309      * constant.
310      */
311     int NUMBER_OF_PARSERS = 20;
312 
313     
314 
315 
316 
317 }