Merge "Added comments to the opendaylight-inventory.yang file to help describe the...
[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
18 public class RestconfApplication extends Application {
19
20     @Override
21     public Set<Class<?>> getClasses() {
22         return ImmutableSet.<Class<?>> of(RestconfDocumentedExceptionMapper.class);
23     }
24
25     @Override
26     public Set<Object> getSingletons() {
27         Set<Object> singletons = new HashSet<>();
28         ControllerContext controllerContext = ControllerContext.getInstance();
29         BrokerFacade brokerFacade = BrokerFacade.getInstance();
30         RestconfImpl restconfImpl = RestconfImpl.getInstance();
31         restconfImpl.setBroker(brokerFacade);
32         restconfImpl.setControllerContext(controllerContext);
33         singletons.add(controllerContext);
34         singletons.add(brokerFacade);
35         singletons.add(restconfImpl);
36         singletons.add(XmlToCompositeNodeProvider.INSTANCE);
37         singletons.add(StructuredDataToXmlProvider.INSTANCE);
38         singletons.add(JsonToCompositeNodeProvider.INSTANCE);
39         singletons.add(StructuredDataToJsonProvider.INSTANCE);
40         return singletons;
41     }
42
43 }