2 * Copyright IBM Corporation, 2013. 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
9 package org.opendaylight.controller.networkconfig.neutron.northbound;
11 import java.util.HashMap;
12 import java.util.HashSet;
15 import javax.ws.rs.core.Application;
16 import org.eclipse.persistence.jaxb.rs.MOXyJsonProvider;
20 * This class is an instance of javax.ws.rs.core.Application and is used to return the classes
21 * that will be instantiated for JAXRS processing. This is necessary
22 * because package scanning in jersey doesn't yet work in OSGi environment.
25 public class NeutronNorthboundRSApplication extends Application {
27 public Set<Class<?>> getClasses() {
28 Set<Class<?>> classes = new HashSet<Class<?>>();
30 classes.add(NeutronNetworksNorthbound.class);
31 classes.add(NeutronSubnetsNorthbound.class);
32 classes.add(NeutronPortsNorthbound.class);
33 classes.add(NeutronRoutersNorthbound.class);
34 classes.add(NeutronFloatingIPsNorthbound.class);
39 public Set<Object> getSingletons() {
40 MOXyJsonProvider moxyJsonProvider = new MOXyJsonProvider();
42 moxyJsonProvider.setAttributePrefix("@");
43 moxyJsonProvider.setFormattedOutput(true);
44 moxyJsonProvider.setIncludeRoot(false);
45 moxyJsonProvider.setMarshalEmptyCollections(true);
46 moxyJsonProvider.setValueWrapper("$");
48 Map<String, String> namespacePrefixMapper = new HashMap<String, String>(1);
49 namespacePrefixMapper.put("router", "router"); // FIXME: fill in with XSD
50 namespacePrefixMapper.put("provider", "provider"); // FIXME: fill in with XSD
51 moxyJsonProvider.setNamespacePrefixMapper(namespacePrefixMapper);
52 moxyJsonProvider.setNamespaceSeparator(':');
54 HashSet<Object> set = new HashSet<Object>(1);
55 set.add(moxyJsonProvider);