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<?>> builder()
23 .add(RestconfDocumentedExceptionMapper.class)
24 .add(XmlNormalizedNodeBodyReader.class)
25 .add(JsonNormalizedNodeBodyReader.class)
26 .add(NormalizedNodeJsonBodyWriter.class)
27 .add(NormalizedNodeXmlBodyWriter.class)
32 public Set<Object> getSingletons() {
33 Set<Object> singletons = new HashSet<>();
34 ControllerContext controllerContext = ControllerContext.getInstance();
35 BrokerFacade brokerFacade = BrokerFacade.getInstance();
36 RestconfImpl restconfImpl = RestconfImpl.getInstance();
37 restconfImpl.setBroker(brokerFacade);
38 restconfImpl.setControllerContext(controllerContext);
39 singletons.add(controllerContext);
40 singletons.add(brokerFacade);
41 singletons.add(restconfImpl);
42 singletons.add(StructuredDataToXmlProvider.INSTANCE);
43 singletons.add(StructuredDataToJsonProvider.INSTANCE);
44 singletons.add(JsonToCompositeNodeProvider.INSTANCE);
45 singletons.add(XmlToCompositeNodeProvider.INSTANCE);