Aligning Jackson to the Controller's l latest upgrade (2.3.0). Also updated the north... 03/4003/1
authorMadhu Venugopal <mavenugo@gmail.com>
Thu, 2 Jan 2014 22:25:14 +0000 (14:25 -0800)
committerMadhu Venugopal <mavenugo@gmail.com>
Thu, 2 Jan 2014 22:25:14 +0000 (14:25 -0800)
Due to this change, the ovsdb.northbound bundle will start to accept and respond OVSDB JSON messages in the same format as
expected by the ovsdb-server. (i.e) a set will be represented as ["set",[]] instead of the common sense [].
This is due to the ovsdb requirement as specified in the RFC / Draft.

Change-Id: I3a1a2548f1b8c87d1d4b63f5952d6fabaa6f3d33
Signed-off-by: Madhu Venugopal <mavenugo@gmail.com>
commons/parent/pom.xml
northbound/ovsdb/pom.xml
northbound/ovsdb/src/main/java/org/opendaylight/ovsdb/northbound/OVSDBNorthbound.java
northbound/ovsdb/src/main/java/org/opendaylight/ovsdb/northbound/OVSDBRow.java
ovsdb/pom.xml
ovsdb/src/test/java/org/opendaylight/ovsdb/lib/jsonrpc/TestClient.java

index 12914b48995029144e04a11ca86a12dba6f03938..062ffe8a9bf318ca7ea59c7f7ba3ae34431a37ad 100755 (executable)
@@ -21,6 +21,7 @@
   <properties>
     <nexusproxy>http://nexus.opendaylight.org/content</nexusproxy>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <jackson.new.version>2.3.0</jackson.new.version>
   </properties>
   <!-- modules should go once the jenkins job is updated to use the root pom -->
   <modules>
index c32a9101d29faefcc2aae374338831ebabef3f5a..440afb0acc40ca15db873ae4b3755b7f173d4c2d 100644 (file)
@@ -13,7 +13,6 @@
     <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
     <tag>HEAD</tag>
   </scm>
-
   <artifactId>ovsdb.northbound</artifactId>
   <version>0.5.0-SNAPSHOT</version>
   <packaging>bundle</packaging>
@@ -51,9 +50,8 @@
               javax.xml.bind.annotation,
               org.slf4j,
               org.apache.catalina.filters,
-              org.codehaus.jackson.jaxrs,
-              org.codehaus.jackson.annotate,
-              org.codehaus.jackson.map.annotate,
+              com.fasterxml.jackson.databind.annotation,
+              com.fasterxml.jackson.annotation,
               !org.codehaus.enunciate.jaxrs
             </Import-Package>
             <Export-Package>
       <artifactId>enunciate-core-annotations</artifactId>
       <version>${enunciate.version}</version>
     </dependency>
