Use YangConstants.RFC6020_YIN_MEDIA_TYPE 01/92301/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 7 Jul 2020 18:05:01 +0000 (20:05 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 26 Aug 2020 22:04:15 +0000 (00:04 +0200)
application/yin+xml media type is an RFC6020 definition, and hence
its common definition lives in YangConstants. Use it for there
instead of brewing our own.

Change-Id: I6d9f9fd123ffa6db41994d55400bd8c640c6a1f4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit fe99fcac52d3bd524f8046e0ea151b7704f3d90e)

restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/md/sal/rest/schema/SchemaExportContentYinBodyWriter.java
restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/md/sal/rest/schema/SchemaRetrievalService.java
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/Rfc8040.java
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/schema/SchemaExportContentYinBodyWriter.java
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/services/simple/api/RestconfSchemaService.java

index 707e397a4c1cf40095b3908ca5a426d72f0f68d8..9f4f8be89ce2b226e1304115e5c3080a02168b63 100644 (file)
@@ -18,10 +18,11 @@ import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
 import javax.xml.stream.XMLStreamException;
 import org.opendaylight.restconf.common.schema.SchemaExportContext;
+import org.opendaylight.yangtools.yang.common.YangConstants;
 import org.opendaylight.yangtools.yang.model.export.YinExportUtils;
 
 @Provider
-@Produces({ SchemaRetrievalService.YIN_MEDIA_TYPE })
+@Produces({ YangConstants.RFC6020_YIN_MEDIA_TYPE })
 public class SchemaExportContentYinBodyWriter implements MessageBodyWriter<SchemaExportContext> {
 
     @Override
@@ -46,6 +47,5 @@ public class SchemaExportContentYinBodyWriter implements MessageBodyWriter<Schem
         } catch (final XMLStreamException e) {
             throw new IllegalStateException(e);
         }
-
     }
 }
index ed7e1432d61883ff0e563a2b5d30bde2ab1d5869..a20d0411887a6aa3e948d98d07d9956c69e830c8 100644 (file)
@@ -23,11 +23,8 @@ import org.opendaylight.yangtools.yang.common.YangConstants;
 @Deprecated
 @Beta
 public interface SchemaRetrievalService {
-
-    String YIN_MEDIA_TYPE = "application/yin+xml";
-
     @GET
-    @Produces({YIN_MEDIA_TYPE, YangConstants.RFC6020_YANG_MEDIA_TYPE})
+    @Produces({YangConstants.RFC6020_YIN_MEDIA_TYPE, YangConstants.RFC6020_YANG_MEDIA_TYPE})
     @Path("/modules/module/{identifier:.+}/schema")
     SchemaExportContext getSchema(@PathParam("identifier") String mountAndModuleId);
 }
index ba444a5abf9f81602ee3901e95643f450e710dd5..404afd6afdc461e1a118d33e868e09cf76c5eb57 100644 (file)
@@ -42,7 +42,6 @@ public final class Rfc8040 {
         public static final String DATA = "application/yang-data";
         public static final String YANG_PATCH = "application/yang.patch";
         public static final String YANG_PATCH_STATUS = "application/yang.patch-status";
-        public static final String YIN = "application/yin";
     }
 
     /**
index baae974370ffaafa8cac9b71105b83562854b11c..d9b1ca4ff532015639393d29cb59496c81aeb5d4 100644 (file)
@@ -18,12 +18,11 @@ import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
 import javax.xml.stream.XMLStreamException;
 import org.opendaylight.restconf.common.schema.SchemaExportContext;
-import org.opendaylight.restconf.nb.rfc8040.Rfc8040;
-import org.opendaylight.restconf.nb.rfc8040.utils.RestconfConstants;
+import org.opendaylight.yangtools.yang.common.YangConstants;
 import org.opendaylight.yangtools.yang.model.export.YinExportUtils;
 
 @Provider
-@Produces({ Rfc8040.MediaTypes.YIN + RestconfConstants.XML })
+@Produces({ YangConstants.RFC6020_YIN_MEDIA_TYPE })
 public class SchemaExportContentYinBodyWriter implements MessageBodyWriter<SchemaExportContext> {
 
     @Override
index 3e18718854eab841edadd4963459e8df4ec53359..c292782550af679a75cc67c7b5147def372f8a22 100644 (file)
@@ -12,8 +12,6 @@ import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import org.opendaylight.restconf.common.schema.SchemaExportContext;
-import org.opendaylight.restconf.nb.rfc8040.Rfc8040;
-import org.opendaylight.restconf.nb.rfc8040.utils.RestconfConstants;
 import org.opendaylight.yangtools.yang.common.YangConstants;
 
 /**
@@ -31,7 +29,7 @@ public interface RestconfSchemaService extends UpdateHandlers {
      * @return {@link SchemaExportContext}
      */
     @GET
-    @Produces({ Rfc8040.MediaTypes.YIN + RestconfConstants.XML, YangConstants.RFC6020_YANG_MEDIA_TYPE })
+    @Produces({ YangConstants.RFC6020_YIN_MEDIA_TYPE, YangConstants.RFC6020_YANG_MEDIA_TYPE })
     @Path("modules/{identifier:.+}")
     SchemaExportContext getSchema(@PathParam("identifier") String identifier);
 }