Package bsh

Examples of bsh.NameSpace


            o = bsh.eval(expression);
            if (Debug.verboseOn())
                Debug.logVerbose("Evaluated to -- " + o, module);

            // read back the context info
            NameSpace ns = bsh.getNameSpace();
            String[] varNames = ns.getVariableNames();
            for (String varName: varNames) {
                context.put(varName, bsh.get(varName));
            }
        } catch (EvalError e) {
            Debug.logError(e, "BSH Evaluation error.", module);
View Full Code Here


            master = BshUtil.masterClassManagers.get(classLoader);
        }

        if (master != null) {
            Interpreter interpreter = new Interpreter(new StringReader(""), System.out, System.err,
                    false, new NameSpace(master, "global"), null, null);
            return interpreter;
        } else {
            Interpreter interpreter = new Interpreter();
            interpreter.setClassLoader(classLoader);
            return interpreter;
View Full Code Here

            o = bsh.eval(expression);
            if (Debug.verboseOn())
                Debug.logVerbose("Evaluated to -- " + o, module);

            // read back the context info
            NameSpace ns = bsh.getNameSpace();
            String[] varNames = ns.getVariableNames();
            for (String varName: varNames) {
                context.put(varName, bsh.get(varName));
            }
        } catch (EvalError e) {
            Debug.logError(e, "BSH Evaluation error.", module);
View Full Code Here

            }
        }

        if (master != null) {
            Interpreter interpreter = new Interpreter(new StringReader(""), System.out, System.err,
                    false, new NameSpace(master, "global"), null, null);
            return interpreter;
        } else {
            Interpreter interpreter = new Interpreter();
            interpreter.setClassLoader(classLoader);
            return interpreter;
View Full Code Here

    }
  }

  protected boolean contains(Scope scope, String name) {
    if (scope != null) {
      final NameSpace bshns = prepareNS(scope);
        //note: we have to create NameSpace (with prepareNS)
        //to have the correct chain
      if (bshns != _bshns) {
         try {
           return bshns.getVariable(name) != Primitive.VOID;
        } catch (UtilEvalError ex) {
          throw UiException.Aide.wrap(ex);
        }
      }
    }
View Full Code Here

    }
    return contains(name);
  }
  protected Object get(Scope scope, String name) {
    if (scope != null) {
      final NameSpace bshns = prepareNS(scope);
        //note: we have to create NameSpace (with prepareNS)
        //to have the correct chain
      if (bshns != _bshns) {
         try {
           return Primitive.unwrap(bshns.getVariable(name));
        } catch (UtilEvalError ex) {
          throw UiException.Aide.wrap(ex);
        }
      }
    }
View Full Code Here

    }
    return get(name);
  }
  protected void set(Scope scope, String name, Object val) {
    if (scope != null) {
      final NameSpace bshns = prepareNS(scope);
        //note: we have to create NameSpace (with prepareNS)
        //to have the correct chain
      if (bshns != _bshns) {
         try {
           bshns.setVariable(
             name, val != null ? val: Primitive.NULL, false);
           return;
        } catch (UtilEvalError ex) {
          throw UiException.Aide.wrap(ex);
        }
View Full Code Here

    }
    set(name, val);
  }
  protected void unset(Scope scope, String name) {
    if (scope != null) {
      final NameSpace bshns = prepareNS(scope);
        //note: we have to create NameSpace (with prepareNS)
        //to have the correct chain
      if (bshns != _bshns) {
         bshns.unsetVariable(name);
         return;
      }
    }
    unset(name);
  }
View Full Code Here

    if (nsw != null)
      return nsw.unwrap(scope);

    //bind bshns and scope
    Scope p = getParentIdSpace(scope);
    NameSpace bshns = new NS(p != null ? prepareDetachedNS(p): null, null, scope);
    scope.setAttribute(VAR_NSW, NSWrap.getInstance(bshns));
    return bshns;
  }
View Full Code Here

            _inGet = false;
          }
        }

        if (var == null && recurse) {
          NameSpace parent = getParent();
          if (parent instanceof AbstractNS) {
            var = ((AbstractNS)parent).getVariableImpl(name, true);
          } else if (parent != null) { //show not reach here; just in case
            try {
              java.lang.reflect.Method m =
View Full Code Here

TOP

Related Classes of bsh.NameSpace

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.