Rename *Swagger* classes to *OpenApi*
[netconf.git] / restconf / sal-rest-docgen / src / main / java / org / opendaylight / netconf / sal / rest / doc / mountpoints / MountPointOpenApi.java
similarity index 90%
rename from restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/mountpoints/MountPointSwagger.java
rename to restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/mountpoints/MountPointOpenApi.java
index 9a0076b7f3dbce3bc6333ae0f91f7bdb64af58e1..1b5f1c140391627c2c20900017f41b7673f234da 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.netconf.sal.rest.doc.mountpoints;
 import static com.google.common.base.Preconditions.checkState;
 import static java.util.Objects.requireNonNull;
 import static org.opendaylight.netconf.sal.rest.doc.impl.ApiDocServiceImpl.DEFAULT_PAGESIZE;
-import static org.opendaylight.netconf.sal.rest.doc.impl.BaseYangSwaggerGenerator.BASE_PATH;
+import static org.opendaylight.netconf.sal.rest.doc.impl.BaseYangOpenApiGenerator.BASE_PATH;
 import static org.opendaylight.netconf.sal.rest.doc.model.builder.OperationBuilder.DESCRIPTION_KEY;
 import static org.opendaylight.netconf.sal.rest.doc.model.builder.OperationBuilder.RESPONSES_KEY;
 import static org.opendaylight.netconf.sal.rest.doc.model.builder.OperationBuilder.SUMMARY_KEY;
@@ -34,7 +34,7 @@ import javax.ws.rs.core.UriInfo;
 import org.opendaylight.mdsal.dom.api.DOMMountPointListener;
 import org.opendaylight.mdsal.dom.api.DOMMountPointService;
 import org.opendaylight.mdsal.dom.api.DOMSchemaService;
-import org.opendaylight.netconf.sal.rest.doc.impl.BaseYangSwaggerGenerator;
+import org.opendaylight.netconf.sal.rest.doc.impl.BaseYangOpenApiGenerator;
 import org.opendaylight.netconf.sal.rest.doc.impl.DefinitionNames;
 import org.opendaylight.netconf.sal.rest.doc.openapi.CommonApiObject;
 import org.opendaylight.netconf.sal.rest.doc.openapi.SwaggerObject;
