Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.intent; |
| 2 | |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 3 | import org.onlab.onos.store.Store; |
| 4 | |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame^] | 5 | import java.util.List; |
| 6 | |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 7 | /** |
| 8 | * Manages inventory of end-station intents; not intended for direct use. |
| 9 | */ |
| 10 | public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> { |
| 11 | |
| 12 | /** |
| 13 | * Creates a new intent. |
| 14 | * |
| 15 | * @param intent intent |
| 16 | * @return appropriate event or null if no change resulted |
| 17 | */ |
| 18 | IntentEvent createIntent(Intent intent); |
| 19 | |
| 20 | /** |
| 21 | * Removes the specified intent from the inventory. |
| 22 | * |
| 23 | * @param intentId intent identification |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame^] | 24 | * @return removed state transition event or null if intent was not found |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 25 | */ |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame^] | 26 | IntentEvent removeIntent(IntentId intentId); |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 27 | |
| 28 | /** |
| 29 | * Returns the number of intents in the store. |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 30 | */ |
| 31 | long getIntentCount(); |
| 32 | |
| 33 | /** |
| 34 | * Returns a collection of all intents in the store. |
| 35 | * |
| 36 | * @return iterable collection of all intents |
| 37 | */ |
| 38 | Iterable<Intent> getIntents(); |
| 39 | |
| 40 | /** |
| 41 | * Returns the intent with the specified identifer. |
| 42 | * |
| 43 | * @param intentId intent identification |
| 44 | * @return intent or null if not found |
| 45 | */ |
| 46 | Intent getIntent(IntentId intentId); |
| 47 | |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame^] | 48 | /** |
| 49 | * Returns the state of the specified intent. |
| 50 | * |
| 51 | * @param intentId intent identification |
| 52 | * @return current intent state |
| 53 | */ |
| 54 | IntentState getIntentState(IntentId intentId); |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 55 | |
| 56 | /** |
| 57 | * Sets the state of the specified intent to the new state. |
| 58 | * |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame^] | 59 | * @param intent intent whose state is to be changed |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 60 | * @param newState new state |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame^] | 61 | * @return state transition event |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 62 | */ |
| 63 | IntentEvent setState(Intent intent, IntentState newState); |
| 64 | |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame^] | 65 | /** |
| 66 | * Adds the installable intents which resulted from compilation of the |
| 67 | * specified original intent. |
| 68 | * |
| 69 | * @param intentId original intent identifier |
| 70 | * @param installableIntents compiled installable intents |
| 71 | * @return compiled state transition event |
| 72 | */ |
| 73 | IntentEvent addInstallableIntents(IntentId intentId, |
| 74 | List<InstallableIntent> installableIntents); |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 75 | |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame^] | 76 | /** |
| 77 | * Returns the list of the installable events associated with the specified |
| 78 | * original intent. |
| 79 | * |
| 80 | * @param intentId original intent identifier |
| 81 | * @return compiled installable intents |
| 82 | */ |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 83 | List<InstallableIntent> getInstallableIntents(IntentId intentId); |
| 84 | |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame^] | 85 | // TODO: this should be triggered from with the store as a result of removeIntent call |
| 86 | |
| 87 | /** |
| 88 | * Removes any installable intents which resulted from compilation of the |
| 89 | * specified original intent. |
| 90 | * |
| 91 | * @param intentId original intent identifier |
| 92 | * @return compiled state transition event |
| 93 | */ |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 94 | void removeInstalledIntents(IntentId intentId); |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame^] | 95 | |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 96 | } |