link start!

This commit is contained in:
cherubin
2026-03-17 13:31:18 -07:00
commit 08abe87cfb
5910 changed files with 386288 additions and 0 deletions
@@ -0,0 +1,4 @@
package org.apache.velocity.app.event;
public interface EventHandler {
}
@@ -0,0 +1,9 @@
package org.apache.velocity.app.event;
public interface EventHandlerMethodExecutor {
void execute(EventHandler eventHandler) throws Exception;
Object getReturnValue();
boolean isDone();
}
@@ -0,0 +1,13 @@
package org.apache.velocity.context;
public interface Context {
boolean containsKey(Object obj);
Object get(String str);
Object[] getKeys();
Object put(String str, Object obj);
Object remove(Object obj);
}
@@ -0,0 +1,4 @@
package org.apache.velocity.context;
public interface InternalContextAdapter extends InternalHousekeepingContext, Context, InternalWrapperContext, InternalEventContext {
}
@@ -0,0 +1,9 @@
package org.apache.velocity.context;
import org.apache.velocity.app.event.EventCartridge;
public interface InternalEventContext {
EventCartridge attachEventCartridge(EventCartridge eventCartridge);
EventCartridge getEventCartridge();
}
@@ -0,0 +1,37 @@
package org.apache.velocity.context;
import java.util.List;
import org.apache.velocity.runtime.resource.Resource;
import org.apache.velocity.util.introspection.IntrospectionCacheData;
interface InternalHousekeepingContext {
int getCurrentMacroCallDepth();
String getCurrentMacroName();
Resource getCurrentResource();
String getCurrentTemplateName();
List getMacroLibraries();
Object[] getMacroNameStack();
Object[] getTemplateNameStack();
IntrospectionCacheData icacheGet(Object obj);
void icachePut(Object obj, IntrospectionCacheData introspectionCacheData);
void popCurrentMacroName();
void popCurrentTemplateName();
void pushCurrentMacroName(String str);
void pushCurrentTemplateName(String str);
void setCurrentResource(Resource resource);
void setMacroLibraries(List list);
}
@@ -0,0 +1,9 @@
package org.apache.velocity.context;
public interface InternalWrapperContext {
InternalContextAdapter getBaseContext();
Context getInternalUserContext();
Object localPut(String str, Object obj);
}
@@ -0,0 +1,9 @@
package org.apache.velocity.exception;
public interface ExtendedParseException {
int getColumnNumber();
int getLineNumber();
String getTemplateName();
}
@@ -0,0 +1,11 @@
package org.apache.velocity.runtime;
import org.apache.velocity.runtime.parser.Parser;
public interface ParserPool {
Parser get();
void initialize(RuntimeServices runtimeServices);
void put(Parser parser);
}
@@ -0,0 +1,12 @@
package org.apache.velocity.runtime;
import java.io.IOException;
import java.io.Writer;
import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;
public interface Renderable {
boolean render(InternalContextAdapter internalContextAdapter, Writer writer) throws IOException, MethodInvocationException, ParseErrorException, ResourceNotFoundException;
}
@@ -0,0 +1,68 @@
package org.apache.velocity.runtime;
public interface RuntimeConstants {
public static final String COUNTER_INITIAL_VALUE = "directive.foreach.counter.initial.value";
public static final String COUNTER_NAME = "directive.foreach.counter.name";
public static final String DEBUG_PREFIX = " [debug] ";
public static final String DEFAULT_RUNTIME_DIRECTIVES = "org/apache/velocity/runtime/defaults/directive.properties";
public static final String DEFAULT_RUNTIME_PROPERTIES = "org/apache/velocity/runtime/defaults/velocity.properties";
public static final String DEFINE_DIRECTIVE_MAXDEPTH = "directive.define.max.depth";
public static final String DIRECTIVE_IF_TOSTRING_NULLCHECK = "directive.if.tostring.nullcheck";
public static final String ENCODING_DEFAULT = "ISO-8859-1";
public static final String ERRORMSG_END = "directive.include.output.errormsg.end";
public static final String ERRORMSG_START = "directive.include.output.errormsg.start";
public static final String ERROR_PREFIX = " [error] ";
public static final String EVALUATE_CONTEXT_CLASS = "directive.evaluate.context.class";
public static final String EVENTHANDLER_INCLUDE = "eventhandler.include.class";
public static final String EVENTHANDLER_INVALIDREFERENCES = "eventhandler.invalidreferences.class";
public static final String EVENTHANDLER_METHODEXCEPTION = "eventhandler.methodexception.class";
public static final String EVENTHANDLER_NULLSET = "eventhandler.nullset.class";
public static final String EVENTHANDLER_REFERENCEINSERTION = "eventhandler.referenceinsertion.class";
public static final String FILE_RESOURCE_LOADER_CACHE = "file.resource.loader.cache";
public static final String FILE_RESOURCE_LOADER_PATH = "file.resource.loader.path";
public static final String HAS_NEXT_NAME = "directive.foreach.iterator.name";
public static final String INFO_PREFIX = " [info] ";
public static final String INPUT_ENCODING = "input.encoding";
public static final String INTERPOLATE_STRINGLITERALS = "runtime.interpolate.string.literals";
public static final String INTROSPECTOR_RESTRICT_CLASSES = "introspector.restrict.classes";
public static final String INTROSPECTOR_RESTRICT_PACKAGES = "introspector.restrict.packages";
public static final String MAX_NUMBER_LOOPS = "directive.foreach.maxloops";
public static final int NUMBER_OF_PARSERS = 20;
public static final String OUTPUT_ENCODING = "output.encoding";
public static final String PARSER_POOL_CLASS = "parser.pool.class";
public static final String PARSER_POOL_SIZE = "parser.pool.size";
public static final String PARSE_DIRECTIVE_MAXDEPTH = "directive.parse.max.depth";
public static final String PROVIDE_SCOPE_CONTROL = "provide.scope.control";
public static final String RESOURCE_LOADER = "resource.loader";
public static final String RESOURCE_MANAGER_CACHE_CLASS = "resource.manager.cache.class";
public static final String RESOURCE_MANAGER_CLASS = "resource.manager.class";
public static final String RESOURCE_MANAGER_DEFAULTCACHE_SIZE = "resource.manager.defaultcache.size";
public static final String RESOURCE_MANAGER_LOGWHENFOUND = "resource.manager.logwhenfound";
public static final String RUNTIME_LOG = "runtime.log";
public static final String RUNTIME_LOG_ERROR_STACKTRACE = "runtime.log.error.stacktrace";
public static final String RUNTIME_LOG_INFO_STACKTRACE = "runtime.log.info.stacktrace";
public static final String RUNTIME_LOG_LOGSYSTEM = "runtime.log.logsystem";
public static final String RUNTIME_LOG_LOGSYSTEM_CLASS = "runtime.log.logsystem.class";
public static final String RUNTIME_LOG_REFERENCE_LOG_INVALID = "runtime.log.invalid.references";
public static final String RUNTIME_LOG_WARN_STACKTRACE = "runtime.log.warn.stacktrace";
public static final String RUNTIME_REFERENCES_STRICT = "runtime.references.strict";
public static final String RUNTIME_REFERENCES_STRICT_ESCAPE = "runtime.references.strict.escape";
public static final String SET_NULL_ALLOWED = "directive.set.null.allowed";
public static final String SKIP_INVALID_ITERATOR = "directive.foreach.skip.invalid";
public static final String STRICT_MATH = "runtime.strict.math";
public static final String TRACE_PREFIX = " [trace] ";
public static final String UBERSPECT_CLASSNAME = "runtime.introspector.uberspect";
public static final String UNKNOWN_PREFIX = " [unknown] ";
public static final String VM_ARGUMENTS_STRICT = "velocimacro.arguments.strict";
public static final String VM_BODY_REFERENCE = "velocimacro.body.reference";
public static final String VM_CONTEXT_LOCALSCOPE = "velocimacro.context.localscope";
public static final String VM_LIBRARY = "velocimacro.library";
public static final String VM_LIBRARY_AUTORELOAD = "velocimacro.library.autoreload";
public static final String VM_LIBRARY_DEFAULT = "VM_global_library.vm";
public static final String VM_MAX_DEPTH = "velocimacro.max.depth";
public static final String VM_MESSAGES_ON = "velocimacro.messages.on";
public static final String VM_PERM_ALLOW_INLINE = "velocimacro.permissions.allow.inline";
public static final String VM_PERM_ALLOW_INLINE_REPLACE_GLOBAL = "velocimacro.permissions.allow.inline.to.replace.global";
public static final String VM_PERM_INLINE_LOCAL = "velocimacro.permissions.allow.inline.local.scope";
public static final String WARN_PREFIX = " [warn] ";
}
@@ -0,0 +1,11 @@
package org.apache.velocity.runtime;
public interface RuntimeLogger {
void debug(Object obj);
void error(Object obj);
void info(Object obj);
void warn(Object obj);
}
@@ -0,0 +1,102 @@
package org.apache.velocity.runtime;
import java.io.Reader;
import java.io.Writer;
import java.util.Properties;
import org.apache.commons.collections.ExtendedProperties;
import org.apache.velocity.Template;
import org.apache.velocity.app.event.EventCartridge;
import org.apache.velocity.context.Context;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.runtime.directive.Directive;
import org.apache.velocity.runtime.log.Log;
import org.apache.velocity.runtime.parser.ParseException;
import org.apache.velocity.runtime.parser.Parser;
import org.apache.velocity.runtime.parser.node.Node;
import org.apache.velocity.runtime.parser.node.SimpleNode;
import org.apache.velocity.runtime.resource.ContentResource;
import org.apache.velocity.util.introspection.Introspector;
import org.apache.velocity.util.introspection.Uberspect;
public interface RuntimeServices extends RuntimeLogger {
void addProperty(String str, Object obj);
boolean addVelocimacro(String str, String str2, String[] strArr, String str3);
boolean addVelocimacro(String str, Node node, String[] strArr, String str2);
void clearProperty(String str);
Parser createNewParser();
boolean dumpVMNamespace(String str);
boolean evaluate(Context context, Writer writer, String str, Reader reader);
boolean evaluate(Context context, Writer writer, String str, String str2);
Object getApplicationAttribute(Object obj);
EventCartridge getApplicationEventCartridge();
boolean getBoolean(String str, boolean z);
ExtendedProperties getConfiguration();
ContentResource getContent(String str) throws ResourceNotFoundException, ParseErrorException;
ContentResource getContent(String str, String str2) throws ResourceNotFoundException, ParseErrorException;
Directive getDirective(String str);
int getInt(String str);
int getInt(String str, int i);
Introspector getIntrospector();
String getLoaderNameForResource(String str);
Log getLog();
Object getProperty(String str);
String getString(String str);
String getString(String str, String str2);
Template getTemplate(String str) throws ResourceNotFoundException, ParseErrorException;
Template getTemplate(String str, String str2) throws ResourceNotFoundException, ParseErrorException;
Uberspect getUberspect();
Directive getVelocimacro(String str, String str2);
Directive getVelocimacro(String str, String str2, String str3);
void init();
void init(String str);
void init(Properties properties);
boolean invokeVelocimacro(String str, String str2, String[] strArr, Context context, Writer writer);
boolean isInitialized();
boolean isVelocimacro(String str, String str2);
SimpleNode parse(Reader reader, String str) throws ParseException;
SimpleNode parse(Reader reader, String str, boolean z) throws ParseException;
SimpleNode parse(String str, String str2) throws ParseException;
Object setApplicationAttribute(Object obj, Object obj2);
void setConfiguration(ExtendedProperties extendedProperties);
void setProperty(String str, Object obj);
}
@@ -0,0 +1,6 @@
package org.apache.velocity.runtime.directive;
public interface DirectiveConstants {
public static final int BLOCK = 1;
public static final int LINE = 2;
}
@@ -0,0 +1,24 @@
package org.apache.velocity.runtime.log;
import org.apache.velocity.runtime.RuntimeServices;
public interface LogChute {
public static final int DEBUG_ID = 0;
public static final String DEBUG_PREFIX = " [debug] ";
public static final int ERROR_ID = 3;
public static final String ERROR_PREFIX = " [error] ";
public static final int INFO_ID = 1;
public static final String INFO_PREFIX = " [info] ";
public static final int TRACE_ID = -1;
public static final String TRACE_PREFIX = " [trace] ";
public static final int WARN_ID = 2;
public static final String WARN_PREFIX = " [warn] ";
void init(RuntimeServices runtimeServices) throws Exception;
boolean isLevelEnabled(int i);
void log(int i, String str);
void log(int i, String str, Throwable th);
}
@@ -0,0 +1,15 @@
package org.apache.velocity.runtime.log;
import org.apache.velocity.runtime.RuntimeServices;
public interface LogSystem {
public static final int DEBUG_ID = 0;
public static final boolean DEBUG_ON = true;
public static final int ERROR_ID = 3;
public static final int INFO_ID = 1;
public static final int WARN_ID = 2;
void init(RuntimeServices runtimeServices) throws Exception;
void logVelocityMessage(int i, String str);
}
@@ -0,0 +1,29 @@
package org.apache.velocity.runtime.parser;
import java.io.IOException;
public interface CharStream {
char BeginToken() throws IOException;
void Done();
String GetImage();
char[] GetSuffix(int i);
void backup(int i);
int getBeginColumn();
int getBeginLine();
int getColumn();
int getEndColumn();
int getEndLine();
int getLine();
char readChar() throws IOException;
}
@@ -0,0 +1,63 @@
package org.apache.velocity.runtime.parser.node;
import java.io.IOException;
import java.io.Writer;
import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.exception.TemplateInitException;
import org.apache.velocity.runtime.Renderable;
import org.apache.velocity.runtime.parser.Token;
public interface Node extends Renderable {
Object childrenAccept(ParserVisitor parserVisitor, Object obj);
boolean evaluate(InternalContextAdapter internalContextAdapter) throws MethodInvocationException;
Object execute(Object obj, InternalContextAdapter internalContextAdapter) throws MethodInvocationException;
int getColumn();
Token getFirstToken();
int getInfo();
Token getLastToken();
int getLine();
String getTemplateName();
int getType();
Object init(InternalContextAdapter internalContextAdapter, Object obj) throws TemplateInitException;
boolean isInvalid();
Object jjtAccept(ParserVisitor parserVisitor, Object obj);
void jjtAddChild(Node node, int i);
void jjtClose();
Node jjtGetChild(int i);
int jjtGetNumChildren();
Node jjtGetParent();
void jjtOpen();
void jjtSetParent(Node node);
String literal();
boolean render(InternalContextAdapter internalContextAdapter, Writer writer) throws IOException, MethodInvocationException, ParseErrorException, ResourceNotFoundException;
void setInfo(int i);
void setInvalid();
Object value(InternalContextAdapter internalContextAdapter) throws MethodInvocationException;
}
@@ -0,0 +1,83 @@
package org.apache.velocity.runtime.parser.node;
public interface ParserVisitor {
Object visit(ASTAddNode aSTAddNode, Object obj);
Object visit(ASTAndNode aSTAndNode, Object obj);
Object visit(ASTAssignment aSTAssignment, Object obj);
Object visit(ASTBlock aSTBlock, Object obj);
Object visit(ASTComment aSTComment, Object obj);
Object visit(ASTDirective aSTDirective, Object obj);
Object visit(ASTDivNode aSTDivNode, Object obj);
Object visit(ASTEQNode aSTEQNode, Object obj);
Object visit(ASTElseIfStatement aSTElseIfStatement, Object obj);
Object visit(ASTElseStatement aSTElseStatement, Object obj);
Object visit(ASTEscape aSTEscape, Object obj);
Object visit(ASTEscapedDirective aSTEscapedDirective, Object obj);
Object visit(ASTExpression aSTExpression, Object obj);
Object visit(ASTFalse aSTFalse, Object obj);
Object visit(ASTFloatingPointLiteral aSTFloatingPointLiteral, Object obj);
Object visit(ASTGENode aSTGENode, Object obj);
Object visit(ASTGTNode aSTGTNode, Object obj);
Object visit(ASTIdentifier aSTIdentifier, Object obj);
Object visit(ASTIfStatement aSTIfStatement, Object obj);
Object visit(ASTIntegerLiteral aSTIntegerLiteral, Object obj);
Object visit(ASTIntegerRange aSTIntegerRange, Object obj);
Object visit(ASTLENode aSTLENode, Object obj);
Object visit(ASTLTNode aSTLTNode, Object obj);
Object visit(ASTMap aSTMap, Object obj);
Object visit(ASTMethod aSTMethod, Object obj);
Object visit(ASTModNode aSTModNode, Object obj);
Object visit(ASTMulNode aSTMulNode, Object obj);
Object visit(ASTNENode aSTNENode, Object obj);
Object visit(ASTNotNode aSTNotNode, Object obj);
Object visit(ASTObjectArray aSTObjectArray, Object obj);
Object visit(ASTOrNode aSTOrNode, Object obj);
Object visit(ASTReference aSTReference, Object obj);
Object visit(ASTSetDirective aSTSetDirective, Object obj);
Object visit(ASTStringLiteral aSTStringLiteral, Object obj);
Object visit(ASTSubtractNode aSTSubtractNode, Object obj);
Object visit(ASTText aSTText, Object obj);
Object visit(ASTTrue aSTTrue, Object obj);
Object visit(ASTWord aSTWord, Object obj);
Object visit(ASTprocess aSTprocess, Object obj);
Object visit(SimpleNode simpleNode, Object obj);
}
@@ -0,0 +1,16 @@
package org.apache.velocity.runtime.resource;
import java.util.Iterator;
import org.apache.velocity.runtime.RuntimeServices;
public interface ResourceCache {
Iterator enumerateKeys();
Resource get(Object obj);
void initialize(RuntimeServices runtimeServices);
Resource put(Object obj, Resource resource);
Resource remove(Object obj);
}
@@ -0,0 +1,16 @@
package org.apache.velocity.runtime.resource;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.runtime.RuntimeServices;
public interface ResourceManager {
public static final int RESOURCE_CONTENT = 2;
public static final int RESOURCE_TEMPLATE = 1;
String getLoaderNameForResource(String str);
Resource getResource(String str, int i, String str2) throws ResourceNotFoundException, ParseErrorException;
void initialize(RuntimeServices runtimeServices);
}
@@ -0,0 +1,15 @@
package org.apache.velocity.runtime.resource.util;
public interface StringResourceRepository {
String getEncoding();
StringResource getStringResource(String str);
void putStringResource(String str, String str2);
void putStringResource(String str, String str2, String str3);
void removeStringResource(String str);
void setEncoding(String str);
}
@@ -0,0 +1,7 @@
package org.apache.velocity.util;
import org.apache.velocity.context.Context;
public interface ContextAware {
void setContext(Context context);
}
@@ -0,0 +1,7 @@
package org.apache.velocity.util;
import org.apache.velocity.runtime.RuntimeServices;
public interface RuntimeServicesAware {
void setRuntimeServices(RuntimeServices runtimeServices);
}
@@ -0,0 +1,5 @@
package org.apache.velocity.util;
public interface TemplateNumber {
Number getAsNumber();
}
@@ -0,0 +1,5 @@
package org.apache.velocity.util.introspection;
public interface ChainableUberspector extends Uberspect {
void wrap(Uberspect uberspect);
}
@@ -0,0 +1,9 @@
package org.apache.velocity.util.introspection;
public interface IntrospectorCache {
void clear();
ClassMap get(Class cls);
ClassMap put(Class cls);
}
@@ -0,0 +1,5 @@
package org.apache.velocity.util.introspection;
public interface SecureIntrospectorControl {
boolean checkObjectExecutePermission(Class cls, String str);
}
@@ -0,0 +1,15 @@
package org.apache.velocity.util.introspection;
import java.util.Iterator;
public interface Uberspect {
Iterator getIterator(Object obj, Info info) throws Exception;
VelMethod getMethod(Object obj, String str, Object[] objArr, Info info) throws Exception;
VelPropertyGet getPropertyGet(Object obj, String str, Info info) throws Exception;
VelPropertySet getPropertySet(Object obj, String str, Object obj2, Info info) throws Exception;
void init();
}
@@ -0,0 +1,10 @@
package org.apache.velocity.util.introspection;
import org.apache.velocity.runtime.RuntimeLogger;
import org.apache.velocity.runtime.log.Log;
public interface UberspectLoggable {
void setLog(Log log);
void setRuntimeLogger(RuntimeLogger runtimeLogger);
}
@@ -0,0 +1,11 @@
package org.apache.velocity.util.introspection;
public interface VelMethod {
String getMethodName();
Class getReturnType();
Object invoke(Object obj, Object[] objArr) throws Exception;
boolean isCacheable();
}
@@ -0,0 +1,9 @@
package org.apache.velocity.util.introspection;
public interface VelPropertyGet {
String getMethodName();
Object invoke(Object obj) throws Exception;
boolean isCacheable();
}
@@ -0,0 +1,9 @@
package org.apache.velocity.util.introspection;
public interface VelPropertySet {
String getMethodName();
Object invoke(Object obj, Object obj2) throws Exception;
boolean isCacheable();
}