5f47fcbc4609a2d8f12cc1a637eda85632b2c571
[netconf.git] / restconf / sal-rest-connector / src / main / java / org / opendaylight / restconf / 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.restconf;
9
10 import com.google.common.collect.ImmutableSet;
11 import java.util.HashSet;
12 import java.util.Set;
13 import javax.ws.rs.core.Application;
14 import org.opendaylight.netconf.md.sal.rest.schema.SchemaExportContentYangBodyWriter;
15 import org.opendaylight.netconf.md.sal.rest.schema.SchemaExportContentYinBodyWriter;
16 import org.opendaylight.netconf.sal.rest.impl.JsonNormalizedNodeBodyReader;
17 import org.opendaylight.netconf.sal.rest.impl.PATCHJsonBodyWriter;
18 import org.opendaylight.netconf.sal.rest.impl.PATCHXmlBodyWriter;
19 import org.opendaylight.netconf.sal.rest.impl.RestconfDocumentedExceptionMapper;
20 import org.opendaylight.netconf.sal.rest.impl.XmlNormalizedNodeBodyReader;
21 import org.opendaylight.restconf.common.wrapper.services.ServicesWrapperImpl;
22 import org.opendaylight.restconf.jersey.providers.JsonToPATCHBodyReader;
23 import org.opendaylight.restconf.jersey.providers.NormalizedNodeJsonBodyWriter;
24 import org.opendaylight.restconf.jersey.providers.NormalizedNodeXmlBodyWriter;
25 import org.opendaylight.restconf.jersey.providers.XmlToPATCHBodyReader;
26
27 public class RestconfApplication extends Application {
28
29     @Override
30     public Set<Class<?>> getClasses() {
31         return ImmutableSet.<Class<?>> builder()
32                 .add(NormalizedNodeJsonBodyWriter.class).add(NormalizedNodeXmlBodyWriter.class)
33                 .add(JsonNormalizedNodeBodyReader.class).add(XmlNormalizedNodeBodyReader.class)
34                 .add(SchemaExportContentYinBodyWriter.class)
35                 .add(JsonToPATCHBodyReader.class).add(XmlToPATCHBodyReader.class)
36                 .add(PATCHJsonBodyWriter.class).add(PATCHXmlBodyWriter.class)
37                 .add(SchemaExportContentYangBodyWriter.class).add(RestconfDocumentedExceptionMapper.class)
38                 .build();
39     }
40
41     @Override
42     public Set<Object> getSingletons() {
43         final Set<Object> singletons = new HashSet<>();
44         singletons.add(ServicesWrapperImpl.getInstance());
45         return singletons;
46     }
47 }