2 * Copyright IBM Corporation, 2013. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
9 package org.opendaylight.controller.networkconfig.neutron.northbound;
\r
11 import java.util.HashMap;
\r
12 import java.util.HashSet;
\r
13 import java.util.Map;
\r
14 import java.util.Set;
\r
15 import javax.ws.rs.core.Application;
\r
16 import org.eclipse.persistence.jaxb.rs.MOXyJsonProvider;
\r
17 import org.opendaylight.controller.networkconfig.neutron.northbound.NeutronFloatingIPsNorthbound;
\r
18 import org.opendaylight.controller.networkconfig.neutron.northbound.NeutronNetworksNorthbound;
\r
19 import org.opendaylight.controller.networkconfig.neutron.northbound.NeutronPortsNorthbound;
\r
20 import org.opendaylight.controller.networkconfig.neutron.northbound.NeutronRoutersNorthbound;
\r
21 import org.opendaylight.controller.networkconfig.neutron.northbound.NeutronSubnetsNorthbound;
\r
25 * This class is an instance of javax.ws.rs.core.Application and is used to return the classes
\r
26 * that will be instantiated for JAXRS processing. This is necessary
\r
27 * because package scanning in jersey doesn't yet work in OSGi environment.
\r
30 public class NeutronNorthboundRSApplication extends Application {
\r
32 public Set<Class<?>> getClasses() {
\r
33 Set<Class<?>> classes = new HashSet<Class<?>>();
\r
35 classes.add(NeutronNetworksNorthbound.class);
\r
36 classes.add(NeutronSubnetsNorthbound.class);
\r
37 classes.add(NeutronPortsNorthbound.class);
\r
38 classes.add(NeutronRoutersNorthbound.class);
\r
39 classes.add(NeutronFloatingIPsNorthbound.class);
\r
44 public Set<Object> getSingletons() {
\r
45 MOXyJsonProvider moxyJsonProvider = new MOXyJsonProvider();
\r
47 moxyJsonProvider.setAttributePrefix("@");
\r
48 moxyJsonProvider.setFormattedOutput(true);
\r
49 moxyJsonProvider.setIncludeRoot(false);
\r
50 moxyJsonProvider.setMarshalEmptyCollections(true);
\r
51 moxyJsonProvider.setValueWrapper("$");
\r
53 Map<String, String> namespacePrefixMapper = new HashMap<String, String>(1);
\r
54 namespacePrefixMapper.put("router", "router"); // FIXME: fill in with XSD
\r
55 namespacePrefixMapper.put("provider", "provider"); // FIXME: fill in with XSD
\r
56 moxyJsonProvider.setNamespacePrefixMapper(namespacePrefixMapper);
\r
57 moxyJsonProvider.setNamespaceSeparator(':');
\r
59 HashSet<Object> set = new HashSet<Object>(1);
\r
60 set.add(moxyJsonProvider);
\r