public Object retraceVariable(String variable) {
if ( variable == null || variable.trim().length() == 0 ) {
JangodLogger.severe("variable name is required.");
return Constants.STR_BLANK;
}
Variable var = new Variable(variable);
String varName = var.getName();
//find from runtime(tree scope) > engine > global
Object obj = runtime.get(varName, level);
int lvl = level;
while( obj == null && lvl > 1) {
obj = runtime.get(varName, --lvl);
}
if ( obj == null ) {
obj = context.getAttribute(varName);
}
if ( obj == null ) {
if( VAR_DATE.equals(variable) ) {
return new java.util.Date();
}
if ( VAR_PATH.equals(variable) ) {
return getWorkspace();
}
}
if ( obj != null ) {
obj = var.resolve(obj);
if ( obj == null ) {
JangodLogger.fine(varName + " can't resolve member >>> " + variable);
}
} else {
JangodLogger.finer(variable + " can't resolve variable >>> " + varName);