2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.sal.rest.impl;
10 import com.google.common.collect.ImmutableSet;
11 import java.util.HashSet;
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;
18 public class RestconfApplication extends Application {
21 public Set<Class<?>> getClasses() {
22 return ImmutableSet.<Class<?>> of(RestconfDocumentedExceptionMapper.class);
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);