Ray Milkey

Remove some deprecated APIs and warnings from BatchOperationEntry

Change-Id: I44daf9646f6d2a60fd7c0ce96d6692ab8a9cdda2
......@@ -48,16 +48,6 @@ public class BatchOperationEntry<T extends Enum<?>, U> {
*
* @return the target object of this operation
*/
@Deprecated
public U getTarget() {
return target();
}
/**
* Gets the target object of this operation.
*
* @return the target object of this operation
*/
public U target() {
return target;
}
......@@ -67,16 +57,6 @@ public class BatchOperationEntry<T extends Enum<?>, U> {
*
* @return the operator of this operation
*/
@Deprecated
public T getOperator() {
return operator();
}
/**
* Gets the operator of this operation.
*
* @return the operator of this operation
*/
public T operator() {
return operator;
}
......
......@@ -200,18 +200,18 @@ public class FlowRuleManager
FlowRuleOperations.Builder fopsBuilder = FlowRuleOperations.builder();
batch.getOperations().stream().forEach(op -> {
switch (op.getOperator()) {
switch (op.operator()) {
case ADD:
fopsBuilder.add(op.getTarget());
fopsBuilder.add(op.target());
break;
case REMOVE:
fopsBuilder.remove(op.getTarget());
fopsBuilder.remove(op.target());
break;
case MODIFY:
fopsBuilder.modify(op.getTarget());
fopsBuilder.modify(op.target());
break;
default:
log.warn("Unknown flow operation operator: {}", op.getOperator());
log.warn("Unknown flow operation operator: {}", op.operator());
}
}
......@@ -438,25 +438,25 @@ public class FlowRuleManager
// Request has been forwarded to MASTER Node, and was
request.ops().stream().forEach(
op -> {
switch (op.getOperator()) {
switch (op.operator()) {
case ADD:
eventDispatcher.post(
new FlowRuleEvent(
FlowRuleEvent.Type.RULE_ADD_REQUESTED,
op.getTarget()));
op.target()));
break;
case REMOVE:
eventDispatcher.post(
new FlowRuleEvent(
FlowRuleEvent.Type.RULE_REMOVE_REQUESTED,
op.getTarget()));
op.target()));
break;
case MODIFY:
//TODO: do something here when the time comes.
break;
default:
log.warn("Unknown flow operation operator: {}", op.getOperator());
log.warn("Unknown flow operation operator: {}", op.operator());
}
}
);
......
......@@ -384,7 +384,7 @@ public class DistributedFlowRuleStore
log.warn("Failed to storeBatch: {}", e.getMessage());
Set<FlowRule> allFailures = operation.getOperations().stream()
.map(op -> op.getTarget())
.map(op -> op.target())
.collect(Collectors.toSet());
notifyDelegate(FlowRuleBatchEvent.completed(
......@@ -418,9 +418,9 @@ public class DistributedFlowRuleStore
return operation.getOperations().stream().map(
op -> {
StoredFlowEntry entry;
switch (op.getOperator()) {
switch (op.operator()) {
case ADD:
entry = new DefaultFlowEntry(op.getTarget());
entry = new DefaultFlowEntry(op.target());
// always add requested FlowRule

// Note: 2 equal FlowEntry may have different treatment
flowTable.remove(entry.deviceId(), entry);
......@@ -438,7 +438,7 @@ public class DistributedFlowRuleStore
//TODO: figure this out at some point
break;
default:
log.warn("Unknown flow operation operator: {}", op.getOperator());
log.warn("Unknown flow operation operator: {}", op.operator());
}
return null;
}
......@@ -712,15 +712,15 @@ public class DistributedFlowRuleStore
ops.stream().forEach(
op -> {
final FlowRule entry = op.getTarget();
final FlowRule entry = op.target();
final FlowId id = entry.id();
ImmutableList<StoredFlowEntry> original = backupFlowTable.get(id);
List<StoredFlowEntry> list = new ArrayList<>();
if (original != null) {
list.addAll(original);
}
list.remove(op.getTarget());
if (op.getOperator() == FlowRuleOperation.ADD) {
list.remove(op.target());
if (op.operator() == FlowRuleOperation.ADD) {
list.add((StoredFlowEntry) entry);
}
......
......@@ -265,8 +265,8 @@ public class SimpleFlowRuleStore
List<FlowRuleBatchEntry> toRemove = new ArrayList<>();
for (FlowRuleBatchEntry entry : operation.getOperations()) {
final FlowRule flowRule = entry.getTarget();
if (entry.getOperator().equals(FlowRuleOperation.ADD)) {
final FlowRule flowRule = entry.target();
if (entry.operator().equals(FlowRuleOperation.ADD)) {
if (!getFlowEntries(flowRule.deviceId(), flowRule.id()).contains(flowRule)) {
storeFlowRule(flowRule);
toAdd.add(entry);
......