+
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-annotations</artifactId>
+      <version>${jackson.new.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-core</artifactId>
+      <version>${jackson.new.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+      <version>${jackson.new.version}</version>
+    </dependency>
+
   </dependencies>
 </project>
index f82c6c92d94beba9819c1d8e982a389de3acbfa8..35e29ddc9e8dcffd3d76fb645a279c35a0e74af6 100644 (file)
@@ -10,6 +10,7 @@
 package org.opendaylight.ovsdb.northbound;
 
 import java.util.List;
+import java.util.Map;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
@@ -176,8 +177,8 @@ public class OVSDBNorthbound {
         @ResponseCode(code = 400, condition = "Invalid data passed"),
         @ResponseCode(code = 401, condition = "User not authorized to perform this operation")})
     @Consumes({ MediaType.APPLICATION_JSON})
-    @TypeHint(String.class)
-    public String getRow(@PathParam("nodeType") String nodeType, @PathParam("nodeId") String nodeId,
+    @TypeHint(OVSDBRow.class)
+    public OVSDBRow getRow(@PathParam("nodeType") String nodeType, @PathParam("nodeId") String nodeId,
                            @PathParam("tableName") String tableName, @PathParam("rowUuid") String rowUuid) {
 
         if (!NorthboundUtils.isAuthorized(getUserName(), "default", Privilege.WRITE, this)) {
@@ -194,15 +195,13 @@ public class OVSDBNorthbound {
         }
 
         Node node = Node.fromString(nodeType, nodeId);
-        //Table<?> row = null;
-        String row = null;
+        Table<?> row = null;
         try {
-            row = ovsdbTable.getSerializedRow(node, ovsTableName, rowUuid);
+            row = ovsdbTable.getRow(node, ovsTableName, rowUuid);
         } catch (Exception e) {
             throw new BadRequestException(e.getMessage());
         }
-        //return new OVSDBRow(null, row);
-        return row;
+        return new OVSDBRow(null, row);
     }
 
     /**
@@ -227,8 +226,8 @@ public class OVSDBNorthbound {
         @ResponseCode(code = 400, condition = "Invalid data passed"),
         @ResponseCode(code = 401, condition = "User not authorized to perform this operation")})
     @Consumes({ MediaType.APPLICATION_JSON})
-    @TypeHint(String.class)
-    public String getAllRows(@PathParam("nodeType") String nodeType, @PathParam("nodeId") String nodeId,
+    @TypeHint(OVSDBRows.class)
+    public OVSDBRows getAllRows(@PathParam("nodeType") String nodeType, @PathParam("nodeId") String nodeId,
                                @PathParam("tableName") String tableName) {
         if (!NorthboundUtils.isAuthorized(getUserName(), "default", Privilege.WRITE, this)) {
             throw new UnauthorizedException("User is not authorized to perform this operation");
@@ -244,15 +243,13 @@ public class OVSDBNorthbound {
         }
 
         Node node = Node.fromString(nodeType, nodeId);
-        //Map<String, Table<?>> rows = null;
-        String rows = null;
+        Map<String, Table<?>> rows = null;
         try {
-            rows = ovsdbTable.getSerializedRows(node, ovsTableName);
+            rows = ovsdbTable.getRows(node, ovsTableName);
         } catch (Exception e) {
             throw new BadRequestException(e.getMessage());
         }
-        //return new OVSDBRows(rows);
-        return rows;
+        return new OVSDBRows(rows);
     }
 
     /**
index 5bdb3c8ff187bd10400bee5b9c6951ee1f141e82..1f2ff51b8d084b01fbbea9c23b0ddb3b8ddd3116 100644 (file)
@@ -9,9 +9,6 @@
  */
 package org.opendaylight.ovsdb.northbound;
 
-import org.codehaus.jackson.annotate.JsonSubTypes;
-import org.codehaus.jackson.annotate.JsonTypeInfo;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
 import org.opendaylight.ovsdb.lib.table.Bridge;
 import org.opendaylight.ovsdb.lib.table.Capability;
 import org.opendaylight.ovsdb.lib.table.Controller;
@@ -27,6 +24,10 @@ import org.opendaylight.ovsdb.lib.table.SFlow;
 import org.opendaylight.ovsdb.lib.table.SSL;
 import org.opendaylight.ovsdb.lib.table.internal.Table;
 
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
 @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
 public class OVSDBRow {
     String parent_uuid;
index 866f9d78129973fe9da337d1c336563546ec7d39..bfc671085772fa8c6acc22475445fb730d3fec35 100755 (executable)
@@ -64,7 +64,7 @@
                             javax.net.ssl,
                             *
                         </Import-Package>
-                        <Embed-Dependency>httpclient,commons-codec,httpcore-nio,javax.servlet-api,jackson-annotations,jackson-core,jackson-databind,portlet-api,commons-collections;type=!pom;inline=false</Embed-Dependency>
+                        <Embed-Dependency>httpclient,commons-codec,httpcore-nio,javax.servlet-api,portlet-api,commons-collections;type=!pom;inline=false</Embed-Dependency>
                         <Embed-Transitive>
                             true
                         </Embed-Transitive>
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-annotations</artifactId>
-            <version>2.2.2</version>
+            <version>${jackson.new.version}</version>
         </dependency>
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-core</artifactId>
-            <version>2.2.2</version>
+            <version>${jackson.new.version}</version>
         </dependency>
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
-            <version>2.2.2</version>
+            <version>${jackson.new.version}</version>
         </dependency>
         <dependency>
             <groupId>javax.portlet</groupId>
index bcd8b90c7991f9a00496304d1b41cea44d01239a..0ef84540b53a47e7846049ec708ca47a8f15b43e 100644 (file)
@@ -13,7 +13,6 @@ import io.netty.handler.logging.LogLevel;
 import io.netty.handler.logging.LoggingHandler;
 import junit.framework.TestCase;
 
-import org.codehaus.jackson.map.ObjectMapper;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;