Introduce RestconfServer.dataPOST()
[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.DOMMountPointService;
13 import org.opendaylight.mdsal.dom.api.DOMSchemaService;
14 import org.opendaylight.restconf.nb.rfc8040.databind.DatabindProvider;
15 import org.opendaylight.restconf.nb.rfc8040.jersey.providers.JsonNormalizedNodeBodyWriter;
16 import org.opendaylight.restconf.nb.rfc8040.jersey.providers.JsonPatchStatusBodyWriter;
17 import org.opendaylight.restconf.nb.rfc8040.jersey.providers.XmlNormalizedNodeBodyWriter;
18 import org.opendaylight.restconf.nb.rfc8040.jersey.providers.XmlPatchStatusBodyWriter;
19 import org.opendaylight.restconf.nb.rfc8040.jersey.providers.YangSchemaExportBodyWriter;
20 import org.opendaylight.restconf.nb.rfc8040.jersey.providers.YinSchemaExportBodyWriter;
21 import org.opendaylight.restconf.nb.rfc8040.jersey.providers.errors.RestconfDocumentedExceptionMapper;
22 import org.opendaylight.restconf.nb.rfc8040.rests.services.impl.RestconfImpl;
23 import org.opendaylight.restconf.nb.rfc8040.rests.services.impl.RestconfSchemaServiceImpl;
24 import org.opendaylight.restconf.server.api.RestconfServer;
25
26 final class RestconfApplication extends Application {
27     private final Set<Object> singletons;
28
29     RestconfApplication(final DatabindProvider databindProvider, final RestconfServer server,
30             final DOMMountPointService mountPointService, final DOMSchemaService domSchemaService) {
31         singletons = Set.of(
32             new RestconfDocumentedExceptionMapper(databindProvider),
33             new RestconfImpl(server),
34             new RestconfSchemaServiceImpl(domSchemaService, mountPointService));
35     }
36
37     @Override
38     public Set<Class<?>> getClasses() {
39         return Set.of(
40             JsonNormalizedNodeBodyWriter.class, XmlNormalizedNodeBodyWriter.class,
41             YinSchemaExportBodyWriter.class, YangSchemaExportBodyWriter.class,
42             JsonPatchStatusBodyWriter.class, XmlPatchStatusBodyWriter.class);
43     }
44
45     @Override
46     public Set<Object> getSingletons() {
47         return singletons;
48     }
49 }