Support Kryo serialization for intent related types
- Implement the protected constructors
- Register the types in KryoFactory
Change-Id: I14214ed1703a8e4b3145625732c74600fc0aba06
diff --git a/src/main/java/net/onrc/onos/api/newintent/AbstractIntent.java b/src/main/java/net/onrc/onos/api/newintent/AbstractIntent.java
index f2e3d8a..0058860 100644
--- a/src/main/java/net/onrc/onos/api/newintent/AbstractIntent.java
+++ b/src/main/java/net/onrc/onos/api/newintent/AbstractIntent.java
@@ -16,6 +16,13 @@
this.id = id;
}
+ /**
+ * Constructor for serializer.
+ */
+ protected AbstractIntent() {
+ this.id = null;
+ }
+
@Override
public IntentId getId() {
return id;
diff --git a/src/main/java/net/onrc/onos/api/newintent/ConnectivityIntent.java b/src/main/java/net/onrc/onos/api/newintent/ConnectivityIntent.java
index ecb1d6b..cd03272 100644
--- a/src/main/java/net/onrc/onos/api/newintent/ConnectivityIntent.java
+++ b/src/main/java/net/onrc/onos/api/newintent/ConnectivityIntent.java
@@ -39,6 +39,15 @@
}
/**
+ * Constructor for serializer.
+ */
+ protected ConnectivityIntent() {
+ super();
+ this.match = null;
+ this.action = null;
+ }
+
+ /**
* Returns the match specifying the type of traffic.
*
* @return traffic match
diff --git a/src/main/java/net/onrc/onos/api/newintent/IntentEvent.java b/src/main/java/net/onrc/onos/api/newintent/IntentEvent.java
index 670e87e..3dcf2a8 100644
--- a/src/main/java/net/onrc/onos/api/newintent/IntentEvent.java
+++ b/src/main/java/net/onrc/onos/api/newintent/IntentEvent.java
@@ -33,6 +33,16 @@
}
/**
+ * Constructor for serializer.
+ */
+ protected IntentEvent() {
+ this.intent = null;
+ this.state = null;
+ this.previous = null;
+ this.time = 0;
+ }
+
+ /**
* Returns the state of the intent which caused the event.
*
* @return the state of the intent
diff --git a/src/main/java/net/onrc/onos/api/newintent/IntentId.java b/src/main/java/net/onrc/onos/api/newintent/IntentId.java
index b7cdb01..ebe1b45 100644
--- a/src/main/java/net/onrc/onos/api/newintent/IntentId.java
+++ b/src/main/java/net/onrc/onos/api/newintent/IntentId.java
@@ -27,6 +27,12 @@
return new IntentId(id);
}
+ /**
+ * Constructor for serializer.
+ */
+ protected IntentId() {
+ this.id = 0;
+ }
/**
* Constructs the ID corresponding to a given long value.
diff --git a/src/main/java/net/onrc/onos/api/newintent/MultiPointToSinglePointIntent.java b/src/main/java/net/onrc/onos/api/newintent/MultiPointToSinglePointIntent.java
index 99c1c02..610863a 100644
--- a/src/main/java/net/onrc/onos/api/newintent/MultiPointToSinglePointIntent.java
+++ b/src/main/java/net/onrc/onos/api/newintent/MultiPointToSinglePointIntent.java
@@ -44,6 +44,15 @@
}
/**
+ * Constructor for serializer.
+ */
+ protected MultiPointToSinglePointIntent() {
+ super();
+ this.ingressPorts = null;
+ this.egressPort = null;
+ }
+
+ /**
* Returns the set of ports on which ingress traffic should be connected to the egress port.
*
* @return set of ingress ports
diff --git a/src/main/java/net/onrc/onos/api/newintent/OpticalConnectivityIntent.java b/src/main/java/net/onrc/onos/api/newintent/OpticalConnectivityIntent.java
index 174d8c0..9e5c3bc 100644
--- a/src/main/java/net/onrc/onos/api/newintent/OpticalConnectivityIntent.java
+++ b/src/main/java/net/onrc/onos/api/newintent/OpticalConnectivityIntent.java
@@ -30,6 +30,15 @@
}
/**
+ * Constructor for serializer.
+ */
+ protected OpticalConnectivityIntent() {
+ super();
+ this.srcSwitchPort = null;
+ this.dstSwitchPort = null;
+ }
+
+ /**
* Gets source transponder port.
*
* @return The source transponder port.
diff --git a/src/main/java/net/onrc/onos/api/newintent/PacketConnectivityIntent.java b/src/main/java/net/onrc/onos/api/newintent/PacketConnectivityIntent.java
index e03166c..f4eecf9 100644
--- a/src/main/java/net/onrc/onos/api/newintent/PacketConnectivityIntent.java
+++ b/src/main/java/net/onrc/onos/api/newintent/PacketConnectivityIntent.java
@@ -55,6 +55,19 @@
}
/**
+ * Constructor for serializer.
+ */
+ protected PacketConnectivityIntent() {
+ super();
+ this.srcSwitchPorts = null;
+ this.match = null;
+ this.dstSwitchPorts = null;
+ this.canSetupOpticalFlow = false;
+ this.idleTimeoutValue = 0;
+ this.hardTimeoutValue = 0;
+ }
+
+ /**
* Gets the set of source switch ports.
*
* @return the set of source switch ports.
diff --git a/src/main/java/net/onrc/onos/api/newintent/PathIntent.java b/src/main/java/net/onrc/onos/api/newintent/PathIntent.java
index db11f4c..5b9a42f 100644
--- a/src/main/java/net/onrc/onos/api/newintent/PathIntent.java
+++ b/src/main/java/net/onrc/onos/api/newintent/PathIntent.java
@@ -37,6 +37,11 @@
this.path = ImmutableList.copyOf(checkNotNull(path));
}
+ protected PathIntent() {
+ super();
+ this.path = null;
+ }
+
/**
* Returns the links which the traffic goes along.
*
diff --git a/src/main/java/net/onrc/onos/api/newintent/PointToPointIntent.java b/src/main/java/net/onrc/onos/api/newintent/PointToPointIntent.java
index 9672690..d57f782 100644
--- a/src/main/java/net/onrc/onos/api/newintent/PointToPointIntent.java
+++ b/src/main/java/net/onrc/onos/api/newintent/PointToPointIntent.java
@@ -33,6 +33,14 @@
this.egressPort = checkNotNull(egressPort);
}
+ /**
+ * Constructor for serializer.
+ */
+ protected PointToPointIntent() {
+ super();
+ this.ingressPort = null;
+ this.egressPort = null;
+ }
/**
* Returns the port on which the ingress traffic should be connected to
diff --git a/src/main/java/net/onrc/onos/api/newintent/SinglePointToMultiPointIntent.java b/src/main/java/net/onrc/onos/api/newintent/SinglePointToMultiPointIntent.java
index e2ee22f..d46197f 100644
--- a/src/main/java/net/onrc/onos/api/newintent/SinglePointToMultiPointIntent.java
+++ b/src/main/java/net/onrc/onos/api/newintent/SinglePointToMultiPointIntent.java
@@ -44,6 +44,15 @@
}
/**
+ * Constructor for serializer.
+ */
+ protected SinglePointToMultiPointIntent() {
+ super();
+ this.ingressPort = null;
+ this.egressPorts = null;
+ }
+
+ /**
* Returns the port on which the ingress traffic should be connected to the egress.
*
* @return ingress port