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         return classes;
47     }
48
49     @Override
50     public Set<Object> getSingletons() {
51         MOXyJsonProvider moxyJsonProvider = new MOXyJsonProvider();
52
53         moxyJsonProvider.setAttributePrefix("@");
54         moxyJsonProvider.setFormattedOutput(true);
55         moxyJsonProvider.setIncludeRoot(false);
56         moxyJsonProvider.setMarshalEmptyCollections(true);
57         moxyJsonProvider.setValueWrapper("$");
58
59         Map<String, String> namespacePrefixMapper = new HashMap<String, String>(1);
60         namespacePrefixMapper.put("router", "router");        // FIXME: fill in with XSD
61         namespacePrefixMapper.put("provider", "provider");    // FIXME: fill in with XSD
62         moxyJsonProvider.setNamespacePrefixMapper(namespacePrefixMapper);
63         moxyJsonProvider.setNamespaceSeparator(':');
64
65         HashSet<Object> set = new HashSet<Object>(1);
66         set.add(moxyJsonProvider);
67         return set;
68     }
69 }