[DOSGI-229] Refactor api and fix some issues
diff --git a/dsw/cxf-dsw/pom.xml b/dsw/cxf-dsw/pom.xml
index 52727ae..3693a23 100644
--- a/dsw/cxf-dsw/pom.xml
+++ b/dsw/cxf-dsw/pom.xml
@@ -97,6 +97,11 @@
             <artifactId>easymockclassextension</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-jdk14</artifactId>
+            <version>1.7.14</version>
+        </dependency>
     </dependencies>
 
     <build>
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
deleted file mode 100644
index fb42606..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/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.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;
-}
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/DistributionProvider.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/DistributionProvider.java
new file mode 100644
index 0000000..a16f2bd
--- /dev/null
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/DistributionProvider.java
@@ -0,0 +1,52 @@
+/**
+ * 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.ServiceReference;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+
+public interface DistributionProvider {
+
+    String[] getSupportedTypes();
+
+    /**
+     * 
+     * @param sref reference of the service to be exported
+     * @param effectiveProperties combined properties of the service and additional properties from rsa
+     * @param exportedInterface name of the interface to be exported
+     * @return
+     */
+    Endpoint createServer(ServiceReference<?> sref,
+                          Map<String, Object> effectiveProperties,
+                          String exportedInterface);
+
+    /**
+     * 
+     * @param sref reference of the service offered to the requesting bundle
+     * @param iClass
+     * @param endpoint description of the remote endpoint
+     * @return service proxy to be given to the requesting bundle
+     * @throws IntentUnsatisfiedException
+     */
+    Object createProxy(ServiceReference<?> sref,
+                       Class<?> iClass, 
+                       EndpointDescription endpoint) throws IntentUnsatisfiedException;
+}
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/Endpoint.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/Endpoint.java
new file mode 100644
index 0000000..f45b562
--- /dev/null
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/Endpoint.java
@@ -0,0 +1,27 @@
+/**
+ * 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 org.osgi.service.remoteserviceadmin.EndpointDescription;
+
+public interface Endpoint extends Closeable {
+    EndpointDescription description();
+}
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
deleted file mode 100644
index 86acf8c..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/ExportResult.java
+++ /dev/null
@@ -1,53 +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.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;
-    }
-}
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParser.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParser.java
index c7a8f96..82753b1 100644
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParser.java
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParser.java
@@ -18,6 +18,7 @@
  */
 package org.apache.cxf.dosgi.dsw.decorator;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
 import java.util.ArrayList;
@@ -28,19 +29,17 @@
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Unmarshaller;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
 import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
 
-import org.xml.sax.SAXException;
 import org.apache.cxf.xmlns.service_decoration._1_0.ServiceDecorationType;
 import org.apache.cxf.xmlns.service_decoration._1_0.ServiceDecorationsType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 class DecorationParser {
-    private static final Logger LOG = LoggerFactory.getLogger(ServiceDecoratorImpl.class);
     private JAXBContext jaxbContext;
     private Schema schema;
 
@@ -51,29 +50,36 @@
             SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
             URL resource = getClass().getResource("/service-decoration.xsd");
             schema = schemaFactory.newSchema(resource);
-        } catch (JAXBException e) {
-            throw new RuntimeException(e.getMessage(), e);
-        } catch (SAXException e) {
+        } catch (Exception e) {
             throw new RuntimeException("Error loading decorations schema", e);
         }
 
     }
 
-    List<ServiceDecorationType> getDecorations(URL resourceURL) {
-        if (resourceURL == null) {
+    List<ServiceDecorationType> getDecorations(URL resourceURL) throws JAXBException, IOException {
+        if (resourceURL == null || !decorationType(resourceURL)) {
             return new ArrayList<ServiceDecorationType>();
         }
+        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+        unmarshaller.setSchema(schema);
+        InputStream is = resourceURL.openStream();
+        Source source = new StreamSource(is);
+        JAXBElement<ServiceDecorationsType> jaxb = unmarshaller.unmarshal(source, ServiceDecorationsType.class);
+        ServiceDecorationsType decorations = jaxb.getValue();
+        return decorations.getServiceDecoration();
+    }
+
+    private boolean decorationType(URL resourceURL) {
         try {
-            Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
-            unmarshaller.setSchema(schema);
             InputStream is = resourceURL.openStream();
-            Source source = new StreamSource(is);
-            JAXBElement<ServiceDecorationsType> jaxb = unmarshaller.unmarshal(source, ServiceDecorationsType.class);
-            ServiceDecorationsType decorations = jaxb.getValue();
-            return decorations.getServiceDecoration();
-        } catch (Exception ex) {
-            LOG.warn("Problem parsing: " + resourceURL, ex);
-            return new ArrayList<ServiceDecorationType>();
+            XMLInputFactory factory = XMLInputFactory.newInstance();
+            XMLStreamReader reader = factory.createXMLStreamReader(is);
+            reader.next();
+            String ns = reader.getNamespaceURI();
+            reader.close();
+            return ns.equals("http://cxf.apache.org/xmlns/service-decoration/1.0.0");
+        } catch (Exception e) {
+            return false;
         }
     }
 }
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImpl.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImpl.java
index cc8a2dc..20130c3 100644
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImpl.java
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImpl.java
@@ -32,8 +32,11 @@
 import org.apache.cxf.xmlns.service_decoration._1_0.ServiceDecorationType;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class ServiceDecoratorImpl implements ServiceDecorator {
+    private static final Logger LOG = LoggerFactory.getLogger(ServiceDecoratorImpl.class);
     final List<Rule> decorations = new CopyOnWriteArrayList<Rule>();
 
     private DecorationParser parser;
@@ -75,7 +78,11 @@
         }
         List<ServiceDecorationType> elements = new ArrayList<ServiceDecorationType>();
         while (entries.hasMoreElements()) {
-            elements.addAll(parser.getDecorations((URL)entries.nextElement()));
+            try {
+                elements.addAll(parser.getDecorations((URL)entries.nextElement()));
+            } catch (Exception e) {
+                LOG.warn("Error parsing remote-service descriptions in bundle" + bundle.getSymbolicName(), e);
+            }
         }
         return elements;
     }
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 7992062..b1dffff 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,8 +31,8 @@
 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.api.DistributionProvider;
+import org.apache.cxf.dosgi.dsw.api.Endpoint;
 import org.apache.cxf.dosgi.dsw.qos.IntentManager;
 import org.apache.cxf.dosgi.dsw.qos.IntentUtils;
 import org.apache.cxf.dosgi.dsw.util.ClassUtils;
