Examples of OCommandScriptException


Examples of com.orientechnologies.orient.core.command.script.OCommandScriptException

    this.started = doc.field(PROP_STARTED) == null ? false : ((Boolean) doc.field(PROP_STARTED));
    ODocument funcDoc = doc.field(PROP_FUNC);
    if (funcDoc != null)
      function = new OFunction(funcDoc);
    else
      throw new OCommandScriptException("function cannot be null");
    this.startTime = doc.field(PROP_STARTTIME);
    this.document = doc;
    this.db = ODatabaseRecordThreadLocal.INSTANCE.get();
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.command.script.OCommandScriptException

    this.started = doc.field(PROP_STARTED) == null ? false : ((Boolean) doc.field(PROP_STARTED));
    ODocument funcDoc = doc.field(PROP_FUNC);
    if (funcDoc != null)
      function = new OFunction(funcDoc);
    else
      throw new OCommandScriptException("function cannot be null");
    this.startTime = doc.field(PROP_STARTTIME);
    this.db = ODatabaseRecordThreadLocal.INSTANCE.get();
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.command.script.OCommandScriptException

            args[i++] = arg.getValue();
        }
        invocableEngine.invokeFunction(this.function.getName(), args);
      }
    } catch (ScriptException e) {
      throw new OCommandScriptException("Error on execution of the script", this.function.getName(), e.getColumnNumber(), e);
    } catch (NoSuchMethodException e) {
      throw new OCommandScriptException("Error on execution of the script", this.function.getName(), 0, e);
    } catch (OCommandScriptException e) {
      throw e;
    } catch (Exception ex) {
      throw new OCommandScriptException("Unknown Exception", this.function.getName(), 0, ex);
    } finally {
      if (scriptManager != null && binding != null)
        scriptManager.unbind(binding);
      OLogManager.instance().warn(this, "Job : " + this.toString() + " Finished!");
      isRunning = false;
View Full Code Here

Examples of com.orientechnologies.orient.core.command.script.OCommandScriptException

        final Invocable invocableEngine = (Invocable) scriptEngine;
        Object[] EMPTY = new Object[0];
        result = (String) invocableEngine.invokeFunction(func.getName(), EMPTY);
      }
    } catch (ScriptException e) {
      throw new OCommandScriptException("Error on execution of the script", func.getName(), e.getColumnNumber(), e);
    } catch (NoSuchMethodException e) {
      throw new OCommandScriptException("Error on execution of the script", func.getName(), 0, e);
    } catch (OCommandScriptException e) {
      // PASS THROUGH
      throw e;

    } finally {
View Full Code Here

Examples of com.orientechnologies.orient.core.command.script.OCommandScriptException

    return false;
  }

  @Override
  protected void throwSyntaxErrorException(String iText) {
    throw new OCommandScriptException("Error on parsing of the script: " + iText);
  }
View Full Code Here

Examples of com.orientechnologies.orient.enterprise.command.script.OCommandScriptException

  public Object execute(final Map<Object, Object> iArgs) {
    final String language = request.getLanguage();
    final String script = request.getText();

    if (language == null)
      throw new OCommandScriptException("No language was specified");

    if (!engines.containsKey(language))
      throw new OCommandScriptException("Unsupported language: " + language + ". Supported languages are: " + engines);

    if (script == null)
      throw new OCommandScriptException("Invalid script: " + script);

    final ScriptEngine scriptEngine = engines.get(language);

    if (scriptEngine == null)
      throw new OCommandScriptException("Cannot find script engine: " + language);

    final Bindings binding = scriptEngine.createBindings();

    // BIND FIXED VARIABLES
    binding.put("db", database);

    // BIND PARAMETERS INTO THE SCRIPT
    if (iArgs != null)
      for (int i = 0; i < iArgs.size(); ++i) {
        binding.put("$" + i, iArgs.get(i));
      }

    try {
      Object result = null;
      result = scriptEngine.eval(script, binding);

      return result;
    } catch (ScriptException e) {
      throw new OCommandScriptException("Error on execution of the script", request.getText(), 0, e);
    }
  }
View Full Code Here

Examples of com.orientechnologies.orient.enterprise.command.script.OCommandScriptException

  public Object execute(final Map<Object, Object> iArgs) {
    final String language = request.getLanguage();
    final String script = request.getText();

    if (language == null)
      throw new OCommandScriptException("No language was specified");

    if (!engines.containsKey(language))
      throw new OCommandScriptException("Unsupported language: " + language + ". Supported languages are: " + engines);

    if (script == null)
      throw new OCommandScriptException("Invalid script: null");

    final ScriptEngine scriptEngine = engines.get(language);

    if (scriptEngine == null)
      throw new OCommandScriptException("Cannot find script engine: " + language);

    final Bindings binding = scriptEngine.createBindings();

    // BIND FIXED VARIABLES
    binding.put("db", database);

    // BIND PARAMETERS INTO THE SCRIPT
    if (iArgs != null)
      for (int i = 0; i < iArgs.size(); ++i) {
        binding.put("$" + i, iArgs.get(i));
      }

    try {
      Object result = null;
      result = scriptEngine.eval(script, binding);

      return result;
    } catch (ScriptException e) {
      throw new OCommandScriptException("Error on execution of the script", request.getText(), 0, e);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.