Examples of OCommandRequestText


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

    case OChannelBinaryProtocol.REQUEST_COMMAND: {
      data.commandInfo = "Execute remote command";

      final boolean asynch = channel.readByte() == 'a';

      final OCommandRequestText command = (OCommandRequestText) OStreamSerializerAnyStreamable.INSTANCE.fromStream(
          connection.database, channel.readBytes());

      final OQuery<?> query = (OQuery<?>) (command instanceof OQuery<?> ? command : null);

      data.commandDetail = command.getText();

      channel.acquireExclusiveLock();
      try {
        if (asynch) {
          // ASYNCHRONOUS
          final StringBuilder empty = new StringBuilder();
          final Set<ODocument> recordsToSend = new HashSet<ODocument>();
          final int txId = lastClientTxId;

          final Map<String, Integer> fetchPlan = query != null ? OFetchHelper.buildFetchPlan(query.getFetchPlan()) : null;
          command.setResultListener(new OCommandResultListener() {
            @Override
            public boolean result(final Object iRecord) {
              if (empty.length() == 0)
                try {
                  sendOk(txId);
View Full Code Here

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

  private OCommandExecutorSQLAbstract  delegate;

  @SuppressWarnings("unchecked")
  public OCommandExecutorSQLDelegate parse(final OCommandRequestText iCommand) {
    if (iCommand instanceof OCommandRequestText) {
      OCommandRequestText textRequest = iCommand;
      final String text = textRequest.getText();
      final String textUpperCase = text.toUpperCase();

      delegate = (OCommandExecutorSQLAbstract) OSQLEngine.getInstance().getCommand(textUpperCase);
      if (delegate == null)
        throw new IllegalArgumentException("Can't find a command executor for the command request: " + iCommand);
View Full Code Here

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

    do {
      OStorageRemoteThreadLocal.INSTANCE.get().commandExecuting = true;

      try {
        final OCommandRequestText aquery = iCommand;

        final boolean asynch = iCommand instanceof OCommandRequestAsynch;

        OChannelBinaryClient network = null;
        try {
          network = beginRequest(OChannelBinaryProtocol.REQUEST_COMMAND);

          network.writeByte((byte) (asynch ? 'a' : 's')); // ASYNC / SYNC
          network.writeBytes(OStreamSerializerAnyStreamable.INSTANCE.toStream(iCommand.getDatabase(), command));

        } finally {
          endRequest(network);
        }

        try {
          beginResponse(network);

          if (asynch) {
            byte status;

            // ASYNCH: READ ONE RECORD AT TIME
            while ((status = network.readByte()) > 0) {
              final ORecordSchemaAware<?> record = (ORecordSchemaAware<?>) readIdentifiable(network, iCommand.getDatabase());
              if (record == null)
                break;

              switch (status) {
              case 1:
                // PUT AS PART OF THE RESULT SET. INVOKE THE LISTENER
                try {
                  if (!aquery.getResultListener().result(record)) {
                    // EMPTY THE INPUT CHANNEL
                    while (network.in.available() > 0)
                      network.in.read();

                    break;
View Full Code Here

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

    do {

      OStorageRemoteThreadLocal.INSTANCE.get().commandExecuting = true;

      try {
        final OCommandRequestText aquery = iCommand;

        final boolean asynch = iCommand instanceof OCommandRequestAsynch;

        final OChannelBinaryClient network = beginRequest(OChannelBinaryProtocol.REQUEST_COMMAND);
        try {
          network.writeByte((byte) (asynch ? 'a' : 's')); // ASYNC / SYNC
          network.writeBytes(OStreamSerializerAnyStreamable.INSTANCE.toStream(iCommand.getDatabase(), command));
        } finally {
          endRequest(network);
        }

        try {
          beginResponse(network);

          if (asynch) {
            byte status;

            // ASYNCH: READ ONE RECORD AT TIME
            while ((status = network.readByte()) > 0) {
              ORecordSchemaAware<?> record = (ORecordSchemaAware<?>) readIdentifiable(network, iCommand.getDatabase());
              if (record == null)
                break;

              switch (status) {
              case 1:
                // PUT AS PART OF THE RESULT SET. INVOKE THE LISTENER
                try {
                  if (!aquery.getResultListener().result(record)) {
                    // EMPTY THE INPUT CHANNEL
                    while (network.in.available() > 0)
                      network.in.read();

                    break;
View Full Code Here

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

    do {

      OStorageRemoteThreadLocal.INSTANCE.get().commandExecuting = true;

      try {
        final OCommandRequestText aquery = iCommand;

        final boolean asynch = iCommand instanceof OCommandRequestAsynch;

        final OChannelBinaryClient network = beginRequest(OChannelBinaryProtocol.REQUEST_COMMAND);
        try {
          network.writeByte((byte) (asynch ? 'a' : 's')); // ASYNC / SYNC
          network.writeBytes(OStreamSerializerAnyStreamable.INSTANCE.toStream(iCommand.getDatabase(), command));
        } finally {
          endRequest(network);
        }

        try {
          beginResponse(network);

          if (asynch) {
            byte status;

            // ASYNCH: READ ONE RECORD AT TIME
            while ((status = network.readByte()) > 0) {
              ORecordSchemaAware<?> record = (ORecordSchemaAware<?>) readRecordFromNetwork(network, iCommand.getDatabase());
              if (record == null)
                break;

              switch (status) {
              case 1:
                // PUT AS PART OF THE RESULT SET. INVOKE THE LISTENER
                try {
                  if (!aquery.getResultListener().result(record)) {
                    // EMPTY THE INPUT CHANNEL
                    while (network.in.available() > 0)
                      network.in.read();

                    break;
View Full Code Here

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

  private OCommandExecutorSQLAbstract  delegate;

  @SuppressWarnings("unchecked")
  public OCommandExecutorSQLDelegate parse(final OCommandRequestText iCommand) {
    if (iCommand instanceof OCommandRequestText) {
      OCommandRequestText sql = iCommand;
      final String text = sql.getText();
      final String textUpperCase = text.toUpperCase();

      delegate = (OCommandExecutorSQLAbstract) OSQLEngine.getInstance().getCommand(textUpperCase);
      if (delegate == null)
        throw new IllegalArgumentException("Can't find a command executor for the command request: " + iCommand);
View Full Code Here

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

    case OChannelBinaryProtocol.REQUEST_COMMAND: {
      data.commandInfo = "Execute remote command";

      final boolean asynch = channel.readByte() == 'a';

      final OCommandRequestText command = (OCommandRequestText) OStreamSerializerAnyStreamable.INSTANCE.fromStream(
          connection.database, channel.readBytes());

      final OQuery<?> query = (OQuery<?>) (command instanceof OQuery<?> ? command : null);

      data.commandDetail = command.getText();

      if (asynch) {
        // ASYNCHRONOUS
        final StringBuilder empty = new StringBuilder();
        final Set<ODocument> recordsToSend = new HashSet<ODocument>();
        final int txId = lastClientTxId;

        final Map<String, Integer> fetchPlan = query != null ? OFetchHelper.buildFetchPlan(query.getFetchPlan()) : null;
        command.setResultListener(new OCommandResultListener() {
          @Override
          public boolean result(final Object iRecord) {
            if (empty.length() == 0)
              try {
                sendOk(txId);
View Full Code Here

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

    case OChannelBinaryProtocol.REQUEST_COMMAND: {
      data.commandInfo = "Execute remote command";

      final boolean asynch = channel.readByte() == 'a';

      final OCommandRequestText command = (OCommandRequestText) OStreamSerializerAnyStreamable.INSTANCE.fromStream(
          connection.database, channel.readBytes());

      final OQuery<?> query = (OQuery<?>) (command instanceof OQuery<?> ? command : null);

      data.commandDetail = command.getText();

      channel.acquireExclusiveLock();
      try {
        if (asynch) {
          // ASYNCHRONOUS
          final StringBuilder empty = new StringBuilder();
          final Set<ODocument> recordsToSend = new HashSet<ODocument>();
          final int txId = lastClientTxId;

          final Map<String, Integer> fetchPlan = query != null ? OFetchHelper.buildFetchPlan(query.getFetchPlan()) : null;
          command.setResultListener(new OCommandResultListener() {
            @Override
            public boolean result(final Object iRecord) {
              if (empty.length() == 0)
                try {
                  sendOk(txId);
View Full Code Here

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

    case OChannelBinaryProtocol.REQUEST_COMMAND: {
      data.commandInfo = "Execute remote command";

      final boolean asynch = channel.readByte() == 'a';

      final OCommandRequestText command = (OCommandRequestText) OStreamSerializerAnyStreamable.INSTANCE.fromStream(
          connection.database, channel.readBytes());

      final OQuery<?> query = (OQuery<?>) (command instanceof OQuery<?> ? command : null);

      data.commandDetail = command.getText();

      channel.acquireExclusiveLock();
      try {
        if (asynch) {
          // ASYNCHRONOUS
          final StringBuilder empty = new StringBuilder();
          final Set<ODocument> recordsToSend = new HashSet<ODocument>();
          final int txId = lastClientTxId;

          final Map<String, Integer> fetchPlan = query != null ? OFetchHelper.buildFetchPlan(query.getFetchPlan()) : null;
          command.setResultListener(new OCommandResultListener() {
            @Override
            public boolean result(final Object iRecord) {
              if (empty.length() == 0)
                try {
                  sendOk(txId);
View Full Code Here

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

    final Object response;

    try {
      db = getProfiledDatabaseInstance(iRequest);

      final OCommandRequestText cmd = (OCommandRequestText) OCommandManager.instance().getRequester(language);
      cmd.setText(text);
      cmd.setLimit(limit);
      response = db.command(cmd).execute();

    } finally {
      if (db != null)
        OSharedDocumentDatabase.release(db);
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.