/*
 * Copyright IBM Corporation, 2013.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */

package org.opendaylight.neutron.northbound.api;

import org.eclipse.persistence.jaxb.rs.MOXyJsonProvider;

import javax.ws.rs.core.Application;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;


/**
 * This class is an instance of javax.ws.rs.core.Application and is used to return the classes
 * that will be instantiated for JAXRS processing. This is necessary
 * because package scanning in jersey doesn't yet work in OSGi environment.
 *
 */
public class NeutronNorthboundRSApplication extends Application {
    @Override
    public Set<Class<?>> getClasses() {
        Set<Class<?>> classes = new HashSet<Class<?>>();
// northbound URIs
        classes.add(NeutronNetworksNorthbound.class);
        classes.add(NeutronSubnetsNorthbound.class);
        classes.add(NeutronPortsNorthbound.class);
        classes.add(NeutronRoutersNorthbound.class);
        classes.add(NeutronFloatingIPsNorthbound.class);
        classes.add(NeutronSecurityGroupsNorthbound.class);
        classes.add(NeutronSecurityRulesNorthbound.class);
        classes.add(NeutronFirewallNorthbound.class);
        classes.add(NeutronFirewallPolicyNorthbound.class);
        classes.add(NeutronFirewallRulesNorthbound.class);
        classes.add(NeutronLoadBalancerNorthbound.class);
        classes.add(NeutronLoadBalancerListenerNorthbound.class);
        classes.add(NeutronLoadBalancerPoolNorthbound.class);
        classes.add(NeutronLoadBalancerHealthMonitorNorthbound.class);
        classes.add(NeutronLoadBalancerPoolMembersNorthbound.class);
      classes.add(MOXyJsonProvider.class);
        return classes;
    }

    @Override
    public Set<Object> getSingletons() {
        MOXyJsonProvider moxyJsonProvider = new MOXyJsonProvider();

        moxyJsonProvider.setAttributePrefix("@");
        moxyJsonProvider.setFormattedOutput(true);
        moxyJsonProvider.setIncludeRoot(false);
        moxyJsonProvider.setMarshalEmptyCollections(true);
        moxyJsonProvider.setValueWrapper("$");

        Map<String, String> namespacePrefixMapper = new HashMap<String, String>(3);
        namespacePrefixMapper.put("router", "router");        // FIXME: fill in with XSD
        namespacePrefixMapper.put("provider", "provider");    // FIXME: fill in with XSD
        namespacePrefixMapper.put("binding", "binding");
        moxyJsonProvider.setNamespacePrefixMapper(namespacePrefixMapper);
        moxyJsonProvider.setNamespaceSeparator(':');

        HashSet<Object> set = new HashSet<Object>(1);
        set.add(moxyJsonProvider);
        return set;
    }
}

@@ -338,66 +338,8 @@
 i;%0A%0A
-import org.eclipse.persistence.jaxb.rs.MOXyJsonProvider;%0A%0A
 impo
@@ -375,34 +375,8 @@
 on;%0A
-import java.util.HashMap;%0A
 impo
@@ -1786,1010 +1786,24 @@
     
-classes.add(MOXyJsonProvider.class);%0A        return classes;%0A    %7D%0A%0A    @Override%0A    public Set%3CObject%3E getSingletons() %7B%0A        MOXyJsonProvider moxyJsonProvider = new MOXyJsonProvider();%0A%0A        moxyJsonProvider.setAttributePrefix(%22@%22);%0A        moxyJsonProvider.setFormattedOutput(true);%0A        moxyJsonProvider.setIncludeRoot(false);%0A        moxyJsonProvider.setMarshalEmptyCollections(true);%0A        moxyJsonProvider.setValueWrapper(%22$%22);%0A%0A        Map%3CString, String%3E namespacePrefixMapper = new HashMap%3CString, String%3E(3);%0A        namespacePrefixMapper.put(%22router%22, %22router%22);        // FIXME: fill in with XSD%0A        namespacePrefixMapper.put(%22provider%22, %22provider%22);    // FIXME: fill in with XSD%0A        namespacePrefixMapper.put(%22binding%22, %22binding%22);%0A        moxyJsonProvider.setNamespacePrefixMapper(namespacePrefixMapper);%0A        moxyJsonProvider.setNamespaceSeparator(':');%0A%0A        HashSet%3CObject%3E set = new HashSet%3CObject%3E(1);%0A        set.add(moxyJsonProvider);%0A        return set
+  return classes
 ;%0A  

Remove MOXy references from Northbound bundle