Committed by
Gerrit Code Review
Move inner interfaces to upper level to reduce IntentManager's size
Change-Id: Ice4fba9e0e70f72904fe7dfa9f371f61ca739b48
Showing
3 changed files
with
109 additions
and
52 deletions
1 | +/* | ||
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 | + */ | ||
16 | +package org.onosproject.net.intent.impl; | ||
17 | + | ||
18 | +import org.onosproject.net.flow.FlowRuleBatchOperation; | ||
19 | +import org.onosproject.net.intent.BatchWrite; | ||
20 | +import org.onosproject.net.intent.Intent; | ||
21 | + | ||
22 | +import java.util.Collections; | ||
23 | +import java.util.List; | ||
24 | + | ||
25 | +/** | ||
26 | + * Represents a completed phase of processing an intent. | ||
27 | + */ | ||
28 | +interface CompletedIntentUpdate extends IntentUpdate { | ||
29 | + | ||
30 | + /** | ||
31 | + * Write data to the specified BatchWrite after execution() is called. | ||
32 | + * | ||
33 | + * @param batchWrite batchWrite | ||
34 | + */ | ||
35 | + default void writeAfterExecution(BatchWrite batchWrite) {} | ||
36 | + | ||
37 | + /** | ||
38 | + * Moves forward with the contained current batch. | ||
39 | + * This method is invoked when the batch is successfully completed. | ||
40 | + */ | ||
41 | + default void batchSuccess() {} | ||
42 | + | ||
43 | + /** | ||
44 | + * Reverts the contained batches. | ||
45 | + * This method is invoked when the batch results in failure. | ||
46 | + */ | ||
47 | + default void batchFailed() {} | ||
48 | + | ||
49 | + /** | ||
50 | + * Returns the current FlowRuleBatchOperation. | ||
51 | + * | ||
52 | + * @return current FlowRuleBatchOperation | ||
53 | + */ | ||
54 | + default FlowRuleBatchOperation currentBatch() { | ||
55 | + return null; | ||
56 | + } | ||
57 | + | ||
58 | + /** | ||
59 | + * Returns all of installable intents this instance holds. | ||
60 | + * | ||
61 | + * @return all of installable intents | ||
62 | + */ | ||
63 | + default List<Intent> allInstallables() { | ||
64 | + return Collections.emptyList(); | ||
65 | + } | ||
66 | +} |
... | @@ -483,58 +483,6 @@ public class IntentManager | ... | @@ -483,58 +483,6 @@ public class IntentManager |
483 | } | 483 | } |
484 | } | 484 | } |
485 | 485 | ||
486 | - private interface IntentUpdate { | ||
487 | - | ||
488 | - /** | ||
489 | - * Execute the procedure represented by the instance | ||
490 | - * and generates the next update instance. | ||
491 | - * | ||
492 | - * @return next update | ||
493 | - */ | ||
494 | - default Optional<IntentUpdate> execute() { | ||
495 | - return Optional.empty(); | ||
496 | - } | ||
497 | - | ||
498 | - /** | ||
499 | - * Write data to the specified BatchWrite before execution() is called. | ||
500 | - * | ||
501 | - * @param batchWrite batchWrite | ||
502 | - */ | ||
503 | - default void writeBeforeExecution(BatchWrite batchWrite) {} | ||
504 | - } | ||
505 | - | ||
506 | - private interface CompletedIntentUpdate extends IntentUpdate { | ||
507 | - | ||
508 | - /** | ||
509 | - * Write data to the specified BatchWrite after execution() is called. | ||
510 | - * | ||
511 | - * @param batchWrite batchWrite | ||
512 | - */ | ||
513 | - default void writeAfterExecution(BatchWrite batchWrite) {} | ||
514 | - | ||
515 | - default void batchSuccess() {} | ||
516 | - | ||
517 | - default void batchFailed() {} | ||
518 | - | ||
519 | - /** | ||
520 | - * Returns the current FlowRuleBatchOperation. | ||
521 | - * | ||
522 | - * @return current FlowRuleBatchOperation | ||
523 | - */ | ||
524 | - default FlowRuleBatchOperation currentBatch() { | ||
525 | - return null; | ||
526 | - } | ||
527 | - | ||
528 | - /** | ||
529 | - * Returns all of installable intents this instance holds. | ||
530 | - * | ||
531 | - * @return all of installable intents | ||
532 | - */ | ||
533 | - default List<Intent> allInstallables() { | ||
534 | - return Collections.emptyList(); | ||
535 | - } | ||
536 | - } | ||
537 | - | ||
538 | private class InstallRequest implements IntentUpdate { | 486 | private class InstallRequest implements IntentUpdate { |
539 | 487 | ||
540 | private final Intent intent; | 488 | private final Intent intent; | ... | ... |
1 | +/* | ||
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 | + */ | ||
16 | +package org.onosproject.net.intent.impl; | ||
17 | + | ||
18 | +import org.onosproject.net.intent.BatchWrite; | ||
19 | + | ||
20 | +import java.util.Optional; | ||
21 | + | ||
22 | +/** | ||
23 | + * Represents a phase of processing an intent. | ||
24 | + */ | ||
25 | +interface IntentUpdate { | ||
26 | + | ||
27 | + /** | ||
28 | + * Execute the procedure represented by the instance | ||
29 | + * and generates the next update instance. | ||
30 | + * | ||
31 | + * @return next update | ||
32 | + */ | ||
33 | + default Optional<IntentUpdate> execute() { | ||
34 | + return Optional.empty(); | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * Write data to the specified BatchWrite before execution() is called. | ||
39 | + * | ||
40 | + * @param batchWrite batchWrite | ||
41 | + */ | ||
42 | + default void writeBeforeExecution(BatchWrite batchWrite) {} | ||
43 | +} |
-
Please register or login to post a comment