[ONOS-2408]Data model and utility class about RFC 7047 (ovsdb protocol).
The whole lib of ovsdb provides the function of encode to jasonRPC and
decode to Pojo to consumer, the bussiness of coordination of
communication is implemented by adapter.

Change-Id: I4c35426273394c1699207e5a4f2e98cead59f1e1
diff --git a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/AbnormalSchemaException.java b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/AbnormalSchemaException.java
new file mode 100644
index 0000000..8a32ffd
--- /dev/null
+++ b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/AbnormalSchemaException.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.ovsdb.rfc.error;
+
+/**
+ * AbnormalSchema exception is thrown when the received schema is invalid.
+ */
+public class AbnormalSchemaException extends RuntimeException {
+    private static final long serialVersionUID = 8328377718334680368L;
+
+    /**
+     * Constructs a AbnormalSchemaException object.
+     * @param message error message
+     */
+    public AbnormalSchemaException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructs a AbnormalSchemaException object.
+     * @param message error message
+     * @param cause Throwable
+     */
+    public AbnormalSchemaException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+}
diff --git a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/ArgumentException.java b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/ArgumentException.java
new file mode 100644
index 0000000..d7d69d1
--- /dev/null
+++ b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/ArgumentException.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.ovsdb.rfc.error;
+
+/**
+ * This exception is thrown when the argument is not supported.
+ */
+public class ArgumentException extends RuntimeException {
+    private static final long serialVersionUID = 4950089877540156797L;
+
+    /**
+     * Constructs a ArgumentException object.
+     * @param message error message
+     */
+    public ArgumentException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructs a ArgumentException object.
+     * @param message error message
+     * @param cause Throwable
+     */
+    public ArgumentException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}
diff --git a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/ColumnSchemaNotFoundException.java b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/ColumnSchemaNotFoundException.java
new file mode 100644
index 0000000..acdbdf5
--- /dev/null
+++ b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/ColumnSchemaNotFoundException.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.ovsdb.rfc.error;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * This exception is thrown when a ColumnSchema cannot be found.
+ */
+public class ColumnSchemaNotFoundException extends RuntimeException {
+    private static final long serialVersionUID = -4325190659387339524L;
+
+    /**
+     * Constructs a ColumnSchemaNotFoundException object.
+     * @param message error message
+     */
+    public ColumnSchemaNotFoundException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructs a ColumnSchemaNotFoundException object.
+     * @param message error message
+     * @param cause Throwable
+     */
+    public ColumnSchemaNotFoundException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * Create error message.
+     * @param columnName column name
+     * @param tableName table name
+     * @return message
+     */
+    public static String createMessage(String columnName, String tableName) {
+        String message = toStringHelper("ColumnSchemaNotFoundException")
+                .addValue("Could not find ColumnSchema for " + columnName
+                                  + " in " + tableName).toString();
+        return message;
+    }
+}
diff --git a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/JsonParsingException.java b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/JsonParsingException.java
new file mode 100644
index 0000000..e62a03f
--- /dev/null
+++ b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/JsonParsingException.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.ovsdb.rfc.error;
+
+/**
+ * The JsonParsingException is thrown when JSON could not be successfully
+ * parsed.
+ */
+public class JsonParsingException extends RuntimeException {
+    private static final long serialVersionUID = 1424752181911923235L;
+
+    /**
+     * Constructs a JsonParsingException object.
+     * @param message error message
+     */
+    public JsonParsingException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructs a JsonParsingException object.
+     * @param message error message
+     * @param cause Throwable
+     */
+    public JsonParsingException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * Constructs a JsonParsingException object.
+     * @param cause Throwable
+     */
+    public JsonParsingException(Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * Constructs a JsonParsingException object.
+     * @param message error message
+     * @param cause Throwable
+     * @param enableSuppression enable Suppression
+     * @param writableStackTrace writable StackTrace
+     */
+    public JsonParsingException(String message, Throwable cause,
+                                boolean enableSuppression,
+                                boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}
diff --git a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/TableSchemaNotFoundException.java b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/TableSchemaNotFoundException.java
new file mode 100644
index 0000000..698e6e3
--- /dev/null
+++ b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/TableSchemaNotFoundException.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.ovsdb.rfc.error;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * This exception is thrown when a TableSchema cannot be found.
+ */
+public class TableSchemaNotFoundException extends RuntimeException {
+    private static final long serialVersionUID = 8431894450061740838L;
+
+    /**
+     * Constructs a TableSchemaNotFoundException object.
+     * @param message error message
+     */
+    public TableSchemaNotFoundException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructs a TableSchemaNotFoundException object.
+     * @param message error message
+     * @param cause Throwable
+     */
+    public TableSchemaNotFoundException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * Create error message.
+     * @param tableName table name
+     * @param schemaName database name
+     * @return message
+     */
+    public static String createMessage(String tableName, String schemaName) {
+        String message = toStringHelper("TableSchemaNotFoundException")
+                .addValue("Can not find TableSchema for " + tableName + " in "
+                        + schemaName).toString();
+        return message;
+    }
+
+}
diff --git a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/TypedSchemaException.java b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/TypedSchemaException.java
new file mode 100644
index 0000000..59aea30
--- /dev/null
+++ b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/TypedSchemaException.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.ovsdb.rfc.error;
+
+/**
+ * This is a generic exception thrown by the Typed Schema utilities.
+ */
+public class TypedSchemaException extends RuntimeException {
+    private static final long serialVersionUID = -1452257990783176715L;
+
+    /**
+     * Constructs a TypedSchemaException object.
+     * @param message error message
+     */
+    public TypedSchemaException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructs a TypedSchemaException object.
+     * @param message error message
+     * @param cause Throwable
+     */
+    public TypedSchemaException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}
diff --git a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/UnknownResultException.java b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/UnknownResultException.java
new file mode 100644
index 0000000..ab30fb1
--- /dev/null
+++ b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/UnknownResultException.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.ovsdb.rfc.error;
+
+/**
+ * This exception is thrown when a result does not meet any of the known formats
+ * in RFC7047.
+ */
+public class UnknownResultException extends RuntimeException {
+    private static final long serialVersionUID = 1377011546616825375L;
+
+    /**
+     * Constructs a UnknownResultException object.
+     * @param message error message
+     */
+    public UnknownResultException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructs a UnknownResultException object.
+     * @param message error message
+     * @param cause Throwable
+     */
+    public UnknownResultException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}
diff --git a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/UnsupportedEncodingException.java b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/UnsupportedEncodingException.java
new file mode 100644
index 0000000..6ba7fd5
--- /dev/null
+++ b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/UnsupportedEncodingException.java
@@ -0,0 +1,16 @@
+package org.onosproject.ovsdb.rfc.error;
+
+/**
+ * This exception is thrown when the encoding does not meet UTF-8 in RFC7047.
+ */
+public class UnsupportedEncodingException extends RuntimeException {
+    private static final long serialVersionUID = -4865311369828520666L;
+
+    /**
+     * Constructs a UnsupportedEncodingException object.
+     * @param message error message
+     */
+    public UnsupportedEncodingException(String message) {
+        super(message);
+    }
+}
diff --git a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/VersionMismatchException.java b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/VersionMismatchException.java
new file mode 100644
index 0000000..68d63b9
--- /dev/null
+++ b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/error/VersionMismatchException.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.ovsdb.rfc.error;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * This exception is used when the a table or row is accessed though a typed
+ * interface and the version requirements are not met.
+ */
+public class VersionMismatchException extends RuntimeException {
+    private static final long serialVersionUID = -8439624321110133595L;
+
+    /**
+     * Constructs a VersionMismatchException object.
+     * @param message error message
+     */
+    public VersionMismatchException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructs a VersionMismatchException object.
+     * @param message error message
+     * @param cause Throwable
+     */
+    public VersionMismatchException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * Create error message.
+     * @param actualVersion the actual version
+     * @param fromVersion the initial version
+     * @return message
+     */
+    public static String createFromMessage(String actualVersion,
+                                           String fromVersion) {
+        String message = toStringHelper("VersionMismatchException")
+                .addValue("The fromVersion should less than the actualVersion.\n"
+                                  + "fromVersion: "
+                                  + fromVersion
+                                  + ".\n"
+                                  + "actualVersion: " + actualVersion)
+                .toString();
+        return message;
+    }
+
+    /**
+     * Create error message.
+     * @param actualVersion the actual version
+     * @param toVersion the end version
+     * @return message
+     */
+    public static String createToMessage(String actualVersion, String toVersion) {
+        String message = toStringHelper("VersionMismatchException")
+                .addValue("The toVersion should greater than the required version.\n"
+                                  + "toVersion: "
+                                  + toVersion
+                                  + ".\n"
+                                  + "Actual Version: " + actualVersion)
+                .toString();
+        return message;
+    }
+}