cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject cxf git commit: Update osgi framework used to 5.0 since we only support Karaf 4+
Date Fri, 05 May 2017 18:54:36 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 864dafbc5 -> 3a46e586b


Update osgi framework used to 5.0 since we only support Karaf 4+


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/3a46e586
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/3a46e586
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/3a46e586

Branch: refs/heads/master
Commit: 3a46e586b405c79a98e37d33a30b2fa22905f853
Parents: 864dafb
Author: Daniel Kulp <dkulp@apache.org>
Authored: Fri May 5 14:54:07 2017 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Fri May 5 14:54:07 2017 -0400

----------------------------------------------------------------------
 .../cxf/bus/blueprint/BlueprintBeanLocator.java |  8 +-
 .../blueprint/BundleDelegatingClassLoader.java  |  1 -
 .../org/apache/cxf/bus/osgi/CXFActivator.java   | 24 +++---
 .../bus/osgi/CXFExtensionBundleListener.java    |  2 +-
 .../cxf/bus/osgi/ManagedWorkQueueList.java      |  9 +-
 .../apache/cxf/bus/osgi/OSGIBusListener.java    | 34 ++++----
 .../apache/cxf/bus/osgi/OSGiBeanLocator.java    |  4 +-
 .../apache/cxf/common/util/CollectionUtils.java | 88 ++++++++++++++++++++
 .../cxf/bus/osgi/OSGiBusListenerTest.java       | 16 ++--
 .../cxf/osgi/itests/CXFOSGiTestSupport.java     |  2 +-
 .../karaf/commands/ListEndpointsCommand.java    |  4 +-
 .../karaf/commands/internal/CXFController.java  | 13 +--
 parent/pom.xml                                  |  3 +-
 .../apache/cxf/ext/logging/osgi/Activator.java  |  4 +-
 .../transport/http/asyncclient/Activator.java   | 13 ++-
 .../osgi/HTTPJettyTransportActivator.java       | 36 ++++----
 .../osgi/HTTPUndertowTransportActivator.java    | 30 ++++---
 .../http/osgi/HTTPTransportActivator.java       | 16 ++--
 .../http/osgi/HttpServiceTrackerCust.java       | 23 +++--
 .../transport/http/osgi/ServletExporter.java    |  2 +-
 .../wsn/services/OSGiJaxwsEndpointManager.java  |  8 +-
 .../service/CertificateRepoProxyFactory.java    |  8 +-
 .../cxf/xkms/service/NamedServiceProxy.java     |  4 +-
 23 files changed, 217 insertions(+), 135 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java b/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java