@@ -47,16 +47,16 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class MountPointSwagger implements DOMMountPointListener, AutoCloseable {
+public class MountPointOpenApi implements DOMMountPointListener, AutoCloseable {
 
-    private static final Logger LOG = LoggerFactory.getLogger(MountPointSwagger.class);
+    private static final Logger LOG = LoggerFactory.getLogger(MountPointOpenApi.class);
 
     private static final String DATASTORES_REVISION = "-";
     private static final String DATASTORES_LABEL = "Datastores";
 
     private final DOMSchemaService globalSchema;
     private final DOMMountPointService mountService;
-    private final BaseYangSwaggerGenerator swaggerGenerator;
+    private final BaseYangOpenApiGenerator openApiGenerator;
     private final Map<YangInstanceIdentifier, Long> instanceIdToLongId =
             new TreeMap<>((o1, o2) -> o1.toString().compareToIgnoreCase(o2.toString()));
     private final Map<Long, YangInstanceIdentifier> longIdToInstanceId = new HashMap<>();
@@ -67,11 +67,11 @@ public class MountPointSwagger implements DOMMountPointListener, AutoCloseable {
 
     private ListenerRegistration<DOMMountPointListener> registration;
 
-    public MountPointSwagger(final DOMSchemaService globalSchema, final DOMMountPointService mountService,
-            final BaseYangSwaggerGenerator swaggerGenerator) {
+    public MountPointOpenApi(final DOMSchemaService globalSchema, final DOMMountPointService mountService,
+            final BaseYangOpenApiGenerator openApiGenerator) {
         this.globalSchema = requireNonNull(globalSchema);
         this.mountService = requireNonNull(mountService);
-        this.swaggerGenerator = requireNonNull(swaggerGenerator);
+        this.openApiGenerator = requireNonNull(openApiGenerator);
     }
 
     public void init() {
@@ -91,7 +91,7 @@ public class MountPointSwagger implements DOMMountPointListener, AutoCloseable {
             final SchemaContext context = globalSchema.getGlobalContext();
             for (final Entry<YangInstanceIdentifier, Long> entry : instanceIdToLongId.entrySet()) {
                 final String modName = findModuleName(entry.getKey(), context);
-                urlToId.put(swaggerGenerator.generateUrlPrefixFromInstanceID(entry.getKey(), modName),
+                urlToId.put(openApiGenerator.generateUrlPrefixFromInstanceID(entry.getKey(), modName),
                         entry.getValue());
             }
         }
@@ -110,7 +110,7 @@ public class MountPointSwagger implements DOMMountPointListener, AutoCloseable {
 
     private String getYangMountUrl(final YangInstanceIdentifier key) {
         final String modName = findModuleName(key, globalSchema.getGlobalContext());
-        return swaggerGenerator.generateUrlPrefixFromInstanceID(key, modName) + "yang-ext:mount";
+        return openApiGenerator.generateUrlPrefixFromInstanceID(key, modName) + "yang-ext:mount";
     }
 
     private YangInstanceIdentifier getInstanceId(final Long id) {
@@ -147,9 +147,9 @@ public class MountPointSwagger implements DOMMountPointListener, AutoCloseable {
         if (DATASTORES_LABEL.equals(module) && DATASTORES_REVISION.equals(revision)) {
             return generateDataStoreApiDoc(uriInfo, urlPrefix, deviceName);
         }
-        final SwaggerObject swaggerObject = swaggerGenerator.getApiDeclaration(module, revision, uriInfo, context,
+        final SwaggerObject swaggerObject = openApiGenerator.getApiDeclaration(module, revision, uriInfo, context,
                 urlPrefix);
-        return BaseYangSwaggerGenerator.convertToOpenApi(swaggerObject);
+        return BaseYangOpenApiGenerator.convertToOpenApi(swaggerObject);
     }
 
     public CommonApiObject getMountPointApi(final UriInfo uriInfo, final Long id, final Optional<Integer> pageNum) {
@@ -180,7 +180,7 @@ public class MountPointSwagger implements DOMMountPointListener, AutoCloseable {
 
         final SwaggerObject doc;
 
-        final SwaggerObject swaggerObject = swaggerGenerator.getAllModulesDoc(uriInfo, range, context,
+        final SwaggerObject swaggerObject = openApiGenerator.getAllModulesDoc(uriInfo, range, context,
                 Optional.of(deviceName), urlPrefix, definitionNames);
 
         if (includeDataStore) {
@@ -192,7 +192,7 @@ public class MountPointSwagger implements DOMMountPointListener, AutoCloseable {
             doc = swaggerObject;
         }
 
-        return BaseYangSwaggerGenerator.convertToOpenApi(doc);
+        return BaseYangOpenApiGenerator.convertToOpenApi(doc);
     }
 
     private static String extractDeviceName(final YangInstanceIdentifier iid) {
@@ -202,9 +202,9 @@ public class MountPointSwagger implements DOMMountPointListener, AutoCloseable {
 
     private SwaggerObject generateDataStoreApiDoc(final UriInfo uriInfo, final String context,
             final String deviceName) {
-        final SwaggerObject declaration = swaggerGenerator.createSwaggerObject(
-                swaggerGenerator.createSchemaFromUriInfo(uriInfo),
-                swaggerGenerator.createHostFromUriInfo(uriInfo),
+        final SwaggerObject declaration = openApiGenerator.createSwaggerObject(
+                openApiGenerator.createSchemaFromUriInfo(uriInfo),
+                openApiGenerator.createHostFromUriInfo(uriInfo),
                 BASE_PATH,
                 context);
 
@@ -234,7 +234,7 @@ public class MountPointSwagger implements DOMMountPointListener, AutoCloseable {
         final ObjectNode responses = JsonNodeFactory.instance.objectNode();
         responses.set(String.valueOf(Response.Status.OK.getStatusCode()), okResponse);
         operationObject.set(RESPONSES_KEY, responses);
-        pathsObject.set(swaggerGenerator.getResourcePath(resourceType, context), pathItem);
+        pathsObject.set(openApiGenerator.getResourcePath(resourceType, context), pathItem);
     }
 
     @Override