Eliminate RestconfInvokeOperationsServiceImpl
[netconf.git] / restconf / restconf-nb / src / main / java / org / opendaylight / restconf / nb / rfc8040 / RestconfApplication.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.restconf.nb.rfc8040;
9
10 import java.util.Set;
11 import javax.ws.rs.core.Application;
12 import org.opendaylight.mdsal.dom.api.DOMActionService;
13 import org.opendaylight.mdsal.dom.api.DOMDataBroker;
14 import org.opendaylight.mdsal.dom.api.DOMMountPointService;
15 import org.opendaylight.mdsal.dom.api.DOMNotificationService;
16 import org.opendaylight.mdsal.dom.api.DOMSchemaService;
17 import org.opendaylight.restconf.nb.rfc8040.databind.DatabindProvider;
18 import org.opendaylight.restconf.nb.rfc8040.jersey.providers.JsonNormalizedNodeBodyWriter;
19 import org.opendaylight.restconf.nb.rfc8040.jersey.providers.JsonPatchStatusBodyWriter;
20 import org.opendaylight.restconf.nb.rfc8040.jersey.providers.XmlNormalizedNodeBodyWriter;
21 import org.opendaylight.restconf.nb.rfc8040.jersey.providers.XmlPatchStatusBodyWriter;
22 import org.opendaylight.restconf.nb.rfc8040.jersey.providers.YangSchemaExportBodyWriter;
23 import org.opendaylight.restconf.nb.rfc8040.jersey.providers.YinSchemaExportBodyWriter;
24 import org.opendaylight.restconf.nb.rfc8040.jersey.providers.errors.RestconfDocumentedExceptionMapper;
25 import org.opendaylight.restconf.nb.rfc8040.rests.services.impl.MdsalRestconfServer;
26 import org.opendaylight.restconf.nb.rfc8040.rests.services.impl.RestconfDataServiceImpl;
27 import org.opendaylight.restconf.nb.rfc8040.rests.services.impl.RestconfImpl;
28 import org.opendaylight.restconf.nb.rfc8040.rests.services.impl.RestconfOperationsServiceImpl;
29 import org.opendaylight.restconf.nb.rfc8040.rests.services.impl.RestconfSchemaServiceImpl;
30
31 final class RestconfApplication extends Application {
32     private final Set<Object> singletons;
33
34     RestconfApplication(final DatabindProvider databindProvider, final MdsalRestconfServer server,
35             final DOMMountPointService mountPointService, final DOMDataBroker dataBroker,
36             final DOMActionService actionService, final DOMNotificationService notificationService,
37             final DOMSchemaService domSchemaService) {
38         singletons = Set.of(
39             new RestconfDocumentedExceptionMapper(databindProvider),
40             new RestconfDataServiceImpl(databindProvider, server, actionService),
41             new RestconfOperationsServiceImpl(server),
42             new RestconfSchemaServiceImpl(domSchemaService, mountPointService),
43             new RestconfImpl(databindProvider));
44     }
45
46     @Override
47     public Set<Class<?>> getClasses() {
48         return Set.of(
49             JsonNormalizedNodeBodyWriter.class, XmlNormalizedNodeBodyWriter.class,
50             YinSchemaExportBodyWriter.class, YangSchemaExportBodyWriter.class,
51             JsonPatchStatusBodyWriter.class, XmlPatchStatusBodyWriter.class);
52     }
53
54     @Override
55     public Set<Object> getSingletons() {
56         return singletons;
57     }
58 }