Eliminate nb.rfc8040.rests.services.api 40/109040/4
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 21 Nov 2023 16:38:17 +0000 (17:38 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 22 Nov 2023 15:12:23 +0000 (16:12 +0100)
This package contains just a specification and we can simply inline it
-- and move SchemaExportContext to nb.rfc8040.legacy pending further
refactor.

JIRA: NETCONF-773
Change-Id: Ia11b36dd66ca050cf8213d87e8d281250cd4de99
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/AbstractSchemaExportBodyWriter.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/YangSchemaExportBodyWriter.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/YinSchemaExportBodyWriter.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/legacy/SchemaExportContext.java [moved from restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/api/SchemaExportContext.java with 93% similarity]
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/api/RestconfSchemaService.java [deleted file]
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfSchemaServiceImpl.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfSchemaSourceUrlProvider.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserIdentifier.java
restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfSchemaServiceTest.java

index 8e6040f963b2370e502be21cafd16640216a30c2..f5aa413c603708774a36c7fd086c7babf75870b2 100644 (file)
@@ -11,7 +11,7 @@ import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.ext.MessageBodyWriter;
-import org.opendaylight.restconf.nb.rfc8040.rests.services.api.SchemaExportContext;
+import org.opendaylight.restconf.nb.rfc8040.legacy.SchemaExportContext;
 
 abstract class AbstractSchemaExportBodyWriter implements MessageBodyWriter<SchemaExportContext> {
     @Override
index 4738def08dbcd59ab51808fb97a4a381de2acea3..a55b38ee7ece1d875a6bd49fe4ad496e0d483a1a 100644 (file)
@@ -18,7 +18,7 @@ import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.Provider;
-import org.opendaylight.restconf.nb.rfc8040.rests.services.api.SchemaExportContext;
+import org.opendaylight.restconf.nb.rfc8040.legacy.SchemaExportContext;
 import org.opendaylight.yangtools.yang.common.Revision;
 import org.opendaylight.yangtools.yang.common.YangConstants;
 import org.opendaylight.yangtools.yang.model.api.Module;
index e34ca244ebe5d3c8d0fb3eaa04a10b3e16bbf473..b28c990cfa5845ba5150a32ba9e191ecd389a86a 100644 (file)
@@ -16,7 +16,7 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.Provider;
 import javax.xml.stream.XMLStreamException;
-import org.opendaylight.restconf.nb.rfc8040.rests.services.api.SchemaExportContext;
+import org.opendaylight.restconf.nb.rfc8040.legacy.SchemaExportContext;
 import org.opendaylight.yangtools.yang.common.YangConstants;
 import org.opendaylight.yangtools.yang.model.export.YinExportUtils;
 
similarity index 93%
rename from restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/api/SchemaExportContext.java
rename to restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/legacy/SchemaExportContext.java
index cd7fe8e6cd731c11b3e7bc7a2669e93c8e013cd2..99ca68ffa1a8040c62786cd155e7238b3d429e90 100644 (file)
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.restconf.nb.rfc8040.rests.services.api;
+package org.opendaylight.restconf.nb.rfc8040.legacy;
 
 import static java.util.Objects.requireNonNull;
 
diff --git a/restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/api/RestconfSchemaService.java b/restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/api/RestconfSchemaService.java
deleted file mode 100644 (file)
index 000e590..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.restconf.nb.rfc8040.rests.services.api;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import org.opendaylight.yangtools.yang.common.YangConstants;
-
-/**
- * Retrieval of the YANG modules which server supports.
- */
-@Path("/")
-public interface RestconfSchemaService {
-    /**
-     * Get schema of specific module.
-     *
-     * @param identifier path parameter
-     * @return {@link SchemaExportContext}
-     */
-    @GET
-    @Produces({ YangConstants.RFC6020_YIN_MEDIA_TYPE, YangConstants.RFC6020_YANG_MEDIA_TYPE })
-    @Path("modules/{identifier:.+}")
-    SchemaExportContext getSchema(@PathParam("identifier") String identifier);
-}
index 0f15f9f776f25c1dd27826d9bae20fa31c8ac881..5379b0f626fdbc6c9868da2df6fdb0aa14c32d5a 100644 (file)
@@ -10,19 +10,22 @@ package org.opendaylight.restconf.nb.rfc8040.rests.services.impl;
 import static com.google.common.base.Preconditions.checkArgument;
 import static java.util.Objects.requireNonNull;
 
+import javax.ws.rs.GET;
 import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
 import org.opendaylight.mdsal.dom.api.DOMMountPointService;
 import org.opendaylight.mdsal.dom.api.DOMSchemaService;
 import org.opendaylight.mdsal.dom.api.DOMYangTextSourceProvider;
-import org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfSchemaService;
-import org.opendaylight.restconf.nb.rfc8040.rests.services.api.SchemaExportContext;
+import org.opendaylight.restconf.nb.rfc8040.legacy.SchemaExportContext;
 import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier;
+import org.opendaylight.yangtools.yang.common.YangConstants;
 
 /**
- * Implementation of {@link RestconfSchemaService}.
+ * Retrieval of the YANG modules which server supports.
  */
 @Path("/")
-public class RestconfSchemaServiceImpl implements RestconfSchemaService {
+public class RestconfSchemaServiceImpl {
     private final DOMSchemaService schemaService;
     private final DOMMountPointService mountPointService;
     private final DOMYangTextSourceProvider sourceProvider;
@@ -41,8 +44,16 @@ public class RestconfSchemaServiceImpl implements RestconfSchemaService {
         checkArgument(sourceProvider != null, "No DOMYangTextSourceProvider available in %s", schemaService);
     }
 
-    @Override
-    public SchemaExportContext getSchema(final String identifier) {
+    /**
+     * Get schema of specific module.
+     *
+     * @param identifier path parameter
+     * @return {@link SchemaExportContext}
+     */
+    @GET
+    @Produces({ YangConstants.RFC6020_YIN_MEDIA_TYPE, YangConstants.RFC6020_YANG_MEDIA_TYPE })
+    @Path("modules/{identifier:.+}")
+    public SchemaExportContext getSchema(@PathParam("identifier") final String identifier) {
         return ParserIdentifier.toSchemaExportContextFromIdentifier(schemaService.getGlobalContext(), identifier,
             mountPointService, sourceProvider);
     }
index 5d148ac7fc617a53428337508269ee44e996772a..98cc60c549076074bc4cfd80e163360899f9ea17 100644 (file)
@@ -23,7 +23,7 @@ import org.osgi.service.component.annotations.Component;
  * <p>The URL is expected to be requested by {@link org.opendaylight.netconf.yanglib.writer.YangLibraryWriter
  * YangLibraryWriter} when yang-library data is being constructed, only default module-set name ("ODL_modules")
  * is supported. The composed URL for resource download expected to be served by
- * {@link org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfSchemaService RestconfSchemaService}.
+ * {@link RestconfSchemaServiceImpl}.
  */
 @Singleton
 @Component(immediate = true, service = YangLibrarySchemaSourceUrlProvider.class)
index e4aaa43345069478927a419653912ef7daa80f51..a288ccf75f0944f530b3b1ab763f3e37954b01c4 100644 (file)
@@ -26,7 +26,7 @@ import org.opendaylight.mdsal.dom.api.DOMYangTextSourceProvider;
 import org.opendaylight.restconf.api.ApiPath;
 import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
 import org.opendaylight.restconf.nb.rfc8040.legacy.InstanceIdentifierContext;
-import org.opendaylight.restconf.nb.rfc8040.rests.services.api.SchemaExportContext;
+import org.opendaylight.restconf.nb.rfc8040.legacy.SchemaExportContext;
 import org.opendaylight.yangtools.yang.common.ErrorTag;
 import org.opendaylight.yangtools.yang.common.ErrorType;
 import org.opendaylight.yangtools.yang.common.Revision;
index 103350152eacfa04c894b1160db21f7f4ead48a3..8b9b53fd657317445c0f6b12a23ab2dde2984cf3 100644 (file)
@@ -24,7 +24,6 @@ import org.opendaylight.mdsal.dom.broker.DOMMountPointServiceImpl;
 import org.opendaylight.mdsal.dom.spi.FixedDOMSchemaService;
 import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
 import org.opendaylight.restconf.nb.rfc8040.legacy.ErrorTags;
-import org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfSchemaService;
 import org.opendaylight.yangtools.yang.common.ErrorTag;
 import org.opendaylight.yangtools.yang.common.ErrorType;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -57,7 +56,7 @@ public class RestconfSchemaServiceTest {
         YangParserTestUtils.parseYangResourceDirectory("/modules/mount-points");
 
     // service under test
-    private RestconfSchemaService schemaService;
+    private RestconfSchemaServiceImpl schemaService;
 
     // handlers
     @Mock