Hongtao Yin | 142b758 | 2015-01-21 14:41:30 -0800 | [diff] [blame] | 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.flowext; |
| 17 | |
| 18 | import com.google.common.base.MoreObjects; |
| 19 | import org.onosproject.net.flow.CompletedBatchOperation; |
| 20 | import org.onosproject.net.flow.FlowRule; |
| 21 | |
| 22 | import java.util.Set; |
| 23 | |
| 24 | /** |
| 25 | * Experimental extension to the flow rule subsystem; still under development. |
| 26 | * <p> |
| 27 | * Representation of a completed flow rule batch operation. |
| 28 | * </p> |
| 29 | */ |
| 30 | //TODO explain the purpose of this class beyond FlowRuleProvider |
| 31 | public class FlowExtCompletedOperation extends CompletedBatchOperation { |
| 32 | // the batchId is provided by application, once one flow rule of this batch failed |
| 33 | // all the batch should withdraw |
| 34 | private final long batchId; |
| 35 | |
| 36 | public FlowExtCompletedOperation(long batchId, boolean success, Set<FlowRule> failures) { |
| 37 | super(success, failures, null); |
| 38 | this.batchId = batchId; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Returns the BatchId of this BatchOperation. |
| 43 | * |
| 44 | * @return the number of Batch |
| 45 | */ |
| 46 | public long getBatchId() { |
| 47 | return batchId; |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Returns a string representation of the object. |
| 52 | * |
| 53 | * @return a string representation of the object. |
| 54 | */ |
| 55 | @Override |
| 56 | public String toString() { |
| 57 | return MoreObjects.toStringHelper(getClass()) |
| 58 | .add("success?", isSuccess()) |
| 59 | .add("failedItems", failedIds()) |
| 60 | .toString(); |
| 61 | } |
| 62 | } |