You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by cs...@apache.org on 2016/02/26 17:33:07 UTC

cxf-dosgi git commit: [DOSGI-229] Refactor to make Remote Service Admin core independent of CXF

Repository: cxf-dosgi
Updated Branches:
  refs/heads/master d72ef14de -> a93346ed7


[DOSGI-229] Refactor to make Remote Service Admin core independent of CXF


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

Branch: refs/heads/master
Commit: a93346ed7b7042c50e7671a734f3b975efec7707
Parents: d72ef14
Author: Christian Schneider <ch...@die-schneider.net>
Authored: Fri Feb 26 17:29:09 2016 +0100
Committer: Christian Schneider <ch...@die-schneider.net>
Committed: Fri Feb 26 17:29:09 2016 +0100

----------------------------------------------------------------------
 .../org/apache/cxf/dosgi/dsw/Activator.java     |  7 +--
 .../dosgi/dsw/api/ConfigurationTypeHandler.java | 43 ++++++++++++++++
 .../apache/cxf/dosgi/dsw/api/ExportResult.java  | 53 +++++++++++++++++++
 .../dsw/api/IntentUnsatisfiedException.java     | 35 +++++++++++++
 .../cxf/dosgi/dsw/decorator/InterfaceRule.java  |  2 +-
 .../apache/cxf/dosgi/dsw/decorator/Rule.java    |  2 +-
 .../AbstractPojoConfigurationTypeHandler.java   |  4 +-
 .../dsw/handlers/ConfigTypeHandlerFactory.java  | 10 +++-
 .../dsw/handlers/ConfigurationTypeHandler.java  | 43 ----------------
 .../cxf/dosgi/dsw/handlers/ExportResult.java    | 54 --------------------
 .../JaxRSPojoConfigurationTypeHandler.java      |  9 ++--
 .../cxf/dosgi/dsw/handlers/JaxRSUtils.java      |  3 ++
 .../handlers/PojoConfigurationTypeHandler.java  |  7 +--
 .../cxf/dosgi/dsw/handlers/ServerWrapper.java   | 44 ++++++++++++++++
 .../handlers/WsdlConfigurationTypeHandler.java  |  5 +-
 .../cxf/dosgi/dsw/qos/IntentManagerImpl.java    |  1 +
 .../dsw/qos/IntentUnsatisfiedException.java     | 35 -------------
 .../dosgi/dsw/service/ClientServiceFactory.java |  5 +-
 .../dsw/service/ConfigTypeHandlerFinder.java    | 36 +++++++++++++
 .../cxf/dosgi/dsw/service/EventProducer.java    |  3 ++
 .../dsw/service/ExportRegistrationImpl.java     | 15 ++++--
 .../dsw/service/RemoteServiceAdminCore.java     | 46 +++++++++--------
 .../dsw/service/RemoteServiceadminFactory.java  |  8 +--
 .../apache/cxf/dosgi/dsw/util/OsgiUtils.java    |  9 ++--
 .../dsw/decorator/ServiceDecoratorImplTest.java |  4 +-
 .../dsw/handlers/ClientServiceFactoryTest.java  |  2 +
 .../handlers/ConfigTypeHandlerFactoryTest.java  |  6 ++-
 .../dsw/handlers/HttpServiceManagerTest.java    |  6 +--
 .../cxf/dosgi/dsw/handlers/JaxRSUtilsTest.java  | 10 ++++
 .../PojoConfigurationTypeHandlerTest.java       | 18 ++++---
 .../SecurityDelegatingHttpContextTest.java      |  3 ++
 .../dosgi/dsw/qos/IntentManagerImplTest.java    |  8 +--
 .../apache/cxf/dosgi/dsw/qos/IntentMapTest.java |  3 +-
 .../cxf/dosgi/dsw/qos/IntentTrackerTest.java    |  9 ++--
 .../dosgi/dsw/service/EventProducerTest.java    |  7 +--
 .../dsw/service/ImportRegistrationImplTest.java |  2 +-
 .../dsw/service/RemoteServiceAdminCoreTest.java | 18 +++----
 .../cxf/dosgi/dsw/util/ClassUtilsTest.java      |  2 +-
 .../cxf/dosgi/dsw/util/OsgiUtilsTest.java       |  8 ++-
 39 files changed, 361 insertions(+), 224 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java
index d5e6caa..166bc13 100644
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java
@@ -37,6 +37,7 @@ import org.apache.cxf.dosgi.dsw.qos.IntentManager;
 import org.apache.cxf.dosgi.dsw.qos.IntentManagerImpl;
 import org.apache.cxf.dosgi.dsw.qos.IntentMap;
 import org.apache.cxf.dosgi.dsw.qos.IntentTracker;
+import org.apache.cxf.dosgi.dsw.service.ConfigTypeHandlerFinder;
 import org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore;
 import org.apache.cxf.dosgi.dsw.service.RemoteServiceadminFactory;
 import org.apache.cxf.dosgi.dsw.util.Utils;
