Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 1 | /* |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 2 | * Copyright 2014 Open Networking Laboratory |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 3 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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 |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 7 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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. |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 15 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.intent; |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 17 | |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 18 | |
Thomas Vachuska | 10d4abc | 2014-10-21 12:47:26 -0700 | [diff] [blame] | 19 | import java.util.List; |
| 20 | |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 21 | /** |
| 22 | * Service for application submitting or withdrawing their intents. |
| 23 | */ |
| 24 | public interface IntentService { |
| 25 | /** |
| 26 | * Submits an intent into the system. |
Thomas Vachuska | 4b42077 | 2014-10-30 16:46:17 -0700 | [diff] [blame] | 27 | * <p> |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 28 | * This is an asynchronous request meaning that any compiling or |
| 29 | * installation activities may be done at later time. |
Thomas Vachuska | 4b42077 | 2014-10-30 16:46:17 -0700 | [diff] [blame] | 30 | * </p> |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 31 | * @param intent intent to be submitted |
| 32 | */ |
| 33 | void submit(Intent intent); |
| 34 | |
| 35 | /** |
| 36 | * Withdraws an intent from the system. |
Thomas Vachuska | 4b42077 | 2014-10-30 16:46:17 -0700 | [diff] [blame] | 37 | * <p> |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 38 | * This is an asynchronous request meaning that the environment may be |
| 39 | * affected at later time. |
Thomas Vachuska | 4b42077 | 2014-10-30 16:46:17 -0700 | [diff] [blame] | 40 | * </p> |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 41 | * @param intent intent to be withdrawn |
| 42 | */ |
| 43 | void withdraw(Intent intent); |
| 44 | |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 45 | /** |
| 46 | * Replaces the specified intent with a new one. |
| 47 | * |
| 48 | * @param oldIntentId identifier of the old intent being replaced |
| 49 | * @param newIntent new intent replacing the old one |
| 50 | */ |
Brian O'Connor | ea4d7d1 | 2015-01-28 16:37:46 -0800 | [diff] [blame] | 51 | @Deprecated |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 52 | void replace(IntentId oldIntentId, Intent newIntent); |
Thomas Vachuska | 1fb982f | 2014-10-22 14:09:17 -0700 | [diff] [blame] | 53 | |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 54 | /** |
| 55 | * Submits a batch of submit & withdraw operations. Such a batch is |
| 56 | * assumed to be processed together. |
Thomas Vachuska | 4b42077 | 2014-10-30 16:46:17 -0700 | [diff] [blame] | 57 | * <p> |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 58 | * This is an asynchronous request meaning that the environment may be |
| 59 | * affected at later time. |
Thomas Vachuska | 4b42077 | 2014-10-30 16:46:17 -0700 | [diff] [blame] | 60 | * </p> |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 61 | * @param operations batch of intent operations |
| 62 | */ |
Brian O'Connor | ea4d7d1 | 2015-01-28 16:37:46 -0800 | [diff] [blame] | 63 | @Deprecated |
Brian O'Connor | fa81eae | 2014-10-30 13:20:05 -0700 | [diff] [blame] | 64 | void execute(IntentOperations operations); |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 65 | |
| 66 | /** |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 67 | * Returns an iterable of intents currently in the system. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 68 | * |
| 69 | * @return set of intents |
| 70 | */ |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 71 | Iterable<Intent> getIntents(); |
| 72 | |
| 73 | /** |
| 74 | * Returns the number of intents currently in the system. |
| 75 | * |
| 76 | * @return number of intents |
| 77 | */ |
| 78 | long getIntentCount(); |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 79 | |
| 80 | /** |
| 81 | * Retrieves the intent specified by its identifier. |
| 82 | * |
| 83 | * @param id intent identifier |
| 84 | * @return the intent or null if one with the given identifier is not found |
| 85 | */ |
| 86 | Intent getIntent(IntentId id); |
| 87 | |
| 88 | /** |
| 89 | * Retrieves the state of an intent by its identifier. |
| 90 | * |
| 91 | * @param id intent identifier |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 92 | * @return the intent state or null if one with the given identifier is not |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame] | 93 | * found |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 94 | */ |
| 95 | IntentState getIntentState(IntentId id); |
| 96 | |
| 97 | /** |
Thomas Vachuska | 10d4abc | 2014-10-21 12:47:26 -0700 | [diff] [blame] | 98 | * Returns the list of the installable events associated with the specified |
| 99 | * top-level intent. |
| 100 | * |
| 101 | * @param intentId top-level intent identifier |
| 102 | * @return compiled installable intents |
| 103 | */ |
| 104 | List<Intent> getInstallableIntents(IntentId intentId); |
| 105 | |
| 106 | /** |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 107 | * Adds the specified listener for intent events. |
| 108 | * |
| 109 | * @param listener listener to be added |
| 110 | */ |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 111 | void addListener(IntentListener listener); |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 112 | |
| 113 | /** |
| 114 | * Removes the specified listener for intent events. |
| 115 | * |
| 116 | * @param listener listener to be removed |
| 117 | */ |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 118 | void removeListener(IntentListener listener); |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 119 | } |