Package bsh

Examples of bsh.NameSpace


  private synchronized void readObject(ObjectInputStream s)
  throws IOException, ClassNotFoundException {
    s.defaultReadObject();

    if (s.readBoolean()) {
      BSHInterpreter.read(new NameSpace(null, null, "nst") {
        public void setVariable(String name, Object value, boolean strictJava) {
          if (_vars == null) _vars = new HashMap();
          _vars.put(name, value);
        }
        public void setMethod(String name, BshMethod mtd) {
View Full Code Here


      {
        public void run()
        {
          try
          {
            NameSpace ns = new NameSpace(
              BeanShell.getNameSpace(),
              "EditServer namespace");
            ns.setVariable("socket",client);
            BeanShell.eval(null,ns,script);
          }
          catch(bsh.UtilEvalError e)
          {
            Log.log(Log.ERROR,this,e);
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

            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

        if( runtime == null )
        {
            runtime = new Interpreter();
            BshClassManager.createClassManager( runtime );
            Class compositeType = me.getClass().getInterfaces()[ 0 ];
            NameSpace namespace = buildNamespace( compositeType, runtime );
            runtime.setNameSpace( namespace );
            synchronized( BeanShellMixin.class )
            {
                runtimes.put( module, runtime );
            }
View Full Code Here

        throws IOException
    {
        ClassLoader loader = compositeType.getClassLoader();
        BshClassManager classManager = BshClassManager.createClassManager( runtime );
        classManager.setClassLoader( loader );
        NameSpace namespace = new NameSpace( classManager, compositeType.getName() );

        URL scriptUrl = getFunctionResource( compositeType );
        if( scriptUrl == null )
        {
            return null;
View Full Code Here

            // Need optimizations so that this method only build the namespace and extract the mixins
            // once per composite.
            try
            {

                NameSpace namespace = buildNamespace( compositeType, runtime );
                if( namespace == null )
                {
                    return false;
                }
                runtime.setNameSpace( namespace );
View Full Code Here

        assertEquals("scriptInfo.code", "testScriptInfoCode", scriptInfo.code);
    }

    @Test
    public void testScriptInfoConstructor1() throws Throwable {
        NameSpace ns = NameSpace.JAVACODE;
        BSHLogListener.ScriptInfo scriptInfo =  new BSHLogListener.ScriptInfo(ns);
        assertSame("scriptInfo.nameSpace", ns, scriptInfo.nameSpace);
    }
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.