Exemplo n.º 1
0
  private long getCurrentStreamPosition(IBoxEventsManager eventsManager, long streamPosition)
      throws BoxRestException, BoxServerException, AuthFatalFailureException {

    final BoxEventRequestObject requestObject =
        BoxEventRequestObject.getEventsRequestObject(streamPosition);
    final BoxEventCollection events = eventsManager.getEvents(requestObject);
    streamPosition = events.getNextStreamPosition();
    return streamPosition;
  }
Exemplo n.º 2
0
  private BoxRealTimeServer getBoxRealTimeServer(
      long currentStreamPosition, IBoxEventsManager eventsManager)
      throws BoxRestException, BoxServerException, AuthFatalFailureException {

    final BoxEventRequestObject optionsRequest =
        BoxEventRequestObject.getEventsRequestObject(currentStreamPosition);

    final BoxCollection eventOptions = eventsManager.getEventOptions(optionsRequest);
    final ArrayList<BoxTypedObject> entries = eventOptions.getEntries();

    // validate options
    if (entries == null || entries.size() < 1 || !(entries.get(0) instanceof BoxRealTimeServer)) {

      throw new RuntimeCamelException(
          "No Real Time Server from event options for " + cachedBoxClient);
    }

    return (BoxRealTimeServer) entries.get(0);
  }