X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnorthbound%2Fcommons%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnorthbound%2Fcommons%2FNorthboundApplication.java;h=cf48729113ce7b1304f2a0f7b3f2e4a7c0e05dfc;hb=c7551f594c34504fffa0055d3360132577938b38;hp=e164abaf95c0ccd3adb07e3bb55d32b8f9f22ec8;hpb=c541f7868e6e2d654b8080b5426bb12a39bddf11;p=controller.git diff --git a/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/NorthboundApplication.java b/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/NorthboundApplication.java index e164abaf95..cf48729113 100644 --- a/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/NorthboundApplication.java +++ b/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/NorthboundApplication.java @@ -19,9 +19,9 @@ import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.annotation.XmlRootElement; -import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider; -import org.codehaus.jackson.map.DeserializationConfig; import org.opendaylight.controller.northbound.bundlescanner.IBundleScanService; +import org.opendaylight.controller.northbound.commons.exception.GenericExceptionMapper; +import org.opendaylight.controller.northbound.commons.query.QueryContextProvider; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleReference; @@ -31,12 +31,14 @@ import org.osgi.framework.ServiceReference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; + /** * Instance of javax.ws.rs.core.Application used to return the classes * that will be instantiated for JAXRS processing. This hooks onto the * bundle scanner service to provide JAXB classes to JAX-RS for prorcessing. */ -@SuppressWarnings("unchecked") public class NorthboundApplication extends Application { public static final String JAXRS_RESOURCES_MANIFEST_NAME = "Jaxrs-Resources"; public static final String JAXRS_EXCLUDES_MANIFEST_NAME = "Jaxrs-Exclude-Types"; @@ -58,6 +60,8 @@ public class NorthboundApplication extends Application { } ); _singletons.add(getJsonProvider()); _singletons.add(new JacksonJsonProcessingExceptionMapper()); + _singletons.add(new QueryContextProvider()); + _singletons.add(new GenericExceptionMapper()); } //////////////////////////////////////////////////////////////// @@ -78,7 +82,7 @@ public class NorthboundApplication extends Application { private static final JacksonJaxbJsonProvider getJsonProvider() { JacksonJaxbJsonProvider jsonProvider = new JacksonJaxbJsonProvider(); - jsonProvider.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, + jsonProvider.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); return jsonProvider; } @@ -98,7 +102,7 @@ public class NorthboundApplication extends Application { } private static final IBundleScanService lookupBundleScanner(BundleContext ctx) { - ServiceReference svcRef = ctx.getServiceReference(IBundleScanService.class); + ServiceReference svcRef = ctx.getServiceReference(IBundleScanService.class); if (svcRef == null) { throw new ServiceException("Unable to lookup IBundleScanService"); }