Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.intent; |
| 2 | |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 3 | |
Thomas Vachuska | 10d4abc | 2014-10-21 12:47:26 -0700 | [diff] [blame^] | 4 | import java.util.List; |
| 5 | |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 6 | /** |
| 7 | * Service for application submitting or withdrawing their intents. |
| 8 | */ |
| 9 | public interface IntentService { |
| 10 | /** |
| 11 | * Submits an intent into the system. |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame] | 12 | * <p/> |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 13 | * This is an asynchronous request meaning that any compiling or |
| 14 | * installation activities may be done at later time. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 15 | * |
| 16 | * @param intent intent to be submitted |
| 17 | */ |
| 18 | void submit(Intent intent); |
| 19 | |
| 20 | /** |
| 21 | * Withdraws an intent from the system. |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame] | 22 | * <p/> |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 23 | * This is an asynchronous request meaning that the environment may be |
| 24 | * affected at later time. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 25 | * |
| 26 | * @param intent intent to be withdrawn |
| 27 | */ |
| 28 | void withdraw(Intent intent); |
| 29 | |
| 30 | /** |
| 31 | * Submits a batch of submit & withdraw operations. Such a batch is |
| 32 | * assumed to be processed together. |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame] | 33 | * <p/> |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 34 | * This is an asynchronous request meaning that the environment may be |
| 35 | * affected at later time. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 36 | * |
| 37 | * @param operations batch of intent operations |
| 38 | */ |
| 39 | void execute(IntentOperations operations); |
| 40 | |
| 41 | /** |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 42 | * Returns an iterable of intents currently in the system. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 43 | * |
| 44 | * @return set of intents |
| 45 | */ |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 46 | Iterable<Intent> getIntents(); |
| 47 | |
| 48 | /** |
| 49 | * Returns the number of intents currently in the system. |
| 50 | * |
| 51 | * @return number of intents |
| 52 | */ |
| 53 | long getIntentCount(); |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 54 | |
| 55 | /** |
| 56 | * Retrieves the intent specified by its identifier. |
| 57 | * |
| 58 | * @param id intent identifier |
| 59 | * @return the intent or null if one with the given identifier is not found |
| 60 | */ |
| 61 | Intent getIntent(IntentId id); |
| 62 | |
| 63 | /** |
| 64 | * Retrieves the state of an intent by its identifier. |
| 65 | * |
| 66 | * @param id intent identifier |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 67 | * @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] | 68 | * found |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 69 | */ |
| 70 | IntentState getIntentState(IntentId id); |
| 71 | |
| 72 | /** |
Thomas Vachuska | 10d4abc | 2014-10-21 12:47:26 -0700 | [diff] [blame^] | 73 | * Returns the list of the installable events associated with the specified |
| 74 | * top-level intent. |
| 75 | * |
| 76 | * @param intentId top-level intent identifier |
| 77 | * @return compiled installable intents |
| 78 | */ |
| 79 | List<Intent> getInstallableIntents(IntentId intentId); |
| 80 | |
| 81 | /** |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 82 | * Adds the specified listener for intent events. |
| 83 | * |
| 84 | * @param listener listener to be added |
| 85 | */ |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 86 | void addListener(IntentListener listener); |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 87 | |
| 88 | /** |
| 89 | * Removes the specified listener for intent events. |
| 90 | * |
| 91 | * @param listener listener to be removed |
| 92 | */ |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 93 | void removeListener(IntentListener listener); |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 94 | } |