Remove static RestconfImpl
[netconf.git] / restconf / restconf-nb-bierman02 / src / main / java / org / opendaylight / netconf / sal / rest / impl / 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.netconf.sal.rest.impl;
9
10 import com.google.common.collect.ImmutableSet;
11 import java.util.HashSet;
12 import java.util.Set;
13 import javax.ws.rs.core.Application;
14 import org.opendaylight.netconf.md.sal.rest.schema.SchemaExportContentYangBodyWriter;
15 import org.opendaylight.netconf.md.sal.rest.schema.SchemaExportContentYinBodyWriter;
16 import org.opendaylight.netconf.md.sal.rest.schema.SchemaRetrievalServiceImpl;
17 import org.opendaylight.netconf.sal.restconf.impl.BrokerFacade;
18 import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
19 import org.opendaylight.netconf.sal.restconf.impl.StatisticsRestconfServiceWrapper;
20
21 public class RestconfApplication extends Application {
22
23     @Override
24     public Set<Class<?>> getClasses() {
25         return ImmutableSet.<Class<?>>builder()
26                 .add(PatchJsonBodyWriter.class)
27                 .add(PatchXmlBodyWriter.class)
28                 .add(NormalizedNodeJsonBodyWriter.class)
29                 .add(NormalizedNodeXmlBodyWriter.class)
30                 .add(SchemaExportContentYinBodyWriter.class)
31                 .add(SchemaExportContentYangBodyWriter.class)
32                 .build();
33     }
34
35     @Override
36     public Set<Object> getSingletons() {
37         final Set<Object> singletons = new HashSet<>();
38         final ControllerContext controllerContext = ControllerContext.getInstance();
39         final BrokerFacade brokerFacade = BrokerFacade.getInstance();
40         final SchemaRetrievalServiceImpl schemaRetrieval = new SchemaRetrievalServiceImpl(controllerContext);
41         singletons.add(controllerContext);
42         singletons.add(brokerFacade);
43         singletons.add(schemaRetrieval);
44         singletons.add(new RestconfCompositeWrapper(StatisticsRestconfServiceWrapper.getInstance(), schemaRetrieval));
45         singletons.add(new RestconfDocumentedExceptionMapper(controllerContext));
46         singletons.add(new XmlNormalizedNodeBodyReader(controllerContext));
47         singletons.add(new JsonNormalizedNodeBodyReader(controllerContext));
48         singletons.add(new XmlToPatchBodyReader(controllerContext));
49         singletons.add(new JsonToPatchBodyReader(controllerContext));
50 //        singletons.add(StructuredDataToXmlProvider.INSTANCE);
51 //        singletons.add(StructuredDataToJsonProvider.INSTANCE);
52 //        singletons.add(JsonToCompositeNodeProvider.INSTANCE);
53 //        singletons.add(XmlToCompositeNodeProvider.INSTANCE);
54         return singletons;
55     }
56
57 }