Merge "Stop scheduling the Install Snapshot check"
[controller.git] / opendaylight / networkconfiguration / neutron / northbound / src / main / java / org / opendaylight / controller / networkconfig / neutron / northbound / NeutronNorthboundRSApplication.java
1 /*
2  * Copyright IBM Corporation, 2013.  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
9 package org.opendaylight.controller.networkconfig.neutron.northbound;
10
11 import org.eclipse.persistence.jaxb.rs.MOXyJsonProvider;
12
13 import javax.ws.rs.core.Application;
14 import java.util.HashMap;
15 import java.util.HashSet;
16 import java.util.Map;
17 import java.util.Set;
18
19
20 /**
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.
24  *
25  */
26 public class NeutronNorthboundRSApplication extends Application {
27     @Override
28     public Set<Class<?>> getClasses() {
29         Set<Class<?>> classes = new HashSet<Class<?>>();
30 // northbound URIs
31         classes.add(NeutronNetworksNorthbound.class);
32         classes.add(NeutronSubnetsNorthbound.class);
33         classes.add(NeutronPortsNorthbound.class);
34         classes.add(NeutronRoutersNorthbound.class);
35         classes.add(NeutronFloatingIPsNorthbound.class);
36         classes.add(NeutronSecurityGroupsNorthbound.class);
37         classes.add(NeutronSecurityRulesNorthbound.class);
38         classes.add(NeutronFirewallNorthbound.class);
39         classes.add(NeutronFirewallPolicyNorthbound.class);
40         classes.add(NeutronFirewallRulesNorthbound.class);
41         classes.add(NeutronLoadBalancerNorthbound.class);
42         classes.add(NeutronLoadBalancerListenerNorthbound.class);
43         classes.add(NeutronLoadBalancerPoolNorthbound.class);
44         classes.add(NeutronLoadBalancerHealthMonitorNorthbound.class);
45         classes.add(NeutronLoadBalancerPoolMembersNorthbound.class);
46       classes.add(MOXyJsonProvider.class);
47         return classes;
48     }
49
50     @Override
51     public Set<Object> getSingletons() {
52         MOXyJsonProvider moxyJsonProvider = new MOXyJsonProvider();
53
54         moxyJsonProvider.setAttributePrefix("@");
55         moxyJsonProvider.setFormattedOutput(true);
56         moxyJsonProvider.setIncludeRoot(false);
57         moxyJsonProvider.setMarshalEmptyCollections(true);
58         moxyJsonProvider.setValueWrapper("$");
59
60         Map<String, String> namespacePrefixMapper = new HashMap<String, String>(3);
61         namespacePrefixMapper.put("router", "router");        // FIXME: fill in with XSD
62         namespacePrefixMapper.put("provider", "provider");    // FIXME: fill in with XSD
63         namespacePrefixMapper.put("binding", "binding");
64         moxyJsonProvider.setNamespacePrefixMapper(namespacePrefixMapper);
65         moxyJsonProvider.setNamespaceSeparator(':');
66
67         HashSet<Object> set = new HashSet<Object>(1);
68         set.add(moxyJsonProvider);
69         return set;
70     }
71 }