X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=restconf%2Frestconf-nb-rfc8040%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Frestconf%2Fnb%2Frfc8040%2FRestconfApplication.java;h=89c858788043374e911f576b6cd2f35a74ee8279;hb=5defe99f336b51d4e96473aff6de4b9e6af8cb34;hp=e779281483c80b1a1c3b0e48c4e8e422af8e9b65;hpb=352559891fbfd6cd3ae9cacbc788b1a821b2a49e;p=netconf.git diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/RestconfApplication.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/RestconfApplication.java index e779281483..89c8587880 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/RestconfApplication.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/RestconfApplication.java @@ -11,6 +11,8 @@ import com.google.common.collect.ImmutableSet; import java.util.HashSet; import java.util.Set; import javax.ws.rs.core.Application; +import org.opendaylight.restconf.nb.rfc8040.handlers.DOMMountPointServiceHandler; +import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler; import org.opendaylight.restconf.nb.rfc8040.jersey.providers.JsonNormalizedNodeBodyReader; import org.opendaylight.restconf.nb.rfc8040.jersey.providers.NormalizedNodeJsonBodyWriter; import org.opendaylight.restconf.nb.rfc8040.jersey.providers.NormalizedNodeXmlBodyWriter; @@ -21,17 +23,25 @@ import org.opendaylight.restconf.nb.rfc8040.jersey.providers.patch.PatchXmlBodyW import org.opendaylight.restconf.nb.rfc8040.jersey.providers.patch.XmlToPatchBodyReader; import org.opendaylight.restconf.nb.rfc8040.jersey.providers.schema.SchemaExportContentYangBodyWriter; import org.opendaylight.restconf.nb.rfc8040.jersey.providers.schema.SchemaExportContentYinBodyWriter; -import org.opendaylight.restconf.nb.rfc8040.services.wrapper.ServicesWrapperImpl; +import org.opendaylight.restconf.nb.rfc8040.services.wrapper.ServicesWrapper; public class RestconfApplication extends Application { + private final SchemaContextHandler schemaContextHandler; + private final DOMMountPointServiceHandler mountPointServiceHandler; + private final ServicesWrapper servicesWrapper; + + public RestconfApplication(SchemaContextHandler schemaContextHandler, + DOMMountPointServiceHandler mountPointServiceHandler, ServicesWrapper servicesWrapper) { + this.schemaContextHandler = schemaContextHandler; + this.mountPointServiceHandler = mountPointServiceHandler; + this.servicesWrapper = servicesWrapper; + } @Override public Set> getClasses() { return ImmutableSet.>builder() .add(NormalizedNodeJsonBodyWriter.class).add(NormalizedNodeXmlBodyWriter.class) - .add(JsonNormalizedNodeBodyReader.class).add(XmlNormalizedNodeBodyReader.class) .add(SchemaExportContentYinBodyWriter.class).add(SchemaExportContentYangBodyWriter.class) - .add(JsonToPatchBodyReader.class).add(XmlToPatchBodyReader.class) .add(PatchJsonBodyWriter.class).add(PatchXmlBodyWriter.class) .build(); } @@ -39,7 +49,11 @@ public class RestconfApplication extends Application { @Override public Set getSingletons() { final Set singletons = new HashSet<>(); - singletons.add(ServicesWrapperImpl.getInstance()); + singletons.add(servicesWrapper); + singletons.add(new JsonNormalizedNodeBodyReader(schemaContextHandler, mountPointServiceHandler)); + singletons.add(new JsonToPatchBodyReader(schemaContextHandler, mountPointServiceHandler)); + singletons.add(new XmlNormalizedNodeBodyReader(schemaContextHandler, mountPointServiceHandler)); + singletons.add(new XmlToPatchBodyReader(schemaContextHandler, mountPointServiceHandler)); return singletons; } }