@@ -57,8 +58,8 @@ public class Activator implements ManagedService, BundleActivator {
     private static final Logger LOG = LoggerFactory.getLogger(Activator.class);
     private static final int DEFAULT_INTENT_TIMEOUT = 30000;
     private static final String CONFIG_SERVICE_PID = "cxf-dsw";
-    private ServiceRegistration rsaFactoryReg;
-    private ServiceRegistration decoratorReg;
+    private ServiceRegistration<?> rsaFactoryReg;
+    private ServiceRegistration<?> decoratorReg;
     private IntentTracker intentTracker;
     private HttpServiceManager httpServiceManager;
     private BundleContext bc;
@@ -91,7 +92,7 @@ public class Activator implements ManagedService, BundleActivator {
         intentTracker.open();
         IntentManager intentManager = new IntentManagerImpl(intentMap, DEFAULT_INTENT_TIMEOUT);
         httpServiceManager = new HttpServiceManager(bc, httpBase, cxfServletAlias);
-        ConfigTypeHandlerFactory configTypeHandlerFactory
+        ConfigTypeHandlerFinder configTypeHandlerFactory
             = new ConfigTypeHandlerFactory(bc, intentManager, httpServiceManager);
         RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, configTypeHandlerFactory);
         RemoteServiceadminFactory rsaf = new RemoteServiceadminFactory(rsaCore);

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/ConfigurationTypeHandler.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/ConfigurationTypeHandler.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/ConfigurationTypeHandler.java
new file mode 100644
index 0000000..fb42606
--- /dev/null
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/ConfigurationTypeHandler.java
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.dsw.api;
+
+import java.util.Map;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+
+public interface ConfigurationTypeHandler {
+
+    String[] getSupportedTypes();
+
+    ExportResult createServer(ServiceReference<?> serviceReference,
+                        BundleContext dswContext,
+                        BundleContext callingContext,
+                        Map<String, Object> sd,
+                        Class<?> iClass,
+                        Object serviceBean);
+
+    Object createProxy(ServiceReference<?> serviceReference,
+                       BundleContext dswContext,
+                       BundleContext callingContext,
+                       Class<?> iClass, 
+                       EndpointDescription endpoint) throws IntentUnsatisfiedException;
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/ExportResult.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/ExportResult.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/ExportResult.java
new file mode 100644
index 0000000..86acf8c
--- /dev/null
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/ExportResult.java
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.dsw.api;
+
+import java.io.Closeable;
+import java.util.Map;
+
+public class ExportResult {
+
+    private final Map<String, Object> endpointProps;
+    private final Closeable server;
+    private final Exception exception;
+
+    public ExportResult(Map<String, Object> endpointProps, Closeable server) {
+        this.endpointProps = endpointProps;
+        this.server = server;
+        this.exception = null;
+    }
+
+    public ExportResult(Map<String, Object> endpointProps, Exception ex) {
+        this.endpointProps = endpointProps;
+        this.server = null;
+        this.exception = ex;
+    }
+
+    public Map<String, Object> getEndpointProps() {
+        return endpointProps;
+    }
+
+    public Closeable getServer() {
+        return server;
+    }
+
+    public Exception getException() {
+        return exception;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/IntentUnsatisfiedException.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/IntentUnsatisfiedException.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/IntentUnsatisfiedException.java
new file mode 100644
index 0000000..4e27938
--- /dev/null
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/IntentUnsatisfiedException.java
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.dsw.api;
+
+public class IntentUnsatisfiedException extends RuntimeException {
+
+    private static final long serialVersionUID = 1L;
+
+    private final String intent;
+
+    public IntentUnsatisfiedException(String intent) {
+        super(intent);
+        this.intent = intent;
+    }
+
+    public String getIntent() {
+        return intent;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java
index 14b1ab8..894d01d 100644
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java
@@ -66,7 +66,7 @@ public class InterfaceRule implements Rule {
         addProps.put(name, obj);
     }
 
-    public synchronized void apply(ServiceReference sref, Map<String, Object> target) {
+    public synchronized void apply(ServiceReference<?> sref, Map<String, Object> target) {
         String[] objectClass = (String[]) sref.getProperty(Constants.OBJECTCLASS);
         boolean matches = false;
         for (String cls : objectClass) {

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/Rule.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/Rule.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/Rule.java
index a280442..adbd1cf 100644
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/Rule.java
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/Rule.java
@@ -31,7 +31,7 @@ public interface Rule {
      * @param sref The Service Reference to be checked.
      * @param target Any additional properties are to be set in this map.
      */
-    void apply(ServiceReference sref, Map<String, Object> target);
+    void apply(ServiceReference<?> sref, Map<String, Object> target);
 
     /**
      * Returns the bundle that provided this rule.

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
index 9006131..7992062 100644
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
@@ -31,6 +31,8 @@ import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.common.util.PackageUtils;
 import org.apache.cxf.dosgi.dsw.Constants;
+import org.apache.cxf.dosgi.dsw.api.ConfigurationTypeHandler;
+import org.apache.cxf.dosgi.dsw.api.ExportResult;
 import org.apache.cxf.dosgi.dsw.qos.IntentManager;
 import org.apache.cxf.dosgi.dsw.qos.IntentUtils;
 import org.apache.cxf.dosgi.dsw.util.ClassUtils;
@@ -209,7 +211,7 @@ public abstract class AbstractPojoConfigurationTypeHandler implements Configurat
         try {
             Thread.currentThread().setContextClassLoader(ServerFactoryBean.class.getClassLoader());
             Server server = factory.create();
-            return new ExportResult(endpointProps, server);
+            return new ExportResult(endpointProps, new ServerWrapper(server));
         } catch (Exception e) {
             return new ExportResult(endpointProps, e);
         } finally {

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactory.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactory.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactory.java
index b7380fb..8c0a881 100644
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactory.java
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactory.java
@@ -25,7 +25,9 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.cxf.dosgi.dsw.Constants;
+import org.apache.cxf.dosgi.dsw.api.ConfigurationTypeHandler;
 import org.apache.cxf.dosgi.dsw.qos.IntentManager;
+import org.apache.cxf.dosgi.dsw.service.ConfigTypeHandlerFinder;
 import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
 import org.apache.cxf.dosgi.dsw.util.Utils;
 import org.osgi.framework.BundleContext;
@@ -34,7 +36,7 @@ import org.osgi.service.remoteserviceadmin.RemoteConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class ConfigTypeHandlerFactory {
+public class ConfigTypeHandlerFactory implements ConfigTypeHandlerFinder {
 
     protected static final String DEFAULT_CONFIGURATION_TYPE = Constants.WS_CONFIG_TYPE;
     private static final Logger LOG = LoggerFactory.getLogger(ConfigTypeHandlerFactory.class);
@@ -62,12 +64,14 @@ public class ConfigTypeHandlerFactory {
         supportedConfigurationTypes.add(Constants.WS_CONFIG_TYPE_OLD);
     }
 
+    @Override
     public ConfigurationTypeHandler getHandler(BundleContext dswBC,
             Map<String, Object> serviceProperties) {
         List<String> configurationTypes = determineConfigurationTypes(serviceProperties);
         return getHandler(dswBC, configurationTypes, serviceProperties);
     }
 
+    @Override
     public ConfigurationTypeHandler getHandler(BundleContext dswBC, EndpointDescription endpoint) {
         List<String> configurationTypes = determineConfigTypesForImport(endpoint);
         return getHandler(dswBC, configurationTypes, endpoint.getProperties());
@@ -163,6 +167,10 @@ public class ConfigTypeHandlerFactory {
         return usableConfigurationTypes;
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.cxf.dosgi.dsw.handlers.ConfigTypeHandlerFinder#getSupportedConfigurationTypes()
+     */
+    @Override
     public List<String> getSupportedConfigurationTypes() {
         return supportedConfigurationTypes;
     }

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigurationTypeHandler.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigurationTypeHandler.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigurationTypeHandler.java
deleted file mode 100644
index a69c5e1..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigurationTypeHandler.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.dosgi.dsw.handlers;
-
-import java.util.Map;
-
-import org.apache.cxf.dosgi.dsw.qos.IntentUnsatisfiedException;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-
-public interface ConfigurationTypeHandler {
-
-    String[] getSupportedTypes();
-
-    ExportResult createServer(ServiceReference serviceReference,
-                        BundleContext dswContext,
-                        BundleContext callingContext,
-                        Map<String, Object> sd,
-                        Class<?> iClass,
-                        Object serviceBean);
-
-    Object createProxy(ServiceReference serviceReference,
-                       BundleContext dswContext,
-                       BundleContext callingContext,
-                       Class<?> iClass, EndpointDescription endpoint) throws IntentUnsatisfiedException;
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ExportResult.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ExportResult.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ExportResult.java
deleted file mode 100644
index 47b7bf6..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ExportResult.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.dosgi.dsw.handlers;
-
-import java.util.Map;
-
-import org.apache.cxf.endpoint.Server;
-
-public class ExportResult {
-
-    private final Map<String, Object> endpointProps;
-    private final Server server;
-    private final Exception exception;
-
-    public ExportResult(Map<String, Object> endpointProps, Server server) {
-        this.endpointProps = endpointProps;
-        this.server = server;
-        this.exception = null;
-    }
-
-    public ExportResult(Map<String, Object> endpointProps, Exception ex) {
-        this.endpointProps = endpointProps;
-        this.server = null;
-        this.exception = ex;
-    }
-
-    public Map<String, Object> getEndpointProps() {
-        return endpointProps;
-    }
-
-    public Server getServer() {
-        return server;
-    }
-
-    public Exception getException() {
-        return exception;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
index c85a2c9..bf15c1c 100644
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
@@ -25,8 +25,9 @@ import java.util.Map;
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.util.ProxyClassLoader;
 import org.apache.cxf.dosgi.dsw.Constants;
+import org.apache.cxf.dosgi.dsw.api.ExportResult;
+import org.apache.cxf.dosgi.dsw.api.IntentUnsatisfiedException;
 import org.apache.cxf.dosgi.dsw.qos.IntentManager;
-import org.apache.cxf.dosgi.dsw.qos.IntentUnsatisfiedException;
 import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
@@ -54,7 +55,7 @@ public class JaxRSPojoConfigurationTypeHandler extends AbstractPojoConfiguration
         return new String[] {Constants.RS_CONFIG_TYPE};
     }
 
-    public Object createProxy(ServiceReference serviceReference, BundleContext dswContext,
+    public Object createProxy(ServiceReference<?> serviceReference, BundleContext dswContext,
                               BundleContext callingContext, Class<?> iClass,
                               EndpointDescription endpoint) throws IntentUnsatisfiedException {
         String address = getPojoAddress(endpoint, iClass);
@@ -109,7 +110,7 @@ public class JaxRSPojoConfigurationTypeHandler extends AbstractPojoConfiguration
         return getProxy(bean.create(), iClass);
     }
 
-    public ExportResult createServer(ServiceReference sref,
+    public ExportResult createServer(ServiceReference<?> sref,
                                      BundleContext dswContext,
                                      BundleContext callingContext,
                                      Map<String, Object> sd, Class<?> iClass,
@@ -146,7 +147,7 @@ public class JaxRSPojoConfigurationTypeHandler extends AbstractPojoConfiguration
         try {
             Thread.currentThread().setContextClassLoader(JAXRSServerFactoryBean.class.getClassLoader());
             Server server = factory.create();
-            return new ExportResult(endpointProps, server);
+            return new ExportResult(endpointProps, new ServerWrapper(server));
         } catch (Exception e) {
             return new ExportResult(endpointProps, e);
         } finally {

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java
index 5573c09..a7fe503 100644
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java
@@ -53,6 +53,9 @@ public final class JaxRSUtils {
         // never constructed
     }
 
+    @SuppressWarnings({
+     "rawtypes", "unchecked"
+    })
     static List<Object> getProviders(BundleContext callingContext, Map<String, Object> sd) {
         List<Object> providers = new ArrayList<Object>();
         if ("aegis".equals(sd.get(org.apache.cxf.dosgi.dsw.Constants.RS_DATABINDING_PROP_KEY))) {

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java
index b0c58f7..dcea099 100644
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java
@@ -26,8 +26,9 @@ import org.apache.cxf.Bus;
 import org.apache.cxf.aegis.databinding.AegisDatabinding;
 import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.dosgi.dsw.Constants;
+import org.apache.cxf.dosgi.dsw.api.ExportResult;
+import org.apache.cxf.dosgi.dsw.api.IntentUnsatisfiedException;
 import org.apache.cxf.dosgi.dsw.qos.IntentManager;
-import org.apache.cxf.dosgi.dsw.qos.IntentUnsatisfiedException;
 import org.apache.cxf.frontend.ClientProxyFactoryBean;
 import org.apache.cxf.frontend.ServerFactoryBean;
 import org.apache.cxf.jaxb.JAXBDataBinding;
@@ -53,7 +54,7 @@ public class PojoConfigurationTypeHandler extends AbstractPojoConfigurationTypeH
         return new String[] {Constants.WS_CONFIG_TYPE, Constants.WS_CONFIG_TYPE_OLD};
     }
 
-    public Object createProxy(ServiceReference sref, BundleContext dswContext, BundleContext callingContext,
+    public Object createProxy(ServiceReference<?> sref, BundleContext dswContext, BundleContext callingContext,
                               Class<?> iClass, EndpointDescription endpoint) throws IntentUnsatisfiedException {
         Map<String, Object> sd = endpoint.getProperties();
         String address = getClientAddress(sd);
@@ -86,7 +87,7 @@ public class PojoConfigurationTypeHandler extends AbstractPojoConfigurationTypeH
         return null;
     }
 
-    public ExportResult createServer(ServiceReference sref,
+    public ExportResult createServer(ServiceReference<?> sref,
                                      BundleContext dswContext,
                                      BundleContext callingContext,
                                      Map<String, Object> sd,

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServerWrapper.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServerWrapper.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServerWrapper.java
new file mode 100644
index 0000000..1c85a4e
--- /dev/null
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServerWrapper.java
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.dsw.handlers;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+import org.apache.cxf.endpoint.Server;
+
+public class ServerWrapper implements Closeable {
+    private Server server;
+
+    public ServerWrapper(Server server) {
+        this.server = server;
+    }
+    
+    public Server getServer() {
+        return server;
+    }
+
+    @Override
+    public void close() throws IOException {
+        server.stop();
+        server.destroy();
+    }
+    
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java
index 40ddc37..2c9e34f 100644
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java
@@ -29,6 +29,7 @@ import org.apache.cxf.Bus;
 import org.apache.cxf.common.util.PackageUtils;
 import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.dosgi.dsw.Constants;
+import org.apache.cxf.dosgi.dsw.api.ExportResult;
 import org.apache.cxf.dosgi.dsw.qos.IntentManager;
 import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
 import org.apache.cxf.jaxb.JAXBDataBinding;
@@ -53,7 +54,7 @@ public class WsdlConfigurationTypeHandler extends AbstractPojoConfigurationTypeH
         return new String[] {Constants.WSDL_CONFIG_TYPE};
     }
 
-    public Object createProxy(ServiceReference serviceReference,
+    public Object createProxy(ServiceReference<?> serviceReference,
                               BundleContext dswContext,
                               BundleContext callingContext,
                               Class<?> iClass,
@@ -100,7 +101,7 @@ public class WsdlConfigurationTypeHandler extends AbstractPojoConfigurationTypeH
         return Service.create(wsdlAddress, serviceQname);
     }
 
-    public ExportResult createServer(ServiceReference sref,
+    public ExportResult createServer(ServiceReference<?> sref,
                                BundleContext dswContext,
                                BundleContext callingContext,
                                Map<String, Object> sd,

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImpl.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImpl.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImpl.java
index d7b50f2..806c1b0 100644
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImpl.java
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImpl.java
@@ -27,6 +27,7 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.cxf.binding.BindingConfiguration;
+import org.apache.cxf.dosgi.dsw.api.IntentUnsatisfiedException;
 import org.apache.cxf.endpoint.AbstractEndpointFactory;
 import org.apache.cxf.feature.Feature;
 import org.slf4j.Logger;

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUnsatisfiedException.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUnsatisfiedException.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUnsatisfiedException.java
deleted file mode 100644
index a1b61fa..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUnsatisfiedException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.dosgi.dsw.qos;
-
-public class IntentUnsatisfiedException extends RuntimeException {
-
-    private static final long serialVersionUID = 1L;
-
-    private final String intent;
-
-    public IntentUnsatisfiedException(String intent) {
-        super(intent);
-        this.intent = intent;
-    }
-
-    public String getIntent() {
-        return intent;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactory.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactory.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactory.java
index b77950a..c6c4ee0 100644
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactory.java
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactory.java
@@ -23,8 +23,8 @@ import java.security.PrivilegedAction;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.cxf.dosgi.dsw.handlers.ConfigurationTypeHandler;
-import org.apache.cxf.dosgi.dsw.qos.IntentUnsatisfiedException;
+import org.apache.cxf.dosgi.dsw.api.ConfigurationTypeHandler;
+import org.apache.cxf.dosgi.dsw.api.IntentUnsatisfiedException;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceFactory;
@@ -33,6 +33,7 @@ import org.osgi.service.remoteserviceadmin.EndpointDescription;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@SuppressWarnings("rawtypes")
 public class ClientServiceFactory implements ServiceFactory {
 
     private static final Logger LOG = LoggerFactory.getLogger(ClientServiceFactory.class);

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ConfigTypeHandlerFinder.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ConfigTypeHandlerFinder.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ConfigTypeHandlerFinder.java
new file mode 100644
index 0000000..322bc1c
--- /dev/null
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ConfigTypeHandlerFinder.java
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.dsw.service;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cxf.dosgi.dsw.api.ConfigurationTypeHandler;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+
+public interface ConfigTypeHandlerFinder {
+
+    ConfigurationTypeHandler getHandler(BundleContext dswBC, Map<String, Object> serviceProperties);
+
+    ConfigurationTypeHandler getHandler(BundleContext dswBC, EndpointDescription endpoint);
+
+    List<String> getSupportedConfigurationTypes();
+
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventProducer.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventProducer.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventProducer.java
index 74ed7e2..26a46ab 100644
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventProducer.java
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventProducer.java
@@ -83,6 +83,9 @@ public class EventProducer {
         }
     }
 
+    @SuppressWarnings({
+     "rawtypes", "unchecked"
+    })
     private void notifyListeners(RemoteServiceAdminEvent rsae) {
         try {
             ServiceReference[] listenerRefs = bctx.getServiceReferences(

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java
index 2a9757b..59a9b11 100644
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java
@@ -18,11 +18,12 @@
  */
 package org.apache.cxf.dosgi.dsw.service;
 
+import java.io.Closeable;
+import java.io.IOException;
 import java.util.Arrays;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.cxf.endpoint.Server;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.remoteserviceadmin.EndpointDescription;
 import org.osgi.service.remoteserviceadmin.ExportReference;
@@ -36,7 +37,7 @@ public class ExportRegistrationImpl implements ExportRegistration {
 
     private final RemoteServiceAdminCore rsaCore;
     private final ExportReferenceImpl exportReference;
-    private final Server server;
+    private final Closeable server;
     private final Throwable exception;
 
     private final ExportRegistrationImpl parent;
@@ -44,7 +45,7 @@ public class ExportRegistrationImpl implements ExportRegistration {
     private volatile boolean closed;
 
     private ExportRegistrationImpl(ExportRegistrationImpl parent, RemoteServiceAdminCore rsaCore,
-            ExportReferenceImpl exportReference, Server server, Throwable exception) {
+            ExportReferenceImpl exportReference, Closeable server, Throwable exception) {
         this.parent = parent != null ? parent.parent : this; // a parent points to itself
         this.parent.addInstance();
         this.rsaCore = rsaCore;
@@ -61,7 +62,7 @@ public class ExportRegistrationImpl implements ExportRegistration {
 
     // create a new (parent) instance which was exported successfully with the given server
     public ExportRegistrationImpl(ServiceReference sref, EndpointDescription endpoint,
-            RemoteServiceAdminCore rsaCore, Server server) {
+            RemoteServiceAdminCore rsaCore, Closeable server) {
         this(null, rsaCore, new ExportReferenceImpl(sref, endpoint), server, null);
     }
 
@@ -113,7 +114,11 @@ public class ExportRegistrationImpl implements ExportRegistration {
                 LOG.debug("really closing ExportRegistration now!");
 
                 if (server != null) {
-                    server.destroy();
+                    try {
+                        server.close();
+                    } catch (IOException e) {
+                        LOG.warn("Error closing ExportRegistration", e);
+                    }
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
index e9bafa5..2007ec2 100644
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
@@ -32,9 +32,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.cxf.dosgi.dsw.handlers.ConfigTypeHandlerFactory;
-import org.apache.cxf.dosgi.dsw.handlers.ConfigurationTypeHandler;
-import org.apache.cxf.dosgi.dsw.handlers.ExportResult;
+import org.apache.cxf.dosgi.dsw.api.ConfigurationTypeHandler;
+import org.apache.cxf.dosgi.dsw.api.ExportResult;
 import org.apache.cxf.dosgi.dsw.util.ClassUtils;
 import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
 import org.apache.cxf.dosgi.dsw.util.Utils;
@@ -69,13 +68,13 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin {
 
     private final BundleContext bctx;
     private final EventProducer eventProducer;
-    private final ConfigTypeHandlerFactory configTypeHandlerFactory;
+    private final ConfigTypeHandlerFinder configTypeHandlerFinder;
     private final ServiceListener exportedServiceListener;
 
-    public RemoteServiceAdminCore(BundleContext bc, ConfigTypeHandlerFactory configTypeHandlerFactory) {
+    public RemoteServiceAdminCore(BundleContext bc, ConfigTypeHandlerFinder configTypeHandlerFinder) {
         this.bctx = bc;
         this.eventProducer = new EventProducer(bctx);
-        this.configTypeHandlerFactory = configTypeHandlerFactory;
+        this.configTypeHandlerFinder = configTypeHandlerFinder;
         // listen for exported services being unregistered so we can close the export
         this.exportedServiceListener = new ServiceListener() {
             public void serviceChanged(ServiceEvent event) {
@@ -157,11 +156,11 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin {
     }
 
     private List<ExportRegistration> exportInterfaces(List<String> interfaces,
-            ServiceReference serviceReference, Map<String, Object> serviceProperties) {
+            ServiceReference<?> serviceReference, Map<String, Object> serviceProperties) {
         LOG.info("interfaces selected for export: " + interfaces);
         ConfigurationTypeHandler handler;
         try {
-            handler = configTypeHandlerFactory.getHandler(bctx, serviceProperties);
+            handler = findHandler(serviceProperties);
         } catch (RuntimeException e) {
             LOG.error(e.getMessage(), e);
             return Collections.emptyList();
@@ -287,7 +286,7 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin {
         return copy;
     }
 
-    private boolean isCreatedByThisRSA(ServiceReference sref) {
+    private boolean isCreatedByThisRSA(ServiceReference<?> sref) {
         return bctx.getBundle().equals(sref.getBundle()); // sref bundle can be null
     }
 
@@ -335,22 +334,14 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin {
                 return ir;
             }
 
-            ConfigurationTypeHandler handler;
-            try {
-                handler = configTypeHandlerFactory.getHandler(bctx, endpoint);
-            } catch (RuntimeException e) {
-                LOG.error("no handler found: " + e.getMessage(), e);
-                return null;
-            }
-
-            LOG.debug("Handler: {}", handler);
+            ConfigurationTypeHandler handler = findHandler(endpoint);
 
             // TODO: somehow select the interfaces that should be imported ---> job of the TopologyManager?
             List<String> matchingInterfaces = endpoint.getInterfaces();
 
             LOG.info("Matching Interfaces for import: " + matchingInterfaces);
 
-            if (matchingInterfaces.size() == 1) {
+            if (handler != null && matchingInterfaces.size() == 1) {
                 LOG.info("Proxifying interface: " + matchingInterfaces.get(0));
 
                 ImportRegistrationImpl imReg = new ImportRegistrationImpl(endpoint, this);
@@ -395,7 +386,7 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin {
 
             ClientServiceFactory csf = new ClientServiceFactory(actualContext, iClass, endpoint, handler, imReg);
             imReg.setClientServiceFactory(csf);
-            ServiceRegistration proxyReg = actualContext.registerService(interfaceName, csf, serviceProps);
+            ServiceRegistration<?> proxyReg = actualContext.registerService(interfaceName, csf, serviceProps);
             imReg.setImportedServiceRegistration(proxyReg);
         } catch (Exception ex) {
             // Only logging at debug level as this might be written to the log at the TopologyManager
@@ -410,7 +401,7 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin {
      *
      * @param sref the service whose exports should be removed and closed
      */
-    protected void removeServiceExports(ServiceReference sref) {
+    protected void removeServiceExports(ServiceReference<?> sref) {
         List<ExportRegistration> regs = new ArrayList<ExportRegistration>(1);
         synchronized (exportedServices) {
             for (Iterator<Collection<ExportRegistration>> it = exportedServices.values().iterator(); it.hasNext();) {
@@ -512,4 +503,17 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin {
         removeImportRegistrations();
         bctx.removeServiceListener(exportedServiceListener);
     }
+    
+    private ConfigurationTypeHandler findHandler(EndpointDescription endpoint) {
+        try {
+            return configTypeHandlerFinder.getHandler(bctx, endpoint);
+        } catch (RuntimeException e) {
+            LOG.error("No handler found: " + e.getMessage(), e);
+            return null;
+        }
+    }
+
+    private ConfigurationTypeHandler findHandler(Map<String, Object> serviceProperties) {
+        return configTypeHandlerFinder.getHandler(bctx, serviceProperties);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java
index 11f91c9..968ff16 100644
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java
@@ -21,10 +21,11 @@ package org.apache.cxf.dosgi.dsw.service;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.ServiceFactory;
 import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class RemoteServiceadminFactory implements ServiceFactory {
+public class RemoteServiceadminFactory implements ServiceFactory<RemoteServiceAdmin> {
 
     private static final Logger LOG = LoggerFactory.getLogger(RemoteServiceadminFactory.class);
 
@@ -35,13 +36,14 @@ public class RemoteServiceadminFactory implements ServiceFactory {
         this.rsaCore = rsaCore;
     }
 
-    public synchronized Object getService(Bundle b, ServiceRegistration sreg) {
+    public synchronized RemoteServiceAdmin getService(Bundle b, ServiceRegistration<RemoteServiceAdmin> sreg) {
         LOG.debug("new RemoteServiceAdmin ServiceInstance created for Bundle {}", b.getSymbolicName());
         instances++;
         return new RemoteServiceAdminInstance(b.getBundleContext(), rsaCore);
     }
 
-    public synchronized void ungetService(Bundle b, ServiceRegistration sreg, Object serviceObject) {
+    public synchronized void ungetService(Bundle b, ServiceRegistration<RemoteServiceAdmin> sreg,
+                                          RemoteServiceAdmin serviceObject) {
         LOG.debug("RemoteServiceAdmin ServiceInstance removed for Bundle {}", b.getSymbolicName());
         instances--;
         ((RemoteServiceAdminInstance)serviceObject).close(instances == 0);

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java
index 9f4216d..61f2e1e 100644
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java
@@ -35,6 +35,7 @@ import org.osgi.service.remoteserviceadmin.EndpointPermission;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@SuppressWarnings("deprecation")
 public final class OsgiUtils {
 
     public static final Logger LOG = LoggerFactory.getLogger(OsgiUtils.class);
@@ -92,9 +93,9 @@ public final class OsgiUtils {
      *         occurred during the retrieval
      */
     public static String getVersion(Class<?> iClass, BundleContext bc) {
-        ServiceReference paRef = bc.getServiceReference(PackageAdmin.class.getName());
+        ServiceReference<PackageAdmin> paRef = bc.getServiceReference(PackageAdmin.class);
         if (paRef != null) {
-            PackageAdmin pa = (PackageAdmin)bc.getService(paRef);
+            PackageAdmin pa = bc.getService(paRef);
             try {
                 Bundle b = pa.getBundle(iClass);
                 if (b == null) {
@@ -105,7 +106,7 @@ public final class OsgiUtils {
                 LOG.debug("Interface source bundle: {}", b.getSymbolicName());
 
                 ExportedPackage[] ep = pa.getExportedPackages(b);
-                LOG.debug("Exported Packages of the source bundle: {}", ep);
+                LOG.debug("Exported Packages of the source bundle: {}", (Object)ep);
 
                 String pack = iClass.getPackage().getName();
                 LOG.debug("Looking for Package: {}", pack);
@@ -177,7 +178,7 @@ public final class OsgiUtils {
      * @param serviceReference a service reference
      * @return the service's properties as a map
      */
-    public static Map<String, Object> getProperties(ServiceReference serviceReference) {
+    public static Map<String, Object> getProperties(ServiceReference<?> serviceReference) {
         String[] keys = serviceReference.getPropertyKeys();
         Map<String, Object> props = new HashMap<String, Object>(keys.length);
         for (String key : keys) {

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java
index b770b89..5c59a55 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java
@@ -24,11 +24,11 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
-import junit.framework.Assert;
 import junit.framework.TestCase;
 
 import org.easymock.EasyMock;
 import org.easymock.IAnswer;
+import org.junit.Assert;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
@@ -41,6 +41,7 @@ public class ServiceDecoratorImplTest extends TestCase {
     private static final URL RES_SD0 = getResource("/test-resources/sd0.xml");
     private static final URL RES_SD_1 = getResource("/test-resources/sd-1.xml");
 
+    @SuppressWarnings("rawtypes")
     public void testAddRemoveDecorations() {
         final Map<String, Object> serviceProps = new HashMap<String, Object>();
         serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.acme.foo.Bar"});
@@ -149,6 +150,7 @@ public class ServiceDecoratorImplTest extends TestCase {
         assertEquals(expected, actual);
     }
 
+    @SuppressWarnings("rawtypes")
     private Map<String, Object> testDecorate(final Map<String, Object> serviceProps, URL ... resources) {
         Bundle b = createBundleContaining(resources);
 

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClientServiceFactoryTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClientServiceFactoryTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClientServiceFactoryTest.java
index 315c55b..7d07227 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClientServiceFactoryTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClientServiceFactoryTest.java
@@ -23,6 +23,7 @@ import java.util.Map;
 
 import junit.framework.TestCase;
 
+import org.apache.cxf.dosgi.dsw.api.ConfigurationTypeHandler;
 import org.apache.cxf.dosgi.dsw.service.ClientServiceFactory;
 import org.apache.cxf.dosgi.dsw.service.ImportRegistrationImpl;
 import org.easymock.EasyMock;
@@ -37,6 +38,7 @@ import org.osgi.service.remoteserviceadmin.RemoteConstants;
 
 public class ClientServiceFactoryTest extends TestCase {
 
+    @SuppressWarnings("rawtypes")
     public void testGetService() {
         Object myTestProxyObject = new Object();
 

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactoryTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactoryTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactoryTest.java
index a74b194..1508277 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactoryTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactoryTest.java
@@ -22,10 +22,12 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.cxf.dosgi.dsw.Constants;
+import org.apache.cxf.dosgi.dsw.api.ConfigurationTypeHandler;
 import org.apache.cxf.dosgi.dsw.qos.DefaultIntentMapFactory;
 import org.apache.cxf.dosgi.dsw.qos.IntentManager;
 import org.apache.cxf.dosgi.dsw.qos.IntentManagerImpl;
 import org.apache.cxf.dosgi.dsw.qos.IntentMap;
+import org.apache.cxf.dosgi.dsw.service.ConfigTypeHandlerFinder;
 import org.easymock.EasyMock;
 import org.junit.Test;
 import org.osgi.framework.BundleContext;
@@ -93,7 +95,7 @@ public class ConfigTypeHandlerFactoryTest {
         IntentMap intentMap = new IntentMap(new DefaultIntentMapFactory().create());
         IntentManager intentManager = new IntentManagerImpl(intentMap);
         HttpServiceManager httpServiceManager = new HttpServiceManager(bc, null, null);
-        ConfigTypeHandlerFactory f = new ConfigTypeHandlerFactory(bc, intentManager, httpServiceManager);
+        ConfigTypeHandlerFinder f = new ConfigTypeHandlerFactory(bc, intentManager, httpServiceManager);
         return f.getHandler(bc, serviceProps);
     }
 
@@ -106,7 +108,7 @@ public class ConfigTypeHandlerFactoryTest {
         IntentMap intentMap = new IntentMap(new DefaultIntentMapFactory().create());
         IntentManager intentManager = new IntentManagerImpl(intentMap);
         HttpServiceManager httpServiceManager = new HttpServiceManager(bc, null, null);
-        ConfigTypeHandlerFactory f = new ConfigTypeHandlerFactory(bc, intentManager, httpServiceManager);
+        ConfigTypeHandlerFinder f = new ConfigTypeHandlerFactory(bc, intentManager, httpServiceManager);
         return f.getHandler(bc, serviceProps);
     }
 }

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java
index 9a75654..a792bd6 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java
@@ -25,7 +25,6 @@ import javax.servlet.ServletConfig;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 
-import junit.framework.Assert;
 import junit.framework.TestCase;
 
 import org.apache.cxf.Bus;
@@ -33,6 +32,7 @@ import org.apache.cxf.BusFactory;
 import org.easymock.Capture;
 import org.easymock.EasyMock;
 import org.easymock.IMocksControl;
+import org.junit.Assert;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Filter;
 import org.osgi.framework.ServiceEvent;
@@ -68,7 +68,7 @@ public class HttpServiceManagerTest extends TestCase {
         BundleContext dswContext = c.createMock(BundleContext.class);
         Filter filter = c.createMock(Filter.class);
         expect(dswContext.createFilter(EasyMock.eq("(service.id=12345)"))).andReturn(filter).once();
-        Capture<ServiceListener> captured = new Capture<ServiceListener>();
+        Capture<ServiceListener> captured = EasyMock.newCapture();
         dswContext.addServiceListener(EasyMock.capture(captured), EasyMock.<String>anyObject());
         expectLastCall().atLeastOnce();
         expect(dswContext.getProperty("org.apache.cxf.httpservice.requirefilter")).andReturn(null).atLeastOnce();
@@ -77,7 +77,7 @@ public class HttpServiceManagerTest extends TestCase {
         ServletContext servletContext = c.createMock(ServletContext.class);
         expect(config.getServletContext()).andReturn(servletContext);
         final HttpService httpService = new DummyHttpService(config);
-        ServiceReference sr = c.createMock(ServiceReference.class);
+        ServiceReference<?> sr = c.createMock(ServiceReference.class);
         expect(sr.getProperty(EasyMock.eq("service.id"))).andReturn(12345L).atLeastOnce();
         expect(servletContext.getResourceAsStream((String)EasyMock.anyObject())).andReturn(null).anyTimes();
         c.replay();

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtilsTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtilsTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtilsTest.java
index b0976af..6c8e35a 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtilsTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtilsTest.java
@@ -61,6 +61,7 @@ public class JaxRSUtilsTest extends TestCase {
         assertEquals(AegisElementProvider.class.getName(), providers.get(0).getClass().getName());
     }
 
+    @SuppressWarnings("rawtypes")
     public void testServiceProviders() {
         Map<String, Object> props = new HashMap<String, Object>();
         props.put(Constants.RS_PROVIDER_PROP_KEY, new Object[] {
@@ -125,6 +126,9 @@ public class JaxRSUtilsTest extends TestCase {
         assertEquals(JAXBElementProvider.class.getName(), providers.get(1).getClass().getName());
     }
 
+    @SuppressWarnings({
+     "rawtypes", "unchecked"
+    })
     public void testCustomGlobalProvider() throws Exception {
         ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
         BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
@@ -144,6 +148,9 @@ public class JaxRSUtilsTest extends TestCase {
         assertSame(p, providers.get(0));
     }
 
+    @SuppressWarnings({
+     "rawtypes", "unchecked"
+    })
     public void testNoCustomGlobalProvider() throws Exception {
         ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
         BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
@@ -163,6 +170,9 @@ public class JaxRSUtilsTest extends TestCase {
         assertEquals(0, providers.size());
     }
 
+    @SuppressWarnings({
+     "rawtypes", "unchecked"
+    })
     public void testCustomGlobalProviderExpected() throws Exception {
         ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
         BundleContext bc = EasyMock.createNiceMock(BundleContext.class);

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java
index fe49b8d..2c97b86 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.cxf.dosgi.dsw.handlers;
 
+import java.io.Closeable;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
@@ -25,10 +26,10 @@ import java.util.Map;
 
 import javax.xml.namespace.QName;
 
-import junit.framework.Assert;
 import junit.framework.TestCase;
 
 import org.apache.cxf.dosgi.dsw.Constants;
+import org.apache.cxf.dosgi.dsw.api.ExportResult;
 import org.apache.cxf.dosgi.dsw.handlers.jaxws.MyJaxWsEchoService;
 import org.apache.cxf.dosgi.dsw.handlers.jaxws.MyJaxWsEchoServiceImpl;
 import org.apache.cxf.dosgi.dsw.handlers.simple.MySimpleEchoService;
@@ -48,9 +49,10 @@ import org.apache.cxf.transport.Destination;
 import org.apache.cxf.ws.addressing.AttributedURIType;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean;
+import org.easymock.EasyMock;
 import org.easymock.IAnswer;
-import org.easymock.classextension.EasyMock;
-import org.easymock.classextension.IMocksControl;
+import org.easymock.IMocksControl;
+import org.junit.Assert;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.remoteserviceadmin.EndpointDescription;
@@ -226,7 +228,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
             @Override
             protected ExportResult createServerFromFactory(ServerFactoryBean factory,
                                                            Map<String, Object> endpointProps) {
-                return new ExportResult(endpointProps, (Server) null);
+                return new ExportResult(endpointProps, (Closeable) null);
             }
         };
 
@@ -374,8 +376,8 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
         ExportResult exportResult = handler.createServer(sref, dswBC, null, sd, MyJaxWsEchoService.class, serviceBean);
         c.verify();
 
-        Server server = exportResult.getServer();
-        Endpoint ep = server.getEndpoint();
+        ServerWrapper serverWrapper = (ServerWrapper)exportResult.getServer();
+        Endpoint ep = serverWrapper.getServer().getEndpoint();
         QName bindingName = ep.getEndpointInfo().getBinding().getName();
         Assert.assertEquals(JaxWsEndpointImpl.class, ep.getClass());
         Assert.assertEquals(new QName("http://jaxws.handlers.dsw.dosgi.cxf.apache.org/",
@@ -396,10 +398,10 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
 
         c.replay();
         ExportResult exportResult = handler.createServer(sref, dswBC, null, sd, MySimpleEchoService.class, serviceBean);
-        Server server = exportResult.getServer();
+        ServerWrapper serverWrapper = (ServerWrapper)exportResult.getServer();
         c.verify();
 
-        Endpoint ep = server.getEndpoint();
+        Endpoint ep = serverWrapper.getServer().getEndpoint();
         QName bindingName = ep.getEndpointInfo().getBinding().getName();
         Assert.assertEquals(EndpointImpl.class, ep.getClass());
         Assert.assertEquals(new QName("http://simple.handlers.dsw.dosgi.cxf.apache.org/",

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContextTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContextTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContextTest.java
index 22b3291..58b5f58 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContextTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContextTest.java
@@ -38,6 +38,9 @@ import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.http.HttpContext;
 
+@SuppressWarnings({
+    "unchecked", "rawtypes"
+   })
 public class SecurityDelegatingHttpContextTest extends TestCase {
 
     protected HttpContext defaultHttpContext;

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java
index d7dad6f..9057e46 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java
@@ -26,14 +26,14 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import junit.framework.Assert;
-
 import org.apache.cxf.binding.BindingConfiguration;
+import org.apache.cxf.dosgi.dsw.api.IntentUnsatisfiedException;
 import org.apache.cxf.endpoint.AbstractEndpointFactory;
 import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.feature.Feature;
-import org.easymock.classextension.EasyMock;
-import org.easymock.classextension.IMocksControl;
+import org.easymock.EasyMock;
+import org.easymock.IMocksControl;
+import org.junit.Assert;
 import org.junit.Test;
 
 public class IntentManagerImplTest extends Assert {

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentMapTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentMapTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentMapTest.java
index aaa3f0e..748da85 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentMapTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentMapTest.java
@@ -21,8 +21,7 @@ package org.apache.cxf.dosgi.dsw.qos;
 import java.util.HashMap;
 import java.util.Map;
 
-import junit.framework.Assert;
-
+import org.junit.Assert;
 import org.junit.Test;
 
 public class IntentMapTest {

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentTrackerTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentTrackerTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentTrackerTest.java
index 74ecd21..b68cf61 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentTrackerTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentTrackerTest.java
@@ -18,13 +18,12 @@
  */
 package org.apache.cxf.dosgi.dsw.qos;
 
-import junit.framework.Assert;
-
 import org.apache.cxf.dosgi.dsw.Constants;
 import org.apache.cxf.feature.AbstractFeature;
 import org.easymock.Capture;
-import org.easymock.classextension.EasyMock;
-import org.easymock.classextension.IMocksControl;
+import org.easymock.EasyMock;
+import org.easymock.IMocksControl;
+import org.junit.Assert;
 import org.junit.Test;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Filter;
@@ -45,7 +44,7 @@ public class IntentTrackerTest {
         BundleContext bc = c.createMock(BundleContext.class);
         Filter filter = c.createMock(Filter.class);
         expect(bc.createFilter(EasyMock.<String>anyObject())).andReturn(filter);
-        final Capture<ServiceListener> capturedListener = new Capture<ServiceListener>();
+        final Capture<ServiceListener> capturedListener = EasyMock.newCapture();
         bc.addServiceListener(EasyMock.capture(capturedListener), EasyMock.<String>anyObject());
         EasyMock.expectLastCall().atLeastOnce();
         expect(bc.getServiceReferences(EasyMock.<String>anyObject(),

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/EventProducerTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/EventProducerTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/EventProducerTest.java
index d1c21e8..eba5400 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/EventProducerTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/EventProducerTest.java
@@ -18,15 +18,15 @@
  */
 package org.apache.cxf.dosgi.dsw.service;
 
+import java.io.Closeable;
 import java.util.Arrays;
 import java.util.Dictionary;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.UUID;
 
-import org.apache.cxf.endpoint.Server;
+import org.easymock.EasyMock;
 import org.easymock.IAnswer;
-import org.easymock.classextension.EasyMock;
 import org.junit.Assert;
 import org.junit.Test;
 import org.osgi.framework.Bundle;
@@ -114,7 +114,8 @@ public class EventProducerTest {
         EasyMock.replay(bc);
         EventProducer eventProducer = new EventProducer(bc);
 
-        ExportRegistrationImpl ereg = new ExportRegistrationImpl(sref, endpoint, remoteServiceAdminCore, (Server)null);
+        ExportRegistrationImpl ereg = new ExportRegistrationImpl(sref, endpoint, remoteServiceAdminCore, 
+                                                                 (Closeable)null);
         eventProducer.publishNotification(ereg);
     }
 

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java
index 95dfe9a..21d76cd 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java
@@ -18,8 +18,8 @@
  */
 package org.apache.cxf.dosgi.dsw.service;
 
+import org.easymock.EasyMock;
 import org.easymock.IMocksControl;
-import org.easymock.classextension.EasyMock;
 import org.junit.Test;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
index dcc6002..f714eca 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.cxf.dosgi.dsw.service;
 
+import java.io.Closeable;
 import java.lang.reflect.Field;
 import java.util.Arrays;
 import java.util.Collection;
@@ -27,18 +28,17 @@ import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.cxf.dosgi.dsw.api.ConfigurationTypeHandler;
+import org.apache.cxf.dosgi.dsw.api.ExportResult;
 import org.apache.cxf.dosgi.dsw.handlers.ConfigTypeHandlerFactory;
-import org.apache.cxf.dosgi.dsw.handlers.ConfigurationTypeHandler;
-import org.apache.cxf.dosgi.dsw.handlers.ExportResult;
 import org.apache.cxf.dosgi.dsw.handlers.HttpServiceManager;
 import org.apache.cxf.dosgi.dsw.qos.DefaultIntentMapFactory;
 import org.apache.cxf.dosgi.dsw.qos.IntentManager;
 import org.apache.cxf.dosgi.dsw.qos.IntentManagerImpl;
 import org.apache.cxf.dosgi.dsw.qos.IntentMap;
-import org.apache.cxf.endpoint.Server;
+import org.easymock.EasyMock;
 import org.easymock.IAnswer;
 import org.easymock.IMocksControl;
-import org.easymock.classextension.EasyMock;
 import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -82,7 +82,7 @@ public class RemoteServiceAdminCoreTest {
         EasyMock.expect(sref.getProperty("objectClass")).andReturn(new String[] {"a.b.C"}).anyTimes();
         EasyMock.expect(sref.getProperty("service.exported.interfaces")).andReturn("*").anyTimes();
 
-        ConfigTypeHandlerFactory configTypeHandlerFactory = c.createMock(ConfigTypeHandlerFactory.class);
+        ConfigTypeHandlerFinder configTypeHandlerFactory = c.createMock(ConfigTypeHandlerFactory.class);
 
         c.replay();
 
@@ -122,7 +122,7 @@ public class RemoteServiceAdminCoreTest {
         IntentMap intentMap = new IntentMap(new DefaultIntentMapFactory().create());
         IntentManager intentManager = new IntentManagerImpl(intentMap, 10000);
         HttpServiceManager httpServiceManager = c.createMock(HttpServiceManager.class);
-        ConfigTypeHandlerFactory configTypeHandlerFactory
+        ConfigTypeHandlerFinder configTypeHandlerFactory
             = new ConfigTypeHandlerFactory(bc, intentManager, httpServiceManager);
 
         c.replay();
@@ -205,7 +205,7 @@ public class RemoteServiceAdminCoreTest {
         Map<String, Object> eProps = new HashMap<String, Object>(sProps);
         eProps.put("endpoint.id", "http://something");
         eProps.put("service.imported.configs", new String[] {"org.apache.cxf.ws"});
-        ExportResult er = new ExportResult(eProps, (Server) null);
+        ExportResult er = new ExportResult(eProps, (Closeable) null);
 
         ConfigurationTypeHandler handler = EasyMock.createNiceMock(ConfigurationTypeHandler.class);
         EasyMock.expect(handler.createServer(sref,
@@ -214,7 +214,7 @@ public class RemoteServiceAdminCoreTest {
                                              sProps, Runnable.class, svcObject)).andReturn(er).once();
         EasyMock.replay(handler);
 
-        ConfigTypeHandlerFactory handlerFactory = EasyMock.createNiceMock(ConfigTypeHandlerFactory.class);
+        ConfigTypeHandlerFinder handlerFactory = EasyMock.createNiceMock(ConfigTypeHandlerFactory.class);
         EasyMock.expect(handlerFactory.getHandler(bc, sProps))
             .andReturn(handler).once(); // Second time shouldn't get there because it should simply copy
         EasyMock.replay(handlerFactory);
@@ -311,7 +311,7 @@ public class RemoteServiceAdminCoreTest {
                                              sProps, Runnable.class, svcObject)).andReturn(er);
         EasyMock.replay(handler);
 
-        ConfigTypeHandlerFactory handlerFactory = EasyMock.createNiceMock(ConfigTypeHandlerFactory.class);
+        ConfigTypeHandlerFinder handlerFactory = EasyMock.createNiceMock(ConfigTypeHandlerFactory.class);
         EasyMock.expect(handlerFactory.getHandler(bc, sProps)).andReturn(handler).anyTimes();
         EasyMock.replay(handlerFactory);
         RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, handlerFactory);

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/ClassUtilsTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/ClassUtilsTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/ClassUtilsTest.java
index e920d75..96ffd82 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/ClassUtilsTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/ClassUtilsTest.java
@@ -28,7 +28,7 @@ import java.util.Map;
 
 import junit.framework.TestCase;
 
-import org.easymock.classextension.EasyMock;
+import org.easymock.EasyMock;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a93346ed/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/OsgiUtilsTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/OsgiUtilsTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/OsgiUtilsTest.java
index bc03696..c45f7b2 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/OsgiUtilsTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/OsgiUtilsTest.java
@@ -39,6 +39,7 @@ import org.osgi.service.packageadmin.PackageAdmin;
 import org.osgi.service.remoteserviceadmin.EndpointDescription;
 import org.osgi.service.remoteserviceadmin.RemoteConstants;
 
+@SuppressWarnings("deprecation")
 public class OsgiUtilsTest extends TestCase {
 
     public void testMultiValuePropertyAsString() {
@@ -75,6 +76,9 @@ public class OsgiUtilsTest extends TestCase {
         EasyMock.verify(bc);
     }
 
+    @SuppressWarnings({
+     "rawtypes", "unchecked"
+    })
     public void testGetVersion() {
         IMocksControl c = EasyMock.createNiceControl();
         BundleContext bc = c.createMock(BundleContext.class);
@@ -82,7 +86,7 @@ public class OsgiUtilsTest extends TestCase {
         PackageAdmin pa = c.createMock(PackageAdmin.class);
         Bundle b = c.createMock(Bundle.class);
 
-        EasyMock.expect(bc.getServiceReference(EasyMock.eq(PackageAdmin.class.getName()))).andReturn(sref);
+        EasyMock.expect(bc.getServiceReference(EasyMock.eq(PackageAdmin.class))).andReturn(sref);
         EasyMock.expect(bc.getService(EasyMock.eq(sref))).andReturn(pa);
 
         Class<?> iClass = CharSequence.class;
@@ -96,7 +100,7 @@ public class OsgiUtilsTest extends TestCase {
         c.reset();
         // version 1.2.3
 
-        EasyMock.expect(bc.getServiceReference(EasyMock.eq(PackageAdmin.class.getName()))).andReturn(sref);
+        EasyMock.expect(bc.getServiceReference(EasyMock.eq(PackageAdmin.class))).andReturn(sref);
         EasyMock.expect(bc.getService(EasyMock.eq(sref))).andReturn(pa);
         EasyMock.expect(pa.getBundle(EasyMock.eq(iClass))).andReturn(b);