*/
package org.opendaylight.restconf.nb.rfc8040;
-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 java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import org.opendaylight.mdsal.dom.api.DOMActionService;
+import org.opendaylight.mdsal.dom.api.DOMDataBroker;
+import org.opendaylight.mdsal.dom.api.DOMMountPointService;
+import org.opendaylight.mdsal.dom.api.DOMNotificationService;
+import org.opendaylight.mdsal.dom.api.DOMRpcService;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
+import org.opendaylight.mdsal.dom.api.DOMYangTextSourceProvider;
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;
-import org.opendaylight.restconf.nb.rfc8040.jersey.providers.XmlNormalizedNodeBodyReader;
-import org.opendaylight.restconf.nb.rfc8040.jersey.providers.patch.JsonToPatchBodyReader;
-import org.opendaylight.restconf.nb.rfc8040.jersey.providers.patch.PatchJsonBodyWriter;
-import org.opendaylight.restconf.nb.rfc8040.jersey.providers.patch.PatchXmlBodyWriter;
-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.ServicesWrapper;
+import org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfStreamsSubscriptionService;
+import org.opendaylight.restconf.nb.rfc8040.rests.services.impl.RestconfDataServiceImpl;
+import org.opendaylight.restconf.nb.rfc8040.rests.services.impl.RestconfImpl;
+import org.opendaylight.restconf.nb.rfc8040.rests.services.impl.RestconfInvokeOperationsServiceImpl;
+import org.opendaylight.restconf.nb.rfc8040.rests.services.impl.RestconfOperationsServiceImpl;
+import org.opendaylight.restconf.nb.rfc8040.rests.services.impl.RestconfSchemaServiceImpl;
+import org.opendaylight.restconf.nb.rfc8040.rests.services.impl.RestconfStreamsSubscriptionServiceImpl;
+import org.opendaylight.restconf.nb.rfc8040.streams.Configuration;
-public class RestconfApplication extends Application {
- private final SchemaContextHandler schemaContextHandler;
- private final DOMMountPointServiceHandler mountPointServiceHandler;
- private final ServicesWrapper servicesWrapper;
+@Singleton
+public class RestconfApplication extends AbstractRestconfApplication {
+ private RestconfApplication(final SchemaContextHandler schemaContextHandler,
+ final DOMMountPointService mountPointService, final RestconfStreamsSubscriptionService streamSubscription,
+ final DOMDataBroker dataBroker, final DOMRpcService rpcService, final DOMActionService actionService,
+ final DOMNotificationService notificationService, final DOMSchemaService domSchemaService,
+ final Configuration configuration) {
+ super(schemaContextHandler, mountPointService, List.of(
+ streamSubscription,
+ new RestconfDataServiceImpl(schemaContextHandler, dataBroker, mountPointService, streamSubscription,
+ actionService, configuration),
+ new RestconfInvokeOperationsServiceImpl(rpcService, schemaContextHandler),
+ new RestconfOperationsServiceImpl(schemaContextHandler, mountPointService),
+ new RestconfSchemaServiceImpl(schemaContextHandler, mountPointService,
+ domSchemaService.getExtensions().getInstance(DOMYangTextSourceProvider.class)),
+ new RestconfImpl(schemaContextHandler)));
- public RestconfApplication(SchemaContextHandler schemaContextHandler,
- DOMMountPointServiceHandler mountPointServiceHandler, ServicesWrapper servicesWrapper) {
- this.schemaContextHandler = schemaContextHandler;
- this.mountPointServiceHandler = mountPointServiceHandler;
- this.servicesWrapper = servicesWrapper;
}
- @Override
- public Set<Class<?>> getClasses() {
- return ImmutableSet.<Class<?>>builder()
- .add(NormalizedNodeJsonBodyWriter.class).add(NormalizedNodeXmlBodyWriter.class)
- .add(SchemaExportContentYinBodyWriter.class).add(SchemaExportContentYangBodyWriter.class)
- .add(PatchJsonBodyWriter.class).add(PatchXmlBodyWriter.class)
- .build();
- }
-
- @Override
- public Set<Object> getSingletons() {
- final Set<Object> singletons = new HashSet<>();
- 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;
+ @Inject
+ public RestconfApplication(final SchemaContextHandler schemaContextHandler,
+ final DOMMountPointService mountPointService, final DOMDataBroker dataBroker,
+ final DOMRpcService rpcService, final DOMActionService actionService,
+ final DOMNotificationService notificationService,
+ final DOMSchemaService domSchemaService, final Configuration configuration) {
+ this(schemaContextHandler, mountPointService,
+ new RestconfStreamsSubscriptionServiceImpl(dataBroker, notificationService, schemaContextHandler,
+ configuration),
+ dataBroker, rpcService, actionService, notificationService, domSchemaService, configuration);
}
}