/* * 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.controller.networkconfig.neutron.northbound; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import javax.ws.rs.core.Application; import org.eclipse.persistence.jaxb.rs.MOXyJsonProvider; /** * 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> getClasses() { Set> classes = new HashSet>(); // northbound URIs classes.add(NeutronNetworksNorthbound.class); classes.add(NeutronSubnetsNorthbound.class); classes.add(NeutronPortsNorthbound.class); classes.add(NeutronRoutersNorthbound.class); classes.add(NeutronFloatingIPsNorthbound.class); return classes; } @Override public Set getSingletons() { MOXyJsonProvider moxyJsonProvider = new MOXyJsonProvider(); moxyJsonProvider.setAttributePrefix("@"); moxyJsonProvider.setFormattedOutput(true); moxyJsonProvider.setIncludeRoot(false); moxyJsonProvider.setMarshalEmptyCollections(true); moxyJsonProvider.setValueWrapper("$"); Map namespacePrefixMapper = new HashMap(1); namespacePrefixMapper.put("router", "router"); // FIXME: fill in with XSD namespacePrefixMapper.put("provider", "provider"); // FIXME: fill in with XSD moxyJsonProvider.setNamespacePrefixMapper(namespacePrefixMapper); moxyJsonProvider.setNamespaceSeparator(':'); HashSet set = new HashSet(1); set.add(moxyJsonProvider); return set; } }