blob: b9fb1333ef5020714b242649eb95148bf0e25af5 [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
18
19import org.onosproject.event.Event;
20
21/**
22 * Abstract class for worklet.
23 */
24public abstract class AbstractWorklet implements Worklet {
25
26 @Override
27 public String tag() {
28 return this.getClass().getName();
29 }
30
31 @Override
32 public boolean isCompleted(WorkflowContext context, Event event)throws WorkflowException {
33 throw new WorkflowException("(" + tag() + ").isCompleted should not be called");
34 }
35
36 @Override
37 public boolean isNext(WorkflowContext context) throws WorkflowException {
38 throw new WorkflowException("(" + tag() + ").isNext should not be called");
39 }
40
41 @Override
42 public void timeout(WorkflowContext context) throws WorkflowException {
43 throw new WorkflowException("Timeout happened");
44 }
45}
46