Bug 6325 - upgrade draft11 to draft15 - change media types 94/42994/10
authorJakub Toth <jatoth@cisco.com>
Tue, 2 Aug 2016 17:58:38 +0000 (13:58 -0400)
committerJakub Toth <jatoth@cisco.com>
Mon, 15 Aug 2016 15:21:18 +0000 (15:21 +0000)
  * remove media types(for +json and +xml in all cases):
    * yang.api
    * yang.datastore
    * yang.data
    * yang.operation
    * yang.errors
  * add new media type:
    * for xml - yang-data
    * for json - yang-data+json

Change-Id: I9c1e3a28872c47f691d342a4982eaa3f8bbae16c
Signed-off-by: Jakub Toth <jatoth@cisco.com>
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/NormalizedNodeJsonBodyWriter.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/NormalizedNodeXmlBodyWriter.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlNormalizedNodeBodyReader.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/Draft15.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/api/RestconfModulesService.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/api/RestconfOperationsService.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/api/RestconfStreamsService.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/restful/services/api/RestconfDataService.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/restful/services/api/RestconfInvokeOperationsService.java

index 9e1dcb2ee211003f9511aa9353f54b12a654fefd..fd2b14102a7315ae6069567056303b4d82f557de 100644 (file)
@@ -52,9 +52,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @Provider
-@Consumes({ Draft02.MediaTypes.DATA + RestconfService.JSON, Draft15.MediaTypes.DATA + RestconfConstants.JSON,
-        Draft02.MediaTypes.OPERATION + RestconfService.JSON, Draft15.MediaTypes.OPERATION + RestconfConstants.JSON,
-        MediaType.APPLICATION_JSON })
+@Consumes({ Draft02.MediaTypes.DATA + RestconfService.JSON, Draft02.MediaTypes.OPERATION + RestconfService.JSON,
+        Draft15.MediaTypes.DATA + RestconfConstants.JSON, MediaType.APPLICATION_JSON })
 public class JsonNormalizedNodeBodyReader extends AbstractIdentifierAwareJaxRsProvider implements MessageBodyReader<NormalizedNodeContext> {
 
     private final static Logger LOG = LoggerFactory.getLogger(JsonNormalizedNodeBodyReader.class);
index ff3f9f42b672f7293760fbba2e1e453773fa295f..b262758fc71b33cac7fd53b6107b1487b8d21e32 100644 (file)
@@ -47,9 +47,8 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
 @Provider
 @Produces({ Draft02.MediaTypes.API + RestconfService.JSON, Draft02.MediaTypes.DATA + RestconfService.JSON,
-        Draft02.MediaTypes.OPERATION + RestconfService.JSON,
-        Draft15.MediaTypes.API + RestconfConstants.JSON, Draft15.MediaTypes.DATA + RestconfConstants.JSON,
-        Draft15.MediaTypes.OPERATION + RestconfConstants.JSON, MediaType.APPLICATION_JSON })
+        Draft02.MediaTypes.OPERATION + RestconfService.JSON, Draft15.MediaTypes.DATA + RestconfConstants.JSON,
+        MediaType.APPLICATION_JSON })
 public class NormalizedNodeJsonBodyWriter implements MessageBodyWriter<NormalizedNodeContext> {
 
     private static final int DEFAULT_INDENT_SPACES_NUM = 2;
index b1ede154d7b5dadceb082772fd676c5d7ab6630c..576ea8f82acd3c998944698445882a199b570516 100644 (file)
@@ -31,7 +31,6 @@ import org.opendaylight.netconf.sal.rest.api.RestconfService;
 import org.opendaylight.netconf.sal.restconf.impl.InstanceIdentifierContext;
 import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
 import org.opendaylight.restconf.Draft15;
-import org.opendaylight.restconf.utils.RestconfConstants;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
@@ -45,9 +44,8 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
 @Provider
 @Produces({ Draft02.MediaTypes.API + RestconfService.XML, Draft02.MediaTypes.DATA + RestconfService.XML,
-        Draft02.MediaTypes.OPERATION + RestconfService.XML,
-        Draft15.MediaTypes.API + RestconfConstants.XML, Draft15.MediaTypes.DATA + RestconfConstants.XML,
-        Draft15.MediaTypes.OPERATION + RestconfConstants.XML, MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+        Draft02.MediaTypes.OPERATION + RestconfService.XML, Draft15.MediaTypes.DATA, MediaType.APPLICATION_XML,
+        MediaType.TEXT_XML })
 public class NormalizedNodeXmlBodyWriter implements MessageBodyWriter<NormalizedNodeContext> {
 
     private static final XMLOutputFactory XML_FACTORY;
index b13832c9b9c7b7d7e7c5e7f8c38fff2ad7a6b302..97867111a7b10602bccf1b2a99e05424da9f2dc8 100644 (file)
@@ -35,7 +35,6 @@ import org.opendaylight.netconf.sal.restconf.impl.RestconfDocumentedException;
 import org.opendaylight.netconf.sal.restconf.impl.RestconfError.ErrorTag;
 import org.opendaylight.netconf.sal.restconf.impl.RestconfError.ErrorType;
 import org.opendaylight.restconf.Draft15;
-import org.opendaylight.restconf.utils.RestconfConstants;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlUtils;
@@ -57,9 +56,8 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 @Provider
-@Consumes({ Draft02.MediaTypes.DATA + RestconfService.XML, Draft15.MediaTypes.DATA + RestconfConstants.XML,
-        Draft02.MediaTypes.OPERATION + RestconfService.XML, Draft15.MediaTypes.OPERATION + RestconfConstants.XML,
-    MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+@Consumes({ Draft02.MediaTypes.DATA + RestconfService.XML, Draft02.MediaTypes.OPERATION + RestconfService.XML,
+        Draft15.MediaTypes.DATA, MediaType.APPLICATION_XML, MediaType.TEXT_XML })
 public class XmlNormalizedNodeBodyReader extends AbstractIdentifierAwareJaxRsProvider implements MessageBodyReader<NormalizedNodeContext> {
 
     private final static Logger LOG = LoggerFactory.getLogger(XmlNormalizedNodeBodyReader.class);
index e6f80b1a74dbe1eddb4adc343033e780ab3c057d..885229515cb589fdc720ef2e4c5e1a6096bc0301 100644 (file)
@@ -40,13 +40,9 @@ public final class Draft15 {
             throw new UnsupportedOperationException("Util class");
         }
 
-        public static final String API = "application/yang.api";
-        public static final String DATASTORE = "application/yang.datastore";
-        public static final String DATA = "application/yang.data";
-        public static final String OPERATION = "application/yang.operation";
+        public static final String DATA = "application/yang-data";
         public static final String PATCH = "application/yang.patch";
         public static final String PATCH_STATUS = "application/yang.patch-status";
-        public static final String ERRORS = "application/yang.errors";
         public static final String YIN = "application/yin";
         public static final String YANG = "application/yang";
     }
index e4478445c4f4d16b1cca25d0ac1c6ddb4fdcb992..4b3f97d65ca1ee4603560ee431f3c132a70fcc4d 100644 (file)
@@ -32,8 +32,8 @@ public interface RestconfModulesService {
      */
     @GET
     @Path("data/ietf-yang-library:modules")
-    @Produces({ Draft15.MediaTypes.API + RestconfConstants.JSON, Draft15.MediaTypes.API + RestconfConstants.XML,
-            MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+    @Produces({ Draft15.MediaTypes.DATA + RestconfConstants.JSON, Draft15.MediaTypes.DATA, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
     public NormalizedNodeContext getModules(@Context UriInfo uriInfo);
 
     /**
@@ -48,8 +48,8 @@ public interface RestconfModulesService {
      */
     @GET
     @Path("data/ietf-yang-library:modules/{identifier:.+}")
-    @Produces({ Draft15.MediaTypes.API + RestconfConstants.JSON, Draft15.MediaTypes.API + RestconfConstants.XML,
-            MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+    @Produces({ Draft15.MediaTypes.DATA + RestconfConstants.JSON, Draft15.MediaTypes.DATA, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
     public NormalizedNodeContext getModules(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
 
     /**
@@ -65,7 +65,7 @@ public interface RestconfModulesService {
      */
     @GET
     @Path("data/ietf-yang-library:modules/module/{identifier:.+}")
-    @Produces({ Draft15.MediaTypes.API + RestconfConstants.JSON, Draft15.MediaTypes.API + RestconfConstants.XML,
-            MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+    @Produces({ Draft15.MediaTypes.DATA + RestconfConstants.JSON, Draft15.MediaTypes.DATA, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
     public NormalizedNodeContext getModule(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
 }
\ No newline at end of file
index f64b58bed9f3efdc6b202dd04c22600cd71ce739..e9726d4a5fa2d89c73e6726696590dff4fd06506 100644 (file)
@@ -34,8 +34,8 @@ public interface RestconfOperationsService {
      */
     @GET
     @Path("/operations")
-    @Produces({ Draft15.MediaTypes.API + RestconfConstants.JSON, Draft15.MediaTypes.API + RestconfConstants.XML,
-            MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+    @Produces({ Draft15.MediaTypes.DATA + RestconfConstants.JSON, Draft15.MediaTypes.DATA, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
     public NormalizedNodeContext getOperations(@Context UriInfo uriInfo);
 
     /**
@@ -49,7 +49,7 @@ public interface RestconfOperationsService {
      */
     @GET
     @Path("/operations/{identifier:.+}")
-    @Produces({ Draft15.MediaTypes.API + RestconfConstants.JSON, Draft15.MediaTypes.API + RestconfConstants.XML,
-            MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+    @Produces({ Draft15.MediaTypes.DATA + RestconfConstants.JSON, Draft15.MediaTypes.DATA, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
     public NormalizedNodeContext getOperations(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
 }
\ No newline at end of file
index d649d3af6efa292d6b937daf5e19b46335087da6..9b385de7d2f9ba55535b0e3771b8ad3543bb4e7f 100644 (file)
@@ -33,7 +33,7 @@ public interface RestconfStreamsService {
      */
     @GET
     @Path("data/ietf-restconf-monitoring:restconf-state/streams")
-    @Produces({ Draft15.MediaTypes.API + RestconfConstants.JSON, Draft15.MediaTypes.API + RestconfConstants.XML,
-            MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+    @Produces({ Draft15.MediaTypes.DATA + RestconfConstants.JSON, Draft15.MediaTypes.DATA, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
     public NormalizedNodeContext getAvailableStreams(@Context UriInfo uriInfo);
 }
\ No newline at end of file
index bd800311d7f6f0fc8a21c822499372eba012a68f..12bbf9f78ef1a15bd73af99217d8b94e0331e36d 100644 (file)
@@ -45,8 +45,8 @@ public interface RestconfDataService {
      */
     @GET
     @Path("/data/{identifier:.+}")
-    @Produces({ Draft15.MediaTypes.DATA + RestconfConstants.JSON, Draft15.MediaTypes.DATA + RestconfConstants.XML,
-            MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+    @Produces({ Draft15.MediaTypes.DATA + RestconfConstants.JSON, Draft15.MediaTypes.DATA, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
     NormalizedNodeContext readData(@Encoded @PathParam("identifier") String identifier,
             @Context UriInfo uriInfo);
 
@@ -61,8 +61,8 @@ public interface RestconfDataService {
      */
     @PUT
     @Path("/data/{identifier:.+}")
-    @Consumes({ Draft15.MediaTypes.DATA + RestconfConstants.JSON, Draft15.MediaTypes.DATA + RestconfConstants.XML,
-            MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+    @Consumes({ Draft15.MediaTypes.DATA + RestconfConstants.JSON, Draft15.MediaTypes.DATA, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
     Response putData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload);
 
     /**
@@ -78,8 +78,8 @@ public interface RestconfDataService {
      */
     @POST
     @Path("/data/{identifier:.+}")
-    @Consumes({ Draft15.MediaTypes.DATA + RestconfConstants.JSON, Draft15.MediaTypes.DATA + RestconfConstants.XML,
-            MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+    @Consumes({ Draft15.MediaTypes.DATA + RestconfConstants.JSON, Draft15.MediaTypes.DATA, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
     Response postData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
             @Context UriInfo uriInfo);
 
@@ -94,8 +94,8 @@ public interface RestconfDataService {
      */
     @POST
     @Path("/data")
-    @Consumes({ Draft15.MediaTypes.DATA + RestconfConstants.JSON, Draft15.MediaTypes.DATA + RestconfConstants.XML,
-            MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+    @Consumes({ Draft15.MediaTypes.DATA + RestconfConstants.JSON, Draft15.MediaTypes.DATA, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
     Response postData(NormalizedNodeContext payload, @Context UriInfo uriInfo);
 
     /**
index c37cd1311b13e3844954b067c3e0fa8623603fad..0cb12ada8ef98ea7d07da08c8e2b93e819e5cfa0 100644 (file)
@@ -41,14 +41,10 @@ public interface RestconfInvokeOperationsService {
      */
     @POST
     @Path("/operations/{identifier:.+}")
-    @Produces({ Draft15.MediaTypes.OPERATION + RestconfConstants.JSON,
-            Draft15.MediaTypes.OPERATION + RestconfConstants.XML, Draft15.MediaTypes.DATA + RestconfConstants.JSON,
-            Draft15.MediaTypes.DATA + RestconfConstants.XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML,
-            MediaType.TEXT_XML })
-    @Consumes({ Draft15.MediaTypes.OPERATION + RestconfConstants.JSON,
-            Draft15.MediaTypes.OPERATION + RestconfConstants.XML, Draft15.MediaTypes.DATA + RestconfConstants.JSON,
-            Draft15.MediaTypes.DATA + RestconfConstants.XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML,
-            MediaType.TEXT_XML })
+    @Produces({ Draft15.MediaTypes.DATA + RestconfConstants.JSON, Draft15.MediaTypes.DATA, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+    @Consumes({ Draft15.MediaTypes.DATA + RestconfConstants.JSON, Draft15.MediaTypes.DATA, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
     NormalizedNodeContext invokeRpc(@Encoded @PathParam("identifier") String identifier,
             NormalizedNodeContext payload, @Context UriInfo uriInfo);
 }