Merge "Bug 1637: Change Rpc actor calls to async"
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / 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.controller.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.controller.sal.restconf.impl.BrokerFacade;
15 import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
16 import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
17 import org.opendaylight.controller.sal.restconf.impl.StatisticsRestconfServiceWrapper;
18
19 public class RestconfApplication extends Application {
20
21     @Override
22     public Set<Class<?>> getClasses() {
23         return ImmutableSet.<Class<?>> builder()
24                 .add(RestconfDocumentedExceptionMapper.class)
25                 .add(XmlNormalizedNodeBodyReader.class)
26                 .add(JsonNormalizedNodeBodyReader.class)
27                 .add(NormalizedNodeJsonBodyWriter.class)
28                 .add(NormalizedNodeXmlBodyWriter.class)
29                 .build();
30     }
31
32     @Override
33     public Set<Object> getSingletons() {
34         Set<Object> singletons = new HashSet<>();
35         ControllerContext controllerContext = ControllerContext.getInstance();
36         BrokerFacade brokerFacade = BrokerFacade.getInstance();
37         RestconfImpl restconfImpl = RestconfImpl.getInstance();
38         restconfImpl.setBroker(brokerFacade);
39         restconfImpl.setControllerContext(controllerContext);
40         singletons.add(controllerContext);
41         singletons.add(brokerFacade);
42         singletons.add(StatisticsRestconfServiceWrapper.getInstance());
43         singletons.add(StructuredDataToXmlProvider.INSTANCE);
44         singletons.add(StructuredDataToJsonProvider.INSTANCE);
45         singletons.add(JsonToCompositeNodeProvider.INSTANCE);
46         singletons.add(XmlToCompositeNodeProvider.INSTANCE);
47         return singletons;
48     }
49
50 }