jaegonkim | 6a7b524 | 2018-09-12 23:09:42 +0900 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.workflow.api; |
| 17 | |
| 18 | import org.onosproject.store.Store; |
| 19 | import org.onosproject.store.service.StorageException; |
| 20 | |
| 21 | import java.util.Collection; |
| 22 | |
| 23 | /** |
| 24 | * Interface for workplace store. |
| 25 | */ |
| 26 | public interface WorkplaceStore extends Store<WorkflowDataEvent, WorkplaceStoreDelegate> { |
| 27 | |
| 28 | /** |
| 29 | * Registers workplace on workplace store. |
| 30 | * @param name workplace name to register |
| 31 | * @param workplace workplace |
| 32 | * @throws StorageException storage exception |
| 33 | */ |
| 34 | void registerWorkplace(String name, Workplace workplace) throws StorageException; |
| 35 | |
| 36 | /** |
| 37 | * Removes workplace from workplace store. |
| 38 | * @param name workplace name to remove |
| 39 | * @throws StorageException storage exception |
| 40 | */ |
| 41 | void removeWorkplace(String name) throws StorageException; |
| 42 | |
| 43 | /** |
| 44 | * Gets workplace on workplace store. |
| 45 | * @param name workplace name to get |
| 46 | * @return workplace |
| 47 | * @throws StorageException storage exception |
| 48 | */ |
| 49 | Workplace getWorkplace(String name) throws StorageException; |
| 50 | |
| 51 | /** |
| 52 | * Commits workplace on workplace store. |
| 53 | * @param name workplace name to commit |
| 54 | * @param workplace workplace to commit |
| 55 | * @param handleEvent whether or not to handle workplace(workflow data) event |
| 56 | * @throws StorageException storage exception |
| 57 | */ |
| 58 | void commitWorkplace(String name, Workplace workplace, boolean handleEvent) throws StorageException; |
| 59 | |
| 60 | /** |
| 61 | * Gets all workplaces from workplace store. |
| 62 | * @return collection of workplace |
| 63 | * @throws StorageException storage exception |
| 64 | */ |
| 65 | Collection<Workplace> getWorkplaces() throws StorageException; |
| 66 | |
| 67 | /** |
| 68 | * Registers workflow context on workplace store. |
| 69 | * @param name workflow context name to register |
| 70 | * @param context workflow context to register |
| 71 | * @throws StorageException storage exception |
| 72 | */ |
| 73 | void registerContext(String name, WorkflowContext context) throws StorageException; |
| 74 | |
| 75 | /** |
| 76 | * Removes workflow context from workplace store. |
| 77 | * @param name workflow context name |
| 78 | * @throws StorageException storage exception |
| 79 | */ |
| 80 | void removeContext(String name) throws StorageException; |
| 81 | |
| 82 | /** |
| 83 | * Gets workflow context with name. |
| 84 | * @param name workflow context name to get |
| 85 | * @return workflow context |
| 86 | * @throws StorageException storage exception |
| 87 | */ |
| 88 | WorkflowContext getContext(String name) throws StorageException; |
| 89 | |
| 90 | /** |
| 91 | * Commits workflow context on workplace store. |
| 92 | * @param name workflow context name to commit |
| 93 | * @param context workflow context to commit |
| 94 | * @param handleEvent whether or not to handle workflow context(workflow data) event |
| 95 | * @throws StorageException storage exception |
| 96 | */ |
| 97 | void commitContext(String name, WorkflowContext context, boolean handleEvent) throws StorageException; |
| 98 | |
| 99 | /** |
| 100 | * Gets all workflow context from workplace store. |
| 101 | * @return collection of workflow context |
| 102 | * @throws StorageException storage exception |
| 103 | */ |
| 104 | Collection<WorkflowContext> getContexts() throws StorageException; |
| 105 | |
| 106 | /** |
| 107 | * Gets workflow contexts belonging to a workplace. |
| 108 | * @param workplaceName workplace name |
| 109 | * @return collection of workflow contexts belonging to a workplace |
| 110 | */ |
| 111 | Collection<WorkflowContext> getWorkplaceContexts(String workplaceName); |
| 112 | |
| 113 | /** |
| 114 | * Removes all workflow contexts beloinging to a workplace. |
| 115 | * @param workplaceName workplace name |
| 116 | */ |
| 117 | void removeWorkplaceContexts(String workplaceName); |
| 118 | } |