2 * Copyright (c) 2013, 2015 IBM Corporation 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
9 package org.opendaylight.neutron.northbound.api;
11 import org.eclipse.persistence.jaxb.rs.MOXyJsonProvider;
13 import javax.ws.rs.core.Application;
14 import java.util.HashMap;
15 import java.util.HashSet;
21 * This class is an instance of javax.ws.rs.core.Application and is used to return the classes
22 * that will be instantiated for JAXRS processing. This is necessary
23 * because package scanning in jersey doesn't yet work in OSGi environment.
26 public class NeutronNorthboundRSApplication extends Application {
27 private static final int HASHMAP_SIZE = 3;
30 public Set<Class<?>> getClasses() {
31 Set<Class<?>> classes = new HashSet<Class<?>>();
33 classes.add(NeutronNetworksNorthbound.class);
34 classes.add(NeutronSubnetsNorthbound.class);
35 classes.add(NeutronPortsNorthbound.class);
36 classes.add(NeutronRoutersNorthbound.class);
37 classes.add(NeutronFloatingIPsNorthbound.class);
38 classes.add(NeutronSecurityGroupsNorthbound.class);
39 classes.add(NeutronSecurityRulesNorthbound.class);
40 classes.add(NeutronFirewallNorthbound.class);
41 classes.add(NeutronFirewallPolicyNorthbound.class);
42 classes.add(NeutronFirewallRulesNorthbound.class);
43 classes.add(NeutronLoadBalancerNorthbound.class);
44 classes.add(NeutronLoadBalancerListenerNorthbound.class);
45 classes.add(NeutronLoadBalancerPoolNorthbound.class);
46 classes.add(NeutronLoadBalancerHealthMonitorNorthbound.class);
47 classes.add(NeutronMeteringLabelsNorthbound.class);
48 classes.add(NeutronMeteringLabelRulesNorthbound.class);
49 classes.add(NeutronVPNServicesNorthbound.class);
50 classes.add(NeutronVPNIKEPoliciesNorthbound.class);
51 classes.add(NeutronVPNIPSECPoliciesNorthbound.class);
52 classes.add(NeutronVPNIPSECSiteConnectionsNorthbound.class);
54 classes.add(MOXyJsonProvider.class);
59 public Set<Object> getSingletons() {
60 MOXyJsonProvider moxyJsonProvider = new MOXyJsonProvider();
62 moxyJsonProvider.setAttributePrefix("@");
63 moxyJsonProvider.setFormattedOutput(true);
64 moxyJsonProvider.setIncludeRoot(false);
65 moxyJsonProvider.setMarshalEmptyCollections(true);
66 moxyJsonProvider.setValueWrapper("$");
68 Map<String, String> namespacePrefixMapper = new HashMap<String, String>(HASHMAP_SIZE);
69 // FIXME: fill in next two with XSD
70 namespacePrefixMapper.put("router", "router");
71 namespacePrefixMapper.put("provider", "provider");
72 namespacePrefixMapper.put("binding", "binding");
73 moxyJsonProvider.setNamespacePrefixMapper(namespacePrefixMapper);
74 moxyJsonProvider.setNamespaceSeparator(':');
76 Set<Object> set = new HashSet<Object>(1);
77 set.add(moxyJsonProvider);