use of org.onosproject.workflow.api.Workplace in project onos by opennetworkinglab.
the class WorkplaceStoreCommand method printAllWorkplace.
/**
* Prints all workplaces.
*/
private void printAllWorkplace() {
WorkplaceStore workplaceStore = get(WorkplaceStore.class);
for (Workplace workplace : workplaceStore.getWorkplaces()) {
print(getWorkplaceString(workplace));
printWorkplaceContexts(workplaceStore, workplace.name());
}
}
use of org.onosproject.workflow.api.Workplace in project onos by opennetworkinglab.
the class WorkplaceStoreCommand method printWorkplace.
/**
* Prints workplace.
* @param name workplace name
*/
private void printWorkplace(String name) {
WorkplaceStore workplaceStore = get(WorkplaceStore.class);
Workplace workplace = workplaceStore.getWorkplace(name);
if (Objects.isNull(workplace)) {
print("Not existing workplace " + name);
return;
}
print(getWorkplaceString(workplace));
printWorkplaceContexts(workplaceStore, workplace.name());
}
use of org.onosproject.workflow.api.Workplace in project onos by opennetworkinglab.
the class DistributedWorkplaceStore method activate.
@Activate
public void activate() {
appId = coreService.registerApplication("org.onosproject.workplacestore");
log.info("appId=" + appId);
KryoNamespace workplaceNamespace = KryoNamespace.newBuilder().register(KryoNamespaces.API).register(WorkflowData.class).register(Workplace.class).register(DefaultWorkplace.class).register(WorkflowContext.class).register(DefaultWorkflowContext.class).register(SystemWorkflowContext.class).register(WorkflowState.class).register(ProgramCounter.class).register(DataModelTree.class).register(JsonDataModelTree.class).register(List.class).register(ArrayList.class).register(JsonNode.class).register(ObjectNode.class).register(TextNode.class).register(LinkedHashMap.class).register(ArrayNode.class).register(BaseJsonNode.class).register(BigIntegerNode.class).register(BinaryNode.class).register(BooleanNode.class).register(ContainerNode.class).register(DecimalNode.class).register(DoubleNode.class).register(FloatNode.class).register(IntNode.class).register(JsonNodeType.class).register(LongNode.class).register(MissingNode.class).register(NullNode.class).register(NumericNode.class).register(POJONode.class).register(ShortNode.class).register(ValueNode.class).register(JsonNodeCreator.class).register(JsonNodeFactory.class).build();
localWorkplaceMap.clear();
workplaceMap = storageService.<String, WorkflowData>consistentMapBuilder().withSerializer(Serializer.using(workplaceNamespace)).withName("workplace-map").withApplicationId(appId).build();
workplaceMap.addListener(workplaceMapEventListener);
localContextMap.clear();
contextMap = storageService.<String, WorkflowData>consistentMapBuilder().withSerializer(Serializer.using(workplaceNamespace)).withName("workflow-context-map").withApplicationId(appId).build();
contextMap.addListener(contextMapEventListener);
workplaceMapEventListener.syncLocal();
contextMapEventListener.syncLocal();
log.info("Started");
}
use of org.onosproject.workflow.api.Workplace in project onos by opennetworkinglab.
the class WorkflowManager method invokeWorkflow.
@Override
public void invokeWorkflow(JsonNode worklowDescJson) throws WorkflowException {
log.info("invokeWorkflow: {}", worklowDescJson);
Workplace workplace = workplaceStore.getWorkplace(Workplace.SYSTEM_WORKPLACE);
if (Objects.isNull(workplace)) {
throw new WorkflowException("Invalid system workplace");
}
Workflow workflow = workflowStore.get(URI.create(worklowDescJson.get("id").asText()));
if (Objects.isNull(workflow)) {
throw new WorkflowException("Invalid Workflow");
}
checkWorkflowDataModelSchema(workflow, worklowDescJson);
Workflow wfCreationWf = workflowStore.get(URI.create(WorkplaceWorkflow.WF_CREATE_WORKFLOW));
if (Objects.isNull(wfCreationWf)) {
throw new WorkflowException("Invalid workflow " + WorkplaceWorkflow.WF_CREATE_WORKFLOW);
}
WorkflowContext context = wfCreationWf.buildSystemContext(workplace, new JsonDataModelTree(worklowDescJson));
workflowExecutionService.execInitWorklet(context);
}
Aggregations