Package com.google.code.hs4j

Examples of com.google.code.hs4j.Command


    this.handler = new HandlerSocketHandler(this.hsClient);
  }

  @Test
  public void testOnMessageSent() {
    Command cmd = new InsertCommand("1", null);
    HandlerSocketSession session = EasyMock
        .createMock(HandlerSocketSession.class);
    session.addCommand(cmd);
    EasyMock.expectLastCall();
    EasyMock.replay(session);
View Full Code Here


    }
  }

  private Object decode0(IoBuffer buffer, HandlerSocketSession session) {
    if (session.getCurrentCommand().decode(session, buffer)) {
      final Command command = session.getCurrentCommand();
      session.setCurrentCommand(null);
      return command;
    }
    return null;
  }
View Full Code Here

  public ResultSet find(int indexId, String[] keys, FindOperator operator,
      int limit, int offset, Filter[] filters ) throws InterruptedException,
      TimeoutException, HandlerSocketException {
    IndexRecord indexRecord = this.getRecord(indexId);
    Command cmd = this.commandFactory.createFindCommand(String
        .valueOf(indexId), operator, keys, limit, offset,
        indexRecord.fieldList, filters);
    this.connector.send(cmd);
    this.awaitResponse(cmd);
    return (ResultSet) cmd.getResult();
  }
View Full Code Here

  public String insertIgnore(int indexId, String[] values)
          throws InterruptedException, TimeoutException,
          HandlerSocketException {
      byte[][] bytes = HSUtils.getByteArrayFromStringArray(values,this.encoding);
      Command cmd = this.commandFactory.createInsertIgnoreCommand(String
                .valueOf(indexId), bytes);
        this.connector.send(cmd);
        this.awaitResponse(cmd);
       
        return cmd.getResponseStatus() == 0 ? (String)cmd.getResult() : EMPTY_STR;
  }
View Full Code Here

  }

  protected boolean insert0(int indexId, byte[][] bytes)
      throws HandlerSocketException, InterruptedException,
      TimeoutException {
    Command cmd = this.commandFactory.createInsertCommand(String
        .valueOf(indexId), bytes);
    this.connector.send(cmd);
    this.awaitResponse(cmd);
    return cmd.getResponseStatus() == 0;
  }
View Full Code Here

  }

  public int delete(int indexId, String[] keys, FindOperator operator,
      int limit, int offset) throws InterruptedException,
      TimeoutException, HandlerSocketException {
    Command cmd = this.commandFactory.createDeleteCommand(String
        .valueOf(indexId), operator, keys, limit, offset);
    this.connector.send(cmd);
    this.awaitResponse(cmd);
    return (Integer) cmd.getResult();
  }
View Full Code Here

  protected int update0(int indexId, String[] keys, FindOperator operator,
      int limit, int offset, byte[][] bytes)
      throws HandlerSocketException, InterruptedException,
      TimeoutException {
    Command cmd = this.commandFactory.createUpdateCommand(String
        .valueOf(indexId), operator, keys, bytes, limit, offset);
    this.connector.send(cmd);
    this.awaitResponse(cmd);
    return (Integer) cmd.getResult();
  }
View Full Code Here

  protected int incr(int indexId, String[] keys, FindOperator operator,
      int limit, int offset, byte[][] bytes)
      throws HandlerSocketException, InterruptedException,
      TimeoutException {
    Command cmd = this.commandFactory.createIncrCommand(String
        .valueOf(indexId), operator, keys, bytes, limit, offset);
    this.connector.send(cmd);
    this.awaitResponse(cmd);
    return (Integer) cmd.getResult();
  }
View Full Code Here

  protected int decr(int indexId, String[] keys, FindOperator operator,
      int limit, int offset, byte[][] bytes)
      throws HandlerSocketException, InterruptedException,
      TimeoutException {
    Command cmd = this.commandFactory.createDecrCommand(String
        .valueOf(indexId), operator, keys, bytes, limit, offset);
    this.connector.send(cmd);
    this.awaitResponse(cmd);
    return (Integer) cmd.getResult();
  }
View Full Code Here

      throw new HandlerSocketException("Empty connections");
    }

    boolean result = true;
    for (Session session : sessionList) {
      Command cmd = this.commandFactory.createOpenIndexCommand(String
          .valueOf(indexId), dbname, tableName, indexName, columns, fcolumns);
      session.write(cmd);
      this.awaitResponse(cmd);
      result = result && cmd.getResponseStatus() == 0;
    }
    return result;

  }
View Full Code Here

TOP

Related Classes of com.google.code.hs4j.Command

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.