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