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 java.util.HashSet;
13 import javax.ws.rs.core.Application;
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;
19 import com.google.common.collect.ImmutableSet;
21 public class RestconfApplication extends Application {
24 public Set<Class<?>> getClasses() {
25 return ImmutableSet.<Class<?>>of( RestconfDocumentedExceptionMapper.class );
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);