blob: df0b267572fba5687e90696d038e2c3dacea7daa [file] [log] [blame]
Sho SHIMIZUbdc17e72015-01-27 17:46:41 -08001/*
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 */
16package org.onosproject.net.intent.impl;
17
18import org.onosproject.net.flow.FlowRuleBatchOperation;
19import org.onosproject.net.intent.BatchWrite;
20import org.onosproject.net.intent.Intent;
21
22import java.util.Collections;
23import java.util.List;
Sho SHIMIZU62808d12015-02-03 18:54:39 -080024import java.util.Optional;
Sho SHIMIZUbdc17e72015-01-27 17:46:41 -080025
26/**
27 * Represents a completed phase of processing an intent.
28 */
29interface CompletedIntentUpdate extends IntentUpdate {
30
31 /**
32 * Write data to the specified BatchWrite after execution() is called.
33 *
34 * @param batchWrite batchWrite
35 */
36 default void writeAfterExecution(BatchWrite batchWrite) {}
37
38 /**
39 * Moves forward with the contained current batch.
40 * This method is invoked when the batch is successfully completed.
41 */
42 default void batchSuccess() {}
43
44 /**
45 * Reverts the contained batches.
46 * This method is invoked when the batch results in failure.
47 */
48 default void batchFailed() {}
49
50 /**
51 * Returns the current FlowRuleBatchOperation.
52 *
53 * @return current FlowRuleBatchOperation
54 */
55 default FlowRuleBatchOperation currentBatch() {
56 return null;
57 }
58
59 /**
60 * Returns all of installable intents this instance holds.
61 *
62 * @return all of installable intents
63 */
64 default List<Intent> allInstallables() {
65 return Collections.emptyList();
66 }
Sho SHIMIZU62808d12015-02-03 18:54:39 -080067
68 @Override
69 default Optional<IntentUpdate> execute() {
70 return Optional.empty();
71 }
Sho SHIMIZUbdc17e72015-01-27 17:46:41 -080072}