Minor cleanups for DefaultFlowRule.
Deprecate public constructors in favour of using the builder pattern.
Deprecate FlowRuleExtPayLoad.
Change-Id: I2bd241f290c4bd841ed641ddf37f06a8bbd129b2
diff --git a/core/api/src/main/java/org/onosproject/net/flow/DefaultFlowRule.java b/core/api/src/main/java/org/onosproject/net/flow/DefaultFlowRule.java
index d258a74..5b97fa3 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/DefaultFlowRule.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/DefaultFlowRule.java
@@ -15,7 +15,6 @@
*/
package org.onosproject.net.flow;
-import com.google.common.annotations.Beta;
import com.google.common.base.Charsets;
import com.google.common.hash.Funnel;
import com.google.common.hash.HashCode;
@@ -32,6 +31,9 @@
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
+/**
+ * Default flow rule.
+ */
public class DefaultFlowRule implements FlowRule {
private final DeviceId deviceId;
@@ -53,6 +55,11 @@
private final Integer tableId;
private final FlowRuleExtPayLoad payLoad;
+ /**
+ * Creates a new flow rule from an existing rule.
+ *
+ * @param rule new flow rule
+ */
public DefaultFlowRule(FlowRule rule) {
this.deviceId = rule.deviceId();
this.priority = rule.priority();
@@ -94,8 +101,6 @@
this.payLoad = null;
}
-
-
/**
* Support for the third party flow rule. Creates a flow rule of flow table.
*
@@ -108,7 +113,9 @@
* @param timeout the timeout for this flow requested by an application
* @param permanent whether the flow is permanent i.e. does not time out
* @param payLoad 3rd-party origin private flow
+ * @deprecated in Junco release. Use FlowRule.Builder instead.
*/
+ @Deprecated
public DefaultFlowRule(DeviceId deviceId, TrafficSelector selector,
TrafficTreatment treatment, int priority,
ApplicationId appId, int timeout, boolean permanent,
@@ -130,7 +137,9 @@
* @param hardTimeout the hard timeout located switch's flow table for this flow requested by an application
* @param permanent whether the flow is permanent i.e. does not time out
* @param payLoad 3rd-party origin private flow
+ * @deprecated in Junco release. Use FlowRule.Builder instead.
*/
+ @Deprecated
public DefaultFlowRule(DeviceId deviceId, TrafficSelector selector,
TrafficTreatment treatment, int priority,
ApplicationId appId, int timeout, int hardTimeout, boolean permanent,
@@ -178,8 +187,9 @@
* @param timeout the timeout for this flow requested by an application
* @param permanent whether the flow is permanent i.e. does not time out
* @param payLoad 3rd-party origin private flow
- *
+ * @deprecated in Junco release. Use FlowRule.Builder instead.
*/
+ @Deprecated
public DefaultFlowRule(DeviceId deviceId, TrafficSelector selector,
TrafficTreatment treatment, int priority,
ApplicationId appId, GroupId groupId, int timeout,
@@ -202,8 +212,9 @@
* @param hardTimeout the hard timeout located switch's flow table for this flow requested by an application
* @param permanent whether the flow is permanent i.e. does not time out
* @param payLoad 3rd-party origin private flow
- *
+ * @deprecated in Junco release. Use FlowRule.Builder instead.
*/
+ @Deprecated
public DefaultFlowRule(DeviceId deviceId, TrafficSelector selector,
TrafficTreatment treatment, int priority,
ApplicationId appId, GroupId groupId, int timeout, int hardTimeout,
@@ -272,7 +283,6 @@
return treatment;
}
- @Override
/*
* The priority and statistics can change on a given treatment and selector
*
@@ -280,6 +290,7 @@
*
* @see java.lang.Object#equals(java.lang.Object)
*/
+ @Override
public int hashCode() {
return Objects.hash(deviceId, selector, tableId, payLoad);
}
@@ -289,7 +300,6 @@
return Objects.hash(deviceId, selector, tableId, payLoad);
}
- @Override
/*
* The priority and statistics can change on a given treatment and selector
*
@@ -297,6 +307,7 @@
*
* @see java.lang.Object#equals(java.lang.Object)
*/
+ @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
@@ -338,8 +349,6 @@
return timeout;
}
-
-
@Override
public int hardTimeout() {
return hardTimeout;
@@ -360,15 +369,27 @@
return tableId;
}
- @Beta
+ /**
+ * Returns the wallclock time that the flow was created.
+ *
+ * @return creation time in milliseconds since epoch
+ */
public long created() {
return created;
}
+ /**
+ * Returns a default flow rule builder.
+ *
+ * @return builder
+ */
public static Builder builder() {
return new Builder();
}
+ /**
+ * Default flow rule builder.
+ */
public static final class Builder implements FlowRule.Builder {
private FlowId flowId;
diff --git a/core/api/src/main/java/org/onosproject/net/flow/FlowRule.java b/core/api/src/main/java/org/onosproject/net/flow/FlowRule.java
index 35804b8..4da33aa 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/FlowRule.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/FlowRule.java
@@ -111,7 +111,7 @@
/**
* Returns the hard timeout for this flow requested by an application.
- * This paremeter configure switch's flow hard timeout.
+ * This parameter configure switch's flow hard timeout.
* In case of controller-switch connection lost, this variable can be useful.
* @return integer value of the hard Timeout
*/
@@ -275,6 +275,8 @@
* Returns the third party original flow rule.
*
* @return FlowRuleExtPayLoad
+ * @deprecated in Junco release
*/
+ @Deprecated
FlowRuleExtPayLoad payLoad();
}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/FlowRuleExtPayLoad.java b/core/api/src/main/java/org/onosproject/net/flow/FlowRuleExtPayLoad.java
index 29bcb91..d63f599 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/FlowRuleExtPayLoad.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/FlowRuleExtPayLoad.java
@@ -15,13 +15,16 @@
*/
package org.onosproject.net.flow;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
import java.util.Arrays;
+import static com.google.common.base.MoreObjects.toStringHelper;
+
/**
* Represents for 3rd-party private original flow.
+ *
+ * @deprecated in Junco release
*/
+@Deprecated
public final class FlowRuleExtPayLoad {
private final byte[] payLoad;