Simon Hunt | f844f63 | 2015-05-20 19:06:35 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Open Networking Laboratory |
| 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 | */ |
| 17 | |
| 18 | package org.onosproject.cord.gui.model; |
| 19 | |
| 20 | |
| 21 | import com.fasterxml.jackson.databind.node.ObjectNode; |
| 22 | |
| 23 | /** |
| 24 | * Designates a specific instance of an XOS function. |
| 25 | */ |
Simon Hunt | 09a32db | 2015-05-21 15:00:42 -0700 | [diff] [blame] | 26 | public interface XosFunction { |
Simon Hunt | f844f63 | 2015-05-20 19:06:35 -0700 | [diff] [blame] | 27 | |
| 28 | /** |
| 29 | * Returns the descriptor for this function. |
| 30 | * |
Simon Hunt | 6c2555b | 2015-05-21 18:17:56 -0700 | [diff] [blame] | 31 | * @return function descriptor |
Simon Hunt | f844f63 | 2015-05-20 19:06:35 -0700 | [diff] [blame] | 32 | */ |
| 33 | XosFunctionDescriptor descriptor(); |
| 34 | |
| 35 | /** |
Simon Hunt | 6c2555b | 2015-05-21 18:17:56 -0700 | [diff] [blame] | 36 | * Applies a parameter change for the given user. |
Simon Hunt | f844f63 | 2015-05-20 19:06:35 -0700 | [diff] [blame] | 37 | * |
Simon Hunt | 6c2555b | 2015-05-21 18:17:56 -0700 | [diff] [blame] | 38 | * @param user user to apply change to |
| 39 | * @param param parameter name |
| 40 | * @param value new parameter value |
Simon Hunt | f844f63 | 2015-05-20 19:06:35 -0700 | [diff] [blame] | 41 | */ |
Simon Hunt | 6c2555b | 2015-05-21 18:17:56 -0700 | [diff] [blame] | 42 | void applyParam(SubscriberUser user, String param, String value); |
| 43 | |
| 44 | /** |
| 45 | * Create an initialized memento. |
| 46 | * If the function maintains no state per user, return null. |
| 47 | * |
| 48 | * @return a new memento |
| 49 | */ |
| 50 | Memento createMemento(); |
| 51 | |
| 52 | /** |
| 53 | * Internal state memento. |
| 54 | */ |
| 55 | interface Memento { |
| 56 | /** |
| 57 | * Returns a JSON representation of this memento. |
| 58 | * |
| 59 | * @return memento state as object node |
| 60 | */ |
| 61 | ObjectNode toObjectNode(); |
| 62 | } |
Simon Hunt | f844f63 | 2015-05-20 19:06:35 -0700 | [diff] [blame] | 63 | } |
| 64 | |