blob: 2292b5b3ef4eda4c45edd6e6574582e7fbbf2898 [file] [log] [blame]
Pavlin Radoslavovdd08e8c2014-08-14 11:02:57 -07001package net.onrc.onos.core.topology;
2
3import net.onrc.onos.api.batchoperation.BatchOperation;
4import net.onrc.onos.api.batchoperation.BatchOperationEntry;
5
6/**
7 * A list of topology operations.
8 */
9public class TopologyBatchOperation extends
10 BatchOperation<BatchOperationEntry<TopologyBatchOperation.Operator, ?>> {
11 /**
12 * The topology operations' operators.
13 */
14 public enum Operator {
15 /**
16 * Adds a new topology event.
17 */
18 ADD,
19
20 /**
21 * Removes an existing topology event.
22 */
23 REMOVE,
24 }
25
26 /**
27 * Adds an add-TopologyEvent operation.
28 *
29 * @param topologyEvent the Topology Event to be added
30 * @return the TopologyBatchOperation object if succeeded, null otherwise
31 */
32 public TopologyBatchOperation addAddTopologyOperation(
33 TopologyEvent topologyEvent) {
34 return (null == super.addOperation(
35 new BatchOperationEntry<Operator, TopologyEvent>(
36 Operator.ADD, topologyEvent)))
37 ? null : this;
38 }
39
40 /**
41 * Adds a remove-TopologyEvent operation.
42 *
43 * @param topologyEvent the Topology Event to be removed
44 * @return the TopologyBatchOperation object if succeeded, null otherwise
45 */
46 public TopologyBatchOperation addRemoveTopologyOperation(
47 TopologyEvent topologyEvent) {
48 return (null == super.addOperation(
49 new BatchOperationEntry<Operator, TopologyEvent>(
50 Operator.REMOVE, topologyEvent)))
51 ? null : this;
52 }
53}