Package com.kurento.kmf.content

Examples of com.kurento.kmf.content.ContentCommandResult


  private void internalProcessCommandExecution(AsyncContext asyncCtx,
      JsonRpcRequest message) {
    Assert.notNull(message.getParams(), "", 1); // TODO
    Assert.notNull(message.getParams().getCommand(), "", 1); // TODO
    ContentCommandResult result = null;
    try {
      result = interalRawCallToOnContentCommand(new ContentCommand(
          message.getParams().getCommand().getType(), message
              .getParams().getCommand().getData()));

    } catch (Throwable t) {
      getLogger().error(
          "Error invoking onContentCommand on handler. Cause "
              + t.getMessage(), t);

      int errorCode = 1; // TODO: define error code
      if (t instanceof KurentoMediaFrameworkException) {
        errorCode = ((KurentoMediaFrameworkException) t).getCode();
      }

      if (!registered) {
        // An error with a command acting a session creation (e.g.
        // register) makes the session to terminate. This avoids
        // security problems where a client may force and exception, in
        // which case it should not be given access to the session.
        internalTerminateWithError(asyncCtx, errorCode, t.getMessage(),
            message);
      } else {
        // An error executing a command in other scenarion is not
        // considered faltal and the session may continue
        protocolManager.sendJsonError(asyncCtx, JsonRpcResponse
            .newError(errorCode, t.getMessage(), message.getId()));

      }

      callOnUncaughtExceptionThrown(t);
      return;
    }

    try {
      protocolManager.sendJsonAnswer(
          asyncCtx,
          JsonRpcResponse.newExecuteResponse(sessionId,
              result.getResult(), message.getId()));

      registered = true;

    } catch (Throwable t) {
      getLogger()
View Full Code Here


      WebRtcContentSession contentSession, ContentCommand contentCommand)
      throws Exception {
    if (contentCommand.getType().equalsIgnoreCase("calibrate")) {
      pointerDetectorAdvFilter.trackColorFromCalibrationRegion();
    }
    return new ContentCommandResult(contentCommand.getData());
  }
View Full Code Here

      connection.player.stop();
      connection.player.release();
      connection.port.release();
      playersList.remove(0);
    }
    return new ContentCommandResult(contentCommand.getData());
  }
View Full Code Here

      throws Exception {
    EventListener.addEvent();
    if (contentCommand.getType().equalsIgnoreCase("typeKO")) {
      throw new Exception(contentCommand.getData());
    }
    return new ContentCommandResult(contentCommand.getData());
  }
View Full Code Here

      throws Exception {
    EventListener.addEvent();
    if (contentCommand.getType().equalsIgnoreCase("typeKO")) {
      throw new Exception(contentCommand.getData());
    }
    return new ContentCommandResult(contentCommand.getData());
  }
View Full Code Here

    String cmdData = command.getData();
    getLogger().info("onContentCommand: ({}, {})", cmdType, cmdData);

    if (COMMAND_GET_PARTICIPANTS.equalsIgnoreCase(cmdType)) {
      String json = gson.toJson(participants.values());
      return new ContentCommandResult(json);
    } else if (COMMAND_SELECT.equalsIgnoreCase(cmdType)) {
      return new ContentCommandResult(Boolean.toString(selectParticipant(
          session, cmdData)));
    }
    return super.onContentCommand(session, command);
  }
View Full Code Here

    String cmdData = command.getData();
    getLogger().info("onContentCommand: ({}, {})", cmdType, cmdData);

    if (COMMAND_GET_PARTICIPANTS.equalsIgnoreCase(cmdType)) {
      String json = gson.toJson(participants.values());
      return new ContentCommandResult(json);
    } else if (COMMAND_SELECT.equalsIgnoreCase(cmdType)) {
      return new ContentCommandResult(Boolean.toString(selectParticipant(
          session, cmdData)));
    } else if (COMMAND_CONNECT.equalsIgnoreCase(cmdType)) {
      Type listType = new TypeToken<List<String>>() {
      }.getType();
      List<String> idList = gson.fromJson(cmdData, listType);
      if (idList.size() != 2) {
        return new ContentCommandResult(Boolean.FALSE.toString());
      }
      return new ContentCommandResult(
          Boolean.toString(connectParticipant(idList.get(0),
              idList.get(1))));
    }
    return super.onContentCommand(session, command);
  }
View Full Code Here

        for (WebRtcContentSession s : sessions.values()) {
          getLogger().info("---- publishEvent {} ", s.getSessionId());
          s.publishEvent(new ContentEvent("startConn", "startConn"));
        }
      }
      return new ContentCommandResult(result);
    }
    return super.onContentCommand(session, command);
  }
View Full Code Here

      HttpPlayerSession contentSession, ContentCommand contentCommand)
      throws Exception {
    if (contentCommand.getType().equalsIgnoreCase("typeKO")) {
      throw new Exception(contentCommand.getData());
    }
    return new ContentCommandResult(contentCommand.getData());
  }
View Full Code Here

      HttpPlayerSession contentSession, ContentCommand contentCommand)
      throws Exception {
    if (contentCommand.getType().equalsIgnoreCase("typeKO")) {
      throw new Exception(contentCommand.getData());
    }
    return new ContentCommandResult(contentCommand.getData());
  }
View Full Code Here

TOP

Related Classes of com.kurento.kmf.content.ContentCommandResult

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.