blob: 95e6e08f68b7c03bfbb157ba7ba23202cc2ea980 [file] [log] [blame]
jaegonkim6a7b5242018-09-12 23:09:42 +09001/*
2 * Copyright 2018-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.workflow.api;
17
18import java.net.URI;
19import java.util.Set;
20
21/**
22 * An interface representing workflow.
23 */
24public interface Workflow {
25
26 /**
27 * Id of workflow.
28 * @return id
29 */
30 URI id();
31
32 /**
33 * Returns init worklet.
34 * @param context workflow context
35 * @return init worklet
36 * @throws WorkflowException workflow exception
37 */
38 Worklet init(WorkflowContext context) throws WorkflowException;
39
40 /**
41 * Returns next worklet.
42 * @param context workflow context
43 * @return next worklet
44 * @throws WorkflowException workflow exception
45 */
46 Worklet next(WorkflowContext context) throws WorkflowException;
47
48 /**
49 * Returns instance of worklet.
50 * @param workletType class name of worklet
51 * @return instance of worklet
52 * @throws WorkflowException workflow exception
53 */
54 Worklet getWorkletInstance(String workletType) throws WorkflowException;
55
56 /**
57 * Builds workflow context.
58 * @param workplace workplace of system workflow
59 * @param data data model of system workflow context
60 * @return workflow context
61 * @throws WorkflowException workflow exception
62 */
63 WorkflowContext buildContext(Workplace workplace, DataModelTree data) throws WorkflowException;
64
65 /**
66 * Builds system workflow context.
67 * @param workplace workplace of system workflow
68 * @param data data model of system workflow context
69 * @return system workflow context
70 * @throws WorkflowException workflow exception
71 */
72 WorkflowContext buildSystemContext(Workplace workplace, DataModelTree data) throws WorkflowException;
73
74 /**
75 * Returns workflow attributes.
76 * @return attributes
77 */
78 Set<WorkflowAttribute> attributes();
79}