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 702218 2008-10-06 18:15:18Z nbubna $ 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 * Properties referenced in the template are required to exist the object 58 */ 59 String RUNTIME_REFERENCES_STRICT = "runtime.references.strict"; 60 61 /** 62 * @deprecated This appears to have always been meaningless. 63 */ 64 String RUNTIME_LOG_ERROR_STACKTRACE = "runtime.log.error.stacktrace"; 65 66 /** 67 * @deprecated The functionality this controlled is confusing and no longer necessary. 68 */ 69 String RUNTIME_LOG_WARN_STACKTRACE = "runtime.log.warn.stacktrace"; 70 71 /** 72 * @deprecated This appears to have always been meaningless. 73 */ 74 String RUNTIME_LOG_INFO_STACKTRACE = "runtime.log.info.stacktrace"; 75 76 /** Logging of invalid references. */ 77 String RUNTIME_LOG_REFERENCE_LOG_INVALID = "runtime.log.invalid.references"; 78 79 /** 80 * @deprecated Use LogChute.TRACE_PREFIX instead 81 */ 82 String TRACE_PREFIX = " [trace] "; 83 84 /** 85 * @deprecated Use LogChute.DEBUG_PREFIX instead 86 */ 87 String DEBUG_PREFIX = " [debug] "; 88 89 /** 90 * @deprecated Use LogChute.INFO_PREFIX instead 91 */ 92 String INFO_PREFIX = " [info] "; 93 94 /** 95 * @deprecated Use LogChute.WARN_PREFIX instead 96 */ 97 String WARN_PREFIX = " [warn] "; 98 99 /** 100 * @deprecated Use LogChute.ERROR_PREFIX instead 101 */ 102 String ERROR_PREFIX = " [error] "; 103 104 /** 105 * @deprecated This will be removed in a future version 106 */ 107 String UNKNOWN_PREFIX = " [unknown] "; 108 109 /* 110 * ---------------------------------------------------------------------- 111 * D I R E C T I V E C O N F I G U R A T I O N 112 * ---------------------------------------------------------------------- 113 * Directive properties are of the form: 114 * 115 * directive.<directive-name>.<property> 116 * ---------------------------------------------------------------------- 117 */ 118 119 /** Counter reference name in #foreach directives. */ 120 String COUNTER_NAME = "directive.foreach.counter.name"; 121 122 /** 123 * Iterator.hasNext() reference name in #foreach directives. 124 * @since 1.6 125 */ 126 String HAS_NEXT_NAME = "directive.foreach.iterator.name"; 127 128 /** Initial counter value in #foreach directives. */ 129 String COUNTER_INITIAL_VALUE = "directive.foreach.counter.initial.value"; 130 131 /** Maximum allowed number of loops. */ 132 String MAX_NUMBER_LOOPS = "directive.foreach.maxloops"; 133 134 /** 135 * Whether to throw an exception or just skip bad iterables. Default is true. 136 * @since 1.6 137 */ 138 String SKIP_INVALID_ITERATOR = "directive.foreach.skip.invalid"; 139 140 /** if set to true then allows #set to accept null values in the right hand side. */ 141 String SET_NULL_ALLOWED = "directive.set.null.allowed"; 142 143 /** 144 * Starting tag for error messages triggered by passing a parameter not allowed in the #include directive. Only string literals, 145 * and references are allowed. 146 */ 147 String ERRORMSG_START = "directive.include.output.errormsg.start"; 148 149 /** 150 * Ending tag for error messages triggered by passing a parameter not allowed in the #include directive. Only string literals, 151 * and references are allowed. 152 */ 153 String ERRORMSG_END = "directive.include.output.errormsg.end"; 154 155 /** Maximum recursion depth allowed for the #parse directive. */ 156 String PARSE_DIRECTIVE_MAXDEPTH = "directive.parse.max.depth"; 157 158 /** Maximum recursion depth allowed for the #define directive. */ 159 String DEFINE_DIRECTIVE_MAXDEPTH = "directive.define.max.depth"; 160 161 /** 162 * class to use for local context with #evaluate() 163 * @since 1.6 164 */ 165 String EVALUATE_CONTEXT_CLASS = "directive.evaluate.context.class"; 166 167 168 /* 169 * ---------------------------------------------------------------------- 170 * 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 171 * ---------------------------------------------------------------------- 172 */ 173 174 /** */ 175 String RESOURCE_MANAGER_CLASS = "resource.manager.class"; 176 177 /** 178 * The <code>resource.manager.cache.class</code> property specifies the name of the 179 * {@link org.apache.velocity.runtime.resource.ResourceCache} implementation to use. 180 */ 181 String RESOURCE_MANAGER_CACHE_CLASS = "resource.manager.cache.class"; 182 183 /** The <code>resource.manager.cache.size</code> property specifies the cache upper bound (if relevant). */ 184 String RESOURCE_MANAGER_DEFAULTCACHE_SIZE = "resource.manager.defaultcache.size"; 185 186 /* 187 * ---------------------------------------------------------------------- 188 * 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 189 * ---------------------------------------------------------------------- 190 */ 191 192 /** controls if the finding of a resource is logged. */ 193 String RESOURCE_MANAGER_LOGWHENFOUND = "resource.manager.logwhenfound"; 194 195 /** 196 * Key used to retrieve the names of the resource loaders to be used. In a properties file they may appear as the following: 197 * 198 * <p>resource.loader = file,classpath</p> 199 */ 200 String RESOURCE_LOADER = "resource.loader"; 201 202 /** The public handle for setting a path in the FileResourceLoader. */ 203 String FILE_RESOURCE_LOADER_PATH = "file.resource.loader.path"; 204 205 /** The public handle for turning the caching on in the FileResourceLoader. */ 206 String FILE_RESOURCE_LOADER_CACHE = "file.resource.loader.cache"; 207 208 /* 209 * ---------------------------------------------------------------------- 210 * 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 211 * ---------------------------------------------------------------------- 212 */ 213 214 /** 215 * The <code>eventhandler.referenceinsertion.class</code> property specifies a list of the 216 * {@link org.apache.velocity.app.event.ReferenceInsertionEventHandler} implementations to use. 217 */ 218 String EVENTHANDLER_REFERENCEINSERTION = "eventhandler.referenceinsertion.class"; 219 220 /** 221 * The <code>eventhandler.nullset.class</code> property specifies a list of the 222 * {@link org.apache.velocity.app.event.NullSetEventHandler} implementations to use. 223 */ 224 String EVENTHANDLER_NULLSET = "eventhandler.nullset.class"; 225 226 /** 227 * The <code>eventhandler.methodexception.class</code> property specifies a list of the 228 * {@link org.apache.velocity.app.event.MethodExceptionEventHandler} implementations to use. 229 */ 230 String EVENTHANDLER_METHODEXCEPTION = "eventhandler.methodexception.class"; 231 232 /** 233 * The <code>eventhandler.include.class</code> property specifies a list of the 234 * {@link org.apache.velocity.app.event.IncludeEventHandler} implementations to use. 235 */ 236 String EVENTHANDLER_INCLUDE = "eventhandler.include.class"; 237 238 /** 239 * The <code>eventhandler.invalidreferences.class</code> property specifies a list of the 240 * {@link org.apache.velocity.app.event.InvalidReferenceEventHandler} implementations to use. 241 */ 242 String EVENTHANDLER_INVALIDREFERENCES = "eventhandler.invalidreferences.class"; 243 244 245 /* 246 * ---------------------------------------------------------------------- 247 * V E L O C I M A C R O C O N F I G U R A T I O N 248 * ---------------------------------------------------------------------- 249 */ 250 251 /** Name of local Velocimacro library template. */ 252 String VM_LIBRARY = "velocimacro.library"; 253 254 /** Default Velocimacro library template. */ 255 String VM_LIBRARY_DEFAULT = "VM_global_library.vm"; 256 257 /** switch for autoloading library-sourced VMs (for development). */ 258 String VM_LIBRARY_AUTORELOAD = "velocimacro.library.autoreload"; 259 260 /** boolean (true/false) default true : allow inline (in-template) macro definitions. */ 261 String VM_PERM_ALLOW_INLINE = "velocimacro.permissions.allow.inline"; 262 263 /** boolean (true/false) default false : allow inline (in-template) macro definitions to replace existing. */ 264 String VM_PERM_ALLOW_INLINE_REPLACE_GLOBAL = "velocimacro.permissions.allow.inline.to.replace.global"; 265 266 /** Switch for forcing inline macros to be local : default false. */ 267 String VM_PERM_INLINE_LOCAL = "velocimacro.permissions.allow.inline.local.scope"; 268 269 /** Switch for VM blather : default true. */ 270 String VM_MESSAGES_ON = "velocimacro.messages.on"; 271 272 /** switch for local context in VM : default false. */ 273 String VM_CONTEXT_LOCALSCOPE = "velocimacro.context.localscope"; 274 275 /** if true, throw an exception for wrong number of arguments **/ 276 String VM_ARGUMENTS_STRICT = "velocimacro.arguments.strict"; 277 278 /** 279 * Specify the maximum depth for macro calls 280 * @since 1.6 281 */ 282 String VM_MAX_DEPTH = "velocimacro.max.depth"; 283 284 /* 285 * ---------------------------------------------------------------------- 286 * 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 287 * ---------------------------------------------------------------------- 288 */ 289 290 /** Switch for the interpolation facility for string literals. */ 291 String INTERPOLATE_STRINGLITERALS = "runtime.interpolate.string.literals"; 292 293 /** The character encoding for the templates. Used by the parser in processing the input streams. */ 294 String INPUT_ENCODING = "input.encoding"; 295 296 /** Encoding for the output stream. Currently used by Anakia and VelocityServlet */ 297 String OUTPUT_ENCODING = "output.encoding"; 298 299 /** Default Encoding is ISO-8859-1. */ 300 String ENCODING_DEFAULT = "ISO-8859-1"; 301 302 /** key name for uberspector. Multiple classnames can be specified,in which case uberspectors will be chained. */ 303 String UBERSPECT_CLASSNAME = "runtime.introspector.uberspect"; 304 305 /** A comma separated list of packages to restrict access to in the SecureIntrospector. */ 306 String INTROSPECTOR_RESTRICT_PACKAGES = "introspector.restrict.packages"; 307 308 /** A comma separated list of classes to restrict access to in the SecureIntrospector. */ 309 String INTROSPECTOR_RESTRICT_CLASSES = "introspector.restrict.classes"; 310 311 /** Switch for ignoring nulls in math equations vs throwing exceptions. */ 312 String STRICT_MATH = "runtime.strict.math"; 313 314 /** 315 * The <code>parser.pool.class</code> property specifies the name of the {@link org.apache.velocity.util.SimplePool} 316 * implementation to use. 317 */ 318 String PARSER_POOL_CLASS = "parser.pool.class"; 319 320 /** 321 * @see #NUMBER_OF_PARSERS 322 */ 323 String PARSER_POOL_SIZE = "parser.pool.size"; 324 325 /* 326 * ---------------------------------------------------------------------- 327 * These constants are used internally by the Velocity runtime i.e. 328 * the constants listed below are strictly used in the Runtime 329 * class itself. 330 * ---------------------------------------------------------------------- 331 */ 332 333 /** Default Runtime properties. */ 334 String DEFAULT_RUNTIME_PROPERTIES = "org/apache/velocity/runtime/defaults/velocity.properties"; 335 336 /** Default Runtime properties. */ 337 String DEFAULT_RUNTIME_DIRECTIVES = "org/apache/velocity/runtime/defaults/directive.properties"; 338 339 /** 340 * The default number of parser instances to create. Configurable via the parameter named by the {@link #PARSER_POOL_SIZE} 341 * constant. 342 */ 343 int NUMBER_OF_PARSERS = 20; 344 345 346 347 348 349 }