From: Jakub Toth Date: Tue, 2 Aug 2016 17:58:38 +0000 (-0400) Subject: Bug 6325 - upgrade draft11 to draft15 - change media types X-Git-Tag: release/carbon~240^2~3 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=ad3be50e3b5346cddeebb761c9162684389ea938;p=netconf.git Bug 6325 - upgrade draft11 to draft15 - change media types * 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 --- diff --git a/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java b/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java index 9e1dcb2ee2..fd2b14102a 100644 --- a/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java +++ b/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java @@ -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 { private final static Logger LOG = LoggerFactory.getLogger(JsonNormalizedNodeBodyReader.class); diff --git a/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/NormalizedNodeJsonBodyWriter.java b/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/NormalizedNodeJsonBodyWriter.java index ff3f9f42b6..b262758fc7 100644 --- a/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/NormalizedNodeJsonBodyWriter.java +++ b/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/NormalizedNodeJsonBodyWriter.java @@ -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 { private static final int DEFAULT_INDENT_SPACES_NUM = 2; diff --git a/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/NormalizedNodeXmlBodyWriter.java b/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/NormalizedNodeXmlBodyWriter.java index b1ede154d7..576ea8f82a 100644 --- a/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/NormalizedNodeXmlBodyWriter.java +++ b/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/NormalizedNodeXmlBodyWriter.java @@ -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 { private static final XMLOutputFactory XML_FACTORY; diff --git a/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlNormalizedNodeBodyReader.java b/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlNormalizedNodeBodyReader.java index b13832c9b9..97867111a7 100644 --- a/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlNormalizedNodeBodyReader.java +++ b/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlNormalizedNodeBodyReader.java @@ -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 { private final static Logger LOG = LoggerFactory.getLogger(XmlNormalizedNodeBodyReader.class); diff --git a/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/Draft15.java b/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/Draft15.java index e6f80b1a74..885229515c 100644 --- a/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/Draft15.java +++ b/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/Draft15.java @@ -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"; } diff --git a/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/api/RestconfModulesService.java b/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/api/RestconfModulesService.java index e4478445c4..4b3f97d65c 100644 --- a/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/api/RestconfModulesService.java +++ b/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/api/RestconfModulesService.java @@ -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 diff --git a/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/api/RestconfOperationsService.java b/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/api/RestconfOperationsService.java index f64b58bed9..e9726d4a5f 100644 --- a/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/api/RestconfOperationsService.java +++ b/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/api/RestconfOperationsService.java @@ -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 diff --git a/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/api/RestconfStreamsService.java b/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/api/RestconfStreamsService.java index d649d3af6e..9b385de7d2 100644 --- a/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/api/RestconfStreamsService.java +++ b/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/api/RestconfStreamsService.java @@ -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 diff --git a/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/restful/services/api/RestconfDataService.java b/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/restful/services/api/RestconfDataService.java index bd800311d7..12bbf9f78e 100644 --- a/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/restful/services/api/RestconfDataService.java +++ b/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/restful/services/api/RestconfDataService.java @@ -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); /** diff --git a/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/restful/services/api/RestconfInvokeOperationsService.java b/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/restful/services/api/RestconfInvokeOperationsService.java index c37cd1311b..0cb12ada8e 100644 --- a/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/restful/services/api/RestconfInvokeOperationsService.java +++ b/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/restful/services/api/RestconfInvokeOperationsService.java @@ -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); }