index be91e3a..c275809 100644
--- a/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java
+++ b/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java
@@ -125,9 +125,9 @@ public class BlueprintBeanLocator implements ConfiguredBeanLocator {
         }
         if (list.isEmpty() && context != null) {
             try {
-                ServiceReference refs[] = context.getServiceReferences(type.getName(), null);
+                ServiceReference<?> refs[] = context.getServiceReferences(type.getName(), null);
                 if (refs != null) {
-                    for (ServiceReference r : refs) {
+                    for (ServiceReference<?> r : refs) {
                         list.add(type.cast(context.getService(r)));
                     }
                 }
@@ -169,9 +169,9 @@ public class BlueprintBeanLocator implements ConfiguredBeanLocator {
 
         try {
             if (context != null) {
-                ServiceReference refs[] = context.getServiceReferences(type.getName(), null);
+                ServiceReference<?> refs[] = context.getServiceReferences(type.getName(), null);
                 if (refs != null) {
-                    for (ServiceReference r : refs) {
+                    for (ServiceReference<?> r : refs) {
                         Object o2 = context.getService(r);
                         Class<? extends T> t = o2.getClass().asSubclass(type);
                         if (listener.loadBean(t.getName(), t)) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/core/src/main/java/org/apache/cxf/bus/blueprint/BundleDelegatingClassLoader.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/blueprint/BundleDelegatingClassLoader.java b/core/src/main/java/org/apache/cxf/bus/blueprint/BundleDelegatingClassLoader.java
index 5b739a4..5cf9979 100644
--- a/core/src/main/java/org/apache/cxf/bus/blueprint/BundleDelegatingClassLoader.java
+++ b/core/src/main/java/org/apache/cxf/bus/blueprint/BundleDelegatingClassLoader.java
@@ -81,7 +81,6 @@ public class BundleDelegatingClassLoader extends ClassLoader {
         Enumeration<URL> urls;
         try {
             urls = AccessController.doPrivileged(new PrivilegedExceptionAction<Enumeration<URL>>() {
-                @SuppressWarnings("unchecked")
                 public Enumeration<URL> run() throws IOException {
                     return bundle.getResources(name);
                 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/core/src/main/java/org/apache/cxf/bus/osgi/CXFActivator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/osgi/CXFActivator.java b/core/src/main/java/org/apache/cxf/bus/osgi/CXFActivator.java
index a5d23d0..375efc0 100644
--- a/core/src/main/java/org/apache/cxf/bus/osgi/CXFActivator.java
+++ b/core/src/main/java/org/apache/cxf/bus/osgi/CXFActivator.java
@@ -21,12 +21,12 @@ package org.apache.cxf.bus.osgi;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Properties;
 
 import org.apache.cxf.bus.blueprint.BlueprintNameSpaceHandlerFactory;
 import org.apache.cxf.bus.blueprint.NamespaceHandlerRegisterer;
 import org.apache.cxf.bus.extension.Extension;
 import org.apache.cxf.bus.extension.ExtensionRegistry;
+import org.apache.cxf.common.util.CollectionUtils;
 import org.apache.cxf.internal.CXFAPINamespaceHandler;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
@@ -48,9 +48,9 @@ public class CXFActivator implements BundleActivator {
 
     private List<Extension> extensions;
     private ManagedWorkQueueList workQueues;
-    private ServiceTracker configAdminTracker;
+    private ServiceTracker<ConfigurationAdmin, ConfigurationAdmin> configAdminTracker;
     private CXFExtensionBundleListener cxfBundleListener;
-    private ServiceRegistration workQueueServiceRegistration;
+    private ServiceRegistration<ManagedServiceFactory> workQueueServiceRegistration;
 
 
 
@@ -61,10 +61,11 @@ public class CXFActivator implements BundleActivator {
         context.addBundleListener(cxfBundleListener);
         cxfBundleListener.registerExistingBundles(context);
 
-        configAdminTracker = new ServiceTracker(context, ConfigurationAdmin.class.getName(), null);
+        configAdminTracker = new ServiceTracker<>(context, ConfigurationAdmin.class, null);
         configAdminTracker.open();
         workQueues.setConfigAdminTracker(configAdminTracker);
-        workQueueServiceRegistration = registerManagedServiceFactory(context, ManagedServiceFactory.class,
+        workQueueServiceRegistration = registerManagedServiceFactory(context,
+                                                                     ManagedServiceFactory.class,
                                                                      workQueues,
                                                                      ManagedWorkQueueList.FACTORY_PID);
 
@@ -91,13 +92,12 @@ public class CXFActivator implements BundleActivator {
 
     }
 
-    private ServiceRegistration registerManagedServiceFactory(BundleContext context,
-                                                              Class<?> serviceClass,
-                                                              Object service,
-                                                              String servicePid) {
-        Properties props = new Properties();
-        props.put(Constants.SERVICE_PID, servicePid);
-        return context.registerService(serviceClass.getName(), service, props);
+    private <T> ServiceRegistration<T> registerManagedServiceFactory(BundleContext context,
+                                                                     Class<T> serviceClass,
+                                                                     T service,
+                                                                     String servicePid) {
+        return context.registerService(serviceClass, service, 
+                                       CollectionUtils.singletonDictionary(Constants.SERVICE_PID, servicePid));
     }
 
     private Extension createOsgiBusListenerExtension(BundleContext context) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/core/src/main/java/org/apache/cxf/bus/osgi/CXFExtensionBundleListener.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/osgi/CXFExtensionBundleListener.java b/core/src/main/java/org/apache/cxf/bus/osgi/CXFExtensionBundleListener.java
index 05ceabf..d065c82 100644
--- a/core/src/main/java/org/apache/cxf/bus/osgi/CXFExtensionBundleListener.java
+++ b/core/src/main/java/org/apache/cxf/bus/osgi/CXFExtensionBundleListener.java
@@ -134,7 +134,7 @@ public class CXFExtensionBundleListener implements SynchronousBundleListener {
         }
         public Object load(ClassLoader cl, Bus b) {
             if (interfaceName == null && bundle.getBundleContext() != null) {
-                ServiceReference ref = bundle.getBundleContext().getServiceReference(className);
+                ServiceReference<?> ref = bundle.getBundleContext().getServiceReference(className);
                 if (ref != null && ref.getBundle().getBundleId() == bundle.getBundleId()) {
                     Object o = bundle.getBundleContext().getService(ref);
                     serviceObject = o;

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/core/src/main/java/org/apache/cxf/bus/osgi/ManagedWorkQueueList.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/osgi/ManagedWorkQueueList.java b/core/src/main/java/org/apache/cxf/bus/osgi/ManagedWorkQueueList.java
index 99ba3c7..ba1469d 100644
--- a/core/src/main/java/org/apache/cxf/bus/osgi/ManagedWorkQueueList.java
+++ b/core/src/main/java/org/apache/cxf/bus/osgi/ManagedWorkQueueList.java
@@ -45,13 +45,13 @@ public class ManagedWorkQueueList implements ManagedServiceFactory, PropertyChan
 
     private Map<String, AutomaticWorkQueueImpl> queues =
         new ConcurrentHashMap<String, AutomaticWorkQueueImpl>(4, 0.75f, 2);
-    private ServiceTracker configAdminTracker;
+    private ServiceTracker<ConfigurationAdmin, ConfigurationAdmin> configAdminTracker;
 
     public String getName() {
         return FACTORY_PID;
     }
 
-    public void updated(String pid, @SuppressWarnings("rawtypes") Dictionary props)
+    public void updated(String pid, Dictionary<String, ?> props)
         throws ConfigurationException {
         if (pid == null) {
             return;
@@ -98,8 +98,7 @@ public class ManagedWorkQueueList implements ManagedServiceFactory, PropertyChan
         String filter = "(service.factoryPid=" + ManagedWorkQueueList.FACTORY_PID + ")";
         Configuration[] configs = configurationAdmin.listConfigurations(filter);
         for (Configuration configuration : configs) {
-            @SuppressWarnings("rawtypes")
-            Dictionary props = configuration.getProperties();
+            Dictionary<String, Object> props = configuration.getProperties();
             String name = (String)props.get(AutomaticWorkQueueImpl.PROPERTY_NAME);
             if (queue.getName().equals(name)) {
                 selectedConfig = configuration;
@@ -118,7 +117,7 @@ public class ManagedWorkQueueList implements ManagedServiceFactory, PropertyChan
         }
     }
 
-    public void setConfigAdminTracker(ServiceTracker configAdminTracker) {
+    public void setConfigAdminTracker(ServiceTracker<ConfigurationAdmin, ConfigurationAdmin> configAdminTracker) {
         this.configAdminTracker = configAdminTracker;
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/core/src/main/java/org/apache/cxf/bus/osgi/OSGIBusListener.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/osgi/OSGIBusListener.java b/core/src/main/java/org/apache/cxf/bus/osgi/OSGIBusListener.java
index 23de3d0..2891334 100644
--- a/core/src/main/java/org/apache/cxf/bus/osgi/OSGIBusListener.java
+++ b/core/src/main/java/org/apache/cxf/bus/osgi/OSGIBusListener.java
@@ -19,7 +19,8 @@
 package org.apache.cxf.bus.osgi;
 
 import java.util.Dictionary;
-import java.util.Properties;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.regex.Pattern;
 
 import org.apache.cxf.Bus;
@@ -27,6 +28,7 @@ import org.apache.cxf.bus.extension.ExtensionManagerImpl;
 import org.apache.cxf.buslifecycle.BusCreationListener;
 import org.apache.cxf.buslifecycle.BusLifeCycleListener;
 import org.apache.cxf.buslifecycle.BusLifeCycleManager;
+import org.apache.cxf.common.util.CollectionUtils;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.configuration.ConfiguredBeanLocator;
 import org.apache.cxf.endpoint.ClientLifeCycleListener;
@@ -52,7 +54,7 @@ public class OSGIBusListener implements BusLifeCycleListener {
     private static final String SERVICE_PROPERTY_RESTRICTED = "org.apache.cxf.bus.restricted.extension";
     private static final String BUS_EXTENSION_BUNDLES_EXCLUDES = "bus.extension.bundles.excludes";
     Bus bus;
-    ServiceRegistration service;
+    ServiceRegistration<?> service;
     BundleContext defaultContext;
     private Pattern extensionBundlesExcludesPattern;
 
@@ -111,8 +113,8 @@ public class OSGIBusListener implements BusLifeCycleListener {
         }
     }
 
-    private static ServiceReference[] getServiceReferences(BundleContext context, Class<?> serviceClass) {
-        ServiceReference[] refs = null;
+    private static ServiceReference<?>[] getServiceReferences(BundleContext context, Class<?> serviceClass) {
+        ServiceReference<?>[] refs = null;
         try {
             refs = context.getServiceReferences(serviceClass.getName(), null);
         } catch (InvalidSyntaxException e) {
@@ -125,8 +127,8 @@ public class OSGIBusListener implements BusLifeCycleListener {
     }
 
     private void sendBusCreatedToBusCreationListeners() {
-        ServiceReference refs[] = getServiceReferences(defaultContext, BusCreationListener.class);
-        for (ServiceReference ref : refs) {
+        ServiceReference<?> refs[] = getServiceReferences(defaultContext, BusCreationListener.class);
+        for (ServiceReference<?> ref : refs) {
             if (!isPrivate(ref) && !isExcluded(ref)) {
                 BusCreationListener listener = (BusCreationListener)defaultContext.getService(ref);
                 listener.busCreated(bus);
@@ -135,9 +137,9 @@ public class OSGIBusListener implements BusLifeCycleListener {
     }
 
     private void registerServerLifecycleListeners() {
-        ServiceReference refs[] = getServiceReferences(defaultContext, ServerLifeCycleListener.class);
+        ServiceReference<?> refs[] = getServiceReferences(defaultContext, ServerLifeCycleListener.class);
         ServerLifeCycleManager clcm = bus.getExtension(ServerLifeCycleManager.class);
-        for (ServiceReference ref : refs) {
+        for (ServiceReference<?> ref : refs) {
             if (!isPrivate(ref) && !isExcluded(ref)) {
                 ServerLifeCycleListener listener = (ServerLifeCycleListener)defaultContext.getService(ref);
                 clcm.registerListener(listener);
@@ -145,9 +147,9 @@ public class OSGIBusListener implements BusLifeCycleListener {
         }
     }
     private void registerClientLifeCycleListeners() {
-        ServiceReference refs[] = getServiceReferences(defaultContext, ClientLifeCycleListener.class);
+        ServiceReference<?> refs[] = getServiceReferences(defaultContext, ClientLifeCycleListener.class);
         ClientLifeCycleManager clcm = bus.getExtension(ClientLifeCycleManager.class);
-        for (ServiceReference ref : refs) {
+        for (ServiceReference<?> ref : refs) {
             if (!isPrivate(ref) && !isExcluded(ref)) {
                 ClientLifeCycleListener listener = (ClientLifeCycleListener)defaultContext.getService(ref);
                 clcm.registerListener(listener);
@@ -156,8 +158,8 @@ public class OSGIBusListener implements BusLifeCycleListener {
     }
 
     private void registerBusFeatures() {
-        ServiceReference refs[] = getServiceReferences(defaultContext, Feature.class);
-        for (ServiceReference ref : refs) {
+        ServiceReference<?> refs[] = getServiceReferences(defaultContext, Feature.class);
+        for (ServiceReference<?> ref : refs) {
             if (!isPrivate(ref) && !isExcluded(ref)) {
                 Feature feature = (Feature)defaultContext.getService(ref);
                 bus.getFeatures().add(feature);
@@ -165,7 +167,7 @@ public class OSGIBusListener implements BusLifeCycleListener {
         }
     }
 
-    private boolean isPrivate(ServiceReference ref) {
+    private boolean isPrivate(ServiceReference<?> ref) {
         Object o = ref.getProperty(SERVICE_PROPERTY_PRIVATE);
         Boolean pvt = Boolean.FALSE;
         if (o == null) {
@@ -178,7 +180,7 @@ public class OSGIBusListener implements BusLifeCycleListener {
         return pvt.booleanValue();
     }
 
-    private boolean isExcluded(ServiceReference ref) {
+    private boolean isExcluded(ServiceReference<?> ref) {
         String o = (String)ref.getProperty(SERVICE_PROPERTY_RESTRICTED);
         if (!StringUtils.isEmpty(o)) {
             // if the service's restricted-regex is set, the service is excluded when the app not matching that regex
@@ -207,12 +209,12 @@ public class OSGIBusListener implements BusLifeCycleListener {
     private void registerBusAsService() {
         BundleContext context = bus.getExtension(BundleContext.class);
         if (context != null) {
-            Properties props = new Properties();
+            Map<String, Object> props = new HashMap<>();
             props.put(CONTEXT_SYMBOLIC_NAME_PROPERTY, context.getBundle().getSymbolicName());
             props.put(CONTEXT_VERSION_PROPERTY, getBundleVersion(context.getBundle()));
             props.put(CONTEXT_NAME_PROPERTY, bus.getId());
 
-            service = context.registerService(Bus.class.getName(), bus, props);
+            service = context.registerService(Bus.class.getName(), bus, CollectionUtils.toDictionary(props));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/core/src/main/java/org/apache/cxf/bus/osgi/OSGiBeanLocator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/osgi/OSGiBeanLocator.java b/core/src/main/java/org/apache/cxf/bus/osgi/OSGiBeanLocator.java
index 5fec856..d1c40ea 100644
--- a/core/src/main/java/org/apache/cxf/bus/osgi/OSGiBeanLocator.java
+++ b/core/src/main/java/org/apache/cxf/bus/osgi/OSGiBeanLocator.java
@@ -61,9 +61,9 @@ public class OSGiBeanLocator implements ConfiguredBeanLocator {
     private <T> List<T> getBeansFromOsgiService(Class<T> type) {
         List<T> list = new ArrayList<>();
         try {
-            ServiceReference refs[] = context.getServiceReferences(type.getName(), null);
+            ServiceReference<?> refs[] = context.getServiceReferences(type.getName(), null);
             if (refs != null) {
-                for (ServiceReference r : refs) {
+                for (ServiceReference<?> r : refs) {
                     if (type == ClassLoader.class
                         && checkCompatibleLocators
                         && !PropertyUtils.isTrue(r.getProperty(COMPATIBLE_LOCATOR_PROP))) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/core/src/main/java/org/apache/cxf/common/util/CollectionUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/util/CollectionUtils.java b/core/src/main/java/org/apache/cxf/common/util/CollectionUtils.java
index 9e7a3d4..0bb7516 100644
--- a/core/src/main/java/org/apache/cxf/common/util/CollectionUtils.java
+++ b/core/src/main/java/org/apache/cxf/common/util/CollectionUtils.java
@@ -21,7 +21,11 @@ package org.apache.cxf.common.util;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.Dictionary;
+import java.util.Enumeration;
 import java.util.Iterator;
+import java.util.Map;
 
 public final class CollectionUtils {
     private CollectionUtils() {
@@ -53,4 +57,88 @@ public final class CollectionUtils {
         return true;
     }
 
+    public static <S, T> Dictionary<S, T> singletonDictionary(S s, T t) {
+        return toDictionary(Collections.singletonMap(s, t));
+    }
+    public static <S, T> Dictionary<S, T> toDictionary(Map<S, T> map) {
+        return new MapToDictionary<S, T>(map);
+    }
+    
+    static class MapToDictionary<S, T> extends Dictionary<S, T> {
+        /**
+         * Map source.
+         **/
+        private Map<S, T> map;
+
+        MapToDictionary(Map<S, T> map) {
+            this.map = map;
+        }
+
+
+        public Enumeration<T> elements() {
+            if (map == null) {
+                return null;
+            }
+            return new IteratorToEnumeration<T>(map.values().iterator());
+        }
+
+        public T get(Object key) {
+            if (map == null)  {
+                return null;
+            }
+            return map.get(key);
+        }
+
+        public boolean isEmpty() {
+            if (map == null) {
+                return true;
+            }
+            return map.isEmpty();
+        }
+
+        public Enumeration<S> keys() {
+            if (map == null) {
+                return null;
+            }
+            return new IteratorToEnumeration<S>(map.keySet().iterator());
+        }
+
+        public T put(S key, T value) {
+            throw new UnsupportedOperationException();
+        }
+
+        public T remove(Object key) {
+            throw new UnsupportedOperationException();
+        }
+
+        public int size() {
+            if (map == null) {
+                return 0;
+            }
+            return map.size();
+        }
+        
+        
+        static class IteratorToEnumeration<X> implements Enumeration<X> {
+            private final Iterator<X> iter;
+
+            IteratorToEnumeration(Iterator<X> iter) {
+                this.iter = iter;
+            }
+
+            public boolean hasMoreElements() {
+                if (iter == null) {
+                    return false;
+                }
+                return iter.hasNext();
+            }
+
+            public X nextElement() {
+                if (iter == null) {
+                    return null;
+                }
+                return iter.next();
+            }
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/core/src/test/java/org/apache/cxf/bus/osgi/OSGiBusListenerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/bus/osgi/OSGiBusListenerTest.java b/core/src/test/java/org/apache/cxf/bus/osgi/OSGiBusListenerTest.java
index 4b2c55a..17b8b33 100644
--- a/core/src/test/java/org/apache/cxf/bus/osgi/OSGiBusListenerTest.java
+++ b/core/src/test/java/org/apache/cxf/bus/osgi/OSGiBusListenerTest.java
@@ -127,7 +127,7 @@ public class OSGiBusListenerTest extends Assert {
     }
 
     private void setUpClientLifeCycleListeners(String[] names, String[] restricted, String excludes) throws Exception {
-        ServiceReference[] svcrefs = createTestServiceReferences(names, restricted);
+        ServiceReference<Object>[] svcrefs = createTestServiceReferences(names, restricted);
         EasyMock.expect(bundleContext.getServiceReferences(ClientLifeCycleListener.class.getName(), null))
             .andReturn(svcrefs);
         ClientLifeCycleManager lcmanager = control.createMock(ClientLifeCycleManager.class);
@@ -143,7 +143,7 @@ public class OSGiBusListenerTest extends Assert {
     }
 
     private void setUpServerLifeCycleListeners(String[] names, String[] restricted, String excludes) throws Exception {
-        ServiceReference[] svcrefs = createTestServiceReferences(names, restricted);
+        ServiceReference<Object>[] svcrefs = createTestServiceReferences(names, restricted);
         EasyMock.expect(bundleContext.getServiceReferences(ServerLifeCycleListener.class.getName(), null))
             .andReturn(svcrefs);
         ServerLifeCycleManager lcmanager = control.createMock(ServerLifeCycleManager.class);
@@ -160,7 +160,7 @@ public class OSGiBusListenerTest extends Assert {
 
     private void setFeatures(String[] names, String[] restricted,
                              Collection<Feature> lst) throws Exception {
-        ServiceReference[] svcrefs = createTestServiceReferences(names, restricted);
+        ServiceReference<Object>[] svcrefs = createTestServiceReferences(names, restricted);
         EasyMock.expect(bundleContext.getServiceReferences(Feature.class.getName(), null))
             .andReturn(svcrefs);
         for (int i = 0; i < names.length; i++) {
@@ -172,8 +172,9 @@ public class OSGiBusListenerTest extends Assert {
     }
 
     // Creates test service references with the specified symbolic names and the restricted extension properties.
-    private ServiceReference[] createTestServiceReferences(String[] names, String[] restricted) {
-        ServiceReference[] refs = new ServiceReference[names.length];
+    private ServiceReference<Object>[] createTestServiceReferences(String[] names, String[] restricted) {
+        @SuppressWarnings("unchecked")
+        ServiceReference<Object>[] refs = new ServiceReference[names.length];
         for (int i = 0; i < names.length; i++) {
             refs[i] = createTestServiceReference(names[i], restricted[i]);
         }
@@ -182,8 +183,9 @@ public class OSGiBusListenerTest extends Assert {
 
 
     // Creates a test service reference with the specified symbolic name and the restricted extension property.
-    private ServiceReference createTestServiceReference(String name, String rst) {
-        ServiceReference ref = control.createMock(ServiceReference.class);
+    private ServiceReference<Object> createTestServiceReference(String name, String rst) {
+        @SuppressWarnings("unchecked")
+        ServiceReference<Object> ref = control.createMock(ServiceReference.class);
         Bundle b = control.createMock(Bundle.class);
         EasyMock.expect(b.getSymbolicName()).andReturn(name).anyTimes();
         EasyMock.expect(ref.getBundle()).andReturn(b).anyTimes();

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java
----------------------------------------------------------------------
diff --git a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java
index 5773e18..c99c225 100644
--- a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java
+++ b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java
@@ -177,7 +177,7 @@ public class CXFOSGiTestSupport {
     public void assertServicePublished(String filter, int timeout) {
         try {
             Filter serviceFilter = bundleContext.createFilter(filter);
-            ServiceTracker tracker = new ServiceTracker(bundleContext, serviceFilter, null);
+            ServiceTracker<Object, ?> tracker = new ServiceTracker<>(bundleContext, serviceFilter, null);
             tracker.open();
             Object service = tracker.waitForService(timeout);
             tracker.close();

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/osgi/karaf/commands/src/main/java/org/apache/cxf/karaf/commands/ListEndpointsCommand.java
----------------------------------------------------------------------
diff --git a/osgi/karaf/commands/src/main/java/org/apache/cxf/karaf/commands/ListEndpointsCommand.java b/osgi/karaf/commands/src/main/java/org/apache/cxf/karaf/commands/ListEndpointsCommand.java
index 4190702..5f8d78e 100644
--- a/osgi/karaf/commands/src/main/java/org/apache/cxf/karaf/commands/ListEndpointsCommand.java
+++ b/osgi/karaf/commands/src/main/java/org/apache/cxf/karaf/commands/ListEndpointsCommand.java
@@ -148,7 +148,7 @@ public class ListEndpointsCommand extends CXFController implements Action {
         String filter = "(&(" + "objectclass=" + "javax.servlet.Servlet"
             + ")(servlet-name=cxf-osgi-transport-servlet))";
 
-        ServiceReference ref = getBundleContext().getServiceReferences(null, filter)[0];
+        ServiceReference<?> ref = getBundleContext().getServiceReferences((String)null, filter)[0];
 
         if (ref != null) {
             ret = (String)ref.getProperty("alias");
@@ -163,7 +163,7 @@ public class ListEndpointsCommand extends CXFController implements Action {
         String filter = "(&(" + "objectclass=" + "org.osgi.service.http.HttpService"
                 + "))";
 
-        ServiceReference ref = getBundleContext().getServiceReferences(null, filter)[0];
+        ServiceReference<?> ref = getBundleContext().getServiceReferences((String)null, filter)[0];
 
         if (ref != null) {
             ret = (String) ref.getProperty("org.osgi.service.http.port");

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/osgi/karaf/commands/src/main/java/org/apache/cxf/karaf/commands/internal/CXFController.java
----------------------------------------------------------------------
diff --git a/osgi/karaf/commands/src/main/java/org/apache/cxf/karaf/commands/internal/CXFController.java b/osgi/karaf/commands/src/main/java/org/apache/cxf/karaf/commands/internal/CXFController.java
index 6a8fc4c..7d1279e 100644
--- a/osgi/karaf/commands/src/main/java/org/apache/cxf/karaf/commands/internal/CXFController.java
+++ b/osgi/karaf/commands/src/main/java/org/apache/cxf/karaf/commands/internal/CXFController.java
@@ -20,6 +20,7 @@
 package org.apache.cxf.karaf.commands.internal;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -47,11 +48,11 @@ public class CXFController {
     public List<Bus> getBusses() {
         List<Bus> busses = new ArrayList<>();
         try {
-            ServiceReference[] references = bundleContext.getServiceReferences(Bus.class.getName(), null);
+            Collection<ServiceReference<Bus>> references = bundleContext.getServiceReferences(Bus.class, null);
             if (references != null) {
-                for (ServiceReference reference : references) {
+                for (ServiceReference<Bus> reference : references) {
                     if (reference != null) {
-                        Bus bus = (Bus) bundleContext.getService(reference);
+                        Bus bus = bundleContext.getService(reference);
                         if (bus != null) {
                             busses.add(bus);
                         }
@@ -66,12 +67,12 @@ public class CXFController {
 
     public Bus getBus(String name) {
         try {
-            ServiceReference[] references = bundleContext.getServiceReferences(Bus.class.getName(), null);
+            Collection<ServiceReference<Bus>> references = bundleContext.getServiceReferences(Bus.class, null);
             if (references != null) {
-                for (ServiceReference reference : references) {
+                for (ServiceReference<Bus> reference : references) {
                     if (reference != null
                         && name.equals(reference.getProperty("cxf.bus.id"))) {
-                        return (Bus) bundleContext.getService(reference);
+                        return bundleContext.getService(reference);
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index d29a212..2de8b2e 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -187,11 +187,10 @@
         <cxf.aries.version>1.0.0</cxf.aries.version>
         <cxf.aries.parser.version>1.3.1</cxf.aries.parser.version> 
         <cxf.aries.version.range>[1.0,2)</cxf.aries.version.range>
-        <cxf.osgi.version>4.2.0</cxf.osgi.version>
+        <cxf.osgi.version>5.0.0</cxf.osgi.version>
         <cxf.karaf.version>4.1.1</cxf.karaf.version>
         <cxf.pax.logging.version>1.6.0</cxf.pax.logging.version>
         <cxf.pax.exam.version>4.10.0</cxf.pax.exam.version>
-        <cxf.felix.framework.version>2.0.5</cxf.felix.framework.version>
         <cxf.felix.configadmin.version>1.2.4</cxf.felix.configadmin.version>
         <cxf.xmlbeans.bundle.version>2.6.0_2</cxf.xmlbeans.bundle.version>
         <cxf.servicemix.aspectj.version>1.8.7_2</cxf.servicemix.aspectj.version>

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/osgi/Activator.java b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/osgi/Activator.java
index a57d7d3..88f1db3 100644
--- a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/osgi/Activator.java
+++ b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/osgi/Activator.java
@@ -51,8 +51,8 @@ public class Activator implements BundleActivator {
 
     private static final class ConfigUpdater implements ManagedService {
         private BundleContext bundleContext;
-        private ServiceRegistration serviceReg;
-        private ServiceRegistration intentReg;
+        private ServiceRegistration<?> serviceReg;
+        private ServiceRegistration<?> intentReg;
         private LoggingFeature logging;
 
         ConfigUpdater(BundleContext bundleContext) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/Activator.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/Activator.java b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/Activator.java
index 0321a95..af69975 100644
--- a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/Activator.java
+++ b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/Activator.java
@@ -50,18 +50,15 @@ public class Activator implements BundleActivator {
         conduitConfigurer.close();
     }
 
-    public class ConduitConfigurer extends ServiceTracker implements ManagedService {
+    public class ConduitConfigurer extends ServiceTracker<Bus, Bus> implements ManagedService {
         private Map<String, Object> currentConfig;
 
         public ConduitConfigurer(BundleContext context) {
-            super(context, Bus.class.getName(), null);
+            super(context, Bus.class, null);
         }
 
-        @SuppressWarnings({
-            "rawtypes", "unchecked"
-        })
         @Override
-        public void updated(Dictionary properties) throws ConfigurationException {
+        public void updated(Dictionary<String, ?> properties) throws ConfigurationException {
             this.currentConfig = toMap(properties);
             Bus[] buses = (Bus[])getServices();
             if (buses == null) {
@@ -73,8 +70,8 @@ public class Activator implements BundleActivator {
         }
 
         @Override
-        public Object addingService(ServiceReference reference) {
-            Bus bus = (Bus)super.addingService(reference);
+        public Bus addingService(ServiceReference<Bus> reference) {
+            Bus bus = super.addingService(reference);
             configureConduitFactory(bus);
             return bus;
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/osgi/HTTPJettyTransportActivator.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/osgi/HTTPJettyTransportActivator.java b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/osgi/HTTPJettyTransportActivator.java
index b7556bc..846bc7d 100644
--- a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/osgi/HTTPJettyTransportActivator.java
+++ b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/osgi/HTTPJettyTransportActivator.java
@@ -24,13 +24,13 @@ import java.security.GeneralSecurityException;
 import java.util.Dictionary;
 import java.util.Enumeration;
 import java.util.List;
-import java.util.Properties;
 import java.util.StringTokenizer;
 
 import javax.management.MBeanServer;
 
 import org.apache.cxf.bus.blueprint.BlueprintNameSpaceHandlerFactory;
 import org.apache.cxf.bus.blueprint.NamespaceHandlerRegisterer;
+import org.apache.cxf.common.util.CollectionUtils;
 import org.apache.cxf.configuration.jsse.TLSParameterJaxBUtils;
 import org.apache.cxf.configuration.jsse.TLSServerParameters;
 import org.apache.cxf.configuration.security.CertStoreType;
@@ -61,8 +61,8 @@ public class HTTPJettyTransportActivator
 
     BundleContext context;
     MBeanServer mbeans;
-    ServiceTracker mbeanServerTracker;
-    ServiceRegistration reg;
+    ServiceTracker<MBeanServer, ?> mbeanServerTracker;
+    ServiceRegistration<ManagedServiceFactory> reg;
 
     JettyHTTPServerEngineFactory factory = new JettyHTTPServerEngineFactory() {
         public MBeanServer getMBeanServer() {
@@ -72,12 +72,11 @@ public class HTTPJettyTransportActivator
 
     public void start(BundleContext ctx) throws Exception {
         this.context = ctx;
-        Properties servProps = new Properties();
-        servProps.put(Constants.SERVICE_PID, FACTORY_PID);
-        reg = context.registerService(ManagedServiceFactory.class.getName(),
-                                       this, servProps);
+        reg = context.registerService(ManagedServiceFactory.class,
+                                      this,
+                                      CollectionUtils.singletonDictionary(Constants.SERVICE_PID, FACTORY_PID));
 
-        mbeanServerTracker = new ServiceTracker(ctx, MBeanServer.class.getName(), null);
+        mbeanServerTracker = new ServiceTracker<>(ctx, MBeanServer.class, null);
         try {
             BlueprintNameSpaceHandlerFactory nsHandlerFactory = new BlueprintNameSpaceHandlerFactory() {
 
@@ -102,8 +101,7 @@ public class HTTPJettyTransportActivator
         return FACTORY_PID;
     }
 
-    @SuppressWarnings("unchecked")
-    public void updated(String pid, @SuppressWarnings("rawtypes") Dictionary properties)
+    public void updated(String pid, Dictionary<String, ?> properties)
         throws ConfigurationException {
         if (pid == null) {
             return;
@@ -129,7 +127,7 @@ public class HTTPJettyTransportActivator
     }
 
 
-    private void configure(JettyHTTPServerEngine e, Dictionary<String, String> properties) {
+    private void configure(JettyHTTPServerEngine e, Dictionary<String, ?> properties) {
         ThreadingParameters threading = createThreadingParameters(properties);
         if (threading != null) {
             e.setThreadingParameters(threading);
@@ -138,13 +136,13 @@ public class HTTPJettyTransportActivator
         while (keys.hasMoreElements()) {
             String k = keys.nextElement();
             if ("sessionSupport".equals(k)) {
-                e.setSessionSupport(Boolean.parseBoolean(properties.get(k)));
+                e.setSessionSupport(Boolean.parseBoolean((String)properties.get(k)));
             } else if ("continuationsEnabled".equals(k)) {
-                e.setContinuationsEnabled(Boolean.parseBoolean(properties.get(k)));
+                e.setContinuationsEnabled(Boolean.parseBoolean((String)properties.get(k)));
             } else if ("reuseAddress".equals(k)) {
-                e.setReuseAddress(Boolean.parseBoolean(properties.get(k)));
+                e.setReuseAddress(Boolean.parseBoolean((String)properties.get(k)));
             } else if ("maxIdleTime".equals(k)) {
-                e.setMaxIdleTime(Integer.parseInt(properties.get(k)));
+                e.setMaxIdleTime(Integer.parseInt((String)properties.get(k)));
             }
         }
     }
@@ -152,7 +150,7 @@ public class HTTPJettyTransportActivator
     public void deleted(String pid) {
     }
 
-    private ThreadingParameters createThreadingParameters(Dictionary<String, String> d) {
+    private ThreadingParameters createThreadingParameters(Dictionary<String, ?> d) {
         Enumeration<String> keys = d.keys();
         ThreadingParameters p = null;
         while (keys.hasMoreElements()) {
@@ -161,7 +159,7 @@ public class HTTPJettyTransportActivator
                 if (p == null) {
                     p = new ThreadingParameters();
                 }
-                String v = d.get(k);
+                String v = (String)d.get(k);
                 k = k.substring("threadingParameters.".length());
                 if ("minThreads".equals(k)) {
                     p.setMinThreads(Integer.parseInt(v));
@@ -175,7 +173,7 @@ public class HTTPJettyTransportActivator
         return p;
     }
 
-    private TLSServerParameters createTlsServerParameters(Dictionary<String, String> d) {
+    private TLSServerParameters createTlsServerParameters(Dictionary<String, ?> d) {
         Enumeration<String> keys = d.keys();
         TLSServerParameters p = null;
         SecureRandomParameters srp = null;
@@ -188,7 +186,7 @@ public class HTTPJettyTransportActivator
                 if (p == null) {
                     p = new TLSServerParameters();
                 }
-                String v = d.get(k);
+                String v = (String)d.get(k);
                 k = k.substring("tlsServerParameters.".length());
 
                 if ("secureSocketProtocol".equals(k)) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/osgi/HTTPUndertowTransportActivator.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/osgi/HTTPUndertowTransportActivator.java b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/osgi/HTTPUndertowTransportActivator.java
index 89c53ee..1d917ca 100644
--- a/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/osgi/HTTPUndertowTransportActivator.java
+++ b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/osgi/HTTPUndertowTransportActivator.java
@@ -24,13 +24,13 @@ import java.security.GeneralSecurityException;
 import java.util.Dictionary;
 import java.util.Enumeration;
 import java.util.List;
-import java.util.Properties;
 import java.util.StringTokenizer;
 
 import javax.management.MBeanServer;
 
 import org.apache.cxf.bus.blueprint.BlueprintNameSpaceHandlerFactory;
 import org.apache.cxf.bus.blueprint.NamespaceHandlerRegisterer;
+import org.apache.cxf.common.util.CollectionUtils;
 import org.apache.cxf.configuration.jsse.TLSParameterJaxBUtils;
 import org.apache.cxf.configuration.jsse.TLSServerParameters;
 import org.apache.cxf.configuration.security.CertStoreType;
@@ -61,8 +61,8 @@ public class HTTPUndertowTransportActivator
 
     BundleContext context;
     MBeanServer mbeans;
-    ServiceTracker mbeanServerTracker;
-    ServiceRegistration reg;
+    ServiceTracker<MBeanServer, MBeanServer> mbeanServerTracker;
+    ServiceRegistration<?> reg;
 
     UndertowHTTPServerEngineFactory factory = new UndertowHTTPServerEngineFactory() {
         public MBeanServer getMBeanServer() {
@@ -72,12 +72,11 @@ public class HTTPUndertowTransportActivator
 
     public void start(BundleContext ctx) throws Exception {
         this.context = ctx;
-        Properties servProps = new Properties();
-        servProps.put(Constants.SERVICE_PID, FACTORY_PID);
         reg = context.registerService(ManagedServiceFactory.class.getName(),
-                                       this, servProps);
+                                      this,
+                                      CollectionUtils.singletonDictionary(Constants.SERVICE_PID, FACTORY_PID));
 
-        mbeanServerTracker = new ServiceTracker(ctx, MBeanServer.class.getName(), null);
+        mbeanServerTracker = new ServiceTracker<>(ctx, MBeanServer.class, null);
         try {
             BlueprintNameSpaceHandlerFactory nsHandlerFactory = new BlueprintNameSpaceHandlerFactory() {
 
@@ -102,8 +101,7 @@ public class HTTPUndertowTransportActivator
         return FACTORY_PID;
     }
 
-    @SuppressWarnings("unchecked")
-    public void updated(String pid, @SuppressWarnings("rawtypes") Dictionary properties)
+    public void updated(String pid, Dictionary<String, ?> properties)
         throws ConfigurationException {
         if (pid == null) {
             return;
@@ -129,7 +127,7 @@ public class HTTPUndertowTransportActivator
     }
 
 
-    private void configure(UndertowHTTPServerEngine e, Dictionary<String, String> properties) {
+    private void configure(UndertowHTTPServerEngine e, Dictionary<String, ?> properties) {
         ThreadingParameters threading = createThreadingParameters(properties);
         if (threading != null) {
             e.setThreadingParameters(threading);
@@ -138,9 +136,9 @@ public class HTTPUndertowTransportActivator
         while (keys.hasMoreElements()) {
             String k = keys.nextElement();
             if ("continuationsEnabled".equals(k)) {
-                e.setContinuationsEnabled(Boolean.parseBoolean(properties.get(k)));
+                e.setContinuationsEnabled(Boolean.parseBoolean((String)properties.get(k)));
             } else if ("maxIdleTime".equals(k)) {
-                e.setMaxIdleTime(Integer.parseInt(properties.get(k)));
+                e.setMaxIdleTime(Integer.parseInt((String)properties.get(k)));
             }
         }
     }
@@ -148,7 +146,7 @@ public class HTTPUndertowTransportActivator
     public void deleted(String pid) {
     }
 
-    private ThreadingParameters createThreadingParameters(Dictionary<String, String> d) {
+    private ThreadingParameters createThreadingParameters(Dictionary<String, ?> d) {
         Enumeration<String> keys = d.keys();
         ThreadingParameters p = null;
         while (keys.hasMoreElements()) {
@@ -157,7 +155,7 @@ public class HTTPUndertowTransportActivator
                 if (p == null) {
                     p = new ThreadingParameters();
                 }
-                String v = d.get(k);
+                String v = (String)d.get(k);
                 k = k.substring("threadingParameters.".length());
                 if ("minThreads".equals(k)) {
                     p.setMinThreads(Integer.parseInt(v));
@@ -171,7 +169,7 @@ public class HTTPUndertowTransportActivator
         return p;
     }
 
-    private TLSServerParameters createTlsServerParameters(Dictionary<String, String> d) {
+    private TLSServerParameters createTlsServerParameters(Dictionary<String, ?> d) {
         Enumeration<String> keys = d.keys();
         TLSServerParameters p = null;
         SecureRandomParameters srp = null;
@@ -184,7 +182,7 @@ public class HTTPUndertowTransportActivator
                 if (p == null) {
                     p = new TLSServerParameters();
                 }
-                String v = d.get(k);
+                String v = (String)d.get(k);
                 k = k.substring("tlsServerParameters.".length());
 
                 if ("secureSocketProtocol".equals(k)) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/HTTPTransportActivator.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/HTTPTransportActivator.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/HTTPTransportActivator.java
index d39812b..c9fd950 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/HTTPTransportActivator.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/HTTPTransportActivator.java
@@ -19,10 +19,9 @@
 
 package org.apache.cxf.transport.http.osgi;
 
-import java.util.Properties;
-
 import org.apache.cxf.bus.blueprint.BlueprintNameSpaceHandlerFactory;
 import org.apache.cxf.bus.blueprint.NamespaceHandlerRegisterer;
+import org.apache.cxf.common.util.CollectionUtils;
 import org.apache.cxf.common.util.PropertyUtils;
 import org.apache.cxf.transport.http.DestinationRegistry;
 import org.apache.cxf.transport.http.DestinationRegistryImpl;
@@ -39,7 +38,7 @@ import org.osgi.util.tracker.ServiceTracker;
 
 public class HTTPTransportActivator implements BundleActivator {
     private static final String DISABLE_DEFAULT_HTTP_TRANSPORT = "org.apache.cxf.osgi.http.transport.disable";
-    private ServiceTracker httpServiceTracker;
+    private ServiceTracker<HttpService, ?> httpServiceTracker;
 
     public void start(final BundleContext context) throws Exception {
 
@@ -60,7 +59,7 @@ public class HTTPTransportActivator implements BundleActivator {
         HTTPTransportFactory transportFactory = new HTTPTransportFactory(destinationRegistry);
 
         HttpServiceTrackerCust customizer = new HttpServiceTrackerCust(destinationRegistry, context);
-        httpServiceTracker = new ServiceTracker(context, HttpService.class.getName(), customizer);
+        httpServiceTracker = new ServiceTracker<>(context, HttpService.class, customizer);
         httpServiceTracker.open();
 
         context.registerService(DestinationRegistry.class.getName(), destinationRegistry, null);
@@ -77,11 +76,10 @@ public class HTTPTransportActivator implements BundleActivator {
                                             "http://cxf.apache.org/transports/http/configuration");
     }
 
-    private ServiceRegistration registerService(BundleContext context, Class<?> serviceInterface,
-                                        Object serviceObject, String servicePid) {
-        Properties servProps = new Properties();
-        servProps.put(Constants.SERVICE_PID,  servicePid);
-        return context.registerService(serviceInterface.getName(), serviceObject, servProps);
+    private <T> ServiceRegistration<T> registerService(BundleContext context, Class<T> serviceInterface,
+                                        T serviceObject, String servicePid) {
+        return context.registerService(serviceInterface, serviceObject,
+                                       CollectionUtils.singletonDictionary(Constants.SERVICE_PID, servicePid));
     }
 
     public void stop(BundleContext context) throws Exception {

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/HttpServiceTrackerCust.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/HttpServiceTrackerCust.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/HttpServiceTrackerCust.java
index fbf9035..4d1d3fc 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/HttpServiceTrackerCust.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/HttpServiceTrackerCust.java
@@ -18,10 +18,9 @@
  */
 package org.apache.cxf.transport.http.osgi;
 
-import java.util.Properties;
-
 import javax.servlet.Servlet;
 
+import org.apache.cxf.common.util.CollectionUtils;
 import org.apache.cxf.transport.http.DestinationRegistry;
 import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
 import org.osgi.framework.BundleContext;
@@ -33,11 +32,11 @@ import org.osgi.service.cm.ManagedService;
 import org.osgi.service.http.HttpService;
 import org.osgi.util.tracker.ServiceTrackerCustomizer;
 
-final class HttpServiceTrackerCust implements ServiceTrackerCustomizer {
+final class HttpServiceTrackerCust implements ServiceTrackerCustomizer<HttpService, HttpService> {
     private static final String CXF_CONFIG_PID = "org.apache.cxf.osgi";
     private final DestinationRegistry destinationRegistry;
     private final BundleContext context;
-    private ServiceRegistration servletPublisherReg;
+    private ServiceRegistration<ManagedService> servletPublisherReg;
     private ServletExporter servletExporter;
 
     HttpServiceTrackerCust(DestinationRegistry destinationRegistry, BundleContext context) {
@@ -46,7 +45,7 @@ final class HttpServiceTrackerCust implements ServiceTrackerCustomizer {
     }
 
     @Override
-    public void removedService(ServiceReference reference, Object service) {
+    public void removedService(ServiceReference<HttpService> reference, HttpService service) {
         servletPublisherReg.unregister();
         try {
             servletExporter.updated(null);
@@ -56,18 +55,18 @@ final class HttpServiceTrackerCust implements ServiceTrackerCustomizer {
     }
 
     @Override
-    public void modifiedService(ServiceReference reference, Object service) {
+    public void modifiedService(ServiceReference<HttpService> reference, HttpService service) {
     }
 
     @Override
-    public Object addingService(ServiceReference reference) {
-        HttpService httpService = (HttpService)context.getService(reference);
+    public HttpService addingService(ServiceReference<HttpService> reference) {
+        HttpService httpService = context.getService(reference);
         Servlet servlet = new CXFNonSpringServlet(destinationRegistry, false);
         servletExporter = new ServletExporter(servlet, httpService);
-        Properties servProps = new Properties();
-        servProps.put(Constants.SERVICE_PID,  CXF_CONFIG_PID);
-        servletPublisherReg = context.registerService(ManagedService.class.getName(),
-                                                      servletExporter, servProps);
+        servletPublisherReg = context.registerService(ManagedService.class,
+                                                      servletExporter,
+                                                      CollectionUtils.singletonDictionary(Constants.SERVICE_PID,
+                                                                                          CXF_CONFIG_PID));
         return httpService;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/ServletExporter.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/ServletExporter.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/ServletExporter.java
index c2216ee..dc9f4a0 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/ServletExporter.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/ServletExporter.java
@@ -39,7 +39,7 @@ class ServletExporter implements ManagedService {
 
     private String alias;
     private Servlet servlet;
-    private ServiceRegistration serviceRegistration;
+    private ServiceRegistration<?> serviceRegistration;
     private HttpService httpService;
 
     ServletExporter(Servlet servlet, HttpService httpService) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/OSGiJaxwsEndpointManager.java
----------------------------------------------------------------------
diff --git a/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/OSGiJaxwsEndpointManager.java b/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/OSGiJaxwsEndpointManager.java
index 24e8c8f..2dadb70 100644
--- a/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/OSGiJaxwsEndpointManager.java
+++ b/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/OSGiJaxwsEndpointManager.java
@@ -21,7 +21,8 @@ package org.apache.cxf.wsn.services;
 
 import java.net.URL;
 import java.util.Dictionary;
-import java.util.Properties;
+import java.util.HashMap;
+import java.util.Map;
 
 import javax.management.MBeanServer;
 import javax.xml.ws.Endpoint;
@@ -29,6 +30,7 @@ import javax.xml.ws.Endpoint;
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.blueprint.BlueprintBus;
+import org.apache.cxf.common.util.CollectionUtils;
 import org.apache.cxf.wsn.EndpointRegistrationException;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -111,11 +113,11 @@ public class OSGiJaxwsEndpointManager extends JaxwsEndpointManager {
         bp.setId("WS-Notification");
         bp.initialize();
         if (null != bundleContext) {
-            Properties props = new Properties();
+            Map<String, Object> props = new HashMap<>();
             props.put(CONTEXT_SYMBOLIC_NAME_PROPERTY, bundleContext.getBundle().getSymbolicName());
             props.put(CONTEXT_VERSION_PROPERTY, getBundleVersion(bundleContext.getBundle()));
             props.put(CONTEXT_NAME_PROPERTY, bp.getId());
-            bundleContext.registerService(Bus.class.getName(), bp, props);
+            bundleContext.registerService(Bus.class.getName(), bp, CollectionUtils.toDictionary(props));
         }
         cxfBus = bp;
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/CertificateRepoProxyFactory.java
----------------------------------------------------------------------
diff --git a/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/CertificateRepoProxyFactory.java b/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/CertificateRepoProxyFactory.java
index 218578c..f62f561 100644
--- a/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/CertificateRepoProxyFactory.java
+++ b/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/CertificateRepoProxyFactory.java
@@ -27,13 +27,13 @@ import org.osgi.framework.Filter;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.util.tracker.ServiceTracker;
 
-public class CertificateRepoProxyFactory {
-    private ServiceTracker tracker;
+public class CertificateRepoProxyFactory<T> {
+    private ServiceTracker<?, ?> tracker;
     private CertificateRepo proxy;
 
-    public CertificateRepoProxyFactory(Class<?> serviceInterface, String filterSt, BundleContext context) {
+    public CertificateRepoProxyFactory(Class<T> serviceInterface, String filterSt, BundleContext context) {
         Filter filter = createFilter(filterSt, context);
-        this.tracker = new ServiceTracker(context, filter, null);
+        this.tracker = new ServiceTracker<>(context, filter, null);
         this.tracker.open();
         Class<?>[] interfaces = new Class<?>[]{serviceInterface};
         InvocationHandler handler = new NamedServiceProxy(tracker, filterSt);

http://git-wip-us.apache.org/repos/asf/cxf/blob/3a46e586/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/NamedServiceProxy.java
----------------------------------------------------------------------
diff --git a/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/NamedServiceProxy.java b/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/NamedServiceProxy.java
index 9ec9a31..e18cb91 100644
--- a/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/NamedServiceProxy.java
+++ b/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/NamedServiceProxy.java
@@ -24,10 +24,10 @@ import java.lang.reflect.Method;
 import org.osgi.util.tracker.ServiceTracker;
 
 public class NamedServiceProxy implements InvocationHandler {
-    private ServiceTracker tracker;
+    private ServiceTracker<?, ?> tracker;
     private String filter;
 
-    public NamedServiceProxy(ServiceTracker tracker, String filter) {
+    public NamedServiceProxy(ServiceTracker<?, ?> tracker, String filter) {
         this.tracker = tracker;
         this.filter = filter;
     }


Mime
View raw message