public static JSONObject convertToJson()

in tez-plugins/tez-protobuf-history-plugin/src/main/java/org/apache/tez/dag/history/logging/proto/HistoryEventProtoJsonConversion.java [44:113]


  public static JSONObject convertToJson(HistoryEventProto historyEvent) throws JSONException {
    JSONObject jsonObject = null;

    switch (historyEvent.getEventType()) {
    case "APP_LAUNCHED":
      jsonObject = convertAppLaunchedEvent(historyEvent);
      break;
    case "AM_LAUNCHED":
      jsonObject = convertAMLaunchedEvent(historyEvent);
      break;
    case "AM_STARTED":
      jsonObject = convertAMStartedEvent(historyEvent);
      break;
    case "CONTAINER_LAUNCHED":
      jsonObject = convertContainerLaunchedEvent(historyEvent);
      break;
    case "CONTAINER_STOPPED":
      jsonObject = convertContainerStoppedEvent(historyEvent);
      break;
    case "DAG_SUBMITTED":
      jsonObject = convertDAGSubmittedEvent(historyEvent);
      break;
    case "DAG_INITIALIZED":
      jsonObject = convertDAGInitializedEvent(historyEvent);
      break;
    case "DAG_STARTED":
      jsonObject = convertDAGStartedEvent(historyEvent);
      break;
    case "DAG_FINISHED":
      jsonObject = convertDAGFinishedEvent(historyEvent);
      break;
    case "VERTEX_INITIALIZED":
      jsonObject = convertVertexInitializedEvent(historyEvent);
      break;
    case "VERTEX_STARTED":
      jsonObject = convertVertexStartedEvent(historyEvent);
      break;
    case "VERTEX_FINISHED":
      jsonObject = convertVertexFinishedEvent(historyEvent);
      break;
    case "TASK_STARTED":
      jsonObject = convertTaskStartedEvent(historyEvent);
      break;
    case "TASK_FINISHED":
      jsonObject = convertTaskFinishedEvent(historyEvent);
      break;
    case "TASK_ATTEMPT_STARTED":
      jsonObject = convertTaskAttemptStartedEvent(historyEvent);
      break;
    case "TASK_ATTEMPT_FINISHED":
      jsonObject = convertTaskAttemptFinishedEvent(historyEvent);
      break;
    case "VERTEX_CONFIGURE_DONE":
      jsonObject = convertVertexReconfigureDoneEvent(historyEvent);
      break;
    case "DAG_RECOVERED":
      jsonObject = convertDAGRecoveredEvent(historyEvent);
      break;
    case "VERTEX_COMMIT_STARTED":
    case "VERTEX_GROUP_COMMIT_STARTED":
    case "VERTEX_GROUP_COMMIT_FINISHED":
    case "DAG_COMMIT_STARTED":
      throw new UnsupportedOperationException(
          "Invalid Event, does not support history" + ", eventType=" + historyEvent.getEventType());
    default:
      throw new UnsupportedOperationException(
          "Unhandled Event" + ", eventType=" + historyEvent.getEventType());
    }
    return jsonObject;
  }