Package org.mokai.Message

Examples of org.mokai.Message.Direction


  private void save(Message message) throws StoreException, RejectedException {
    Connection conn = null;

    try {
      conn = dataSource.getConnection();
      Direction direction = message.getDirection();

      // check if the handler supports the message
      if (handler.supportsDirection(direction)) {
        long id = handler.insertMessage(conn, message);
        message.setId(id);
View Full Code Here


    Connection conn = null;

    try {
      conn = dataSource.getConnection();
      Direction direction = message.getDirection();

      // check if the handler supports the message
      if (handler.supportsDirection(direction)) {
        boolean found = handler.updateMessage(conn, message);
        if (!found) {
View Full Code Here

  @Override
  public void updateStatus(MessageCriteria criteria, byte newStatus) throws StoreException {
    if (mongo == null) throw new IllegalStateException("No mongo specified");

    Direction direction = null;
    if (criteria != null) {
      direction = criteria.getDirection();
    }

    try {
View Full Code Here

    if (mongo == null) throw new IllegalStateException("No mongo specified");

    Collection<Message> messages = new ArrayList<Message>();

    // retrieve the direction
    Direction direction = null;
    if (criteria != null) {
      direction = criteria.getDirection();
    }

    try {
      if (direction == null || direction.equals(Direction.TO_CONNECTIONS)) {
        messages.addAll(list(CONNECTIONS_MSGS, criteria));
      }

      if (direction == null || direction.equals(Direction.TO_APPLICATIONS)) {
        messages.addAll(list(APPLICATIONS_MSGS, criteria));
      }

      return messages;
    } catch (Exception e) {
View Full Code Here

      RejectedException, IllegalStateException {

    checkHandlersNotNull();

    // retrieve the direction of the message
    Direction direction = message.getDirection();

    long id = -1;

    // insert the message using one of the handlers
    if (direction.equals(Direction.TO_CONNECTIONS)) {
      id = outboundHandler.insertMessage(conn, message);
    } else if (direction.equals(Direction.TO_APPLICATIONS)) {
      id = inboundHandler.insertMessage(conn, message);
    } else {
      throw new RejectedException("can't save a message with direction: " + direction);
    }
View Full Code Here

      RejectedException, IllegalStateException {

    checkHandlersNotNull();

    // retrieve the direction of the message
    Direction direction = message.getDirection();

    // generate statement and execute
    if (direction.equals(Direction.TO_CONNECTIONS)) {
      return outboundHandler.updateMessage(conn, message);
    } else if (direction.equals(Direction.TO_APPLICATIONS)) {
      return inboundHandler.updateMessage(conn, message);
    } else {
      throw new RejectedException("can't save a message with direction: " + direction);
    }
  }
View Full Code Here

  public final void updateMessagesStatus(Connection conn, MessageCriteria criteria, byte newStatus)
      throws SQLException, IllegalStateException {

    checkHandlersNotNull();

    Direction direction = null;
    if (criteria != null) {
      direction = criteria.getDirection();
    }

    if (direction == null || direction.equals(Direction.TO_CONNECTIONS)) {
      outboundHandler.updateMessagesStatus(conn, criteria, newStatus);
    }

    if (direction == null || direction.equals(Direction.TO_APPLICATIONS)) {
      inboundHandler.updateMessagesStatus(conn, criteria, newStatus);
    }
  }
View Full Code Here

    checkHandlersNotNull();

    Collection<Message> messages = new ArrayList<Message>();

    // retrieve the direction
    Direction direction = null;
    if (criteria != null) {
      direction = criteria.getDirection();
    }

    if (direction == null || direction.equals(Direction.TO_CONNECTIONS) || direction.equals(Direction.UNKNOWN)) {
      messages.addAll(outboundHandler.listMessages(conn, criteria));
    }

    if (direction == null || direction.equals(Direction.TO_APPLICATIONS) || direction.equals(Direction.UNKNOWN)) {
      messages.addAll(inboundHandler.listMessages(conn, criteria));
    }

    return messages;
View Full Code Here

TOP

Related Classes of org.mokai.Message.Direction

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.