Remove some deprecated APIs and warnings from BatchOperationEntry
Change-Id: I44daf9646f6d2a60fd7c0ce96d6692ab8a9cdda2
Showing
4 changed files
with
18 additions
and
38 deletions
| ... | @@ -48,16 +48,6 @@ public class BatchOperationEntry<T extends Enum<?>, U> { | ... | @@ -48,16 +48,6 @@ public class BatchOperationEntry<T extends Enum<?>, U> { |
| 48 | * | 48 | * |
| 49 | * @return the target object of this operation | 49 | * @return the target object of this operation |
| 50 | */ | 50 | */ |
| 51 | - @Deprecated | ||
| 52 | - public U getTarget() { | ||
| 53 | - return target(); | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | - /** | ||
| 57 | - * Gets the target object of this operation. | ||
| 58 | - * | ||
| 59 | - * @return the target object of this operation | ||
| 60 | - */ | ||
| 61 | public U target() { | 51 | public U target() { |
| 62 | return target; | 52 | return target; |
| 63 | } | 53 | } |
| ... | @@ -67,16 +57,6 @@ public class BatchOperationEntry<T extends Enum<?>, U> { | ... | @@ -67,16 +57,6 @@ public class BatchOperationEntry<T extends Enum<?>, U> { |
| 67 | * | 57 | * |
| 68 | * @return the operator of this operation | 58 | * @return the operator of this operation |
| 69 | */ | 59 | */ |
| 70 | - @Deprecated | ||
| 71 | - public T getOperator() { | ||
| 72 | - return operator(); | ||
| 73 | - } | ||
| 74 | - | ||
| 75 | - /** | ||
| 76 | - * Gets the operator of this operation. | ||
| 77 | - * | ||
| 78 | - * @return the operator of this operation | ||
| 79 | - */ | ||
| 80 | public T operator() { | 60 | public T operator() { |
| 81 | return operator; | 61 | return operator; |
| 82 | } | 62 | } | ... | ... |
| ... | @@ -200,18 +200,18 @@ public class FlowRuleManager | ... | @@ -200,18 +200,18 @@ public class FlowRuleManager |
| 200 | 200 | ||
| 201 | FlowRuleOperations.Builder fopsBuilder = FlowRuleOperations.builder(); | 201 | FlowRuleOperations.Builder fopsBuilder = FlowRuleOperations.builder(); |
| 202 | batch.getOperations().stream().forEach(op -> { | 202 | batch.getOperations().stream().forEach(op -> { |
| 203 | - switch (op.getOperator()) { | 203 | + switch (op.operator()) { |
| 204 | case ADD: | 204 | case ADD: |
| 205 | - fopsBuilder.add(op.getTarget()); | 205 | + fopsBuilder.add(op.target()); |
| 206 | break; | 206 | break; |
| 207 | case REMOVE: | 207 | case REMOVE: |
| 208 | - fopsBuilder.remove(op.getTarget()); | 208 | + fopsBuilder.remove(op.target()); |
| 209 | break; | 209 | break; |
| 210 | case MODIFY: | 210 | case MODIFY: |
| 211 | - fopsBuilder.modify(op.getTarget()); | 211 | + fopsBuilder.modify(op.target()); |
| 212 | break; | 212 | break; |
| 213 | default: | 213 | default: |
| 214 | - log.warn("Unknown flow operation operator: {}", op.getOperator()); | 214 | + log.warn("Unknown flow operation operator: {}", op.operator()); |
| 215 | 215 | ||
| 216 | } | 216 | } |
| 217 | } | 217 | } |
| ... | @@ -438,25 +438,25 @@ public class FlowRuleManager | ... | @@ -438,25 +438,25 @@ public class FlowRuleManager |
| 438 | // Request has been forwarded to MASTER Node, and was | 438 | // Request has been forwarded to MASTER Node, and was |
| 439 | request.ops().stream().forEach( | 439 | request.ops().stream().forEach( |
| 440 | op -> { | 440 | op -> { |
| 441 | - switch (op.getOperator()) { | 441 | + switch (op.operator()) { |
| 442 | 442 | ||
| 443 | case ADD: | 443 | case ADD: |
| 444 | eventDispatcher.post( | 444 | eventDispatcher.post( |
| 445 | new FlowRuleEvent( | 445 | new FlowRuleEvent( |
| 446 | FlowRuleEvent.Type.RULE_ADD_REQUESTED, | 446 | FlowRuleEvent.Type.RULE_ADD_REQUESTED, |
| 447 | - op.getTarget())); | 447 | + op.target())); |
| 448 | break; | 448 | break; |
| 449 | case REMOVE: | 449 | case REMOVE: |
| 450 | eventDispatcher.post( | 450 | eventDispatcher.post( |
| 451 | new FlowRuleEvent( | 451 | new FlowRuleEvent( |
| 452 | FlowRuleEvent.Type.RULE_REMOVE_REQUESTED, | 452 | FlowRuleEvent.Type.RULE_REMOVE_REQUESTED, |
| 453 | - op.getTarget())); | 453 | + op.target())); |
| 454 | break; | 454 | break; |
| 455 | case MODIFY: | 455 | case MODIFY: |
| 456 | //TODO: do something here when the time comes. | 456 | //TODO: do something here when the time comes. |
| 457 | break; | 457 | break; |
| 458 | default: | 458 | default: |
| 459 | - log.warn("Unknown flow operation operator: {}", op.getOperator()); | 459 | + log.warn("Unknown flow operation operator: {}", op.operator()); |
| 460 | } | 460 | } |
| 461 | } | 461 | } |
| 462 | ); | 462 | ); | ... | ... |
| ... | @@ -384,7 +384,7 @@ public class DistributedFlowRuleStore | ... | @@ -384,7 +384,7 @@ public class DistributedFlowRuleStore |
| 384 | log.warn("Failed to storeBatch: {}", e.getMessage()); | 384 | log.warn("Failed to storeBatch: {}", e.getMessage()); |
| 385 | 385 | ||
| 386 | Set<FlowRule> allFailures = operation.getOperations().stream() | 386 | Set<FlowRule> allFailures = operation.getOperations().stream() |
| 387 | - .map(op -> op.getTarget()) | 387 | + .map(op -> op.target()) |
| 388 | .collect(Collectors.toSet()); | 388 | .collect(Collectors.toSet()); |
| 389 | 389 | ||
| 390 | notifyDelegate(FlowRuleBatchEvent.completed( | 390 | notifyDelegate(FlowRuleBatchEvent.completed( |
| ... | @@ -418,9 +418,9 @@ public class DistributedFlowRuleStore | ... | @@ -418,9 +418,9 @@ public class DistributedFlowRuleStore |
| 418 | return operation.getOperations().stream().map( | 418 | return operation.getOperations().stream().map( |
| 419 | op -> { | 419 | op -> { |
| 420 | StoredFlowEntry entry; | 420 | StoredFlowEntry entry; |
| 421 | - switch (op.getOperator()) { | 421 | + switch (op.operator()) { |
| 422 | case ADD: | 422 | case ADD: |
| 423 | - entry = new DefaultFlowEntry(op.getTarget()); | 423 | + entry = new DefaultFlowEntry(op.target()); |
| 424 | // always add requested FlowRule | 424 | // always add requested FlowRule |
| 425 | // Note: 2 equal FlowEntry may have different treatment | 425 | // Note: 2 equal FlowEntry may have different treatment |
| 426 | flowTable.remove(entry.deviceId(), entry); | 426 | flowTable.remove(entry.deviceId(), entry); |
| ... | @@ -438,7 +438,7 @@ public class DistributedFlowRuleStore | ... | @@ -438,7 +438,7 @@ public class DistributedFlowRuleStore |
| 438 | //TODO: figure this out at some point | 438 | //TODO: figure this out at some point |
| 439 | break; | 439 | break; |
| 440 | default: | 440 | default: |
| 441 | - log.warn("Unknown flow operation operator: {}", op.getOperator()); | 441 | + log.warn("Unknown flow operation operator: {}", op.operator()); |
| 442 | } | 442 | } |
| 443 | return null; | 443 | return null; |
| 444 | } | 444 | } |
| ... | @@ -712,15 +712,15 @@ public class DistributedFlowRuleStore | ... | @@ -712,15 +712,15 @@ public class DistributedFlowRuleStore |
| 712 | 712 | ||
| 713 | ops.stream().forEach( | 713 | ops.stream().forEach( |
| 714 | op -> { | 714 | op -> { |
| 715 | - final FlowRule entry = op.getTarget(); | 715 | + final FlowRule entry = op.target(); |
| 716 | final FlowId id = entry.id(); | 716 | final FlowId id = entry.id(); |
| 717 | ImmutableList<StoredFlowEntry> original = backupFlowTable.get(id); | 717 | ImmutableList<StoredFlowEntry> original = backupFlowTable.get(id); |
| 718 | List<StoredFlowEntry> list = new ArrayList<>(); | 718 | List<StoredFlowEntry> list = new ArrayList<>(); |
| 719 | if (original != null) { | 719 | if (original != null) { |
| 720 | list.addAll(original); | 720 | list.addAll(original); |
| 721 | } | 721 | } |
| 722 | - list.remove(op.getTarget()); | 722 | + list.remove(op.target()); |
| 723 | - if (op.getOperator() == FlowRuleOperation.ADD) { | 723 | + if (op.operator() == FlowRuleOperation.ADD) { |
| 724 | list.add((StoredFlowEntry) entry); | 724 | list.add((StoredFlowEntry) entry); |
| 725 | } | 725 | } |
| 726 | 726 | ... | ... |
| ... | @@ -265,8 +265,8 @@ public class SimpleFlowRuleStore | ... | @@ -265,8 +265,8 @@ public class SimpleFlowRuleStore |
| 265 | List<FlowRuleBatchEntry> toRemove = new ArrayList<>(); | 265 | List<FlowRuleBatchEntry> toRemove = new ArrayList<>(); |
| 266 | 266 | ||
| 267 | for (FlowRuleBatchEntry entry : operation.getOperations()) { | 267 | for (FlowRuleBatchEntry entry : operation.getOperations()) { |
| 268 | - final FlowRule flowRule = entry.getTarget(); | 268 | + final FlowRule flowRule = entry.target(); |
| 269 | - if (entry.getOperator().equals(FlowRuleOperation.ADD)) { | 269 | + if (entry.operator().equals(FlowRuleOperation.ADD)) { |
| 270 | if (!getFlowEntries(flowRule.deviceId(), flowRule.id()).contains(flowRule)) { | 270 | if (!getFlowEntries(flowRule.deviceId(), flowRule.id()).contains(flowRule)) { |
| 271 | storeFlowRule(flowRule); | 271 | storeFlowRule(flowRule); |
| 272 | toAdd.add(entry); | 272 | toAdd.add(entry); | ... | ... |
-
Please register or login to post a comment