2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.netconf.sal.rest.impl;
10 import com.google.common.collect.ImmutableSet;
11 import java.util.HashSet;
13 import javax.inject.Inject;
14 import javax.inject.Singleton;
15 import javax.ws.rs.core.Application;
16 import org.opendaylight.netconf.md.sal.rest.schema.SchemaExportContentYangBodyWriter;
17 import org.opendaylight.netconf.md.sal.rest.schema.SchemaExportContentYinBodyWriter;
18 import org.opendaylight.netconf.md.sal.rest.schema.SchemaRetrievalServiceImpl;
19 import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
20 import org.opendaylight.netconf.sal.restconf.impl.StatisticsRestconfServiceWrapper;
21 import org.slf4j.Logger;
22 import org.slf4j.LoggerFactory;
25 @Deprecated(since = "2.0.12")
26 public class RestconfApplication extends Application {
27 private static final Logger LOG = LoggerFactory.getLogger(RestconfApplication.class);
29 private final ControllerContext controllerContext;
30 private final StatisticsRestconfServiceWrapper statsServiceWrapper;
33 public RestconfApplication(final ControllerContext controllerContext,
34 final StatisticsRestconfServiceWrapper statsServiceWrapper) {
35 this.controllerContext = controllerContext;
36 this.statsServiceWrapper = statsServiceWrapper;
37 LOG.warn("Pre-standard version of RESTCONF activated. Please note that this implementation is considered "
38 + "obsoleve and WILL BE REMOVED IN THE NEXT MAJOR RELEASE. Please use the RFC8040-compliant "
39 + "implementation instead.");
43 public Set<Class<?>> getClasses() {
44 return ImmutableSet.<Class<?>>builder()
45 .add(PatchJsonBodyWriter.class)
46 .add(PatchXmlBodyWriter.class)
47 .add(NormalizedNodeJsonBodyWriter.class)
48 .add(NormalizedNodeXmlBodyWriter.class)
49 .add(SchemaExportContentYinBodyWriter.class)
50 .add(SchemaExportContentYangBodyWriter.class)
55 public Set<Object> getSingletons() {
56 final Set<Object> singletons = new HashSet<>();
57 final SchemaRetrievalServiceImpl schemaRetrieval = new SchemaRetrievalServiceImpl(controllerContext);
58 singletons.add(schemaRetrieval);
59 singletons.add(new RestconfCompositeWrapper(statsServiceWrapper, schemaRetrieval));
60 singletons.add(new RestconfDocumentedExceptionMapper(controllerContext));
61 singletons.add(new XmlNormalizedNodeBodyReader(controllerContext));
62 singletons.add(new JsonNormalizedNodeBodyReader(controllerContext));
63 singletons.add(new XmlToPatchBodyReader(controllerContext));
64 singletons.add(new JsonToPatchBodyReader(controllerContext));
65 // singletons.add(StructuredDataToXmlProvider.INSTANCE);
66 // singletons.add(StructuredDataToJsonProvider.INSTANCE);
67 // singletons.add(JsonToCompositeNodeProvider.INSTANCE);
68 // singletons.add(XmlToCompositeNodeProvider.INSTANCE);