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.md.sal.rest.schema.SchemaExportContentYangBodyWriter;
15 import org.opendaylight.controller.md.sal.rest.schema.SchemaExportContentYinBodyWriter;
16 import org.opendaylight.controller.md.sal.rest.schema.SchemaRetrievalServiceImpl;
17 import org.opendaylight.controller.sal.restconf.impl.BrokerFacade;
18 import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
19 import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
20 import org.opendaylight.controller.sal.restconf.impl.StatisticsRestconfServiceWrapper;
22 public class RestconfApplication extends Application {
25 public Set<Class<?>> getClasses() {
26 return ImmutableSet.<Class<?>> builder()
27 .add(RestconfDocumentedExceptionMapper.class)
28 .add(XmlNormalizedNodeBodyReader.class)
29 .add(JsonNormalizedNodeBodyReader.class)
30 .add(NormalizedNodeJsonBodyWriter.class)
31 .add(NormalizedNodeXmlBodyWriter.class)
32 .add(SchemaExportContentYinBodyWriter.class)
33 .add(SchemaExportContentYangBodyWriter.class)
38 public Set<Object> getSingletons() {
39 final Set<Object> singletons = new HashSet<>();
40 final ControllerContext controllerContext = ControllerContext.getInstance();
41 final BrokerFacade brokerFacade = BrokerFacade.getInstance();
42 final RestconfImpl restconfImpl = RestconfImpl.getInstance();
43 final SchemaRetrievalServiceImpl schemaRetrieval = new SchemaRetrievalServiceImpl(controllerContext);
44 restconfImpl.setBroker(brokerFacade);
45 restconfImpl.setControllerContext(controllerContext);
46 singletons.add(controllerContext);
47 singletons.add(brokerFacade);
48 singletons.add(schemaRetrieval);
49 singletons.add(new RestconfCompositeWrapper(StatisticsRestconfServiceWrapper.getInstance(), schemaRetrieval));
50 // singletons.add(StructuredDataToXmlProvider.INSTANCE);
51 // singletons.add(StructuredDataToJsonProvider.INSTANCE);
52 // singletons.add(JsonToCompositeNodeProvider.INSTANCE);
53 // singletons.add(XmlToCompositeNodeProvider.INSTANCE);