Package bsh

Examples of bsh.Interpreter


    /**
     * @param bshFile
     */
    private void loadScript(File bshFile) {
        try {
            mScript = (BeanShellScriptIf) new Interpreter().source(bshFile.getAbsolutePath());
        } catch (Exception e) {
            e.printStackTrace();
            mScript = null;
        }
    }
View Full Code Here


        + "return (BeanShellProgramFilterIf) this;";
  }

  private void compileSource() throws EvalError {
    if (mScriptSource != null && mScript == null) {
      mScript = (BeanShellProgramFilterIf) new Interpreter()
          .eval(mScriptSource);
    }
  }
View Full Code Here

  protected void testScript() {
    boolean error = false;
    try {
      BeanShellProgramFilterIf filter;
      filter = (BeanShellProgramFilterIf) new Interpreter().eval(mScriptEditor
          .getText());
      filter.accept(Plugin.getPluginManager().getExampleProgram());
    } catch (Exception e) {
      ErrorHandler.handle(mLocalizer.msg("errorParsing",
          "Error while parsing Script"), e);
View Full Code Here


    synchronized void createInterpreter() {
        // create interpreter just-in-time
        if(interpreter == null) {
            interpreter=new Interpreter();
            try {
                interpreter.set("bsh_prot", this);
            }
            catch(EvalError evalError) {
            }
View Full Code Here

   */
  protected Interpreter createInterpreter()
  {
    try
    {
      final Interpreter interpreter = new Interpreter();
      initializeInterpreter(interpreter);
      return interpreter;
    }
    catch (Throwable e)
    {
View Full Code Here

  {
    super();
   
    this.bshScript = bshScript;

    interpreter = new Interpreter();
   
    interpreter.setClassLoader(Thread.currentThread().getContextClassLoader());

    try
    {
View Full Code Here

     */
    private final Interpreter initialize(
        Object stub,
        String scriptPath)
    {
        final Interpreter interpreter = new Interpreter();
        interpreter.setClassLoader(stub.getClass().getClassLoader());
        return interpreter;
    }
View Full Code Here

    if (DebugFile.trace) {
      DebugFile.writeln("Begin ModelManager.dropDomain(" + sDomainNm + ")");
      DebugFile.incIdent();
    }

    Interpreter oInterpreter = new Interpreter();

    oInterpreter.set ("DomainNm", sDomainNm);
    oInterpreter.set ("DefaultConnection", oConn);

    oInterpreter.eval(getResourceAsString("scripts/domain_drop.js", sEncoding));

    Object obj = oInterpreter.get("ErrorCode");

    Integer oCodError = (Integer) oInterpreter.get("ErrorCode");

    if (oCodError.compareTo(new Integer (0))!=0) {
      iErrors++;
      if (null!=oStrLog) oStrLog.append("EvalError: " + oInterpreter.get("ErrorMessage") + "\n");

      throw new SQLException((String) oInterpreter.get("ErrorMessage"));
    }

    if (DebugFile.trace) {
      DebugFile.decIdent();
      DebugFile.writeln("End ModelManager.dropDomain()");
    }

    if  (oInterpreter.get("ReturnValue")!=null)
      return ( (Integer) oInterpreter.get("ReturnValue")).intValue();
    else
      return 0;
  } // dropDomain
View Full Code Here

    }

    int iDominId = 0;
    int iRetVal;

    Interpreter oInterpreter = new Interpreter();

    oInterpreter.set ("DomainNm", sDomainNm);
    oInterpreter.set ("DefaultConnection", oConn);
    oInterpreter.set ("AlternativeConnection", oConn);

    if (DebugFile.trace) DebugFile.writeln("Interpreter.eval(getResourceAsString(scripts/domain_create.js,"+sEncoding);

    oInterpreter.eval(getResourceAsString("scripts/domain_create.js", sEncoding));

    Object obj = oInterpreter.get("ErrorCode");

    Integer oCodError = (Integer) oInterpreter.get("ErrorCode");

    if (oCodError.intValue()!=0) {
      sErrMsg = (String) oInterpreter.get("ErrorMessage");
      iErrors++;
      if (null!=oStrLog) oStrLog.append("EvalError: " + sErrMsg + "\n");
      if (DebugFile.trace) {
        DebugFile.writeln("SQLException "+sErrMsg);
        DebugFile.decIdent();
      }
      throw new SQLException(sErrMsg);
    } // fi ()

    obj = oInterpreter.get("ReturnValue");

    if ( null != obj ) {
      iDominId = ( (Integer) obj).intValue();

      Statement oStmt = oConn.createStatement();
      if (DebugFile.trace) DebugFile.writeln("Statement.executeUpdate(UPDATE k_workareas SET nm_workarea='" + sDomainNm.toLowerCase() + "_default' WHERE id_domain=" + String.valueOf(iDominId) + " AND nm_workarea='model_default')");
      oStmt.executeUpdate("UPDATE k_workareas SET nm_workarea='" + sDomainNm.toLowerCase() + "_default' WHERE id_domain=" + String.valueOf(iDominId) + " AND nm_workarea='model_default'");
      oStmt.close();

      if (null!=oStrLog) oStrLog.append("New Domain " + oInterpreter.get("ReturnValue") + " created successfully\n");
      iRetVal = iDominId;
    }
    else {
      if (null!=oStrLog) oStrLog.append( oInterpreter.get("ErrorMessage") + ": Domain not created.");
      iRetVal = 0;
    }

    if (DebugFile.trace) {
      DebugFile.decIdent();
View Full Code Here

    String sErrMsg = null;
    String sRetVal = null;
  Integer oCodError = new Integer(0);
 
    Interpreter oInterpreter = new Interpreter();
    try {
      oInterpreter.set ("UserId", sUserId);
      oInterpreter.set ("DefaultConnection", new JDCConnection(oConn,null));
      if (DebugFile.trace) DebugFile.writeln("Interpreter.eval(getResourceAsString(scripts/user_categories_create.js,"+sEncoding);
      oInterpreter.eval(getResourceAsString("scripts/user_categories_create.js", sEncoding));
      Object obj = oInterpreter.get("ErrorCode");
      oCodError = (Integer) oInterpreter.get("ErrorCode");
      if (oCodError.intValue()==0) {
        sErrMsg = (String) oInterpreter.get("ErrorMessage");
        sRetVal = (String) oInterpreter.get("ReturnValue");
      }
    } catch (EvalError ee) {
      if (DebugFile.trace) {
        DebugFile.writeln("EvalError at user_categories_create.js "+ee.getMessage());
        DebugFile.decIdent();
View Full Code Here

TOP

Related Classes of bsh.Interpreter

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.