@@ -47,11 +47,12 @@
 import org.apache.cxf.interceptor.Interceptor;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
 import org.osgi.service.remoteserviceadmin.RemoteConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public abstract class AbstractPojoConfigurationTypeHandler implements ConfigurationTypeHandler {
+public abstract class AbstractPojoConfigurationTypeHandler implements DistributionProvider {
 
     private static final Logger LOG = LoggerFactory.getLogger(AbstractPojoConfigurationTypeHandler.class);
     protected BundleContext bundleContext;
@@ -206,14 +207,13 @@
         return bus;
     }
 
-    protected ExportResult createServerFromFactory(ServerFactoryBean factory, Map<String, Object> endpointProps) {
+    protected Endpoint createServerFromFactory(ServerFactoryBean factory, Map<String, Object> endpointProps) {
         ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
         try {
             Thread.currentThread().setContextClassLoader(ServerFactoryBean.class.getClassLoader());
             Server server = factory.create();
-            return new ExportResult(endpointProps, new ServerWrapper(server));
-        } catch (Exception e) {
-            return new ExportResult(endpointProps, e);
+            EndpointDescription epd = new EndpointDescription(endpointProps);
+            return new ServerWrapper(epd, server);
         } finally {
             Thread.currentThread().setContextClassLoader(oldClassLoader);
         }
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 8c0a881..5d92eeb 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,7 @@
 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.api.DistributionProvider;
 import org.apache.cxf.dosgi.dsw.qos.IntentManager;
 import org.apache.cxf.dosgi.dsw.service.ConfigTypeHandlerFinder;
 import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
@@ -65,19 +65,19 @@
     }
 
     @Override
-    public ConfigurationTypeHandler getHandler(BundleContext dswBC,
+    public DistributionProvider 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) {
+    public DistributionProvider getHandler(BundleContext dswBC, EndpointDescription endpoint) {
         List<String> configurationTypes = determineConfigTypesForImport(endpoint);
         return getHandler(dswBC, configurationTypes, endpoint.getProperties());
     }
 
-    private ConfigurationTypeHandler getHandler(BundleContext dswBC,
+    private DistributionProvider getHandler(BundleContext dswBC,
                                                List<String> configurationTypes,
                                                Map<String, Object> serviceProperties) {
         intentManager.assertAllIntentsSupported(serviceProperties);
@@ -89,7 +89,8 @@
         } else if (configurationTypes.contains(Constants.WSDL_CONFIG_TYPE)) {
             return wsdlConfigurationTypeHandler;
         }
-        throw new RuntimeException("None of the configuration types in " + configurationTypes + " is supported.");
+        LOG.info("None of the configuration types in " + configurationTypes + " is supported.");
+        return null;
     }
 
     private boolean isJaxrsRequested(Collection<String> types, Map<String, Object> serviceProperties) {
@@ -138,20 +139,13 @@
                 configurationTypes.add(rct);
             }
         }
-        LOG.info("configuration types selected for export: " + configurationTypes);
-        if (configurationTypes.isEmpty()) {
-            throw new RuntimeException("the requested configuration types are not supported");
-        }
+        LOG.info("Configuration types selected for export: {}.", configurationTypes);
         return configurationTypes;
     }
 
     private List<String> determineConfigTypesForImport(EndpointDescription endpoint) {
         List<String> remoteConfigurationTypes = endpoint.getConfigurationTypes();
 
-        if (remoteConfigurationTypes == null) {
-            throw new RuntimeException("The supplied endpoint has no configuration type");
-        }
-
         List<String> usableConfigurationTypes = new ArrayList<String>();
         for (String ct : supportedConfigurationTypes) {
             if (remoteConfigurationTypes.contains(ct)) {
@@ -159,11 +153,8 @@
             }
         }
 
-        if (usableConfigurationTypes.isEmpty()) {
-            throw new RuntimeException("The supplied endpoint has no compatible configuration type. "
-                    + "Supported types are: " + supportedConfigurationTypes
-                    + "    Types needed by the endpoint: " + remoteConfigurationTypes);
-        }
+        LOG.info("Ignoring endpoint {} as it has no compatible configuration types: {}.", 
+                 endpoint.getId(), remoteConfigurationTypes);
         return usableConfigurationTypes;
     }
 
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 bf15c1c..7fc5956 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,9 +25,10 @@
 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.Endpoint;
 import org.apache.cxf.dosgi.dsw.api.IntentUnsatisfiedException;
 import org.apache.cxf.dosgi.dsw.qos.IntentManager;
+import org.apache.cxf.dosgi.dsw.util.ClassUtils;
 import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
@@ -55,18 +56,18 @@
         return new String[] {Constants.RS_CONFIG_TYPE};
     }
 
