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