Examples of OCommandExecutor


Examples of com.orientechnologies.orient.core.command.OCommandExecutor

  /**
   * Execute the command request and return the result back.
   */
  public Object command(final OCommandRequestText iCommand) {
    final OCommandExecutor executor = OCommandManager.instance().getExecutor(iCommand);
    executor.setProgressListener(iCommand.getProgressListener());
    executor.parse(iCommand);
    try {
      return executor.execute(iCommand.getParameters());
    } catch (OException e) {
      // PASS THROUGHT
      throw e;
    } catch (Exception e) {
      throw new OCommandExecutionException("Error on execution of command: " + iCommand, e);
View Full Code Here

Examples of com.orientechnologies.orient.core.command.OCommandExecutor

  /**
   * Execute the command request and return the result back.
   */
  public Object command(final OCommandRequestText iCommand) {
    final OCommandExecutor executor = OCommandManager.instance().getExecutor(iCommand);
    executor.setProgressListener(iCommand.getProgressListener());
    executor.parse(iCommand);
    try {
      return executor.execute(iCommand.getParameters());
    } catch (OCommandExecutionException e) {
      // PASS THROUGHT
      throw e;
    } catch (Exception e) {
      throw new OCommandExecutionException("Error on execution of command: " + iCommand, e);
View Full Code Here

Examples of com.orientechnologies.orient.core.command.OCommandExecutor

  /**
   * Execute the command request and return the result back.
   */
  public Object command(final OCommandRequestText iCommand) {
    final OCommandExecutor executor = OCommandManager.instance().getExecutor(iCommand);
    executor.setProgressListener(iCommand.getProgressListener());
    executor.parse(iCommand);
    try {
      return executor.execute(iCommand.getParameters());
    } catch (OException e) {
      // PASS THROUGHT
      throw e;
    } catch (Exception e) {
      throw new OCommandExecutionException("Error on execution of command: " + iCommand, e);
View Full Code Here

Examples of com.orientechnologies.orient.core.command.OCommandExecutor

  /**
   * Execute the command request and return the result back.
   */
  public Object command(final OCommandRequestText iCommand) {
    final OCommandExecutor executor = OCommandManager.instance().getExecutor(iCommand);
    executor.setProgressListener(iCommand.getProgressListener());
    executor.parse(iCommand);
    try {
      return executor.execute(iCommand.getParameters());
    } catch (OException e) {
      // PASS THROUGHT
      throw e;
    } catch (Exception e) {
      throw new OCommandExecutionException("Error on execution of command: " + iCommand, e);
View Full Code Here

Examples of com.orientechnologies.orient.core.command.OCommandExecutor

  /**
   * Executes the command request and return the result back.
   */
  public Object command(final OCommandRequestText iCommand) {
    final OCommandExecutor executor = OCommandManager.instance().getExecutor(iCommand);

    // COPY THE CONTEXT FROM THE REQUEST
    executor.setContext(iCommand.getContext());

    executor.setProgressListener(iCommand.getProgressListener());
    executor.parse(iCommand);

    return executeCommand(iCommand, executor);
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.command.OCommandExecutor

      cmd.setText(text);
      cmd.setLimit(limit);
      cmd.setFetchPlan(fetchPlan);

      final OCommandExecutor executor = OCommandManager.instance().getExecutor(cmd);
      executor.setContext(cmd.getContext());
      executor.setProgressListener(cmd.getProgressListener());
      executor.parse(cmd);

      if (!executor.isIdempotent() && iRequest.httpMethod.equals("GET"))
        throw new OCommandExecutionException("Cannot execute non idempotent command using HTTP GET");

      response = db.command(cmd).execute();

      fetchPlan = executor.getFetchPlan();

      String format = null;
      if (iRequest.parameters.get("format") != null)
        format = iRequest.parameters.get("format");
View Full Code Here

Examples of com.orientechnologies.orient.core.command.OCommandExecutor

     final ODistributedConfiguration dbCfg = dManager.getDatabaseConfiguration(getName());
     if (!dbCfg.isReplicationActive(null, dManager.getLocalNodeName()))
       // DON'T REPLICATE
       return wrapped.command(iCommand);

     final OCommandExecutor executor = OCommandManager.instance().getExecutor(iCommand);

     executor.setProgressListener(iCommand.getProgressListener());
     executor.parse(iCommand);

     final OCommandExecutor exec = executor instanceof OCommandExecutorSQLDelegate ? ((OCommandExecutorSQLDelegate) executor)
         .getDelegate() : executor;

     try {
       final OSQLCommandTask task = new OSQLCommandTask(iCommand);

       Object result = null;
       OCommandDistributedReplicateRequest.DISTRIBUTED_EXECUTION_MODE executionMode = OCommandDistributedReplicateRequest.DISTRIBUTED_EXECUTION_MODE.LOCAL;
       if (OScenarioThreadLocal.INSTANCE.get() != RUN_MODE.RUNNING_DISTRIBUTED) {
         if (exec instanceof OCommandDistributedReplicateRequest)
           executionMode = ((OCommandDistributedReplicateRequest) exec).getDistributedExecutionMode();
       }

       switch (executionMode) {
       case LOCAL:
         return wrapped.command(iCommand);

       case REPLICATE: {
         // REPLICATE IT, GET ALL THE INVOLVED NODES
         final Collection<String> involvedClusters = exec.getInvolvedClusters();
         final Collection<String> nodes;

         task.setResultStrategy(OAbstractRemoteTask.RESULT_STRATEGY.ANY);

         nodes = dbCfg.getServers(involvedClusters);
         if (iCommand instanceof ODistributedCommand)
           nodes.removeAll(((ODistributedCommand) iCommand).nodesToExclude());

         result = dManager.sendRequest(getName(), involvedClusters, nodes, task, EXECUTION_MODE.RESPONSE);
         break;
       }

       case SHARDED: {
         // SHARDED, GET ONLY ONE NODE PER INVOLVED CLUSTER
         final Collection<String> involvedClusters = exec.getInvolvedClusters();
         final Collection<String> nodes;

         task.setResultStrategy(OAbstractRemoteTask.RESULT_STRATEGY.UNION);

         nodes = dbCfg.getOneServerPerCluster(involvedClusters, dManager.getLocalNodeName());

         if (iCommand instanceof ODistributedCommand)
           nodes.removeAll(((ODistributedCommand) iCommand).nodesToExclude());

         boolean executeLocally = false;
         if (exec.isIdempotent()) {
           // IDEMPOTENT: CHECK IF CAN WORK LOCALLY ONLY
           int maxReadQuorum;
           if (involvedClusters.isEmpty())
             maxReadQuorum = dbCfg.getReadQuorum(null);
           else {
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.