Search in sources :

Example 1 with ContextEventMapStore

use of org.onosproject.workflow.api.ContextEventMapStore in project onos by opennetworkinglab.

the class WorkFlowEventMapCommand method doExecute.

@Override
protected void doExecute() {
    if (Objects.isNull(cmd)) {
        error("invalid cmd parameter");
        return;
    }
    ContextEventMapStore store = get(ContextEventMapStore.class);
    try {
        switch(cmd) {
            case PRINT:
                JsonNode tree = store.asJsonTree();
                ObjectMapper mapper = new ObjectMapper();
                try {
                    print(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(tree));
                } catch (JsonProcessingException e) {
                    error("Exception: " + e.getMessage() + ", trace: " + Arrays.asList(e.getStackTrace()));
                }
                break;
            default:
                print("Unsupported cmd: " + cmd);
        }
    } catch (WorkflowException e) {
        error(e.getMessage() + ", trace: " + Arrays.asList(e.getStackTrace()));
    }
}
Also used : ContextEventMapStore(org.onosproject.workflow.api.ContextEventMapStore) WorkflowException(org.onosproject.workflow.api.WorkflowException) JsonNode(com.fasterxml.jackson.databind.JsonNode) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ContextEventMapStore (org.onosproject.workflow.api.ContextEventMapStore)1 WorkflowException (org.onosproject.workflow.api.WorkflowException)1