class Resolver extends SymbolResolver
The resolver operates multiple scopes which are organized in two nesting levels. The outer scope belongs to the Security Manager and is a singleton. The inner scopes belong to the resource plugins. All inner scopes have the common parent (are siblings). For any expression evaluation, there is only one active inner scope for the specific plugin, plus the outer scope for the Security Manager.
All scopes are named. This allows the full access to any symbol in either plugin's or Security Manager's scope even if they are named identically. The Security Manager's scope is named "security", whereas plugins scopes are named after the resource type name they control: "system", "directory", "net" etc.
Modifier and Type | Field and Description |
---|---|
private static java.util.Map |
constants
Constants pool.
|
private Scope |
scope
The current expression's scope.
|
_aastore, _aconst_null, _aload_0, _aload_1, _aload_2, _aload_3, _anewarray, _areturn, _astore_1, _astore_2, _astore_3, _checkcast, _d2i, _d2l, _dadd, _dcmpg, _dconst_0, _dconst_1, _ddiv, _dmul, _dneg, _drem, _dreturn, _dsub, _dup, _getfield, _goto, _i2d, _i2l, _iadd, _iand, _iconst_0, _iconst_1, _iconst_2, _iconst_3, _iconst_4, _iconst_5, _idiv, _if_icmpeq, _if_icmpge, _if_icmpgt, _if_icmple, _if_icmplt, _if_icmpne, _ifeq, _ifge, _ifgt, _ifle, _iflt, _ifne, _ifnonnull, _ifnull, _imul, _ineg, _invokeinterface, _invokespecial, _invokestatic, _invokevirtual, _ior, _irem, _ireturn, _ishl, _ishr, _isub, _iushr, _ixor, _l2d, _l2i, _ladd, _land, _lcmp, _lconst_0, _lconst_1, _ldc_w, _ldc2_w, _ldiv, _lmul, _lneg, _lor, _lrem, _lshl, _lshr, _lsub, _lushr, _lxor, _new, _pop, _pop2, _return, _swap, CLASS_COMPILEDEXPRESSION, METHDESC_EXECUTE, METHNAME_EXECUTE, METHOD_INIT
Constructor and Description |
---|
Resolver()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkPermission(java.lang.Class target,
java.lang.reflect.Method method,
boolean registered)
Makes decision about validity of a method call in an expression.
|
Scope |
getCurrentScope()
Gets the current scope.
|
protected java.lang.Object |
resolveConstant(java.lang.String qualifier,
java.lang.String constant)
Resolves the specified string constant to a literal object.
|
(package private) void |
setCurrentScope(Scope scope)
Sets the current scope.
|
dropLibrary, dropVariable, dropVariablePool, getVariable, registerLibrary, registerVariable, resetVariables
private static java.util.Map constants
private Scope scope
Resolver()
protected java.lang.Object resolveConstant(java.lang.String qualifier, java.lang.String constant)
resolveConstant
in class SymbolResolver
qualifier
- An optional qualifier for concrete implementations which must
support multiple namespaces. A qualifier is not mandatory for
constants, so this parameter may be null
.constant
- The string constant to be resolved to a literal.symbol
, or
null
if the symbol is not recognized.public boolean checkPermission(java.lang.Class target, java.lang.reflect.Method method, boolean registered)
The logic implemented here is very simple: this method returns true (allows method use) only if it was registered with a library.
checkPermission
in class SymbolResolver
target
- instance of a class referenced in the expressionmethod
- method of the class referenced in the expressionregistered
- true
if the referenced target class has been
registered as a library and method is exported from the librarytrue
if method use is allowedpublic Scope getCurrentScope()
The current scope is always the scope of the plugin who requested expression evaluation. That scope is kept in the "scope" member.
getCurrentScope
in class SymbolResolver
Scope
of the plugin submitted the expressionvoid setCurrentScope(Scope scope)
Security Manager should call this method to set the current scope to the plugin that submitted the expression.
scope
- scope of the plugin evaluating the expression