Bug 1003: Restconf - remove whitespace on input
[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 java.util.HashSet;
11 import java.util.Set;
12
13 import javax.ws.rs.core.Application;
14
15 import org.opendaylight.controller.sal.restconf.impl.BrokerFacade;
16 import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
17 import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
18
19 import com.google.common.collect.ImmutableSet;
20
21 public class RestconfApplication extends Application {
22
23     @Override
24     public Set<Class<?>> getClasses() {
25         return ImmutableSet.<Class<?>>of( RestconfDocumentedExceptionMapper.class );
26     }
27
28     @Override
29     public Set<Object> getSingletons() {
30         Set<Object> singletons = new HashSet<>();
31         ControllerContext controllerContext = ControllerContext.getInstance();
32         BrokerFacade brokerFacade = BrokerFacade.getInstance();
33         RestconfImpl restconfImpl = RestconfImpl.getInstance();
34         restconfImpl.setBroker(brokerFacade);
35         restconfImpl.setControllerContext(controllerContext);
36         singletons.add(controllerContext);
37         singletons.add(brokerFacade);
38         singletons.add(restconfImpl);
39         singletons.add(XmlToCompositeNodeProvider.INSTANCE);
40         singletons.add(StructuredDataToXmlProvider.INSTANCE);
41         singletons.add(JsonToCompositeNodeProvider.INSTANCE);
42         singletons.add(StructuredDataToJsonProvider.INSTANCE);
43         return singletons;
44     }
45
46
47 }