Skip to content

Commit

Permalink
Rework ApiDocServiceImpl initialization
Browse files Browse the repository at this point in the history
Swagger wiring has been reworked as part of:
https://jira.opendaylight.org/browse/NETCONF-771.

JIRA:LIGHTY-175
Signed-off-by: Ivan Hrasko <[email protected]>
  • Loading branch information
ihrasko committed Mar 28, 2023
1 parent 3711558 commit 16c0b4a
Showing 1 changed file with 2 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletContainer;
import org.opendaylight.netconf.sal.rest.doc.api.ApiDocService;
import org.opendaylight.netconf.sal.rest.doc.impl.AllModulesDocGenerator;
import org.opendaylight.netconf.sal.rest.doc.impl.ApiDocGeneratorRFC8040;
import org.opendaylight.netconf.sal.rest.doc.impl.ApiDocServiceImpl;
import org.opendaylight.netconf.sal.rest.doc.impl.MountPointSwaggerGeneratorRFC8040;
import org.opendaylight.netconf.sal.rest.doc.jaxrs.ApiDocApplication;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -41,7 +38,6 @@ public class SwaggerLighty extends AbstractLightyModule {
private final LightyServerBuilder jettyServerBuilder;
private final LightyServices lightyServices;

private MountPointSwaggerGeneratorRFC8040 mountPointSwaggerGeneratorRFC8040;
private ApiDocService apiDocService;

public SwaggerLighty(RestConfConfiguration restConfConfiguration,
Expand All @@ -59,16 +55,8 @@ protected boolean initProcedure() {
String basePathString = restConfConfiguration.getRestconfServletContextPath().replaceAll("^/+", "");
LOG.info("basePath: {}", basePathString);

this.mountPointSwaggerGeneratorRFC8040 = new MountPointSwaggerGeneratorRFC8040(
lightyServices.getDOMSchemaService(), lightyServices.getDOMMountPointService(),basePathString);

ApiDocGeneratorRFC8040 apiDocGeneratorRFC8040 = new ApiDocGeneratorRFC8040(
lightyServices.getDOMSchemaService(), basePathString);
AllModulesDocGenerator allModulesDocGenerator =
new AllModulesDocGenerator(apiDocGeneratorRFC8040);

this.apiDocService = new ApiDocServiceImpl(mountPointSwaggerGeneratorRFC8040,
apiDocGeneratorRFC8040, allModulesDocGenerator);
this.apiDocService = new ApiDocServiceImpl(lightyServices.getDOMSchemaService(),
lightyServices.getDOMMountPointService());

ApiDocApplication apiDocApplication = new ApiDocApplication(apiDocService);

Expand All @@ -90,9 +78,6 @@ protected boolean initProcedure() {
@Override
protected boolean stopProcedure() {
LOG.info("shutting down swagger ...");
if (mountPointSwaggerGeneratorRFC8040 != null) {
mountPointSwaggerGeneratorRFC8040.close();
}
return true;
}

Expand Down

0 comments on commit 16c0b4a

Please sign in to comment.