Search in sources :

Example 1 with DefaultWorkplace

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

the class WorkflowManager method createWorkplace.

@Override
public void createWorkplace(WorkplaceDescription wpDesc) throws WorkflowException {
    log.info("createWorkplace: {}", wpDesc);
    JsonNode root;
    if (wpDesc.data().isPresent()) {
        root = wpDesc.data().get();
    } else {
        root = JsonNodeFactory.instance.objectNode();
    }
    DefaultWorkplace workplace = new DefaultWorkplace(wpDesc.name(), new JsonDataModelTree(root));
    workplaceStore.registerWorkplace(wpDesc.name(), workplace);
}
Also used : DefaultWorkplace(org.onosproject.workflow.api.DefaultWorkplace) JsonDataModelTree(org.onosproject.workflow.api.JsonDataModelTree) JsonNode(com.fasterxml.jackson.databind.JsonNode)

Example 2 with DefaultWorkplace

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

the class WorkFlowEngine method activate.

@Activate
public void activate() {
    appId = coreService.registerApplication(APPID);
    workplaceStore.setDelegate(workplaceStoreDelegate);
    localNodeId = clusterService.getLocalNode().id();
    leadershipService.runForLeadership(appId.name());
    workflowBatchExecutor = newSingleThreadExecutor(groupedThreads("onos/workflow", "workflow-batch", log));
    workflowExecutor = newFixedThreadPool(DEFAULT_WORKFLOW_THREADS, groupedThreads("onos/workflow-exec", "worker-%d", log));
    handlerTaskBatchExecutor = newSingleThreadExecutor(groupedThreads("onos/workflow", "handlertask-batch", log));
    handlerTaskExecutor = newFixedThreadPool(DEFAULT_EVENTTASK_THREADS, groupedThreads("onos/handlertask-exec", "worker-%d", log));
    eventMapTriggerExecutor = newSingleThreadScheduledExecutor(groupedThreads("onos/workflow-engine", "eventmap-trigger-executor"));
    (new WorkplaceWorkflow(this, workflowStore)).registerWorkflows();
    JsonDataModelTree data = new JsonDataModelTree(JsonNodeFactory.instance.objectNode());
    workplaceStore.registerWorkplace(Workplace.SYSTEM_WORKPLACE, new DefaultWorkplace(Workplace.SYSTEM_WORKPLACE, data));
    log.info("Started");
}
Also used : DefaultWorkplace(org.onosproject.workflow.api.DefaultWorkplace) JsonDataModelTree(org.onosproject.workflow.api.JsonDataModelTree) Activate(org.osgi.service.component.annotations.Activate)

Aggregations

DefaultWorkplace (org.onosproject.workflow.api.DefaultWorkplace)2 JsonDataModelTree (org.onosproject.workflow.api.JsonDataModelTree)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 Activate (org.osgi.service.component.annotations.Activate)1