Do not include restconf-nb-bierman02 in odl-restconf
[netconf.git] / restconf / restconf-nb-bierman02 / src / main / java / org / opendaylight / netconf / sal / rest / impl / RestconfApplication.java
index 9dd5a59ddae62d96fa245afa3bc354ed46d94bd2..d8918dfaeba7792b00fa3cd4f593a2930c5273cd 100644 (file)
@@ -10,15 +10,34 @@ package org.opendaylight.netconf.sal.rest.impl;
 import com.google.common.collect.ImmutableSet;
 import java.util.HashSet;
 import java.util.Set;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.ws.rs.core.Application;
 import org.opendaylight.netconf.md.sal.rest.schema.SchemaExportContentYangBodyWriter;
 import org.opendaylight.netconf.md.sal.rest.schema.SchemaExportContentYinBodyWriter;
 import org.opendaylight.netconf.md.sal.rest.schema.SchemaRetrievalServiceImpl;
-import org.opendaylight.netconf.sal.restconf.impl.BrokerFacade;
 import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
 import org.opendaylight.netconf.sal.restconf.impl.StatisticsRestconfServiceWrapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
+@Singleton
+@Deprecated(since = "2.0.12")
 public class RestconfApplication extends Application {
+    private static final Logger LOG = LoggerFactory.getLogger(RestconfApplication.class);
+
+    private final ControllerContext controllerContext;
+    private final StatisticsRestconfServiceWrapper statsServiceWrapper;
+
+    @Inject
+    public RestconfApplication(final ControllerContext controllerContext,
+            final StatisticsRestconfServiceWrapper statsServiceWrapper) {
+        this.controllerContext = controllerContext;
+        this.statsServiceWrapper = statsServiceWrapper;
+        LOG.warn("Pre-standard version of RESTCONF activated. Please note that this implementation is considered "
+            + "obsoleve and WILL BE REMOVED IN THE NEXT MAJOR RELEASE. Please use the RFC8040-compliant "
+            + "implementation instead.");
+    }
 
     @Override
     public Set<Class<?>> getClasses() {
@@ -35,13 +54,9 @@ public class RestconfApplication extends Application {
     @Override
     public Set<Object> getSingletons() {
         final Set<Object> singletons = new HashSet<>();
-        final ControllerContext controllerContext = ControllerContext.getInstance();
-        final BrokerFacade brokerFacade = BrokerFacade.getInstance();
         final SchemaRetrievalServiceImpl schemaRetrieval = new SchemaRetrievalServiceImpl(controllerContext);
-        singletons.add(controllerContext);
-        singletons.add(brokerFacade);
         singletons.add(schemaRetrieval);
-        singletons.add(new RestconfCompositeWrapper(StatisticsRestconfServiceWrapper.getInstance(), schemaRetrieval));
+        singletons.add(new RestconfCompositeWrapper(statsServiceWrapper, schemaRetrieval));
         singletons.add(new RestconfDocumentedExceptionMapper(controllerContext));
         singletons.add(new XmlNormalizedNodeBodyReader(controllerContext));
         singletons.add(new JsonNormalizedNodeBodyReader(controllerContext));