-    public Object createProxy(ServiceReference<?> serviceReference, BundleContext dswContext,
-                              BundleContext callingContext, Class<?> iClass,
-                              EndpointDescription endpoint) throws IntentUnsatisfiedException {
+    public Object createProxy(ServiceReference<?> sref,
+                              Class<?> iClass,
+                              EndpointDescription endpoint) {
+        BundleContext callingContext = sref.getBundle().getBundleContext();
         String address = getPojoAddress(endpoint, iClass);
         if (address == null) {
             LOG.warn("Remote address is unavailable");
             return null;
         }
-
         ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
         try {
-            return createJaxrsProxy(address, callingContext, dswContext, iClass, null, endpoint);
+            return createJaxrsProxy(address, callingContext, iClass, null, endpoint);
         } catch (Throwable e) {
             Thread.currentThread().setContextClassLoader(oldClassLoader);
         }
@@ -74,7 +75,7 @@
         try {
             ProxyClassLoader cl = new ProxyClassLoader(iClass.getClassLoader());
             cl.addLoader(Client.class.getClassLoader());
-            return createJaxrsProxy(address, callingContext, dswContext, iClass, cl, endpoint);
+            return createJaxrsProxy(address, callingContext, iClass, cl, endpoint);
         } catch (Throwable e) {
             LOG.warn("proxy creation failed", e);
         }
@@ -83,7 +84,6 @@
     }
 
     protected Object createJaxrsProxy(String address,
-                                      BundleContext dswContext,
                                       BundleContext callingContext,
                                       Class<?> iClass,
                                       ClassLoader loader,
@@ -110,11 +110,12 @@
         return getProxy(bean.create(), iClass);
     }
 
-    public ExportResult createServer(ServiceReference<?> sref,
-                                     BundleContext dswContext,
-                                     BundleContext callingContext,
-                                     Map<String, Object> sd, Class<?> iClass,
-                                     Object serviceBean) throws IntentUnsatisfiedException {
+    public Endpoint createServer(ServiceReference<?> sref,
+                                     Map<String, Object> sd,
+                                     String exportedInterface) throws IntentUnsatisfiedException {
+        BundleContext callingContext = sref.getBundle().getBundleContext();
+        Object serviceBean = callingContext.getService(sref);
+        Class<?> iClass = ClassUtils.getInterfaceClass(serviceBean, exportedInterface);
         String contextRoot = getServletContextRoot(sd);
         String address;
         if (contextRoot == null) {
@@ -125,7 +126,6 @@
                 address = "/";
             }
         }
-
         Bus bus = createBus(sref, callingContext, contextRoot);
 
         LOG.info("Creating a " + iClass.getName()
@@ -141,15 +141,14 @@
         return createServerFromFactory(factory, endpointProps);
     }
 
-    private ExportResult createServerFromFactory(JAXRSServerFactoryBean factory,
+    private Endpoint createServerFromFactory(JAXRSServerFactoryBean factory,
                                                        Map<String, Object> endpointProps) {
         ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
         try {
             Thread.currentThread().setContextClassLoader(JAXRSServerFactoryBean.class.getClassLoader());
             Server server = factory.create();
-            return new ExportResult(endpointProps, new ServerWrapper(server));
-        } catch (Exception e) {
-            return new ExportResult(endpointProps, e);
+            EndpointDescription epd = new EndpointDescription(endpointProps);
+            return new ServerWrapper(epd, server);
         } finally {
             Thread.currentThread().setContextClassLoader(oldClassLoader);
         }
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 dcea099..f57fcf3 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,9 +26,10 @@
 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.Endpoint;
 import org.apache.cxf.dosgi.dsw.api.IntentUnsatisfiedException;
 import org.apache.cxf.dosgi.dsw.qos.IntentManager;
+import org.apache.cxf.dosgi.dsw.util.ClassUtils;
 import org.apache.cxf.frontend.ClientProxyFactoryBean;
 import org.apache.cxf.frontend.ServerFactoryBean;
 import org.apache.cxf.jaxb.JAXBDataBinding;
@@ -54,8 +55,9 @@
         return new String[] {Constants.WS_CONFIG_TYPE, Constants.WS_CONFIG_TYPE_OLD};
     }
 
-    public Object createProxy(ServiceReference<?> sref, BundleContext dswContext, BundleContext callingContext,
-                              Class<?> iClass, EndpointDescription endpoint) throws IntentUnsatisfiedException {
+    public Object createProxy(ServiceReference<?> sref,
+                              Class<?> iClass,
+                              EndpointDescription endpoint) throws IntentUnsatisfiedException {
         Map<String, Object> sd = endpoint.getProperties();
         String address = getClientAddress(sd);
         if (address == null) {
@@ -72,8 +74,9 @@
             factory.getServiceFactory().setDataBinding(getDataBinding(sd, iClass));
             factory.setServiceClass(iClass);
             factory.setAddress(address);
+            BundleContext callingContext = sref.getBundle().getBundleContext();
             addWsInterceptorsFeaturesProps(factory.getClientFactoryBean(), callingContext, sd);
-            setClientWsdlProperties(factory.getClientFactoryBean(), dswContext, sd, false);
+            setClientWsdlProperties(factory.getClientFactoryBean(), bundleContext, sd, false);
 
             intentManager.applyIntents(factory.getFeatures(), factory.getClientFactoryBean(), sd);
 
@@ -87,37 +90,35 @@
         return null;
     }
 
-    public ExportResult createServer(ServiceReference<?> sref,
-                                     BundleContext dswContext,
-                                     BundleContext callingContext,
+    public Endpoint createServer(ServiceReference<?> sref,
                                      Map<String, Object> sd,
-                                     Class<?> iClass,
-                                     Object serviceBean) throws IntentUnsatisfiedException {
-        try {
-            String address = getPojoAddress(sd, iClass);
-            ServerFactoryBean factory = createServerFactoryBean(sd, iClass);
-            factory.setDataBinding(getDataBinding(sd, iClass));
-            String contextRoot = getServletContextRoot(sd);
-            Bus bus = createBus(sref, callingContext, contextRoot);
-            factory.setBus(bus);
-            factory.setServiceClass(iClass);
-            factory.setAddress(address);
-            factory.setServiceBean(serviceBean);
-            addWsInterceptorsFeaturesProps(factory, callingContext, sd);
-            setWsdlProperties(factory, callingContext, sd, false);
-            String[] intents = intentManager.applyIntents(factory.getFeatures(), factory, sd);
+                                     String exportedInterface) throws IntentUnsatisfiedException {
+        BundleContext callingContext = sref.getBundle().getBundleContext();
+        Object serviceBean = callingContext.getService(sref);
+        Class<?> iClass = ClassUtils.getInterfaceClass(serviceBean, exportedInterface);
+        String address = getPojoAddress(sd, iClass);
+        ServerFactoryBean factory = createServerFactoryBean(sd, iClass);
+        factory.setDataBinding(getDataBinding(sd, iClass));
+        String contextRoot = getServletContextRoot(sd);
 
-            String completeEndpointAddress = httpServiceManager.getAbsoluteAddress(contextRoot, address);
+        Bus bus = createBus(sref, callingContext, contextRoot);
+        factory.setBus(bus);
+        factory.setServiceClass(iClass);
+        factory.setAddress(address);
+        
+        factory.setServiceBean(serviceBean);
+        addWsInterceptorsFeaturesProps(factory, callingContext, sd);
+        setWsdlProperties(factory, callingContext, sd, false);
+        String[] intents = intentManager.applyIntents(factory.getFeatures(), factory, sd);
+
+        String completeEndpointAddress = httpServiceManager.getAbsoluteAddress(contextRoot, address);
 
             // The properties for the EndpointDescription
-            Map<String, Object> endpointProps = createEndpointProps(sd, iClass,
+        Map<String, Object> endpointProps = createEndpointProps(sd, iClass,
                                                                     new String[]{Constants.WS_CONFIG_TYPE},
                                                                     completeEndpointAddress, intents);
 
-            return createServerFromFactory(factory, endpointProps);
-        } catch (RuntimeException re) {
-            return new ExportResult(sd, re);
-        }
+        return createServerFromFactory(factory, endpointProps);
     }
 
     private String getPojoAddress(Map<String, Object> sd, Class<?> iClass) {
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
index 1c85a4e..67bcc63 100644
--- 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
@@ -18,27 +18,32 @@
  */
 package org.apache.cxf.dosgi.dsw.handlers;
 
-import java.io.Closeable;
 import java.io.IOException;
 
+import org.apache.cxf.dosgi.dsw.api.Endpoint;
 import org.apache.cxf.endpoint.Server;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
 
-public class ServerWrapper implements Closeable {
+public class ServerWrapper implements Endpoint {
+    private EndpointDescription desc;
     private Server server;
 
-    public ServerWrapper(Server server) {
+    public ServerWrapper(EndpointDescription desc, Server server) {
+        this.desc = desc;
         this.server = server;
     }
     
     public Server getServer() {
-        return server;
+        return this.server;
     }
 
     @Override
     public void close() throws IOException {
-        server.stop();
-        server.destroy();
+        this.server.destroy();
     }
-    
-    
+
+    @Override
+    public EndpointDescription description() {
+        return this.desc;
+    }
 }
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 2c9e34f..3c5e80e 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,8 +29,9 @@
 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.api.Endpoint;
 import org.apache.cxf.dosgi.dsw.qos.IntentManager;
+import org.apache.cxf.dosgi.dsw.util.ClassUtils;
 import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
 import org.apache.cxf.jaxb.JAXBDataBinding;
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
@@ -55,8 +56,6 @@
     }
 
     public Object createProxy(ServiceReference<?> serviceReference,
-                              BundleContext dswContext,
-                              BundleContext callingContext,
                               Class<?> iClass,
                               EndpointDescription endpoint) {
         String wsdlAddressProp = getWsdlAddress(endpoint, iClass);
@@ -101,17 +100,17 @@
         return Service.create(wsdlAddress, serviceQname);
     }
 
-    public ExportResult createServer(ServiceReference<?> sref,
-                               BundleContext dswContext,
-                               BundleContext callingContext,
+    public Endpoint createServer(ServiceReference<?> sref,
                                Map<String, Object> sd,
-                               Class<?> iClass,
-                               Object serviceBean) {
+                               String exportedInterface) {
+        BundleContext callingContext = sref.getBundle().getBundleContext();
+        Object serviceBean = callingContext.getService(sref);
+        Class<?> iClass = ClassUtils.getInterfaceClass(serviceBean, exportedInterface);
         String location = OsgiUtils.getProperty(sd, Constants.WSDL_LOCATION);
         if (location == null) {
             throw new RuntimeException("WSDL location property is unavailable");
         }
-        URL wsdlURL = dswContext.getBundle().getResource(location);
+        URL wsdlURL = callingContext.getBundle().getResource(location);
         if (wsdlURL == null) {
             throw new RuntimeException("WSDL resource at " + location + " is unavailable");
         }
@@ -132,7 +131,7 @@
         factory.setServiceClass(iClass);
         factory.setAddress(address != null ? address : "/");
         factory.getServiceFactory().setDataBinding(databinding);
-        factory.setServiceBean(serviceBean);
+        factory.setServiceBean(callingContext.getService(sref));
 
         addWsInterceptorsFeaturesProps(factory, callingContext, sd);
 
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 c6c4ee0..df62627 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,10 +23,9 @@
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.cxf.dosgi.dsw.api.ConfigurationTypeHandler;
+import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
 import org.apache.cxf.dosgi.dsw.api.IntentUnsatisfiedException;
 import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceFactory;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.remoteserviceadmin.EndpointDescription;
@@ -38,19 +37,15 @@
 
     private static final Logger LOG = LoggerFactory.getLogger(ClientServiceFactory.class);
 
-    private BundleContext dswContext;
-    private Class<?> iClass;
     private EndpointDescription endpoint;
-    private ConfigurationTypeHandler handler;
+    private DistributionProvider handler;
     private ImportRegistrationImpl importRegistration;
 
     private boolean closeable;
     private int serviceCounter;
 
-    public ClientServiceFactory(BundleContext dswContext, Class<?> iClass, EndpointDescription endpoint,
-                                ConfigurationTypeHandler handler, ImportRegistrationImpl ir) {
-        this.dswContext = dswContext;
-        this.iClass = iClass;
+    public ClientServiceFactory(EndpointDescription endpoint,
+                                DistributionProvider handler, ImportRegistrationImpl ir) {
         this.endpoint = endpoint;
         this.handler = handler;
         this.importRegistration = ir;
@@ -61,10 +56,10 @@
         String interfaceName = interfaces == null || interfaces.isEmpty() ? null : interfaces.get(0);
         LOG.debug("getService() from serviceFactory for {}", interfaceName);
         try {
+            final Class<?> iClass = requestingBundle.loadClass(interfaceName);
             Object proxy = AccessController.doPrivileged(new PrivilegedAction<Object>() {
                 public Object run() {
-                    return handler.createProxy(sreg.getReference(), dswContext,
-                            requestingBundle.getBundleContext(), iClass, endpoint);
+                    return handler.createProxy(sreg.getReference(), iClass, endpoint);
                 }
             });
 
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
index 322bc1c..11e9514 100644
--- 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
@@ -21,15 +21,15 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.cxf.dosgi.dsw.api.ConfigurationTypeHandler;
+import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.remoteserviceadmin.EndpointDescription;
 
 public interface ConfigTypeHandlerFinder {
 
-    ConfigurationTypeHandler getHandler(BundleContext dswBC, Map<String, Object> serviceProperties);
+    DistributionProvider getHandler(BundleContext dswBC, Map<String, Object> serviceProperties);
 
-    ConfigurationTypeHandler getHandler(BundleContext dswBC, EndpointDescription endpoint);
+    DistributionProvider getHandler(BundleContext dswBC, EndpointDescription endpoint);
 
     List<String> getSupportedConfigurationTypes();
 
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 d6e5774..d80bd40 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
@@ -24,6 +24,7 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.cxf.dosgi.dsw.api.Endpoint;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.remoteserviceadmin.EndpointDescription;
 import org.osgi.service.remoteserviceadmin.ExportReference;
@@ -62,15 +63,13 @@
     }
 
     // create a new (parent) instance which was exported successfully with the given server
-    public ExportRegistrationImpl(ServiceReference sref, EndpointDescription endpoint,
-            RemoteServiceAdminCore rsaCore, Closeable server) {
-        this(null, rsaCore, new ExportReferenceImpl(sref, endpoint), server, null);
+    public ExportRegistrationImpl(ServiceReference sref, Endpoint endpoint, RemoteServiceAdminCore rsaCore) {
+        this(null, rsaCore, new ExportReferenceImpl(sref, endpoint.description()), endpoint, null);
     }
 
     // create a new (parent) instance which failed to be exported with the given exception
-    public ExportRegistrationImpl(ServiceReference sref, EndpointDescription endpoint,
-            RemoteServiceAdminCore rsaCore, Throwable exception) {
-        this(null, rsaCore, new ExportReferenceImpl(sref, endpoint), null, exception);
+    public ExportRegistrationImpl(RemoteServiceAdminCore rsaCore, Throwable exception) {
+        this(null, rsaCore, null, null, exception);
     }
 
     private void ensureParent() {
@@ -80,6 +79,9 @@
     }
 
     public ExportReference getExportReference() {
+        if (exportReference == null) {
+            throw new IllegalStateException(getException());
+        }
         return closed ? null : exportReference;
     }
 
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 2007ec2..d561079 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.Map;
 import java.util.Set;
 
-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.api.DistributionProvider;
+import org.apache.cxf.dosgi.dsw.api.Endpoint;
 import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
 import org.apache.cxf.dosgi.dsw.util.Utils;
 import org.osgi.framework.Bundle;
@@ -158,43 +157,28 @@
     private List<ExportRegistration> exportInterfaces(List<String> interfaces,
             ServiceReference<?> serviceReference, Map<String, Object> serviceProperties) {
         LOG.info("interfaces selected for export: " + interfaces);
-        ConfigurationTypeHandler handler;
+        DistributionProvider handler;
         try {
-            handler = findHandler(serviceProperties);
+            handler = configTypeHandlerFinder.getHandler(bctx, serviceProperties);
         } catch (RuntimeException e) {
             LOG.error(e.getMessage(), e);
             return Collections.emptyList();
         }
         List<ExportRegistration> exportRegs = new ArrayList<ExportRegistration>(1);
-        Object service = bctx.getService(serviceReference);
-        Bundle bundle = serviceReference.getBundle();
-
-        // if service has been unregistered in the meantime
-        if (service == null || bundle == null) {
-            LOG.info("service has been unregistered, aborting export");
-            return exportRegs;
-        }
-
         for (String iface : interfaces) {
-            LOG.info("creating server for interface " + iface);
-            // this is an extra sanity check, but do we really need it now?
-            Class<?> interfaceClass = ClassUtils.getInterfaceClass(service, iface);
-            if (interfaceClass != null) {
-                ExportResult exportResult = handler.createServer(serviceReference, bctx, bundle.getBundleContext(),
-                    serviceProperties, interfaceClass, service);
-                EndpointDescription endpoint = new EndpointDescription(exportResult.getEndpointProps());
-                ExportRegistrationImpl exportRegistration;
-                if (exportResult.getException() == null) {
-                    LOG.info("created server for interface " + iface);
-                    exportRegistration = new ExportRegistrationImpl(serviceReference, endpoint, this,
-                            exportResult.getServer());
-                } else {
-                    LOG.error("failed to create server for interface " + iface, exportResult.getException());
-                    exportRegistration = new ExportRegistrationImpl(serviceReference, endpoint, this,
-                            exportResult.getException());
-                }
-                exportRegs.add(exportRegistration);
+            ExportRegistrationImpl exportRegistration;
+            try {
+                LOG.info("creating server for interface " + iface);
+                Endpoint endpoint = handler.createServer(serviceReference, serviceProperties, iface);
+                exportRegistration = new ExportRegistrationImpl(serviceReference, endpoint, this);
+                LOG.info("created server for interface " + iface);
+            } catch (Exception e) {
+                LOG.debug("failed to create server for interface " + iface, e);
+                serviceProperties.put(RemoteConstants.ENDPOINT_ID, "failed");
+                serviceProperties.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, "none");
+                exportRegistration = new ExportRegistrationImpl(this, e);
             }
+            exportRegs.add(exportRegistration);
         }
         return exportRegs;
     }
@@ -334,65 +318,64 @@
                 return ir;
             }
 
-            ConfigurationTypeHandler handler = findHandler(endpoint);
+            DistributionProvider handler = configTypeHandlerFinder.getHandler(bctx, 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 (handler != null && matchingInterfaces.size() == 1) {
-                LOG.info("Proxifying interface: " + matchingInterfaces.get(0));
-
-                ImportRegistrationImpl imReg = new ImportRegistrationImpl(endpoint, this);
-
-                proxifyMatchingInterface(matchingInterfaces.get(0), imReg, handler, bctx);
-                if (imRegs == null) {
-                    imRegs = new ArrayList<ImportRegistrationImpl>();
-                    importedServices.put(endpoint, imRegs);
-                }
-                imRegs.add(imReg);
-                eventProducer.publishNotification(imReg);
-                return imReg;
+            
+            if (handler == null) {
+                LOG.info("No matching handler can be found for remote endpoint {}.", endpoint.getId());
+                return null;
             }
-            return null;
+            if (matchingInterfaces.size() == 0) {
+                LOG.info("No matching interfaces found for remote endpoint {}.", endpoint.getId());
+                return null;
+            }
+            if (matchingInterfaces.size() > 1) {
+                LOG.info("More than one interface {} found for remote endpoint {}. This is not supported.", 
+                         endpoint.getInterfaces(),
+                         endpoint.getId());
+                return null;
+            }
+
+            LOG.info("Importing service {} with interfaces {} using handler {}.", 
+                     endpoint.getId(), endpoint.getInterfaces(), handler.getClass());
+
+            ImportRegistrationImpl imReg = exposeServiceFactory(matchingInterfaces.get(0), endpoint, handler);
+            if (imRegs == null) {
+                imRegs = new ArrayList<ImportRegistrationImpl>();
+                importedServices.put(endpoint, imRegs);
+            }
+            imRegs.add(imReg);
+            eventProducer.publishNotification(imReg);
+            return imReg;
         }
     }
 
-    protected void proxifyMatchingInterface(String interfaceName, ImportRegistrationImpl imReg,
-                                            ConfigurationTypeHandler handler, BundleContext requestingContext) {
+    protected ImportRegistrationImpl exposeServiceFactory(String interfaceName,
+                                            EndpointDescription epd,
+                                            DistributionProvider handler) {
+        ImportRegistrationImpl imReg = new ImportRegistrationImpl(epd, this);
         try {
-            // MARC: relies on dynamic imports?
-            Class<?> iClass = bctx.getBundle().loadClass(interfaceName);
-            if (iClass == null) {
-                throw new ClassNotFoundException("Cannot load interface class");
-            }
-
-            BundleContext actualContext = bctx;
-            Class<?> actualClass = requestingContext.getBundle().loadClass(interfaceName);
-            if (actualClass != iClass) {
-                LOG.info("Class " + interfaceName + " loaded by DSW's bundle context is not "
-                             + "equal to the one loaded by the requesting bundle context, "
-                             + "DSW will use the requesting bundle context to register a proxy service");
-                iClass = actualClass;
-                actualContext = requestingContext;
-            }
-
+            // FIXME This should not be done here but without it the service factory
+            // does not seem to be picked up by the consumers
+            bctx.getBundle().loadClass(interfaceName);
+            
             EndpointDescription endpoint = imReg.getImportedEndpointDescription();
-            /* TODO: add additional local params... */
             Dictionary<String, Object> serviceProps = new Hashtable<String, Object>(endpoint.getProperties());
             serviceProps.put(RemoteConstants.SERVICE_IMPORTED, true);
             serviceProps.remove(RemoteConstants.SERVICE_EXPORTED_INTERFACES);
 
-            ClientServiceFactory csf = new ClientServiceFactory(actualContext, iClass, endpoint, handler, imReg);
+            ClientServiceFactory csf = new ClientServiceFactory(endpoint, handler, imReg);
             imReg.setClientServiceFactory(csf);
-            ServiceRegistration<?> proxyReg = actualContext.registerService(interfaceName, csf, serviceProps);
-            imReg.setImportedServiceRegistration(proxyReg);
+            ServiceRegistration<?> csfReg = bctx.registerService(interfaceName, csf, serviceProps);
+            imReg.setImportedServiceRegistration(csfReg);
         } catch (Exception ex) {
             // Only logging at debug level as this might be written to the log at the TopologyManager
             LOG.debug("Can not proxy service with interface " + interfaceName + ": " + ex.getMessage(), ex);
             imReg.setException(ex);
         }
+        return imReg;
     }
 
     /**
@@ -474,9 +457,12 @@
             List<ExportRegistration> bundleRegs = new ArrayList<ExportRegistration>();
             for (Collection<ExportRegistration> regs : exportedServices.values()) {
                 if (!regs.isEmpty()) {
-                    Bundle regBundle = regs.iterator().next().getExportReference().getExportedService().getBundle();
-                    if (exportingBundle.equals(regBundle)) {
-                        bundleRegs.addAll(regs);
+                    ExportRegistration exportRegistration = regs.iterator().next();
+                    if (exportRegistration.getException() == null) {
+                        Bundle regBundle = exportRegistration.getExportReference().getExportedService().getBundle();
+                        if (exportingBundle.equals(regBundle)) {
+                            bundleRegs.addAll(regs);
+                        }
                     }
                 }
             }
@@ -503,17 +489,4 @@
         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);
-    }
 }
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParserTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParserTest.java
index 37c018a..270c7fa 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParserTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParserTest.java
@@ -18,9 +18,12 @@
  */
 package org.apache.cxf.dosgi.dsw.decorator;
 
+import java.io.IOException;
 import java.net.URL;
 import java.util.List;
 
+import javax.xml.bind.JAXBException;
+
 import org.apache.cxf.xmlns.service_decoration._1_0.AddPropertyType;
 import org.apache.cxf.xmlns.service_decoration._1_0.MatchPropertyType;
 import org.apache.cxf.xmlns.service_decoration._1_0.MatchType;
@@ -33,7 +36,7 @@
 public class DecorationParserTest {
 
     @Test
-    public void testGetDecoratorForSD() {
+    public void testGetDecoratorForSD() throws JAXBException, IOException {
         URL resource = getClass().getResource("/test-resources/sd.xml");
         List<ServiceDecorationType> elements = new DecorationParser().getDecorations(resource);
         assertEquals(1, elements.size());
@@ -53,7 +56,7 @@
     }
 
     @Test
-    public void testGetDecorationForNull() {
+    public void testGetDecorationForNull() throws JAXBException, IOException {
         List<ServiceDecorationType> elements = new DecorationParser().getDecorations(null);
         Assert.assertEquals(0, elements.size());
     }
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java
index 8b45d28..c66642b 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java
@@ -29,6 +29,7 @@
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 
+@SuppressWarnings("rawtypes")
 public class InterfaceRuleTest extends TestCase {
 
     public void testDUMMY() {
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 5c59a55..400d793 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
@@ -173,6 +173,7 @@
         Bundle b = EasyMock.createMock(Bundle.class);
         EasyMock.expect(b.findEntries("OSGI-INF/remote-service", "*.xml", false)).andReturn(
             Collections.enumeration(Arrays.asList(resources))).anyTimes();
+        EasyMock.expect(b.getSymbolicName()).andReturn("bundlename");
         EasyMock.replay(b);
         return b;
     }
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 7d07227..bdbb93d 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,7 +23,7 @@
 
 import junit.framework.TestCase;
 
-import org.apache.cxf.dosgi.dsw.api.ConfigurationTypeHandler;
+import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
 import org.apache.cxf.dosgi.dsw.service.ClientServiceFactory;
 import org.apache.cxf.dosgi.dsw.service.ImportRegistrationImpl;
 import org.easymock.EasyMock;
@@ -38,35 +38,39 @@
 
 public class ClientServiceFactoryTest extends TestCase {
 
-    @SuppressWarnings("rawtypes")
-    public void testGetService() {
+    @SuppressWarnings({
+     "rawtypes", "unchecked"
+    })
+    public void testGetService() throws ClassNotFoundException {
         Object myTestProxyObject = new Object();
 
-        IMocksControl control = EasyMock.createNiceControl();
-        BundleContext dswContext = control.createMock(BundleContext.class);
+        IMocksControl control = EasyMock.createControl();
         Map<String, Object> map = new HashMap<String, Object>();
         map.put(RemoteConstants.ENDPOINT_ID, "http://google.de");
         map.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, "myGreatConfiguration");
-        map.put(Constants.OBJECTCLASS, new String[]{"my.class"});
+        map.put(Constants.OBJECTCLASS, new String[]{String.class.getName()});
 
         EndpointDescription endpoint = new EndpointDescription(map);
-        ConfigurationTypeHandler handler = control.createMock(ConfigurationTypeHandler.class);
+        
 
         ImportRegistrationImpl iri = new ImportRegistrationImpl(endpoint, null);
 
         BundleContext requestingContext = control.createMock(BundleContext.class);
         Bundle requestingBundle = control.createMock(Bundle.class);
+        EasyMock.expect(requestingBundle.loadClass(String.class.getName())).andReturn((Class)String.class);
         EasyMock.expect(requestingBundle.getBundleContext()).andReturn(requestingContext);
 
-        ServiceReference sr = control.createMock(ServiceReference.class);
+        ServiceReference sref = control.createMock(ServiceReference.class);
+        EasyMock.expect(sref.getBundle()).andReturn(requestingBundle);
         ServiceRegistration sreg = control.createMock(ServiceRegistration.class);
-        EasyMock.expect(sreg.getReference()).andReturn(sr);
+        EasyMock.expect(sreg.getReference()).andReturn(sref);
 
-        handler.createProxy(sr, dswContext, requestingContext, String.class, endpoint);
+        DistributionProvider handler = control.createMock(DistributionProvider.class);
+        handler.createProxy(sref, String.class, endpoint);
         EasyMock.expectLastCall().andReturn(myTestProxyObject);
         control.replay();
 
-        ClientServiceFactory csf = new ClientServiceFactory(dswContext, String.class, endpoint, handler, iri);
+        ClientServiceFactory csf = new ClientServiceFactory(endpoint, handler, iri);
         assertSame(myTestProxyObject, csf.getService(requestingBundle, sreg));
     }
 }
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 1508277..c96874e 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,13 +22,14 @@
 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.api.DistributionProvider;
 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.Assert;
 import org.junit.Test;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.remoteserviceadmin.RemoteConstants;
@@ -39,54 +40,55 @@
 
     @Test
     public void testGetDefaultHandlerNoIntents() {
-        ConfigurationTypeHandler handler = getHandlerWith(null, null);
+        DistributionProvider handler = getHandlerWith(null, null);
         assertTrue(handler instanceof PojoConfigurationTypeHandler);
     }
 
     @Test
     public void testGetJaxrsHandlerNoIntents() {
-        ConfigurationTypeHandler handler = getHandlerWith(Constants.RS_CONFIG_TYPE, null);
+        DistributionProvider handler = getHandlerWith(Constants.RS_CONFIG_TYPE, null);
         assertTrue(handler instanceof JaxRSPojoConfigurationTypeHandler);
     }
 
     @Test
     public void testGetJaxrsHandlerHttpIntents() {
-        ConfigurationTypeHandler handler = getHandlerWith(Constants.RS_CONFIG_TYPE, "HTTP");
+        DistributionProvider handler = getHandlerWith(Constants.RS_CONFIG_TYPE, "HTTP");
         assertTrue(handler instanceof JaxRSPojoConfigurationTypeHandler);
     }
 
     @Test
     public void testJaxrsPropertyIgnored() {
-        ConfigurationTypeHandler handler = getHandlerWith(Constants.RS_CONFIG_TYPE, "SOAP HTTP");
+        DistributionProvider handler = getHandlerWith(Constants.RS_CONFIG_TYPE, "SOAP HTTP");
         assertTrue(handler instanceof PojoConfigurationTypeHandler);
         assertTrue(!(handler instanceof JaxRSPojoConfigurationTypeHandler));
     }
 
     @Test
     public void testJaxrsPropertyIgnored2() {
-        ConfigurationTypeHandler handler = getHandlerWith2(Constants.RS_CONFIG_TYPE, new String[] {"HTTP", "SOAP"});
+        DistributionProvider handler = getHandlerWith2(Constants.RS_CONFIG_TYPE, new String[] {"HTTP", "SOAP"});
         assertTrue(handler instanceof PojoConfigurationTypeHandler);
         assertTrue(!(handler instanceof JaxRSPojoConfigurationTypeHandler));
     }
 
     @Test
     public void testGetPojoHandler() {
-        ConfigurationTypeHandler handler = getHandlerWith(Constants.WS_CONFIG_TYPE, null);
+        DistributionProvider handler = getHandlerWith(Constants.WS_CONFIG_TYPE, null);
         assertTrue(handler instanceof PojoConfigurationTypeHandler);
     }
 
     @Test
     public void testGetWSDLHandler() {
-        ConfigurationTypeHandler handler = getHandlerWith(Constants.WSDL_CONFIG_TYPE, null);
+        DistributionProvider handler = getHandlerWith(Constants.WSDL_CONFIG_TYPE, null);
         assertTrue(handler instanceof WsdlConfigurationTypeHandler);
     }
 
-    @Test(expected = RuntimeException.class)
+    @Test
     public void testUnsupportedConfiguration() {
-        getHandlerWith("notSupportedConfig", null);
+        DistributionProvider handler = getHandlerWith("notSupportedConfig", null);
+        Assert.assertNull(handler);
     }
 
-    private ConfigurationTypeHandler getHandlerWith(String configType, String intents) {
+    private DistributionProvider getHandlerWith(String configType, String intents) {
         BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
         EasyMock.replay(bc);
         Map<String, Object> serviceProps = new HashMap<String, Object>();
@@ -99,7 +101,7 @@
         return f.getHandler(bc, serviceProps);
     }
 
-    private ConfigurationTypeHandler getHandlerWith2(String configType, String[] intents) {
+    private DistributionProvider getHandlerWith2(String configType, String[] intents) {
         BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
         EasyMock.replay(bc);
         Map<String, Object> serviceProps = new HashMap<String, Object>();
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 2c97b86..69f194d 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,7 +18,6 @@
  */
 package org.apache.cxf.dosgi.dsw.handlers;
 
-import java.io.Closeable;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
@@ -29,16 +28,13 @@
 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.api.Endpoint;
 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;
-import org.apache.cxf.dosgi.dsw.handlers.simple.MySimpleEchoServiceImpl;
 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.AbstractEndpointFactory;
-import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.EndpointImpl;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.feature.Feature;
@@ -53,11 +49,15 @@
 import org.easymock.IAnswer;
 import org.easymock.IMocksControl;
 import org.junit.Assert;
+import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.remoteserviceadmin.EndpointDescription;
 import org.osgi.service.remoteserviceadmin.RemoteConstants;
 
+@SuppressWarnings({
+    "unchecked", "rawtypes"
+   })
 public class PojoConfigurationTypeHandlerTest extends TestCase {
 
     public void testGetPojoAddressEndpointURI() {
@@ -110,9 +110,13 @@
     public void testCreateProxy() {
         IMocksControl c = EasyMock.createNiceControl();
         BundleContext bc1 = c.createMock(BundleContext.class);
-        BundleContext bc2 = c.createMock(BundleContext.class);
 
-        ServiceReference sref = c.createMock(ServiceReference.class);
+        
+        ServiceReference<?> sref = c.createMock(ServiceReference.class);
+        Bundle requestingBundle = c.createMock(Bundle.class);
+        BundleContext requestingContext = c.createMock(BundleContext.class);
+        EasyMock.expect(requestingBundle.getBundleContext()).andReturn(requestingContext);
+        EasyMock.expect(sref.getBundle()).andReturn(requestingBundle);
 
         final ClientProxyFactoryBean cpfb = c.createMock(ClientProxyFactoryBean.class);
         ReflectionServiceFactoryBean sf = c.createMock(ReflectionServiceFactoryBean.class);
@@ -148,13 +152,13 @@
         EasyMock.expectLastCall().atLeastOnce();
 
         c.replay();
-        Object proxy = p.createProxy(sref, bc1, bc2, CharSequence.class, endpoint);
+        Object proxy = p.createProxy(sref, CharSequence.class, endpoint);
         assertNotNull(proxy);
         assertTrue("Proxy is not of the requested type! ", proxy instanceof CharSequence);
         c.verify();
     }
 
-    public void testCreateServerWithAddressProperty() {
+    public void testCreateServerWithAddressProperty() throws Exception {
         BundleContext dswContext = EasyMock.createNiceMock(BundleContext.class);
         EasyMock.replay(dswContext);
 
@@ -176,18 +180,23 @@
                 return sfb;
             }
         };
+        ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
+        
+        BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.expect(bundleContext.getService(sref)).andReturn(myService);
+        EasyMock.replay(bundleContext);
+        Bundle bundle = EasyMock.createNiceMock(Bundle.class);
+        EasyMock.expect(bundle.getBundleContext()).andReturn(bundleContext);
+        EasyMock.replay(bundle);
 
-        ServiceReference sr = EasyMock.createNiceMock(ServiceReference.class);
-        BundleContext callingContext = EasyMock.createNiceMock(BundleContext.class);
-        EasyMock.replay(sr);
-        EasyMock.replay(callingContext);
-
+        EasyMock.expect(sref.getBundle()).andReturn(bundle);
+        EasyMock.replay(sref);
+        
         Map<String, Object> props = new HashMap<String, Object>();
         props.put(Constants.WS_ADDRESS_PROPERTY, "http://alternate_host:80/myString");
 
-        ExportResult exportResult = p.createServer(sr, dswContext, callingContext, props, String.class, myService);
-
-        Map<String, Object> edProps = exportResult.getEndpointProps();
+        Endpoint exportResult = p.createServer(sref, props, String.class.getName());
+        Map<String, Object> edProps = exportResult.description().getProperties();
 
         assertNotNull(edProps.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS));
         assertEquals(1, ((String[])edProps.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS)).length);
@@ -226,23 +235,29 @@
                                                                                 intentManager,
                                                                                 dummyHttpServiceManager()) {
             @Override
-            protected ExportResult createServerFromFactory(ServerFactoryBean factory,
+            protected Endpoint createServerFromFactory(ServerFactoryBean factory,
                                                            Map<String, Object> endpointProps) {
-                return new ExportResult(endpointProps, (Closeable) null);
+                EndpointDescription epd = new EndpointDescription(endpointProps);
+                return new ServerWrapper(epd, null);
             }
         };
-
-        ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
-        EasyMock.replay(sref);
-
         Runnable myService = EasyMock.createMock(Runnable.class);
         EasyMock.replay(myService);
-        ExportResult result = handler.createServer(sref, null, null, properties, Runnable.class, myService);
-        if (result.getException() != null) {
-            throw result.getException();
-        }
+        
+        ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
+        BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.expect(bundleContext.getService(sref)).andReturn(myService);
+        EasyMock.replay(bundleContext);
+        Bundle bundle = EasyMock.createNiceMock(Bundle.class);
+        EasyMock.expect(bundle.getBundleContext()).andReturn(bundleContext);
+        EasyMock.replay(bundle);
 
-        Map<String, Object> props = result.getEndpointProps();
+        EasyMock.expect(sref.getBundle()).andReturn(bundle);
+        EasyMock.replay(sref);
+
+
+        Endpoint result = handler.createServer(sref, properties, Runnable.class.getName());
+        Map<String, Object> props = result.description().getProperties();
         assertEquals(expectedAddress, props.get("org.apache.cxf.ws.address"));
         assertEquals("Version of java. package is always 0", "0.0.0", props.get("endpoint.package.version.java.lang"));
         assertTrue(Arrays.equals(new String[] {"org.apache.cxf.ws"}, (String[]) props.get("service.imported.configs")));
@@ -261,22 +276,25 @@
                                                                                 intentManager,
                                                                                 dummyHttpServiceManager()) {
             @Override
-            protected ExportResult createServerFromFactory(ServerFactoryBean factory,
+            protected Endpoint createServerFromFactory(ServerFactoryBean factory,
                                                            Map<String, Object> endpointProps) {
                 throw new TestException();
             }
         };
 
-        ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
+        ServiceReference<?> sref = EasyMock.createNiceMock(ServiceReference.class);
         EasyMock.replay(sref);
 
         Map<String, Object> props = new HashMap<String, Object>();
 
         Runnable myService = EasyMock.createMock(Runnable.class);
         EasyMock.replay(myService);
-        ExportResult result = handler.createServer(sref, null, null, props, Runnable.class, myService);
-        Assert.assertTrue(result.getException() instanceof TestException);
-        Assert.assertEquals(props, result.getEndpointProps());
+        try {
+            handler.createServer(sref, props, Runnable.class.getName());
+            fail("Expected TestException");
+        } catch (TestException e) {
+            // Expected
+        }
     }
 
     private ServerFactoryBean createMockServerFactoryBean() {
@@ -366,18 +384,16 @@
                                                                                 intentManager,
                                                                                 dummyHttpServiceManager());
 
-        Object serviceBean = new MyJaxWsEchoServiceImpl();
-        ServiceReference sref = c.createMock(ServiceReference.class);
+        ServiceReference<?> sref = c.createMock(ServiceReference.class);
 
         Map<String, Object> sd = new HashMap<String, Object>();
         sd.put(Constants.WS_ADDRESS_PROPERTY, "/somewhere");
 
         c.replay();
-        ExportResult exportResult = handler.createServer(sref, dswBC, null, sd, MyJaxWsEchoService.class, serviceBean);
+        ServerWrapper serverWrapper = (ServerWrapper)handler.createServer(sref, sd, MyJaxWsEchoService.class.getName());
         c.verify();
 
-        ServerWrapper serverWrapper = (ServerWrapper)exportResult.getServer();
-        Endpoint ep = serverWrapper.getServer().getEndpoint();
+        org.apache.cxf.endpoint.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/",
@@ -391,17 +407,16 @@
         IntentManager intentManager = new DummyIntentManager();
         PojoConfigurationTypeHandler handler
             = new PojoConfigurationTypeHandler(dswBC, intentManager, dummyHttpServiceManager());
-        Object serviceBean = new MySimpleEchoServiceImpl();
-        ServiceReference sref = c.createMock(ServiceReference.class);
+        ServiceReference<?> sref = c.createMock(ServiceReference.class);
         Map<String, Object> sd = new HashMap<String, Object>();
         sd.put(Constants.WS_ADDRESS_PROPERTY, "/somewhere_else");
 
         c.replay();
-        ExportResult exportResult = handler.createServer(sref, dswBC, null, sd, MySimpleEchoService.class, serviceBean);
-        ServerWrapper serverWrapper = (ServerWrapper)exportResult.getServer();
+        ServerWrapper serverWrapper = (ServerWrapper)handler.createServer(sref, sd, 
+                                                                          MySimpleEchoService.class.getName());
         c.verify();
 
-        Endpoint ep = serverWrapper.getServer().getEndpoint();
+        org.apache.cxf.endpoint.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/",
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 eba5400..98b4cbf 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,13 +18,13 @@
  */
 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.dosgi.dsw.handlers.ServerWrapper;
 import org.easymock.EasyMock;
 import org.easymock.IAnswer;
 import org.junit.Assert;
@@ -40,22 +40,24 @@
 import org.osgi.service.remoteserviceadmin.ExportRegistration;
 import org.osgi.service.remoteserviceadmin.RemoteServiceAdminEvent;
 
+@SuppressWarnings({"rawtypes", "unchecked"})
 public class EventProducerTest {
-
+    
+    
     @Test
     public void testPublishNotification() throws Exception {
         RemoteServiceAdminCore remoteServiceAdminCore = EasyMock.createNiceMock(RemoteServiceAdminCore.class);
         EasyMock.replay(remoteServiceAdminCore);
 
-        final EndpointDescription endpoint = EasyMock.createNiceMock(EndpointDescription.class);
-        EasyMock.expect(endpoint.getServiceId()).andReturn(Long.MAX_VALUE).anyTimes();
+        final EndpointDescription epd = EasyMock.createNiceMock(EndpointDescription.class);
+        EasyMock.expect(epd.getServiceId()).andReturn(Long.MAX_VALUE).anyTimes();
         final String uuid = UUID.randomUUID().toString();
-        EasyMock.expect(endpoint.getFrameworkUUID()).andReturn(uuid).anyTimes();
-        EasyMock.expect(endpoint.getId()).andReturn("foo://bar").anyTimes();
+        EasyMock.expect(epd.getFrameworkUUID()).andReturn(uuid).anyTimes();
+        EasyMock.expect(epd.getId()).andReturn("foo://bar").anyTimes();
         final List<String> interfaces = Arrays.asList("org.foo.Bar", "org.boo.Far");
-        EasyMock.expect(endpoint.getInterfaces()).andReturn(interfaces).anyTimes();
-        EasyMock.expect(endpoint.getConfigurationTypes()).andReturn(Arrays.asList("org.apache.cxf.ws")).anyTimes();
-        EasyMock.replay(endpoint);
+        EasyMock.expect(epd.getInterfaces()).andReturn(interfaces).anyTimes();
+        EasyMock.expect(epd.getConfigurationTypes()).andReturn(Arrays.asList("org.apache.cxf.ws")).anyTimes();
+        EasyMock.replay(epd);
         final ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
         EasyMock.replay(sref);
 
@@ -80,7 +82,7 @@
                 Assert.assertEquals("test.bundle", event.getProperty("bundle.symbolicname"));
                 Assert.assertEquals(new Version(1, 2, 3, "test"), event.getProperty("bundle.version"));
                 Assert.assertNull(event.getProperty("cause"));
-                Assert.assertEquals(endpoint, event.getProperty("export.registration"));
+                Assert.assertEquals(epd, event.getProperty("export.registration"));
 
                 Assert.assertEquals(Long.MAX_VALUE, event.getProperty("service.remote.id"));
                 Assert.assertEquals(uuid, event.getProperty("service.remote.uuid"));
@@ -95,7 +97,7 @@
                 Assert.assertEquals(RemoteServiceAdminEvent.EXPORT_REGISTRATION, rsae.getType());
                 Assert.assertSame(bundle, rsae.getSource());
                 ExportReference er = rsae.getExportReference();
-                Assert.assertSame(endpoint, er.getExportedEndpoint());
+                Assert.assertSame(epd, er.getExportedEndpoint());
                 Assert.assertSame(sref, er.getExportedService());
 
                 return null;
@@ -113,9 +115,8 @@
         EasyMock.expect(bc.getService(eaSref)).andReturn(ea).anyTimes();
         EasyMock.replay(bc);
         EventProducer eventProducer = new EventProducer(bc);
-
-        ExportRegistrationImpl ereg = new ExportRegistrationImpl(sref, endpoint, remoteServiceAdminCore, 
-                                                                 (Closeable)null);
+        ServerWrapper endpoint = new ServerWrapper(epd, null);
+        ExportRegistrationImpl ereg = new ExportRegistrationImpl(sref, endpoint, remoteServiceAdminCore);
         eventProducer.publishNotification(ereg);
     }
 
@@ -179,7 +180,7 @@
         EasyMock.replay(bc);
         EventProducer eventProducer = new EventProducer(bc);
 
-        ExportRegistrationImpl ereg = new ExportRegistrationImpl(sref, endpoint, rsaCore, exportException);
+        ExportRegistrationImpl ereg = new ExportRegistrationImpl(rsaCore, exportException);
         eventProducer.publishNotification(Arrays.<ExportRegistration>asList(ereg));
     }
 }
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 f714eca..2900ce6 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,7 +18,6 @@
  */
 package org.apache.cxf.dosgi.dsw.service;
 
-import java.io.Closeable;
 import java.lang.reflect.Field;
 import java.util.Arrays;
 import java.util.Collection;
@@ -28,10 +27,11 @@
 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.api.DistributionProvider;
+import org.apache.cxf.dosgi.dsw.api.Endpoint;
 import org.apache.cxf.dosgi.dsw.handlers.ConfigTypeHandlerFactory;
 import org.apache.cxf.dosgi.dsw.handlers.HttpServiceManager;
+import org.apache.cxf.dosgi.dsw.handlers.ServerWrapper;
 import org.apache.cxf.dosgi.dsw.qos.DefaultIntentMapFactory;
 import org.apache.cxf.dosgi.dsw.qos.IntentManager;
 import org.apache.cxf.dosgi.dsw.qos.IntentManagerImpl;
@@ -58,6 +58,9 @@
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
+@SuppressWarnings({
+    "rawtypes", "unchecked"
+   })
 public class RemoteServiceAdminCoreTest {
 
     @Test
@@ -129,9 +132,10 @@
 
         RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, configTypeHandlerFactory) {
             @Override
-            protected void proxifyMatchingInterface(String interfaceName, ImportRegistrationImpl imReg,
-                                                    ConfigurationTypeHandler handler,
-                                                    BundleContext requestingContext) {
+            protected ImportRegistrationImpl exposeServiceFactory(String interfaceName, 
+                                                                      EndpointDescription epd,
+                                                                      DistributionProvider handler) {
+                return new ImportRegistrationImpl(epd, this);
             }
         };
 
@@ -205,13 +209,10 @@
         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, (Closeable) null);
+        Endpoint er = new ServerWrapper(new EndpointDescription(eProps), null);
 
-        ConfigurationTypeHandler handler = EasyMock.createNiceMock(ConfigurationTypeHandler.class);
-        EasyMock.expect(handler.createServer(sref,
-                                             bc,
-                                             sref.getBundle().getBundleContext(),
-                                             sProps, Runnable.class, svcObject)).andReturn(er).once();
+        DistributionProvider handler = EasyMock.createNiceMock(DistributionProvider.class);
+        EasyMock.expect(handler.createServer(sref, sProps, Runnable.class.getName())).andReturn(er).once();
         EasyMock.replay(handler);
 
         ConfigTypeHandlerFinder handlerFactory = EasyMock.createNiceMock(ConfigTypeHandlerFactory.class);
@@ -254,7 +255,6 @@
         // Look at the exportedServices data structure
         Field field = RemoteServiceAdminCore.class.getDeclaredField("exportedServices");
         field.setAccessible(true);
-        @SuppressWarnings("unchecked")
         Map<Map<String, Object>, Collection<ExportRegistration>> exportedServices =
                 (Map<Map<String, Object>, Collection<ExportRegistration>>) field.get(rsaCore);
 
@@ -304,27 +304,23 @@
         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, new TestException());
 
-        ConfigurationTypeHandler handler = EasyMock.createNiceMock(ConfigurationTypeHandler.class);
-        EasyMock.expect(handler.createServer(sref, bc, sref.getBundle().getBundleContext(),
-                                             sProps, Runnable.class, svcObject)).andReturn(er);
+        DistributionProvider handler = EasyMock.createMock(DistributionProvider.class);
+        EasyMock.expect(handler.createServer(sref, sProps, Runnable.class.getName())).andThrow(new TestException());
         EasyMock.replay(handler);
 
-        ConfigTypeHandlerFinder handlerFactory = EasyMock.createNiceMock(ConfigTypeHandlerFactory.class);
+        ConfigTypeHandlerFinder handlerFactory = EasyMock.createMock(ConfigTypeHandlerFactory.class);
         EasyMock.expect(handlerFactory.getHandler(bc, sProps)).andReturn(handler).anyTimes();
         EasyMock.replay(handlerFactory);
         RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, handlerFactory);
 
-        List<ExportRegistration> ereg = rsaCore.exportService(sref, null);
+        List<ExportRegistration> ereg = rsaCore.exportService(sref, sProps);
         assertEquals(1, ereg.size());
         assertTrue(ereg.get(0).getException() instanceof TestException);
-        assertSame(sref, ereg.get(0).getExportReference().getExportedService());
 
         // Look at the exportedServices data structure
         Field field = RemoteServiceAdminCore.class.getDeclaredField("exportedServices");
         field.setAccessible(true);
-        @SuppressWarnings("unchecked")
         Map<Map<String, Object>, Collection<ExportRegistration>> exportedServices =
                 (Map<Map<String, Object>, Collection<ExportRegistration>>) field.get(rsaCore);
 
@@ -332,9 +328,6 @@
         assertEquals("There is 1 export registration",
                 1, exportedServices.values().iterator().next().size());
 
-        // Remove all export registrations from the service bundle
-        rsaCore.removeExportRegistrations(sref.getBundle());
-        assertEquals("No more exported services", 0, exportedServices.size());
     }
 
     private ServiceReference mockServiceReference(final Map<String, Object> sProps) {
@@ -361,6 +354,6 @@
     }
 
     @SuppressWarnings("serial")
-    private static class TestException extends Exception {
+    private static class TestException extends RuntimeException {
     }
 }
diff --git a/parent/pom.xml b/parent/pom.xml
index d529f9d..2ce6c48 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -189,10 +189,10 @@
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-compiler-plugin</artifactId>
-                    <version>2.5.1</version>
+                    <version>3.5.1</version>
                     <configuration>
-                        <source>1.6</source>
-                        <target>1.6</target>
+                        <source>1.7</source>
+                        <target>1.7</target>
                         <maxmem>256M</maxmem>
                         <fork>false</fork>
                     </configuration>
diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java
index 48e87ac..1e4bf39 100644
--- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java
+++ b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java
@@ -28,9 +28,6 @@
 import java.util.Map;
 import java.util.Properties;
 import java.util.TreeMap;
-import java.util.jar.Attributes;
-import java.util.jar.JarInputStream;
-import java.util.jar.Manifest;
 
 import org.ops4j.pax.exam.CoreOptions;
 import org.ops4j.pax.exam.Option;
@@ -94,18 +91,8 @@
 
         for (Map.Entry<Integer, String> entry : bundles.entrySet()) {
             String bundleUri = entry.getValue();
-            URL bundleURL = new URL(bundleUri);
-            JarInputStream bundleJar = new JarInputStream(bundleURL.openStream());
-            Manifest manifest = bundleJar.getManifest();
-            Attributes host = manifest.getAttributes("Fragment-Host");
-            if (host != null) {
-                System.out.println(bundleUri);
-            }
-            bundleJar.close();
-            
             opts.add(CoreOptions.bundle(bundleUri));
         }
-        System.out.println(opts);
         return opts.toArray(new Option[opts.size()]);
     }
 
diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestImportService.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestImportService.java
index 0f8b0b8..efc334b 100644
--- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestImportService.java
+++ b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestImportService.java
@@ -73,7 +73,7 @@
                 provision(createServiceConsumerBundle()),
                 // increase for debugging
                 systemProperty("org.apache.cxf.dosgi.test.serviceWaitTimeout").value(
-                        System.getProperty("org.apache.cxf.dosgi.test.serviceWaitTimeout", "20")),
+                        System.getProperty("org.apache.cxf.dosgi.test.serviceWaitTimeout", "200")),
                 frameworkStartLevel(100),
                 //CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005")
         };
@@ -110,17 +110,9 @@
         //    a service property.
 
         // Set up a Server in the test
-        ServerFactoryBean factory = new ServerFactoryBean();
-        factory.setServiceClass(GreeterService.class);
-        factory.setAddress("http://localhost:9191/grrr");
-        factory.getServiceFactory().setDataBinding(new AegisDatabinding());
-        factory.setServiceBean(new TestGreeter());
-
         Server server = null;
-        ClassLoader cl = Thread.currentThread().getContextClassLoader();
         try {
-            Thread.currentThread().setContextClassLoader(ServerFactoryBean.class.getClassLoader());
-            server = factory.create();
+            server = publishTestGreeter();
 
             Dictionary<String, Object> props = new Hashtable<String, Object>();
             props.put("testName", "test1");
@@ -134,6 +126,21 @@
             if (server != null) {
                 server.stop();
             }
+            
+        }
+    }
+
+    private Server publishTestGreeter() {
+        ClassLoader cl = Thread.currentThread().getContextClassLoader();
+        try {
+            Thread.currentThread().setContextClassLoader(ServerFactoryBean.class.getClassLoader());
+            ServerFactoryBean factory = new ServerFactoryBean();
+            factory.setServiceClass(GreeterService.class);
+            factory.setAddress("http://localhost:9191/grrr");
+            factory.getServiceFactory().setDataBinding(new AegisDatabinding());
+            factory.setServiceBean(new TestGreeter());
+            return factory.create();
+        } finally {
             Thread.currentThread().setContextClassLoader(cl);
         }
     }