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/03/11 23:53:48 UTC

[01/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

Repository: cxf-dosgi
Updated Branches:
  refs/heads/master 9ed37bef0 -> 1425743fb


http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/FilterHelper.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/FilterHelper.java b/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/FilterHelper.java
deleted file mode 100644
index 3739f16..0000000
--- a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/FilterHelper.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.topologymanager.importer;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.osgi.framework.Constants;
-
-public final class FilterHelper {
-    private static final String OBJECTCLASS_EXPRESSION = ".*\\(" + Constants.OBJECTCLASS + "=([a-zA-Z_0-9.]+)\\).*";
-    private static final Pattern OBJECTCLASS_PATTERN = Pattern.compile(OBJECTCLASS_EXPRESSION);
-
-    private FilterHelper() {
-        // prevent instantiation
-    }
-
-    public static String getObjectClass(String filter) {
-        if (filter != null) {
-            Matcher matcher = OBJECTCLASS_PATTERN.matcher(filter);
-            if (matcher.matches() && matcher.groupCount() >= 1) {
-                return matcher.group(1);
-            }
-        }
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/ListenerHookImpl.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/ListenerHookImpl.java b/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/ListenerHookImpl.java
deleted file mode 100644
index 03ec9da..0000000
--- a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/ListenerHookImpl.java
+++ /dev/null
@@ -1,119 +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.topologymanager.importer;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.hooks.service.ListenerHook;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Listens for service listeners and informs ServiceInterestListener about added and removed interest
- * in services
- */
-public class ListenerHookImpl implements ListenerHook {
-
-    private static final Logger LOG = LoggerFactory.getLogger(ListenerHookImpl.class);
-
-    // From the old impl.
-    private static final Set<String> SYSTEM_PACKAGES;
-    static {
-        SYSTEM_PACKAGES = new HashSet<String>();
-        SYSTEM_PACKAGES.add("org.osgi.service");
-        SYSTEM_PACKAGES.add("org.apache.felix");
-        SYSTEM_PACKAGES.add("org.ops4j.pax.logging");
-        SYSTEM_PACKAGES.add("ch.ethz.iks.slp");
-        SYSTEM_PACKAGES.add("org.ungoverned.osgi.service");
-        SYSTEM_PACKAGES.add("org.springframework.osgi.context.event.OsgiBundleApplicationContextListener");
-        SYSTEM_PACKAGES.add("java.net.ContentHandler");
-    }
-
-    private final BundleContext bctx;
-    private final ServiceInterestListener serviceInterestListener;
-    private final String frameworkUUID;
-
-    public ListenerHookImpl(BundleContext bc, ServiceInterestListener serviceInterestListener) {
-        this.bctx = bc;
-        this.frameworkUUID = bctx.getProperty(Constants.FRAMEWORK_UUID);
-        this.serviceInterestListener = serviceInterestListener;
-    }
-
-    @Override
-    public void added(Collection<ListenerInfo> listeners) {
-        LOG.debug("added listeners {}", listeners);
-        for (ListenerInfo listenerInfo : listeners) {
-            LOG.debug("Filter {}", listenerInfo.getFilter());
-
-            String className = FilterHelper.getObjectClass(listenerInfo.getFilter());
-
-            if (listenerInfo.getBundleContext().equals(bctx)) {
-                LOG.debug("ListenerHookImpl: skipping request from myself");
-                continue;
-            }
-
-            if (listenerInfo.getFilter() == null) {
-                LOG.debug("skipping empty filter");
-                continue;
-            }
-
-            if (isClassExcluded(className)) {
-                LOG.debug("Skipping import request for excluded class [{}]", className);
-                continue;
-            }
-            String exFilter = extendFilter(listenerInfo.getFilter());
-            serviceInterestListener.addServiceInterest(exFilter);
-        }
-    }
-
-    @Override
-    public void removed(Collection<ListenerInfo> listeners) {
-        LOG.debug("removed listeners {}", listeners);
-
-        for (ListenerInfo listenerInfo : listeners) {
-            LOG.debug("Filter {}", listenerInfo.getFilter());
-
-            // TODO: determine if service was handled?
-            String exFilter = extendFilter(listenerInfo.getFilter());
-            serviceInterestListener.removeServiceInterest(exFilter);
-        }
-    }
-
-    private static boolean isClassExcluded(String className) {
-        if (className == null) {
-            return true;
-        }
-
-        for (String p : SYSTEM_PACKAGES) {
-            if (className.startsWith(p)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    String extendFilter(String filter) {
-        return "(&" + filter + "(!(" + RemoteConstants.ENDPOINT_FRAMEWORK_UUID + "=" + frameworkUUID + ")))";
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/RSATracker.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/RSATracker.java b/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/RSATracker.java
deleted file mode 100644
index 56e98e8..0000000
--- a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/RSATracker.java
+++ /dev/null
@@ -1,26 +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.topologymanager.importer;
-
-import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
-
-public interface RSATracker {
-    void added(RemoteServiceAdmin rsa);
-    void removed(RemoteServiceAdmin rsa);
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/ReferenceCounter.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/ReferenceCounter.java b/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/ReferenceCounter.java
deleted file mode 100644
index 6ecff31..0000000
--- a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/ReferenceCounter.java
+++ /dev/null
@@ -1,76 +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.topologymanager.importer;
-
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * Manages a reference count per key.
- *
- * @param <K> the key type
- */
-public class ReferenceCounter<K> {
-
-    private final ConcurrentMap<K, Integer> counts = new ConcurrentHashMap<K, Integer>();
-
-    /**
-     * Increases the reference count for the given key,
-     * or sets it to 1 if the key has no existing count.
-     *
-     * @param key a key
-     * @return the updated reference count
-     */
-    public int add(K key) {
-        while (true) {
-            Integer count = counts.get(key);
-            if (count == null) {
-                if (counts.putIfAbsent(key, 1) == null) {
-                    return 1;
-                }
-            } else if (counts.replace(key, count, count + 1)) {
-                return count + 1;
-            }
-        }
-    }
-
-    /**
-     * Decreases the reference count for the given key,
-     * and removes it if it reaches 0.
-     * If the key has no existing count, -1 is returned.
-     *
-     * @param key a key
-     * @return the updated reference count, or -1 if the key has no existing count
-     */
-    public int remove(K key) {
-        while (true) {
-            Integer count = counts.get(key);
-            if (count == null) {
-                return -1;
-            }
-            if (count == 1) {
-                if (counts.remove(key, 1)) {
-                    return 0;
-                }
-            } else if (counts.replace(key, count, count - 1)) {
-                return count - 1;
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/ServiceInterestListener.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/ServiceInterestListener.java b/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/ServiceInterestListener.java
deleted file mode 100644
index f4db92e..0000000
--- a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/ServiceInterestListener.java
+++ /dev/null
@@ -1,26 +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.topologymanager.importer;
-
-public interface ServiceInterestListener {
-
-    void addServiceInterest(String filter);
-
-    void removeServiceInterest(String filter);
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/TopologyManagerImport.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/TopologyManagerImport.java b/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/TopologyManagerImport.java
deleted file mode 100644
index 30fe4c2..0000000
--- a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/TopologyManagerImport.java
+++ /dev/null
@@ -1,345 +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.topologymanager.importer;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.hooks.service.ListenerHook;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-import org.osgi.service.remoteserviceadmin.ImportReference;
-import org.osgi.service.remoteserviceadmin.ImportRegistration;
-import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
-import org.osgi.service.remoteserviceadmin.RemoteServiceAdminEvent;
-import org.osgi.service.remoteserviceadmin.RemoteServiceAdminListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Listens for remote endpoints using the EndpointListener interface and the EndpointListenerManager.
- * Listens for local service interests using the ListenerHookImpl that calls back through the
- * ServiceInterestListener interface.
- * Manages local creation and destruction of service imports using the available RemoteServiceAdmin services.
- */
-public class TopologyManagerImport implements EndpointListener, RemoteServiceAdminListener, ServiceInterestListener {
-
-    private static final Logger LOG = LoggerFactory.getLogger(TopologyManagerImport.class);
-    private ExecutorService execService;
-
-    private final EndpointListenerManager endpointListenerManager;
-    private final BundleContext bctx;
-    private Set<RemoteServiceAdmin> rsaSet;
-    private final ListenerHookImpl listenerHook;
-
-    /**
-     * If set to false only one service is imported for each import interest even it multiple services are
-     * available. If set to true, all available services are imported.
-     *
-     * TODO: Make this available as a configuration option
-     */
-    private boolean importAllAvailable = true;
-
-    /**
-     * Contains an instance of the Class Import Interest for each distinct import request. If the same filter
-     * is requested multiple times the existing instance of the Object increments an internal reference
-     * counter. If an interest is removed, the related ServiceInterest object is used to reduce the reference
-     * counter until it reaches zero. in this case the interest is removed.
-     */
-    private final ReferenceCounter<String> importInterestsCounter = new ReferenceCounter<String>();
-
-    /**
-     * List of Endpoints by matched filter that were reported by the EndpointListener and can be imported
-     */
-    private final Map<String /* filter */, List<EndpointDescription>> importPossibilities
-        = new HashMap<String, List<EndpointDescription>>();
-
-    /**
-     * List of already imported Endpoints by their matched filter
-     */
-    private final Map<String /* filter */, List<ImportRegistration>> importedServices
-        = new HashMap<String, List<ImportRegistration>>();
-    
-
-    public TopologyManagerImport(BundleContext bc) {
-        this.rsaSet = new HashSet<RemoteServiceAdmin>();
-        bctx = bc;
-        endpointListenerManager = new EndpointListenerManager(bctx, this);
-        execService = new ThreadPoolExecutor(5, 10, 50, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
-        listenerHook = new ListenerHookImpl(bc, this);
-    }
-    
-    public void start() {
-        bctx.registerService(RemoteServiceAdminListener.class, this, null);
-        bctx.registerService(ListenerHook.class, listenerHook, null);
-        endpointListenerManager.start();
-    }
-
-    public void stop() {
-        endpointListenerManager.stop();
-        execService.shutdown();
-        // this is called from Activator.stop(), which implicitly unregisters our registered services
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.cxf.dosgi.topologymanager.ServiceInterestListener#addServiceInterest(java.lang.String)
-     */
-    public void addServiceInterest(String filter) {
-        if (importInterestsCounter.add(filter) == 1) {
-            endpointListenerManager.extendScope(filter);
-        }
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.cxf.dosgi.topologymanager.ServiceInterestListener#removeServiceInterest(java.lang.String)
-     */
-    public void removeServiceInterest(String filter) {
-        if (importInterestsCounter.remove(filter) == 0) {
-            LOG.debug("last reference to import interest is gone -> removing interest filter: {}", filter);
-            endpointListenerManager.reduceScope(filter);
-            synchronized (importedServices) {
-                List<ImportRegistration> irs = importedServices.remove(filter);
-                if (irs != null) {
-                    for (ImportRegistration ir : irs) {
-                        ir.close();
-                    }
-                }
-            }
-        }
-    }
-
-    public void endpointAdded(EndpointDescription endpoint, String filter) {
-        if (filter == null) {
-            LOG.error("Endpoint is not handled because no matching filter was provided!");
-            return;
-        }
-        LOG.debug("importable service added for filter {}, endpoint {}", filter, endpoint);
-        addImportPossibility(endpoint, filter);
-        triggerImport(filter);
-    }
-
-    public void endpointRemoved(EndpointDescription endpoint, String filter) {
-        LOG.debug("EndpointRemoved {}", endpoint);
-        removeImportPossibility(endpoint, filter);
-        triggerImport(filter);
-    }
-
-    private void addImportPossibility(EndpointDescription endpoint, String filter) {
-        synchronized (importPossibilities) {
-            List<EndpointDescription> endpoints = importPossibilities.get(filter);
-            if (endpoints == null) {
-                endpoints = new ArrayList<EndpointDescription>();
-                importPossibilities.put(filter, endpoints);
-            }
-            // prevent adding the same endpoint multiple times, which can happen sometimes,
-            // and which causes imports to remain available even when services are actually down
-            if (!endpoints.contains(endpoint)) {
-                endpoints.add(endpoint);
-            }
-        }
-    }
-
-    private void removeImportPossibility(EndpointDescription endpoint, String filter) {
-        synchronized (importPossibilities) {
-            List<EndpointDescription> endpoints = importPossibilities.get(filter);
-            if (endpoints != null) {
-                endpoints.remove(endpoint);
-                if (endpoints.isEmpty()) {
-                    importPossibilities.remove(filter);
-                }
-            }
-        }
-    }
-
-    public void add(RemoteServiceAdmin rsa) {
-        rsaSet.add(rsa);
-        synchronized (importPossibilities) {
-            for (String filter : importPossibilities.keySet()) {
-                triggerImport(filter);
-            }
-        }
-    }
-    
-    public void remove(RemoteServiceAdmin rsa) {
-        rsaSet.remove(rsa);
-    }
-
-
-    private void triggerImport(final String filter) {
-        LOG.debug("Import of a service for filter {} was queued", filter);
-
-        execService.execute(new Runnable() {
-            public void run() {
-                try {
-                    unexportNotAvailableServices(filter);
-                    importServices(filter);
-                } catch (Exception e) {
-                    LOG.error(e.getMessage(), e);
-                }
-                // Notify EndpointListeners? NO!
-            }
-        });
-    }
-
-    private void unexportNotAvailableServices(String filter) {
-        synchronized (importedServices) {
-            List<ImportRegistration> importRegistrations = importedServices.get(filter);
-            if (importRegistrations != null) {
-                // iterate over a copy
-                for (ImportRegistration ir : new ArrayList<ImportRegistration>(importRegistrations)) {
-                    EndpointDescription endpoint = ir.getImportReference().getImportedEndpoint();
-                    if (!isImportPossibilityAvailable(endpoint, filter)) {
-                        removeImport(ir, null); // also unexports the service
-                    }
-                }
-            }
-        }
-    }
-
-    private boolean isImportPossibilityAvailable(EndpointDescription endpoint, String filter) {
-        synchronized (importPossibilities) {
-            List<EndpointDescription> endpoints = importPossibilities.get(filter);
-            return endpoints != null && endpoints.contains(endpoint);
-        }
-    }
-
-    // return a copy to prevent sync issues
-    private List<EndpointDescription> getImportPossibilitiesCopy(String filter) {
-        synchronized (importPossibilities) {
-            List<EndpointDescription> possibilities = importPossibilities.get(filter);
-            return possibilities == null
-                ? Collections.<EndpointDescription>emptyList()
-                : new ArrayList<EndpointDescription>(possibilities);
-        }
-    }
-
-    private void importServices(String filter) {
-        synchronized (importedServices) {
-            List<ImportRegistration> importRegistrations = importedServices.get(filter);
-            for (EndpointDescription endpoint : getImportPossibilitiesCopy(filter)) {
-                // TODO but optional: if the service is already imported and the endpoint is still
-                // in the list of possible imports check if a "better" endpoint is now in the list
-                if (!alreadyImported(endpoint, importRegistrations)) {
-                    // service not imported yet -> import it now
-                    ImportRegistration ir = importService(endpoint);
-                    if (ir != null) {
-                        // import was successful
-                        if (importRegistrations == null) {
-                            importRegistrations = new ArrayList<ImportRegistration>();
-                            importedServices.put(filter, importRegistrations);
-                        }
-                        importRegistrations.add(ir);
-                        if (!importAllAvailable) {
-                            return;
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    private boolean alreadyImported(EndpointDescription endpoint, List<ImportRegistration> importRegistrations) {
-        if (importRegistrations != null) {
-            for (ImportRegistration ir : importRegistrations) {
-                if (endpoint.equals(ir.getImportReference().getImportedEndpoint())) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Tries to import the service with each rsa until one import is successful
-     *
-     * @param endpoint endpoint to import
-     * @return import registration of the first successful import
-     */
-    private ImportRegistration importService(EndpointDescription endpoint) {
-        for (RemoteServiceAdmin rsa : rsaSet) {
-            ImportRegistration ir = rsa.importService(endpoint);
-            if (ir != null) {
-                if (ir.getException() == null) {
-                    LOG.debug("Service import was successful {}", ir);
-                    return ir;
-                } else {
-                    LOG.info("Error importing service " + endpoint, ir.getException());
-                }
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Remove and close (unexport) the given import. The import is specified either
-     * by its ImportRegistration or by its ImportReference (only one of them must
-     * be specified).
-     * <p>
-     * If this method is called from within iterations on the underlying data structure,
-     * the iterations must be made on copies of the structures rather than the original
-     * references in order to prevent ConcurrentModificationExceptions.
-     *
-     * @param reg the import registration to remove
-     * @param ref the import reference to remove
-     */
-    private void removeImport(ImportRegistration reg, ImportReference ref) {
-        // this method may be called recursively by calling ImportRegistration.close()
-        // and receiving a RemoteServiceAdminEvent for its unregistration, which results
-        // in a ConcurrentModificationException. We avoid this by closing the registrations
-        // only after data structure manipulation is done, and being re-entrant.
-        synchronized (importedServices) {
-            List<ImportRegistration> removed = new ArrayList<ImportRegistration>();
-            for (Iterator<List<ImportRegistration>> it1 = importedServices.values().iterator(); it1.hasNext();) {
-                Collection<ImportRegistration> irs = it1.next();
-                for (Iterator<ImportRegistration> it2 = irs.iterator(); it2.hasNext();) {
-                    ImportRegistration ir = it2.next();
-                    if (ir.equals(reg) || ir.getImportReference().equals(ref)) {
-                        removed.add(ir);
-                        it2.remove();
-                    }
-                }
-                if (irs.isEmpty()) {
-                    it1.remove();
-                }
-            }
-            for (ImportRegistration ir : removed) {
-                ir.close();
-            }
-        }
-    }
-
-    public void remoteAdminEvent(RemoteServiceAdminEvent event) {
-        if (event.getType() == RemoteServiceAdminEvent.IMPORT_UNREGISTRATION) {
-            removeImport(null, event.getImportReference());
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/ActivatorTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/ActivatorTest.java b/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/ActivatorTest.java
deleted file mode 100644
index 100e3a3..0000000
--- a/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/ActivatorTest.java
+++ /dev/null
@@ -1,68 +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.topologymanager;
-
-import org.apache.cxf.dosgi.topologymanager.exporter.DefaultExportPolicy;
-import org.apache.cxf.dosgi.topologymanager.exporter.TopologyManagerExport;
-import org.easymock.Capture;
-import org.easymock.EasyMock;
-import org.easymock.IAnswer;
-import org.easymock.IMocksControl;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceReference;
-
-public class ActivatorTest {
-
-    @Test
-    public void testStart() throws Exception {
-        IMocksControl c = EasyMock.createNiceControl();
-        BundleContext context = c.createMock(BundleContext.class);
-        EasyMock.expect(context.getProperty(Constants.FRAMEWORK_UUID)).andReturn("myid");
-        context.addServiceListener(EasyMock.isA(TopologyManagerExport.class));
-        EasyMock.expectLastCall();
-        final Capture<String> filter = EasyMock.newCapture();
-        EasyMock.expect(context.createFilter(EasyMock.capture(filter)))
-            .andAnswer(new IAnswer<Filter>() {
-                public Filter answer() throws Throwable {
-                    return FrameworkUtil.createFilter(filter.getValue());
-                }
-            }).times(2);
-        ServiceReference<?> sref = c.createMock(ServiceReference.class);
-        Bundle bundle = c.createMock(Bundle.class);
-        EasyMock.expect(sref.getBundle()).andReturn(bundle).anyTimes();
-        EasyMock.expect(context.getServiceReferences((String)null, Activator.DOSGI_SERVICES))
-            .andReturn(new ServiceReference[]{sref});
-
-        c.replay();
-        Activator activator = new Activator();
-        activator.doStart(context, new DefaultExportPolicy());
-        c.verify();
-        
-        c.reset();
-        c.replay();
-        activator.doStop(context);
-        c.verify();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/exporter/EndpointListenerNotifierTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/exporter/EndpointListenerNotifierTest.java b/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/exporter/EndpointListenerNotifierTest.java
deleted file mode 100644
index 04bd017..0000000
--- a/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/exporter/EndpointListenerNotifierTest.java
+++ /dev/null
@@ -1,160 +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.topologymanager.exporter;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Dictionary;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.easymock.EasyMock;
-import org.junit.Assert;
-import org.junit.Test;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-
-@SuppressWarnings({
-    "rawtypes", "unchecked"
-   })
-public class EndpointListenerNotifierTest {
-
-    @Test
-    public void testNotifyListener() throws InvalidSyntaxException {
-        EndpointDescription endpoint1 = createEndpoint("myClass");
-        EndpointDescription endpoint2 = createEndpoint("notMyClass");
-
-        // Expect listener to be called for endpoint1 but not for endpoint2 
-        EndpointListener epl = listenerExpects(endpoint1, "(objectClass=myClass)");
-
-        EndpointRepository exportRepository = new EndpointRepository();
-        EndpointListenerNotifier tm = new EndpointListenerNotifier(exportRepository);
-
-        EasyMock.replay(epl);
-        Set<Filter> filters = new HashSet<Filter>();
-        filters.add(FrameworkUtil.createFilter("(objectClass=myClass)"));
-        tm.add(epl, filters);
-        tm.endpointAdded(endpoint1, null);
-        tm.endpointAdded(endpoint2, null);
-        tm.endpointRemoved(endpoint1, null);
-        tm.endpointRemoved(endpoint2, null);
-        EasyMock.verify(epl);
-    }
-
-    private EndpointListener listenerExpects(EndpointDescription endpoint, String filter) {
-        EndpointListener epl = EasyMock.createStrictMock(EndpointListener.class);
-        epl.endpointAdded(EasyMock.eq(endpoint), EasyMock.eq(filter));
-        EasyMock.expectLastCall().once();
-        epl.endpointRemoved(EasyMock.eq(endpoint), EasyMock.eq(filter));
-        EasyMock.expectLastCall().once();
-        return epl;
-    }
-    
-    @Test
-    public void testNotifyListeners() throws InvalidSyntaxException {
-        EndpointDescription endpoint1 = createEndpoint("myClass");
-        
-        EndpointListener epl = EasyMock.createStrictMock(EndpointListener.class);
-        epl.endpointAdded(EasyMock.eq(endpoint1), EasyMock.eq("(objectClass=myClass)"));
-        EasyMock.expectLastCall().once();
-        epl.endpointRemoved(EasyMock.eq(endpoint1), EasyMock.eq("(objectClass=myClass)"));
-        EasyMock.expectLastCall().once();
-
-        EndpointRepository exportRepository = new EndpointRepository();
-        EndpointListenerNotifier tm = new EndpointListenerNotifier(exportRepository);
-
-        EasyMock.replay(epl);
-        Set<Filter> filters = new HashSet<Filter>();
-        filters.add(FrameworkUtil.createFilter("(objectClass=myClass)"));
-        tm.add(epl, filters);
-        tm.endpointAdded(endpoint1, null);
-        tm.endpointRemoved(endpoint1, null);
-        tm.remove(epl);
-        EasyMock.verify(epl);
-    }
-    
-    public EndpointDescription createEndpoint(String iface) {
-        Map<String, Object> props = new Hashtable<String, Object>(); 
-        props.put("objectClass", new String[]{iface});
-        props.put(RemoteConstants.ENDPOINT_ID, iface);
-        props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, "any");
-        return new EndpointDescription(props);
-    }
-
-    @Test
-    public void testNormalizeScopeForSingleString() {
-        ServiceReference sr = createListenerServiceWithFilter("(myProp=A)");
-        Set<Filter> res = EndpointListenerNotifier.getFiltersFromEndpointListenerScope(sr);
-        assertEquals(1, res.size());
-        Filter filter = res.iterator().next();
-        filterMatches(filter);
-    }
-
-    @Test
-    public void testNormalizeScopeForStringArray() {
-        String[] filters = {"(myProp=A)", "(otherProp=B)"};
-        ServiceReference sr = createListenerServiceWithFilter(filters); 
-        Set<Filter> res = EndpointListenerNotifier.getFiltersFromEndpointListenerScope(sr);
-        assertEquals(filters.length, res.size());
-        Iterator<Filter> it = res.iterator();
-        Filter filter1 = it.next();
-        Filter filter2 = it.next();
-        Dictionary<String, String> props = new Hashtable();
-        props.put("myProp", "A");
-        assertThat(filter1.match(props) || filter2.match(props), is(true));
-    }
-
-    @Test
-    public void testNormalizeScopeForCollection() {
-        Collection<String> collection = Arrays.asList("(myProp=A)", "(otherProp=B)");
-        ServiceReference sr = createListenerServiceWithFilter(collection);
-        Set<Filter> res = EndpointListenerNotifier.getFiltersFromEndpointListenerScope(sr);
-        Iterator<Filter> it = res.iterator();
-        Filter filter1 = it.next();
-        Filter filter2 = it.next();
-        Dictionary<String, String> props = new Hashtable();
-        props.put("myProp", "A");
-        Assert.assertThat(filter1.match(props) || filter2.match(props), is(true));
-    }
-    
-    private void filterMatches(Filter filter) {
-        Dictionary<String, String> props = new Hashtable();
-        props.put("myProp", "A");
-        Assert.assertTrue("Filter should match", filter.match(props));
-    }
-
-    private ServiceReference createListenerServiceWithFilter(Object filters) {
-        ServiceReference sr = EasyMock.createMock(ServiceReference.class);
-        EasyMock.expect(sr.getProperty(EndpointListener.ENDPOINT_LISTENER_SCOPE)).andReturn(filters);
-        EasyMock.replay(sr);
-        return sr;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/exporter/EndpointRepositoryTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/exporter/EndpointRepositoryTest.java b/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/exporter/EndpointRepositoryTest.java
deleted file mode 100644
index cb07f43..0000000
--- a/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/exporter/EndpointRepositoryTest.java
+++ /dev/null
@@ -1,82 +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.topologymanager.exporter;
-
-import java.util.Arrays;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
-
-public class EndpointRepositoryTest {
-
-    @Test
-    public void testAddRemove() throws InvalidSyntaxException {
-        EndpointDescription ep1 = createEndpoint("my");
-        
-        IMocksControl c = EasyMock.createControl();
-        ServiceReference<?> sref = createService(c);
-        RemoteServiceAdmin rsa = c.createMock(RemoteServiceAdmin.class);
-        EndpointListener notifier = c.createMock(EndpointListener.class);
-        
-        notifier.endpointAdded(ep1, null);
-        EasyMock.expectLastCall();
-        
-        c.replay();
-        EndpointRepository repo = new EndpointRepository();
-        repo.setNotifier(notifier);
-        List<EndpointDescription> endpoints = Arrays.asList(ep1);
-        repo.addEndpoints(sref, rsa, endpoints);
-        c.verify();
-
-        c.reset();
-        notifier.endpointRemoved(ep1, null);
-        EasyMock.expectLastCall();
-
-        c.replay();
-        repo.removeRemoteServiceAdmin(rsa);
-        c.verify();
-    }
-
-    private ServiceReference<?> createService(IMocksControl c) {
-        ServiceReference<?> sref = c.createMock(ServiceReference.class);
-        Bundle bundle = c.createMock(Bundle.class);
-        EasyMock.expect(bundle.getSymbolicName()).andReturn("myBundle");
-        EasyMock.expect(sref.getBundle()).andReturn(bundle);
-        return sref;
-    }
-
-    public EndpointDescription createEndpoint(String iface) {
-        Map<String, Object> props = new Hashtable<String, Object>(); 
-        props.put("objectClass", new String[]{iface});
-        props.put(RemoteConstants.ENDPOINT_ID, iface);
-        props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, "any");
-        return new EndpointDescription(props);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/exporter/TopologyManagerExportTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/exporter/TopologyManagerExportTest.java b/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/exporter/TopologyManagerExportTest.java
deleted file mode 100644
index 0eda150..0000000
--- a/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/exporter/TopologyManagerExportTest.java
+++ /dev/null
@@ -1,153 +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.topologymanager.exporter;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.Executor;
-
-import org.apache.cxf.dosgi.dsw.api.ExportPolicy;
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-import org.osgi.service.remoteserviceadmin.ExportReference;
-import org.osgi.service.remoteserviceadmin.ExportRegistration;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
-
-import static org.easymock.EasyMock.expectLastCall;
-
-@SuppressWarnings({"rawtypes", "unchecked"})
-public class TopologyManagerExportTest {
-
-    /**
-     * This tests if the topology manager handles a service marked to be exported correctly by exporting it to
-     * an available RemoteServiceAdmin and notifying an EndpointListener afterwards.
-     *
-     * @throws Exception
-     */
-    @Test
-    public void testServiceExportUnexport() throws Exception {
-        IMocksControl c = EasyMock.createControl();
-        RemoteServiceAdmin rsa = c.createMock(RemoteServiceAdmin.class);
-        final EndpointListener notifier = c.createMock(EndpointListener.class);
-        final ServiceReference sref = createUserService(c);
-        EndpointDescription epd = createEndpoint();
-        expectServiceExported(c, rsa, notifier, sref, epd);
-        
-        c.replay();
-        EndpointRepository endpointRepo = new EndpointRepository();
-        endpointRepo.setNotifier(notifier);
-        Executor executor = syncExecutor();
-        ExportPolicy policy = new DefaultExportPolicy();
-        TopologyManagerExport exportManager = new TopologyManagerExport(endpointRepo, executor, policy);
-        exportManager.add(rsa);
-        exportManager.serviceChanged(new ServiceEvent(ServiceEvent.REGISTERED, sref));
-        c.verify();
-        
-        c.reset();
-        notifier.endpointRemoved(epd, null);
-        expectLastCall().once();
-        c.replay();
-        exportManager.serviceChanged(new ServiceEvent(ServiceEvent.UNREGISTERING, sref));
-        c.verify();
-        
-        c.reset();
-        c.replay();
-        exportManager.serviceChanged(new ServiceEvent(ServiceEvent.MODIFIED, sref));
-        c.verify();
-        
-        c.reset();
-        c.replay();
-        exportManager.remove(rsa);
-        c.verify();
-    }
-
-    @Test
-    public void testExportExisting() throws Exception {
-        IMocksControl c = EasyMock.createControl();
-        RemoteServiceAdmin rsa = c.createMock(RemoteServiceAdmin.class);
-        final EndpointListenerNotifier mockEpListenerNotifier = c.createMock(EndpointListenerNotifier.class);
-        final ServiceReference sref = createUserService(c);
-        expectServiceExported(c, rsa, mockEpListenerNotifier, sref, createEndpoint());
-        c.replay();
-
-        EndpointRepository endpointRepo = new EndpointRepository();
-        endpointRepo.setNotifier(mockEpListenerNotifier);
-        ExportPolicy policy = new DefaultExportPolicy();
-        TopologyManagerExport exportManager = new TopologyManagerExport(endpointRepo, syncExecutor(), policy);
-        exportManager.serviceChanged(new ServiceEvent(ServiceEvent.REGISTERED, sref));
-        exportManager.add(rsa);
-        c.verify();
-    }
-
-    private void expectServiceExported(IMocksControl c, RemoteServiceAdmin rsa,
-                                       final EndpointListener listener,
-                                       final ServiceReference sref, EndpointDescription epd) {
-        ExportRegistration exportRegistration = createExportRegistration(c, epd);
-        EasyMock.expect(rsa.exportService(EasyMock.same(sref), (Map<String, Object>)EasyMock.anyObject()))
-            .andReturn(Collections.singletonList(exportRegistration)).once();
-        listener.endpointAdded(epd, null); 
-        EasyMock.expectLastCall().once();
-    }
-
-    private Executor syncExecutor() {
-        return new Executor() {
-            @Override
-            public void execute(Runnable command) {
-                command.run();
-            }
-        };
-    }
-
-    private ExportRegistration createExportRegistration(IMocksControl c, EndpointDescription endpoint) {
-        ExportRegistration exportRegistration = c.createMock(ExportRegistration.class);
-        ExportReference exportReference = c.createMock(ExportReference.class);
-        EasyMock.expect(exportRegistration.getExportReference()).andReturn(exportReference).anyTimes();
-        EasyMock.expect(exportRegistration.getException()).andReturn(null).anyTimes();
-        EasyMock.expect(exportReference.getExportedEndpoint()).andReturn(endpoint).anyTimes();
-        return exportRegistration;
-    }
-
-    private EndpointDescription createEndpoint() {
-        Map<String, Object> props = new HashMap<String, Object>();
-        props.put(RemoteConstants.ENDPOINT_ID, "1");
-        props.put(Constants.OBJECTCLASS, new String[] {"abc"});
-        props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, "cxf");
-        return new EndpointDescription(props);
-    }
-
-    private ServiceReference createUserService(IMocksControl c) {
-        final ServiceReference sref = c.createMock(ServiceReference.class);
-        EasyMock.expect(sref.getProperty(EasyMock.same(RemoteConstants.SERVICE_EXPORTED_INTERFACES)))
-            .andReturn("*").anyTimes();
-        Bundle srefBundle = c.createMock(Bundle.class);
-        EasyMock.expect(sref.getBundle()).andReturn(srefBundle).atLeastOnce();
-        EasyMock.expect(sref.getProperty("objectClass")).andReturn("org.My").anyTimes();
-        EasyMock.expect(srefBundle.getSymbolicName()).andReturn("serviceBundleName").atLeastOnce();
-        return sref;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/importer/EndpointListenerImplTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/importer/EndpointListenerImplTest.java b/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/importer/EndpointListenerImplTest.java
deleted file mode 100644
index c736197..0000000
--- a/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/importer/EndpointListenerImplTest.java
+++ /dev/null
@@ -1,111 +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.topologymanager.importer;
-
-import java.util.Dictionary;
-import java.util.List;
-
-import org.easymock.EasyMock;
-import org.easymock.IAnswer;
-import org.easymock.IMocksControl;
-import org.junit.Assert;
-import org.junit.Test;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-
-public class EndpointListenerImplTest extends Assert {
-
-    int testCase;
-
-    @SuppressWarnings({
-     "rawtypes", "unchecked"
-    })
-    @Test
-    public void testScopeChange() {
-        IMocksControl c = EasyMock.createNiceControl();
-        BundleContext bc = c.createMock(BundleContext.class);
-        TopologyManagerImport tm = c.createMock(TopologyManagerImport.class);
-        ServiceRegistration sr = c.createMock(ServiceRegistration.class);
-
-        // expect Listener registration
-        EasyMock.expect(bc.registerService(EasyMock.anyObject(Class.class),
-                                           EasyMock.anyObject(),
-                                           (Dictionary)EasyMock.anyObject())).andReturn(sr).atLeastOnce();
-
-        sr.setProperties((Dictionary)EasyMock.anyObject());
-
-        // expect property changes based on later calls
-        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
-
-            public Object answer() throws Throwable {
-                Object[] args = EasyMock.getCurrentArguments();
-                Dictionary props = (Dictionary)args[0];
-                List<String> scope = (List<String>)props.get(EndpointListener.ENDPOINT_LISTENER_SCOPE);
-                switch (testCase) {
-                case 1:
-                    assertEquals(1, scope.size());
-                    assertEquals("(a=b)", scope.get(0));
-                    break;
-                case 2:
-                    assertEquals(0, scope.size());
-                    break;
-                case 3:
-                    assertEquals("adding entry to empty list failed", 1, scope.size());
-                    assertEquals("(a=b)", scope.get(0));
-                    break;
-                case 4:
-                    assertEquals("adding second entry failed", 2, scope.size());
-                    assertNotNull(scope.contains("(a=b)"));
-                    assertNotNull(scope.contains("(c=d)"));
-                    break;
-                case 5:
-                    assertEquals("remove failed", 1, scope.size());
-                    assertEquals("(c=d)", scope.get(0));
-                    break;
-                default:
-                    assertTrue("This should not happen!", false);
-                }
-                return null;
-            }
-        }).atLeastOnce();
-
-        c.replay();
-
-        EndpointListenerManager endpointListener = new EndpointListenerManager(bc, tm);
-
-        endpointListener.start();
-
-        testCase = 1;
-        endpointListener.extendScope("(a=b)");
-        testCase = 2;
-        endpointListener.reduceScope("(a=b)");
-
-        testCase = 3;
-        endpointListener.extendScope("(a=b)");
-        testCase = 4;
-        endpointListener.extendScope("(c=d)");
-        testCase = 5;
-        endpointListener.reduceScope("(a=b)");
-
-        endpointListener.stop();
-
-        c.verify();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/importer/ListenerHookImplTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/importer/ListenerHookImplTest.java b/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/importer/ListenerHookImplTest.java
deleted file mode 100644
index 1e2f90c..0000000
--- a/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/importer/ListenerHookImplTest.java
+++ /dev/null
@@ -1,89 +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.topologymanager.importer;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-import org.junit.Test;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.hooks.service.ListenerHook.ListenerInfo;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-public class ListenerHookImplTest {
-
-    @Test
-    public void testExtendFilter() throws InvalidSyntaxException {
-        String filter = "(a=b)";
-        BundleContext bc = createBundleContext();
-        filter = new ListenerHookImpl(bc, null).extendFilter(filter);
-
-        Filter f = FrameworkUtil.createFilter(filter);
-
-        Dictionary<String, String> m = new Hashtable<String, String>();
-        m.put("a", "b");
-        assertTrue(filter + " filter must match as uuid is missing", f.match(m));
-        m.put(RemoteConstants.ENDPOINT_FRAMEWORK_UUID, "MyUUID");
-        assertFalse(filter + " filter must NOT match as uuid is the local one", f.match(m));
-    }
-    
-    @Test
-    public void testAddedRemoved() throws InvalidSyntaxException {
-        IMocksControl c = EasyMock.createControl();
-        String filter = "(objectClass=My)";
-        BundleContext bc = createBundleContext();
-        BundleContext listenerBc = createBundleContext();
-        ServiceInterestListener serviceInterestListener = c.createMock(ServiceInterestListener.class);
-        ListenerHookImpl listenerHook = new ListenerHookImpl(bc, serviceInterestListener);
-
-        ListenerInfo listener = c.createMock(ListenerInfo.class);
-        EasyMock.expect(listener.getBundleContext()).andReturn(listenerBc);
-        EasyMock.expect(listener.getFilter()).andReturn(filter).atLeastOnce();
-        
-        // Main assertions
-        serviceInterestListener.addServiceInterest(listenerHook.extendFilter(filter));
-        EasyMock.expectLastCall();
-        serviceInterestListener.removeServiceInterest(listenerHook.extendFilter(filter));
-        EasyMock.expectLastCall();
-
-        Collection<ListenerInfo> listeners = Collections.singletonList(listener);
-        
-        c.replay();
-        listenerHook.added(listeners);
-        listenerHook.removed(listeners);
-        c.verify();
-    }
-
-    private BundleContext createBundleContext() {
-        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-        EasyMock.expect(bc.getProperty(EasyMock.eq("org.osgi.framework.uuid"))).andReturn("MyUUID").atLeastOnce();
-        EasyMock.replay(bc);
-        return bc;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/importer/ReferenceCounterTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/importer/ReferenceCounterTest.java b/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/importer/ReferenceCounterTest.java
deleted file mode 100644
index 3ab78db..0000000
--- a/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/importer/ReferenceCounterTest.java
+++ /dev/null
@@ -1,42 +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.topologymanager.importer;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class ReferenceCounterTest {
-
-    @Test
-    public void testCounter() {
-        ReferenceCounter<String> counter = new ReferenceCounter<String>();
-        assertEquals(-1, counter.remove("a"));
-        assertEquals(-1, counter.remove("a"));
-        assertEquals(1, counter.add("a"));
-        assertEquals(2, counter.add("a"));
-        assertEquals(3, counter.add("a"));
-        assertEquals(2, counter.remove("a"));
-        assertEquals(1, counter.remove("a"));
-        assertEquals(2, counter.add("a"));
-        assertEquals(1, counter.remove("a"));
-        assertEquals(0, counter.remove("a"));
-        assertEquals(-1, counter.remove("a"));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/importer/TopologyManagerImportTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/importer/TopologyManagerImportTest.java b/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/importer/TopologyManagerImportTest.java
deleted file mode 100644
index 00be969..0000000
--- a/dsw/cxf-topology-manager/src/test/java/org/apache/cxf/dosgi/topologymanager/importer/TopologyManagerImportTest.java
+++ /dev/null
@@ -1,87 +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.topologymanager.importer;
-
-import java.util.Dictionary;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-
-import org.easymock.EasyMock;
-import org.easymock.IAnswer;
-import org.easymock.IMocksControl;
-import org.junit.Test;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.ImportReference;
-import org.osgi.service.remoteserviceadmin.ImportRegistration;
-import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
-
-import static org.junit.Assert.assertTrue;
-
-public class TopologyManagerImportTest {
-
-    @SuppressWarnings({
-     "rawtypes", "unchecked"
-    })
-    @Test
-    public void testImportForNewlyAddedRSA() throws InterruptedException {
-        IMocksControl c = EasyMock.createControl();
-
-        c.makeThreadSafe(true);
-
-        final Semaphore sema = new Semaphore(0);
-
-        ServiceRegistration sreg = c.createMock(ServiceRegistration.class);
-        sreg.unregister();
-        EasyMock.expectLastCall().once();
-        
-        BundleContext bc = c.createMock(BundleContext.class);
-        EasyMock.expect(bc.registerService(EasyMock.anyObject(Class.class),
-                                           EasyMock.anyObject(),
-                                           (Dictionary)EasyMock.anyObject())).andReturn(sreg).anyTimes();
-        EasyMock.expect(bc.getProperty(Constants.FRAMEWORK_UUID)).andReturn("myid");
-
-        EndpointDescription endpoint = c.createMock(EndpointDescription.class);
-        RemoteServiceAdmin rsa = c.createMock(RemoteServiceAdmin.class);
-        final ImportRegistration ireg = c.createMock(ImportRegistration.class);
-        EasyMock.expect(ireg.getException()).andReturn(null).anyTimes();
-        ImportReference iref = c.createMock(ImportReference.class);
-        EasyMock.expect(ireg.getImportReference()).andReturn(iref).anyTimes();
-        EasyMock.expect(iref.getImportedEndpoint()).andReturn(endpoint).anyTimes();
-
-        EasyMock.expect(rsa.importService(EasyMock.eq(endpoint))).andAnswer(new IAnswer<ImportRegistration>() {
-            public ImportRegistration answer() throws Throwable {
-                sema.release();
-                return ireg;
-            }
-        }).once();
-        c.replay();
-
-        TopologyManagerImport tm = new TopologyManagerImport(bc);
-        tm.start();
-        tm.endpointAdded(endpoint, "myFilter");
-        tm.add(rsa);
-        assertTrue("rsa.ImportService should have been called",
-                   sema.tryAcquire(100, TimeUnit.SECONDS));
-        tm.stop();
-        c.verify();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/pom.xml
----------------------------------------------------------------------
diff --git a/dsw/pom.xml b/dsw/pom.xml
deleted file mode 100644
index 375d8fc..0000000
--- a/dsw/pom.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version='1.0' encoding='UTF-8' ?>
-<!--
-  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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>cxf-dosgi-ri-dsw</artifactId>
-    <packaging>pom</packaging>
-    <name>Distributed OSGI Distributed Software Modules</name>
-    <url>http://cxf.apache.org</url>
-
-    <parent>
-      <groupId>org.apache.cxf.dosgi</groupId>
-      <artifactId>cxf-dosgi-ri-parent</artifactId>
-      <version>1.8-SNAPSHOT</version>
-      <relativePath>../parent/pom.xml</relativePath>
-    </parent>
-
-    <properties>
-      <topDirectoryLocation>..</topDirectoryLocation>
-    </properties>
-
-    <modules>
-      <module>cxf-topology-manager</module>
-      <module>cxf-dosgi-provider-api</module>
-      <module>cxf-dosgi-rsa</module>
-      <module>cxf-dsw</module>
-      <module>cxf-dosgi-tcp</module>
-    </modules>
-</project>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/osgi-api/pom.xml
----------------------------------------------------------------------
diff --git a/osgi-api/pom.xml b/osgi-api/pom.xml
deleted file mode 100644
index 6a123eb..0000000
--- a/osgi-api/pom.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version='1.0' encoding='UTF-8' ?>
-<!--
-  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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>cxf-dosgi-ri-osgi-api</artifactId>
-    <packaging>bundle</packaging>
-    <name>CXF dOSGi Required OSGi Compendium APIs</name>
-    <description>The minimal set of OSGi Compendium APIs required by DOSGi</description>
-    <!--
-        This bundle should be deployed instead of the full OSGi Compendium bundle to prevent issues
-        caused by multiple exports of other OSGi APIs that are not used by DOSGi. See DOSGI-208.
-    -->
-
-    <parent>
-        <groupId>org.apache.cxf.dosgi</groupId>
-        <artifactId>cxf-dosgi-ri-parent</artifactId>
-        <version>1.8-SNAPSHOT</version>
-        <relativePath>../parent/pom.xml</relativePath>
-    </parent>
-
-    <properties>
-        <!-- the minimal set of OSGi Compendium packages that is required for DOSGi to run -->
-        <required-packages>org.osgi.service.remoteserviceadmin,org.osgi.service.event</required-packages>
-    </properties>
-    
-    <dependencies>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-            <scope>provided</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <configuration>
-                    <instructions>
-                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
-                        <!-- we must both import and export to prevent trouble if another bundle exports them too -->
-                        <Import-Package>${required-packages},*</Import-Package>
-                        <Export-Package>${required-packages}</Export-Package>
-                        <!-- embed the packages in this bundle -->
-                        <Private-Package>${required-packages}</Private-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index ea56f96..cf58737 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -173,6 +173,9 @@
                     <artifactId>maven-bundle-plugin</artifactId>
                     <version>${felix.plugin.version}</version>
                     <extensions>true</extensions>
+                    <configuration>
+                        <obrRepository>NONE</obrRepository>
+                    </configuration>
                 </plugin>
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 039c837..d5c2fa4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -102,11 +102,8 @@
 
     <modules>
         <module>parent</module>
-        <module>felix</module>
-        <module>dsw</module>
-        <module>discovery</module>
+        <module>cxf-dsw</module>
         <module>samples</module>
-        <module>osgi-api</module>
         <module>distribution</module>
         <module>systests2</module>
     </modules>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/systests2/multi-bundle/pom.xml
----------------------------------------------------------------------
diff --git a/systests2/multi-bundle/pom.xml b/systests2/multi-bundle/pom.xml
index baa9d01..f1efaff 100644
--- a/systests2/multi-bundle/pom.xml
+++ b/systests2/multi-bundle/pom.xml
@@ -130,12 +130,6 @@
             </exclusions>
         </dependency>
         <dependency>
-            <groupId>org.apache.cxf.dosgi</groupId>
-            <artifactId>cxf-dosgi-ri-discovery-distributed-zookeeper-server</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>org.apache.cxf.dosgi.samples</groupId>
             <artifactId>cxf-dosgi-ri-samples-greeter-impl</artifactId>
             <version>${project.version}</version>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/tck/apply-to-tck.sh.template
----------------------------------------------------------------------
diff --git a/tck/apply-to-tck.sh.template b/tck/apply-to-tck.sh.template
deleted file mode 100755
index b6d4455..0000000
--- a/tck/apply-to-tck.sh.template
+++ /dev/null
@@ -1,15 +0,0 @@
-#This script pretends the current build to be the same as the version in the R5 TCK repo.
-#This puts the wrong version numbers on the files copied to the repo, so it could be improved
-#but it keeps changes to a minimum.
-#
-#Run this script before executing the CT tests to get the CT tests to run with the current CXF DOSGi build
-
-TCK_HOME=... the osgi build clone root directory...
-ZOOKEEPER_JAR=... the zookeeper server jar, can be obtained from a zookeeper download...
-cp $ZOOKEEPER_JAR $TCK_HOME/licensed/repo/org.apache.cxf.dosgi.discovery.zookeeper/org.apache.cxf.dosgi.discovery.zookeeper-1.2.0.jar
-
-cp org.osgi.impl.service.remoteserviceadmin-4.3.0.lib $TCK_HOME/cnf/repo/org.osgi.impl.service.remoteserviceadmin
-
-cp ../distribution/single-bundle/target/cxf-dosgi-ri-singlebundle-distribution-1.5-SNAPSHOT.jar $TCK_HOME/licensed/repo/org.apache.cxf.dosgi.singlebundle/org.apache.cxf.dosgi.singlebundle-1.3.1.jar
-cp ../discovery/distributed/zookeeper-server/target/cxf-dosgi-ri-discovery-distributed-zookeeper-server-1.5-SNAPSHOT.jar $TCK_HOME/licensed/repo/org.apache.cxf.dosgi.discovery.server/org.apache.cxf.dosgi.discovery.server-1.2.0.jar
-cp ../discovery/distributed/zookeeper-server-config/target/cxf-dosgi-ri-discovery-distributed-zookeeper-server-config-1.5-SNAPSHOT.jar $TCK_HOME/licensed/repo/org.apache.cxf.dosgi.discovery.server.config/org.apache.cxf.dosgi.discovery.server.config-1.2.0.jar

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/tck/org.osgi.impl.service.remoteserviceadmin-4.3.0.lib
----------------------------------------------------------------------
diff --git a/tck/org.osgi.impl.service.remoteserviceadmin-4.3.0.lib b/tck/org.osgi.impl.service.remoteserviceadmin-4.3.0.lib
deleted file mode 100644
index 66a532c..0000000
--- a/tck/org.osgi.impl.service.remoteserviceadmin-4.3.0.lib
+++ /dev/null
@@ -1,5 +0,0 @@
-org.apache.cxf.dosgi.singlebundle; version=1.3.1
-com.springsource.org.apache.log4j; version=1.2.15
-slf4j.api; version=1.6.1
-slf4j.nop; version=1.6.1
-           


[04/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

Posted by cs...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java
deleted file mode 100644
index 31b1e42..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java
+++ /dev/null
@@ -1,86 +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;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.cxf.dosgi.dsw.Constants;
-import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
-public final class IntentUtils {
-
-    private IntentUtils() {
-        // never constructed
-    }
-
-    public static String[] mergeArrays(String[] a1, String[] a2) {
-        if (a1 == null) {
-            return a2;
-        }
-        if (a2 == null) {
-            return a1;
-        }
-
-        List<String> list = new ArrayList<String>(a1.length + a2.length);
-        Collections.addAll(list, a1);
-        for (String s : a2) {
-            if (!list.contains(s)) {
-                list.add(s);
-            }
-        }
-
-        return list.toArray(new String[list.size()]);
-    }
-
-    public static Set<String> getRequestedIntents(Map<String, Object> sd) {
-        Collection<String> intents = OsgiUtils.getMultiValueProperty(sd.get(RemoteConstants.SERVICE_EXPORTED_INTENTS));
-        Collection<String> intents2
-            = OsgiUtils.getMultiValueProperty(sd.get(RemoteConstants.SERVICE_EXPORTED_INTENTS_EXTRA));
-        @SuppressWarnings("deprecation")
-        Collection<String> oldIntents = OsgiUtils.getMultiValueProperty(sd.get(Constants.EXPORTED_INTENTS_OLD));
-        Set<String> allIntents = new HashSet<String>();
-        if (intents != null) {
-            allIntents.addAll(parseIntents(intents));
-        }
-        if (intents2 != null) {
-            allIntents.addAll(parseIntents(intents2));
-        }
-        if (oldIntents != null) {
-            allIntents.addAll(parseIntents(oldIntents));
-        }
-
-        return allIntents;
-    }
-
-    private static Collection<String> parseIntents(Collection<String> intents) {
-        List<String> parsed = new ArrayList<String>();
-        for (String intent : intents) {
-            parsed.addAll(Arrays.asList(intent.split("[ ]")));
-        }
-        return parsed;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/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
deleted file mode 100644
index 9acd0f0..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java
+++ /dev/null
@@ -1,132 +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.util;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.packageadmin.ExportedPackage;
-import org.osgi.service.packageadmin.PackageAdmin;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("deprecation")
-public final class OsgiUtils {
-
-    public static final Logger LOG = LoggerFactory.getLogger(OsgiUtils.class);
-
-    private OsgiUtils() {
-    }
-
-    public static boolean getBooleanProperty(Map<String, Object> sd, String name) {
-        return toBoolean(sd.get(name));
-    }
-
-    public static boolean toBoolean(Object value) {
-        return value instanceof Boolean && (Boolean) value
-            || value instanceof String && Boolean.parseBoolean((String)value);
-    }
-
-    @SuppressWarnings("unchecked")
-    public static Collection<String> getMultiValueProperty(Object property) {
-        if (property == null) {
-            return null;
-        } else if (property instanceof Collection) {
-            return (Collection<String>)property;
-        } else if (property instanceof String[]) {
-            return Arrays.asList((String[])property);
-        } else {
-            return Collections.singleton(property.toString());
-        }
-    }
-
-    public static String getProperty(EndpointDescription endpoint, String name) {
-        return getProperty(endpoint.getProperties(), name);
-    }
-
-    public static String getProperty(Map<String, Object> dict, String name) {
-        Object value = dict.get(name);
-        return value instanceof String ? (String) value : null;
-    }
-
-    public static String getFirstNonEmptyStringProperty(Map<String, Object> dict, String ... keys) {
-        for (String key : keys) {
-            String value = getProperty(dict, key);
-            if (value != null) {
-                return value;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Tries to retrieve the version of iClass via the PackageAdmin.
-     *
-     * @param iClass tThe interface for which the version should be found
-     * @param bc any valid BundleContext
-     * @return the version of the interface or "0.0.0" if no version information could be found or an error
-     *         occurred during the retrieval
-     */
-    public static String getVersion(Class<?> iClass, BundleContext bc) {
-        ServiceReference<PackageAdmin> paRef = bc.getServiceReference(PackageAdmin.class);
-        if (paRef != null) {
-            PackageAdmin pa = bc.getService(paRef);
-            try {
-                Bundle b = pa.getBundle(iClass);
-                if (b == null) {
-                    LOG.info("Unable to find interface version for interface " + iClass.getName()
-                            + ". Falling back to 0.0.0");
-                    return "0.0.0";
-                }
-                LOG.debug("Interface source bundle: {}", b.getSymbolicName());
-
-                ExportedPackage[] ep = pa.getExportedPackages(b);
-                LOG.debug("Exported Packages of the source bundle: {}", (Object)ep);
-
-                String pack = iClass.getPackage().getName();
-                LOG.debug("Looking for Package: {}", pack);
-                if (ep != null) {
-                    for (ExportedPackage p : ep) {
-                        if (p != null
-                            && pack.equals(p.getName())) {
-                            LOG.debug("found package -> Version: {}", p.getVersion());
-                            return p.getVersion().toString();
-                        }
-                    }
-                }
-            } finally {
-                if (pa != null) {
-                    bc.ungetService(paRef);
-                }
-            }
-        } else {
-            LOG.error("Was unable to obtain the package admin service -> can't resolve interface versions");
-        }
-
-        LOG.info("Unable to find interface version for interface " + iClass.getName()
-                 + ". Falling back to 0.0.0");
-        return "0.0.0";
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/StringPlus.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/StringPlus.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/StringPlus.java
deleted file mode 100644
index dbb4cda..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/StringPlus.java
+++ /dev/null
@@ -1,72 +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.util;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public final class StringPlus {
-
-    private static final Logger LOG = LoggerFactory.getLogger(StringPlus.class);
-
-    private StringPlus() {
-        // never constructed
-    }
-
-    @SuppressWarnings("rawtypes")
-    public static String[] normalize(Object object) {
-        if (object instanceof String) {
-            String s = (String)object;
-            String[] values = s.split(",");
-            List<String> list = new ArrayList<String>();
-            for (String val : values) {
-                String actualValue = val.trim();
-                if (!actualValue.isEmpty()) {
-                    list.add(actualValue);
-                }
-            }
-            return list.toArray(new String[list.size()]);
-        }
-
-        if (object instanceof String[]) {
-            return (String[])object;
-        }
-        
-        if (object instanceof Collection) {
-            Collection col = (Collection)object;
-            List<String> ar = new ArrayList<String>(col.size());
-            for (Object o : col) {
-                if (o instanceof String) {
-                    String s = (String)o;
-                    ar.add(s);
-                } else {
-                    LOG.warn("stringPlus contained non string element in list! Element was skipped");
-                }
-            }
-            return ar.toArray(new String[ar.size()]);
-        }
-
-        return null;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/main/resources/service-decoration.xsd
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/resources/service-decoration.xsd b/dsw/cxf-dsw/src/main/resources/service-decoration.xsd
deleted file mode 100644
index 66e8d30..0000000
--- a/dsw/cxf-dsw/src/main/resources/service-decoration.xsd
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<schema targetNamespace="http://cxf.apache.org/xmlns/service-decoration/1.0.0" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://cxf.apache.org/xmlns/service-decoration/1.0.0">
-    <element name="service-decorations" type="tns:ServiceDecorationsType"></element>
-
-    <complexType name="ServiceDecorationsType">
-        <sequence>
-            <element maxOccurs="unbounded" minOccurs="0"
-                ref="tns:service-decoration">
-            </element>
-        </sequence>
-    </complexType>
-
-    <complexType name="ServiceDecorationType">
-        <sequence>
-            <element maxOccurs="unbounded" minOccurs="0"
-                ref="tns:match">
-            </element>
-        </sequence>
-    </complexType>
-
-    <complexType name="MatchType">
-        <sequence>
-            <element maxOccurs="unbounded" minOccurs="0"
-                ref="tns:match-property">
-            </element>
-            <element maxOccurs="unbounded" minOccurs="0"
-                ref="tns:add-property">
-            </element>
-        </sequence>
-        <attribute name="interface" type="string"></attribute>
-    </complexType>
-
-    <complexType name="MatchPropertyType">
-        <attribute name="name" type="string"></attribute>
-        <attribute name="value" type="string"></attribute>
-    </complexType>
-
-    <complexType name="AddPropertyType">
-        <attribute name="name" type="string"></attribute>
-        <attribute name="value" type="string"></attribute>
-        <attribute name="type" type="string"></attribute>
-    </complexType>
-    <element name="service-decoration"
-        type="tns:ServiceDecorationType">
-    </element>
-    <element name="match" type="tns:MatchType"></element>
-    <element name="match-property" type="tns:MatchPropertyType"></element>
-    <element name="add-property" type="tns:AddPropertyType"></element>
-</schema>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
deleted file mode 100644
index 65e93bc..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
+++ /dev/null
@@ -1,66 +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;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import junit.framework.TestCase;
-
-import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.ServiceRegistration;
-
-public class ActivatorTest extends TestCase {
-
-    private BundleContext getMockBundleContext(IMocksControl control) {
-        Bundle b = control.createMock(Bundle.class);
-        Dictionary<String, String> ht = new Hashtable<String, String>();
-        EasyMock.expect(b.getHeaders()).andReturn(ht).anyTimes();
-        BundleContext bc = control.createMock(BundleContext.class);
-
-        EasyMock.expect(b.getBundleContext()).andReturn(bc).anyTimes();
-        EasyMock.expect(bc.getBundle()).andReturn(b).anyTimes();
-        return bc;
-    }
-
-    @SuppressWarnings({
-     "rawtypes", "unchecked"
-    })
-    public void testCreateAndShutdownRemoteServiceAdminService() throws Exception {
-        IMocksControl control = EasyMock.createNiceControl();
-        BundleContext bc = getMockBundleContext(control);
-        Filter filter = control.createMock(Filter.class);
-        EasyMock.expect(bc.createFilter(EasyMock.<String>anyObject())).andReturn(filter);
-        EasyMock.expectLastCall().atLeastOnce();
-        ServiceRegistration sr = control.createMock(ServiceRegistration.class);
-        EasyMock.expect(bc.registerService(EasyMock.eq(DistributionProvider.class.getName()),
-                                           EasyMock.anyObject(), (Dictionary<String, String>)EasyMock.anyObject()))
-                                           .andReturn(sr).atLeastOnce();
-
-        control.replay();
-        Activator a = new Activator();
-        a.start(bc);
-        control.verify();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/TestUtils.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/TestUtils.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/TestUtils.java
deleted file mode 100644
index b81bf3e..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/TestUtils.java
+++ /dev/null
@@ -1,37 +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;
-
-public final class TestUtils {
-
-//    private TestUtils() {
-//    }
-//
-//    public static ServiceEndpointDescription mockServiceDescription(String... interfaceNames) {
-//        List<String> iList = new ArrayList<String>();
-//        for (String iName : interfaceNames) {
-//            iList.add(iName);
-//        }
-//
-//        ServiceEndpointDescription sd = EasyMock.createNiceMock(ServiceEndpointDescription.class);
-//        sd.getProvidedInterfaces();
-//        EasyMock.expectLastCall().andReturn(iList);
-//        return sd;
-//    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParserTest.java
----------------------------------------------------------------------
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
deleted file mode 100644
index 270c7fa..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParserTest.java
+++ /dev/null
@@ -1,63 +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.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;
-import org.apache.cxf.xmlns.service_decoration._1_0.ServiceDecorationType;
-import org.junit.Assert;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class DecorationParserTest {
-
-    @Test
-    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());
-        ServiceDecorationType decoration = elements.get(0);
-        assertEquals(1, decoration.getMatch().size());
-        MatchType match = decoration.getMatch().get(0);
-        assertEquals("org.acme.foo.*", match.getInterface());
-        assertEquals(1, match.getMatchProperty().size());
-        MatchPropertyType matchProp = match.getMatchProperty().get(0);
-        assertEquals("test.prop", matchProp.getName());
-        assertEquals("xyz", matchProp.getValue());
-        assertEquals(1, match.getAddProperty().size());
-        AddPropertyType addProp = match.getAddProperty().get(0);
-        assertEquals("test.too", addProp.getName());
-        assertEquals("ahaha", addProp.getValue());
-        assertEquals("java.lang.String", addProp.getType());
-    }
-
-    @Test
-    public void testGetDecorationForNull() throws JAXBException, IOException {
-        List<ServiceDecorationType> elements = new DecorationParser().getDecorations(null);
-        Assert.assertEquals(0, elements.size());
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java
----------------------------------------------------------------------
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
deleted file mode 100644
index c66642b..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java
+++ /dev/null
@@ -1,163 +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.decorator;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-import org.easymock.EasyMock;
-import org.easymock.IAnswer;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-
-@SuppressWarnings("rawtypes")
-public class InterfaceRuleTest extends TestCase {
-
-    public void testDUMMY() {
-        assertTrue(true);
-    }
-
-    public void testInterfaceRuleGetBundle() {
-        Bundle b = EasyMock.createMock(Bundle.class);
-        EasyMock.replay(b);
-        InterfaceRule ir = new InterfaceRule(b, "org.apache.Foo");
-        assertSame(b, ir.getBundle());
-    }
-
-    public void testInterfaceRule1() {
-        InterfaceRule ir = new InterfaceRule(null, "org.apache.Foo");
-        ir.addProperty("x", "y", String.class.getName());
-
-        final Map<String, Object> serviceProps = new HashMap<String, Object>();
-        serviceProps.put(Constants.OBJECTCLASS, new String[] {"a.b.C", "org.apache.Foo"});
-        ServiceReference sref = mockServiceReference(serviceProps);
-
-        Map<String, Object> m = new HashMap<String, Object>();
-        m.put("a", "b");
-        ir.apply(sref, m);
-        Map<String, Object> expected = new HashMap<String, Object>();
-        expected.put("a", "b");
-        expected.put("x", "y");
-        assertEquals(expected, m);
-    }
-
-    public void testInterfaceRule2() {
-        InterfaceRule ir = new InterfaceRule(null, "org.apache.F(.*)");
-        ir.addPropMatch("boo", "baah");
-        ir.addProperty("x", "1", Integer.class.getName());
-        ir.addProperty("aaa.bbb", "true", Boolean.class.getName());
-
-        final Map<String, Object> serviceProps = new HashMap<String, Object>();
-        serviceProps.put("boo", "baah");
-        serviceProps.put(Constants.OBJECTCLASS, new String[] {"a.b.C", "org.apache.Foo"});
-        ServiceReference sref = mockServiceReference(serviceProps);
-
-        Map<String, Object> m = new HashMap<String, Object>();
-        ir.apply(sref, m);
-        Map<String, Object> expected = new HashMap<String, Object>();
-        expected.put("x", 1);
-        expected.put("aaa.bbb", Boolean.TRUE);
-        assertEquals(expected, m);
-    }
-
-    public void testInterfaceRule3() {
-        InterfaceRule ir = new InterfaceRule(null, "org.apache.F(.*)");
-        ir.addProperty("x", "y", String.class.getName());
-
-        final Map<String, Object> serviceProps = new HashMap<String, Object>();
-        serviceProps.put("boo", "baah");
-        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.apache.Boo"});
-        ServiceReference sref = mockServiceReference(serviceProps);
-
-        Map<String, Object> m = new HashMap<String, Object>();
-        ir.apply(sref, m);
-        assertEquals(0, m.size());
-    }
-
-    public void testInterfaceRule4() {
-        InterfaceRule ir = new InterfaceRule(null, "org.apache.F(.*)");
-        ir.addPropMatch("boo", "baah");
-        ir.addProperty("x", "y", String.class.getName());
-
-        final Map<String, Object> serviceProps = new HashMap<String, Object>();
-        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.apache.Foo"});
-        ServiceReference sref = mockServiceReference(serviceProps);
-
-        Map<String, Object> m = new HashMap<String, Object>();
-        ir.apply(sref, m);
-        assertEquals(0, m.size());
-    }
-
-    public void testInterfaceRule5() {
-        InterfaceRule ir = new InterfaceRule(null, "org.apache.Foo");
-        ir.addPropMatch("test.int", "42");
-        ir.addProperty("x", "1", Long.class.getName());
-
-        final Map<String, Object> serviceProps = new HashMap<String, Object>();
-        serviceProps.put("test.int", 42);
-        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.apache.Foo"});
-        ServiceReference sref = mockServiceReference(serviceProps);
-
-        Map<String, Object> m = new HashMap<String, Object>();
-        m.put("x", "foo");
-        m.put("aaa.bbb", Boolean.TRUE);
-        ir.apply(sref, m);
-        Map<String, Object> expected = new HashMap<String, Object>();
-        expected.put("x", 1L);
-        expected.put("aaa.bbb", Boolean.TRUE);
-        assertEquals(expected, m);
-    }
-
-    public void testInterfaceRule6() {
-        InterfaceRule ir = new InterfaceRule(null, "org.apache.Foo");
-        ir.addPropMatch("test.int", "42");
-        ir.addProperty("x", "1", Long.class.getName());
-
-        final Map<String, Object> serviceProps = new HashMap<String, Object>();
-        serviceProps.put("test.int", 51);
-        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.apache.Foo"});
-        ServiceReference sref = mockServiceReference(serviceProps);
-
-        Map<String, Object> m = new HashMap<String, Object>();
-        m.put("x", "foo");
-        m.put("aaa.bbb", Boolean.TRUE);
-        ir.apply(sref, m);
-        Map<String, Object> expected = new HashMap<String, Object>();
-        expected.put("x", "foo");
-        expected.put("aaa.bbb", Boolean.TRUE);
-        assertEquals(expected, m);
-    }
-
-    private ServiceReference mockServiceReference(final Map<String, Object> serviceProps) {
-        ServiceReference sref = EasyMock.createMock(ServiceReference.class);
-        EasyMock.expect(sref.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
-            public Object answer() throws Throwable {
-                return serviceProps.get(EasyMock.getCurrentArguments()[0]);
-            }
-        }).anyTimes();
-        EasyMock.expect(sref.getPropertyKeys())
-            .andReturn(serviceProps.keySet().toArray(new String[] {})).anyTimes();
-
-        EasyMock.replay(sref);
-        return sref;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorBundleListenerTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorBundleListenerTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorBundleListenerTest.java
deleted file mode 100644
index 1ca33fc..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorBundleListenerTest.java
+++ /dev/null
@@ -1,69 +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.decorator;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.easymock.EasyMock;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-
-import static org.junit.Assert.assertEquals;
-
-public class ServiceDecoratorBundleListenerTest {
-
-    @Test
-    public void testBundleListener() {
-        BundleContext bc = EasyMock.createMock(BundleContext.class);
-        EasyMock.replay(bc);
-
-        final List<String> called = new ArrayList<String>();
-        ServiceDecoratorImpl serviceDecorator = new ServiceDecoratorImpl() {
-            @Override
-            void addDecorations(Bundle bundle) {
-                called.add("addDecorations");
-            }
-
-            @Override
-            void removeDecorations(Bundle bundle) {
-                called.add("removeDecorations");
-            }
-        };
-
-        Bundle b = EasyMock.createMock(Bundle.class);
-        EasyMock.replay(b);
-        
-        ServiceDecoratorBundleListener listener = new ServiceDecoratorBundleListener(serviceDecorator);
-
-        assertEquals("Precondition failed", 0, called.size());
-        listener.bundleChanged(new BundleEvent(BundleEvent.INSTALLED, b));
-        assertEquals(0, called.size());
-
-        listener.bundleChanged(new BundleEvent(BundleEvent.STARTED, b));
-        assertEquals(Arrays.asList("addDecorations"), called);
-
-        listener.bundleChanged(new BundleEvent(BundleEvent.STOPPING, b));
-        assertEquals(Arrays.asList("addDecorations", "removeDecorations"), called);
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/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
deleted file mode 100644
index 400d793..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java
+++ /dev/null
@@ -1,187 +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.decorator;
-
-import java.net.URL;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-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;
-
-public class ServiceDecoratorImplTest extends TestCase {
-    private static final Map<String, Object> EMPTY = new HashMap<String, Object>();
-    private static final URL RES_SD = getResource("/test-resources/sd.xml");
-    private static final URL RES_SD1 = getResource("/test-resources/sd1.xml");
-    private static final URL RES_SD2 = getResource("/test-resources/sd2.xml");
-    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"});
-        serviceProps.put("test.prop", "xyz");
-
-        Bundle b = createBundleContaining(RES_SD);
-        ServiceDecoratorImpl sd = new ServiceDecoratorImpl();
-        assertEquals("Precondition failed", 0, sd.decorations.size());
-        sd.addDecorations(b);
-        assertEquals(1, sd.decorations.size());
-
-        Map<String, Object> target = new HashMap<String, Object>();
-        ServiceReference sref = EasyMock.createMock(ServiceReference.class);
-        EasyMock.expect(sref.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
-            public Object answer() throws Throwable {
-                return serviceProps.get(EasyMock.getCurrentArguments()[0]);
-            }
-        }).anyTimes();
-        EasyMock.replay(sref);
-        sd.decorate(sref, target);
-
-        Map<String, Object> expected = new HashMap<String, Object>();
-        expected.put("test.too", "ahaha");
-        assertEquals(expected, target);
-
-        // remove it again
-        sd.removeDecorations(b);
-        assertEquals(0, sd.decorations.size());
-        Map<String, Object> target2 = new HashMap<String, Object>();
-        sd.decorate(sref, target2);
-        assertEquals(EMPTY, target2);
-    }
-
-    public void testAddDecorations() {
-        final Map<String, Object> serviceProps = new HashMap<String, Object>();
-        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.acme.foo.Bar"});
-        serviceProps.put("test.prop", "xyz");
-
-        Map<String, Object> expected = new HashMap<String, Object>();
-        expected.put("test.too", "ahaha");
-        assertDecorate(serviceProps, expected, RES_SD);
-    }
-
-    public void testAddDecorations1() {
-        Map<String, Object> serviceProps = new HashMap<String, Object>();
-        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.A"});
-
-        Map<String, Object> expected = new HashMap<String, Object>();
-        expected.put("A", "B");
-        expected.put("C", 2);
-        assertDecorate(serviceProps, expected, RES_SD1, RES_SD2);
-    }
-
-    public void testAddDecorations2() {
-        Map<String, Object> serviceProps = new HashMap<String, Object>();
-        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.D"});
-
-        assertDecorate(serviceProps, EMPTY, RES_SD1, RES_SD2);
-    }
-
-    public void testAddDecorations3() {
-        Map<String, Object> serviceProps = new HashMap<String, Object>();
-        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.B"});
-        serviceProps.put("x", "y");
-
-        Map<String, Object> expected = new HashMap<String, Object>();
-        expected.put("bool", Boolean.TRUE);
-        assertDecorate(serviceProps, expected, RES_SD1, RES_SD2);
-    }
-
-    public void testAddDecorations4() {
-        Map<String, Object> serviceProps = new HashMap<String, Object>();
-        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.C"});
-        serviceProps.put("x", "z");
-
-        Map<String, Object> expected = new HashMap<String, Object>();
-        expected.put("bool", Boolean.FALSE);
-        assertDecorate(serviceProps, expected, RES_SD1, RES_SD2);
-    }
-
-    public void testAddDecorations5() {
-        Map<String, Object> serviceProps = new HashMap<String, Object>();
-        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.C"});
-        serviceProps.put("x", "x");
-
-        assertDecorate(serviceProps, EMPTY, RES_SD1, RES_SD2);
-    }
-
-    public void testAddDecorations6() {
-        Map<String, Object> serviceProps = new HashMap<String, Object>();
-        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.D"});
-
-        assertDecorate(serviceProps, EMPTY, RES_SD0);
-    }
-
-    public void testAddDecorations7() {
-        Map<String, Object> serviceProps = new HashMap<String, Object>();
-        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.D"});
-
-        assertDecorate(serviceProps, EMPTY, RES_SD_1);
-    }
-    
-    private void assertDecorate(final Map<String, Object> serviceProps, 
-                                Map<String, Object> expected, URL ... resources) {
-        Map<String, Object> actual = testDecorate(serviceProps, resources);
-        assertEquals(expected, actual);
-    }
-
-    @SuppressWarnings("rawtypes")
-    private Map<String, Object> testDecorate(final Map<String, Object> serviceProps, URL ... resources) {
-        Bundle b = createBundleContaining(resources);
-
-        ServiceDecoratorImpl sd = new ServiceDecoratorImpl();
-        sd.addDecorations(b);
-
-        Map<String, Object> target = new HashMap<String, Object>();
-        ServiceReference sref = EasyMock.createMock(ServiceReference.class);
-        EasyMock.expect(sref.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
-            public Object answer() throws Throwable {
-                return serviceProps.get(EasyMock.getCurrentArguments()[0]);
-            }
-        }).anyTimes();
-        EasyMock.replay(sref);
-        sd.decorate(sref, target);
-        return target;
-    }
-
-    private Bundle createBundleContaining(URL... resources) {
-        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;
-    }
-
-    private static URL getResource(String path) {
-        URL resource = ServiceDecoratorImplTest.class.getResource(path);
-        Assert.assertNotNull("Resource " + path + " not found!", resource);
-        return resource;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProviderTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProviderTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProviderTest.java
deleted file mode 100644
index 8f58918..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProviderTest.java
+++ /dev/null
@@ -1,104 +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.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cxf.dosgi.dsw.Constants;
-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.easymock.EasyMock;
-import org.junit.Assert;
-import org.junit.Test;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
-import static org.junit.Assert.assertTrue;
-
-public class CXFDistributionProviderTest {
-
-    @Test
-    public void testGetDefaultHandlerNoIntents() {
-        DistributionProvider handler = getHandlerWith(null, null);
-        assertTrue(handler instanceof PojoConfigurationTypeHandler);
-    }
-
-    @Test
-    public void testGetJaxrsHandlerNoIntents() {
-        DistributionProvider handler = getHandlerWith(Constants.RS_CONFIG_TYPE, null);
-        assertTrue(handler instanceof JaxRSPojoConfigurationTypeHandler);
-    }
-
-    @Test
-    public void testGetJaxrsHandlerHttpIntents() {
-        DistributionProvider handler = getHandlerWith(Constants.RS_CONFIG_TYPE, "HTTP");
-        assertTrue(handler instanceof JaxRSPojoConfigurationTypeHandler);
-    }
-
-    @Test
-    public void testJaxrsPropertyIgnored() {
-        DistributionProvider handler = getHandlerWith(Constants.RS_CONFIG_TYPE, "SOAP HTTP");
-        assertTrue(handler instanceof PojoConfigurationTypeHandler);
-        assertTrue(!(handler instanceof JaxRSPojoConfigurationTypeHandler));
-    }
-
-    @Test
-    public void testJaxrsPropertyIgnored2() {
-        DistributionProvider handler = getHandlerWith(Constants.RS_CONFIG_TYPE, new String[] {"HTTP", "SOAP"});
-        assertTrue(handler instanceof PojoConfigurationTypeHandler);
-        assertTrue(!(handler instanceof JaxRSPojoConfigurationTypeHandler));
-    }
-
-    @Test
-    public void testGetPojoHandler() {
-        DistributionProvider handler = getHandlerWith(Constants.WS_CONFIG_TYPE, null);
-        assertTrue(handler instanceof PojoConfigurationTypeHandler);
-    }
-
-    @Test
-    public void testGetWSDLHandler() {
-        DistributionProvider handler = getHandlerWith(Constants.WSDL_CONFIG_TYPE, null);
-        assertTrue(handler instanceof WsdlConfigurationTypeHandler);
-    }
-    
-    @Test
-    public void testUnsupportedConfiguration() {
-        DistributionProvider handler = getHandlerWith("notSupportedConfig", null);
-        Assert.assertNull(handler);
-    }
-
-    private DistributionProvider getHandlerWith(String configType, Object intents) {
-        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-        EasyMock.replay(bc);
-        Map<String, Object> serviceProps = new HashMap<String, Object>();
-        serviceProps.put(RemoteConstants.SERVICE_EXPORTED_CONFIGS, configType);
-        serviceProps.put(RemoteConstants.SERVICE_EXPORTED_INTENTS, intents);
-        IntentMap intentMap = new IntentMap(new DefaultIntentMapFactory().create());
-        IntentManager intentManager = new IntentManagerImpl(intentMap);
-        HttpServiceManager httpServiceManager = new HttpServiceManager(bc, null, null);
-        CXFDistributionProvider f = new CXFDistributionProvider(bc, intentManager, httpServiceManager);
-        List<String> configurationTypes = f.determineConfigurationTypes(serviceProps);
-        return f.getHandler(configurationTypes, serviceProps);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClassUtilsTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClassUtilsTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClassUtilsTest.java
deleted file mode 100644
index a0774be..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClassUtilsTest.java
+++ /dev/null
@@ -1,134 +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.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-import org.apache.cxf.dosgi.dsw.util.Provider;
-import org.easymock.EasyMock;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-
-public class ClassUtilsTest extends TestCase {
-
-    public void testGetInterfaceClass() {
-        assertEquals(String.class,
-                ClassUtils.getInterfaceClass("Hello", "java.lang.String"));
-        assertNull(ClassUtils.getInterfaceClass("Hello", "java.lang.Integer"));
-        assertEquals(List.class, ClassUtils.getInterfaceClass(
-                new ArrayList<String>(), "java.util.List"));
-        assertEquals(Collection.class, ClassUtils.getInterfaceClass(
-                new ArrayList<String>(), "java.util.Collection"));
-    }
-
-    public void testGetInterfaceClassFromSubclass() {
-        assertEquals(Map.class, ClassUtils.getInterfaceClass(
-                new MySubclassFour(), "java.util.Map"));
-        assertNull(ClassUtils.getInterfaceClass(new MySubclassFour(),
-                "java.util.UnknownType"));
-    }
-
-    public void testLoadProvidersAsString() throws Exception {
-        BundleContext bc = mockBundleContext();
-        Map<String, Object> sd = Collections.<String, Object>singletonMap("providers", Provider.class.getName());
-        List<Object> providers = ClassUtils.loadProviderClasses(bc, sd, "providers");
-        assertEquals(1, providers.size());
-        assertTrue(providers.get(0) instanceof Provider);
-    }
-
-    public void testLoadProvidersAsStringArray() throws Exception {
-        BundleContext bc = mockBundleContext();
-        Map<String, Object> sd = Collections.<String, Object>singletonMap("providers",
-                new String[]{Provider.class.getName()});
-        List<Object> providers = ClassUtils.loadProviderClasses(bc, sd, "providers");
-        assertEquals(1, providers.size());
-        assertTrue(providers.get(0) instanceof Provider);
-    }
-
-    public void testLoadProvidersAsObject() throws Exception {
-        Map<String, Object> sd = Collections.<String, Object>singletonMap("providers", new Provider());
-        List<Object> providers = ClassUtils.loadProviderClasses(null, sd, "providers");
-        assertEquals(1, providers.size());
-        assertTrue(providers.get(0) instanceof Provider);
-    }
-
-    public void testLoadProvidersAsObjectArray() throws Exception {
-        Map<String, Object> sd = Collections.<String, Object>singletonMap("providers", new Object[]{new Provider()});
-        List<Object> providers = ClassUtils.loadProviderClasses(null, sd, "providers");
-        assertEquals(1, providers.size());
-        assertTrue(providers.get(0) instanceof Provider);
-    }
-
-    public void testLoadProvidersAsObjectList() throws Exception {
-        List<Object> list = new LinkedList<Object>();
-        list.add(new Provider());
-        Map<String, Object> sd = Collections.<String, Object>singletonMap("providers", list);
-        List<Object> providers = ClassUtils.loadProviderClasses(null, sd, "providers");
-        assertEquals(1, providers.size());
-        assertTrue(providers.get(0) instanceof Provider);
-    }
-
-    public void testLoadProvidersAsStringList() throws Exception {
-        List<Object> list = new LinkedList<Object>();
-        list.add(Provider.class.getName());
-        Map<String, Object> sd = Collections.<String, Object>singletonMap("providers", list);
-        List<Object> providers = ClassUtils.loadProviderClasses(mockBundleContext(), sd, "providers");
-        assertEquals(1, providers.size());
-        assertTrue(providers.get(0) instanceof Provider);
-    }
-
-    private BundleContext mockBundleContext() throws Exception {
-        BundleContext bc = EasyMock.createMock(BundleContext.class);
-        Bundle bundle = EasyMock.createMock(Bundle.class);
-        bc.getBundle();
-        EasyMock.expectLastCall().andReturn(bundle);
-        bundle.loadClass(Provider.class.getName());
-        EasyMock.expectLastCall().andReturn(Provider.class);
-        EasyMock.replay(bc, bundle);
-        return bc;
-    }
-
-    @SuppressWarnings({ "serial", "rawtypes" })
-    private static class MyMapSubclass extends HashMap {
-    }
-
-    @SuppressWarnings("serial")
-    static class MySubclassOne extends MyMapSubclass {
-    }
-
-    @SuppressWarnings("serial")
-    static class MySubclassTwo extends MySubclassOne {
-    }
-
-    @SuppressWarnings("serial")
-    static class MySubclassThree extends MySubclassTwo {
-    }
-
-    @SuppressWarnings("serial")
-    static class MySubclassFour extends MySubclassThree {
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/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
deleted file mode 100644
index 10fba12..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java
+++ /dev/null
@@ -1,125 +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.Dictionary;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-
-import junit.framework.TestCase;
-
-import org.apache.cxf.Bus;
-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;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.http.HttpContext;
-import org.osgi.service.http.HttpService;
-import org.osgi.service.http.NamespaceException;
-
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-
-public class HttpServiceManagerTest extends TestCase {
-
-    public void testGetAbsoluteAddress() {
-        IMocksControl c = EasyMock.createControl();
-        BundleContext bundleContext = c.createMock(BundleContext.class);
-        c.replay();
-        HttpServiceManager manager = new HttpServiceManager(bundleContext, null, null, null);
-        String localIp = LocalHostUtil.getLocalIp();
-
-        String address1 = manager.getAbsoluteAddress(null, "/myservice");
-        assertEquals("http://" + localIp + ":8181/cxf/myservice", address1);
-
-        String address2 = manager.getAbsoluteAddress("/mycontext", "/myservice");
-        assertEquals("http://" + localIp + ":8181/mycontext/myservice", address2);
-
-        c.verify();
-    }
-
-    public void testRegisterAndUnregisterServlet() throws Exception {
-        IMocksControl c = EasyMock.createControl();
-        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 = EasyMock.newCapture();
-        dswContext.addServiceListener(EasyMock.capture(captured), EasyMock.<String>anyObject());
-        expectLastCall().atLeastOnce();
-        expect(dswContext.getProperty("org.apache.cxf.httpservice.requirefilter")).andReturn(null).atLeastOnce();
-        ServletConfig config = c.createMock(ServletConfig.class);
-        expect(config.getInitParameter(EasyMock.<String>anyObject())).andReturn(null).atLeastOnce();
-        ServletContext servletContext = c.createMock(ServletContext.class);
-        expect(config.getServletContext()).andReturn(servletContext);
-        final HttpService httpService = new DummyHttpService(config);
-        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();
-
-        HttpServiceManager h = new HttpServiceManager(dswContext, null, null, null) {
-            @Override
-            protected HttpService getHttpService() {
-                return httpService;
-            }
-        };
-        Bus bus = BusFactory.newInstance().createBus();
-        h.registerServlet(bus, "/myService", dswContext, 12345L);
-
-        ServiceEvent event = new ServiceEvent(ServiceEvent.UNREGISTERING, sr);
-        captured.getValue().serviceChanged(event);
-        c.verify();
-    }
-
-    static class DummyHttpService implements HttpService {
-
-        private ServletConfig config;
-
-        DummyHttpService(ServletConfig config) {
-            this.config = config;
-        }
-
-        @SuppressWarnings("rawtypes")
-        public void registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context)
-            throws ServletException, NamespaceException {
-            Assert.assertEquals("/myService", alias);
-            servlet.init(config);
-        }
-
-        public void registerResources(String alias, String name, HttpContext context) throws NamespaceException {
-            throw new RuntimeException("This method should not be called");
-        }
-
-        public void unregister(String alias) {
-        }
-
-        public HttpContext createDefaultHttpContext() {
-            return EasyMock.createNiceMock(HttpContext.class);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/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
deleted file mode 100644
index 6c8e35a..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtilsTest.java
+++ /dev/null
@@ -1,195 +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.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-import org.apache.cxf.dosgi.dsw.Constants;
-import org.apache.cxf.jaxrs.provider.JAXBElementProvider;
-import org.apache.cxf.jaxrs.provider.aegis.AegisElementProvider;
-import org.easymock.EasyMock;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
-public class JaxRSUtilsTest extends TestCase {
-
-    private void addRequiredProps(Map<String, Object> props) {
-        props.put(RemoteConstants.ENDPOINT_ID, "http://google.de");
-        props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, "myGreatConfiguration");
-        props.put(org.osgi.framework.Constants.OBJECTCLASS, new String[] {"my.class"});
-    }
-
-    public void testNoGlobalProviders() {
-        Map<String, Object> props = new HashMap<String, Object>();
-        addRequiredProps(props);
-        props.put(Constants.RS_PROVIDER_GLOBAL_PROP_KEY, "false");
-
-        assertEquals(0, JaxRSUtils.getProviders(null, props).size());
-    }
-
-    public void testAegisProvider() {
-        Map<String, Object> props = new HashMap<String, Object>();
-        props.put(Constants.RS_DATABINDING_PROP_KEY, "aegis");
-        props.put(Constants.RS_PROVIDER_GLOBAL_PROP_KEY, "false");
-
-        addRequiredProps(props);
-
-        List<Object> providers = JaxRSUtils.getProviders(null, props);
-        assertEquals(1, providers.size());
-        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[] {
-            new AegisElementProvider()
-        });
-        props.put(Constants.RS_PROVIDER_GLOBAL_PROP_KEY, "false");
-        addRequiredProps(props);
-
-        List<Object> providers = JaxRSUtils.getProviders(null, props);
-        assertEquals(1, providers.size());
-        assertEquals(AegisElementProvider.class.getName(), providers.get(0).getClass().getName());
-    }
-
-    public void testServiceProviderProperty() throws Exception {
-        BundleContext bc = EasyMock.createMock(BundleContext.class);
-        Bundle bundle = EasyMock.createMock(Bundle.class);
-        bc.getBundle();
-        EasyMock.expectLastCall().andReturn(bundle).times(2);
-        bundle.loadClass(AegisElementProvider.class.getName());
-        EasyMock.expectLastCall().andReturn(AegisElementProvider.class);
-        bundle.loadClass(JAXBElementProvider.class.getName());
-        EasyMock.expectLastCall().andReturn(JAXBElementProvider.class);
-        EasyMock.replay(bc, bundle);
-
-        Map<String, Object> props = new HashMap<String, Object>();
-        props.put(Constants.RS_PROVIDER_PROP_KEY,
-                "\r\n " + AegisElementProvider.class.getName() + " , \r\n"
-                        + JAXBElementProvider.class.getName() + "\r\n");
-
-        props.put(Constants.RS_PROVIDER_GLOBAL_PROP_KEY, "false");
-        addRequiredProps(props);
-
-        List<Object> providers = JaxRSUtils.getProviders(bc, props);
-        assertEquals(2, providers.size());
-        assertEquals(AegisElementProvider.class.getName(), providers.get(0).getClass().getName());
-        assertEquals(JAXBElementProvider.class.getName(), providers.get(1).getClass().getName());
-    }
-
-    public void testServiceProviderStrings() throws Exception {
-        BundleContext bc = EasyMock.createMock(BundleContext.class);
-        Bundle bundle = EasyMock.createMock(Bundle.class);
-        bc.getBundle();
-        EasyMock.expectLastCall().andReturn(bundle).times(2);
-        bundle.loadClass(AegisElementProvider.class.getName());
-        EasyMock.expectLastCall().andReturn(AegisElementProvider.class);
-        bundle.loadClass(JAXBElementProvider.class.getName());
-        EasyMock.expectLastCall().andReturn(JAXBElementProvider.class);
-        EasyMock.replay(bc, bundle);
-
-        Map<String, Object> props = new HashMap<String, Object>();
-        props.put(Constants.RS_PROVIDER_PROP_KEY, new String[] {
-            "\r\n " + AegisElementProvider.class.getName(),
-            JAXBElementProvider.class.getName() + "\r\n"
-        });
-
-        props.put(Constants.RS_PROVIDER_GLOBAL_PROP_KEY, "false");
-        addRequiredProps(props);
-
-        List<Object> providers = JaxRSUtils.getProviders(bc, props);
-        assertEquals(2, providers.size());
-        assertEquals(AegisElementProvider.class.getName(), providers.get(0).getClass().getName());
-        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);
-        bc.getServiceReferences((String)null, JaxRSUtils.PROVIDERS_FILTER);
-        EasyMock.expectLastCall().andReturn(new ServiceReference[] {sref});
-        sref.getProperty(Constants.RS_PROVIDER_EXPECTED_PROP_KEY);
-        EasyMock.expectLastCall().andReturn(false);
-        bc.getService(sref);
-        AegisElementProvider<?> p = new AegisElementProvider();
-        EasyMock.expectLastCall().andReturn(p);
-        EasyMock.replay(bc, sref);
-        Map<String, Object> props = new HashMap<String, Object>();
-        addRequiredProps(props);
-
-        List<Object> providers = JaxRSUtils.getProviders(bc, props);
-        assertEquals(1, providers.size());
-        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);
-        bc.getServiceReferences((String)null, JaxRSUtils.PROVIDERS_FILTER);
-        EasyMock.expectLastCall().andReturn(new ServiceReference[] {sref});
-        sref.getProperty(Constants.RS_PROVIDER_PROP_KEY);
-        EasyMock.expectLastCall().andReturn(false);
-        bc.getService(sref);
-        AegisElementProvider<?> p = new AegisElementProvider();
-        EasyMock.expectLastCall().andReturn(p);
-        EasyMock.replay(bc);
-        Map<String, Object> props = new HashMap<String, Object>();
-        props.put(Constants.RS_PROVIDER_EXPECTED_PROP_KEY, "true");
-        addRequiredProps(props);
-
-        List<Object> providers = JaxRSUtils.getProviders(bc, props);
-        assertEquals(0, providers.size());
-    }
-
-    @SuppressWarnings({
-     "rawtypes", "unchecked"
-    })
-    public void testCustomGlobalProviderExpected() throws Exception {
-        ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
-        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-        bc.getServiceReferences((String)null, JaxRSUtils.PROVIDERS_FILTER);
-        EasyMock.expectLastCall().andReturn(new ServiceReference[] {sref});
-        sref.getProperty(Constants.RS_PROVIDER_PROP_KEY);
-        EasyMock.expectLastCall().andReturn(true);
-        bc.getService(sref);
-        AegisElementProvider<?> p = new AegisElementProvider();
-        EasyMock.expectLastCall().andReturn(p);
-        EasyMock.replay(bc, sref);
-        Map<String, Object> props = new HashMap<String, Object>();
-        props.put(Constants.RS_PROVIDER_EXPECTED_PROP_KEY, "true");
-        addRequiredProps(props);
-
-        List<Object> providers = JaxRSUtils.getProviders(bc, props);
-        assertEquals(1, providers.size());
-        assertSame(p, providers.get(0));
-    }
-}


[13/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

Posted by cs...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
new file mode 100644
index 0000000..d9bc98d
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
@@ -0,0 +1,66 @@
+/**
+ * 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;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import junit.framework.TestCase;
+
+import org.apache.aries.rsa.spi.DistributionProvider;
+import org.easymock.EasyMock;
+import org.easymock.IMocksControl;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.ServiceRegistration;
+
+public class ActivatorTest extends TestCase {
+
+    private BundleContext getMockBundleContext(IMocksControl control) {
+        Bundle b = control.createMock(Bundle.class);
+        Dictionary<String, String> ht = new Hashtable<String, String>();
+        EasyMock.expect(b.getHeaders()).andReturn(ht).anyTimes();
+        BundleContext bc = control.createMock(BundleContext.class);
+
+        EasyMock.expect(b.getBundleContext()).andReturn(bc).anyTimes();
+        EasyMock.expect(bc.getBundle()).andReturn(b).anyTimes();
+        return bc;
+    }
+
+    @SuppressWarnings({
+     "rawtypes", "unchecked"
+    })
+    public void testCreateAndShutdownRemoteServiceAdminService() throws Exception {
+        IMocksControl control = EasyMock.createNiceControl();
+        BundleContext bc = getMockBundleContext(control);
+        Filter filter = control.createMock(Filter.class);
+        EasyMock.expect(bc.createFilter(EasyMock.<String>anyObject())).andReturn(filter);
+        EasyMock.expectLastCall().atLeastOnce();
+        ServiceRegistration sr = control.createMock(ServiceRegistration.class);
+        EasyMock.expect(bc.registerService(EasyMock.eq(DistributionProvider.class.getName()),
+                                           EasyMock.anyObject(), (Dictionary<String, String>)EasyMock.anyObject()))
+                                           .andReturn(sr).atLeastOnce();
+
+        control.replay();
+        Activator a = new Activator();
+        a.start(bc);
+        control.verify();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/TestUtils.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/TestUtils.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/TestUtils.java
new file mode 100644
index 0000000..b81bf3e
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/TestUtils.java
@@ -0,0 +1,37 @@
+/**
+ * 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;
+
+public final class TestUtils {
+
+//    private TestUtils() {
+//    }
+//
+//    public static ServiceEndpointDescription mockServiceDescription(String... interfaceNames) {
+//        List<String> iList = new ArrayList<String>();
+//        for (String iName : interfaceNames) {
+//            iList.add(iName);
+//        }
+//
+//        ServiceEndpointDescription sd = EasyMock.createNiceMock(ServiceEndpointDescription.class);
+//        sd.getProvidedInterfaces();
+//        EasyMock.expectLastCall().andReturn(iList);
+//        return sd;
+//    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParserTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParserTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParserTest.java
new file mode 100644
index 0000000..270c7fa
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParserTest.java
@@ -0,0 +1,63 @@
+/**
+ * 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.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;
+import org.apache.cxf.xmlns.service_decoration._1_0.ServiceDecorationType;
+import org.junit.Assert;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class DecorationParserTest {
+
+    @Test
+    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());
+        ServiceDecorationType decoration = elements.get(0);
+        assertEquals(1, decoration.getMatch().size());
+        MatchType match = decoration.getMatch().get(0);
+        assertEquals("org.acme.foo.*", match.getInterface());
+        assertEquals(1, match.getMatchProperty().size());
+        MatchPropertyType matchProp = match.getMatchProperty().get(0);
+        assertEquals("test.prop", matchProp.getName());
+        assertEquals("xyz", matchProp.getValue());
+        assertEquals(1, match.getAddProperty().size());
+        AddPropertyType addProp = match.getAddProperty().get(0);
+        assertEquals("test.too", addProp.getName());
+        assertEquals("ahaha", addProp.getValue());
+        assertEquals("java.lang.String", addProp.getType());
+    }
+
+    @Test
+    public void testGetDecorationForNull() throws JAXBException, IOException {
+        List<ServiceDecorationType> elements = new DecorationParser().getDecorations(null);
+        Assert.assertEquals(0, elements.size());
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java
new file mode 100644
index 0000000..c66642b
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java
@@ -0,0 +1,163 @@
+/**
+ * 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.decorator;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+
+@SuppressWarnings("rawtypes")
+public class InterfaceRuleTest extends TestCase {
+
+    public void testDUMMY() {
+        assertTrue(true);
+    }
+
+    public void testInterfaceRuleGetBundle() {
+        Bundle b = EasyMock.createMock(Bundle.class);
+        EasyMock.replay(b);
+        InterfaceRule ir = new InterfaceRule(b, "org.apache.Foo");
+        assertSame(b, ir.getBundle());
+    }
+
+    public void testInterfaceRule1() {
+        InterfaceRule ir = new InterfaceRule(null, "org.apache.Foo");
+        ir.addProperty("x", "y", String.class.getName());
+
+        final Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(Constants.OBJECTCLASS, new String[] {"a.b.C", "org.apache.Foo"});
+        ServiceReference sref = mockServiceReference(serviceProps);
+
+        Map<String, Object> m = new HashMap<String, Object>();
+        m.put("a", "b");
+        ir.apply(sref, m);
+        Map<String, Object> expected = new HashMap<String, Object>();
+        expected.put("a", "b");
+        expected.put("x", "y");
+        assertEquals(expected, m);
+    }
+
+    public void testInterfaceRule2() {
+        InterfaceRule ir = new InterfaceRule(null, "org.apache.F(.*)");
+        ir.addPropMatch("boo", "baah");
+        ir.addProperty("x", "1", Integer.class.getName());
+        ir.addProperty("aaa.bbb", "true", Boolean.class.getName());
+
+        final Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put("boo", "baah");
+        serviceProps.put(Constants.OBJECTCLASS, new String[] {"a.b.C", "org.apache.Foo"});
+        ServiceReference sref = mockServiceReference(serviceProps);
+
+        Map<String, Object> m = new HashMap<String, Object>();
+        ir.apply(sref, m);
+        Map<String, Object> expected = new HashMap<String, Object>();
+        expected.put("x", 1);
+        expected.put("aaa.bbb", Boolean.TRUE);
+        assertEquals(expected, m);
+    }
+
+    public void testInterfaceRule3() {
+        InterfaceRule ir = new InterfaceRule(null, "org.apache.F(.*)");
+        ir.addProperty("x", "y", String.class.getName());
+
+        final Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put("boo", "baah");
+        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.apache.Boo"});
+        ServiceReference sref = mockServiceReference(serviceProps);
+
+        Map<String, Object> m = new HashMap<String, Object>();
+        ir.apply(sref, m);
+        assertEquals(0, m.size());
+    }
+
+    public void testInterfaceRule4() {
+        InterfaceRule ir = new InterfaceRule(null, "org.apache.F(.*)");
+        ir.addPropMatch("boo", "baah");
+        ir.addProperty("x", "y", String.class.getName());
+
+        final Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.apache.Foo"});
+        ServiceReference sref = mockServiceReference(serviceProps);
+
+        Map<String, Object> m = new HashMap<String, Object>();
+        ir.apply(sref, m);
+        assertEquals(0, m.size());
+    }
+
+    public void testInterfaceRule5() {
+        InterfaceRule ir = new InterfaceRule(null, "org.apache.Foo");
+        ir.addPropMatch("test.int", "42");
+        ir.addProperty("x", "1", Long.class.getName());
+
+        final Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put("test.int", 42);
+        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.apache.Foo"});
+        ServiceReference sref = mockServiceReference(serviceProps);
+
+        Map<String, Object> m = new HashMap<String, Object>();
+        m.put("x", "foo");
+        m.put("aaa.bbb", Boolean.TRUE);
+        ir.apply(sref, m);
+        Map<String, Object> expected = new HashMap<String, Object>();
+        expected.put("x", 1L);
+        expected.put("aaa.bbb", Boolean.TRUE);
+        assertEquals(expected, m);
+    }
+
+    public void testInterfaceRule6() {
+        InterfaceRule ir = new InterfaceRule(null, "org.apache.Foo");
+        ir.addPropMatch("test.int", "42");
+        ir.addProperty("x", "1", Long.class.getName());
+
+        final Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put("test.int", 51);
+        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.apache.Foo"});
+        ServiceReference sref = mockServiceReference(serviceProps);
+
+        Map<String, Object> m = new HashMap<String, Object>();
+        m.put("x", "foo");
+        m.put("aaa.bbb", Boolean.TRUE);
+        ir.apply(sref, m);
+        Map<String, Object> expected = new HashMap<String, Object>();
+        expected.put("x", "foo");
+        expected.put("aaa.bbb", Boolean.TRUE);
+        assertEquals(expected, m);
+    }
+
+    private ServiceReference mockServiceReference(final Map<String, Object> serviceProps) {
+        ServiceReference sref = EasyMock.createMock(ServiceReference.class);
+        EasyMock.expect(sref.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
+            public Object answer() throws Throwable {
+                return serviceProps.get(EasyMock.getCurrentArguments()[0]);
+            }
+        }).anyTimes();
+        EasyMock.expect(sref.getPropertyKeys())
+            .andReturn(serviceProps.keySet().toArray(new String[] {})).anyTimes();
+
+        EasyMock.replay(sref);
+        return sref;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorBundleListenerTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorBundleListenerTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorBundleListenerTest.java
new file mode 100644
index 0000000..1ca33fc
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorBundleListenerTest.java
@@ -0,0 +1,69 @@
+/**
+ * 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.decorator;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.easymock.EasyMock;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+
+import static org.junit.Assert.assertEquals;
+
+public class ServiceDecoratorBundleListenerTest {
+
+    @Test
+    public void testBundleListener() {
+        BundleContext bc = EasyMock.createMock(BundleContext.class);
+        EasyMock.replay(bc);
+
+        final List<String> called = new ArrayList<String>();
+        ServiceDecoratorImpl serviceDecorator = new ServiceDecoratorImpl() {
+            @Override
+            void addDecorations(Bundle bundle) {
+                called.add("addDecorations");
+            }
+
+            @Override
+            void removeDecorations(Bundle bundle) {
+                called.add("removeDecorations");
+            }
+        };
+
+        Bundle b = EasyMock.createMock(Bundle.class);
+        EasyMock.replay(b);
+        
+        ServiceDecoratorBundleListener listener = new ServiceDecoratorBundleListener(serviceDecorator);
+
+        assertEquals("Precondition failed", 0, called.size());
+        listener.bundleChanged(new BundleEvent(BundleEvent.INSTALLED, b));
+        assertEquals(0, called.size());
+
+        listener.bundleChanged(new BundleEvent(BundleEvent.STARTED, b));
+        assertEquals(Arrays.asList("addDecorations"), called);
+
+        listener.bundleChanged(new BundleEvent(BundleEvent.STOPPING, b));
+        assertEquals(Arrays.asList("addDecorations", "removeDecorations"), called);
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java
new file mode 100644
index 0000000..400d793
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java
@@ -0,0 +1,187 @@
+/**
+ * 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.decorator;
+
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+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;
+
+public class ServiceDecoratorImplTest extends TestCase {
+    private static final Map<String, Object> EMPTY = new HashMap<String, Object>();
+    private static final URL RES_SD = getResource("/test-resources/sd.xml");
+    private static final URL RES_SD1 = getResource("/test-resources/sd1.xml");
+    private static final URL RES_SD2 = getResource("/test-resources/sd2.xml");
+    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"});
+        serviceProps.put("test.prop", "xyz");
+
+        Bundle b = createBundleContaining(RES_SD);
+        ServiceDecoratorImpl sd = new ServiceDecoratorImpl();
+        assertEquals("Precondition failed", 0, sd.decorations.size());
+        sd.addDecorations(b);
+        assertEquals(1, sd.decorations.size());
+
+        Map<String, Object> target = new HashMap<String, Object>();
+        ServiceReference sref = EasyMock.createMock(ServiceReference.class);
+        EasyMock.expect(sref.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
+            public Object answer() throws Throwable {
+                return serviceProps.get(EasyMock.getCurrentArguments()[0]);
+            }
+        }).anyTimes();
+        EasyMock.replay(sref);
+        sd.decorate(sref, target);
+
+        Map<String, Object> expected = new HashMap<String, Object>();
+        expected.put("test.too", "ahaha");
+        assertEquals(expected, target);
+
+        // remove it again
+        sd.removeDecorations(b);
+        assertEquals(0, sd.decorations.size());
+        Map<String, Object> target2 = new HashMap<String, Object>();
+        sd.decorate(sref, target2);
+        assertEquals(EMPTY, target2);
+    }
+
+    public void testAddDecorations() {
+        final Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.acme.foo.Bar"});
+        serviceProps.put("test.prop", "xyz");
+
+        Map<String, Object> expected = new HashMap<String, Object>();
+        expected.put("test.too", "ahaha");
+        assertDecorate(serviceProps, expected, RES_SD);
+    }
+
+    public void testAddDecorations1() {
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.A"});
+
+        Map<String, Object> expected = new HashMap<String, Object>();
+        expected.put("A", "B");
+        expected.put("C", 2);
+        assertDecorate(serviceProps, expected, RES_SD1, RES_SD2);
+    }
+
+    public void testAddDecorations2() {
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.D"});
+
+        assertDecorate(serviceProps, EMPTY, RES_SD1, RES_SD2);
+    }
+
+    public void testAddDecorations3() {
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.B"});
+        serviceProps.put("x", "y");
+
+        Map<String, Object> expected = new HashMap<String, Object>();
+        expected.put("bool", Boolean.TRUE);
+        assertDecorate(serviceProps, expected, RES_SD1, RES_SD2);
+    }
+
+    public void testAddDecorations4() {
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.C"});
+        serviceProps.put("x", "z");
+
+        Map<String, Object> expected = new HashMap<String, Object>();
+        expected.put("bool", Boolean.FALSE);
+        assertDecorate(serviceProps, expected, RES_SD1, RES_SD2);
+    }
+
+    public void testAddDecorations5() {
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.C"});
+        serviceProps.put("x", "x");
+
+        assertDecorate(serviceProps, EMPTY, RES_SD1, RES_SD2);
+    }
+
+    public void testAddDecorations6() {
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.D"});
+
+        assertDecorate(serviceProps, EMPTY, RES_SD0);
+    }
+
+    public void testAddDecorations7() {
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(Constants.OBJECTCLASS, new String[] {"org.test.D"});
+
+        assertDecorate(serviceProps, EMPTY, RES_SD_1);
+    }
+    
+    private void assertDecorate(final Map<String, Object> serviceProps, 
+                                Map<String, Object> expected, URL ... resources) {
+        Map<String, Object> actual = testDecorate(serviceProps, resources);
+        assertEquals(expected, actual);
+    }
+
+    @SuppressWarnings("rawtypes")
+    private Map<String, Object> testDecorate(final Map<String, Object> serviceProps, URL ... resources) {
+        Bundle b = createBundleContaining(resources);
+
+        ServiceDecoratorImpl sd = new ServiceDecoratorImpl();
+        sd.addDecorations(b);
+
+        Map<String, Object> target = new HashMap<String, Object>();
+        ServiceReference sref = EasyMock.createMock(ServiceReference.class);
+        EasyMock.expect(sref.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
+            public Object answer() throws Throwable {
+                return serviceProps.get(EasyMock.getCurrentArguments()[0]);
+            }
+        }).anyTimes();
+        EasyMock.replay(sref);
+        sd.decorate(sref, target);
+        return target;
+    }
+
+    private Bundle createBundleContaining(URL... resources) {
+        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;
+    }
+
+    private static URL getResource(String path) {
+        URL resource = ServiceDecoratorImplTest.class.getResource(path);
+        Assert.assertNotNull("Resource " + path + " not found!", resource);
+        return resource;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProviderTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProviderTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProviderTest.java
new file mode 100644
index 0000000..dcf1f2d
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProviderTest.java
@@ -0,0 +1,104 @@
+/**
+ * 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.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.aries.rsa.spi.DistributionProvider;
+import org.apache.cxf.dosgi.dsw.Constants;
+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.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Test;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
+
+import static org.junit.Assert.assertTrue;
+
+public class CXFDistributionProviderTest {
+
+    @Test
+    public void testGetDefaultHandlerNoIntents() {
+        DistributionProvider handler = getHandlerWith(null, null);
+        assertTrue(handler instanceof PojoConfigurationTypeHandler);
+    }
+
+    @Test
+    public void testGetJaxrsHandlerNoIntents() {
+        DistributionProvider handler = getHandlerWith(Constants.RS_CONFIG_TYPE, null);
+        assertTrue(handler instanceof JaxRSPojoConfigurationTypeHandler);
+    }
+
+    @Test
+    public void testGetJaxrsHandlerHttpIntents() {
+        DistributionProvider handler = getHandlerWith(Constants.RS_CONFIG_TYPE, "HTTP");
+        assertTrue(handler instanceof JaxRSPojoConfigurationTypeHandler);
+    }
+
+    @Test
+    public void testJaxrsPropertyIgnored() {
+        DistributionProvider handler = getHandlerWith(Constants.RS_CONFIG_TYPE, "SOAP HTTP");
+        assertTrue(handler instanceof PojoConfigurationTypeHandler);
+        assertTrue(!(handler instanceof JaxRSPojoConfigurationTypeHandler));
+    }
+
+    @Test
+    public void testJaxrsPropertyIgnored2() {
+        DistributionProvider handler = getHandlerWith(Constants.RS_CONFIG_TYPE, new String[] {"HTTP", "SOAP"});
+        assertTrue(handler instanceof PojoConfigurationTypeHandler);
+        assertTrue(!(handler instanceof JaxRSPojoConfigurationTypeHandler));
+    }
+
+    @Test
+    public void testGetPojoHandler() {
+        DistributionProvider handler = getHandlerWith(Constants.WS_CONFIG_TYPE, null);
+        assertTrue(handler instanceof PojoConfigurationTypeHandler);
+    }
+
+    @Test
+    public void testGetWSDLHandler() {
+        DistributionProvider handler = getHandlerWith(Constants.WSDL_CONFIG_TYPE, null);
+        assertTrue(handler instanceof WsdlConfigurationTypeHandler);
+    }
+    
+    @Test
+    public void testUnsupportedConfiguration() {
+        DistributionProvider handler = getHandlerWith("notSupportedConfig", null);
+        Assert.assertNull(handler);
+    }
+
+    private DistributionProvider getHandlerWith(String configType, Object intents) {
+        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.replay(bc);
+        Map<String, Object> serviceProps = new HashMap<String, Object>();
+        serviceProps.put(RemoteConstants.SERVICE_EXPORTED_CONFIGS, configType);
+        serviceProps.put(RemoteConstants.SERVICE_EXPORTED_INTENTS, intents);
+        IntentMap intentMap = new IntentMap(new DefaultIntentMapFactory().create());
+        IntentManager intentManager = new IntentManagerImpl(intentMap);
+        HttpServiceManager httpServiceManager = new HttpServiceManager(bc, null, null);
+        CXFDistributionProvider f = new CXFDistributionProvider(bc, intentManager, httpServiceManager);
+        List<String> configurationTypes = f.determineConfigurationTypes(serviceProps);
+        return f.getHandler(configurationTypes, serviceProps);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClassUtilsTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClassUtilsTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClassUtilsTest.java
new file mode 100644
index 0000000..a0774be
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClassUtilsTest.java
@@ -0,0 +1,134 @@
+/**
+ * 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.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.dosgi.dsw.util.Provider;
+import org.easymock.EasyMock;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+public class ClassUtilsTest extends TestCase {
+
+    public void testGetInterfaceClass() {
+        assertEquals(String.class,
+                ClassUtils.getInterfaceClass("Hello", "java.lang.String"));
+        assertNull(ClassUtils.getInterfaceClass("Hello", "java.lang.Integer"));
+        assertEquals(List.class, ClassUtils.getInterfaceClass(
+                new ArrayList<String>(), "java.util.List"));
+        assertEquals(Collection.class, ClassUtils.getInterfaceClass(
+                new ArrayList<String>(), "java.util.Collection"));
+    }
+
+    public void testGetInterfaceClassFromSubclass() {
+        assertEquals(Map.class, ClassUtils.getInterfaceClass(
+                new MySubclassFour(), "java.util.Map"));
+        assertNull(ClassUtils.getInterfaceClass(new MySubclassFour(),
+                "java.util.UnknownType"));
+    }
+
+    public void testLoadProvidersAsString() throws Exception {
+        BundleContext bc = mockBundleContext();
+        Map<String, Object> sd = Collections.<String, Object>singletonMap("providers", Provider.class.getName());
+        List<Object> providers = ClassUtils.loadProviderClasses(bc, sd, "providers");
+        assertEquals(1, providers.size());
+        assertTrue(providers.get(0) instanceof Provider);
+    }
+
+    public void testLoadProvidersAsStringArray() throws Exception {
+        BundleContext bc = mockBundleContext();
+        Map<String, Object> sd = Collections.<String, Object>singletonMap("providers",
+                new String[]{Provider.class.getName()});
+        List<Object> providers = ClassUtils.loadProviderClasses(bc, sd, "providers");
+        assertEquals(1, providers.size());
+        assertTrue(providers.get(0) instanceof Provider);
+    }
+
+    public void testLoadProvidersAsObject() throws Exception {
+        Map<String, Object> sd = Collections.<String, Object>singletonMap("providers", new Provider());
+        List<Object> providers = ClassUtils.loadProviderClasses(null, sd, "providers");
+        assertEquals(1, providers.size());
+        assertTrue(providers.get(0) instanceof Provider);
+    }
+
+    public void testLoadProvidersAsObjectArray() throws Exception {
+        Map<String, Object> sd = Collections.<String, Object>singletonMap("providers", new Object[]{new Provider()});
+        List<Object> providers = ClassUtils.loadProviderClasses(null, sd, "providers");
+        assertEquals(1, providers.size());
+        assertTrue(providers.get(0) instanceof Provider);
+    }
+
+    public void testLoadProvidersAsObjectList() throws Exception {
+        List<Object> list = new LinkedList<Object>();
+        list.add(new Provider());
+        Map<String, Object> sd = Collections.<String, Object>singletonMap("providers", list);
+        List<Object> providers = ClassUtils.loadProviderClasses(null, sd, "providers");
+        assertEquals(1, providers.size());
+        assertTrue(providers.get(0) instanceof Provider);
+    }
+
+    public void testLoadProvidersAsStringList() throws Exception {
+        List<Object> list = new LinkedList<Object>();
+        list.add(Provider.class.getName());
+        Map<String, Object> sd = Collections.<String, Object>singletonMap("providers", list);
+        List<Object> providers = ClassUtils.loadProviderClasses(mockBundleContext(), sd, "providers");
+        assertEquals(1, providers.size());
+        assertTrue(providers.get(0) instanceof Provider);
+    }
+
+    private BundleContext mockBundleContext() throws Exception {
+        BundleContext bc = EasyMock.createMock(BundleContext.class);
+        Bundle bundle = EasyMock.createMock(Bundle.class);
+        bc.getBundle();
+        EasyMock.expectLastCall().andReturn(bundle);
+        bundle.loadClass(Provider.class.getName());
+        EasyMock.expectLastCall().andReturn(Provider.class);
+        EasyMock.replay(bc, bundle);
+        return bc;
+    }
+
+    @SuppressWarnings({ "serial", "rawtypes" })
+    private static class MyMapSubclass extends HashMap {
+    }
+
+    @SuppressWarnings("serial")
+    static class MySubclassOne extends MyMapSubclass {
+    }
+
+    @SuppressWarnings("serial")
+    static class MySubclassTwo extends MySubclassOne {
+    }
+
+    @SuppressWarnings("serial")
+    static class MySubclassThree extends MySubclassTwo {
+    }
+
+    @SuppressWarnings("serial")
+    static class MySubclassFour extends MySubclassThree {
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java
new file mode 100644
index 0000000..10fba12
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java
@@ -0,0 +1,125 @@
+/**
+ * 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.Dictionary;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.Bus;
+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;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.HttpContext;
+import org.osgi.service.http.HttpService;
+import org.osgi.service.http.NamespaceException;
+
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+
+public class HttpServiceManagerTest extends TestCase {
+
+    public void testGetAbsoluteAddress() {
+        IMocksControl c = EasyMock.createControl();
+        BundleContext bundleContext = c.createMock(BundleContext.class);
+        c.replay();
+        HttpServiceManager manager = new HttpServiceManager(bundleContext, null, null, null);
+        String localIp = LocalHostUtil.getLocalIp();
+
+        String address1 = manager.getAbsoluteAddress(null, "/myservice");
+        assertEquals("http://" + localIp + ":8181/cxf/myservice", address1);
+
+        String address2 = manager.getAbsoluteAddress("/mycontext", "/myservice");
+        assertEquals("http://" + localIp + ":8181/mycontext/myservice", address2);
+
+        c.verify();
+    }
+
+    public void testRegisterAndUnregisterServlet() throws Exception {
+        IMocksControl c = EasyMock.createControl();
+        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 = EasyMock.newCapture();
+        dswContext.addServiceListener(EasyMock.capture(captured), EasyMock.<String>anyObject());
+        expectLastCall().atLeastOnce();
+        expect(dswContext.getProperty("org.apache.cxf.httpservice.requirefilter")).andReturn(null).atLeastOnce();
+        ServletConfig config = c.createMock(ServletConfig.class);
+        expect(config.getInitParameter(EasyMock.<String>anyObject())).andReturn(null).atLeastOnce();
+        ServletContext servletContext = c.createMock(ServletContext.class);
+        expect(config.getServletContext()).andReturn(servletContext);
+        final HttpService httpService = new DummyHttpService(config);
+        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();
+
+        HttpServiceManager h = new HttpServiceManager(dswContext, null, null, null) {
+            @Override
+            protected HttpService getHttpService() {
+                return httpService;
+            }
+        };
+        Bus bus = BusFactory.newInstance().createBus();
+        h.registerServlet(bus, "/myService", dswContext, 12345L);
+
+        ServiceEvent event = new ServiceEvent(ServiceEvent.UNREGISTERING, sr);
+        captured.getValue().serviceChanged(event);
+        c.verify();
+    }
+
+    static class DummyHttpService implements HttpService {
+
+        private ServletConfig config;
+
+        DummyHttpService(ServletConfig config) {
+            this.config = config;
+        }
+
+        @SuppressWarnings("rawtypes")
+        public void registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context)
+            throws ServletException, NamespaceException {
+            Assert.assertEquals("/myService", alias);
+            servlet.init(config);
+        }
+
+        public void registerResources(String alias, String name, HttpContext context) throws NamespaceException {
+            throw new RuntimeException("This method should not be called");
+        }
+
+        public void unregister(String alias) {
+        }
+
+        public HttpContext createDefaultHttpContext() {
+            return EasyMock.createNiceMock(HttpContext.class);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtilsTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtilsTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtilsTest.java
new file mode 100644
index 0000000..6c8e35a
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtilsTest.java
@@ -0,0 +1,195 @@
+/**
+ * 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.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.dosgi.dsw.Constants;
+import org.apache.cxf.jaxrs.provider.JAXBElementProvider;
+import org.apache.cxf.jaxrs.provider.aegis.AegisElementProvider;
+import org.easymock.EasyMock;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
+
+public class JaxRSUtilsTest extends TestCase {
+
+    private void addRequiredProps(Map<String, Object> props) {
+        props.put(RemoteConstants.ENDPOINT_ID, "http://google.de");
+        props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, "myGreatConfiguration");
+        props.put(org.osgi.framework.Constants.OBJECTCLASS, new String[] {"my.class"});
+    }
+
+    public void testNoGlobalProviders() {
+        Map<String, Object> props = new HashMap<String, Object>();
+        addRequiredProps(props);
+        props.put(Constants.RS_PROVIDER_GLOBAL_PROP_KEY, "false");
+
+        assertEquals(0, JaxRSUtils.getProviders(null, props).size());
+    }
+
+    public void testAegisProvider() {
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put(Constants.RS_DATABINDING_PROP_KEY, "aegis");
+        props.put(Constants.RS_PROVIDER_GLOBAL_PROP_KEY, "false");
+
+        addRequiredProps(props);
+
+        List<Object> providers = JaxRSUtils.getProviders(null, props);
+        assertEquals(1, providers.size());
+        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[] {
+            new AegisElementProvider()
+        });
+        props.put(Constants.RS_PROVIDER_GLOBAL_PROP_KEY, "false");
+        addRequiredProps(props);
+
+        List<Object> providers = JaxRSUtils.getProviders(null, props);
+        assertEquals(1, providers.size());
+        assertEquals(AegisElementProvider.class.getName(), providers.get(0).getClass().getName());
+    }
+
+    public void testServiceProviderProperty() throws Exception {
+        BundleContext bc = EasyMock.createMock(BundleContext.class);
+        Bundle bundle = EasyMock.createMock(Bundle.class);
+        bc.getBundle();
+        EasyMock.expectLastCall().andReturn(bundle).times(2);
+        bundle.loadClass(AegisElementProvider.class.getName());
+        EasyMock.expectLastCall().andReturn(AegisElementProvider.class);
+        bundle.loadClass(JAXBElementProvider.class.getName());
+        EasyMock.expectLastCall().andReturn(JAXBElementProvider.class);
+        EasyMock.replay(bc, bundle);
+
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put(Constants.RS_PROVIDER_PROP_KEY,
+                "\r\n " + AegisElementProvider.class.getName() + " , \r\n"
+                        + JAXBElementProvider.class.getName() + "\r\n");
+
+        props.put(Constants.RS_PROVIDER_GLOBAL_PROP_KEY, "false");
+        addRequiredProps(props);
+
+        List<Object> providers = JaxRSUtils.getProviders(bc, props);
+        assertEquals(2, providers.size());
+        assertEquals(AegisElementProvider.class.getName(), providers.get(0).getClass().getName());
+        assertEquals(JAXBElementProvider.class.getName(), providers.get(1).getClass().getName());
+    }
+
+    public void testServiceProviderStrings() throws Exception {
+        BundleContext bc = EasyMock.createMock(BundleContext.class);
+        Bundle bundle = EasyMock.createMock(Bundle.class);
+        bc.getBundle();
+        EasyMock.expectLastCall().andReturn(bundle).times(2);
+        bundle.loadClass(AegisElementProvider.class.getName());
+        EasyMock.expectLastCall().andReturn(AegisElementProvider.class);
+        bundle.loadClass(JAXBElementProvider.class.getName());
+        EasyMock.expectLastCall().andReturn(JAXBElementProvider.class);
+        EasyMock.replay(bc, bundle);
+
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put(Constants.RS_PROVIDER_PROP_KEY, new String[] {
+            "\r\n " + AegisElementProvider.class.getName(),
+            JAXBElementProvider.class.getName() + "\r\n"
+        });
+
+        props.put(Constants.RS_PROVIDER_GLOBAL_PROP_KEY, "false");
+        addRequiredProps(props);
+
+        List<Object> providers = JaxRSUtils.getProviders(bc, props);
+        assertEquals(2, providers.size());
+        assertEquals(AegisElementProvider.class.getName(), providers.get(0).getClass().getName());
+        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);
+        bc.getServiceReferences((String)null, JaxRSUtils.PROVIDERS_FILTER);
+        EasyMock.expectLastCall().andReturn(new ServiceReference[] {sref});
+        sref.getProperty(Constants.RS_PROVIDER_EXPECTED_PROP_KEY);
+        EasyMock.expectLastCall().andReturn(false);
+        bc.getService(sref);
+        AegisElementProvider<?> p = new AegisElementProvider();
+        EasyMock.expectLastCall().andReturn(p);
+        EasyMock.replay(bc, sref);
+        Map<String, Object> props = new HashMap<String, Object>();
+        addRequiredProps(props);
+
+        List<Object> providers = JaxRSUtils.getProviders(bc, props);
+        assertEquals(1, providers.size());
+        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);
+        bc.getServiceReferences((String)null, JaxRSUtils.PROVIDERS_FILTER);
+        EasyMock.expectLastCall().andReturn(new ServiceReference[] {sref});
+        sref.getProperty(Constants.RS_PROVIDER_PROP_KEY);
+        EasyMock.expectLastCall().andReturn(false);
+        bc.getService(sref);
+        AegisElementProvider<?> p = new AegisElementProvider();
+        EasyMock.expectLastCall().andReturn(p);
+        EasyMock.replay(bc);
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put(Constants.RS_PROVIDER_EXPECTED_PROP_KEY, "true");
+        addRequiredProps(props);
+
+        List<Object> providers = JaxRSUtils.getProviders(bc, props);
+        assertEquals(0, providers.size());
+    }
+
+    @SuppressWarnings({
+     "rawtypes", "unchecked"
+    })
+    public void testCustomGlobalProviderExpected() throws Exception {
+        ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
+        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+        bc.getServiceReferences((String)null, JaxRSUtils.PROVIDERS_FILTER);
+        EasyMock.expectLastCall().andReturn(new ServiceReference[] {sref});
+        sref.getProperty(Constants.RS_PROVIDER_PROP_KEY);
+        EasyMock.expectLastCall().andReturn(true);
+        bc.getService(sref);
+        AegisElementProvider<?> p = new AegisElementProvider();
+        EasyMock.expectLastCall().andReturn(p);
+        EasyMock.replay(bc, sref);
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put(Constants.RS_PROVIDER_EXPECTED_PROP_KEY, "true");
+        addRequiredProps(props);
+
+        List<Object> providers = JaxRSUtils.getProviders(bc, props);
+        assertEquals(1, providers.size());
+        assertSame(p, providers.get(0));
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java
new file mode 100644
index 0000000..b6b05ea
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java
@@ -0,0 +1,422 @@
+/**
+ * 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.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.aries.rsa.spi.Endpoint;
+import org.apache.aries.rsa.util.EndpointHelper;
+import org.apache.cxf.dosgi.dsw.Constants;
+import org.apache.cxf.dosgi.dsw.handlers.jaxws.MyJaxWsEchoService;
+import org.apache.cxf.dosgi.dsw.handlers.simple.MySimpleEchoService;
+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.EndpointImpl;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.feature.Feature;
+import org.apache.cxf.frontend.ClientProxyFactoryBean;
+import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
+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.IMocksControl;
+import org.junit.Assert;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Version;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
+
+public class PojoConfigurationTypeHandlerTest extends TestCase {
+
+    public void testGetPojoAddressEndpointURI() {
+        IntentManager intentManager = new IntentManagerImpl(new IntentMap());
+        PojoConfigurationTypeHandler handler = new PojoConfigurationTypeHandler(null,
+                                                                                intentManager,
+                                                                                dummyHttpServiceManager());
+        Map<String, Object> sd = new HashMap<String, Object>();
+        String url = "http://somewhere:1234/blah";
+        sd.put(RemoteConstants.ENDPOINT_ID, url);
+        assertEquals(url, handler.getServerAddress(sd, String.class));
+    }
+
+    private HttpServiceManager dummyHttpServiceManager() {
+        return new HttpServiceManager(null, null, null, null);
+    }
+
+    public void testGetPojoAddressEndpointCxf() {
+        IntentManager intentManager = new IntentManagerImpl(new IntentMap());
+        PojoConfigurationTypeHandler handler = new PojoConfigurationTypeHandler(null,
+                                                                                intentManager,
+                                                                                dummyHttpServiceManager());
+        Map<String, Object> sd = new HashMap<String, Object>();
+        String url = "http://somewhere:29/boo";
+        sd.put("org.apache.cxf.ws.address", url);
+        assertEquals(url, handler.getServerAddress(sd, String.class));
+    }
+
+    public void testGetPojoAddressEndpointPojo() {
+        IntentManager intentManager = new IntentManagerImpl(new IntentMap());
+        PojoConfigurationTypeHandler handler = new PojoConfigurationTypeHandler(null,
+                                                                                intentManager,
+                                                                                dummyHttpServiceManager());
+        Map<String, Object> sd = new HashMap<String, Object>();
+        String url = "http://somewhere:32768/foo";
+        sd.put("osgi.remote.configuration.pojo.address", url);
+        assertEquals(url, handler.getServerAddress(sd, String.class));
+    }
+
+    public void testGetDefaultPojoAddress() {
+        IntentManager intentManager = new IntentManagerImpl(new IntentMap());
+        PojoConfigurationTypeHandler handler = new PojoConfigurationTypeHandler(null,
+                                                                                intentManager,
+                                                                                dummyHttpServiceManager());
+        Map<String, Object> sd = new HashMap<String, Object>();
+        assertEquals("/java/lang/String", handler.getServerAddress(sd, String.class));
+    }
+
+    // todo: add test for data bindings
+    public void testCreateProxy() {
+        IMocksControl c = EasyMock.createNiceControl();
+        BundleContext bc1 = c.createMock(BundleContext.class);
+        
+        BundleContext requestingContext = c.createMock(BundleContext.class);
+
+        final ClientProxyFactoryBean cpfb = c.createMock(ClientProxyFactoryBean.class);
+        ReflectionServiceFactoryBean sf = c.createMock(ReflectionServiceFactoryBean.class);
+        EasyMock.expect(cpfb.getServiceFactory()).andReturn(sf).anyTimes();
+        IntentManager intentManager = new IntentManagerImpl(new IntentMap()) {
+            @Override
+            public String[] applyIntents(List<Feature> features,
+                                         AbstractEndpointFactory factory,
+                                         Map<String, Object> sd) {
+                return new String[0];
+            }
+        };
+        PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(bc1,
+                                                                          intentManager,
+                                                                          dummyHttpServiceManager()) {
+            @Override
+            protected ClientProxyFactoryBean createClientProxyFactoryBean(Map<String, Object> sd, Class<?> iClass) {
+                return cpfb;
+            }
+        };
+
+        Class<?>[] exportedInterfaces = new Class[]{Runnable.class};
+        
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put(RemoteConstants.ENDPOINT_ID, "http://google.de/");
+        EndpointHelper.addObjectClass(props, exportedInterfaces);
+        props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, new String[]{"my.config"});
+        EndpointDescription endpoint = new EndpointDescription(props);
+
+        cpfb.setAddress((String)EasyMock.eq(props.get(RemoteConstants.ENDPOINT_ID)));
+        EasyMock.expectLastCall().atLeastOnce();
+
+        cpfb.setServiceClass(EasyMock.eq(Runnable.class));
+        EasyMock.expectLastCall().atLeastOnce();
+
+        c.replay();
+        ClassLoader cl = null;
+        Object proxy = p.importEndpoint(cl, requestingContext, exportedInterfaces, endpoint);
+        assertNotNull(proxy);
+        assertTrue("Proxy is not of the requested type! ", proxy instanceof Runnable);
+        c.verify();
+    }
+
+    public void testCreateServerWithAddressProperty() throws Exception {
+        BundleContext dswContext = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.replay(dswContext);
+
+        String myService = "Hi";
+        final ServerFactoryBean sfb = createMockServerFactoryBean();
+
+        IntentMap intentMap = new IntentMap();
+        IntentManager intentManager = new IntentManagerImpl(intentMap) {
+            @Override
+            public String[] applyIntents(List<Feature> features, AbstractEndpointFactory factory,
+                                         Map<String, Object> sd) {
+                return new String[]{};
+            }
+        };
+        PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(dswContext, intentManager,
+                                                                          dummyHttpServiceManager()) {
+            @Override
+            protected ServerFactoryBean createServerFactoryBean(Map<String, Object> sd, Class<?> iClass) {
+                return sfb;
+            }
+        };
+        BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.replay(bundleContext);
+        
+        Class<?>[] exportedInterface = new Class[]{String.class};
+        Map<String, Object> props = new HashMap<String, Object>();
+        EndpointHelper.addObjectClass(props, exportedInterface);
+        props.put(Constants.WS_ADDRESS_PROPERTY, "http://alternate_host:80/myString");
+
+        Endpoint exportResult = p.exportService(myService, bundleContext, props, exportedInterface);
+        Map<String, Object> edProps = exportResult.description().getProperties();
+
+        assertNotNull(edProps.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS));
+        assertEquals(1, ((String[])edProps.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS)).length);
+        assertEquals(Constants.WS_CONFIG_TYPE, ((String[])edProps.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS))[0]);
+        assertEquals("http://alternate_host:80/myString", edProps.get(RemoteConstants.ENDPOINT_ID));
+    }
+
+    public void testAddressing() throws Exception {
+        runAddressingTest(new HashMap<String, Object>(), "http://localhost:9000/java/lang/Runnable");
+
+        Map<String, Object> p1 = new HashMap<String, Object>();
+        p1.put("org.apache.cxf.ws.address", "http://somewhere");
+        runAddressingTest(p1, "http://somewhere");
+
+        Map<String, Object> p2 = new HashMap<String, Object>();
+        p2.put("org.apache.cxf.rs.address", "https://somewhereelse");
+        runAddressingTest(p2, "https://somewhereelse");
+
+        Map<String, Object> p3 = new HashMap<String, Object>();
+        p3.put("org.apache.cxf.ws.port", 65535);
+        runAddressingTest(p3, "http://localhost:65535/java/lang/Runnable");
+
+        Map<String, Object> p4 = new HashMap<String, Object>();
+        p4.put("org.apache.cxf.ws.port", "8181");
+        runAddressingTest(p4, "http://localhost:8181/java/lang/Runnable");
+    }
+
+    private void runAddressingTest(Map<String, Object> properties, String expectedAddress) throws Exception {
+        Class<?>[] exportedInterface = new Class[]{Runnable.class};
+        EndpointHelper.addObjectClass(properties, exportedInterface);
+        BundleContext dswContext = EasyMock.createNiceMock(BundleContext.class);
+        String expectedUUID = UUID.randomUUID().toString();
+        EasyMock.expect(dswContext.getProperty(org.osgi.framework.Constants.FRAMEWORK_UUID)).andReturn(expectedUUID);
+        EasyMock.replay(dswContext);
+
+        IntentManager intentManager = EasyMock.createNiceMock(IntentManager.class);
+        EasyMock.replay(intentManager);
+
+        PojoConfigurationTypeHandler handler = new PojoConfigurationTypeHandler(dswContext,
+                                                                                intentManager,
+                                                                                dummyHttpServiceManager()) {
+            @Override
+            protected Endpoint createServerFromFactory(ServerFactoryBean factory,
+                                                       EndpointDescription epd) {
+                return new ServerWrapper(epd, null);
+            }
+        };
+        Runnable myService = EasyMock.createMock(Runnable.class);
+        EasyMock.replay(myService);
+        
+        BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.replay(bundleContext);
+
+        Endpoint result = handler.exportService(myService, bundleContext, properties, exportedInterface);
+        Map<String, Object> props = result.description().getProperties();
+        assertEquals(expectedAddress, props.get("org.apache.cxf.ws.address"));
+        Assert.assertArrayEquals(new String[] {"org.apache.cxf.ws"}, 
+                     (String[]) props.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS));
+        Assert.assertArrayEquals(new String[] {"java.lang.Runnable"}, 
+                     (String[]) props.get(org.osgi.framework.Constants.OBJECTCLASS));
+    }
+
+    public void t2estCreateServerException() {
+        BundleContext dswContext = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.replay(dswContext);
+
+        IntentManager intentManager = EasyMock.createNiceMock(IntentManager.class);
+        EasyMock.replay(intentManager);
+
+        PojoConfigurationTypeHandler handler = new PojoConfigurationTypeHandler(dswContext,
+                                                                                intentManager,
+                                                                                dummyHttpServiceManager()) {
+            @Override
+            protected Endpoint createServerFromFactory(ServerFactoryBean factory,
+                                                       EndpointDescription epd) {
+                throw new TestException();
+            }
+        };
+
+        Map<String, Object> props = new HashMap<String, Object>();
+
+        Runnable myService = EasyMock.createMock(Runnable.class);
+        EasyMock.replay(myService);
+        try {
+            handler.exportService(myService, null, props, new Class[]{Runnable.class});
+            fail("Expected TestException");
+        } catch (TestException e) {
+            // Expected
+        }
+    }
+
+    private ServerFactoryBean createMockServerFactoryBean() {
+        ReflectionServiceFactoryBean sf = EasyMock.createNiceMock(ReflectionServiceFactoryBean.class);
+        EasyMock.replay(sf);
+
+        final StringBuilder serverURI = new StringBuilder();
+
+        ServerFactoryBean sfb = EasyMock.createNiceMock(ServerFactoryBean.class);
+        Server server = createMockServer(sfb);
+
+        EasyMock.expect(sfb.getServiceFactory()).andReturn(sf).anyTimes();
+        EasyMock.expect(sfb.create()).andReturn(server);
+        sfb.setAddress((String) EasyMock.anyObject());
+        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
+            public Object answer() throws Throwable {
+                serverURI.setLength(0);
+                serverURI.append(EasyMock.getCurrentArguments()[0]);
+                return null;
+            }
+        });
+        EasyMock.expect(sfb.getAddress()).andAnswer(new IAnswer<String>() {
+            public String answer() throws Throwable {
+                return serverURI.toString();
+            }
+        });
+        EasyMock.replay(sfb);
+        return sfb;
+    }
+
+    private Server createMockServer(final ServerFactoryBean sfb) {
+        AttributedURIType addr = EasyMock.createMock(AttributedURIType.class);
+        EasyMock.expect(addr.getValue()).andAnswer(new IAnswer<String>() {
+            public String answer() throws Throwable {
+                return sfb.getAddress();
+            }
+        });
+        EasyMock.replay(addr);
+
+        EndpointReferenceType er = EasyMock.createMock(EndpointReferenceType.class);
+        EasyMock.expect(er.getAddress()).andReturn(addr);
+        EasyMock.replay(er);
+
+        Destination destination = EasyMock.createMock(Destination.class);
+        EasyMock.expect(destination.getAddress()).andReturn(er);
+        EasyMock.replay(destination);
+
+        Server server = EasyMock.createNiceMock(Server.class);
+        EasyMock.expect(server.getDestination()).andReturn(destination);
+        EasyMock.replay(server);
+        return server;
+    }
+
+    public void testCreateEndpointProps() {
+        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.expect(bc.getProperty("org.osgi.framework.uuid")).andReturn("some_uuid1");
+        EasyMock.replay(bc);
+
+        IntentManager intentManager = new IntentManagerImpl(new IntentMap());
+        PojoConfigurationTypeHandler pch = new PojoConfigurationTypeHandler(bc,
+                                                                            intentManager,
+                                                                            dummyHttpServiceManager());
+        Class<?>[] exportedInterfaces = new Class[] {String.class};
+        Map<String, Object> sd = new HashMap<String, Object>();
+        sd.put(org.osgi.framework.Constants.SERVICE_ID, 42);
+        EndpointHelper.addObjectClass(sd, exportedInterfaces);
+        EndpointDescription epd = pch.createEndpointDesc(sd, new String[] {"org.apache.cxf.ws"},
+                "http://localhost:12345", new String[] {"my_intent", "your_intent"});
+
+        assertEquals("http://localhost:12345", epd.getId());
+        assertEquals(Arrays.asList("java.lang.String"), epd.getInterfaces());
+        assertEquals(Arrays.asList("org.apache.cxf.ws"), epd.getConfigurationTypes());
+        assertEquals(Arrays.asList("my_intent", "your_intent"), epd.getIntents());
+        assertEquals(new Version("0.0.0"), epd.getPackageVersion("java.lang"));
+    }
+
+    public void t2estCreateJaxWsEndpointWithoutIntents() {
+        IMocksControl c = EasyMock.createNiceControl();
+        BundleContext dswBC = c.createMock(BundleContext.class);
+        
+        IntentManager intentManager = new DummyIntentManager();
+        PojoConfigurationTypeHandler handler = new PojoConfigurationTypeHandler(dswBC,
+                                                                                intentManager,
+                                                                                dummyHttpServiceManager());
+
+        Map<String, Object> sd = new HashMap<String, Object>();
+        sd.put(Constants.WS_ADDRESS_PROPERTY, "/somewhere");
+        BundleContext serviceBC = c.createMock(BundleContext.class);
+        Object myService = null;
+        c.replay();
+
+        ServerWrapper serverWrapper = (ServerWrapper)handler.exportService(myService,
+                                                                           serviceBC, 
+                                                                           sd, 
+                                                                           new Class[]{MyJaxWsEchoService.class});
+        c.verify();
+
+        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/",
+                                      "MyJaxWsEchoServiceServiceSoapBinding"),
+                            bindingName);
+    }
+
+    public void t2estCreateSimpleEndpointWithoutIntents() {
+        IMocksControl c = EasyMock.createNiceControl();
+        BundleContext dswBC = c.createMock(BundleContext.class);
+
+        IntentManager intentManager = new DummyIntentManager();
+        PojoConfigurationTypeHandler handler
+            = new PojoConfigurationTypeHandler(dswBC, intentManager, dummyHttpServiceManager());
+        Map<String, Object> sd = new HashMap<String, Object>();
+        sd.put(Constants.WS_ADDRESS_PROPERTY, "/somewhere_else");
+        BundleContext serviceBC = c.createMock(BundleContext.class);
+        c.replay();
+        ServerWrapper serverWrapper = (ServerWrapper)handler.exportService(null, serviceBC, sd, 
+                                                                          new Class[]{MySimpleEchoService.class});
+        c.verify();
+
+        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/",
+                                      "MySimpleEchoServiceSoapBinding"),
+                            bindingName);
+    }
+
+    public static class DummyIntentManager implements IntentManager {
+
+        @Override
+        public String[] applyIntents(List<Feature> features,
+                                     AbstractEndpointFactory factory,
+                                     Map<String, Object> props) {
+            return new String[]{};
+        }
+
+        @Override
+        public void assertAllIntentsSupported(Map<String, Object> serviceProperties) {
+        }
+    }
+
+    @SuppressWarnings("serial")
+    public static class TestException extends RuntimeException {
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContextTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContextTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContextTest.java
new file mode 100644
index 0000000..58b5f58
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContextTest.java
@@ -0,0 +1,267 @@
+/**
+ * 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.PrintWriter;
+import java.net.URL;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import junit.framework.TestCase;
+
+import org.easymock.EasyMock;
+import org.junit.Assert;
+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;
+    protected SecurityDelegatingHttpContext httpContext;
+    protected CommitResponseFilter commitFilter;
+    protected DoNothingFilter doNothingFilter;
+    protected AccessDeniedFilter accessDeniedFilter;
+    protected String mimeType;
+    protected URL url; // does not need to exist
+
+    public void setUp() throws Exception {
+        mimeType = "text/xml";
+        url = new URL("file:test.xml"); // does not need to exist
+
+        // Sample filters
+        commitFilter = new CommitResponseFilter();
+        doNothingFilter = new DoNothingFilter();
+        accessDeniedFilter = new AccessDeniedFilter();
+
+        // Mock up the default http context
+        defaultHttpContext = EasyMock.createNiceMock(HttpContext.class);
+        EasyMock.expect(defaultHttpContext.getMimeType((String)EasyMock.anyObject())).andReturn(mimeType);
+        EasyMock.expect(defaultHttpContext.getResource((String)EasyMock.anyObject())).andReturn(url);
+        EasyMock.replay(defaultHttpContext);
+    }
+
+    public void testFilterRequired() throws Exception {
+        // Mock up the service references
+        ServiceReference[] serviceReferences = new ServiceReference[] {};
+
+        // Mock up the bundle context
+        BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.expect(bundleContext.getServiceReferences(Filter.class.getName(),
+                                                           "(org.apache.cxf.httpservice.filter=true)"))
+            .andReturn(serviceReferences);
+        EasyMock.replay(bundleContext);
+
+        // Set up the secure http context
+        httpContext = new SecurityDelegatingHttpContext(bundleContext, defaultHttpContext);
+        httpContext.requireFilter = true;
+
+        // Ensure that the httpContext doesn't allow the request to be processed, since there are no registered servlet
+        // filters
+        HttpServletRequest request = EasyMock.createNiceMock(HttpServletRequest.class);
+        EasyMock.replay(request);
+        HttpServletResponse response = EasyMock.createNiceMock(HttpServletResponse.class);
+        EasyMock.replay(response);
+        boolean requestAllowed = httpContext.handleSecurity(request, response);
+        Assert.assertFalse(requestAllowed);
+
+        // Ensure that the httpContext returns true if there is no requirement for registered servlet filters
+        httpContext.requireFilter = false;
+        requestAllowed = httpContext.handleSecurity(request, response);
+        Assert.assertTrue(requestAllowed);
+    }
+
+    public void testSingleCommitFilter() throws Exception {
+        // Mock up the service references
+        ServiceReference filterReference = EasyMock.createNiceMock(ServiceReference.class);
+        EasyMock.replay(filterReference);
+        ServiceReference[] serviceReferences = new ServiceReference[] {
+            filterReference
+        };
+
+        // Mock up the bundle context
+        BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.expect(bundleContext.getServiceReferences((String)EasyMock.anyObject(), (String)EasyMock.anyObject()))
+            .andReturn(serviceReferences);
+        EasyMock.expect(bundleContext.getService((ServiceReference)EasyMock.anyObject())).andReturn(commitFilter);
+        EasyMock.replay(bundleContext);
+
+        // Set up the secure http context
+        httpContext = new SecurityDelegatingHttpContext(bundleContext, defaultHttpContext);
+
+        // Ensure that the httpContext returns false, since the filter has committed the response
+        HttpServletRequest request = EasyMock.createNiceMock(HttpServletRequest.class);
+        EasyMock.replay(request);
+        HttpServletResponse response = EasyMock.createNiceMock(HttpServletResponse.class);
+        EasyMock.expect(response.isCommitted()).andReturn(false); // the first call checks to see whether to invoke the
+                                                                  // filter
+        EasyMock.expect(response.isCommitted()).andReturn(true); // the second is called to determine the handleSecurity
+                                                                 // return value
+        EasyMock.expect(response.getWriter()).andReturn(new PrintWriter(System.out));
+        EasyMock.replay(response);
+        Assert.assertFalse(httpContext.handleSecurity(request, response));
+
+        // Ensure that the appropriate filters were called
+        Assert.assertTrue(commitFilter.called);
+        Assert.assertFalse(doNothingFilter.called);
+        Assert.assertFalse(accessDeniedFilter.called);
+    }
+
+    public void testFilterChain() throws Exception {
+        // Mock up the service references
+        ServiceReference filterReference = EasyMock.createNiceMock(ServiceReference.class);
+        EasyMock.replay(filterReference);
+        ServiceReference[] serviceReferences = new ServiceReference[] {
+            filterReference, filterReference
+        };
+
+        // Mock up the bundle context
+        BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.expect(bundleContext.getServiceReferences((String)EasyMock.anyObject(), (String)EasyMock.anyObject()))
+            .andReturn(serviceReferences);
+        EasyMock.expect(bundleContext.getService((ServiceReference)EasyMock.anyObject())).andReturn(doNothingFilter);
+        EasyMock.expect(bundleContext.getService((ServiceReference)EasyMock.anyObject())).andReturn(commitFilter);
+        EasyMock.replay(bundleContext);
+
+        // Set up the secure http context
+        httpContext = new SecurityDelegatingHttpContext(bundleContext, defaultHttpContext);
+
+        // Ensure that the httpContext returns false, since the filter has committed the response
+        HttpServletRequest request = EasyMock.createNiceMock(HttpServletRequest.class);
+        EasyMock.replay(request);
+        HttpServletResponse response = EasyMock.createNiceMock(HttpServletResponse.class);
+        EasyMock.expect(response.isCommitted()).andReturn(false); // doNothingFilter should not commit the response
+        EasyMock.expect(response.getWriter()).andReturn(new PrintWriter(System.out));
+        EasyMock.expect(response.isCommitted()).andReturn(false);
+        EasyMock.expect(response.isCommitted()).andReturn(true); // the commit filter indicating that it committed the
+                                                                 // response
+        EasyMock.replay(response);
+        Assert.assertFalse(httpContext.handleSecurity(request, response));
+
+        // Ensure that the appropriate filters were called
+        Assert.assertTrue(doNothingFilter.called);
+        Assert.assertTrue(commitFilter.called);
+        Assert.assertFalse(accessDeniedFilter.called);
+    }
+
+    public void testAllowRequest() throws Exception {
+        // Mock up the service references
+        ServiceReference filterReference = EasyMock.createNiceMock(ServiceReference.class);
+        EasyMock.replay(filterReference);
+        ServiceReference[] serviceReferences = new ServiceReference[] {
+            filterReference
+        };
+
+        // Mock up the bundle context
+        BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.expect(bundleContext.getServiceReferences((String)EasyMock.anyObject(), (String)EasyMock.anyObject()))
+            .andReturn(serviceReferences);
+        EasyMock.expect(bundleContext.getService((ServiceReference)EasyMock.anyObject())).andReturn(doNothingFilter);
+        EasyMock.replay(bundleContext);
+
+        // Set up the secure http context
+        httpContext = new SecurityDelegatingHttpContext(bundleContext, defaultHttpContext);
+
+        // Ensure that the httpContext returns true, since the filter has not committed the response
+        HttpServletRequest request = EasyMock.createNiceMock(HttpServletRequest.class);
+        EasyMock.replay(request);
+        HttpServletResponse response = EasyMock.createNiceMock(HttpServletResponse.class);
+        EasyMock.expect(response.isCommitted()).andReturn(false);
+        EasyMock.replay(response);
+        Assert.assertTrue(httpContext.handleSecurity(request, response));
+
+        // Ensure that the appropriate filters were called
+        Assert.assertTrue(doNothingFilter.called);
+        Assert.assertFalse(commitFilter.called);
+        Assert.assertFalse(accessDeniedFilter.called);
+    }
+
+    public void testDelegation() throws Exception {
+        BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.replay(bundleContext);
+
+        // Set up the secure http context
+        httpContext = new SecurityDelegatingHttpContext(bundleContext, defaultHttpContext);
+
+        // Ensure that it delegates non-security calls to the wrapped implementation (in this case, the mock)
+        Assert.assertEquals(mimeType, httpContext.getMimeType(""));
+        Assert.assertEquals(url, httpContext.getResource(""));
+    }
+}
+
+class CommitResponseFilter implements Filter {
+
+    boolean called;
+
+    public void init(FilterConfig filterConfig) throws ServletException {
+    }
+
+    public void destroy() {
+    }
+
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
+        throws java.io.IOException, javax.servlet.ServletException {
+        called = true;
+        response.getWriter().write("committing the response");
+    }
+}
+
+class DoNothingFilter implements Filter {
+
+    boolean called;
+
+    public void init(FilterConfig filterConfig) throws ServletException {
+    }
+
+    public void destroy() {
+    }
+
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
+        throws java.io.IOException, javax.servlet.ServletException {
+        called = true;
+        chain.doFilter(request, response);
+    }
+}
+
+class AccessDeniedFilter implements Filter {
+
+    boolean called;
+
+    public void init(FilterConfig filterConfig) throws ServletException {
+    }
+
+    public void destroy() {
+    }
+
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
+        throws java.io.IOException, javax.servlet.ServletException {
+        called = true;
+        ((HttpServletResponse)response).sendError(HttpServletResponse.SC_FORBIDDEN);
+    }
+}


[05/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

Posted by cs...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProvider.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProvider.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProvider.java
deleted file mode 100644
index 46f83eb..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProvider.java
+++ /dev/null
@@ -1,178 +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.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.cxf.dosgi.dsw.Constants;
-import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
-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.OsgiUtils;
-import org.apache.cxf.dosgi.dsw.util.StringPlus;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class CXFDistributionProvider implements DistributionProvider {
-
-    protected static final String DEFAULT_CONFIGURATION_TYPE = Constants.WS_CONFIG_TYPE;
-    private static final Logger LOG = LoggerFactory.getLogger(CXFDistributionProvider.class);
-
-    // protected because of tests
-    protected final String[] supportedConfigurationTypes;
-
-    private IntentManager intentManager;
-    private PojoConfigurationTypeHandler pojoConfigurationTypeHandler;
-    private JaxRSPojoConfigurationTypeHandler jaxRsPojoConfigurationTypeHandler;
-    private WsdlConfigurationTypeHandler wsdlConfigurationTypeHandler;
-    private Set<String> configTypesSet;
-
-    public CXFDistributionProvider(BundleContext bc, IntentManager intentManager,
-                                    HttpServiceManager httpServiceManager) {
-        this.intentManager = intentManager;
-        this.pojoConfigurationTypeHandler = new PojoConfigurationTypeHandler(bc, intentManager, httpServiceManager);
-        this.jaxRsPojoConfigurationTypeHandler = new JaxRSPojoConfigurationTypeHandler(bc,
-                                                                                       intentManager,
-                                                                                       httpServiceManager);
-        this.wsdlConfigurationTypeHandler = new WsdlConfigurationTypeHandler(bc, intentManager, httpServiceManager);
-        supportedConfigurationTypes = new String[] {Constants.WS_CONFIG_TYPE,
-                                                    Constants.WSDL_CONFIG_TYPE, 
-                                                    Constants.RS_CONFIG_TYPE, 
-                                                    Constants.WS_CONFIG_TYPE_OLD};
-        configTypesSet = new HashSet<>(Arrays.asList(supportedConfigurationTypes));
-    }
-    
-    @SuppressWarnings("rawtypes")
-    @Override
-    public Endpoint exportService(Object serviceO, 
-                                  BundleContext serviceContext,
-                                  Map<String, Object> effectiveProperties,
-                                  Class[] exportedInterfaces) {
-        List<String> configurationTypes = determineConfigurationTypes(effectiveProperties);
-        DistributionProvider handler = getHandler(configurationTypes, effectiveProperties);
-        return handler != null ? handler.exportService(serviceO, serviceContext, 
-                                                       effectiveProperties, exportedInterfaces) : null;
-    }
-
-    @SuppressWarnings("rawtypes")
-    @Override
-    public Object importEndpoint(ClassLoader consumerLoader, BundleContext consumerContext, 
-                                 Class[] iClass, EndpointDescription endpoint)
-        throws IntentUnsatisfiedException {
-        List<String> configurationTypes = determineConfigTypesForImport(endpoint);
-        DistributionProvider handler = getHandler(configurationTypes, endpoint.getProperties());
-        return handler != null ? handler.importEndpoint(consumerLoader, consumerContext, iClass, endpoint) : null;
-    }
-
-    DistributionProvider getHandler(List<String> configurationTypes,
-                                            Map<String, Object> serviceProperties) {
-        intentManager.assertAllIntentsSupported(serviceProperties);
-        if (configurationTypes.contains(Constants.WS_CONFIG_TYPE)
-            || configurationTypes.contains(Constants.WS_CONFIG_TYPE_OLD)
-            || configurationTypes.contains(Constants.RS_CONFIG_TYPE)) {
-            boolean jaxrs = isJaxrsRequested(configurationTypes, serviceProperties);
-            return jaxrs ? jaxRsPojoConfigurationTypeHandler : pojoConfigurationTypeHandler;
-        } else if (configurationTypes.contains(Constants.WSDL_CONFIG_TYPE)) {
-            return wsdlConfigurationTypeHandler;
-        }
-        LOG.info("None of the configuration types in " + configurationTypes + " is supported.");
-        return null;
-    }
-
-    private boolean isJaxrsRequested(Collection<String> types, Map<String, Object> serviceProperties) {
-        if (types == null) {
-            return false;
-        }
-
-        if (types.contains(Constants.RS_CONFIG_TYPE)) {
-            Collection<String> intentsProperty
-                = OsgiUtils.getMultiValueProperty(serviceProperties.get(RemoteConstants.SERVICE_EXPORTED_INTENTS));
-            boolean hasHttpIntent = false;
-            boolean hasSoapIntent = false;
-            if (intentsProperty != null) {
-                for (String intent : intentsProperty) {
-                    if (intent.contains("SOAP")) {
-                        hasSoapIntent = true;
-                        break;
-                    }
-
-                    if (intent.contains("HTTP")) {
-                        hasHttpIntent = true;
-                    }
-                }
-            }
-            if ((hasHttpIntent && !hasSoapIntent) || intentsProperty == null) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * determine which configuration types should be used / if the requested are
-     * supported
-     */
-    List<String> determineConfigurationTypes(Map<String, Object> serviceProperties) {
-        String[] requestedConfigurationTypes = StringPlus.normalize(serviceProperties
-                .get(RemoteConstants.SERVICE_EXPORTED_CONFIGS));
-        if (requestedConfigurationTypes == null || requestedConfigurationTypes.length == 0) {
-            return Collections.singletonList(DEFAULT_CONFIGURATION_TYPE);
-        }
-
-        List<String> configurationTypes = new ArrayList<String>();
-        for (String rct : requestedConfigurationTypes) {
-            if (configTypesSet.contains(rct)) {
-                configurationTypes.add(rct);
-            }
-        }
-        LOG.info("Configuration types selected for export: {}.", configurationTypes);
-        return configurationTypes;
-    }
-
-    private List<String> determineConfigTypesForImport(EndpointDescription endpoint) {
-        List<String> remoteConfigurationTypes = endpoint.getConfigurationTypes();
-
-        List<String> usableConfigurationTypes = new ArrayList<String>();
-        for (String ct : supportedConfigurationTypes) {
-            if (remoteConfigurationTypes.contains(ct)) {
-                usableConfigurationTypes.add(ct);
-            }
-        }
-
-        LOG.info("Ignoring endpoint {} as it has no compatible configuration types: {}.", 
-                 endpoint.getId(), remoteConfigurationTypes);
-        return usableConfigurationTypes;
-    }
-
-    public String[] getSupportedTypes() {
-        return supportedConfigurationTypes;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ClassUtils.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ClassUtils.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ClassUtils.java
deleted file mode 100644
index cae19bd..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ClassUtils.java
+++ /dev/null
@@ -1,142 +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.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cxf.helpers.CastUtils;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public final class ClassUtils {
-
-    private static final Logger LOG = LoggerFactory.getLogger(ClassUtils.class);
-
-    private ClassUtils() {
-    }
-
-    public static Class<?> getInterfaceClass(Object service, String interfaceName) {
-        return getInterfaceClass(service.getClass(), interfaceName);
-    }
-
-    private static Class<?> getInterfaceClass(Class<?> serviceClass, String interfaceName) {
-        for (Class<?> iClass : serviceClass.getInterfaces()) {
-            if (iClass.getName().equals(interfaceName)) {
-                return iClass;
-            }
-            Class<?> intf = getInterfaceClass(iClass, interfaceName);
-            if (intf != null) {
-                return intf;
-            }
-        }
-
-        if (serviceClass.getName().equals(interfaceName)) {
-            return serviceClass;
-        }
-
-        Class<?> interfaceOnProxiedClass = getInterfaceClassOnSuperClasses(serviceClass, interfaceName);
-        if (interfaceOnProxiedClass != null) {
-            return interfaceOnProxiedClass;
-        }
-
-        return null;
-    }
-
-    /**
-     * This method tries to deal specifically with classes that might have been proxied
-     * eg. CGLIB proxies of which there might be a chain of proxies as different osgi frameworks
-     * might be proxying the original service class that has been registered and then proxying the proxy.
-     *
-     * @param serviceClass
-     * @param interfaceName
-     * @return
-     */
-    private static Class<?> getInterfaceClassOnSuperClasses(Class<?> serviceClass, String interfaceName) {
-        Class<?> superClass = serviceClass.getSuperclass();
-        if (superClass != null) {
-            for (Class<?> iClass : superClass.getInterfaces()) {
-                if (iClass.getName().equals(interfaceName)) {
-                    return iClass;
-                }
-                Class<?> intf = getInterfaceClass(iClass, interfaceName);
-                if (intf != null) {
-                    return intf;
-                }
-            }
-            Class<?> foundOnSuperclass = getInterfaceClassOnSuperClasses(superClass, interfaceName);
-            if (foundOnSuperclass != null) {
-                return foundOnSuperclass;
-            }
-        }
-        return null;
-    }
-
-    public static List<Object> loadProviderClasses(BundleContext callingContext,
-                                                   Map<String, Object> sd, String propName) {
-        Object serviceProviders = sd.get(propName);
-        if (serviceProviders != null) {
-            if (serviceProviders.getClass().isArray()) {
-                if (serviceProviders.getClass().getComponentType() == String.class) {
-                    return loadProviders(callingContext, (String[])serviceProviders);
-                } else {
-                    return Arrays.asList((Object[])serviceProviders);
-                }
-            } else if (serviceProviders.getClass() == String.class) {
-                String[] classNames = serviceProviders.toString().split(",");
-                return loadProviders(callingContext, classNames);
-            } else if (serviceProviders instanceof List) { 
-                List<Object> list = CastUtils.cast((List<?>)serviceProviders);
-                if (!list.isEmpty()) {
-                    List<Object> providers;
-                    if (list.get(0).getClass() == String.class) {
-                        providers = loadProviders(callingContext, list.toArray(new String[]{}));
-                    } else {
-                        providers = list;
-                    }
-                    return providers;
-                }
-            } else {
-                return Arrays.asList(serviceProviders);
-            }
-        }
-        return Collections.emptyList();
-        
-    }
-
-    private static List<Object> loadProviders(BundleContext callingContext, String[] classNames) {
-        List<Object> providers = new ArrayList<Object>();
-        for (String className : classNames) {
-            try {
-                String realName = className.trim();
-                if (!realName.isEmpty()) {
-                    Class<?> pClass = callingContext.getBundle().loadClass(realName);
-                    providers.add(pClass.newInstance());
-                }
-            } catch (Exception ex) {
-                LOG.warn("Provider " + className.trim() + " can not be loaded or created " + ex.getMessage(), ex);
-            }
-        }
-        return providers;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
deleted file mode 100644
index eca5460..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
+++ /dev/null
@@ -1,176 +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.Collections;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
-
-import org.apache.cxf.Bus;
-import org.apache.cxf.transport.http.DestinationRegistry;
-import org.apache.cxf.transport.http.DestinationRegistryImpl;
-import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceException;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.http.HttpContext;
-import org.osgi.service.http.HttpService;
-import org.osgi.util.tracker.ServiceTracker;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class HttpServiceManager {
-
-    private static final Logger LOG = LoggerFactory.getLogger(HttpServiceManager.class);
-    private static final long SERVICE_LOOKUP_TIMEOUT = 10000;
-    private ServiceTracker<HttpService, HttpService> tracker;
-    private BundleContext bundleContext;
-    private Map<Long, String> exportedAliases = Collections.synchronizedMap(new HashMap<Long, String>());
-    private String httpBase;
-    private String cxfServletAlias;
-
-    public HttpServiceManager(BundleContext bundleContext, String httpBase, String cxfServletAlias) {
-        this(bundleContext, httpBase, cxfServletAlias,
-             new ServiceTracker<HttpService, HttpService>(bundleContext, HttpService.class, null));
-        this.tracker.open();
-    }
-
-    // Only for tests
-    public HttpServiceManager(BundleContext bundleContext,
-                              String httpBase, String cxfServletAlias,
-                              ServiceTracker<HttpService, HttpService> tracker) {
-        this.bundleContext = bundleContext;
-        this.tracker = tracker;
-        this.httpBase = getWithDefault(httpBase, "http://" + LocalHostUtil.getLocalIp() + ":8181");
-        this.cxfServletAlias = getWithDefault(cxfServletAlias, "/cxf");
-    }
-
-    private String getWithDefault(String value, String defaultValue) {
-        return value == null ? defaultValue : value;
-    }
-
-    public Bus registerServlet(Bus bus, String contextRoot, BundleContext callingContext, Long sid) {
-        bus.setExtension(new DestinationRegistryImpl(), DestinationRegistry.class);
-        CXFNonSpringServlet cxf = new CXFNonSpringServlet();
-        cxf.setBus(bus);
-        try {
-            HttpService httpService = getHttpService();
-            httpService.registerServlet(contextRoot, cxf, new Hashtable<String, String>(),
-                                       getHttpContext(callingContext, httpService));
-
-            registerUnexportHook(sid, contextRoot);
-
-            LOG.info("Successfully registered CXF DOSGi servlet at " + contextRoot);
-        } catch (Exception e) {
-            throw new ServiceException("CXF DOSGi: problem registering CXF HTTP Servlet", e);
-        }
-        return bus;
-    }
-
-    protected HttpService getHttpService() {
-        HttpService service = null;
-        try {
-            service = tracker.waitForService(SERVICE_LOOKUP_TIMEOUT);
-        } catch (InterruptedException ex) {
-            LOG.warn("waitForService interrupeted", ex);
-        }
-        if (service == null) {
-            throw new RuntimeException("No HTTPService found");
-        }
-        return service;
-    }
-
-    private HttpContext getHttpContext(BundleContext bc, HttpService httpService) {
-        HttpContext httpContext = httpService.createDefaultHttpContext();
-        return new SecurityDelegatingHttpContext(bc, httpContext);
-    }
-
-    /**
-     * This listens for service removal events and "un-exports" the service
-     * from the HttpService.
-     *
-     * @param sref the service reference to track
-     * @param alias the HTTP servlet context alias
-     */
-    private void registerUnexportHook(Long sid, String alias) {
-        LOG.debug("Registering service listener for service with ID {}", sid);
-
-        String previous = exportedAliases.put(sid, alias);
-        if (previous != null) {
-            LOG.warn("Overwriting service export for service with ID {}", sid);
-        }
-
-        try {
-            Filter f = bundleContext.createFilter("(" + org.osgi.framework.Constants.SERVICE_ID + "=" + sid + ")");
-            if (f != null) {
-                bundleContext.addServiceListener(new UnregisterListener(), f.toString());
-            } else {
-                LOG.warn("Service listener could not be started. The service will not be automatically unexported.");
-            }
-        } catch (InvalidSyntaxException e) {
-            LOG.warn("Service listener could not be started. The service will not be automatically unexported.", e);
-        }
-    }
-
-    protected String getDefaultAddress(Class<?> type) {
-        return "/" + type.getName().replace('.', '/');
-    }
-
-    protected String getAbsoluteAddress(String contextRoot, String relativeEndpointAddress) {
-        if (relativeEndpointAddress.startsWith("http")) {
-            return relativeEndpointAddress;
-        }
-        String effContextRoot = contextRoot == null ? cxfServletAlias : contextRoot;
-        return this.httpBase + effContextRoot + relativeEndpointAddress;
-    }
-
-    public void close() {
-        tracker.close();
-    }
-
-    private final class UnregisterListener implements ServiceListener {
-
-        public void serviceChanged(ServiceEvent event) {
-            if (!(event.getType() == ServiceEvent.UNREGISTERING)) {
-                return;
-            }
-            final ServiceReference<?> sref = event.getServiceReference();
-            final Long sid = (Long) sref.getProperty(org.osgi.framework.Constants.SERVICE_ID);
-            final String alias = exportedAliases.remove(sid);
-            if (alias == null) {
-                LOG.error("Unable to unexport HTTP servlet for service class '{}',"
-                        + " service-id {}: no servlet alias found",
-                        sref.getProperty(org.osgi.framework.Constants.OBJECTCLASS), sid);
-                return;
-            }
-            LOG.debug("Unexporting HTTP servlet for alias '{}'", alias);
-            try {
-                HttpService http = getHttpService();
-                http.unregister(alias);
-            } catch (Exception e) {
-                LOG.warn("An exception occurred while unregistering service for HTTP servlet alias '{}'", alias, e);
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/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
deleted file mode 100644
index 3249de7..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
+++ /dev/null
@@ -1,201 +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.net.URL;
-import java.util.List;
-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.Endpoint;
-import org.apache.cxf.dosgi.dsw.api.IntentUnsatisfiedException;
-import org.apache.cxf.dosgi.dsw.qos.IntentManager;
-import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
-import org.apache.cxf.endpoint.Server;
-import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
-import org.apache.cxf.jaxrs.client.Client;
-import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
-import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
-import org.apache.cxf.jaxrs.model.UserResource;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class JaxRSPojoConfigurationTypeHandler extends AbstractPojoConfigurationTypeHandler {
-
-    private static final Logger LOG = LoggerFactory.getLogger(JaxRSPojoConfigurationTypeHandler.class);
-
-    public JaxRSPojoConfigurationTypeHandler(BundleContext dswBC,
-                                             IntentManager intentManager,
-                                             HttpServiceManager httpServiceManager) {
-        super(dswBC, intentManager, httpServiceManager);
-    }
-
-    public String[] getSupportedTypes() {
-        return new String[] {Constants.RS_CONFIG_TYPE};
-    }
-
-    @SuppressWarnings("rawtypes")
-    public Object importEndpoint(ClassLoader consumerLoader,
-                                 BundleContext consumerContext,
-                                 Class[] interfaces,
-                                 EndpointDescription endpoint) {
-        Class<?> iClass = interfaces[0];
-        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, consumerContext, iClass, null, endpoint);
-        } catch (Throwable e) {
-            Thread.currentThread().setContextClassLoader(oldClassLoader);
-        }
-
-        try {
-            ProxyClassLoader cl = new ProxyClassLoader(iClass.getClassLoader());
-            cl.addLoader(Client.class.getClassLoader());
-            return createJaxrsProxy(address, consumerContext, iClass, cl, endpoint);
-        } catch (Throwable e) {
-            LOG.warn("proxy creation failed", e);
-        }
-
-        return null;
-    }
-
-    protected Object createJaxrsProxy(String address,
-                                      BundleContext callingContext,
-                                      Class<?> iClass,
-                                      ClassLoader loader,
-                                      EndpointDescription endpoint) {
-        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
-        bean.setAddress(address);
-        if (loader != null) {
-            bean.setClassLoader(loader);
-        }
-
-        addRsInterceptorsFeaturesProps(bean, callingContext, endpoint.getProperties());
-
-        List<UserResource> resources = JaxRSUtils.getModel(callingContext, iClass);
-        if (resources != null) {
-            bean.setModelBeansWithServiceClass(resources, iClass);
-        } else {
-            bean.setServiceClass(iClass);
-        }
-        List<Object> providers = JaxRSUtils.getProviders(callingContext, endpoint.getProperties());
-        if (providers != null && !providers.isEmpty()) {
-            bean.setProviders(providers);
-        }
-        Thread.currentThread().setContextClassLoader(JAXRSClientFactoryBean.class.getClassLoader());
-        return getProxy(bean.create(), iClass);
-    }
-
-    @SuppressWarnings("rawtypes")
-    public Endpoint exportService(Object serviceBean,
-                                  BundleContext callingContext,
-                                  Map<String, Object> endpointProps,
-                                  Class[] exportedInterfaces) throws IntentUnsatisfiedException {
-        String contextRoot = getServletContextRoot(endpointProps);
-        String address;
-        Class<?> iClass = exportedInterfaces[0];
-        if (contextRoot == null) {
-            address = getServerAddress(endpointProps, iClass);
-        } else {
-            address = getClientAddress(endpointProps);
-            if (address == null) {
-                address = "/";
-            }
-        }
-        final Long sid = (Long) endpointProps.get(RemoteConstants.ENDPOINT_SERVICE_ID);
-        Bus bus = createBus(sid, callingContext, contextRoot);
-
-        LOG.info("Creating a " + iClass.getName()
-                 + " endpoint via JaxRSPojoConfigurationTypeHandler, address is " + address);
-
-        JAXRSServerFactoryBean factory = createServerFactory(callingContext, endpointProps, 
-                                                             iClass, serviceBean, address, bus);
-        String completeEndpointAddress = httpServiceManager.getAbsoluteAddress(contextRoot, address);
-
-        EndpointDescription epd = createEndpointDesc(endpointProps, new String[] {Constants.RS_CONFIG_TYPE},
-                completeEndpointAddress, new String[] {"HTTP"});
-
-        return createServerFromFactory(factory, epd);
-    }
-
-    private Endpoint createServerFromFactory(JAXRSServerFactoryBean factory,
-                                                       EndpointDescription epd) {
-        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
-        try {
-            Thread.currentThread().setContextClassLoader(JAXRSServerFactoryBean.class.getClassLoader());
-            Server server = factory.create();
-            return new ServerWrapper(epd, server);
-        } finally {
-            Thread.currentThread().setContextClassLoader(oldClassLoader);
-        }
-    }
-
-    private JAXRSServerFactoryBean createServerFactory(BundleContext callingContext,
-                                                       Map<String, Object> sd,
-                                                       Class<?> iClass,
-                                                       Object serviceBean,
-                                                       String address,
-                                                       Bus bus) {
-        JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
-        factory.setBus(bus);
-        List<UserResource> resources = JaxRSUtils.getModel(callingContext, iClass);
-        if (resources != null) {
-            factory.setModelBeansWithServiceClass(resources, iClass);
-            factory.setServiceBeanObjects(serviceBean);
-        } else {
-            factory.setServiceClass(iClass);
-            factory.setResourceProvider(iClass, new SingletonResourceProvider(serviceBean));
-        }
-        factory.setAddress(address);
-        List<Object> providers = JaxRSUtils.getProviders(callingContext, sd);
-        if (providers != null && !providers.isEmpty()) {
-            factory.setProviders(providers);
-        }
-        addRsInterceptorsFeaturesProps(factory, callingContext, sd);
-        String location = OsgiUtils.getProperty(sd, Constants.RS_WADL_LOCATION);
-        if (location != null) {
-            URL wadlURL = callingContext.getBundle().getResource(location);
-            if (wadlURL != null) {
-                factory.setDocLocation(wadlURL.toString());
-            }
-        }
-        return factory;
-    }
-
-    protected String getPojoAddress(EndpointDescription endpoint, Class<?> iClass) {
-        String address = OsgiUtils.getProperty(endpoint, Constants.RS_ADDRESS_PROPERTY);
-
-        if (address == null) {
-            address = httpServiceManager.getDefaultAddress(iClass);
-            if (address != null) {
-                LOG.info("Using a default address: " + address);
-            }
-        }
-        return address;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/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
deleted file mode 100644
index 6e78744..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java
+++ /dev/null
@@ -1,121 +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.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
-import org.apache.cxf.jaxrs.model.UserResource;
-import org.apache.cxf.jaxrs.provider.aegis.AegisElementProvider;
-import org.apache.cxf.jaxrs.utils.ResourceUtils;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public final class JaxRSUtils {
-
-    public static final String MODEL_FOLDER = "/OSGI-INF/cxf/jaxrs/";
-    public static final String DEFAULT_MODEL = "/OSGI-INF/cxf/jaxrs/model.xml";
-    public static final String PROVIDERS_FILTER = "(|"
-            + "(objectClass=javax.ws.rs.ext.MessageBodyReader)"
-            + "(objectClass=javax.ws.rs.ext.MessageBodyWriter)"
-            + "(objectClass=javax.ws.rs.ext.ExceptionMapper)"
-            + "(objectClass=org.apache.cxf.jaxrs.ext.RequestHandler)"
-            + "(objectClass=org.apache.cxf.jaxrs.ext.ResponseHandler)"
-            + "(objectClass=org.apache.cxf.jaxrs.ext.ParameterHandler)"
-            + "(objectClass=org.apache.cxf.jaxrs.ext.ResponseExceptionMapper)"
-            + ")";
-    private static final Logger LOG = LoggerFactory.getLogger(JaxRSUtils.class);
-
-    private 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))) {
-            providers.add(new AegisElementProvider());
-        }
-
-        providers.addAll(ClassUtils.loadProviderClasses(callingContext,
-                                                        sd,
-                                                        org.apache.cxf.dosgi.dsw.Constants.RS_PROVIDER_PROP_KEY));
-
-        Object globalQueryProp = sd.get(org.apache.cxf.dosgi.dsw.Constants.RS_PROVIDER_GLOBAL_PROP_KEY);
-        boolean globalQueryRequired = globalQueryProp == null || OsgiUtils.toBoolean(globalQueryProp);
-        if (!globalQueryRequired) {
-            return providers;
-        }
-
-        boolean cxfProvidersOnly = OsgiUtils.getBooleanProperty(sd,
-                org.apache.cxf.dosgi.dsw.Constants.RS_PROVIDER_EXPECTED_PROP_KEY);
-
-        try {
-            ServiceReference[] refs = callingContext.getServiceReferences((String)null, PROVIDERS_FILTER);
-            if (refs != null) {
-                for (ServiceReference ref : refs) {
-                    if (!cxfProvidersOnly
-                        || OsgiUtils.toBoolean(ref
-                            .getProperty(org.apache.cxf.dosgi.dsw.Constants.RS_PROVIDER_PROP_KEY))) {
-                        providers.add(callingContext.getService(ref));
-                    }
-                }
-            }
-        } catch (Exception ex) {
-            LOG.debug("Problems finding JAXRS providers " + ex.getMessage(), ex);
-        }
-        return providers;
-    }
-
-    static List<UserResource> getModel(BundleContext callingContext, Class<?> iClass) {
-        String classModel = MODEL_FOLDER + iClass.getSimpleName() + "-model.xml";
-        List<UserResource> list = getModel(callingContext, iClass, classModel);
-        return list != null ? list : getModel(callingContext, iClass, DEFAULT_MODEL);
-    }
-
-    private static List<UserResource> getModel(BundleContext callingContext, Class<?> iClass, String name) {
-        InputStream r = iClass.getClassLoader().getResourceAsStream(name);
-        if (r == null) {
-            URL u = callingContext.getBundle().getResource(name);
-            if (u != null) {
-                try {
-                    r = u.openStream();
-                } catch (Exception ex) {
-                    LOG.info("Problems opening a user model resource at " + u.toString());
-                }
-            }
-        }
-        if (r != null) {
-            try {
-                return ResourceUtils.getUserResources(r);
-            } catch (Exception ex) {
-                LOG.info("Problems reading a user model, it will be ignored");
-            }
-        }
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/LocalHostUtil.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/LocalHostUtil.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/LocalHostUtil.java
deleted file mode 100644
index 50e2127..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/LocalHostUtil.java
+++ /dev/null
@@ -1,92 +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.net.InetAddress;
-import java.net.NetworkInterface;
-import java.net.SocketException;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-
-/**
- * Utility methods to get the local address even on a linux host.
- */
-public final class LocalHostUtil {
-
-    private LocalHostUtil() {
-        // Util Class
-    }
-
-    /**
-     * Returns an InetAddress representing the address of the localhost. Every
-     * attempt is made to find an address for this host that is not the loopback
-     * address. If no other address can be found, the loopback will be returned.
-     *
-     * @return InetAddress the address of localhost
-     * @throws UnknownHostException if there is a problem determining the address
-     */
-    public static InetAddress getLocalHost() throws UnknownHostException {
-        InetAddress localHost = InetAddress.getLocalHost();
-        if (!localHost.isLoopbackAddress()) {
-            return localHost;
-        }
-        InetAddress[] addrs = getAllLocalUsingNetworkInterface();
-        for (InetAddress addr : addrs) {
-            if (!addr.isLoopbackAddress() && !addr.getHostAddress().contains(":")) {
-                return addr;
-            }
-        }
-        return localHost;
-    }
-
-    /**
-     * Utility method that delegates to the methods of NetworkInterface to
-     * determine addresses for this machine.
-     *
-     * @return all addresses found from the NetworkInterfaces
-     * @throws UnknownHostException if there is a problem determining addresses
-     */
-    private static InetAddress[] getAllLocalUsingNetworkInterface() throws UnknownHostException {
-        try {
-            List<InetAddress> addresses = new ArrayList<InetAddress>();
-            Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces();
-            while (e.hasMoreElements()) {
-                NetworkInterface ni = e.nextElement();
-                for (Enumeration<InetAddress> e2 = ni.getInetAddresses(); e2.hasMoreElements();) {
-                    addresses.add(e2.nextElement());
-                }
-            }
-            return addresses.toArray(new InetAddress[] {});
-        } catch (SocketException ex) {
-            throw new UnknownHostException("127.0.0.1");
-        }
-    }
-
-    public static String getLocalIp() {
-        String localIP;
-        try {
-            localIP = getLocalHost().getHostAddress();
-        } catch (Exception e) {
-            localIP = "localhost";
-        }
-        return localIP;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/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
deleted file mode 100644
index 512f96f..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java
+++ /dev/null
@@ -1,172 +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 javax.jws.WebService;
-
-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.Endpoint;
-import org.apache.cxf.dosgi.dsw.api.IntentUnsatisfiedException;
-import org.apache.cxf.dosgi.dsw.qos.IntentManager;
-import org.apache.cxf.frontend.ClientProxyFactoryBean;
-import org.apache.cxf.frontend.ServerFactoryBean;
-import org.apache.cxf.jaxb.JAXBDataBinding;
-import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
-import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class PojoConfigurationTypeHandler extends AbstractPojoConfigurationTypeHandler {
-
-    private static final Logger LOG = LoggerFactory.getLogger(PojoConfigurationTypeHandler.class);
-
-    public PojoConfigurationTypeHandler(BundleContext dswBC,
-                                        IntentManager intentManager,
-                                        HttpServiceManager httpServiceManager) {
-        super(dswBC, intentManager, httpServiceManager);
-    }
-
-    public String[] getSupportedTypes() {
-        return new String[] {Constants.WS_CONFIG_TYPE, Constants.WS_CONFIG_TYPE_OLD};
-    }
-
-    @SuppressWarnings("rawtypes")
-    public Object importEndpoint(ClassLoader consumerLoader,
-                                 BundleContext consumerContext,
-                                 Class[] interfaces,
-                                 EndpointDescription endpoint) throws IntentUnsatisfiedException {
-        Class<?> iClass = interfaces[0];
-        Map<String, Object> sd = endpoint.getProperties();
-        String address = getClientAddress(sd);
-        if (address == null) {
-            LOG.warn("Remote address is unavailable");
-            // TODO: fire Event
-            return null;
-        }
-
-        LOG.info("Creating a " + iClass.getName() + " client, endpoint address is " + address);
-
-        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
-        try {
-            ClientProxyFactoryBean factory = createClientProxyFactoryBean(sd, iClass);
-            factory.getServiceFactory().setDataBinding(getDataBinding(sd, iClass));
-            factory.setServiceClass(iClass);
-            factory.setAddress(address);
-            addWsInterceptorsFeaturesProps(factory.getClientFactoryBean(), consumerContext, sd);
-            setClientWsdlProperties(factory.getClientFactoryBean(), bundleContext, sd, false);
-
-            intentManager.applyIntents(factory.getFeatures(), factory.getClientFactoryBean(), sd);
-
-            Thread.currentThread().setContextClassLoader(ClientProxyFactoryBean.class.getClassLoader());
-            return getProxy(factory.create(), iClass);
-        } catch (Exception e) {
-            LOG.warn("proxy creation failed", e);
-        } finally {
-            Thread.currentThread().setContextClassLoader(oldClassLoader);
-        }
-        return null;
-    }
-
-    @SuppressWarnings("rawtypes")
-    public Endpoint exportService(Object serviceO,
-                                  BundleContext serviceContext,
-                                  Map<String, Object> endpointProps,
-                                  Class[] exportedInterfaces) throws IntentUnsatisfiedException {
-        Class<?> iClass = exportedInterfaces[0];
-        String address = getPojoAddress(endpointProps, iClass);
-        ServerFactoryBean factory = createServerFactoryBean(endpointProps, iClass);
-        factory.setDataBinding(getDataBinding(endpointProps, iClass));
-        String contextRoot = getServletContextRoot(endpointProps);
-
-        final Long sid = (Long) endpointProps.get(RemoteConstants.ENDPOINT_SERVICE_ID);
-        Bus bus = createBus(sid, serviceContext, contextRoot);
-        factory.setBus(bus);
-        factory.setServiceClass(iClass);
-        factory.setAddress(address);
-        
-        factory.setServiceBean(serviceO);
-        addWsInterceptorsFeaturesProps(factory, serviceContext, endpointProps);
-        setWsdlProperties(factory, serviceContext, endpointProps, false);
-        String[] intents = intentManager.applyIntents(factory.getFeatures(), factory, endpointProps);
-
-        String completeEndpointAddress = httpServiceManager.getAbsoluteAddress(contextRoot, address);
-        EndpointDescription epd = createEndpointDesc(endpointProps,
-                                                     new String[]{Constants.WS_CONFIG_TYPE},
-                                                     completeEndpointAddress, intents);
-        return createServerFromFactory(factory, epd);
-    }
-
-    private String getPojoAddress(Map<String, Object> sd, Class<?> iClass) {
-        String address = getClientAddress(sd);
-        if (address != null) {
-            return address;
-        }
-
-        // If the property is not of type string this will cause an ClassCastException which
-        // will be propagated to the ExportRegistration exception property.
-        Object port = sd.get(Constants.WS_PORT_PROPERTY);
-        if (port == null) {
-            port = "9000";
-        }
-
-        address = "http://localhost:" + port + "/" + iClass.getName().replace('.', '/');
-        LOG.info("Using a default address: " + address);
-        return address;
-    }
-
-    private DataBinding getDataBinding(Map<String, Object> sd, Class<?> iClass) {
-        Object dataBindingBeanProp = sd.get(Constants.WS_DATABINDING_BEAN_PROP_KEY);
-        if (dataBindingBeanProp instanceof DataBinding) {
-            return (DataBinding)dataBindingBeanProp;
-        } 
-        return isJAXB(sd, iClass) ? new JAXBDataBinding() : new AegisDatabinding();
-    }
-
-    private boolean isJAXB(Map<String, Object> sd, Class<?> iClass) {
-        String dataBindingName = (String)sd.get(Constants.WS_DATABINDING_PROP_KEY);
-        return (iClass.getAnnotation(WebService.class) != null
-            || Constants.WS_DATA_BINDING_JAXB.equals(dataBindingName))
-            && !Constants.WS_DATA_BINDING_AEGIS.equals(dataBindingName);
-    }
-
-    // Isolated so that it can be substituted for testing
-    protected ClientProxyFactoryBean createClientProxyFactoryBean(Map<String, Object> sd, Class<?> iClass) {
-        return isJAXWS(sd, iClass) ? new JaxWsProxyFactoryBean() : new ClientProxyFactoryBean();
-    }
-
-    // Isolated so that it can be substituted for testing
-    protected ServerFactoryBean createServerFactoryBean(Map<String, Object> sd, Class<?> iClass) {
-        return isJAXWS(sd, iClass) ? new JaxWsServerFactoryBean() : new ServerFactoryBean();
-    }
-
-    private boolean isJAXWS(Map<String, Object> sd, Class<?> iClass) {
-        String frontEnd = (String)sd.get(Constants.WS_FRONTEND_PROP_KEY);
-        return (iClass.getAnnotation(WebService.class) != null
-            || Constants.WS_FRONTEND_JAXWS.equals(frontEnd))
-            && !Constants.WS_FRONTEND_SIMPLE.equals(frontEnd);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContext.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContext.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContext.java
deleted file mode 100644
index 7e9710b..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContext.java
+++ /dev/null
@@ -1,133 +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.io.IOException;
-import java.net.URL;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.http.HttpContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * <p>
- * An HttpContext that delegates to another HttpContext for all things other than security. This implementation handles
- * security by delegating to a {@link FilterChain} based on the set of {@link Filter}s registered with a
- * {@link #FILTER_PROP} property.
- * </p>
- * <p>
- * If the {@link BundleContext} contains a {@link #FILTER_REQUIRED_PROP} property with value "true", requests will not
- * be allowed until at least one {@link Filter} with a {@link #FILTER_PROP} property is registered.
- * </p>
- */
-public class SecurityDelegatingHttpContext implements HttpContext {
-
-    public static final String FILTER_PROP = "org.apache.cxf.httpservice.filter";
-    public static final String FILTER_REQUIRED_PROP = "org.apache.cxf.httpservice.requirefilter";
-    private static final Logger LOG = LoggerFactory.getLogger(SecurityDelegatingHttpContext.class);
-    private static final String FILTER_FILTER = "(" + FILTER_PROP + "=*)";
-
-    BundleContext bundleContext;
-    HttpContext delegate;
-    boolean requireFilter;
-
-    public SecurityDelegatingHttpContext(BundleContext bundleContext, HttpContext delegate) {
-        this.bundleContext = bundleContext;
-        this.delegate = delegate;
-        requireFilter = Boolean.TRUE.toString().equalsIgnoreCase(bundleContext.getProperty(FILTER_REQUIRED_PROP));
-    }
-
-    public String getMimeType(String name) {
-        return delegate.getMimeType(name);
-    }
-
-    public URL getResource(String name) {
-        return delegate.getResource(name);
-    }
-
-    @SuppressWarnings({
-     "unchecked", "rawtypes"
-    })
-    public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException {
-        ServiceReference[] refs;
-        try {
-            refs = bundleContext.getServiceReferences(Filter.class.getName(), FILTER_FILTER);
-        } catch (InvalidSyntaxException e) {
-            LOG.warn(e.getMessage(), e);
-            return false;
-        }
-        if (refs == null || refs.length == 0) {
-            LOG.info("No filter registered.");
-            return !requireFilter;
-        }
-        Filter[] filters = new Filter[refs.length];
-        try {
-            for (int i = 0; i < refs.length; i++) {
-                filters[i] = (Filter)bundleContext.getService(refs[i]);
-            }
-            try {
-                new Chain(filters).doFilter(request, response);
-                return !response.isCommitted();
-            } catch (ServletException e) {
-                LOG.warn(e.getMessage(), e);
-                return false;
-            }
-        } finally {
-            for (int i = 0; i < refs.length; i++) {
-                if (filters[i] != null) {
-                    bundleContext.ungetService(refs[i]);
-                }
-            }
-        }
-    }
-}
-
-/**
- * A {@link FilterChain} composed of {@link Filter}s with the
- */
-class Chain implements FilterChain {
-
-    private static final Logger LOG = LoggerFactory.getLogger(Chain.class);
-
-    int current;
-    final Filter[] filters;
-
-    Chain(Filter[] filters) {
-        this.filters = filters;
-    }
-
-    public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
-        if (current < filters.length && !response.isCommitted()) {
-            Filter filter = filters[current++];
-            LOG.info("doFilter() on {}", filter);
-            filter.doFilter(request, response, this);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/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
deleted file mode 100644
index 67bcc63..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServerWrapper.java
+++ /dev/null
@@ -1,49 +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.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 Endpoint {
-    private EndpointDescription desc;
-    private Server server;
-
-    public ServerWrapper(EndpointDescription desc, Server server) {
-        this.desc = desc;
-        this.server = server;
-    }
-    
-    public Server getServer() {
-        return this.server;
-    }
-
-    @Override
-    public void close() throws IOException {
-        this.server.destroy();
-    }
-
-    @Override
-    public EndpointDescription description() {
-        return this.desc;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandler.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandler.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandler.java
deleted file mode 100644
index 6171a53..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandler.java
+++ /dev/null
@@ -1,100 +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.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.osgi.framework.ServiceException;
-
-public class ServiceInvocationHandler implements InvocationHandler {
-
-    private static final String REMOTE_EXCEPTION_TYPE = "REMOTE";
-    private static final Collection<Method> OBJECT_METHODS = Arrays.asList(Object.class.getMethods());
-
-    private Map<Method, List<Class<?>>> exceptionsMap = new HashMap<Method, List<Class<?>>>();
-    private Object serviceObject;
-
-    public ServiceInvocationHandler(Object serviceObject, Class<?> iType) {
-        this.serviceObject = serviceObject;
-        introspectType(iType);
-    }
-
-    public Object invoke(Object proxy, final Method m, Object[] params) throws Throwable {
-        if (OBJECT_METHODS.contains(m)) {
-            if (m.getName().equals("equals")) {
-                params = new Object[] {Proxy.getInvocationHandler(params[0])};
-            }
-            return m.invoke(this, params);
-        }
-
-        ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
-        try {
-            Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-            final Object[] paramsFinal = params;
-            return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
-                public Object run() throws Exception {
-                    return m.invoke(serviceObject, paramsFinal);
-                }
-            });
-        } catch (Throwable ex) {
-            Throwable theCause = ex.getCause() == null ? ex : ex.getCause();
-            Throwable theCauseCause = theCause.getCause() == null ? theCause : theCause.getCause();
-            List<Class<?>> excTypes = exceptionsMap.get(m);
-            if (excTypes != null) {
-                for (Class<?> type : excTypes) {
-                    if (type.isAssignableFrom(theCause.getClass())) {
-                        throw theCause;
-                    }
-                    if (type.isAssignableFrom(theCauseCause.getClass())) {
-                        throw theCauseCause;
-                    }
-                }
-            }
-
-            throw new ServiceException(REMOTE_EXCEPTION_TYPE, theCause);
-        } finally {
-            Thread.currentThread().setContextClassLoader(oldCl);
-        }
-    }
-
-    private void introspectType(Class<?> iType) {
-        for (Method m : iType.getDeclaredMethods()) {
-            for (Class<?> excType : m.getExceptionTypes()) {
-                if (Exception.class.isAssignableFrom(excType)) {
-                    List<Class<?>> types = exceptionsMap.get(m);
-                    if (types == null) {
-                        types = new ArrayList<Class<?>>();
-                        exceptionsMap.put(m, types);
-                    }
-                    types.add(excType);
-                }
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/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
deleted file mode 100644
index a7dcb55..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java
+++ /dev/null
@@ -1,160 +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.net.MalformedURLException;
-import java.net.URL;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.Service;
-
-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.Endpoint;
-import org.apache.cxf.dosgi.dsw.qos.IntentManager;
-import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
-import org.apache.cxf.jaxb.JAXBDataBinding;
-import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class WsdlConfigurationTypeHandler extends AbstractPojoConfigurationTypeHandler {
-
-    private static final Logger LOG = LoggerFactory.getLogger(WsdlConfigurationTypeHandler.class);
-
-    public WsdlConfigurationTypeHandler(BundleContext dswBC,
-                                        IntentManager intentManager,
-                                        HttpServiceManager httpServiceManager) {
-        super(dswBC, intentManager, httpServiceManager);
-    }
-
-    public String[] getSupportedTypes() {
-        return new String[] {Constants.WSDL_CONFIG_TYPE};
-    }
-
-    @SuppressWarnings("rawtypes")
-    public Object importEndpoint(ClassLoader consumerLoader,
-                                 BundleContext consumerContext,
-                                 Class[] interfaces,
-                                 EndpointDescription endpoint) {
-        Class<?> iClass = interfaces[0];
-        String wsdlAddressProp = getWsdlAddress(endpoint, iClass);
-        if (wsdlAddressProp == null) {
-            LOG.warn("WSDL address is unavailable");
-            return null;
-        }
-
-        URL wsdlAddress;
-        try {
-            wsdlAddress = new URL(wsdlAddressProp);
-        } catch (MalformedURLException ex) {
-            LOG.warn("WSDL address is malformed");
-            return null;
-        }
-
-        LOG.info("Creating a " + endpoint.getInterfaces().toArray()[0] + " client, wsdl address is "
-                 + OsgiUtils.getProperty(endpoint, Constants.WSDL_CONFIG_PREFIX));
-
-        String serviceNs = OsgiUtils.getProperty(endpoint, Constants.WSDL_SERVICE_NAMESPACE);
-        if (serviceNs == null) {
-            serviceNs = PackageUtils.getNamespace(PackageUtils.getPackageName(iClass));
-        }
-        String serviceName = OsgiUtils.getProperty(endpoint, Constants.WSDL_SERVICE_NAME);
-        if (serviceName == null) {
-            serviceName = iClass.getSimpleName();
-        }
-        QName serviceQname = getServiceQName(iClass, endpoint.getProperties(),
-                                             Constants.WSDL_SERVICE_NAMESPACE,
-                                             Constants.WSDL_SERVICE_NAME);
-        QName portQname = getPortQName(serviceQname.getNamespaceURI(),
-                endpoint.getProperties(), Constants.WSDL_PORT_NAME);
-        Service service = createWebService(wsdlAddress, serviceQname);
-        Object proxy = getProxy(portQname == null ? service.getPort(iClass) : service.getPort(portQname, iClass),
-                                iClass);
-        // MARC: FIXME!!!! getDistributionProvider().addRemoteService(serviceReference);
-        return proxy;
-    }
-
-    // Isolated so that it can be overridden for test purposes.
-    Service createWebService(URL wsdlAddress, QName serviceQname) {
-        return Service.create(wsdlAddress, serviceQname);
-    }
-
-    @SuppressWarnings("rawtypes")
-    public Endpoint exportService(Object serviceO,
-                                  BundleContext serviceContext,
-                                  Map<String, Object> sd,
-                                  Class[] exportedInterfaces) {
-        Class<?> iClass = exportedInterfaces[0];
-        String location = OsgiUtils.getProperty(sd, Constants.WSDL_LOCATION);
-        if (location == null) {
-            throw new RuntimeException("WSDL location property is unavailable");
-        }
-        URL wsdlURL = serviceContext.getBundle().getResource(location);
-        if (wsdlURL == null) {
-            throw new RuntimeException("WSDL resource at " + location + " is unavailable");
-        }
-
-        String address = getServerAddress(sd, iClass);
-        String contextRoot = getServletContextRoot(sd);
-        if (address == null && contextRoot == null) {
-            throw new RuntimeException("Remote address is unavailable");
-        }
-
-        LOG.info("Creating a " + iClass.getName() + " endpoint from CXF PublishHook, address is " + address);
-
-        DataBinding databinding = new JAXBDataBinding();
-        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
-        final Long sid = (Long) sd.get(RemoteConstants.ENDPOINT_SERVICE_ID);
-        Bus bus = createBus(sid, serviceContext, contextRoot);
-        factory.setBus(bus);
-        factory.setServiceClass(iClass);
-        factory.setAddress(address != null ? address : "/");
-        factory.getServiceFactory().setDataBinding(databinding);
-        factory.setServiceBean(serviceO);
-
-        addWsInterceptorsFeaturesProps(factory, serviceContext, sd);
-
-        setWsdlProperties(factory, serviceContext, sd, true);
-
-        String[] intents = intentManager.applyIntents(factory.getFeatures(), factory, sd);
-
-        EndpointDescription epd = createEndpointDesc(sd,
-                                                     new String[]{Constants.WS_CONFIG_TYPE},
-                                                     address, intents);
-        return createServerFromFactory(factory, epd);
-    }
-
-    private String getWsdlAddress(EndpointDescription endpoint, Class<?> iClass) {
-        String address = OsgiUtils.getProperty(endpoint, Constants.WSDL_CONFIG_PREFIX);
-        if (address == null) {
-            address = httpServiceManager.getDefaultAddress(iClass);
-            if (address != null) {
-                address += "?wsdl";
-            }
-        }
-        return address;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/DefaultIntentMapFactory.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/DefaultIntentMapFactory.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/DefaultIntentMapFactory.java
deleted file mode 100644
index 7e0dd2e..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/DefaultIntentMapFactory.java
+++ /dev/null
@@ -1,52 +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;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.cxf.binding.soap.Soap11;
-import org.apache.cxf.binding.soap.Soap12;
-import org.apache.cxf.binding.soap.SoapBindingConfiguration;
-import org.apache.cxf.binding.soap.SoapVersion;
-import org.apache.cxf.feature.LoggingFeature;
-
-public class DefaultIntentMapFactory {
-
-    public Map<String, Object> create() {
-        Map<String, Object> intentMap = new HashMap<String, Object>();
-        intentMap.put("logging", getLoggingFeature());
-        Object soap11 = getSoapBinding(Soap11.getInstance());
-        intentMap.put("SOAP", soap11);
-        intentMap.put("SOAP.1_1", soap11);
-        intentMap.put("SOAP.1_2", getSoapBinding(Soap12.getInstance()));
-        intentMap.put("HTTP", "PROVIDED");
-        return intentMap;
-    }
-
-    private Object getLoggingFeature() {
-        return new LoggingFeature();
-    }
-
-    private Object getSoapBinding(SoapVersion soapVersion) {
-        SoapBindingConfiguration soapBindingConfig = new SoapBindingConfiguration();
-        soapBindingConfig.setVersion(soapVersion);
-        return soapBindingConfig;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManager.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManager.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManager.java
deleted file mode 100644
index ecaf070..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManager.java
+++ /dev/null
@@ -1,31 +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;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cxf.endpoint.AbstractEndpointFactory;
-import org.apache.cxf.feature.Feature;
-
-public interface IntentManager {
-
-    String[] applyIntents(List<Feature> features, AbstractEndpointFactory factory, Map<String, Object> props);
-    void assertAllIntentsSupported(Map<String, Object> serviceProperties);
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/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
deleted file mode 100644
index 806c1b0..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImpl.java
+++ /dev/null
@@ -1,155 +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;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-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;
-import org.slf4j.LoggerFactory;
-
-public class IntentManagerImpl implements IntentManager {
-
-    static final Logger LOG = LoggerFactory.getLogger(IntentManagerImpl.class);
-    private static final String PROVIDED_INTENT_VALUE = "PROVIDED";
-
-    private final IntentMap intentMap;
-    private final long maxIntentWaitTime;
-
-    public IntentManagerImpl(IntentMap intentMap) {
-        this(intentMap, 0);
-    }
-
-    public IntentManagerImpl(IntentMap intentMap, int maxIntentWaitTime) {
-        this.intentMap = intentMap;
-        this.maxIntentWaitTime = maxIntentWaitTime;
-    }
-
-    public String[] applyIntents(List<Feature> features, AbstractEndpointFactory factory,
-                                 Map<String, Object> props) throws IntentUnsatisfiedException {
-        Set<String> requestedIntents = IntentUtils.getRequestedIntents(props);
-        Set<String> appliedIntents = new HashSet<String>();
-        appliedIntents.addAll(reverseLookup(intentMap, PROVIDED_INTENT_VALUE));
-        boolean bindingApplied = false;
-        for (String intentName : requestedIntents) {
-            bindingApplied |= processIntent(features, factory, intentName, intentMap.get(intentName));
-            appliedIntents.add(intentName);
-        }
-        if (!bindingApplied) {
-            String defaultBindingName = "SOAP";
-            processIntent(features, factory, defaultBindingName, intentMap.get(defaultBindingName));
-            appliedIntents.add(defaultBindingName);
-        }
-        appliedIntents.addAll(addSynonymIntents(appliedIntents, intentMap));
-        return appliedIntents.toArray(new String[appliedIntents.size()]);
-    }
-
-    private boolean processIntent(List<Feature> features, AbstractEndpointFactory factory,
-                                  String intentName, Object intent) throws IntentUnsatisfiedException {
-        if (intent instanceof String) {
-            if (PROVIDED_INTENT_VALUE.equalsIgnoreCase((String) intent)) {
-                return false;
-            }
-        } else if (intent instanceof BindingConfiguration) {
-            BindingConfiguration bindingCfg = (BindingConfiguration)intent;
-            LOG.info("Applying intent: " + intentName + " via binding config: " + bindingCfg);
-            factory.setBindingConfig(bindingCfg);
-            return true;
-        } else if (intent instanceof Feature) {
-            Feature feature = (Feature) intent;
-            LOG.info("Applying intent: " + intentName + " via feature: " + feature);
-            features.add(feature);
-            return false;
-        } else {
-            LOG.info("No mapping for intent: " + intentName);
-            throw new IntentUnsatisfiedException(intentName);
-        }
-        return false;
-    }
-
-    private static Collection<String> addSynonymIntents(Collection<String> appliedIntents,
-                                                 IntentMap map) {
-        // E.g. SOAP and SOAP.1_1 are synonyms
-        List<Object> values = new ArrayList<Object>();
-        for (String key : appliedIntents) {
-            values.add(map.get(key));
-        }
-        return reverseLookup(map, values);
-    }
-
-    private static Collection<String> reverseLookup(IntentMap im, Object obj) {
-        return reverseLookup(im, Collections.singleton(obj));
-    }
-
-    /**
-     * Retrieves all keys whose mapped values are found in the given collection.
-     *
-     * @param im an intent map
-     * @param values a collection of potential values
-     * @return all keys whose mapped values are found in the given collection
-     */
-    private static Collection<String> reverseLookup(IntentMap im, Collection<?> values) {
-        Set<String> intentsFound = new HashSet<String>();
-        for (Map.Entry<String, Object> entry : im.entrySet()) {
-            if (values.contains(entry.getValue())) {
-                intentsFound.add(entry.getKey());
-            }
-        }
-        return intentsFound;
-    }
-
-    public void assertAllIntentsSupported(Map<String, Object> serviceProperties) {
-        long endTime = System.currentTimeMillis() + maxIntentWaitTime;
-        Set<String> requiredIntents = IntentUtils.getRequestedIntents(serviceProperties);
-        List<String> unsupportedIntents = new ArrayList<String>();
-        do {
-            unsupportedIntents.clear();
-            for (String ri : requiredIntents) {
-                if (!intentMap.containsKey(ri)) {
-                    unsupportedIntents.add(ri);
-                }
-            }
-            long remainingSeconds = (endTime - System.currentTimeMillis()) / 1000;
-            if (!unsupportedIntents.isEmpty() && remainingSeconds > 0) {
-                LOG.debug("Waiting for custom intents " + unsupportedIntents + " timeout in " + remainingSeconds);
-                try {
-                    synchronized (intentMap) {
-                        intentMap.wait(1000);
-                    }
-                } catch (InterruptedException e) {
-                    LOG.warn(e.getMessage(), e);
-                }
-            }
-        } while (!unsupportedIntents.isEmpty() && System.currentTimeMillis() < endTime);
-
-        if (!unsupportedIntents.isEmpty()) {
-            throw new RuntimeException("service cannot be exported because the following "
-                                       + "intents are not supported by this RSA: " + unsupportedIntents);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentMap.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentMap.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentMap.java
deleted file mode 100644
index 5ed4ef6..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentMap.java
+++ /dev/null
@@ -1,62 +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;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Maps intent names to intent objects
- * An intent object can be a Feature, a BindingConfiguration or a String
- *
- * Also supports a default intent map. Custom intents can override the defaults
- */
-public class IntentMap extends ConcurrentHashMap<String, Object> {
-
-    private static final long serialVersionUID = 2606460607920520767L;
-    private Map<String, Object> defaultMap;
-
-    public IntentMap() {
-        this(new HashMap<String, Object>());
-    }
-
-    public IntentMap(Map<String, Object> defaultMap) {
-        this.defaultMap = defaultMap;
-        putAll(defaultMap);
-    }
-
-    @Override
-    public Object put(String key, Object value) {
-        Object result = super.put(key, value);
-        synchronized (this) {
-            notifyAll();
-        }
-        return result;
-    }
-
-    @Override
-    public Object remove(Object key) {
-        Object old = super.remove(key);
-        if (defaultMap.containsKey(key)) {
-            put((String)key, defaultMap.get(key));
-        }
-        return old;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentTracker.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentTracker.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentTracker.java
deleted file mode 100644
index e1ceaaa..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentTracker.java
+++ /dev/null
@@ -1,62 +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;
-
-import org.apache.cxf.dosgi.dsw.Constants;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.util.tracker.ServiceTracker;
-
-@SuppressWarnings({"rawtypes", "unchecked"})
-public class IntentTracker extends ServiceTracker {
-
-    private final IntentMap intentMap;
-
-    
-    public IntentTracker(BundleContext context, IntentMap intentMap) {
-        super(context, getFilter(context), null);
-        this.intentMap = intentMap;
-    }
-
-    static Filter getFilter(BundleContext context) {
-        try {
-            return context.createFilter("(" + Constants.INTENT_NAME_PROP + "=*)");
-        } catch (InvalidSyntaxException e) {
-            throw new RuntimeException(e.getMessage(), e);
-        }
-    }
-
-    @Override
-    public Object addingService(ServiceReference reference) {
-        String intentName = (String) reference.getProperty(Constants.INTENT_NAME_PROP);
-        Object intent = super.addingService(reference);
-        IntentManagerImpl.LOG.info("Adding custom intent " + intentName);
-        intentMap.put(intentName, intent);
-        return intent;
-    }
-
-    @Override
-    public void removedService(ServiceReference reference, Object service) {
-        String intentName = (String) reference.getProperty(Constants.INTENT_NAME_PROP);
-        intentMap.remove(intentName);
-        super.removedService(reference, service);
-    }
-}
\ No newline at end of file


[12/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

Posted by cs...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandlerTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandlerTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandlerTest.java
new file mode 100644
index 0000000..64beeac
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandlerTest.java
@@ -0,0 +1,75 @@
+/**
+ * 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.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+public class ServiceInvocationHandlerTest extends TestCase {
+
+    private static final Map<String, Method> OBJECT_METHODS = new HashMap<String, Method>(); {
+        for (Method m : Object.class.getMethods()) {
+            OBJECT_METHODS.put(m.getName(), m);
+        }
+    }
+
+    public void testInvoke() throws Throwable {
+        ServiceInvocationHandler sih = new ServiceInvocationHandler("hello", String.class);
+        Method m = String.class.getMethod("length", new Class[] {});
+        assertEquals(5, sih.invoke(null, m, new Object[] {}));
+    }
+
+    public void testInvokeObjectMethod() throws Throwable {
+        final List<String> called = new ArrayList<String>();
+        ServiceInvocationHandler sih = new ServiceInvocationHandler("hi", String.class) {
+            public boolean equals(Object obj) {
+                called.add("equals");
+                return super.equals(obj);
+            }
+
+            public int hashCode() {
+                called.add("hashCode");
+                return super.hashCode();
+            }
+
+            public String toString() {
+                called.add("toString");
+                return "somestring";
+            }
+        };
+
+        Object proxy = Proxy.newProxyInstance(
+                getClass().getClassLoader(), new Class[] {Runnable.class}, sih);
+
+        assertEquals(true,
+                sih.invoke(null, OBJECT_METHODS.get("equals"), new Object[] {proxy}));
+        assertEquals(System.identityHashCode(sih),
+                sih.invoke(null, OBJECT_METHODS.get("hashCode"), new Object[] {}));
+        assertEquals("somestring",
+                sih.invoke(null, OBJECT_METHODS.get("toString"), new Object[] {}));
+        assertEquals(Arrays.asList("equals", "hashCode", "toString"), called);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandlerTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandlerTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandlerTest.java
new file mode 100644
index 0000000..df90758
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandlerTest.java
@@ -0,0 +1,67 @@
+/**
+ * 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 junit.framework.TestCase;
+
+public class WsdlConfigurationTypeHandlerTest extends TestCase {
+
+    public void testDUMMY() {
+        assertTrue(true);
+    }
+
+//    private Map<String, Object> handlerProps;
+//
+//    @Override
+//    protected void setUp() throws Exception {
+//        super.setUp();
+//
+//        handlerProps = new HashMap<String, Object>();
+//        handlerProps.put(Constants.DEFAULT_HOST_CONFIG, "somehost");
+//        handlerProps.put(Constants.DEFAULT_PORT_CONFIG, "54321");
+//    }
+//
+//    public void testCreateProxyPopulatesDistributionProvider() {
+//        ServiceReference sr = EasyMock.createNiceMock(ServiceReference.class);
+//        BundleContext dswContext = EasyMock.createNiceMock(BundleContext.class);
+//        BundleContext callingContext = EasyMock.createNiceMock(BundleContext.class);
+//        ServiceEndpointDescription sd = TestUtils.mockServiceDescription("Foo");
+//        EasyMock.replay(sr);
+//        EasyMock.replay(dswContext);
+//        EasyMock.replay(callingContext);
+//        EasyMock.replay(sd);
+//
+//        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext);
+//        WsdlConfigurationTypeHandler w = new WsdlConfigurationTypeHandler(dswContext, dp, handlerProps) {
+//            @Override
+//            Service createWebService(URL wsdlAddress, QName serviceQname) {
+//                Service svc = EasyMock.createMock(Service.class);
+//                EasyMock.expect(svc.getPort(CharSequence.class)).andReturn("Hi").anyTimes();
+//                EasyMock.replay(svc);
+//                return svc;
+//            }
+//        };
+//
+//        assertEquals("Precondition failed", 0, dp.getRemoteServices().size());
+//        w.createProxy(sr, dswContext, callingContext, CharSequence.class, sd);
+//        assertEquals(1, dp.getRemoteServices().size());
+//        assertSame(sr, dp.getRemoteServices().iterator().next());
+//
+//    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/jaxws/MyJaxWsEchoService.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/jaxws/MyJaxWsEchoService.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/jaxws/MyJaxWsEchoService.java
new file mode 100644
index 0000000..7814267
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/jaxws/MyJaxWsEchoService.java
@@ -0,0 +1,26 @@
+/**
+ * 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.jaxws;
+
+import javax.jws.WebService;
+
+@WebService
+public interface MyJaxWsEchoService {
+    String echo(String message);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/jaxws/MyJaxWsEchoServiceImpl.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/jaxws/MyJaxWsEchoServiceImpl.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/jaxws/MyJaxWsEchoServiceImpl.java
new file mode 100644
index 0000000..699c9ae
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/jaxws/MyJaxWsEchoServiceImpl.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.handlers.jaxws;
+
+public class MyJaxWsEchoServiceImpl implements MyJaxWsEchoService {
+
+    @Override
+    public String echo(String message) {
+        return message;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/simple/MySimpleEchoService.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/simple/MySimpleEchoService.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/simple/MySimpleEchoService.java
new file mode 100644
index 0000000..7d574ca
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/simple/MySimpleEchoService.java
@@ -0,0 +1,23 @@
+/**
+ * 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.simple;
+
+public interface MySimpleEchoService {
+    String echo(String message);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/simple/MySimpleEchoServiceImpl.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/simple/MySimpleEchoServiceImpl.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/simple/MySimpleEchoServiceImpl.java
new file mode 100644
index 0000000..19dda4b
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/simple/MySimpleEchoServiceImpl.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.handlers.simple;
+
+public class MySimpleEchoServiceImpl implements MySimpleEchoService {
+
+    @Override
+    public String echo(String message) {
+        return message;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfFindListenerHookTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfFindListenerHookTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfFindListenerHookTest.java
new file mode 100644
index 0000000..fde48d2
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfFindListenerHookTest.java
@@ -0,0 +1,341 @@
+/**
+ * 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.hooks;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class CxfFindListenerHookTest extends Assert {
+
+    @Test
+    public void testDUMMY() throws Exception {
+    }
+
+//    private IMocksControl control;
+//
+//    @Before
+//    public void setUp() {
+//        control = EasyMock.createNiceControl();
+//    }
+
+    /* Todo this test doesn't apply at the moment since the ListenerHook doesn't
+     * have a serviceReferencesRequested() API (yet).
+    @Test
+    public void testSyncListenerHook() throws Exception {
+        Bundle bundle = control.createMock(Bundle.class);
+        bundle.findEntries(EasyMock.eq("OSGI-INF/remote-service"),
+            EasyMock.eq("*.xml"), EasyMock.anyBoolean());
+        EasyMock.expectLastCall().andReturn(Collections.enumeration(
+            Arrays.asList(getClass().getResource("/OSGI-INF/remote-service/remote-services.xml"))));
+        Dictionary<String, String> bundleHeaders = new Hashtable<String, String>();
+        bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_NAME,
+                          "Test Bundle");
+        bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_VERSION,
+                          "1.0.0");
+        bundle.getHeaders();
+        EasyMock.expectLastCall().andReturn(bundleHeaders).anyTimes();
+        bundle.loadClass(TestService.class.getName());
+        EasyMock.expectLastCall().andReturn(TestService.class).anyTimes();
+        final BundleContext requestingContext = control.createMock(BundleContext.class);
+        requestingContext.getBundle();
+        EasyMock.expectLastCall().andReturn(bundle).anyTimes();
+
+        BundleTestContext dswContext = new BundleTestContext(bundle);
+        dswContext.addServiceReference(TestService.class.getName(),
+                                       control.createMock(ServiceReference.class));
+        control.replay();
+
+        CxfListenerHook hook = new CxfListenerHook(dswContext, null);
+
+        // TODO : if the next call ends up being executed in a thread of its own then
+        // update the test accordingly, use Futures for ex
+
+        hook.serviceReferencesRequested(requestingContext,
+                                       TestService.class.getName(), null, true);
+
+        List<ServiceReference> registeredRefs = dswContext.getRegisteredReferences();
+        assertNotNull(registeredRefs);
+        assertEquals(1, registeredRefs.size());
+    } */
+
+//    @Test
+//    public void testTrackerPropertiesOnlyClassInFilterWithMatchingInterface() throws Exception {
+//        String filter = "(objectClass=" + TestService.class.getName() + ")";
+//        doTestTrackerPropertiesSet(filter,
+//                                   "osgi.remote.discovery.interest.interfaces",
+//                                   TestService.class.getName(),
+//                                   asList(TestService.class.getName()),
+//                                   Collections.EMPTY_SET);
+//    }
+//
+//    @Test
+//    public void testTrackerPropertiesGenericFilterWithMatchingInterface() throws Exception {
+//        String filter = "(&(objectClass=" + TestService.class.getName()
+//                        + ")(colour=blue))";
+//        doTestTrackerPropertiesSet(filter,
+//                                   "osgi.remote.discovery.interest.filters",
+//                                   replacePredicate(filter),
+//                                   asList(TestService.class.getName()),
+//                                   Collections.EMPTY_SET);
+//    }
+//
+//    @Test
+//    public void testTrackerPropertiesOnlyClassInFilterWithMatchingFilter() throws Exception {
+//        String filter = "(objectClass=" + TestService.class.getName() + ")";
+//        doTestTrackerPropertiesSet(filter,
+//                                   "osgi.remote.discovery.interest.interfaces",
+//                                   TestService.class.getName(),
+//                                   Collections.EMPTY_SET,
+//                                   asList(replacePredicate(filter)));
+//    }
+//
+//    @Test
+//    public void testTrackerPropertiesGenericFilterWithMatchingFilter() throws Exception {
+//        String filter = "(&(objectClass=" + TestService.class.getName()
+//                        + ")(colour=blue))";
+//        doTestTrackerPropertiesSet(filter,
+//                                   "osgi.remote.discovery.interest.filters",
+//                                   replacePredicate(filter),
+//                                   Collections.EMPTY_SET,
+//                                   asList(replacePredicate(filter)));
+//    }
+//
+//    @Test
+//    public void testTrackerPropertiesOnlyClassInFilterWithMatchingBoth() throws Exception {
+//        String filter = "(objectClass=" + TestService.class.getName() + ")";
+//        doTestTrackerPropertiesSet(filter,
+//                                   "osgi.remote.discovery.interest.interfaces",
+//                                   TestService.class.getName(),
+//                                   asList(TestService.class.getName()),
+//                                   asList(replacePredicate(filter)));
+//    }
+//
+//    @Test
+//    public void testTrackerPropertiesGenericFilterWithMatchingBoth() throws Exception {
+//        String filter = "(&(objectClass=" + TestService.class.getName()
+//                        + ")(colour=blue))";
+//        doTestTrackerPropertiesSet(filter,
+//                                   "osgi.remote.discovery.interest.filters",
+//                                   replacePredicate(filter),
+//                                   Collections.EMPTY_SET,
+//                                   asList(replacePredicate(filter)));
+//    }
+//
+//    private void doTestTrackerPropertiesSet(final String filter,
+//                                            String propKey,
+//                                            String propValue,
+//                                            Collection matchingInterfaces,
+//                                            Collection matchingFilters) throws Exception {
+//        Bundle bundle = control.createMock(Bundle.class);
+//        Dictionary<String, String> bundleHeaders = new Hashtable<String, String>();
+//        bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_NAME,
+//                          "Test Bundle");
+//        bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_VERSION,
+//                          "1.0.0");
+//        bundle.getHeaders();
+//        EasyMock.expectLastCall().andReturn(bundleHeaders).times(2);
+//        final String serviceClass = TestService.class.getName();
+//        bundle.loadClass(serviceClass);
+//        EasyMock.expectLastCall().andReturn(TestService.class).times(2);
+//        final BundleContext requestingContext = control.createMock(BundleContext.class);
+//
+//        BundleTestContext dswContext = new BundleTestContext(bundle);
+//        ServiceRegistration serviceRegistration = control.createMock(ServiceRegistration.class);
+//        dswContext.addServiceRegistration(serviceClass, serviceRegistration);
+//        serviceRegistration.unregister();
+//        EasyMock.expectLastCall().times(1);
+//        ServiceReference serviceReference = control.createMock(ServiceReference.class);
+//        dswContext.addServiceReference(serviceClass, serviceReference);
+//
+//        final String trackerClass = DiscoveredServiceTracker.class.getName();
+//        ServiceRegistration trackerRegistration = control.createMock(ServiceRegistration.class);
+//        dswContext.addServiceRegistration(trackerClass, trackerRegistration);
+//        ServiceReference trackerReference = control.createMock(ServiceReference.class);
+//        dswContext.addServiceReference(trackerClass, trackerReference);
+//
+//        List property = asList(propValue);
+//        Dictionary properties = new Hashtable();
+//        properties.put(propKey, property);
+//        trackerRegistration.setProperties(properties);
+//        EasyMock.expectLastCall();
+//
+//        if (matchingInterfaces.size() == 0 && matchingFilters.size() > 0) {
+//            Iterator filters = matchingFilters.iterator();
+//            while (filters.hasNext()) {
+//                Filter f = control.createMock(Filter.class);
+//                dswContext.addFilter((String)filters.next(), f);
+//                f.match(EasyMock.isA(Dictionary.class));
+//                EasyMock.expectLastCall().andReturn(true);
+//            }
+//        }
+//
+//        control.replay();
+//
+//        CxfFindListenerHook hook = new CxfFindListenerHook(dswContext, null);
+//
+//        ListenerHook.ListenerInfo info = new ListenerHook.ListenerInfo() {
+//            public BundleContext getBundleContext() {
+//                return requestingContext;
+//            }
+//
+//            public String getFilter() {
+//                return filter;
+//            }
+//
+//            public boolean isRemoved() {
+//                return false;
+//            }
+//        };
+//        hook.added(Collections.singleton(info));
+//
+//        DiscoveredServiceTracker tracker = (DiscoveredServiceTracker)
+//            dswContext.getService(trackerReference);
+//        assertNotNull(tracker);
+//
+//        Collection interfaces = asList(serviceClass);
+//
+//        notifyAvailable(tracker, matchingInterfaces, matchingFilters, "1234");
+//        notifyAvailable(tracker, matchingInterfaces, matchingFilters, "5678");
+//        notifyAvailable(tracker, matchingInterfaces, matchingFilters, "1234");
+//
+//        notifyUnAvailable(tracker, "1234");
+//        notifyUnAvailable(tracker, "5678");
+//
+//        notifyAvailable(tracker, matchingInterfaces, matchingFilters , "1234");
+//
+//        control.verify();
+//
+//        Map<String, ServiceReference> registeredRefs = dswContext.getRegisteredReferences();
+//        assertNotNull(registeredRefs);
+//        assertEquals(2, registeredRefs.size());
+//        assertNotNull(registeredRefs.get(serviceClass));
+//        assertSame(serviceReference, registeredRefs.get(serviceClass));
+//
+//        Map<String, ServiceRegistration> registeredRegs = dswContext.getRegisteredRegistrations();
+//        assertNotNull(registeredRegs);
+//        assertEquals(2, registeredRegs.size());
+//        assertNotNull(registeredRegs.get(trackerClass));
+//        assertSame(trackerRegistration, registeredRegs.get(trackerClass));
+//
+//        List<Object> registeredServices = dswContext.getRegisteredServices();
+//        assertNotNull(registeredServices);
+//        assertEquals(2, registeredServices.size());
+//    }
+//
+//    @Test
+//    public void testConstructorAndGetters() {
+//        BundleContext bc = control.createMock(BundleContext.class);
+//        CxfRemoteServiceAdmin dp = control.createMock(CxfRemoteServiceAdmin.class);
+//        control.replay();
+//
+//        CxfFindListenerHook clh = new CxfFindListenerHook(bc, dp);
+//        assertSame(bc, clh.getContext());
+//        assertSame(dp, clh.getDistributionProvider());
+//    }
+//
+//    @Test
+//    public void testFindHook() {
+//        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+//
+//        final List<String> lookupCalls = new ArrayList<String>();
+//        CxfFindListenerHook fh = new CxfFindListenerHook(bc, null) {
+//            @Override
+//            protected synchronized void lookupDiscoveryService(
+//                    String interfaceName, String filterValue) {
+//                lookupCalls.add(interfaceName);
+//                lookupCalls.add(filterValue);
+//            }
+//        };
+//
+//        String clazz = "my.app.Class";
+//        String filter = "&(A=B)(C=D)";
+//        fh.find(null, clazz, filter, true, null);
+//
+//        assertEquals(Arrays.asList(clazz, filter), lookupCalls);
+//    }
+//
+//    private void notifyAvailable(DiscoveredServiceTracker tracker,
+//                                 Collection interfaces,
+//                                 Collection filters,
+//                                 String endpointId) {
+//        Map<String, Object> props = new Hashtable<String, Object>();
+//        props.put("osgi.remote.interfaces", "*");
+//        props.put("osgi.remote.endpoint.id", endpointId);
+//        tracker.serviceChanged(new Notification(AVAILABLE,
+//                                                TestService.class.getName(),
+//                                                interfaces,
+//                                                filters,
+//                                                props));
+//    }
+//
+//    private void notifyUnAvailable(DiscoveredServiceTracker tracker,
+//                                   String endpointId) {
+//        Map<String, Object> props = new Hashtable<String, Object>();
+//        props.put("osgi.remote.endpoint.id", endpointId);
+//        tracker.serviceChanged(new Notification(UNAVAILABLE,
+//                                                TestService.class.getName(),
+//                                                Collections.EMPTY_SET,
+//                                                Collections.EMPTY_SET,
+//                                                props));
+//    }
+//
+//    private List<String> asList(String s) {
+//        List l = new ArrayList<String>();
+//        l.add(s);
+//        return l;
+//    }
+//
+//    private String replacePredicate(String filter) {
+//        return filter.replace("objectClass", ServicePublication.SERVICE_INTERFACE_NAME);
+//    }
+//
+//    private class Notification implements DiscoveredServiceNotification {
+//        private int type;
+//        private ServiceEndpointDescription sed;
+//        private Collection interfaces;
+//        private Collection filters;
+//
+//        Notification(int type,
+//                     String interfaceName,
+//                     Collection interfaces,
+//                     Collection filters,
+//                     Map<String, Object> props) {
+//            this.type = type;
+//            this.sed = new ServiceEndpointDescriptionImpl(interfaceName, props);
+//            this.interfaces = interfaces;
+//            this.filters = filters;
+//        }
+//
+//        public int getType() {
+//            return type;
+//        }
+//
+//        public ServiceEndpointDescription getServiceEndpointDescription() {
+//            return sed;
+//        }
+//
+//        public Collection getInterfaces() {
+//            return interfaces;
+//        }
+//
+//        public Collection getFilters() {
+//            return filters;
+//        }
+//    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHookTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHookTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHookTest.java
new file mode 100644
index 0000000..40b40c5
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHookTest.java
@@ -0,0 +1,299 @@
+/**
+ * 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.hooks;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class CxfPublishHookTest extends Assert {
+
+    @Test
+    public void testDUMMY() throws Exception {
+    }
+
+    //
+    // private IMocksControl control;
+    //
+    // @Before
+    // public void setUp() {
+    // control = EasyMock.createNiceControl();
+    // }
+    //
+    // @Test
+    // public void testPublishSingleInterface() throws Exception {
+    // String[] serviceNames = new String[]{TestService.class.getName()};
+    // String[] addresses = new String[]{"http://localhost:9000/hello"};
+    // doTestPublishHook("remote-services.xml", serviceNames, addresses);
+    // }
+    //
+    // @Test
+    // public void testPublishSingleInterfaceAltFormat() throws Exception {
+    // String[] serviceNames = new String[]{TestService.class.getName()};
+    // String[] addresses = new String[]{"http://localhost:9000/hello"};
+    // doTestPublishHook("alt-remote-services.xml", serviceNames, addresses);
+    // }
+    //
+    // @Test
+    // public void testPublishMultiInterface() throws Exception {
+    // String[] serviceNames = new String[]{TestService.class.getName(),
+    // AdditionalInterface.class.getName()};
+    // String[] addresses = new String[]{"http://localhost:9001/hello",
+    // "http://localhost:9002/hello"};
+    // doTestPublishHook("multi-services.xml", serviceNames, addresses);
+    // }
+    //
+    // @SuppressWarnings("unchecked")
+    // private void doTestPublishHook(String remoteServices,
+    // String[] serviceNames,
+    // String[] addresses) throws Exception {
+    //
+    // Bundle bundle = control.createMock(Bundle.class);
+    // bundle.findEntries(EasyMock.eq("OSGI-INF/remote-service"),
+    // EasyMock.eq("*.xml"), EasyMock.anyBoolean());
+    // EasyMock.expectLastCall().andReturn(Collections.enumeration(
+    // Arrays.asList(getClass().getResource("/OSGI-INF/remote-service/" + remoteServices))));
+    // Dictionary<String, String> bundleHeaders = new Hashtable<String, String>();
+    // bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_NAME,
+    // "Test Bundle");
+    // bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_VERSION,
+    // "1.0.0");
+    // bundle.getHeaders();
+    // EasyMock.expectLastCall().andReturn(bundleHeaders).anyTimes();
+    // BundleContext requestingContext = control.createMock(BundleContext.class);
+    // bundle.getBundleContext();
+    // EasyMock.expectLastCall().andReturn(requestingContext).anyTimes();
+    //
+    // TestService serviceObject = new TestServiceImpl();
+    // Dictionary serviceProps = new Hashtable();
+    //
+    // ServiceReference sref = control.createMock(ServiceReference.class);
+    // sref.getBundle();
+    // EasyMock.expectLastCall().andReturn(bundle).anyTimes();
+    // sref.getProperty(Constants.OBJECTCLASS);
+    // EasyMock.expectLastCall().andReturn(serviceNames).anyTimes();
+    // sref.getPropertyKeys();
+    // EasyMock.expectLastCall().andReturn(new String[]{}).anyTimes();
+    //
+    // BundleTestContext dswContext = new BundleTestContext(bundle);
+    //
+    // ServiceRegistration[] serviceRegistrations =
+    // new ServiceRegistration[serviceNames.length];
+    //
+    // for (int i = 0; i < serviceNames.length ; i++) {
+    // serviceRegistrations[i] =
+    // control.createMock(ServiceRegistration.class);
+    // dswContext.addServiceRegistration(serviceNames[i],
+    // serviceRegistrations[i]);
+    // dswContext.addServiceReference(serviceNames[i], sref);
+    // }
+    // dswContext.registerService(serviceNames, serviceObject, serviceProps);
+    //
+    // Server server = control.createMock(Server.class);
+    //
+    // String publicationClass = ServicePublication.class.getName();
+    // ServiceRegistration publicationRegistration =
+    // control.createMock(ServiceRegistration.class);
+    // publicationRegistration.unregister();
+    // EasyMock.expectLastCall().times(serviceNames.length);
+    // dswContext.addServiceRegistration(publicationClass, publicationRegistration);
+    // ServiceReference publicationReference =
+    // control.createMock(ServiceReference.class);
+    // dswContext.addServiceReference(publicationClass, publicationReference);
+    // control.replay();
+    //
+    // TestPublishHook hook = new TestPublishHook(dswContext,
+    // serviceObject,
+    // server);
+    // hook.publishEndpoint(sref);
+    // hook.verify();
+    //
+    // assertEquals(1, hook.getEndpoints().size());
+    // List<EndpointInfo> list = hook.getEndpoints().get(sref);
+    // assertNotNull(list);
+    // assertEquals(serviceNames.length, list.size());
+    // for (int i = 0; i < serviceNames.length; i++) {
+    // assertNotNull(list.get(i));
+    // ServiceEndpointDescription sd = list.get(i).getServiceDescription();
+    // assertNotNull(sd);
+    // assertNotNull(sd.getProvidedInterfaces());
+    // assertEquals(1, sd.getProvidedInterfaces().size());
+    // Collection names = sd.getProvidedInterfaces();
+    // assertEquals(1, names.size());
+    // assertEquals(serviceNames[i], names.toArray()[0]);
+    // String excludeProp = "osgi.remote.interfaces";
+    // assertNull(sd.getProperties().get(excludeProp));
+    // String addrProp =
+    // org.apache.cxf.dosgi.dsw.Constants.WS_ADDRESS_PROPERTY_OLD;
+    // assertEquals(addresses[i], sd.getProperties().get(addrProp));
+    // }
+    //
+    // Map<String, ServiceRegistration> registeredRegs =
+    // dswContext.getRegisteredRegistrations();
+    // assertNotNull(registeredRegs);
+    // assertEquals(serviceNames.length + 1, registeredRegs.size());
+    // assertNotNull(registeredRegs.get(publicationClass));
+    // assertSame(publicationRegistration, registeredRegs.get(publicationClass));
+    //
+    // Map<String, List<Dictionary>> registeredProps =
+    // dswContext.getRegisteredProperties();
+    // assertNotNull(registeredProps);
+    // assertEquals(serviceNames.length + 1, registeredProps.size());
+    // assertNotNull(registeredProps.get(publicationClass));
+    // List<Dictionary> propsList = registeredProps.get(publicationClass);
+    // assertEquals(serviceNames.length, propsList.size());
+    // for (Dictionary props : propsList) {
+    // Collection interfaces =
+    // (Collection)props.get(SERVICE_INTERFACE_NAME);
+    // assertNotNull(interfaces);
+    // assertTrue(interfaces.contains(TestService.class.getName())
+    // || interfaces.contains(AdditionalInterface.class.getName()));
+    // }
+    //
+    // hook.removeEndpoints();
+    //
+    // control.verify();
+    // }
+    //
+    // @SuppressWarnings("unchecked")
+    // @Test
+    // public void testPublishMultipleTimes() {
+    // Bundle bundle = control.createMock(Bundle.class);
+    // bundle.findEntries(EasyMock.eq("OSGI-INF/remote-service"),
+    // EasyMock.eq("*.xml"), EasyMock.anyBoolean());
+    // EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
+    // public Object answer() throws Throwable {
+    // return Collections.enumeration(Arrays.asList(
+    // getClass().getResource("/OSGI-INF/remote-service/remote-services.xml")));
+    // }
+    // }).anyTimes();
+    // Dictionary<String, String> bundleHeaders = new Hashtable<String, String>();
+    // bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_NAME,
+    // "org.apache.cxf.example.bundle");
+    // bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_VERSION,
+    // "1.0.0");
+    // bundle.getHeaders();
+    // EasyMock.expectLastCall().andReturn(bundleHeaders).anyTimes();
+    // BundleContext requestingContext = control.createMock(BundleContext.class);
+    // bundle.getBundleContext();
+    // EasyMock.expectLastCall().andReturn(requestingContext).anyTimes();
+    //
+    // TestService serviceObject = new TestServiceImpl();
+    // Dictionary serviceProps = new Hashtable();
+    //
+    // ServiceReference sref = control.createMock(ServiceReference.class);
+    // sref.getBundle();
+    // EasyMock.expectLastCall().andReturn(bundle).anyTimes();
+    // sref.getProperty(Constants.OBJECTCLASS);
+    // String[] serviceNames = {TestService.class.getName()};
+    // EasyMock.expectLastCall().andReturn(serviceNames).anyTimes();
+    // sref.getPropertyKeys();
+    // EasyMock.expectLastCall().andReturn(new String[]{}).anyTimes();
+    //
+    // BundleTestContext dswContext = new BundleTestContext(bundle);
+    // ServiceRegistration[] serviceRegistrations =
+    // new ServiceRegistration[serviceNames.length];
+    // for (int i = 0; i < serviceNames.length ; i++) {
+    // serviceRegistrations[i] =
+    // control.createMock(ServiceRegistration.class);
+    // dswContext.addServiceRegistration(serviceNames[i],
+    // serviceRegistrations[i]);
+    // dswContext.addServiceReference(serviceNames[i], sref);
+    // }
+    // dswContext.registerService(serviceNames, serviceObject, serviceProps);
+    //
+    // final Server server = control.createMock(Server.class);
+    // control.replay();
+    //
+    // CxfPublishHook hook = new CxfPublishHook(dswContext, null) {
+    // @Override
+    // Server createServer(ServiceReference sref, ServiceEndpointDescription sd) {
+    // return server;
+    // }
+    // };
+    // assertNull("Precondition not met", hook.getEndpoints().get(sref));
+    // hook.publishEndpoint(sref);
+    // assertEquals(1, hook.getEndpoints().get(sref).size());
+    //
+    // hook.endpoints.put(sref, new ArrayList<EndpointInfo>());
+    // assertEquals("Precondition failed", 0, hook.getEndpoints().get(sref).size());
+    // hook.publishEndpoint(sref);
+    // assertEquals(0, hook.getEndpoints().get(sref).size());
+    //
+    // control.verify();
+    // }
+    //
+    // private static class TestPublishHook extends CxfPublishHook {
+    //
+    // private boolean called;
+    // private TestService serviceObject;
+    // private Server server;
+    //
+    // public TestPublishHook(BundleContext bc, TestService serviceObject,
+    // Server s) {
+    // super(bc, null);
+    // this.serviceObject = serviceObject;
+    // this.server = s;
+    // }
+    //
+    // @Override
+    // protected ConfigurationTypeHandler getHandler(ServiceEndpointDescription sd,
+    // Map<String, Object> props) {
+    // return new ConfigurationTypeHandler() {
+    // public String getType() {
+    // return "test";
+    // }
+    //
+    // public Object createProxy(ServiceReference sr,
+    // BundleContext dswContext, BundleContext callingContext,
+    // Class<?> iClass, ServiceEndpointDescription sd) {
+    // throw new UnsupportedOperationException();
+    // }
+    //
+    // public Server createServer(ServiceReference sr,
+    // BundleContext dswContext, BundleContext callingContext,
+    // ServiceEndpointDescription sd, Class<?> iClass, Object serviceBean) {
+    // Assert.assertSame(serviceBean, serviceObject);
+    // TestPublishHook.this.setCalled();
+    // Map props = sd.getProperties();
+    // String address = (String)props.get(WS_ADDRESS_PROPERTY);
+    // if (address != null) {
+    // props.put(ENDPOINT_LOCATION, address);
+    // }
+    // return server;
+    // }
+    //
+    // };
+    // }
+    //
+    // public void setCalled() {
+    // called = true;
+    // }
+    //
+    // public void verify() {
+    // Assert.assertTrue(called);
+    // }
+    // }
+    //
+    // public interface AdditionalInterface {
+    // }
+    //
+    // private static class TestServiceImpl implements TestService, AdditionalInterface {
+    //
+    // }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtilsTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtilsTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtilsTest.java
new file mode 100644
index 0000000..c004702
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtilsTest.java
@@ -0,0 +1,116 @@
+/**
+ * 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.hooks;
+
+import junit.framework.TestCase;
+
+public class ServiceHookUtilsTest extends TestCase {
+
+    public void testDUMMY() {
+        assertTrue(true);
+    }
+
+/*
+    public void testCreateServer() {
+        IMocksControl control = EasyMock.createNiceControl();
+
+        Server srvr = control.createMock(Server.class);
+        ServiceReference serviceReference = control.createMock(ServiceReference.class);
+        BundleContext dswContext = control.createMock(BundleContext.class);
+        BundleContext callingContext = control.createMock(BundleContext.class);
+        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("java.lang.String");
+        Object service = "hi";
+
+        ConfigurationTypeHandler handler = control.createMock(ConfigurationTypeHandler.class);
+        handler.createServer(serviceReference, dswContext, callingContext, sd, String.class, service);
+        EasyMock.expectLastCall().andReturn(srvr);
+        control.replay();
+
+        assertSame(srvr,
+            ServiceHookUtils.createServer(handler, serviceReference, dswContext, callingContext, sd, service));
+    }
+
+    public void testNoServerWhenNoInterfaceSpecified() {
+        IMocksControl control = EasyMock.createNiceControl();
+
+        Server srvr = control.createMock(Server.class);
+        ServiceReference serviceReference = control.createMock(ServiceReference.class);
+        BundleContext dswContext = control.createMock(BundleContext.class);
+        BundleContext callingContext = control.createMock(BundleContext.class);
+        ServiceEndpointDescription sd = mockServiceDescription(control, "Foo");
+        Object service = "hi";
+
+        ConfigurationTypeHandler handler = control.createMock(ConfigurationTypeHandler.class);
+        handler.createServer(serviceReference, dswContext, callingContext, sd, String.class, service);
+        EasyMock.expectLastCall().andReturn(srvr);
+        control.replay();
+
+        assertNull(ServiceHookUtils.createServer(handler, serviceReference, dswContext,
+                                                 callingContext, sd, service));
+    }
+
+    public void testPublish() throws Exception {
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put("foo", "bar");
+        props.put(ServicePublication.ENDPOINT_LOCATION, "http:localhost/xyz");
+        ServiceEndpointDescriptionImpl sed = new ServiceEndpointDescriptionImpl(String.class.getName(), props);
+        assertEquals(new URI("http:localhost/xyz"), sed.getLocation());
+
+        final Dictionary<String, Object> expectedProps = new Hashtable<String, Object>();
+        expectedProps.put(ServicePublication.SERVICE_PROPERTIES, props);
+        expectedProps.put(ServicePublication.SERVICE_INTERFACE_NAME, Collections.singleton(String.class.getName()));
+        expectedProps.put(ServicePublication.ENDPOINT_LOCATION, new URI("http:localhost/xyz"));
+
+        BundleContext bc = EasyMock.createMock(BundleContext.class);
+        EasyMock.expect(bc.registerService(
+            EasyMock.eq(ServicePublication.class.getName()),
+            EasyMock.anyObject(),
+            (Dictionary<?, ?>) EasyMock.anyObject()))
+                .andAnswer(new IAnswer<ServiceRegistration>() {
+                    public ServiceRegistration answer() throws Throwable {
+                        assertTrue(EasyMock.getCurrentArguments()[1] instanceof ServicePublication);
+                        Dictionary<?, ?> actualProps =
+                            (Dictionary<?, ?>) EasyMock.getCurrentArguments()[2];
+                        UUID uuid = UUID.fromString(actualProps.get(ServicePublication.ENDPOINT_SERVICE_ID)
+                                                        .toString());
+                        expectedProps.put(ServicePublication.ENDPOINT_SERVICE_ID, uuid.toString());
+                        assertEquals(expectedProps, actualProps);
+                        return EasyMock.createMock(ServiceRegistration.class);
+                    }
+                });
+        EasyMock.replay(bc);
+
+        ServiceHookUtils.publish(bc, null, sed);
+        EasyMock.verify(bc);
+    }
+
+    private ServiceEndpointDescription mockServiceDescription(IMocksControl control,
+                                                              String... interfaceNames) {
+        List<String> iList = new ArrayList<String>();
+        for (String iName : interfaceNames) {
+            iList.add(iName);
+        }
+        ServiceEndpointDescription sd = control.createMock(ServiceEndpointDescription.class);
+        sd.getProvidedInterfaces();
+        EasyMock.expectLastCall().andReturn(iList);
+        return sd;
+    }
+*/
+}
+

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/TestService.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/TestService.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/TestService.java
new file mode 100644
index 0000000..07b5088
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/TestService.java
@@ -0,0 +1,22 @@
+/**
+ * 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.hooks;
+
+public interface TestService {
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java
new file mode 100644
index 0000000..d90136c
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java
@@ -0,0 +1,278 @@
+/**
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.aries.rsa.spi.IntentUnsatisfiedException;
+import org.apache.cxf.binding.BindingConfiguration;
+import org.apache.cxf.endpoint.AbstractEndpointFactory;
+import org.apache.cxf.feature.AbstractFeature;
+import org.apache.cxf.feature.Feature;
+import org.easymock.EasyMock;
+import org.easymock.IMocksControl;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class IntentManagerImplTest extends Assert {
+
+    @Test
+    public void testIntents() throws Exception {
+        Map<String, Object> intents = new HashMap<String, Object>();
+        intents.put("A", new TestFeature("A"));
+        intents.put("SOAP", new TestFeature("SOAP"));
+        final IntentMap intentMap = new IntentMap(intents);
+
+        IMocksControl control = EasyMock.createNiceControl();
+        List<Feature> features = new ArrayList<Feature>();
+        AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
+        control.replay();
+
+        IntentManager intentManager = new IntentManagerImpl(intentMap, 10000);
+
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put("osgi.remote.requires.intents", "A");
+
+        List<String> effectiveIntents = Arrays.asList(intentManager.applyIntents(features, factory, props));
+        assertEquals(Arrays.asList("A", "SOAP"), effectiveIntents);
+    }
+
+    @Test
+    public void testMultiIntents() {
+        final IntentMap intentMap = new IntentMap(new DefaultIntentMapFactory().create());
+        intentMap.put("confidentiality.message", new TestFeature("confidentiality.message"));
+        intentMap.put("transactionality", new TestFeature("transactionality"));
+
+        IMocksControl control = EasyMock.createNiceControl();
+        List<Feature> features = new ArrayList<Feature>();
+        AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
+        control.replay();
+
+        IntentManager intentManager = new IntentManagerImpl(intentMap);
+
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put("osgi.remote.requires.intents", "transactionality confidentiality.message");
+
+        List<String> effectiveIntents = Arrays.asList(intentManager.applyIntents(features, factory, props));
+        assertTrue(effectiveIntents.contains("transactionality"));
+        assertTrue(effectiveIntents.contains("confidentiality.message"));
+    }
+
+    @Test
+    public void testFailedIntent() {
+        Map<String, Object> intents = new HashMap<String, Object>();
+        intents.put("A", new TestFeature("A"));
+        final IntentMap intentMap = new IntentMap(intents);
+
+        IMocksControl control = EasyMock.createNiceControl();
+        List<Feature> features = new ArrayList<Feature>();
+        AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
+        control.replay();
+
+        IntentManager intentManager = new IntentManagerImpl(intentMap);
+
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put("osgi.remote.requires.intents", "A B");
+        // ServiceEndpointDescription sd =
+        //         new ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
+
+        try {
+            intentManager.applyIntents(features, factory, props);
+            Assert.fail("applyIntents() should have thrown an exception as there was an unsatisfiable intent");
+        } catch (IntentUnsatisfiedException iue) {
+            assertEquals("B", iue.getIntent());
+        }
+    }
+
+    @Test
+    public void testInferIntents() {
+        Map<String, Object> intents = new HashMap<String, Object>();
+        intents.put("SOAP", new TestFeature("SOAP"));
+        intents.put("Prov", "PROVIDED");
+        AbstractFeature feat1 = new TestFeature("feat1");
+        intents.put("A", feat1);
+        intents.put("A_alt", feat1);
+        intents.put("B", new TestFeature("B"));
+        final IntentMap intentMap = new IntentMap(intents);
+
+        IMocksControl control = EasyMock.createNiceControl();
+        List<Feature> features = new ArrayList<Feature>();
+        AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
+        control.replay();
+
+        IntentManager intentManager = new IntentManagerImpl(intentMap);
+
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put("osgi.remote.requires.intents", "A");
+        // ServiceEndpointDescription sd =
+        //         new ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
+
+        List<String> effectiveIntents = Arrays.asList(intentManager.applyIntents(features, factory, props));
+        assertEquals(4, effectiveIntents.size());
+        assertTrue(effectiveIntents.contains("Prov"));
+        assertTrue(effectiveIntents.contains("A"));
+        assertTrue(effectiveIntents.contains("A_alt"));
+    }
+
+    @Test
+    public void testDefaultBindingIntent() {
+        IMocksControl control = EasyMock.createNiceControl();
+
+        Map<String, Object> intents = new HashMap<String, Object>();
+        BindingConfiguration feat1 = control.createMock(BindingConfiguration.class);
+        intents.put("A", new AbstractFeature() {
+        });
+        intents.put("SOAP", feat1);
+        intents.put("SOAP.1_1", feat1);
+        intents.put("SOAP.1_2", control.createMock(BindingConfiguration.class));
+        final IntentMap intentMap = new IntentMap(intents);
+
+        List<Feature> features = new ArrayList<Feature>();
+        AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
+        control.replay();
+        IntentManager intentManager = new IntentManagerImpl(intentMap);
+
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put("osgi.remote.requires.intents", "A");
+        // ServiceEndpointDescription sd =
+        //         new ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
+
+        List<String> effectiveIntents = Arrays.asList(intentManager.applyIntents(features, factory, props));
+        assertEquals(3, effectiveIntents.size());
+        assertTrue(effectiveIntents.contains("A"));
+        assertTrue(effectiveIntents.contains("SOAP"));
+        assertTrue(effectiveIntents.contains("SOAP.1_1"));
+    }
+
+    @Test
+    public void testExplicitBindingIntent() {
+        IMocksControl control = EasyMock.createNiceControl();
+
+        Map<String, Object> intents = new HashMap<String, Object>();
+        BindingConfiguration feat1 = control.createMock(BindingConfiguration.class);
+        intents.put("A", new AbstractFeature() {
+        });
+        intents.put("SOAP", feat1);
+        intents.put("SOAP.1_1", feat1);
+        intents.put("SOAP.1_2", control.createMock(BindingConfiguration.class));
+        final IntentMap intentMap = new IntentMap(intents);
+
+        List<Feature> features = new ArrayList<Feature>();
+        AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
+        control.replay();
+
+        IntentManager intentManager = new IntentManagerImpl(intentMap);
+
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put("osgi.remote.requires.intents", "A SOAP.1_2");
+        // ServiceEndpointDescription sd =
+        //         new ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
+
+        List<String> effectiveIntents = Arrays.asList(intentManager.applyIntents(features, factory, props));
+        assertEquals(2, effectiveIntents.size());
+        assertTrue(effectiveIntents.contains("A"));
+        assertTrue(effectiveIntents.contains("SOAP.1_2"));
+    }
+
+    public void testInheritMasterIntentMapDefault() {
+        List<String> features = runTestInheritMasterIntentMap("A B");
+
+        assertEquals(2, features.size());
+        assertTrue(features.contains("appFeatureA"));
+        assertTrue(features.contains("masterFeatureB"));
+    }
+
+    public void testInheritMasterIntentMap() {
+        List<String> features = runTestInheritMasterIntentMap("A B");
+
+        assertEquals(2, features.size());
+        assertTrue(features.contains("appFeatureA"));
+        assertTrue(features.contains("masterFeatureB"));
+    }
+
+    private List<String> runTestInheritMasterIntentMap(String requestedIntents) {
+        Map<String, Object> masterIntents = new HashMap<String, Object>();
+        masterIntents.put("A", new TestFeature("masterFeatureA"));
+        masterIntents.put("B", new TestFeature("masterFeatureB"));
+        final IntentMap intentMap = new IntentMap(masterIntents);
+        intentMap.put("A", new TestFeature("appFeatureA"));
+
+        IMocksControl control = EasyMock.createNiceControl();
+        List<Feature> features = new ArrayList<Feature>();
+        AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
+        control.replay();
+
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put("osgi.remote.requires.intents", requestedIntents);
+
+        IntentManagerImpl intentManager = new IntentManagerImpl(intentMap);
+        intentManager.applyIntents(features, factory, props);
+
+        List<String> featureNames = new ArrayList<String>();
+        for (Feature f : features) {
+            featureNames.add(f.toString());
+        }
+        return featureNames;
+    }
+
+    @Test
+    public void testProvidedIntents() {
+        Map<String, Object> masterIntents = new HashMap<String, Object>();
+        masterIntents.put("SOAP", "SOAP");
+        masterIntents.put("A", "Provided");
+        masterIntents.put("B", "PROVIDED");
+        final IntentMap intentMap = new IntentMap(masterIntents);
+
+        IMocksControl control = EasyMock.createNiceControl();
+        List<Feature> features = new ArrayList<Feature>();
+        AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
+        control.replay();
+
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put("osgi.remote.requires.intents", "B A");
+
+        IntentManager intentManager = new IntentManagerImpl(intentMap);
+
+        Set<String> effectiveIntents = new HashSet<String>(Arrays.asList(intentManager.applyIntents(features,
+                                                                                                    factory,
+                                                                                                    props)));
+        Set<String> expectedIntents = new HashSet<String>(Arrays.asList(new String[] {"A", "B", "SOAP"}));
+        assertEquals(expectedIntents, effectiveIntents);
+    }
+
+    private static final class TestFeature extends AbstractFeature {
+
+        private final String name;
+
+        private TestFeature(String n) {
+            name = n;
+        }
+
+        @Override
+        public String toString() {
+            return name;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentMapTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentMapTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentMapTest.java
new file mode 100644
index 0000000..748da85
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentMapTest.java
@@ -0,0 +1,41 @@
+/**
+ * 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;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class IntentMapTest {
+
+    @Test
+    public void inheritanceTest() {
+        Map<String, Object> defaultMap = new HashMap<String, Object>();
+        defaultMap.put("key1", "defaultValue");
+        IntentMap intentMap = new IntentMap(defaultMap);
+        Assert.assertEquals("defaultValue", intentMap.get("key1"));
+        intentMap.put("key1", "overridden");
+        Assert.assertEquals("overridden", intentMap.get("key1"));
+        Object curValue = intentMap.remove("key1");
+        Assert.assertEquals("overridden", curValue);
+        Assert.assertEquals("defaultValue", intentMap.get("key1"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentTrackerTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentTrackerTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentTrackerTest.java
new file mode 100644
index 0000000..b68cf61
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentTrackerTest.java
@@ -0,0 +1,80 @@
+/**
+ * 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;
+
+import org.apache.cxf.dosgi.dsw.Constants;
+import org.apache.cxf.feature.AbstractFeature;
+import org.easymock.Capture;
+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;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+
+import static org.easymock.EasyMock.expect;
+
+public class IntentTrackerTest {
+
+    private static final String MY_INTENT_NAME = "myIntent";
+
+    @Test
+    public void testIntentAsService() throws InvalidSyntaxException {
+        IMocksControl c = EasyMock.createControl();
+        BundleContext bc = c.createMock(BundleContext.class);
+        Filter filter = c.createMock(Filter.class);
+        expect(bc.createFilter(EasyMock.<String>anyObject())).andReturn(filter);
+        final Capture<ServiceListener> capturedListener = EasyMock.newCapture();
+        bc.addServiceListener(EasyMock.capture(capturedListener), EasyMock.<String>anyObject());
+        EasyMock.expectLastCall().atLeastOnce();
+        expect(bc.getServiceReferences(EasyMock.<String>anyObject(),
+                                       EasyMock.<String>anyObject())).andReturn(new ServiceReference[]{});
+        IntentMap intentMap = new IntentMap();
+
+        // Create a custom intent
+        @SuppressWarnings("unchecked")
+        ServiceReference<AbstractFeature> reference = c.createMock(ServiceReference.class);
+        expect(reference.getProperty(Constants.INTENT_NAME_PROP)).andReturn(MY_INTENT_NAME);
+        AbstractFeature testIntent = new AbstractFeature() {
+        };
+        expect(bc.getService(reference)).andReturn(testIntent).atLeastOnce();
+
+        c.replay();
+
+        IntentTracker tracker = new IntentTracker(bc, intentMap);
+        tracker.open();
+
+        Assert.assertFalse("IntentMap should not contain " + MY_INTENT_NAME, intentMap.containsKey(MY_INTENT_NAME));
+        ServiceListener listener = capturedListener.getValue();
+
+        // Simulate adding custom intent service
+        ServiceEvent event = new ServiceEvent(ServiceEvent.REGISTERED, reference);
+        listener.serviceChanged(event);
+
+        // our custom intent should now be available
+        Assert.assertTrue("IntentMap should contain " + MY_INTENT_NAME, intentMap.containsKey(MY_INTENT_NAME));
+        Assert.assertEquals(testIntent, intentMap.get(MY_INTENT_NAME));
+
+        c.verify();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentUtilsTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentUtilsTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentUtilsTest.java
new file mode 100644
index 0000000..f7fe844
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentUtilsTest.java
@@ -0,0 +1,70 @@
+/**
+ * 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;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.cxf.dosgi.dsw.Constants;
+import org.junit.Assert;
+import org.junit.Test;
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
+
+public class IntentUtilsTest {
+
+    @Test
+    public void testMergeArrays() {
+        Assert.assertNull(IntentUtils.mergeArrays(null, null));
+
+        String[] sa1 = {};
+        Assert.assertEquals(0, IntentUtils.mergeArrays(sa1, null).length);
+
+        String[] sa2 = {"X"};
+        Assert.assertEquals(1, IntentUtils.mergeArrays(null, sa2).length);
+        Assert.assertEquals("X", IntentUtils.mergeArrays(null, sa2)[0]);
+
+        String[] sa3 = {"Y", "Z"};
+        String[] sa4 = {"A", "Z"};
+        Assert.assertEquals(3, IntentUtils.mergeArrays(sa3, sa4).length);
+        Assert.assertEquals(new HashSet<String>(Arrays.asList("A", "Y", "Z")),
+                new HashSet<String>(Arrays.asList(IntentUtils.mergeArrays(sa3, sa4))));
+    }
+
+    @SuppressWarnings("deprecation")
+    @Test
+    public void testRequestedIntents() {
+        Map<String, Object> props = new HashMap<String, Object>();
+        Assert.assertEquals(0, IntentUtils.getRequestedIntents(props).size());
+
+        props.put(RemoteConstants.SERVICE_EXPORTED_INTENTS, "one");
+        Assert.assertEquals(Collections.singleton("one"), IntentUtils.getRequestedIntents(props));
+
+        props.put(RemoteConstants.SERVICE_EXPORTED_INTENTS_EXTRA, new String[] {"two", "three"});
+        Set<String> expected1 = new HashSet<String>(Arrays.asList("one", "two", "three"));
+        Assert.assertEquals(expected1, IntentUtils.getRequestedIntents(props));
+
+        props.put(Constants.EXPORTED_INTENTS_OLD, "A B C");
+        Set<String> expected2 = new HashSet<String>(Arrays.asList("one", "two", "three", "A", "B", "C"));
+        Assert.assertEquals(expected2, IntentUtils.getRequestedIntents(props));
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/OsgiUtilsTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/OsgiUtilsTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/OsgiUtilsTest.java
new file mode 100644
index 0000000..cc15ea6
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/OsgiUtilsTest.java
@@ -0,0 +1,152 @@
+/**
+ * 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.util;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.easymock.EasyMock;
+import org.easymock.IMocksControl;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+import org.osgi.service.packageadmin.ExportedPackage;
+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() {
+        assertEquals(Collections.singleton("hi"),
+            OsgiUtils.getMultiValueProperty("hi"));
+    }
+
+    public void testMultiValuePropertyAsArray() {
+        assertEquals(Arrays.asList("a", "b"),
+                OsgiUtils.getMultiValueProperty(new String[] {"a", "b"}));
+    }
+
+    public void testMultiValuePropertyAsCollection() {
+        List<String> list = new ArrayList<String>();
+        list.add("1");
+        list.add("2");
+        list.add("3");
+        assertEquals(list, OsgiUtils.getMultiValueProperty(list));
+    }
+
+    public void testMultiValuePropertyNull() {
+        assertNull(OsgiUtils.getMultiValueProperty(null));
+    }
+
+    @SuppressWarnings({
+     "rawtypes", "unchecked"
+    })
+    public void testGetVersion() {
+        IMocksControl c = EasyMock.createNiceControl();
+        BundleContext bc = c.createMock(BundleContext.class);
+        ServiceReference sref = c.createMock(ServiceReference.class);
+        PackageAdmin pa = c.createMock(PackageAdmin.class);
+        Bundle b = c.createMock(Bundle.class);
+
+        EasyMock.expect(bc.getServiceReference(EasyMock.eq(PackageAdmin.class))).andReturn(sref);
+        EasyMock.expect(bc.getService(EasyMock.eq(sref))).andReturn(pa);
+
+        Class<?> iClass = CharSequence.class;
+
+        c.replay();
+        // version 0.0.0 because of missing bundle
+
+        assertEquals("0.0.0", OsgiUtils.getVersion(iClass, bc));
+
+        c.verify();
+        c.reset();
+        // version 1.2.3
+
+        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);
+
+        ExportedPackage[] exP = new ExportedPackage[] {new MyExportedPackage(iClass.getPackage(), "1.2.3"),
+                                                       new MyExportedPackage(String.class.getPackage(), "4.5.6") };
+
+        EasyMock.expect(pa.getExportedPackages(EasyMock.eq(b))).andReturn(exP).atLeastOnce();
+
+        c.replay();
+        assertEquals("1.2.3", OsgiUtils.getVersion(iClass, bc));
+        c.verify();
+    }
+
+    private static class MyExportedPackage implements ExportedPackage {
+
+        Package package1;
+        String version;
+
+        MyExportedPackage(Package package1, String version) {
+            this.package1 = package1;
+            this.version = version;
+        }
+
+        public Bundle getExportingBundle() {
+            return null;
+        }
+
+        public Bundle[] getImportingBundles() {
+            return null;
+        }
+
+        public String getName() {
+            return package1.getName();
+        }
+
+        public String getSpecificationVersion() {
+            return null;
+        }
+
+        public Version getVersion() {
+            return new Version(version);
+        }
+
+        public boolean isRemovalPending() {
+            return false;
+        }
+    }
+
+    public void testGetProperty() {
+        Map<String, Object> p = new HashMap<String, Object>();
+        p.put(RemoteConstants.ENDPOINT_ID, "http://google.de");
+        p.put("notAString", new Object());
+        p.put(org.osgi.framework.Constants.OBJECTCLASS, new String[]{"my.class"});
+        p.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, new String[]{"my.config"});
+
+        EndpointDescription endpoint = new EndpointDescription(p);
+
+        assertNull(OsgiUtils.getProperty(endpoint, "unknownProp"));
+        assertEquals(p.get(RemoteConstants.ENDPOINT_ID), OsgiUtils.getProperty(endpoint, RemoteConstants.ENDPOINT_ID));
+        assertEquals(null, OsgiUtils.getProperty(endpoint, "notAString"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/Provider.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/Provider.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/Provider.java
new file mode 100644
index 0000000..ecd7c78
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/Provider.java
@@ -0,0 +1,23 @@
+/**
+ * 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.util;
+
+
+public class Provider {
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/resources/OSGI-INF/remote-service/alt-remote-services.xml
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/resources/OSGI-INF/remote-service/alt-remote-services.xml b/cxf-dsw/src/test/resources/OSGI-INF/remote-service/alt-remote-services.xml
new file mode 100644
index 0000000..36409ce
--- /dev/null
+++ b/cxf-dsw/src/test/resources/OSGI-INF/remote-service/alt-remote-services.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<service-descriptions xmlns="http://www.osgi.org/xmlns/sd/v1.0.0">
+  <service-description>
+    <provide interface="org.apache.cxf.dosgi.dsw.hooks.TestService" />
+    <provide interface="org.apache.cxf.dosgi.dsw.hooks.CxfPublishHookTest$AdditionalInterface" />
+
+    <property name="osgi.remote.interfaces" value="*" />
+    <property name="osgi.remote.requires.intents" value="SOAP HTTP" />
+    <property name="osgi.remote.configuration.type" value="pojo" />
+    <property name="osgi.remote.configuration.pojo.address" value="http://localhost:9000/hello" />
+  </service-description>
+</service-descriptions>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/resources/OSGI-INF/remote-service/multi-services.xml
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/resources/OSGI-INF/remote-service/multi-services.xml b/cxf-dsw/src/test/resources/OSGI-INF/remote-service/multi-services.xml
new file mode 100644
index 0000000..3d20c08
--- /dev/null
+++ b/cxf-dsw/src/test/resources/OSGI-INF/remote-service/multi-services.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<service-descriptions xmlns="http://www.osgi.org/xmlns/sd/v1.0.0">
+  <service-description>
+    <provide interface="org.apache.cxf.dosgi.dsw.hooks.TestService" />
+    <provide interface="org.apache.cxf.dosgi.dsw.hooks.CxfPublishHookTest$AdditionalInterface" />
+    <property name="osgi.remote.interfaces">org.apache.cxf.dosgi.dsw.hooks.TestService,org.apache.cxf.dosgi.dsw.hooks.CxfPublishHookTest$AdditionalInterface</property>
+    <property name="osgi.remote.requires.intents">SOAP HTTP</property>
+    <property name="osgi.remote.configuration.type">pojo</property>
+    <property name="osgi.remote.configuration.pojo.address"
+              interface="org.apache.cxf.dosgi.dsw.hooks.TestService">
+      http://localhost:9001/hello
+    </property>
+    <property name="osgi.remote.configuration.pojo.address"
+              interface="org.apache.cxf.dosgi.dsw.hooks.CxfPublishHookTest$AdditionalInterface">
+      http://localhost:9002/hello
+    </property>
+  </service-description>
+</service-descriptions>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/resources/OSGI-INF/remote-service/remote-services.xml
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/resources/OSGI-INF/remote-service/remote-services.xml b/cxf-dsw/src/test/resources/OSGI-INF/remote-service/remote-services.xml
new file mode 100644
index 0000000..45b2a20
--- /dev/null
+++ b/cxf-dsw/src/test/resources/OSGI-INF/remote-service/remote-services.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<service-descriptions xmlns="http://www.osgi.org/xmlns/sd/v1.0.0">
+  <service-description>
+    <provide interface="org.apache.cxf.dosgi.dsw.hooks.TestService" />
+    <provide interface="org.apache.cxf.dosgi.dsw.hooks.CxfPublishHookTest$AdditionalInterface" />
+
+    <property name="osgi.remote.interfaces">*</property>
+    <property name="osgi.remote.requires.intents">SOAP HTTP</property>
+    <property name="osgi.remote.configuration.type">pojo</property>
+    <property name="osgi.remote.configuration.pojo.address">http://localhost:9000/hello</property>
+  </service-description>
+</service-descriptions>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/resources/test-resources/rs1.xml
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/resources/test-resources/rs1.xml b/cxf-dsw/src/test/resources/test-resources/rs1.xml
new file mode 100644
index 0000000..f67a833
--- /dev/null
+++ b/cxf-dsw/src/test/resources/test-resources/rs1.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<service-descriptions xmlns="http://www.osgi.org/xmlns/sd/v1.0.0">
+  <service-description>
+    <provide interface="SomeService" />
+    <property name="osgi.remote.requires.intents">confidentiality</property>
+  </service-description>
+  <service-description>
+    <provide interface="SomeOtherService" />
+    <provide interface="WithSomeSecondInterface" />
+  </service-description>
+</service-descriptions>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/resources/test-resources/rs2.xml
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/resources/test-resources/rs2.xml b/cxf-dsw/src/test/resources/test-resources/rs2.xml
new file mode 100644
index 0000000..098aa21
--- /dev/null
+++ b/cxf-dsw/src/test/resources/test-resources/rs2.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<service-descriptions xmlns="http://www.osgi.org/xmlns/sd/v1.0.0">
+  <service-description>
+    <provide interface="org.example.Service" />
+    <property name="deployment.intents">confidentiality.message integrity</property>
+    <property name="osgi.remote.interfaces">*</property>
+  </service-description>
+</service-descriptions>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/resources/test-resources/sd-1.xml
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/resources/test-resources/sd-1.xml b/cxf-dsw/src/test/resources/test-resources/sd-1.xml
new file mode 100644
index 0000000..483b196
--- /dev/null
+++ b/cxf-dsw/src/test/resources/test-resources/sd-1.xml
@@ -0,0 +1,3 @@
+<test>
+  <some-other-tag/>
+</test>
\ No newline at end of file


[10/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

Posted by cs...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceDataMonitorListenerImplTest.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceDataMonitorListenerImplTest.java b/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceDataMonitorListenerImplTest.java
deleted file mode 100644
index 53b6139..0000000
--- a/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceDataMonitorListenerImplTest.java
+++ /dev/null
@@ -1,183 +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.discovery.zookeeper;
-
-import junit.framework.TestCase;
-
-public class InterfaceDataMonitorListenerImplTest extends TestCase {
-
-    public void testDUMMY() {
-        assertTrue(true);
-    }
-
-//    public void testChange() throws Exception {
-//        final List<DiscoveredServiceNotification> dsnCallbacks = new ArrayList<DiscoveredServiceNotification>();
-//        DiscoveredServiceTracker dst = new DiscoveredServiceTracker() {
-//            public void serviceChanged(DiscoveredServiceNotification dsn) {
-//                dsnCallbacks.add(dsn);
-//            }
-//        };
-//
-//        //----------------------------------------------------------------
-//        // Test DiscoveredServiceNotification.AVAILABLE
-//        //----------------------------------------------------------------
-//        Properties initial = new Properties();
-//        initial.put("a", "b");
-//        initial.put(ServicePublication.ENDPOINT_LOCATION, "http://somehost:12345/some/context");
-//        ByteArrayOutputStream propBytes = new ByteArrayOutputStream();
-//        initial.store(propBytes, "");
-//
-//        ZooKeeper zk = EasyMock.createMock(ZooKeeper.class);
-//        EasyMock.expect(zk.getChildren(Utils.getZooKeeperPath(String.class.getName()), false))
-//            .andReturn(Arrays.asList("x#y#z"));
-//        EasyMock.expect(zk.getData(Utils.getZooKeeperPath(String.class.getName()) + "/x#y#z", false, null))
-//            .andReturn(propBytes.toByteArray());
-//        EasyMock.replay(zk);
-//
-//        InterfaceDataMonitorListenerImpl dml = new InterfaceDataMonitorListenerImpl(zk, String.class.getName(), dst);
-//
-//        assertEquals("Precondition failed", 0, dsnCallbacks.size());
-//        dml.change();
-//        assertEquals(1, dsnCallbacks.size());
-//        DiscoveredServiceNotification dsn = dsnCallbacks.iterator().next();
-//        assertEquals(Collections.singleton(String.class.getName()), dsn.getInterfaces());
-//        assertEquals(DiscoveredServiceNotification.AVAILABLE, dsn.getType());
-//        assertEquals(0, dsn.getFilters().size());
-//        ServiceEndpointDescription sed = dsn.getServiceEndpointDescription();
-//        assertEquals(Collections.singleton(String.class.getName()), sed.getProvidedInterfaces());
-//
-//        Properties expected = new Properties();
-//        expected.load(new ByteArrayInputStream(propBytes.toByteArray()));
-//        expected.put("service.exported.configs", "org.apache.cxf.ws");
-//        expected.put("org.apache.cxf.ws.address", "http://somehost:12345/some/context");
-//
-//        assertEquals(expected, sed.getProperties());
-//        EasyMock.verify(zk);
-//
-//        // Again with the same data
-//        EasyMock.reset(zk);
-//        EasyMock.expect(zk.getChildren(Utils.getZooKeeperPath(String.class.getName()), false))
-//            .andReturn(Arrays.asList("x#y#z"));
-//        EasyMock.expect(zk.getData(Utils.getZooKeeperPath(String.class.getName()) + "/x#y#z", false, null))
-//            .andReturn(propBytes.toByteArray());
-//        EasyMock.replay(zk);
-//
-//        dsnCallbacks.clear();
-//        assertEquals("Precondition failed", 0, dsnCallbacks.size());
-//        dml.change();
-//        assertEquals(0, dsnCallbacks.size());
-//
-//        EasyMock.verify(zk);
-//        //----------------------------------------------------------------
-//        // Test DiscoveredServiceNotification.MODIFIED
-//        //----------------------------------------------------------------
-//        Properties modified = new Properties();
-//        modified.put("c", "d");
-//        modified.put(ServicePublication.ENDPOINT_LOCATION, "http://somehost:999/some/context");
-//        modified.put("service.exported.configs", "org.apache.cxf.rs");
-//        ByteArrayOutputStream modBytes = new ByteArrayOutputStream();
-//        modified.store(modBytes, "");
-//
-//        EasyMock.reset(zk);
-//        EasyMock.expect(zk.getChildren(Utils.getZooKeeperPath(String.class.getName()), false))
-//            .andReturn(Arrays.asList("x#y#z"));
-//        EasyMock.expect(zk.getData(Utils.getZooKeeperPath(String.class.getName()) + "/x#y#z", false, null))
-//            .andReturn(modBytes.toByteArray());
-//        EasyMock.replay(zk);
-//
-//        dsnCallbacks.clear();
-//        assertEquals("Precondition failed", 0, dsnCallbacks.size());
-//        dml.change();
-//        assertEquals(1, dsnCallbacks.size());
-//        DiscoveredServiceNotification dsn2 = dsnCallbacks.iterator().next();
-//        assertEquals(Collections.singleton(String.class.getName()), dsn2.getInterfaces());
-//        assertEquals(DiscoveredServiceNotification.MODIFIED, dsn2.getType());
-//        assertEquals(0, dsn2.getFilters().size());
-//        ServiceEndpointDescription sed2 = dsn2.getServiceEndpointDescription();
-//        assertEquals(Collections.singleton(String.class.getName()), sed2.getProvidedInterfaces());
-//        assertEquals(modified, sed2.getProperties());
-//
-//        EasyMock.verify(zk);
-//
-//        //----------------------------------------------------------------
-//        // Test DiscoveredServiceNotification.MODIFIED2
-//        //----------------------------------------------------------------
-//        Properties modified2 = new Properties();
-//        modified2.put("c", "d2");
-//        modified2.put(ServicePublication.ENDPOINT_LOCATION, "http://somehost:112/some/context");
-//        modified2.put("service.exported.configs", "org.apache.cxf.ws");
-//        modified2.put("org.apache.cxf.ws.address", "http://somewhereelse/123");
-//        ByteArrayOutputStream modBytes2 = new ByteArrayOutputStream();
-//        modified2.store(modBytes2, "");
-//
-//        EasyMock.reset(zk);
-//        EasyMock.expect(zk.getChildren(Utils.getZooKeeperPath(String.class.getName()), false))
-//            .andReturn(Arrays.asList("x#y#z"));
-//        EasyMock.expect(zk.getData(Utils.getZooKeeperPath(String.class.getName()) + "/x#y#z", false, null))
-//            .andReturn(modBytes2.toByteArray());
-//        EasyMock.replay(zk);
-//
-//        dsnCallbacks.clear();
-//        assertEquals("Precondition failed", 0, dsnCallbacks.size());
-//        dml.change();
-//        assertEquals(1, dsnCallbacks.size());
-//        DiscoveredServiceNotification dsn3 = dsnCallbacks.iterator().next();
-//        assertEquals(Collections.singleton(String.class.getName()), dsn3.getInterfaces());
-//        assertEquals(DiscoveredServiceNotification.MODIFIED, dsn3.getType());
-//        assertEquals(0, dsn3.getFilters().size());
-//        ServiceEndpointDescription sed3 = dsn3.getServiceEndpointDescription();
-//        assertEquals(Collections.singleton(String.class.getName()), sed3.getProvidedInterfaces());
-//        assertEquals(modified2, sed3.getProperties());
-//
-//        EasyMock.verify(zk);
-//        //----------------------------------------------------------------
-//        // Test DiscoveredServiceNotification.UNAVAILABLE
-//        //----------------------------------------------------------------
-//        EasyMock.reset(zk);
-//        EasyMock.expect(zk.getChildren(Utils.getZooKeeperPath(String.class.getName()), false))
-//            .andReturn(Collections.<String>emptyList());
-//        EasyMock.replay(zk);
-//
-//        dsnCallbacks.clear();
-//        assertEquals("Precondition failed", 0, dsnCallbacks.size());
-//        dml.change();
-//        assertEquals(1, dsnCallbacks.size());
-//        DiscoveredServiceNotification dsn4 = dsnCallbacks.iterator().next();
-//        assertEquals(Collections.singleton(String.class.getName()), dsn4.getInterfaces());
-//        assertEquals(DiscoveredServiceNotification.UNAVAILABLE, dsn4.getType());
-//        assertEquals(0, dsn4.getFilters().size());
-//        ServiceEndpointDescription sed4 = dsn4.getServiceEndpointDescription();
-//        assertEquals(Collections.singleton(String.class.getName()), sed4.getProvidedInterfaces());
-//        assertEquals(modified2, sed4.getProperties());
-//
-//        EasyMock.verify(zk);
-//
-//        // Try the same again...
-//        EasyMock.reset(zk);
-//        EasyMock.expect(zk.getChildren(Utils.getZooKeeperPath(String.class.getName()), false))
-//            .andReturn(Collections.<String>emptyList());
-//        EasyMock.replay(zk);
-//
-//        dsnCallbacks.clear();
-//        assertEquals("Precondition failed", 0, dsnCallbacks.size());
-//        dml.change();
-//        assertEquals("Should not receive a callback again...", 0, dsnCallbacks.size());
-//        EasyMock.verify(zk);
-//    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListenerFactoryTest.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListenerFactoryTest.java b/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListenerFactoryTest.java
deleted file mode 100644
index e63b805..0000000
--- a/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListenerFactoryTest.java
+++ /dev/null
@@ -1,100 +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.discovery.zookeeper.publish;
-
-import java.util.Dictionary;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.apache.zookeeper.ZooKeeper;
-import org.easymock.classextension.EasyMock;
-import org.easymock.classextension.IMocksControl;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-
-public class PublishingEndpointListenerFactoryTest extends TestCase {
-
-    @SuppressWarnings("unchecked")
-    public void testScope() {
-        IMocksControl c = EasyMock.createNiceControl();
-
-        BundleContext ctx = c.createMock(BundleContext.class);
-        ZooKeeper zk = c.createMock(ZooKeeper.class);
-        @SuppressWarnings("rawtypes")
-        ServiceRegistration sreg = c.createMock(ServiceRegistration.class);
-
-        PublishingEndpointListenerFactory eplf = new PublishingEndpointListenerFactory(zk, ctx);
-
-        EasyMock.expect(ctx.registerService(EasyMock.eq(EndpointListener.class.getName()), EasyMock.eq(eplf),
-                                            (Dictionary<String, String>)EasyMock.anyObject())).andReturn(sreg).once();
-
-        EasyMock.expect(ctx.getProperty(EasyMock.eq("org.osgi.framework.uuid"))).andReturn("myUUID").anyTimes();
-
-        c.replay();
-        eplf.start();
-        c.verify();
-
-    }
-
-    @SuppressWarnings("unchecked")
-    public void testServiceFactory() {
-        IMocksControl c = EasyMock.createNiceControl();
-
-        BundleContext ctx = c.createMock(BundleContext.class);
-        ZooKeeper zk = c.createMock(ZooKeeper.class);
-        @SuppressWarnings("rawtypes")
-        ServiceRegistration sreg = c.createMock(ServiceRegistration.class);
-
-        PublishingEndpointListenerFactory eplf = new PublishingEndpointListenerFactory(zk, ctx);
-
-        EasyMock.expect(ctx.registerService(EasyMock.eq(EndpointListener.class.getName()), EasyMock.eq(eplf),
-                                (Dictionary<String, String>)EasyMock.anyObject())).andReturn(sreg).once();
-
-        EasyMock.expect(ctx.getProperty(EasyMock.eq("org.osgi.framework.uuid"))).andReturn("myUUID").anyTimes();
-
-        PublishingEndpointListener eli = c.createMock(PublishingEndpointListener.class);
-        eli.close();
-        EasyMock.expectLastCall().once();
-
-        c.replay();
-        eplf.start();
-
-        PublishingEndpointListener service = eplf.getService(null, null);
-        assertNotNull(service);
-        assertTrue(service instanceof EndpointListener);
-
-        List<PublishingEndpointListener> listeners = eplf.getListeners();
-        assertEquals(1, listeners.size());
-        assertEquals(service, listeners.get(0));
-
-        eplf.ungetService(null, null, service);
-        listeners = eplf.getListeners();
-        assertEquals(0, listeners.size());
-
-        eplf.ungetService(null, null, eli); // no call to close
-        listeners.add(eli);
-        eplf.ungetService(null, null, eli); // call to close
-        listeners = eplf.getListeners();
-        assertEquals(0, listeners.size());
-
-        c.verify();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListenerTest.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListenerTest.java b/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListenerTest.java
deleted file mode 100644
index aa1b68e..0000000
--- a/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListenerTest.java
+++ /dev/null
@@ -1,201 +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.discovery.zookeeper.publish;
-
-import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-import org.apache.cxf.dosgi.endpointdesc.EndpointDescriptionParser;
-import org.apache.cxf.dosgi.endpointdesc.PropertiesMapper;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.ZooDefs.Ids;
-import org.apache.zookeeper.ZooKeeper;
-import org.easymock.IAnswer;
-import org.easymock.classextension.EasyMock;
-import org.easymock.classextension.IMocksControl;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-import org.osgi.xmlns.rsa.v1_0.EndpointDescriptionType;
-import org.osgi.xmlns.rsa.v1_0.PropertyType;
-
-public class PublishingEndpointListenerTest extends TestCase {
-
-    public void testEndpointRemovalAdding() throws KeeperException, InterruptedException {
-        IMocksControl c = EasyMock.createNiceControl();
-
-        BundleContext ctx = c.createMock(BundleContext.class);
-        ZooKeeper zk = c.createMock(ZooKeeper.class);
-
-        String path = "/osgi/service_registry/myClass/google.de#80##test";
-        EasyMock.expect(zk.create(EasyMock.eq(path),
-                (byte[])EasyMock.anyObject(), EasyMock.eq(Ids.OPEN_ACL_UNSAFE),
-                EasyMock.eq(CreateMode.EPHEMERAL))).andReturn("").once();
-
-        zk.delete(EasyMock.eq("/osgi/service_registry/myClass/google.de#80##test"), EasyMock.eq(-1));
-        EasyMock.expectLastCall().once();
-
-        c.replay();
-
-        PublishingEndpointListener eli = new PublishingEndpointListener(zk, ctx);
-
-        Map<String, Object> props = new HashMap<String, Object>();
-        props.put(Constants.OBJECTCLASS, new String[] {
-            "myClass"
-        });
-        props.put(RemoteConstants.ENDPOINT_ID, "http://google.de:80/test");
-        props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, "myConfig");
-
-        EndpointDescription endpoint = new EndpointDescription(props);
-
-        eli.endpointAdded(endpoint, null);
-        eli.endpointAdded(endpoint, null); // should do nothing
-
-        eli.endpointRemoved(endpoint, null);
-        eli.endpointRemoved(endpoint, null); // should do nothing
-
-        c.verify();
-    }
-
-    public void testDiscoveryPlugin() throws Exception {
-        DiscoveryPlugin plugin1 = new DiscoveryPlugin() {
-            public String process(Map<String, Object> mutableProperties, String endpointKey) {
-                String eid = (String) mutableProperties.get("endpoint.id");
-                mutableProperties.put("endpoint.id", eid + "/appended");
-                return endpointKey;
-            }
-        };
-        @SuppressWarnings("unchecked")
-        ServiceReference<DiscoveryPlugin> sr1 = EasyMock.createMock(ServiceReference.class);
-
-        DiscoveryPlugin plugin2 = new DiscoveryPlugin() {
-            public String process(Map<String, Object> mutableProperties, String endpointKey) {
-                mutableProperties.put("foo", "bar");
-                return endpointKey.replaceAll("localhost", "some.machine");
-            }
-        };
-        @SuppressWarnings("unchecked")
-        ServiceReference<DiscoveryPlugin> sr2 = EasyMock.createMock(ServiceReference.class);
-
-        BundleContext ctx = EasyMock.createMock(BundleContext.class);
-        EasyMock.expect(ctx.createFilter(EasyMock.isA(String.class))).andAnswer(new IAnswer<Filter>() {
-            public Filter answer() throws Throwable {
-                return FrameworkUtil.createFilter((String) EasyMock.getCurrentArguments()[0]);
-            }
-        }).anyTimes();
-        ctx.addServiceListener(EasyMock.isA(ServiceListener.class),
-                EasyMock.eq("(objectClass=" + DiscoveryPlugin.class.getName() + ")"));
-        EasyMock.expect(ctx.getService(sr1)).andReturn(plugin1).anyTimes();
-        EasyMock.expect(ctx.getService(sr2)).andReturn(plugin2).anyTimes();
-        EasyMock.expect(ctx.getServiceReferences(DiscoveryPlugin.class.getName(), null))
-                .andReturn(new ServiceReference[]{sr1, sr2}).anyTimes();
-        EasyMock.replay(ctx);
-
-        Map<String, Object> props = new HashMap<String, Object>();
-        props.put(Constants.OBJECTCLASS, new String[] {"org.foo.myClass"});
-        props.put(RemoteConstants.ENDPOINT_ID, "http://localhost:9876/test");
-        props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, "myConfig");
-        EndpointDescription endpoint = new EndpointDescription(props);
-
-        Map<String, Object> expectedProps = new HashMap<String, Object>(props);
-        expectedProps.put("endpoint.id", "http://localhost:9876/test/appended");
-        expectedProps.put("foo", "bar");
-        expectedProps.put("service.imported", "true");
-
-        final ZooKeeper zk = EasyMock.createNiceMock(ZooKeeper.class);
-        String expectedFullPath = "/osgi/service_registry/org/foo/myClass/some.machine#9876##test";
-        
-        List<PropertyType> props2 = new PropertiesMapper().fromProps(expectedProps);
-        EndpointDescriptionType epd = new EndpointDescriptionType();
-        epd.getProperty().addAll(props2);
-        byte[] data = new EndpointDescriptionParser().getData(epd);
-        EasyMock.expect(zk.create(
-                EasyMock.eq(expectedFullPath),
-                EasyMock.aryEq(data),
-                EasyMock.eq(Ids.OPEN_ACL_UNSAFE),
-                EasyMock.eq(CreateMode.EPHEMERAL))).andReturn("");
-        EasyMock.replay(zk);
-
-        PublishingEndpointListener eli = new PublishingEndpointListener(zk, ctx);
-
-        List<EndpointDescription> endpoints = getEndpoints(eli);
-        assertEquals("Precondition", 0, endpoints.size());
-        eli.endpointAdded(endpoint, null);
-        assertEquals(1, endpoints.size());
-
-        //TODO enable
-        //EasyMock.verify(zk);
-    }
-
-    @SuppressWarnings("unchecked")
-    private List<EndpointDescription> getEndpoints(PublishingEndpointListener eli) throws Exception {
-        Field field = eli.getClass().getDeclaredField("endpoints");
-        field.setAccessible(true);
-        return (List<EndpointDescription>) field.get(eli);
-    }
-
-    public void testClose() throws KeeperException, InterruptedException {
-        IMocksControl c = EasyMock.createNiceControl();
-
-        BundleContext ctx = c.createMock(BundleContext.class);
-        ZooKeeper zk = c.createMock(ZooKeeper.class);
-
-        String path = "/osgi/service_registry/myClass/google.de#80##test";
-        EasyMock.expect(zk.create(EasyMock.eq(path),
-                (byte[])EasyMock.anyObject(), EasyMock.eq(Ids.OPEN_ACL_UNSAFE),
-                EasyMock.eq(CreateMode.EPHEMERAL))).andReturn("").once();
-
-        zk.delete(EasyMock.eq("/osgi/service_registry/myClass/google.de#80##test"), EasyMock.eq(-1));
-        EasyMock.expectLastCall().once();
-
-        c.replay();
-
-        PublishingEndpointListener eli = new PublishingEndpointListener(zk, ctx);
-
-        Map<String, Object> props = new HashMap<String, Object>();
-        props.put(Constants.OBJECTCLASS, new String[] {
-            "myClass"
-        });
-        props.put(RemoteConstants.ENDPOINT_ID, "http://google.de:80/test");
-        props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, "myConfig");
-
-        EndpointDescription endpoint = new EndpointDescription(props);
-
-        eli.endpointAdded(endpoint, null);
-
-        eli.close(); // should result in zk.delete(...)
-
-        c.verify();
-    }
-
-    public void testGetKey() throws Exception {
-        assertEquals("somehost#9090##org#example#TestEndpoint",
-            PublishingEndpointListener.getKey("http://somehost:9090/org/example/TestEndpoint"));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitorManagerTest.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitorManagerTest.java b/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitorManagerTest.java
deleted file mode 100644
index 7d6f67f..0000000
--- a/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitorManagerTest.java
+++ /dev/null
@@ -1,139 +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.discovery.zookeeper.subscribe;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.zookeeper.ZooKeeper;
-import org.easymock.IAnswer;
-import org.easymock.classextension.EasyMock;
-import org.easymock.classextension.IMocksControl;
-import org.junit.Test;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-
-import static org.junit.Assert.assertEquals;
-
-public class InterfaceMonitorManagerTest {
-
-    @Test
-    public void testEndpointListenerTrackerCustomizer() {
-        IMocksControl c = EasyMock.createNiceControl();
-
-        BundleContext ctx = c.createMock(BundleContext.class);
-        ZooKeeper zk = c.createMock(ZooKeeper.class);
-
-        @SuppressWarnings("unchecked")
-        ServiceReference<EndpointListener> sref = c.createMock(ServiceReference.class);
-        @SuppressWarnings("unchecked")
-        ServiceReference<EndpointListener> sref2 = c.createMock(ServiceReference.class);
-
-        final Map<String, ?> p = new HashMap<String, Object>();
-
-        EasyMock.expect(sref.getPropertyKeys()).andAnswer(new IAnswer<String[]>() {
-            public String[] answer() throws Throwable {
-                return p.keySet().toArray(new String[p.size()]);
-            }
-        }).anyTimes();
-
-        EasyMock.expect(sref.getProperty((String)EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
-            public Object answer() throws Throwable {
-                String key = (String)(EasyMock.getCurrentArguments()[0]);
-                return p.get(key);
-            }
-        }).anyTimes();
-
-        EasyMock.expect(sref2.getPropertyKeys()).andAnswer(new IAnswer<String[]>() {
-            public String[] answer() throws Throwable {
-                return p.keySet().toArray(new String[p.size()]);
-            }
-        }).anyTimes();
-
-        EasyMock.expect(sref2.getProperty((String)EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
-            public Object answer() throws Throwable {
-                String key = (String)(EasyMock.getCurrentArguments()[0]);
-                return p.get(key);
-            }
-        }).anyTimes();
-
-        final List<IMocksControl> controls = new ArrayList<IMocksControl>();
-
-        InterfaceMonitorManager eltc = new InterfaceMonitorManager(ctx, zk);
-
-        c.replay();
-
-        // sref has no scope -> nothing should happen
-
-        assertEquals(0, eltc.getEndpointListenerScopes().size());
-        assertEquals(0, eltc.getInterests().size());
-
-        //p.put(EndpointListener.ENDPOINT_LISTENER_SCOPE, );
-
-        eltc.addInterest(sref, "(objectClass=mine)", "mine");
-
-        assertEquals(1, eltc.getEndpointListenerScopes().size());
-        assertEquals(1, eltc.getEndpointListenerScopes().get(sref).size());
-        assertEquals("(objectClass=mine)", eltc.getEndpointListenerScopes().get(sref).get(0));
-        assertEquals(1, eltc.getInterests().size());
-
-        eltc.addInterest(sref, "(objectClass=mine)", "mine");
-
-        assertEquals(1, eltc.getEndpointListenerScopes().size());
-        assertEquals(1, eltc.getEndpointListenerScopes().get(sref).size());
-        assertEquals("(objectClass=mine)", eltc.getEndpointListenerScopes().get(sref).get(0));
-        assertEquals(1, eltc.getInterests().size());
-
-        eltc.addInterest(sref2, "(objectClass=mine)", "mine");
-
-        assertEquals(2, eltc.getEndpointListenerScopes().size());
-        assertEquals(1, eltc.getEndpointListenerScopes().get(sref).size());
-        assertEquals(1, eltc.getEndpointListenerScopes().get(sref2).size());
-        assertEquals("(objectClass=mine)", eltc.getEndpointListenerScopes().get(sref).get(0));
-        assertEquals("(objectClass=mine)", eltc.getEndpointListenerScopes().get(sref2).get(0));
-        assertEquals(1, eltc.getInterests().size());
-
-        eltc.removeInterest(sref);
-
-        assertEquals(1, eltc.getEndpointListenerScopes().size());
-        assertEquals(1, eltc.getEndpointListenerScopes().get(sref2).size());
-        assertEquals("(objectClass=mine)", eltc.getEndpointListenerScopes().get(sref2).get(0));
-        assertEquals(1, eltc.getInterests().size());
-
-        eltc.removeInterest(sref);
-
-        assertEquals(1, eltc.getEndpointListenerScopes().size());
-        assertEquals(1, eltc.getEndpointListenerScopes().get(sref2).size());
-        assertEquals("(objectClass=mine)", eltc.getEndpointListenerScopes().get(sref2).get(0));
-        assertEquals(1, eltc.getInterests().size());
-
-        eltc.removeInterest(sref2);
-
-        assertEquals(0, eltc.getEndpointListenerScopes().size());
-        assertEquals(0, eltc.getInterests().size());
-
-        c.verify();
-        for (IMocksControl control : controls) {
-            control.verify();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitorTest.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitorTest.java b/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitorTest.java
deleted file mode 100644
index 67afb16..0000000
--- a/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitorTest.java
+++ /dev/null
@@ -1,67 +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.discovery.zookeeper.subscribe;
-
-import java.util.Collections;
-
-import junit.framework.TestCase;
-
-import org.apache.cxf.dosgi.discovery.zookeeper.util.Utils;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher.Event.EventType;
-import org.apache.zookeeper.Watcher.Event.KeeperState;
-import org.apache.zookeeper.ZooKeeper;
-import org.apache.zookeeper.data.Stat;
-import org.easymock.classextension.EasyMock;
-import org.easymock.classextension.IMocksControl;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-
-public class InterfaceMonitorTest extends TestCase {
-
-    public void testInterfaceMonitor() throws KeeperException, InterruptedException {
-        IMocksControl c = EasyMock.createControl();
-
-        ZooKeeper zk = c.createMock(ZooKeeper.class);
-        expect(zk.getState()).andReturn(ZooKeeper.States.CONNECTED).anyTimes();
-
-        String scope = "(myProp=test)";
-        String interf = "es.schaaf.test";
-        String node = Utils.getZooKeeperPath(interf);
-
-        EndpointListener endpointListener = c.createMock(EndpointListener.class);
-        InterfaceMonitor im = new InterfaceMonitor(zk, interf, endpointListener, scope);
-        zk.exists(eq(node), eq(im), eq(im), EasyMock.anyObject());
-        EasyMock.expectLastCall().once();
-
-        expect(zk.exists(eq(node), eq(false))).andReturn(new Stat()).anyTimes();
-        expect(zk.getChildren(eq(node), eq(false))).andReturn(Collections.<String> emptyList()).once();
-        expect(zk.getChildren(eq(node), eq(im))).andReturn(Collections.<String> emptyList()).once();
-
-        c.replay();
-        im.start();
-        // simulate a zk callback
-        WatchedEvent we = new WatchedEvent(EventType.NodeCreated, KeeperState.SyncConnected, node);
-        im.process(we);
-        c.verify();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/util/UtilsTest.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/util/UtilsTest.java b/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/util/UtilsTest.java
deleted file mode 100644
index 08c830c..0000000
--- a/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/util/UtilsTest.java
+++ /dev/null
@@ -1,110 +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.discovery.zookeeper.util;
-
-import java.util.Arrays;
-
-import junit.framework.TestCase;
-
-import org.easymock.classextension.EasyMock;
-import org.easymock.classextension.IMocksControl;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-
-public class UtilsTest extends TestCase {
-
-    public void testGetZooKeeperPath() {
-        assertEquals(Utils.PATH_PREFIX + '/' + "org/example/Test",
-            Utils.getZooKeeperPath("org.example.Test"));
-
-        // used for the recursive discovery
-        assertEquals(Utils.PATH_PREFIX, Utils.getZooKeeperPath(null));
-        assertEquals(Utils.PATH_PREFIX, Utils.getZooKeeperPath(""));
-    }
-
-    public void testGetStringPlusProperty() {
-        String[] out = Utils.getStringPlusProperty("MyString");
-        assertEquals(1, out.length);
-        assertEquals("MyString", out[0]);
-
-        out = Utils.getStringPlusProperty(new String[]{"MyString"});
-        assertEquals(1, out.length);
-        assertEquals("MyString", out[0]);
-
-        out = Utils.getStringPlusProperty(Arrays.asList("MyString"));
-        assertEquals(1, out.length);
-        assertEquals("MyString", out[0]);
-
-        out = Utils.getStringPlusProperty(Arrays.asList(1));
-        assertEquals(0, out.length);
-
-        out = Utils.getStringPlusProperty(new Object());
-        assertEquals(0, out.length);
-
-        out = Utils.getStringPlusProperty(null);
-        assertEquals(0, out.length);
-    }
-
-    public void testRemoveEmpty() {
-        String[] out = Utils.removeEmpty(new String[0]);
-        assertEquals(0, out.length);
-
-        out = Utils.removeEmpty(new String[]{null});
-        assertEquals(0, out.length);
-
-        out = Utils.removeEmpty(new String[]{""});
-        assertEquals(0, out.length);
-
-        out = Utils.removeEmpty(new String[]{"hi"});
-        assertEquals(1, out.length);
-        assertEquals("hi", out[0]);
-
-        out = Utils.removeEmpty(new String[]{"", "hi", null});
-        assertEquals(1, out.length);
-        assertEquals("hi", out[0]);
-
-        out = Utils.removeEmpty(new String[]{"hi", null, "", ""});
-        assertEquals(1, out.length);
-        assertEquals("hi", out[0]);
-
-        out = Utils.removeEmpty(new String[]{"", "hi", null, "", "", "bye", null});
-        assertEquals(2, out.length);
-        assertEquals("hi", out[0]);
-        assertEquals("bye", out[1]);
-    }
-
-    public void testGetScopes() {
-        IMocksControl c = EasyMock.createNiceControl();
-
-        String[] scopes = new String[]{"myScope=test", ""};
-
-        @SuppressWarnings("unchecked")
-        ServiceReference<EndpointListener> sref = c.createMock(ServiceReference.class);
-        EasyMock.expect(sref.getProperty(EasyMock.eq(EndpointListener.ENDPOINT_LISTENER_SCOPE)))
-            .andReturn(scopes).anyTimes();
-
-        c.replay();
-
-        String[] ret = Utils.getScopes(sref);
-
-        c.verify();
-        assertEquals(1, ret.length);
-        assertEquals(scopes[0], ret[0]);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/pom.xml
----------------------------------------------------------------------
diff --git a/discovery/distributed/pom.xml b/discovery/distributed/pom.xml
deleted file mode 100644
index e33a09f..0000000
--- a/discovery/distributed/pom.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version='1.0' encoding='UTF-8' ?>
-<!--
-  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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-    <groupId>org.apache.cxf.dosgi</groupId>
-    <artifactId>cxf-dosgi-ri-discovery-distributed-parent</artifactId>
-    <version>1.8-SNAPSHOT</version>
-    <packaging>pom</packaging>
-    <name>Distributed OSGI Distributed Discovery Parent</name>
-    <url>http://cxf.apache.org</url>
-
-    <parent>
-      <groupId>org.apache.cxf.dosgi</groupId>
-      <artifactId>cxf-dosgi-ri-parent</artifactId>
-      <version>1.8-SNAPSHOT</version>
-      <relativePath>../../parent/pom.xml</relativePath>
-    </parent>
-
-    <modules>
-      <module>zookeeper-server</module>
-      <module>zookeeper-server-config</module>
-      <module>cxf-discovery</module>
-    </modules>
-</project>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/zookeeper-server-config/pom.xml
----------------------------------------------------------------------
diff --git a/discovery/distributed/zookeeper-server-config/pom.xml b/discovery/distributed/zookeeper-server-config/pom.xml
deleted file mode 100644
index 83073dc..0000000
--- a/discovery/distributed/zookeeper-server-config/pom.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version='1.0' encoding='UTF-8' ?>
-<!--
-  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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-    <groupId>org.apache.cxf.dosgi</groupId>
-    <artifactId>cxf-dosgi-ri-discovery-distributed-zookeeper-server-config</artifactId>
-    <packaging>bundle</packaging>
-    <name>Distributed OSGI Distributed Discovery ZooKeeper Server Control Configuration Bundle</name>
-    <description>This bundle provides some default OSGi Configuration Admin data and is only useful for use in the OSGi CT suite</description>
-    <version>1.8-SNAPSHOT</version>
-
-    <parent>
-      <groupId>org.apache.cxf.dosgi</groupId>
-      <artifactId>cxf-dosgi-ri-parent</artifactId>
-      <version>1.8-SNAPSHOT</version>
-      <relativePath>../../../parent/pom.xml</relativePath>
-    </parent>
-
-    <properties>
-        <topDirectoryLocation>../../..</topDirectoryLocation>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <configuration>
-                    <instructions>
-                        <Bundle-Name>ZooKeeper server configuration bundle</Bundle-Name>
-                        <Bundle-Description>Configures the ZooKeeper server in an OSGi Framework</Bundle-Description>
-                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
-                        <Bundle-Activator>org.apache.cxf.dosgi.discovery.zookeeper.server.config.Activator</Bundle-Activator>
-                        <Import-Package>*</Import-Package>
-                        <Private-Package>org.apache.cxf.dosgi.discovery.zookeeper.server.config</Private-Package>
-                        <Export-Package />
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-</project>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/zookeeper-server-config/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/config/Activator.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/zookeeper-server-config/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/config/Activator.java b/discovery/distributed/zookeeper-server-config/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/config/Activator.java
deleted file mode 100644
index a00c7b0..0000000
--- a/discovery/distributed/zookeeper-server-config/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/config/Activator.java
+++ /dev/null
@@ -1,110 +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.discovery.zookeeper.server.config;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.service.cm.ManagedService;
-import org.osgi.util.tracker.ServiceTracker;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Activator implements BundleActivator {
-
-    private static final Logger LOG = LoggerFactory.getLogger(Activator.class);
-    private static final String ZOOKEEPER_PORT = "org.apache.cxf.dosgi.discovery.zookeeper.port";
-    private static final String PID = "org.apache.cxf.dosgi.discovery.zookeeper.server";
-    private ServiceTracker<ConfigurationAdmin, ConfigurationAdmin> st;
-
-    public void start(BundleContext context) throws Exception {
-        synchronized (Activator.class) {
-            // Only one thread gets to set the port number
-            if (System.getProperty(ZOOKEEPER_PORT) == null) {
-                String port = getFreePort();
-                System.setProperty(ZOOKEEPER_PORT, port);
-                LOG.info("Global ZooKeeper port: {}", port);
-            }
-        }
-
-        st = new ServiceTracker<ConfigurationAdmin, ConfigurationAdmin>(context, ConfigurationAdmin.class, null) {
-            @Override
-            public ConfigurationAdmin addingService(ServiceReference<ConfigurationAdmin> reference) {
-                ConfigurationAdmin service = super.addingService(reference);
-                try {
-                    Configuration cfg = service.getConfiguration(PID, null);
-                    Dictionary<String, Object> props = new Hashtable<String, Object>();
-                    String zp = System.getProperty(ZOOKEEPER_PORT);
-                    props.put("clientPort", zp);
-                    cfg.update(props);
-                    LOG.debug("Set ZooKeeper client port to {}", zp);
-                } catch (IOException e) {
-                    LOG.error("Failed to configure ZooKeeper server!", e);
-                }
-                return service;
-            }
-        };
-        st.open();
-
-        // The following section is done synchronously otherwise it doesn't happen in time for the CT
-        ServiceReference[] refs = context.getServiceReferences(ManagedService.class.getName(),
-                "(service.pid=org.apache.cxf.dosgi.discovery.zookeeper)");
-        if (refs == null || refs.length == 0) {
-            throw new RuntimeException("This bundle must be started after the bundle with the ZooKeeper "
-                                       + "Discovery Managed Service was started.");
-        }
-
-        Dictionary<String, Object> props = new Hashtable<String, Object>();
-        props.put("zookeeper.host", "127.0.0.1");
-        props.put("zookeeper.port", System.getProperty(ZOOKEEPER_PORT));
-
-        ManagedService ms = (ManagedService) context.getService(refs[0]);
-        try {
-            ms.updated(props);
-        } finally {
-            if (ms != null) {
-                context.ungetService(refs[0]);
-            }
-        }
-        LOG.debug("Passed the zookeeper.host property to the ZooKeeper Client managed service.");
-    }
-
-    private String getFreePort() {
-        try {
-            ServerSocket ss = new ServerSocket(0);
-            String port = "" + ss.getLocalPort();
-            ss.close();
-            return port;
-        } catch (IOException e) {
-            LOG.error("Failed to find a free port!", e);
-            return null;
-        }
-    }
-
-    public void stop(BundleContext context) throws Exception {
-        st.close();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/zookeeper-server/pom.xml
----------------------------------------------------------------------
diff --git a/discovery/distributed/zookeeper-server/pom.xml b/discovery/distributed/zookeeper-server/pom.xml
deleted file mode 100644
index 442210e..0000000
--- a/discovery/distributed/zookeeper-server/pom.xml
+++ /dev/null
@@ -1,114 +0,0 @@
-<?xml version='1.0' encoding='UTF-8' ?>
-<!--
-  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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>cxf-dosgi-ri-discovery-distributed-zookeeper-server</artifactId>
-    <packaging>bundle</packaging>
-    <name>CXF DOSGi ZooKeeper Server Control Bundle</name>
-    <description>Runs the ZooKeeper server</description>
-
-    <parent>
-      <groupId>org.apache.cxf.dosgi</groupId>
-      <artifactId>cxf-dosgi-ri-parent</artifactId>
-      <version>1.8-SNAPSHOT</version>
-      <relativePath>../../../parent/pom.xml</relativePath>
-    </parent>
-
-    <properties>
-        <topDirectoryLocation>../../..</topDirectoryLocation>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.zookeeper</groupId>
-            <artifactId>zookeeper</artifactId>
-            <version>${zookeeper.version}</version>
-            <exclusions>
-                <exclusion>
-                   <groupId>com.sun.jdmk</groupId>
-                   <artifactId>jmxtools</artifactId>
-                </exclusion>
-                <exclusion>
-                   <groupId>com.sun.jmx</groupId>
-                   <artifactId>jmxri</artifactId>
-                </exclusion>
-                <exclusion>
-                    <artifactId>slf4j-log4j12</artifactId>
-                    <groupId>org.slf4j</groupId>
-                </exclusion>
-                <exclusion>
-                    <artifactId>jline</artifactId>
-                    <groupId>jline</groupId>
-                </exclusion>
-                <exclusion>
-                    <artifactId>netty</artifactId>
-                    <groupId>io.netty</groupId>
-                </exclusion>
-                <exclusion>
-                    <artifactId>log4j</artifactId>
-                    <groupId>log4j</groupId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-
-        <!--  We need the newer log4j as the one from ZooKeeper has some ugly dependencies -->
-
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.easymock</groupId>
-            <artifactId>easymockclassextension</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <configuration>
-                    <instructions>
-                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
-                        <Bundle-Activator>org.apache.cxf.dosgi.discovery.zookeeper.server.Activator</Bundle-Activator>
-                        <Export-Package>
-                            !*
-                        </Export-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-</project>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/zookeeper-server/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/Activator.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/zookeeper-server/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/Activator.java b/discovery/distributed/zookeeper-server/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/Activator.java
deleted file mode 100644
index 6adf700..0000000
--- a/discovery/distributed/zookeeper-server/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/Activator.java
+++ /dev/null
@@ -1,44 +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.discovery.zookeeper.server;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-
-public class Activator implements BundleActivator {
-
-    ZookeeperStarter zkStarter;
-
-    public void start(BundleContext context) throws Exception {
-        zkStarter = new ZookeeperStarter(context);
-        Dictionary<String, Object> props = new Hashtable<String, Object>();
-        props.put(Constants.SERVICE_PID, "org.apache.cxf.dosgi.discovery.zookeeper.server");
-        context.registerService(org.osgi.service.cm.ManagedService.class.getName(), zkStarter, props);
-    }
-
-    public void stop(BundleContext context) throws Exception {
-        if (zkStarter != null) {
-            zkStarter.shutdown();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/zookeeper-server/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/Utils.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/zookeeper-server/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/Utils.java b/discovery/distributed/zookeeper-server/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/Utils.java
deleted file mode 100644
index fe3c663..0000000
--- a/discovery/distributed/zookeeper-server/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/Utils.java
+++ /dev/null
@@ -1,108 +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.discovery.zookeeper.server;
-
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * General purpose utility methods.
- */
-public final class Utils {
-
-    private Utils() {
-        // prevent instantiation
-    }
-
-    /**
-     * Remove entries whose values are empty from the given dictionary.
-     *
-     * @param dict a dictionary
-     */
-    public static void removeEmptyValues(Dictionary<String, ?> dict) {
-        List<String> keysToRemove = new ArrayList<String>();
-        Enumeration<String> keys = dict.keys();
-        while (keys.hasMoreElements()) {
-            String key = keys.nextElement();
-            Object value = dict.get(key);
-            if (value instanceof String && "".equals(value)) {
-                keysToRemove.add(key);
-            }
-        }
-        for (String key : keysToRemove) {
-            dict.remove(key);
-        }
-    }
-
-    /**
-     * Puts the given key-value pair in the given dictionary if the key does not
-     * already exist in it or if its existing value is null.
-     *
-     * @param dict a dictionary
-     * @param key the key
-     * @param value the default value to set
-     */
-    public static void setDefault(Dictionary<String, String> dict, String key, String value) {
-        if (dict.get(key) == null) {
-            dict.put(key, value);
-        }
-    }
-
-    /**
-     * Converts the given Dictionary to a Map.
-     *
-     * @param dict a dictionary
-     * @param <K> the key type
-     * @param <V> the value type
-     * @return the converted map, or an empty map if the given dictionary is null
-     */
-    public static <K, V> Map<K, V> toMap(Dictionary<K, V> dict) {
-        Map<K, V> map = new HashMap<K, V>();
-        if (dict != null) {
-            Enumeration<K> keys = dict.keys();
-            while (keys.hasMoreElements()) {
-                K key = keys.nextElement();
-                map.put(key, dict.get(key));
-            }
-        }
-        return map;
-    }
-
-    /**
-     * Converts a Dictionary into a Properties instance.
-     *
-     * @param dict a dictionary
-     * @param <K> the key type
-     * @param <V> the value type
-     * @return the properties
-     */
-    public static <K, V> Properties toProperties(Dictionary<K, V> dict) {
-        Properties props = new Properties();
-        for (Enumeration<K> e = dict.keys(); e.hasMoreElements();) {
-            K key = e.nextElement();
-            props.put(key, dict.get(key));
-        }
-        return props;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/zookeeper-server/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/ZookeeperStarter.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/zookeeper-server/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/ZookeeperStarter.java b/discovery/distributed/zookeeper-server/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/ZookeeperStarter.java
deleted file mode 100644
index bd5618f..0000000
--- a/discovery/distributed/zookeeper-server/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/ZookeeperStarter.java
+++ /dev/null
@@ -1,164 +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.discovery.zookeeper.server;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Dictionary;
-import java.util.Map;
-
-import org.apache.zookeeper.server.ServerConfig;
-import org.apache.zookeeper.server.ZooKeeperServerMain;
-import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
-import org.apache.zookeeper.server.quorum.QuorumPeerConfig.ConfigException;
-import org.apache.zookeeper.server.quorum.QuorumPeerMain;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.cm.ConfigurationException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ZookeeperStarter implements org.osgi.service.cm.ManagedService {
-
-    private static final Logger LOG = LoggerFactory.getLogger(ZookeeperStarter.class); //NOPMD - using log4j here
-
-    protected ZookeeperServer main;
-    private final BundleContext bundleContext;
-    private Thread zkMainThread;
-    private Map<String, ?> curConfiguration;
-
-    public ZookeeperStarter(BundleContext ctx) {
-        bundleContext = ctx;
-    }
-
-    synchronized void shutdown() {
-        if (main != null) {
-            LOG.info("Shutting down ZooKeeper server");
-            try {
-                main.shutdown();
-                if (zkMainThread != null) {
-                    zkMainThread.join();
-                }
-            } catch (Throwable e) {
-                LOG.error(e.getMessage(), e);
-            }
-            main = null;
-            zkMainThread = null;
-        }
-    }
-
-    private void setDefaults(Dictionary<String, String> dict) throws IOException {
-        Utils.removeEmptyValues(dict); // to avoid NumberFormatExceptions
-        Utils.setDefault(dict, "tickTime", "2000");
-        Utils.setDefault(dict, "initLimit", "10");
-        Utils.setDefault(dict, "syncLimit", "5");
-        Utils.setDefault(dict, "clientPort", "2181");
-        Utils.setDefault(dict, "dataDir", new File(bundleContext.getDataFile(""), "zkdata").getCanonicalPath());
-    }
-
-    @SuppressWarnings("unchecked")
-    public synchronized void updated(Dictionary<String, ?> dict) throws ConfigurationException {
-        LOG.debug("Received configuration update for Zookeeper Server: " + dict);
-        try {
-            if (dict != null) {
-                setDefaults((Dictionary<String, String>)dict);
-            }
-            Map<String, ?> configMap = Utils.toMap(dict);
-            if (!configMap.equals(curConfiguration)) { // only if something actually changed
-                shutdown();
-                curConfiguration = configMap;
-                // config is null if it doesn't exist, is being deleted or has not yet been loaded
-                // in which case we just stop running
-                if (dict != null) {
-                    startFromConfig(parseConfig(dict));
-                    LOG.info("Applied configuration update: " + dict);
-                }
-            }
-        } catch (Exception th) {
-            LOG.error("Problem applying configuration update: " + dict, th);
-        }
-    }
-
-    private QuorumPeerConfig parseConfig(Dictionary<String, ?> dict) throws IOException, ConfigException {
-        QuorumPeerConfig config = new QuorumPeerConfig();
-        config.parseProperties(Utils.toProperties(dict));
-        return config;
-    }
-
-    protected void startFromConfig(final QuorumPeerConfig config) {
-        int numServers = config.getServers().size();
-        main = numServers > 1 ? new MyQuorumPeerMain(config) : new MyZooKeeperServerMain(config);
-        zkMainThread = new Thread(new Runnable() {
-            public void run() {
-                try {
-                    main.startup();
-                } catch (Throwable e) {
-                    LOG.error("Problem running ZooKeeper server.", e);
-                }
-            }
-        });
-        zkMainThread.start();
-    }
-
-    interface ZookeeperServer {
-        void startup() throws IOException;
-        void shutdown();
-    }
-
-    static class MyQuorumPeerMain extends QuorumPeerMain implements ZookeeperServer {
-
-        private QuorumPeerConfig config;
-
-        MyQuorumPeerMain(QuorumPeerConfig config) {
-            this.config = config;
-        }
-
-        public void startup() throws IOException {
-            runFromConfig(config);
-        }
-
-        public void shutdown() {
-            if (null != quorumPeer) {
-                quorumPeer.shutdown();
-            }
-        }
-    }
-
-    static class MyZooKeeperServerMain extends ZooKeeperServerMain implements ZookeeperServer {
-
-        private QuorumPeerConfig config;
-
-        MyZooKeeperServerMain(QuorumPeerConfig config) {
-            this.config = config;
-        }
-
-        public void startup() throws IOException {
-            ServerConfig serverConfig = new ServerConfig();
-            serverConfig.readFrom(config);
-            runFromConfig(serverConfig);
-        }
-
-        public void shutdown() {
-            try {
-                super.shutdown();
-            } catch (Exception e) {
-                LOG.error("Error shutting down ZooKeeper", e);
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/zookeeper-server/src/main/resources/OSGI-INF/metatype/zookeeper.xml
----------------------------------------------------------------------
diff --git a/discovery/distributed/zookeeper-server/src/main/resources/OSGI-INF/metatype/zookeeper.xml b/discovery/distributed/zookeeper-server/src/main/resources/OSGI-INF/metatype/zookeeper.xml
deleted file mode 100644
index efd9403..0000000
--- a/discovery/distributed/zookeeper-server/src/main/resources/OSGI-INF/metatype/zookeeper.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<MetaData xmlns="http://www.osgi.org/xmlns/metadata/v1.0.0"
-	 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	 xsi:schemaLocation="
-		 http://www.osgi.org/xmlns/metadata/v1.0.0 http://www.osgi.org/xmlns/metatype/v1.1.0/metatype.xsd
-	 ">
-	 <OCD description="" name="Zookeeper server config" id="org.apache.cxf.dosgi.discovery.zookeeper.server">
-        <AD id="clientPort" required="false" type="String" default="2181" description=""/>
-	 	<AD id="tickTime" required="false" type="String" default="2000" description=""/>
-        <AD id="initLimit" required="false" type="String" default="10" description=""/>
-        <AD id="syncLimit" required="false" type="String" default="5" description=""/>
-	 </OCD>
-	 <Designate pid="org.apache.cxf.dosgi.discovery.zookeeper.server">
-	 	<Object ocdref="org.apache.cxf.dosgi.discovery.zookeeper.server"/>
-	 </Designate>
-</MetaData>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/zookeeper-server/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/server/ZookeeperStarterTest.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/zookeeper-server/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/server/ZookeeperStarterTest.java b/discovery/distributed/zookeeper-server/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/server/ZookeeperStarterTest.java
deleted file mode 100644
index 17ca117..0000000
--- a/discovery/distributed/zookeeper-server/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/server/ZookeeperStarterTest.java
+++ /dev/null
@@ -1,81 +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.discovery.zookeeper.server;
-
-import java.io.File;
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import junit.framework.TestCase;
-
-import org.apache.cxf.dosgi.discovery.zookeeper.server.ZookeeperStarter.MyZooKeeperServerMain;
-import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
-import org.easymock.classextension.EasyMock;
-import org.easymock.classextension.IMocksControl;
-import org.osgi.framework.BundleContext;
-
-import static org.easymock.EasyMock.expect;
-import static org.easymock.classextension.EasyMock.replay;
-import static org.easymock.classextension.EasyMock.verify;
-
-public class ZookeeperStarterTest extends TestCase {
-
-    public void testUpdateConfig() throws Exception {
-        final File tempDir = new File("target");
-        IMocksControl control = EasyMock.createControl();
-        BundleContext bc = control.createMock(BundleContext.class);
-        expect(bc.getDataFile("")).andReturn(tempDir);
-        final MyZooKeeperServerMain mockServer = control.createMock(MyZooKeeperServerMain.class);
-        control.replay();
-
-        ZookeeperStarter starter = new ZookeeperStarter(bc) {
-            @Override
-            protected void startFromConfig(QuorumPeerConfig config) {
-                assertEquals(1234, config.getClientPortAddress().getPort());
-                assertTrue(config.getDataDir().contains(tempDir + File.separator + "zkdata"));
-                assertEquals(2000, config.getTickTime());
-                assertEquals(10, config.getInitLimit());
-                assertEquals(5, config.getSyncLimit());
-                this.main = mockServer;
-            }
-        };
-        Dictionary<String, Object> props = new Hashtable<String, Object>();
-        props.put("clientPort", "1234");
-        starter.updated(props);
-        assertNotNull(starter.main);
-
-        control.verify();
-    }
-
-    public void testRemoveConfiguration() throws Exception {
-        BundleContext bc = EasyMock.createMock(BundleContext.class);
-        MyZooKeeperServerMain zkServer = EasyMock.createMock(MyZooKeeperServerMain.class);
-        zkServer.shutdown();
-        EasyMock.expectLastCall();
-
-        replay(zkServer);
-
-        ZookeeperStarter starter = new ZookeeperStarter(bc);
-        starter.main = zkServer;
-        starter.updated(null);
-
-        verify(zkServer);
-        assertNull("main should be null", starter.main);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/pom.xml
----------------------------------------------------------------------
diff --git a/discovery/local/pom.xml b/discovery/local/pom.xml
deleted file mode 100644
index 8fa118f..0000000
--- a/discovery/local/pom.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version='1.0' encoding='UTF-8' ?>
-<!--
-  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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>cxf-dosgi-ri-discovery-local</artifactId>
-    <packaging>bundle</packaging>
-    <name>CXF Local Discovery Service Bundle</name>
-    <description>The CXF Local Discovery Service Implementation</description>
-
-    <parent>
-        <groupId>org.apache.cxf.dosgi</groupId>
-        <artifactId>cxf-dosgi-ri-parent</artifactId>
-        <version>1.8-SNAPSHOT</version>
-        <relativePath>../../parent/pom.xml</relativePath>
-    </parent>
-
-    <properties>
-        <topDirectoryLocation>../..</topDirectoryLocation>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>xmlunit</groupId>
-            <artifactId>xmlunit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.easymock</groupId>
-            <artifactId>easymockclassextension</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.jvnet.jaxb2.maven2</groupId>
-                <artifactId>maven-jaxb2-plugin</artifactId>
-                <version>0.9.0</version>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>generate</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <configuration>
-                    <instructions>
-                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
-                        <Bundle-Activator>org.apache.cxf.dosgi.discovery.local.internal.Activator</Bundle-Activator>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-</project>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/internal/Activator.java
----------------------------------------------------------------------
diff --git a/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/internal/Activator.java b/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/internal/Activator.java
deleted file mode 100644
index 918f009..0000000
--- a/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/internal/Activator.java
+++ /dev/null
@@ -1,41 +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.discovery.local.internal;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Activator implements BundleActivator {
-
-    private static final Logger LOG = LoggerFactory.getLogger(Activator.class);
-
-    LocalDiscovery localDiscovery;
-
-    public synchronized void start(BundleContext context) {
-        localDiscovery = new LocalDiscovery(context);
-        LOG.info("Local D-OSGi service discovery started");
-    }
-
-    public synchronized void stop(BundleContext context) {
-        localDiscovery.shutDown();
-        LOG.info("Local D-OSGi service discovery stopped");
-    }
-}


[08/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

Posted by cs...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/test/resources/ed3.xml
----------------------------------------------------------------------
diff --git a/discovery/local/src/test/resources/ed3.xml b/discovery/local/src/test/resources/ed3.xml
deleted file mode 100644
index 7d4d681..0000000
--- a/discovery/local/src/test/resources/ed3.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-
-<endpoint-descriptions xmlns="http://www.osgi.org/xmlns/rsa/v1.0.0">
-  <endpoint-description>
-    <property name="objectClass">
-      <array>
-        <value>SomeService</value>
-      </array>
-    </property>
-    <property name="endpoint.id">http://somewhere:12345</property>
-    <property name="service.imported.configs" value="org.apache.cxf.ws"/>
-  </endpoint-description>
-</endpoint-descriptions>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/test/resources/ed4.xml
----------------------------------------------------------------------
diff --git a/discovery/local/src/test/resources/ed4.xml b/discovery/local/src/test/resources/ed4.xml
deleted file mode 100644
index cef5d18..0000000
--- a/discovery/local/src/test/resources/ed4.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-
-<endpoint-descriptions xmlns="http://www.osgi.org/xmlns/rsa/v1.0.0"
-  xmlns:other="http://www.acme.org/xmlns/other/v1.0.0">
-  <endpoint-description>
-    <property name="objectClass">
-      <array>
-        <value>org.example.ClassA</value>
-      </array>
-    </property>
-    <property name="endpoint.id">http://somewhere</property>
-    <property name="service.imported.configs" value="org.apache.cxf.ws"/>
-  </endpoint-description>
-
-  <endpoint-description>
-    <property name="objectClass">
-      <array>
-        <value>org.example.ClassB</value>
-      </array>
-    </property>
-    <property name="endpoint.id">http://somewhere:1</property>
-    <property name="service.imported.configs" value="org.apache.cxf.ws"/>
-  </endpoint-description>
-</endpoint-descriptions>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/test/resources/sd.xml
----------------------------------------------------------------------
diff --git a/discovery/local/src/test/resources/sd.xml b/discovery/local/src/test/resources/sd.xml
deleted file mode 100644
index c476116..0000000
--- a/discovery/local/src/test/resources/sd.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-  <!--
-    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.
-  -->
-<service-descriptions xmlns="http://www.osgi.org/xmlns/sd/v1.0.0">
-  <service-description>
-    <provide interface="org.apache.cxf.dosgi.samples.greeter.GreeterService" />
-    <property name="service.exported.interfaces">*</property>
-    <property name="service.exported.configs">org.apache.cxf.ws</property>
-    <property name="org.apache.cxf.ws.address">http://localhost:9090/greeter</property>
-  </service-description>
-</service-descriptions>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/test/resources/sd2.xml
----------------------------------------------------------------------
diff --git a/discovery/local/src/test/resources/sd2.xml b/discovery/local/src/test/resources/sd2.xml
deleted file mode 100644
index 5a156ea..0000000
--- a/discovery/local/src/test/resources/sd2.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-
-<service-descriptions xmlns="http://www.osgi.org/xmlns/sd/v1.0.0">
-  <service-description>
-    <provide interface="org.example.SomeService" />
-    <property name="service.intents">confidentiality</property>
-  </service-description>
-  <service-description>
-    <provide interface="SomeOtherService" />
-    <provide interface="WithSomeSecondInterface" />
-    <property name="blah">5</property>
-  </service-description>
-</service-descriptions>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/pom.xml
----------------------------------------------------------------------
diff --git a/discovery/pom.xml b/discovery/pom.xml
deleted file mode 100644
index f176e51..0000000
--- a/discovery/pom.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version='1.0' encoding='UTF-8' ?>
-<!--
-  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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-    <groupId>org.apache.cxf.dosgi</groupId>
-    <artifactId>cxf-dosgi-ri-discovery</artifactId>
-    <packaging>pom</packaging>
-    <name>Distributed OSGI Discovery Service Modules</name>
-    <version>1.8-SNAPSHOT</version>
-
-    <parent>
-      <groupId>org.apache.cxf.dosgi</groupId>
-      <artifactId>cxf-dosgi-ri-parent</artifactId>
-      <version>1.8-SNAPSHOT</version>
-      <relativePath>../parent/pom.xml</relativePath>
-    </parent>
-
-    <modules>
-      <module>local</module>
-      <module>distributed</module>
-    </modules>
-
-</project>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/distribution/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/distribution/features/src/main/resources/features.xml b/distribution/features/src/main/resources/features.xml
index d8f74d4..26932b1 100644
--- a/distribution/features/src/main/resources/features.xml
+++ b/distribution/features/src/main/resources/features.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0" name="cxf-dosgi-${project.version}">
     <repository>mvn:org.apache.cxf.karaf/apache-cxf/${cxf.version}/xml/features</repository>
+    <repository>mvn:org.apache.aries.rsa/rsa-features/1.8-SNAPSHOT/xml/features</repository>
 
 	<feature name="cxf-dosgi-base" description="base libs needed outside karaf" version="${project.version}" resolver="(obr)">
         <bundle start-level="8">mvn:org.ops4j.pax.logging/pax-logging-api/1.8.5</bundle>
@@ -15,20 +16,8 @@
         <bundle start-level="20">mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.cm/1.0.7</bundle>
     </feature>
 
-    <feature name="cxf-dosgi-core" version="${project.version}">
-        <bundle start-level="8">mvn:${project.groupId}/cxf-dosgi-ri-osgi-api/${project.version}</bundle>
-        <bundle>mvn:${project.groupId}/cxf-dosgi-ri-provider-api/${project.version}</bundle>
-        <bundle>mvn:${project.groupId}/cxf-dosgi-ri-rsa/${project.version}</bundle>
-        <bundle>mvn:${project.groupId}/cxf-dosgi-ri-topology-manager/${project.version}</bundle>
-    </feature>
-    
-    <feature name="cxf-dosgi-provider-tcp" version="${project.version}">
-        <feature>cxf-dosgi-core</feature>
-        <bundle>mvn:${project.groupId}/cxf-dosgi-ri-tcp/${project.version}</bundle>
-    </feature>
-    
     <feature name="cxf-dosgi-provider-cxf" version="${project.version}">
-        <feature>cxf-dosgi-core</feature>
+        <feature>aries-rsa-core</feature>
         <feature>cxf-specs</feature>
         <feature>cxf-jaxws</feature>
         <feature>cxf-jaxrs</feature>
@@ -37,23 +26,7 @@
         <feature>cxf-http</feature>
         <feature>http</feature>
         <bundle>mvn:${project.groupId}/cxf-dosgi-ri-dsw-cxf/${project.version}</bundle>
+        <bundle>mvn:${project.groupId}/cxf-dosgi-ri-dsw-cxf/${project.version}</bundle>
     </feature>
     
-
-    <feature name="cxf-dosgi-discovery-local" version="${project.version}">
-        <feature>cxf-dosgi-core</feature>
-        <bundle>mvn:${project.groupId}/cxf-dosgi-ri-discovery-local/${project.version}</bundle>
-    </feature>
-
-    <feature name="cxf-dosgi-discovery-distributed" version="${project.version}">
-        <feature>cxf-dosgi-core</feature>
-        <bundle>mvn:org.apache.zookeeper/zookeeper/${zookeeper.version}</bundle>
-        <bundle>mvn:${project.groupId}/cxf-dosgi-ri-discovery-local/${project.version}</bundle>
-        <bundle>mvn:${project.groupId}/cxf-dosgi-ri-discovery-distributed/${project.version}</bundle>
-    </feature>
-
-    <feature name="cxf-dosgi-zookeeper-server">
-        <bundle>mvn:org.apache.zookeeper/zookeeper/${zookeeper.version}</bundle>
-        <bundle>mvn:${project.groupId}/cxf-dosgi-ri-discovery-distributed-zookeeper-server/${project.version}</bundle>
-    </feature>
 </features>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/distribution/multi-bundle/pom.xml
----------------------------------------------------------------------
diff --git a/distribution/multi-bundle/pom.xml b/distribution/multi-bundle/pom.xml
index 1b835ff..3053200 100644
--- a/distribution/multi-bundle/pom.xml
+++ b/distribution/multi-bundle/pom.xml
@@ -66,10 +66,9 @@
               </descriptors>
               <features>
                 <feature>cxf-dosgi-base</feature>
-                <feature>cxf-dosgi-core</feature>
+                <feature>aries-rsa-discovery-zookeeper</feature>
+                <feature>aries-rsa-zookeeper-server</feature>
                 <feature>cxf-dosgi-provider-cxf</feature>
-                <feature>cxf-dosgi-discovery-distributed</feature>
-                <feature>cxf-dosgi-zookeeper-server</feature>
               </features>
               <repository>target/distribution_bundles</repository>
               <resolveDefinedRepositoriesRecursively>true</resolveDefinedRepositoriesRecursively>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-provider-api/pom.xml
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-provider-api/pom.xml b/dsw/cxf-dosgi-provider-api/pom.xml
deleted file mode 100644
index 0deab6c..0000000
--- a/dsw/cxf-dosgi-provider-api/pom.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.cxf.dosgi</groupId>
-        <artifactId>cxf-dosgi-ri-parent</artifactId>
-        <version>1.8-SNAPSHOT</version>
-        <relativePath>../../parent/pom.xml</relativePath>
-    </parent>
-    <artifactId>cxf-dosgi-ri-provider-api</artifactId>
-    <packaging>bundle</packaging>
-    <name>Distributed OSGI Distributed Software Modules</name>
-
-    <properties>
-        <topDirectoryLocation>../..</topDirectoryLocation>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.easymock</groupId>
-            <artifactId>easymockclassextension</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-jdk14</artifactId>
-            <version>1.7.14</version>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <extensions>true</extensions>
-                <configuration>
-                    <instructions>
-                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/DistributionProvider.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/DistributionProvider.java b/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/DistributionProvider.java
deleted file mode 100644
index d7c648b..0000000
--- a/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/DistributionProvider.java
+++ /dev/null
@@ -1,56 +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.service.remoteserviceadmin.EndpointDescription;
-
-@SuppressWarnings("rawtypes")
-public interface DistributionProvider {
-
-    String[] getSupportedTypes();
-
-    /**
-     * @param serviceO service instance to be exported
-     * @param serviceContext bundle context of the bundle exporting the sevice
-     * @param effectiveProperties combined properties of the service and additional properties from rsa
-     * @param exportedInterfaces name of the interface to be exported
-     * @return Endpoint that represents the service that is exposed to the outside world
-     */
-    Endpoint exportService(Object serviceO, 
-                           BundleContext serviceContext,
-                           Map<String, Object> effectiveProperties,
-                           Class[] exportedInterfaces);
-
-    /**
-     * @param cl classloader of the consumer bundle
-     * @param consumerContext bundle context of the consumer bundle
-     * @param interfaces interfaces of the service to proxy
-     * @param endpoint description of the remote endpoint
-     * @return service proxy to be given to the requesting bundle
-     * @throws IntentUnsatisfiedException
-     */
-    Object importEndpoint(ClassLoader cl,
-                          BundleContext consumerContext, 
-                          Class[] interfaces, 
-                          EndpointDescription endpoint)
-        throws IntentUnsatisfiedException;
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/Endpoint.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/Endpoint.java b/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/Endpoint.java
deleted file mode 100644
index f45b562..0000000
--- a/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/Endpoint.java
+++ /dev/null
@@ -1,27 +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 org.osgi.service.remoteserviceadmin.EndpointDescription;
-
-public interface Endpoint extends Closeable {
-    EndpointDescription description();
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/EndpointHelper.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/EndpointHelper.java b/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/EndpointHelper.java
deleted file mode 100644
index cdc66ad..0000000
--- a/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/EndpointHelper.java
+++ /dev/null
@@ -1,41 +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.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-public final class EndpointHelper {
-
-    private EndpointHelper() {
-    }
-
-    public static void addObjectClass(Map<String, Object> props, Class<?>[] interfaces) {
-        props.put(org.osgi.framework.Constants.OBJECTCLASS, getClassNames(interfaces));
-    }
-    
-    public static String[] getClassNames(Class<?>[] ifaces) {
-        List<String> ifaceNames = new ArrayList<String>();
-        for (Class<?> iface : ifaces) {
-            ifaceNames.add(iface.getName());
-        }
-        return ifaceNames.toArray(new String[]{});
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/ExportPolicy.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/ExportPolicy.java b/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/ExportPolicy.java
deleted file mode 100644
index 9e82c04..0000000
--- a/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/ExportPolicy.java
+++ /dev/null
@@ -1,46 +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.ServiceReference;
-
-
-/**
- * SPI for TopologyManagerExport. Allows to export services that are
- * not marked for export as well customize the way services are exported.
- * 
- * Use cases:
- * - Mandate SSL and basic authoriziation by adding the respective intents and configs
- * - Add logging interceptor as intent
- * - Remove exported interfaces to filter out services
- */
-public interface ExportPolicy {
-    /**
-     * Allows to supply additional properties for a service that are then
-     * given to RemoteServiceAdmin. The service will be exported
-     * if the original service or the additional properties contain the
-     * non empty property service.exported.interfaces. 
-     * 
-     * @param service to export
-     * @return additional properties for exported Service (must not be null)
-     */
-    Map<String, ?> additionalParameters(ServiceReference<?> sref);
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/IntentUnsatisfiedException.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/IntentUnsatisfiedException.java b/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/IntentUnsatisfiedException.java
deleted file mode 100644
index 4e27938..0000000
--- a/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/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.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/1425743f/dsw/cxf-dosgi-rsa/pom.xml
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-rsa/pom.xml b/dsw/cxf-dosgi-rsa/pom.xml
deleted file mode 100644
index b96828b..0000000
--- a/dsw/cxf-dosgi-rsa/pom.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.cxf.dosgi</groupId>
-        <artifactId>cxf-dosgi-ri-parent</artifactId>
-        <version>1.8-SNAPSHOT</version>
-        <relativePath>../../parent/pom.xml</relativePath>
-    </parent>
-    <artifactId>cxf-dosgi-ri-rsa</artifactId>
-    <packaging>bundle</packaging>
-    <name>CXF dOSGi Remote Service Admin Implementation</name>
-    <description>The CXF Remote Service Admin as described in the OSGi Remote Service Admin specification</description>
-
-    <properties>
-        <topDirectoryLocation>../..</topDirectoryLocation>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.cxf.dosgi</groupId>
-            <artifactId>cxf-dosgi-ri-provider-api</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.easymock</groupId>
-            <artifactId>easymockclassextension</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-jdk14</artifactId>
-            <version>1.7.14</version>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <extensions>true</extensions>
-                <configuration>
-                    <instructions>
-                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
-                        <Bundle-Activator>org.apache.cxf.dosgi.dsw.service.Activator</Bundle-Activator>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/Activator.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/Activator.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/Activator.java
deleted file mode 100644
index 4c4d7ad..0000000
--- a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/Activator.java
+++ /dev/null
@@ -1,37 +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.service;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class Activator implements BundleActivator {
-
-    private DistributionProviderTracker tracker;
-
-    public void start(BundleContext bundlecontext) throws Exception {
-        tracker = new DistributionProviderTracker(bundlecontext);
-        tracker.open();
-    }
-
-    public void stop(BundleContext context) throws Exception {
-        tracker.close();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactory.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactory.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactory.java
deleted file mode 100644
index 7c292db..0000000
--- a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactory.java
+++ /dev/null
@@ -1,110 +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.service;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-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.framework.wiring.BundleWiring;
-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);
-
-    private EndpointDescription endpoint;
-    private DistributionProvider handler;
-    private ImportRegistrationImpl importRegistration;
-
-    private boolean closeable;
-    private int serviceCounter;
-
-    public ClientServiceFactory(EndpointDescription endpoint,
-                                DistributionProvider handler, ImportRegistrationImpl ir) {
-        this.endpoint = endpoint;
-        this.handler = handler;
-        this.importRegistration = ir;
-    }
-
-    public Object getService(final Bundle requestingBundle, final ServiceRegistration sreg) {
-        List<String> interfaceNames = endpoint.getInterfaces();
-        final BundleContext consumerContext = requestingBundle.getBundleContext();
-        final ClassLoader consumerLoader = requestingBundle.adapt(BundleWiring.class).getClassLoader();
-        try {
-            LOG.debug("getService() from serviceFactory for {}", interfaceNames);
-            final List<Class<?>> interfaces = new ArrayList<Class<?>>();
-            for (String ifaceName : interfaceNames) {
-                interfaces.add(consumerLoader.loadClass(ifaceName));
-            }
-            Object proxy = AccessController.doPrivileged(new PrivilegedAction<Object>() {
-                public Object run() {
-                    Class<?>[] ifAr = interfaces.toArray(new Class[]{});
-                    return handler.importEndpoint(consumerLoader, consumerContext, ifAr, endpoint);
-                }
-            });
-
-            synchronized (this) {
-                serviceCounter++;
-            }
-            return proxy;
-        } catch (IntentUnsatisfiedException iue) {
-            LOG.info("Did not create proxy for {} because intent {} could not be satisfied",
-                    interfaceNames, iue.getIntent());
-        } catch (Exception e) {
-            LOG.warn("Problem creating a remote proxy for {}", interfaceNames, e);
-        }
-        return null;
-    }
-
-    public void ungetService(Bundle requestingBundle, ServiceRegistration sreg, Object serviceObject) {
-        String[] interfaces = (String[])sreg.getReference().getProperty(org.osgi.framework.Constants.OBJECTCLASS);
-        LOG.info("Releasing a client object, interfaces: {}", Arrays.toString(interfaces));
-
-        synchronized (this) {
-            serviceCounter--;
-            LOG.debug("Services still provided by this ServiceFactory: {}", serviceCounter);
-            closeIfUnused();
-        }
-    }
-
-    public void setCloseable(boolean closeable) {
-        synchronized (this) {
-            this.closeable = closeable;
-            closeIfUnused();
-        }
-    }
-
-    private synchronized void closeIfUnused() {
-        if (serviceCounter <= 0 && closeable) {
-            importRegistration.closeAll();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderTracker.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderTracker.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderTracker.java
deleted file mode 100644
index 675fcc6..0000000
--- a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderTracker.java
+++ /dev/null
@@ -1,73 +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.service;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
-import org.osgi.util.tracker.ServiceTracker;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("rawtypes")
-public class DistributionProviderTracker extends ServiceTracker<DistributionProvider, ServiceRegistration> {
-    private static final Logger LOG = LoggerFactory.getLogger(Activator.class);
-
-    public DistributionProviderTracker(BundleContext context) {
-        super(context, DistributionProvider.class, null);
-    }
-
-    @Override
-    public ServiceRegistration addingService(ServiceReference<DistributionProvider> reference) {
-        LOG.debug("RemoteServiceAdmin Implementation is starting up");
-        DistributionProvider provider = context.getService(reference);
-        BundleContext apiContext = getAPIContext();
-        RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(context, 
-                                                                    apiContext, 
-                                                                    provider);
-        RemoteServiceadminFactory rsaf = new RemoteServiceadminFactory(rsaCore);
-        Dictionary<String, Object> props = new Hashtable<String, Object>();
-        props.put("remote.intents.supported", reference.getProperty("remote.intents.supported"));
-        props.put("remote.configs.supported", reference.getProperty("remote.configs.supported"));
-        LOG.info("Registering RemoteServiceAdmin for provider " + provider.getClass().getName());
-        return context.registerService(RemoteServiceAdmin.class.getName(), rsaf, props);
-    }
-
-    protected BundleContext getAPIContext() {
-        Bundle apiBundle = FrameworkUtil.getBundle(DistributionProvider.class);
-        BundleContext apiContext = apiBundle.getBundleContext();
-        return apiContext;
-    }
-    
-    @Override
-    public void removedService(ServiceReference<DistributionProvider> reference,
-                               ServiceRegistration reg) {
-        LOG.debug("RemoteServiceAdmin Implementation is shutting down now");
-        reg.unregister();
-        super.removedService(reference, reg);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java
deleted file mode 100644
index 4868efa..0000000
--- a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java
+++ /dev/null
@@ -1,151 +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.service;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.Version;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventAdmin;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.RemoteServiceAdminEvent;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class EventAdminHelper {
-
-    private static final Logger LOG = LoggerFactory.getLogger(EventAdminHelper.class);
-
-    private BundleContext bctx;
-
-    public EventAdminHelper(BundleContext bc) {
-        bctx = bc;
-    }
-
-    private Event createEvent(Map<String, Object> props, String type) {
-        String topic = "org/osgi/service/remoteserviceadmin/" + type;
-        props.put("bundle", bctx.getBundle());
-        props.put("bundle.id", bctx.getBundle().getBundleId());
-        props.put("bundle.symbolicname", bctx.getBundle().getSymbolicName());
-
-        String version = (String)bctx.getBundle().getHeaders().get("Bundle-Version");
-        Version v = version != null ? new Version(version) : Version.emptyVersion;
-        setIfNotNull(props, "bundle.version", v);
-
-        return new Event(topic, props);
-    }
-
-    public void notifyEventAdmin(RemoteServiceAdminEvent rsae) {
-        String topic = remoteServiceAdminEventTypeToString(rsae.getType());
-
-        Map<String, Object> props = new HashMap<String, Object>();
-        setIfNotNull(props, "cause", rsae.getException());
-
-        EndpointDescription endpoint = null;
-        if (rsae.getImportReference() != null) {
-            endpoint = ((ImportRegistrationImpl)rsae.getImportReference()).getImportedEndpointAlways();
-            setIfNotNull(props, "import.registration", endpoint);
-        } else if (rsae.getExportReference() != null) {
-            endpoint = rsae.getExportReference().getExportedEndpoint();
-            setIfNotNull(props, "export.registration", endpoint);
-        }
-
-        if (endpoint != null) {
-            setIfNotNull(props, "service.remote.id", endpoint.getServiceId());
-            setIfNotNull(props, "service.remote.uuid", endpoint.getFrameworkUUID());
-            setIfNotNull(props, "service.remote.uri", endpoint.getId());
-            setIfNotNull(props, "objectClass", endpoint.getInterfaces().toArray());
-            setIfNotNull(props, "service.imported.configs", endpoint.getConfigurationTypes());
-        }
-        props.put("timestamp", System.currentTimeMillis());
-        props.put("event", rsae);
-
-        Event event = createEvent(props, topic);
-        notifyEventAdmins(topic, event);
-    }
-
-    @SuppressWarnings({
-     "rawtypes", "unchecked"
-    })
-    private void notifyEventAdmins(String topic, Event event) {
-        ServiceReference[] refs = null;
-        try {
-            refs = bctx.getAllServiceReferences(EventAdmin.class.getName(), null);
-        } catch (InvalidSyntaxException e) {
-            LOG.error("Failed to get EventAdmin: " + e.getMessage(), e);
-        }
-
-        if (refs != null) {
-            LOG.debug("Publishing event to {} EventAdmins; Topic:[{}]", refs.length, topic);
-            for (ServiceReference serviceReference : refs) {
-                EventAdmin eventAdmin = (EventAdmin) bctx.getService(serviceReference);
-                try {
-                    eventAdmin.postEvent(event);
-                } finally {
-                    if (eventAdmin != null) {
-                        bctx.ungetService(serviceReference);
-                    }
-                }
-            }
-        }
-    }
-
-    private <K, V> void setIfNotNull(Map<K, V> map, K key, V val) {
-        if (val != null) {
-            map.put(key, val);
-        }
-    }
-
-    private static String remoteServiceAdminEventTypeToString(int type) {
-        String retval;
-        switch (type) {
-        case RemoteServiceAdminEvent.EXPORT_ERROR:
-            retval = "EXPORT_ERROR";
-            break;
-        case RemoteServiceAdminEvent.EXPORT_REGISTRATION:
-            retval = "EXPORT_REGISTRATION";
-            break;
-        case RemoteServiceAdminEvent.EXPORT_UNREGISTRATION:
-            retval = "EXPORT_UNREGISTRATION";
-            break;
-        case RemoteServiceAdminEvent.EXPORT_WARNING:
-            retval = "EXPORT_WARNING";
-            break;
-        case RemoteServiceAdminEvent.IMPORT_ERROR:
-            retval = "IMPORT_ERROR";
-            break;
-        case RemoteServiceAdminEvent.IMPORT_REGISTRATION:
-            retval = "IMPORT_REGISTRATION";
-            break;
-        case RemoteServiceAdminEvent.IMPORT_UNREGISTRATION:
-            retval = "IMPORT_UNREGISTRATION";
-            break;
-        case RemoteServiceAdminEvent.IMPORT_WARNING:
-            retval = "IMPORT_WARNING";
-            break;
-        default:
-            retval = "UNKNOWN_EVENT";
-        }
-        return retval;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/EventProducer.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/EventProducer.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/EventProducer.java
deleted file mode 100644
index 26a46ab..0000000
--- a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/EventProducer.java
+++ /dev/null
@@ -1,114 +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.service;
-
-import java.util.List;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.ExportRegistration;
-import org.osgi.service.remoteserviceadmin.ImportRegistration;
-import org.osgi.service.remoteserviceadmin.RemoteServiceAdminEvent;
-import org.osgi.service.remoteserviceadmin.RemoteServiceAdminListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class EventProducer {
-
-    private static final Logger LOG = LoggerFactory.getLogger(EventProducer.class);
-    private final BundleContext bctx;
-    private final EventAdminHelper eaHelper;
-
-    public EventProducer(BundleContext bc) {
-        bctx = bc;
-        eaHelper = new EventAdminHelper(bctx);
-    }
-
-    protected void publishNotification(List<ExportRegistration> erl) {
-        for (ExportRegistration exportRegistration : erl) {
-            publishNotification(exportRegistration);
-        }
-    }
-
-    protected void publishNotification(ExportRegistration er) {
-        int type = er.getException() == null
-            ? RemoteServiceAdminEvent.EXPORT_REGISTRATION
-            : RemoteServiceAdminEvent.EXPORT_ERROR;
-        notify(type, null, er);
-    }
-
-    protected void publishNotification(ImportRegistration ir) {
-        int type = ir.getException() == null
-            ? RemoteServiceAdminEvent.IMPORT_REGISTRATION
-            : RemoteServiceAdminEvent.IMPORT_ERROR;
-        notify(type, ir, null);
-    }
-
-    public void notifyRemoval(ExportRegistration er) {
-        notify(RemoteServiceAdminEvent.EXPORT_UNREGISTRATION, null, er);
-    }
-
-    public void notifyRemoval(ImportRegistration ir) {
-        notify(RemoteServiceAdminEvent.IMPORT_UNREGISTRATION, ir, null);
-    }
-
-    // only one of ir or er must be set, and the other must be null
-    private void notify(int type, ImportRegistration ir, ExportRegistration er) {
-        try {
-            RemoteServiceAdminEvent event = ir != null
-                ? new RemoteServiceAdminEvent(type, bctx.getBundle(), ir.getImportReference(), ir.getException())
-                : new RemoteServiceAdminEvent(type, bctx.getBundle(), er.getExportReference(), er.getException());
-            notifyListeners(event);
-            eaHelper.notifyEventAdmin(event);
-        } catch (IllegalStateException ise) {
-            LOG.debug("can't send notifications since bundle context is no longer valid");
-        }
-    }
-
-    @SuppressWarnings({
-     "rawtypes", "unchecked"
-    })
-    private void notifyListeners(RemoteServiceAdminEvent rsae) {
-        try {
-            ServiceReference[] listenerRefs = bctx.getServiceReferences(
-                    RemoteServiceAdminListener.class.getName(), null);
-            if (listenerRefs != null) {
-                for (ServiceReference sref : listenerRefs) {
-                    RemoteServiceAdminListener rsal = (RemoteServiceAdminListener)bctx.getService(sref);
-                    if (rsal != null) {
-                        try {
-                            Bundle bundle = sref.getBundle();
-                            if (bundle != null) {
-                                LOG.debug("notify RemoteServiceAdminListener {} of bundle {}",
-                                        rsal, bundle.getSymbolicName());
-                                rsal.remoteAdminEvent(rsae);
-                            }
-                        } finally {
-                            bctx.ungetService(sref);
-                        }
-                    }
-                }
-            }
-        } catch (InvalidSyntaxException e) {
-            LOG.error(e.getMessage(), e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportReferenceImpl.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportReferenceImpl.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportReferenceImpl.java
deleted file mode 100644
index 497aa9c..0000000
--- a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportReferenceImpl.java
+++ /dev/null
@@ -1,77 +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.service;
-
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.ExportReference;
-
-@SuppressWarnings("rawtypes")
-public class ExportReferenceImpl implements ExportReference {
-
-    private ServiceReference serviceReference;
-    private EndpointDescription endpoint;
-
-    public ExportReferenceImpl(ServiceReference serviceReference, EndpointDescription endpoint) {
-        this.serviceReference = serviceReference;
-        this.endpoint = endpoint;
-    }
-
-    public ExportReferenceImpl(ExportReference exportReference) {
-        this(exportReference.getExportedService(), exportReference.getExportedEndpoint());
-    }
-
-    public EndpointDescription getExportedEndpoint() {
-        return endpoint;
-    }
-
-    public ServiceReference getExportedService() {
-        return serviceReference;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + (endpoint == null ? 0 : endpoint.hashCode());
-        result = prime * result + (serviceReference == null ? 0 : serviceReference.hashCode());
-        return result;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null || getClass() != obj.getClass()) {
-            return false;
-        }
-        ExportReferenceImpl other = (ExportReferenceImpl) obj;
-        boolean ed = endpoint == null ? other.endpoint == null
-                : endpoint.equals(other.endpoint);
-        boolean sr = serviceReference == null ? other.serviceReference == null
-                : serviceReference.equals(other.serviceReference);
-        return ed && sr;
-    }
-
-    synchronized void close() {
-        this.endpoint = null;
-        this.serviceReference = null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java
deleted file mode 100644
index d80bd40..0000000
--- a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java
+++ /dev/null
@@ -1,152 +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.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.dosgi.dsw.api.Endpoint;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.ExportReference;
-import org.osgi.service.remoteserviceadmin.ExportRegistration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("rawtypes")
-public class ExportRegistrationImpl implements ExportRegistration {
-
-    private static final Logger LOG = LoggerFactory.getLogger(ExportRegistrationImpl.class);
-
-    private final RemoteServiceAdminCore rsaCore;
-    private final ExportReferenceImpl exportReference;
-    private final Closeable server;
-    private final Throwable exception;
-
-    private final ExportRegistrationImpl parent;
-    private int instanceCount;
-    private volatile boolean closed;
-
-    private ExportRegistrationImpl(ExportRegistrationImpl parent, RemoteServiceAdminCore rsaCore,
-            ExportReferenceImpl exportReference, Closeable server, Throwable exception) {
-        this.parent = parent != null ? parent.parent : this; // a parent points to itself
-        this.parent.addInstance();
-        this.rsaCore = rsaCore;
-        this.exportReference = exportReference;
-        this.server = server;
-        this.exception = exception;
-    }
-
-    // create a clone of the provided ExportRegistrationImpl that is linked to it
-    public ExportRegistrationImpl(ExportRegistrationImpl parent) {
-        this(parent, parent.rsaCore, new ExportReferenceImpl(parent.exportReference),
-            parent.server, parent.exception);
-    }
-
-    // create a new (parent) instance which was exported successfully with the given server
-    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(RemoteServiceAdminCore rsaCore, Throwable exception) {
-        this(null, rsaCore, null, null, exception);
-    }
-
-    private void ensureParent() {
-        if (parent != this) {
-            throw new IllegalStateException("this method may only be called on the parent");
-        }
-    }
-
-    public ExportReference getExportReference() {
-        if (exportReference == null) {
-            throw new IllegalStateException(getException());
-        }
-        return closed ? null : exportReference;
-    }
-
-    public Throwable getException() {
-        return closed ? null : exception;
-    }
-
-    public final void close() {
-        synchronized (this) {
-            if (closed) {
-                return;
-            }
-            closed = true;
-        }
-
-        rsaCore.removeExportRegistration(this);
-        exportReference.close();
-        parent.removeInstance();
-    }
-
-    private void addInstance() {
-        ensureParent();
-        synchronized (this) {
-            instanceCount++;
-        }
-    }
-
-    private void removeInstance() {
-        ensureParent();
-        synchronized (this) {
-            instanceCount--;
-            if (instanceCount <= 0) {
-                LOG.debug("really closing ExportRegistration now!");
-
-                if (server != null) {
-                    try {
-                        server.close();
-                    } catch (IOException e) {
-                        LOG.warn("Error closing ExportRegistration", e);
-                    }
-                }
-            }
-        }
-    }
-
-    @Override
-    public String toString() {
-        if (closed) {
-            return "ExportRegistration closed";
-        }
-        EndpointDescription endpoint = getExportReference().getExportedEndpoint();
-        ServiceReference serviceReference = getExportReference().getExportedService();
-        String r = "EndpointDescription for ServiceReference " + serviceReference;
-
-        r += "\n*** EndpointDescription: ****\n";
-        if (endpoint == null) {
-            r += "---> NULL <---- \n";
-        } else {
-            Set<Map.Entry<String, Object>> props = endpoint.getProperties().entrySet();
-            for (Map.Entry<String, Object> entry : props) {
-                Object value = entry.getValue();
-                r += entry.getKey() + " => "
-                    + (value instanceof Object[] ? Arrays.toString((Object[]) value) : value) + "\n";
-            }
-        }
-        return r;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImpl.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImpl.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImpl.java
deleted file mode 100644
index 2b896db..0000000
--- a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImpl.java
+++ /dev/null
@@ -1,230 +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.service;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.ImportReference;
-import org.osgi.service.remoteserviceadmin.ImportRegistration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("rawtypes")
-public class ImportRegistrationImpl implements ImportRegistration, ImportReference {
-
-    private static final Logger LOG = LoggerFactory.getLogger(ImportRegistrationImpl.class);
-
-    private volatile Throwable exception;
-    private volatile ServiceRegistration importedService; // used only in parent
-    private EndpointDescription endpoint;
-    private volatile ClientServiceFactory clientServiceFactory;
-    private RemoteServiceAdminCore rsaCore;
-    private boolean closed;
-    private boolean detached; // used only in parent
-
-    private ImportRegistrationImpl parent;
-    private List<ImportRegistrationImpl> children; // used only in parent
-
-    public ImportRegistrationImpl(Throwable ex) {
-        exception = ex;
-        initParent();
-    }
-
-    public ImportRegistrationImpl(EndpointDescription endpoint, RemoteServiceAdminCore rsac) {
-        this.endpoint = endpoint;
-        this.rsaCore = rsac;
-        initParent();
-    }
-
-    /**
-     * Creates a clone of the given parent instance.
-     */
-    public ImportRegistrationImpl(ImportRegistrationImpl ir) {
-        // we always want a link to the parent...
-        parent = ir.getParent();
-        exception = parent.getException();
-        endpoint = parent.getImportedEndpointDescription();
-        clientServiceFactory = parent.clientServiceFactory;
-        rsaCore = parent.rsaCore;
-
-        parent.instanceAdded(this);
-    }
-
-    private void initParent() {
-        parent = this;
-        children = new ArrayList<ImportRegistrationImpl>(1);
-    }
-
-    private void ensureParent() {
-        if (parent != this) {
-            throw new IllegalStateException("this method may only be called on the parent");
-        }
-    }
-
-    /**
-     * Called on parent when a child is added.
-     *
-     * @param iri the child
-     */
-    private synchronized void instanceAdded(ImportRegistrationImpl iri) {
-        ensureParent();
-        children.add(iri);
-    }
-
-    /**
-     * Called on parent when a child is closed.
-     *
-     * @param iri the child
-     */
-    private void instanceClosed(ImportRegistrationImpl iri) {
-        ensureParent();
-        synchronized (this) {
-            children.remove(iri);
-            if (!children.isEmpty() || detached || !closed) {
-                return;
-            }
-            detached = true;
-        }
-
-        LOG.debug("really closing ImportRegistration now");
-
-        if (importedService != null) {
-            try {
-                importedService.unregister();
-            } catch (IllegalStateException ise) {
-                LOG.debug("imported service is already unregistered");
-            }
-            importedService = null;
-        }
-        if (clientServiceFactory != null) {
-            clientServiceFactory.setCloseable(true);
-        }
-    }
-
-    public void close() {
-        LOG.debug("close() called");
-
-        synchronized (this) {
-            if (isInvalid()) {
-                return;
-            }
-            closed = true;
-        }
-        rsaCore.removeImportRegistration(this);
-        parent.instanceClosed(this);
-    }
-
-    /**
-     * Closes all ImportRegistrations which share the same parent as this one.
-     */
-    public void closeAll() {
-        if (this == parent) {
-            LOG.info("closing down all child ImportRegistrations");
-
-            // we must iterate over a copy of children since close() removes the child
-            // from the list (which would cause a ConcurrentModificationException)
-            for (ImportRegistrationImpl ir : copyChildren()) {
-                ir.close();
-            }
-            this.close();
-        } else {
-            parent.closeAll();
-        }
-    }
-
-    private List<ImportRegistrationImpl> copyChildren() {
-        synchronized (this) {
-            return new ArrayList<ImportRegistrationImpl>(children);
-        }
-    }
-
-    public EndpointDescription getImportedEndpointDescription() {
-        return isInvalid() ? null : endpoint;
-    }
-
-    @Override
-    public EndpointDescription getImportedEndpoint() {
-        return getImportedEndpointDescription();
-    }
-
-    @Override
-    public ServiceReference getImportedService() {
-        return isInvalid() || parent.importedService == null ? null : parent.importedService.getReference();
-    }
-
-    @Override
-    public ImportReference getImportReference() {
-        return this;
-    }
-
-    @Override
-    public Throwable getException() {
-        return exception;
-    }
-
-    public void setException(Throwable ex) {
-        exception = ex;
-    }
-
-    private synchronized boolean isInvalid() {
-        return exception != null || closed;
-    }
-
-    /**
-     * Sets the {@link ServiceRegistration} representing the locally
-     * registered {@link ClientServiceFactory} service which provides
-     * proxies to the remote imported service. It is set only on the parent.
-     *
-     * @param sreg the ServiceRegistration
-     */
-    public void setImportedServiceRegistration(ServiceRegistration sreg) {
-        ensureParent();
-        importedService = sreg;
-    }
-
-    /**
-     * Sets the {@link ClientServiceFactory} which is the implementation
-     * of the locally registered service which provides proxies to the
-     * remote imported service. It is set only on the parent.
-     *
-     * @param csf the ClientServiceFactory
-     */
-    public void setClientServiceFactory(ClientServiceFactory csf) {
-        ensureParent();
-        clientServiceFactory = csf;
-    }
-
-    public ImportRegistrationImpl getParent() {
-        return parent;
-    }
-
-    /**
-     * Returns the imported endpoint even if this
-     * instance is closed or has an exception.
-     *
-     * @return the imported endpoint
-     */
-    public EndpointDescription getImportedEndpointAlways() {
-        return endpoint;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/PackageUtil.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/PackageUtil.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/PackageUtil.java
deleted file mode 100644
index effcef1..0000000
--- a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/PackageUtil.java
+++ /dev/null
@@ -1,85 +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.service;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.packageadmin.ExportedPackage;
-import org.osgi.service.packageadmin.PackageAdmin;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("deprecation")
-public final class PackageUtil {
-
-    public static final Logger LOG = LoggerFactory.getLogger(PackageUtil.class);
-
-    private PackageUtil() {
-    }
-
-    /**
-     * Tries to retrieve the version of iClass via the PackageAdmin.
-     *
-     * @param iClass tThe interface for which the version should be found
-     * @param bc any valid BundleContext
-     * @return the version of the interface or "0.0.0" if no version information could be found or an error
-     *         occurred during the retrieval
-     */
-    public static String getVersion(Class<?> iClass, BundleContext bc) {
-        ServiceReference<PackageAdmin> paRef = bc.getServiceReference(PackageAdmin.class);
-        if (paRef != null) {
-            PackageAdmin pa = bc.getService(paRef);
-            try {
-                Bundle b = pa.getBundle(iClass);
-                if (b == null) {
-                    LOG.info("Unable to find interface version for interface " + iClass.getName()
-                            + ". Falling back to 0.0.0");
-                    return "0.0.0";
-                }
-                LOG.debug("Interface source bundle: {}", b.getSymbolicName());
-
-                ExportedPackage[] ep = pa.getExportedPackages(b);
-                LOG.debug("Exported Packages of the source bundle: {}", (Object)ep);
-
-                String pack = iClass.getPackage().getName();
-                LOG.debug("Looking for Package: {}", pack);
-                if (ep != null) {
-                    for (ExportedPackage p : ep) {
-                        if (p != null
-                            && pack.equals(p.getName())) {
-                            LOG.debug("found package -> Version: {}", p.getVersion());
-                            return p.getVersion().toString();
-                        }
-                    }
-                }
-            } finally {
-                if (pa != null) {
-                    bc.ungetService(paRef);
-                }
-            }
-        } else {
-            LOG.error("Was unable to obtain the package admin service -> can't resolve interface versions");
-        }
-
-        LOG.info("Unable to find interface version for interface " + iClass.getName()
-                 + ". Falling back to 0.0.0");
-        return "0.0.0";
-    }
-}


[09/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

Posted by cs...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/internal/LocalDiscovery.java
----------------------------------------------------------------------
diff --git a/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/internal/LocalDiscovery.java b/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/internal/LocalDiscovery.java
deleted file mode 100644
index 2761cf3..0000000
--- a/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/internal/LocalDiscovery.java
+++ /dev/null
@@ -1,242 +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.discovery.local.internal;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.cxf.dosgi.discovery.local.util.Utils;
-import org.apache.cxf.dosgi.endpointdesc.EndpointDescriptionBundleParser;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-import org.osgi.util.tracker.ServiceTracker;
-
-public class LocalDiscovery implements BundleListener {
-
-    // this is effectively a set which allows for multiple service descriptions with the
-    // same interface name but different properties and takes care of itself with respect to concurrency
-    ConcurrentHashMap<EndpointDescription, Bundle> endpointDescriptions =
-        new ConcurrentHashMap<EndpointDescription, Bundle>();
-    Map<EndpointListener, Collection<String>> listenerToFilters =
-        new HashMap<EndpointListener, Collection<String>>();
-    Map<String, Collection<EndpointListener>> filterToListeners =
-        new HashMap<String, Collection<EndpointListener>>();
-    final BundleContext bundleContext;
-
-    EndpointDescriptionBundleParser bundleParser;
-    ServiceTracker<EndpointListener, EndpointListener> listenerTracker;
-
-    public LocalDiscovery(BundleContext bc) {
-        this.bundleParser = new EndpointDescriptionBundleParser();
-        bundleContext = bc;
-
-        listenerTracker = new ServiceTracker<EndpointListener, EndpointListener>(bundleContext, 
-            EndpointListener.class, null) {
-
-            @Override
-            public EndpointListener addingService(ServiceReference<EndpointListener> reference) {
-                EndpointListener service = super.addingService(reference);
-                addListener(reference, service);
-                return service;
-            }
-
-            @Override
-            public void modifiedService(ServiceReference<EndpointListener> reference, EndpointListener service) {
-                super.modifiedService(reference, service);
-                removeListener(service);
-
-                // This may cause duplicate registrations of remote services,
-                // but that's fine and should be filtered out on another level.
-                // See Remote Service Admin spec section 122.6.3
-                addListener(reference, service);
-            }
-
-            @Override
-            public void removedService(ServiceReference<EndpointListener> reference, EndpointListener service) {
-                super.removedService(reference, service);
-                removeListener(service);
-            }
-        };
-        listenerTracker.open();
-
-        bundleContext.addBundleListener(this);
-        processExistingBundles();
-    }
-
-    private void processExistingBundles() {
-        Bundle[] bundles = bundleContext.getBundles();
-        if (bundles == null) {
-            return;
-        }
-
-        for (Bundle b : bundles) {
-            if (b.getState() == Bundle.ACTIVE) {
-                findDeclaredRemoteServices(b);
-            }
-        }
-    }
-
-    void addListener(ServiceReference<EndpointListener> endpointListenerRef, EndpointListener endpointListener) {
-        List<String> filters = Utils.getStringPlusProperty(endpointListenerRef,
-                EndpointListener.ENDPOINT_LISTENER_SCOPE);
-        if (filters.isEmpty()) {
-            return;
-        }
-
-        synchronized (listenerToFilters) {
-            listenerToFilters.put(endpointListener, filters);
-            for (String filter : filters) {
-                Collection<EndpointListener> listeners = filterToListeners.get(filter);
-                if (listeners == null) {
-                    listeners = new ArrayList<EndpointListener>();
-                    filterToListeners.put(filter, listeners);
-                }
-                listeners.add(endpointListener);
-            }
-        }
-
-        triggerCallbacks(filters, endpointListener);
-    }
-
-    /**
-     * If the tracker was removed or the scope was changed this doesn't require
-     * additional callbacks on the tracker. Its the responsibility of the tracker
-     * itself to clean up any orphans. See Remote Service Admin spec 122.6.3
-     * @param endpointListener
-     */
-    void removeListener(EndpointListener endpointListener) {
-        synchronized (listenerToFilters) {
-            Collection<String> filters = listenerToFilters.remove(endpointListener);
-            if (filters == null) {
-                return;
-            }
-
-            for (String filter : filters) {
-                Collection<EndpointListener> listeners = filterToListeners.get(filter);
-                if (listeners != null) {
-                    listeners.remove(endpointListener);
-                    if (listeners.isEmpty()) {
-                        filterToListeners.remove(filter);
-                    }
-                }
-            }
-        }
-    }
-
-    private Map<String, Collection<EndpointListener>> getMatchingListeners(EndpointDescription endpoint) {
-        // return a copy of matched filters/listeners so that caller doesn't need to hold locks while triggering events
-        Map<String, Collection<EndpointListener>> matched = new HashMap<String, Collection<EndpointListener>>();
-        synchronized (listenerToFilters) {
-            for (Entry<String, Collection<EndpointListener>> entry : filterToListeners.entrySet()) {
-                String filter = entry.getKey();
-                if (Utils.matchFilter(bundleContext, filter, endpoint)) {
-                    matched.put(filter, new ArrayList<EndpointListener>(entry.getValue()));
-                }
-            }
-        }
-        return matched;
-    }
-
-    public void shutDown() {
-        bundleContext.removeBundleListener(this);
-        listenerTracker.close();
-    }
-
-    // BundleListener method
-    public void bundleChanged(BundleEvent be) {
-        switch (be.getType()) {
-        case BundleEvent.STARTED:
-            findDeclaredRemoteServices(be.getBundle());
-            break;
-        case BundleEvent.STOPPED:
-            removeServicesDeclaredInBundle(be.getBundle());
-            break;
-        default:
-        }
-    }
-
-    private void findDeclaredRemoteServices(Bundle bundle) {
-        List<EndpointDescription> endpoints = bundleParser.getAllEndpointDescriptions(bundle);
-        for (EndpointDescription endpoint : endpoints) {
-            endpointDescriptions.put(endpoint, bundle);
-            addedEndpointDescription(endpoint);
-        }
-    }
-
-    private void removeServicesDeclaredInBundle(Bundle bundle) {
-        for (Iterator<Entry<EndpointDescription, Bundle>> i = endpointDescriptions.entrySet().iterator();
-            i.hasNext();) {
-            Entry<EndpointDescription, Bundle> entry = i.next();
-            if (bundle.equals(entry.getValue())) {
-                removedEndpointDescription(entry.getKey());
-                i.remove();
-            }
-        }
-    }
-
-    private void addedEndpointDescription(EndpointDescription endpoint) {
-        triggerCallbacks(endpoint, true);
-    }
-
-    private void removedEndpointDescription(EndpointDescription endpoint) {
-        triggerCallbacks(endpoint, false);
-    }
-
-    private void triggerCallbacks(EndpointDescription endpoint, boolean added) {
-        for (Map.Entry<String, Collection<EndpointListener>> entry : getMatchingListeners(endpoint).entrySet()) {
-            String filter = entry.getKey();
-            for (EndpointListener listener : entry.getValue()) {
-                triggerCallbacks(listener, filter, endpoint, added);
-            }
-        }
-    }
-
-    private void triggerCallbacks(EndpointListener endpointListener, String filter,
-            EndpointDescription endpoint, boolean added) {
-        if (!Utils.matchFilter(bundleContext, filter, endpoint)) {
-            return;
-        }
-
-        if (added) {
-            endpointListener.endpointAdded(endpoint, filter);
-        } else {
-            endpointListener.endpointRemoved(endpoint, filter);
-        }
-    }
-
-    private void triggerCallbacks(Collection<String> filters, EndpointListener endpointListener) {
-        for (String filter : filters) {
-            for (EndpointDescription endpoint : endpointDescriptions.keySet()) {
-                triggerCallbacks(endpointListener, filter, endpoint, true);
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/util/Utils.java
----------------------------------------------------------------------
diff --git a/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/util/Utils.java b/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/util/Utils.java
deleted file mode 100644
index 990ae9f..0000000
--- a/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/util/Utils.java
+++ /dev/null
@@ -1,125 +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.discovery.local.util;
-
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.regex.Pattern;
-
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public final class Utils {
-
-    private static final Logger LOG = LoggerFactory.getLogger(Utils.class);
-
-    private Utils() {
-        // prevent instantiation
-    }
-
-    public static List<String> getStringPlusProperty(ServiceReference<?> sr, String key) {
-        Object value = sr.getProperty(key);
-        if (value == null) {
-            return Collections.emptyList();
-        }
-
-        if (value instanceof String) {
-            return Collections.singletonList((String) value);
-        }
-
-        if (value instanceof String[]) {
-            String[] values = (String[]) value;
-            List<String> result = new ArrayList<String>(values.length);
-            for (String v : values) {
-                if (v != null) {
-                    result.add(v);
-                }
-            }
-            return Collections.unmodifiableList(result);
-        }
-
-        if (value instanceof Collection<?>) {
-            Collection<?> values = (Collection<?>) value;
-            List<String> result = new ArrayList<String>(values.size());
-            for (Object v : values) {
-                if (v instanceof String) {
-                    result.add((String) v);
-                }
-            }
-            return Collections.unmodifiableList(result);
-        }
-
-        return Collections.emptyList();
-    }
-
-    public static boolean matchFilter(BundleContext bctx, String filter, EndpointDescription endpoint) {
-        if (filter == null) {
-            return false;
-        }
-
-        try {
-            Filter f = bctx.createFilter(filter);
-            Dictionary<String, Object> dict = new Hashtable<String, Object>(endpoint.getProperties());
-            return f.match(dict);
-        } catch (Exception e) {
-            LOG.error("Problem creating a Filter from " + filter, e);
-            return false;
-        }
-    }
-    
-    public static String normXML(String s) {
-        String s2 = stripComment(s);
-        String s3 = stripProlog(s2);
-        try {
-            TransformerFactory transFactory = TransformerFactory.newInstance();
-            Transformer transformer = transFactory.newTransformer();
-            StringWriter buffer = new StringWriter();
-            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
-            transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
-            transformer.transform(new StreamSource(new StringReader(s3)), new StreamResult(buffer));
-            return buffer.toString();
-        } catch (Exception e) {
-            return "";
-        }
-    }
-
-    private static String stripComment(String s) {
-        return Pattern.compile("<!--(.*?)-->", Pattern.DOTALL).matcher(s).replaceAll("");
-    }
-
-    private static String stripProlog(String s) {
-        return s.replaceAll("<\\?(.*?)\\?>", "");
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/main/java/org/apache/cxf/dosgi/endpointdesc/EndpointDescriptionBundleParser.java
----------------------------------------------------------------------
diff --git a/discovery/local/src/main/java/org/apache/cxf/dosgi/endpointdesc/EndpointDescriptionBundleParser.java b/discovery/local/src/main/java/org/apache/cxf/dosgi/endpointdesc/EndpointDescriptionBundleParser.java
deleted file mode 100644
index edeaeac..0000000
--- a/discovery/local/src/main/java/org/apache/cxf/dosgi/endpointdesc/EndpointDescriptionBundleParser.java
+++ /dev/null
@@ -1,104 +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.endpointdesc;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Map;
-
-import org.osgi.framework.Bundle;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.xmlns.rsa.v1_0.EndpointDescriptionType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public final class EndpointDescriptionBundleParser {
-    private static final Logger LOG = LoggerFactory.getLogger(EndpointDescriptionBundleParser.class);
-
-    private static final String REMOTE_SERVICES_HEADER_NAME = "Remote-Service";
-    private static final String REMOTE_SERVICES_DIRECTORY = "OSGI-INF/remote-service/";
-
-    private EndpointDescriptionParser parser;
-
-    public EndpointDescriptionBundleParser() {
-        parser = new EndpointDescriptionParser();
-    }
-
-    public List<EndpointDescription> getAllEndpointDescriptions(Bundle b) {
-        List<EndpointDescriptionType> elements = getAllDescriptionElements(b);
-
-        List<EndpointDescription> endpoints = new ArrayList<EndpointDescription>(elements.size());
-        for (EndpointDescriptionType epd : elements) {
-            Map<String, Object> props = new PropertiesMapper().toProps(epd.getProperty());
-            endpoints.add(new EndpointDescription(props));
-        }
-        return endpoints;
-    }
-
-    List<EndpointDescriptionType> getAllDescriptionElements(Bundle b) {
-        Enumeration<URL> urls = getEndpointDescriptionURLs(b);
-        List<EndpointDescriptionType> elements = new ArrayList<EndpointDescriptionType>();
-        while (urls.hasMoreElements()) {
-            URL resourceURL = (URL) urls.nextElement();
-            try {
-                elements.addAll(parser.getEndpointDescriptions(resourceURL.openStream()));
-            } catch (Exception ex) {
-                LOG.warn("Problem parsing: " + resourceURL, ex);
-            }
-        }
-        return elements;
-    }
-    
-    Enumeration<URL> getEndpointDescriptionURLs(Bundle b) {
-        String origDir = getRemoteServicesDir(b);
-        
-        // Split origDir into dir and file pattern
-        String filePattern = "*.xml";
-        String dir;
-        if (origDir.endsWith("/")) {
-            dir = origDir.substring(0, origDir.length() - 1);
-        } else {
-            int idx = origDir.lastIndexOf('/');
-            if (idx >= 0 & origDir.length() > idx) {
-                filePattern = origDir.substring(idx + 1);
-                dir = origDir.substring(0, idx);
-            } else {
-                filePattern = origDir;
-                dir = "";
-            }
-        }
-
-        Enumeration<URL> urls = b.findEntries(dir, filePattern, false);
-        return (urls == null) ? Collections.enumeration(new ArrayList<URL>()) : urls;
-    }
-
-    private static String getRemoteServicesDir(Bundle b) {
-        Dictionary<?, ?> headers = b.getHeaders();
-        Object header = null;
-        if (headers != null) {
-            header = headers.get(REMOTE_SERVICES_HEADER_NAME);
-        }
-        return (header == null) ? REMOTE_SERVICES_DIRECTORY : header.toString();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/main/java/org/apache/cxf/dosgi/endpointdesc/EndpointDescriptionParser.java
----------------------------------------------------------------------
diff --git a/discovery/local/src/main/java/org/apache/cxf/dosgi/endpointdesc/EndpointDescriptionParser.java b/discovery/local/src/main/java/org/apache/cxf/dosgi/endpointdesc/EndpointDescriptionParser.java
deleted file mode 100644
index fb502c8..0000000
--- a/discovery/local/src/main/java/org/apache/cxf/dosgi/endpointdesc/EndpointDescriptionParser.java
+++ /dev/null
@@ -1,90 +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.endpointdesc;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.List;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.namespace.QName;
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-
-import org.osgi.xmlns.rsa.v1_0.EndpointDescriptionType;
-import org.osgi.xmlns.rsa.v1_0.EndpointDescriptionsType;
-
-public class EndpointDescriptionParser {
-    private JAXBContext jaxbContext;
-
-    public EndpointDescriptionParser() {
-        try {
-            jaxbContext = JAXBContext.newInstance(EndpointDescriptionsType.class.getPackage().getName(),
-                                                  this.getClass().getClassLoader());
-        } catch (JAXBException e) {
-            throw new RuntimeException(e.getMessage(), e);
-        }
-    }
-
-    public List<EndpointDescriptionType> getEndpointDescriptions(InputStream is) {
-        try {
-            Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
-            Source source = new StreamSource(is);
-            JAXBElement<EndpointDescriptionsType> jaxb = unmarshaller.unmarshal(source, EndpointDescriptionsType.class);
-            EndpointDescriptionsType decorations = jaxb.getValue();
-            return decorations.getEndpointDescription();
-        } catch (Exception ex) {
-            throw new RuntimeException(ex.getMessage(), ex);
-        }
-    }
-
-    public void writeTo(EndpointDescriptionsType endpointDescriptions, OutputStream os) {
-        try {
-            Marshaller marshaller = jaxbContext.createMarshaller();
-            marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
-            QName name = new QName("http://www.osgi.org/xmlns/rsa/v1.0.0", "endpoint-descriptions");
-            JAXBElement<EndpointDescriptionsType> el = 
-                new JAXBElement<EndpointDescriptionsType>(name, EndpointDescriptionsType.class, 
-                    endpointDescriptions);
-            marshaller.marshal(el, os);
-        } catch (Exception ex) {
-            throw new RuntimeException(ex.getMessage(), ex);
-        } finally {
-            try {
-                os.close();
-            } catch (IOException e) {
-                // Ignore
-            }
-        }
-    }
-    
-    public byte[] getData(EndpointDescriptionType endpointDescription) {
-        EndpointDescriptionsType endpointDescriptions = new EndpointDescriptionsType();
-        endpointDescriptions.getEndpointDescription().add(endpointDescription);
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        writeTo(endpointDescriptions, bos);
-        return bos.toByteArray();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/main/java/org/apache/cxf/dosgi/endpointdesc/PropertiesMapper.java
----------------------------------------------------------------------
diff --git a/discovery/local/src/main/java/org/apache/cxf/dosgi/endpointdesc/PropertiesMapper.java b/discovery/local/src/main/java/org/apache/cxf/dosgi/endpointdesc/PropertiesMapper.java
deleted file mode 100644
index a7ed445..0000000
--- a/discovery/local/src/main/java/org/apache/cxf/dosgi/endpointdesc/PropertiesMapper.java
+++ /dev/null
@@ -1,345 +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.endpointdesc;
-
-import java.io.Serializable;
-import java.io.StringWriter;
-import java.lang.reflect.Array;
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.bind.JAXBElement;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.w3c.dom.Node;
-import org.osgi.xmlns.rsa.v1_0.ArrayType;
-import org.osgi.xmlns.rsa.v1_0.ObjectFactory;
-import org.osgi.xmlns.rsa.v1_0.PropertyType;
-import org.osgi.xmlns.rsa.v1_0.ValueType;
-import org.osgi.xmlns.rsa.v1_0.XmlType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class PropertiesMapper {
-    private static final Logger LOG = LoggerFactory.getLogger(PropertiesMapper.class);
-
-    public Map<String, Object> toProps(List<PropertyType> properties) {
-        Map<String, Object> map = new HashMap<String, Object>();
-        for (PropertyType prop : properties) {
-            map.put(prop.getName(), getValue(prop));
-        }
-        return map;
-    }
-
-    private Object getValue(PropertyType prop) {
-        Object value = null;
-        String type = getTypeName(prop);
-        Object content = getFirstNonText(prop.getContent());
-        if (content instanceof JAXBElement<?>) {
-            JAXBElement<?> el = (JAXBElement<?>)content;
-            if (el.getDeclaredType() == ArrayType.class) {
-                String elName = el.getName().getLocalPart();
-                ArrayType inValue = (ArrayType)el.getValue();
-                if ("array".equals(elName)) {
-                    value = getArray(inValue, type);
-                } else if ("set".equals(elName)) {
-                    value = handleCollection(inValue, new HashSet<Object>(), type);
-                } else if ("list".equals(elName)) {
-                    value = handleCollection(inValue, new ArrayList<Object>(), type);
-                }
-            } else if (el.getDeclaredType() == XmlType.class) {
-                value = readXML((XmlType)el.getValue(), type);
-            }
-        } else {
-            if (prop.getValue() != null) {
-                value = instantiate(type, prop.getValue());
-            } else {
-                if (prop.getContent().size() > 0) {
-                    value = instantiate(type, prop.getContent().get(0).toString());
-                }
-            }
-        }
-        return value;
-    }
-
-    private Object getFirstNonText(List<Serializable> contentList) {
-        for (Object content : contentList) {
-            if (content instanceof JAXBElement<?>) {
-                return content;
-            }
-        }
-        return null;
-    }
-
-    private static String getTypeName(PropertyType prop) {
-        String type = prop.getValueType();
-        return type == null ? "String" : type;
-    }
-
-    private Object getArray(ArrayType arrayEl, String type) {
-        List<ValueType> values = arrayEl.getValue();
-        Class<?> cls = null;
-        if ("long".equals(type)) {
-            cls = long.class;
-        } else if ("double".equals(type)) {
-            cls = double.class;
-        } else if ("float".equals(type)) {
-            cls = float.class;
-        } else if ("int".equals(type)) {
-            cls = int.class;
-        } else if ("byte".equals(type)) {
-            cls = byte.class;
-        } else if ("boolean".equals(type)) {
-            cls = boolean.class;
-        } else if ("short".equals(type)) {
-            cls = short.class;
-        }
-
-        try {
-            if (cls == null) {
-                cls = ClassLoader.getSystemClassLoader().loadClass("java.lang." + type);
-            }
-            Object array = Array.newInstance(cls, values.size());
-
-            for (int i = 0; i < values.size(); i++) {
-                Object val = getValue(values.get(i), type);
-                Array.set(array, i, val);
-            }
-
-            return array;
-        } catch (Exception e) {
-            LOG.warn("Could not create array for Endpoint Description", e);
-            return null;
-        }
-    }
-
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    private Collection handleCollection(ArrayType el, Collection value, String type) {
-        List<ValueType> values = el.getValue();
-        for (ValueType val : values) {
-            Object obj = getValue(val, type);
-            value.add(obj);
-        }
-        return value;
-    }
-    
-    private Object getValue(ValueType value, String type) {
-        if (value.getContent().size() == 1 && value.getContent().get(0) instanceof String) {
-            return handleValue((String)value.getContent().get(0), type);
-        }
-        JAXBElement<?> valueContent = (JAXBElement<?>)getFirstNonText(value.getContent());
-        if (valueContent.getDeclaredType() == XmlType.class) {
-            return readXML((XmlType)valueContent.getValue(), type);
-        }
-        return "";
-    }
-
-    private String readXML(XmlType el, String type) {
-        if (el == null) {
-            return null;
-        }
-        if (!"String".equals(type)) {
-            LOG.warn("Embedded XML must be of type String, found: " + type);
-            return null;
-        }
-        Node xmlContent = (Node)el.getAny();
-        xmlContent.normalize();
-        try {
-            TransformerFactory transFactory = TransformerFactory.newInstance();
-            Transformer transformer = transFactory.newTransformer();
-            StringWriter buffer = new StringWriter();
-            transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
-            transformer.transform(new DOMSource(xmlContent), new StreamResult(buffer));
-            return buffer.toString();
-        } catch (Exception e) {
-            return "";
-        }
-    }
-
-    private static Object handleValue(String val, String type) {
-        return instantiate(type, val);
-    }
-
-    private static Object instantiate(String type, String value) {
-        if ("String".equals(type)) {
-            return value;
-        }
-
-        value = value.trim();
-        String boxedType = null;
-        if ("long".equals(type)) {
-            boxedType = "Long";
-        } else if ("double".equals(type)) {
-            boxedType = "Double";
-        } else if ("float".equals(type)) {
-            boxedType = "Float";
-        } else if ("int".equals(type)) {
-            boxedType = "Integer";
-        } else if ("byte".equals(type)) {
-            boxedType = "Byte";
-        } else if ("char".equals(type)) {
-            boxedType = "Character";
-        } else if ("boolean".equals(type)) {
-            boxedType = "Boolean";
-        } else if ("short".equals(type)) {
-            boxedType = "Short";
-        }
-
-        if (boxedType == null) {
-            boxedType = type;
-        }
-        String javaType = "java.lang." + boxedType;
-
-        try {
-            if ("Character".equals(boxedType)) {
-                return new Character(value.charAt(0));
-            } else {
-                Class<?> cls = ClassLoader.getSystemClassLoader().loadClass(javaType);
-                Constructor<?> ctor = cls.getConstructor(String.class);
-                return ctor.newInstance(value);
-            }
-        } catch (Exception e) {
-            LOG.warn("Could not create Endpoint Property of type " + type + " and value " + value);
-            return null;
-        }
-    }
-    
-    public List<PropertyType> fromProps(Map<String, Object> m) {
-        List<PropertyType> props = new ArrayList<PropertyType>();
-        for (Map.Entry<String, Object> entry : m.entrySet()) {
-            String key = entry.getKey();
-            Object val = entry.getValue();
-
-            PropertyType propEl = new PropertyType();
-            propEl.setName(key);
-            ObjectFactory factory = new ObjectFactory();
-            if (val.getClass().isArray()) {
-                ArrayType arrayEl = new ArrayType();
-                propEl.getContent().add(factory.createArray(arrayEl));
-                for (Object o : normalizeArray(val)) {
-                    setValueType(propEl, o);
-                    ValueType valueType =  new ValueType();
-                    valueType.getContent().add(o.toString());
-                    arrayEl.getValue().add(valueType);
-                }
-            } else if (val instanceof List) {
-                ArrayType listEl = new ArrayType();
-                propEl.getContent().add(factory.createList(listEl));
-                handleCollectionValue((Collection<?>) val, propEl, listEl);
-            } else if (val instanceof Set) {
-                ArrayType setEl = new ArrayType();
-                propEl.getContent().add(factory.createSet(setEl));
-                handleCollectionValue((Collection<?>) val, propEl, setEl);
-            } else if (val instanceof String
-                    || val instanceof Character
-                    || val instanceof Boolean
-                    || val instanceof Byte) {
-                setValueType(propEl, val);
-                propEl.setValue(val.toString());
-            } else if (val instanceof Long
-                    || val instanceof Double
-                    || val instanceof Float
-                    || val instanceof Integer
-                    || val instanceof Short) {
-                // various numbers..   maybe "val instanceof Number"?
-                setValueType(propEl, val);
-                propEl.setValue(val.toString());
-            } else {
-                // Don't add this property as the value type is not supported
-                continue;
-            }
-            props.add(propEl);
-        }
-        return props;
-    }
-
-    private static Object[] normalizeArray(Object val) {
-        List<Object> l = new ArrayList<Object>();
-        if (val instanceof int[]) {
-            int[] ia = (int[]) val;
-            for (int i : ia) {
-                l.add(i);
-            }
-        } else if (val instanceof long[]) {
-            long[] la = (long[]) val;
-            for (long i : la) {
-                l.add(i);
-            }
-        } else if (val instanceof float[]) {
-            float[] fa = (float[]) val;
-            for (float f : fa) {
-                l.add(f);
-            }
-        } else if (val instanceof byte[]) {
-            byte[] ba = (byte[]) val;
-            for (byte b : ba) {
-                l.add(b);
-            }
-        } else if (val instanceof boolean[]) {
-            boolean[] ba = (boolean[]) val;
-            for (boolean b : ba) {
-                l.add(b);
-            }
-        } else if (val instanceof short[]) {
-            short[] sa = (short[]) val;
-            for (short s : sa) {
-                l.add(s);
-            }
-        } else if (val instanceof char[]) {
-            char[] ca = (char[]) val;
-            for (char c : ca) {
-                l.add(c);
-            }
-        } else {
-            return (Object[]) val;
-        }
-        return l.toArray();
-    }
-
-    private static void handleCollectionValue(Collection<?> val, PropertyType propEl, ArrayType listEl) {
-        for (Object o : val) {
-            setValueType(propEl, o);
-            ValueType valueType = new ValueType();
-            valueType.getContent().add(o.toString());
-            listEl.getValue().add(valueType);
-        }
-    }
-
-    private static void setValueType(PropertyType propEl, Object val) {
-        if (val instanceof String) {
-            return;
-        }
-
-        String dataType = val.getClass().getName();
-        if (dataType.startsWith("java.lang.")) {
-            dataType = dataType.substring("java.lang.".length());
-        }
-        propEl.setValueType(dataType);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/main/resources/endpoint-description.xsd
----------------------------------------------------------------------
diff --git a/discovery/local/src/main/resources/endpoint-description.xsd b/discovery/local/src/main/resources/endpoint-description.xsd
deleted file mode 100644
index b3254c1..0000000
--- a/discovery/local/src/main/resources/endpoint-description.xsd
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.osgi.org/xmlns/rsa/v1.0.0" targetNamespace="http://www.osgi.org/xmlns/rsa/v1.0.0">
-    <element name="endpoint-descriptions"
-        type="tns:EndpointDescriptionsType">
-    </element>
-    
-    <complexType name="EndpointDescriptionsType">
-        <sequence>
-            <element maxOccurs="unbounded" minOccurs="0"
-                ref="tns:endpoint-description">
-            </element>
-        </sequence>
-    </complexType>
-
-    <complexType name="EndpointDescriptionType">
-        <sequence>
-            <element ref="tns:property" maxOccurs="unbounded" minOccurs="0"></element>
-        </sequence>
-    </complexType>
-
-    <complexType name="PropertyType" mixed="true">
-        <choice>
-            <element ref="tns:array"></element>
-            <element ref="tns:list"></element>
-            <element ref="tns:set"></element>
-            <element ref="tns:xml"></element>
-        </choice>
-        <attribute name="name" type="string"></attribute>
-        <attribute name="value-type" type="string"></attribute>
-        <attribute name="value" type="string"></attribute>
-    </complexType>
-
-    <complexType name="ArrayType">
-        <sequence>
-            <element maxOccurs="unbounded" minOccurs="0"
-                ref="tns:value">
-            </element>
-        </sequence>
-    </complexType>
-    <element name="endpoint-description"
-        type="tns:EndpointDescriptionType">
-    </element>
-    <element name="property" type="tns:PropertyType"></element>
-    <element name="array" type="tns:ArrayType"></element>
-    <element name="list" type="tns:ArrayType"></element>
-    <element name="set" type="tns:ArrayType"></element>
-
-    <complexType name="XmlType">
-        <sequence>
-            <any></any>
-        </sequence>
-    </complexType>
-    <element name="value" type="tns:ValueType"></element>
-    <element name="xml" type="tns:XmlType"></element>
-
-    <complexType name="ValueType" mixed="true">
-        <sequence>
-            <element ref="tns:xml"></element>
-        </sequence>
-    </complexType>
-</schema>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/internal/ActivatorTest.java
----------------------------------------------------------------------
diff --git a/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/internal/ActivatorTest.java b/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/internal/ActivatorTest.java
deleted file mode 100644
index a0bdc87..0000000
--- a/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/internal/ActivatorTest.java
+++ /dev/null
@@ -1,52 +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.discovery.local.internal;
-
-import junit.framework.TestCase;
-
-import org.easymock.IAnswer;
-import org.easymock.classextension.EasyMock;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkUtil;
-
-public class ActivatorTest extends TestCase {
-
-    public void testActivator() throws Exception {
-        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-        EasyMock.expect(bc.createFilter((String) EasyMock.anyObject())).andAnswer(new IAnswer<Filter>() {
-            public Filter answer() throws Throwable {
-                return FrameworkUtil.createFilter((String) EasyMock.getCurrentArguments()[0]);
-            }
-        }).anyTimes();
-        EasyMock.replay(bc);
-
-        Activator a = new Activator();
-        a.start(bc);
-        assertNotNull(a.localDiscovery);
-
-        a.localDiscovery = EasyMock.createMock(LocalDiscovery.class);
-        a.localDiscovery.shutDown();
-        EasyMock.expectLastCall();
-        EasyMock.replay(a.localDiscovery);
-        a.stop(bc);
-
-        EasyMock.verify(a.localDiscovery);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/internal/LocalDiscoveryTest.java
----------------------------------------------------------------------
diff --git a/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/internal/LocalDiscoveryTest.java b/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/internal/LocalDiscoveryTest.java
deleted file mode 100644
index ccbaca7..0000000
--- a/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/internal/LocalDiscoveryTest.java
+++ /dev/null
@@ -1,409 +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.discovery.local.internal;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-import org.easymock.EasyMock;
-import org.easymock.IAnswer;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleListener;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-
-public class LocalDiscoveryTest extends TestCase {
-
-    public void testLocalDiscovery() throws Exception {
-        Filter filter = EasyMock.createMock(Filter.class);
-        EasyMock.replay(filter);
-
-        BundleContext bc = EasyMock.createMock(BundleContext.class);
-        EasyMock.expect(bc.createFilter("(objectClass=org.osgi.service.remoteserviceadmin.EndpointListener)"))
-            .andReturn(filter);
-        bc.addServiceListener((ServiceListener) EasyMock.anyObject(),
-            EasyMock.eq("(objectClass=org.osgi.service.remoteserviceadmin.EndpointListener)"));
-        EasyMock.expectLastCall();
-        EasyMock.expect(bc.getServiceReferences("org.osgi.service.remoteserviceadmin.EndpointListener", null))
-            .andReturn(null);
-        bc.addBundleListener((BundleListener) EasyMock.anyObject());
-        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
-            public Object answer() throws Throwable {
-                assertEquals(LocalDiscovery.class, EasyMock.getCurrentArguments()[0].getClass());
-                return null;
-            }
-        });
-        EasyMock.expect(bc.getBundles()).andReturn(null);
-        EasyMock.replay(bc);
-
-        LocalDiscovery ld = new LocalDiscovery(bc);
-        assertSame(bc, ld.bundleContext);
-        assertNotNull(ld.listenerTracker);
-
-        EasyMock.verify(bc);
-
-        EasyMock.reset(bc);
-        bc.removeBundleListener(ld);
-        EasyMock.expectLastCall();
-        bc.removeServiceListener((ServiceListener) EasyMock.anyObject());
-        EasyMock.expectLastCall();
-        EasyMock.replay(bc);
-
-        ld.shutDown();
-        EasyMock.verify(bc);
-    }
-
-    public void testPreExistingBundles() throws Exception {
-        Filter filter = EasyMock.createMock(Filter.class);
-        EasyMock.replay(filter);
-
-        BundleContext bc = EasyMock.createMock(BundleContext.class);
-        EasyMock.expect(bc.createFilter("(objectClass=org.osgi.service.remoteserviceadmin.EndpointListener)"))
-            .andReturn(filter);
-        bc.addServiceListener((ServiceListener) EasyMock.anyObject(),
-            EasyMock.eq("(objectClass=org.osgi.service.remoteserviceadmin.EndpointListener)"));
-        EasyMock.expectLastCall();
-        EasyMock.expect(bc.getServiceReferences("org.osgi.service.remoteserviceadmin.EndpointListener", null))
-            .andReturn(null);
-        bc.addBundleListener((BundleListener) EasyMock.anyObject());
-        EasyMock.expectLastCall();
-
-        Bundle b1 = EasyMock.createMock(Bundle.class);
-        EasyMock.expect(b1.getState()).andReturn(Bundle.RESOLVED);
-        EasyMock.replay(b1);
-        Bundle b2 = EasyMock.createMock(Bundle.class);
-        EasyMock.expect(b2.getState()).andReturn(Bundle.ACTIVE);
-        Dictionary<String, String> headers = new Hashtable<String, String>();
-        headers.put("Remote-Service", "OSGI-INF/remote-service/");
-        EasyMock.expect(b2.getHeaders()).andReturn(headers);
-
-        URL rs3URL = getClass().getResource("/ed3.xml");
-        URL rs4URL = getClass().getResource("/ed4.xml");
-        List<URL> urls = Arrays.asList(rs3URL, rs4URL);
-        EasyMock.expect(b2.findEntries("OSGI-INF/remote-service", "*.xml", false))
-            .andReturn(Collections.enumeration(urls));
-        EasyMock.replay(b2);
-
-        EasyMock.expect(bc.getBundles()).andReturn(new Bundle[] {b1, b2});
-        EasyMock.replay(bc);
-
-        LocalDiscovery ld = new LocalDiscovery(bc);
-
-        assertEquals(3, ld.endpointDescriptions.size());
-        Set<String> expected = new HashSet<String>(
-                Arrays.asList("http://somewhere:12345", "http://somewhere:1", "http://somewhere"));
-        Set<String> actual = new HashSet<String>();
-        for (Map.Entry<EndpointDescription, Bundle> entry : ld.endpointDescriptions.entrySet()) {
-            assertSame(b2, entry.getValue());
-            actual.add(entry.getKey().getId());
-        }
-        assertEquals(expected, actual);
-    }
-
-    public void testBundleChanged() throws Exception {
-        LocalDiscovery ld = getLocalDiscovery();
-
-        Bundle bundle = EasyMock.createMock(Bundle.class);
-        EasyMock.expect(bundle.getSymbolicName()).andReturn("testing.bundle").anyTimes();
-        EasyMock.expect(bundle.getState()).andReturn(Bundle.ACTIVE);
-        Dictionary<String, String> headers = new Hashtable<String, String>();
-        headers.put("Remote-Service", "OSGI-INF/rsa/");
-        EasyMock.expect(bundle.getHeaders()).andReturn(headers);
-        EasyMock.expect(bundle.findEntries("OSGI-INF/rsa", "*.xml", false))
-            .andReturn(Collections.enumeration(
-                Collections.singleton(getClass().getResource("/ed3.xml"))));
-        EasyMock.replay(bundle);
-
-        BundleEvent be0 = new BundleEvent(BundleEvent.INSTALLED, bundle);
-        ld.bundleChanged(be0);
-        assertEquals(0, ld.endpointDescriptions.size());
-
-        // Create an EndpointListener
-        final Map<String, Object> props = new Hashtable<String, Object>();
-        props.put(EndpointListener.ENDPOINT_LISTENER_SCOPE, "(objectClass=*)");
-        @SuppressWarnings("unchecked")
-        ServiceReference<EndpointListener> sr = EasyMock.createMock(ServiceReference.class);
-        EasyMock.expect(sr.getPropertyKeys()).andReturn(props.keySet().toArray(new String[] {})).anyTimes();
-        EasyMock.expect(sr.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
-            public Object answer() throws Throwable {
-                return props.get(EasyMock.getCurrentArguments()[0]);
-            }
-        }).anyTimes();
-        EasyMock.replay(sr);
-
-        EndpointListener endpointListener = EasyMock.createMock(EndpointListener.class);
-        endpointListener.endpointAdded((EndpointDescription) EasyMock.anyObject(), EasyMock.eq("(objectClass=*)"));
-        EasyMock.expectLastCall();
-        EasyMock.replay(endpointListener);
-        ld.addListener(sr, endpointListener);
-
-        // Start the bundle
-        BundleEvent be = new BundleEvent(BundleEvent.STARTED, bundle);
-        ld.bundleChanged(be);
-        assertEquals(1, ld.endpointDescriptions.size());
-        EndpointDescription endpoint = ld.endpointDescriptions.keySet().iterator().next();
-        assertEquals("http://somewhere:12345", endpoint.getId());
-        assertSame(bundle, ld.endpointDescriptions.get(endpoint));
-
-        EasyMock.verify(endpointListener);
-
-        // Stop the bundle
-        EasyMock.reset(endpointListener);
-        endpointListener.endpointRemoved((EndpointDescription) EasyMock.anyObject(), EasyMock.eq("(objectClass=*)"));
-        EasyMock.expectLastCall();
-        EasyMock.replay(endpointListener);
-
-        BundleEvent be1 = new BundleEvent(BundleEvent.STOPPED, bundle);
-        ld.bundleChanged(be1);
-        assertEquals(0, ld.endpointDescriptions.size());
-
-        EasyMock.verify(endpointListener);
-    }
-
-    public void testEndpointListenerService() throws Exception {
-        LocalDiscovery ld = getLocalDiscovery();
-
-        Bundle bundle = EasyMock.createMock(Bundle.class);
-        EasyMock.expect(bundle.getState()).andReturn(Bundle.ACTIVE);
-        Dictionary<String, String> headers = new Hashtable<String, String>();
-        headers.put("Remote-Service", "OSGI-INF/rsa/ed4.xml");
-        EasyMock.expect(bundle.getHeaders()).andReturn(headers);
-        EasyMock.expect(bundle.findEntries("OSGI-INF/rsa", "ed4.xml", false))
-            .andReturn(Collections.enumeration(
-                Collections.singleton(getClass().getResource("/ed4.xml"))));
-        EasyMock.replay(bundle);
-
-        BundleEvent be = new BundleEvent(BundleEvent.STARTED, bundle);
-        ld.bundleChanged(be);
-        assertEquals(2, ld.endpointDescriptions.size());
-
-        final Map<String, Object> props = new Hashtable<String, Object>();
-        props.put(EndpointListener.ENDPOINT_LISTENER_SCOPE, new String[] {"(objectClass=org.example.ClassA)"});
-        @SuppressWarnings("unchecked")
-        ServiceReference<EndpointListener> sr = EasyMock.createMock(ServiceReference.class);
-        EasyMock.expect(sr.getPropertyKeys()).andReturn(props.keySet().toArray(new String[] {})).anyTimes();
-        EasyMock.expect(sr.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
-            public Object answer() throws Throwable {
-                return props.get(EasyMock.getCurrentArguments()[0]);
-            }
-        }).anyTimes();
-
-        EasyMock.replay(sr);
-
-        EasyMock.reset(ld.bundleContext);
-        EndpointListener el = EasyMock.createMock(EndpointListener.class);
-        EasyMock.expect(ld.bundleContext.getService(sr)).andReturn(el);
-        EasyMock.expect(ld.bundleContext.ungetService(sr)).andReturn(true);
-        EasyMock.expect(ld.bundleContext.createFilter((String) EasyMock.anyObject())).andAnswer(new IAnswer<Filter>() {
-            public Filter answer() throws Throwable {
-                return FrameworkUtil.createFilter((String) EasyMock.getCurrentArguments()[0]);
-            }
-        }).anyTimes();
-        EasyMock.replay(ld.bundleContext);
-
-        el.endpointAdded((EndpointDescription) EasyMock.anyObject(),
-                EasyMock.eq("(objectClass=org.example.ClassA)"));
-        EasyMock.expectLastCall();
-        EasyMock.replay(el);
-
-        // Add the EndpointListener Service
-        assertEquals("Precondition failed", 0, ld.listenerToFilters.size());
-        assertEquals("Precondition failed", 0, ld.filterToListeners.size());
-        assertSame(el, ld.listenerTracker.addingService(sr));
-
-        assertEquals(1, ld.listenerToFilters.size());
-        assertEquals(Collections.singletonList("(objectClass=org.example.ClassA)"), ld.listenerToFilters.get(el));
-        assertEquals(1, ld.filterToListeners.size());
-        assertEquals(Collections.singletonList(el), ld.filterToListeners.get("(objectClass=org.example.ClassA)"));
-
-        EasyMock.verify(el);
-
-        // Modify the EndpointListener Service
-        // no need to reset the mock for this...
-        props.put(EndpointListener.ENDPOINT_LISTENER_SCOPE,
-                  "(|(objectClass=org.example.ClassA)(objectClass=org.example.ClassB))");
-
-        EasyMock.reset(el);
-        final Set<String> actualEndpoints = new HashSet<String>();
-        el.endpointAdded((EndpointDescription) EasyMock.anyObject(),
-                EasyMock.eq("(|(objectClass=org.example.ClassA)(objectClass=org.example.ClassB))"));
-        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
-            public Object answer() throws Throwable {
-                EndpointDescription endpoint = (EndpointDescription) EasyMock.getCurrentArguments()[0];
-                actualEndpoints.addAll(endpoint.getInterfaces());
-                return null;
-            }
-        }).times(2);
-        EasyMock.replay(el);
-
-        ld.listenerTracker.modifiedService(sr, el);
-        assertEquals(1, ld.listenerToFilters.size());
-        assertEquals(Arrays.asList("(|(objectClass=org.example.ClassA)(objectClass=org.example.ClassB))"),
-            ld.listenerToFilters.get(el));
-        assertEquals(1, ld.filterToListeners.size());
-        assertEquals(Collections.singletonList(el),
-            ld.filterToListeners.get("(|(objectClass=org.example.ClassA)(objectClass=org.example.ClassB))"));
-
-        EasyMock.verify(el);
-        Set<String> expectedEndpoints = new HashSet<String>(Arrays.asList("org.example.ClassA", "org.example.ClassB"));
-        assertEquals(expectedEndpoints, actualEndpoints);
-
-        // Remove the EndpointListener Service
-        ld.listenerTracker.removedService(sr, el);
-        assertEquals(0, ld.listenerToFilters.size());
-        assertEquals(0, ld.filterToListeners.size());
-    }
-
-    public void testRegisterTracker() throws Exception {
-        LocalDiscovery ld = getLocalDiscovery();
-
-        final Map<String, Object> props = new Hashtable<String, Object>();
-        props.put(EndpointListener.ENDPOINT_LISTENER_SCOPE, "(objectClass=Aaaa)");
-        @SuppressWarnings("unchecked")
-        ServiceReference<EndpointListener> sr = EasyMock.createMock(ServiceReference.class);
-        EasyMock.expect(sr.getPropertyKeys()).andReturn(props.keySet().toArray(new String[] {})).anyTimes();
-        EasyMock.expect(sr.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
-            public Object answer() throws Throwable {
-                return props.get(EasyMock.getCurrentArguments()[0]);
-            }
-        }).anyTimes();
-        EasyMock.replay(sr);
-
-        EndpointListener endpointListener = EasyMock.createMock(EndpointListener.class);
-        EasyMock.replay(endpointListener);
-
-        assertEquals("Precondition failed", 0, ld.listenerToFilters.size());
-        assertEquals("Precondition failed", 0, ld.filterToListeners.size());
-        ld.addListener(sr, endpointListener);
-
-        assertEquals(1, ld.listenerToFilters.size());
-        assertEquals(Collections.singletonList("(objectClass=Aaaa)"), ld.listenerToFilters.get(endpointListener));
-        assertEquals(1, ld.filterToListeners.size());
-        assertEquals(Collections.singletonList(endpointListener), ld.filterToListeners.get("(objectClass=Aaaa)"));
-
-        // Add another one with the same scope filter
-        @SuppressWarnings("unchecked")
-        ServiceReference<EndpointListener> sr2 = EasyMock.createMock(ServiceReference.class);
-        EasyMock.expect(sr2.getPropertyKeys()).andReturn(props.keySet().toArray(new String[] {})).anyTimes();
-        EasyMock.expect(sr2.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
-            public Object answer() throws Throwable {
-                return props.get(EasyMock.getCurrentArguments()[0]);
-            }
-        }).anyTimes();
-        EasyMock.replay(sr2);
-
-        EndpointListener endpointListener2 = EasyMock.createMock(EndpointListener.class);
-        EasyMock.replay(endpointListener2);
-        ld.addListener(sr2, endpointListener2);
-
-        assertEquals(2, ld.listenerToFilters.size());
-        assertEquals(Collections.singletonList("(objectClass=Aaaa)"), ld.listenerToFilters.get(endpointListener));
-        assertEquals(Collections.singletonList("(objectClass=Aaaa)"), ld.listenerToFilters.get(endpointListener2));
-
-        assertEquals(1, ld.filterToListeners.size());
-        List<EndpointListener> endpointListeners12 = Arrays.asList(endpointListener, endpointListener2);
-        assertEquals(endpointListeners12, ld.filterToListeners.get("(objectClass=Aaaa)"));
-
-        // Add another listener with a multi-value scope
-        final Map<String, Object> props2 = new Hashtable<String, Object>();
-        props2.put(EndpointListener.ENDPOINT_LISTENER_SCOPE, Arrays.asList("(objectClass=X)", "(objectClass=Y)"));
-        @SuppressWarnings("unchecked")
-        ServiceReference<EndpointListener> sr3 = EasyMock.createMock(ServiceReference.class);
-        EasyMock.expect(sr3.getPropertyKeys()).andReturn(props2.keySet().toArray(new String[] {})).anyTimes();
-        EasyMock.expect(sr3.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
-            public Object answer() throws Throwable {
-                return props2.get(EasyMock.getCurrentArguments()[0]);
-            }
-        }).anyTimes();
-        EasyMock.replay(sr3);
-
-        EndpointListener endpointListener3 = EasyMock.createMock(EndpointListener.class);
-        EasyMock.replay(endpointListener3);
-        ld.addListener(sr3, endpointListener3);
-
-        assertEquals(3, ld.listenerToFilters.size());
-        assertEquals(Collections.singletonList("(objectClass=Aaaa)"), ld.listenerToFilters.get(endpointListener));
-        assertEquals(Collections.singletonList("(objectClass=Aaaa)"), ld.listenerToFilters.get(endpointListener2));
-        assertEquals(Arrays.asList("(objectClass=X)", "(objectClass=Y)"), ld.listenerToFilters.get(endpointListener3));
-
-        assertEquals(3, ld.filterToListeners.size());
-        assertEquals(endpointListeners12, ld.filterToListeners.get("(objectClass=Aaaa)"));
-        assertEquals(Collections.singletonList(endpointListener3), ld.filterToListeners.get("(objectClass=X)"));
-        assertEquals(Collections.singletonList(endpointListener3), ld.filterToListeners.get("(objectClass=Y)"));
-    }
-
-    public void testClearTracker() throws Exception {
-        LocalDiscovery ld = getLocalDiscovery();
-
-        EndpointListener endpointListener = EasyMock.createMock(EndpointListener.class);
-        ld.listenerToFilters.put(endpointListener,
-                new ArrayList<String>(Arrays.asList("(a=b)", "(objectClass=foo.bar.Bheuaark)")));
-        ld.filterToListeners.put("(a=b)", new ArrayList<EndpointListener>(Arrays.asList(endpointListener)));
-        ld.filterToListeners.put("(objectClass=foo.bar.Bheuaark)",
-                new ArrayList<EndpointListener>(Arrays.asList(endpointListener)));
-
-        assertEquals(1, ld.listenerToFilters.size());
-        assertEquals(2, ld.filterToListeners.size());
-        assertEquals(1, ld.filterToListeners.values().iterator().next().size());
-        ld.removeListener(EasyMock.createMock(EndpointListener.class));
-        assertEquals(1, ld.listenerToFilters.size());
-        assertEquals(2, ld.filterToListeners.size());
-        assertEquals(1, ld.filterToListeners.values().iterator().next().size());
-        ld.removeListener(endpointListener);
-        assertEquals(0, ld.listenerToFilters.size());
-        assertEquals(0, ld.filterToListeners.size());
-    }
-
-    private LocalDiscovery getLocalDiscovery() throws InvalidSyntaxException {
-        BundleContext bc = EasyMock.createMock(BundleContext.class);
-        EasyMock.expect(bc.createFilter((String) EasyMock.anyObject())).andAnswer(new IAnswer<Filter>() {
-            public Filter answer() throws Throwable {
-                return FrameworkUtil.createFilter((String) EasyMock.getCurrentArguments()[0]);
-            }
-        }).anyTimes();
-        bc.addServiceListener((ServiceListener) EasyMock.anyObject(),
-            EasyMock.eq("(objectClass=org.osgi.service.remoteserviceadmin.EndpointListener)"));
-        EasyMock.expectLastCall();
-        EasyMock.expect(bc.getServiceReferences("org.osgi.service.remoteserviceadmin.EndpointListener", null))
-            .andReturn(null);
-        bc.addBundleListener((BundleListener) EasyMock.anyObject());
-        EasyMock.expectLastCall();
-        EasyMock.expect(bc.getBundles()).andReturn(null);
-        EasyMock.replay(bc);
-
-        return new LocalDiscovery(bc);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/test/java/org/apache/cxf/dosgi/endpointdesc/EndpointDescriptionBundleParserTest.java
----------------------------------------------------------------------
diff --git a/discovery/local/src/test/java/org/apache/cxf/dosgi/endpointdesc/EndpointDescriptionBundleParserTest.java b/discovery/local/src/test/java/org/apache/cxf/dosgi/endpointdesc/EndpointDescriptionBundleParserTest.java
deleted file mode 100644
index 4884c50..0000000
--- a/discovery/local/src/test/java/org/apache/cxf/dosgi/endpointdesc/EndpointDescriptionBundleParserTest.java
+++ /dev/null
@@ -1,138 +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.endpointdesc;
-
-import java.net.URL;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-import org.apache.cxf.dosgi.discovery.local.util.Utils;
-import org.easymock.EasyMock;
-import org.osgi.framework.Bundle;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-
-public class EndpointDescriptionBundleParserTest extends TestCase {
-
-    private Bundle createBundleContaining(URL ed1URL) {
-        Bundle b = EasyMock.createNiceMock(Bundle.class);
-        EasyMock.expect(b.findEntries(
-            EasyMock.eq("OSGI-INF/remote-service"),
-            EasyMock.eq("*.xml"), EasyMock.anyBoolean())).andReturn(
-                Collections.enumeration(Arrays.asList(ed1URL))).anyTimes();
-        EasyMock.replay(b);
-        return b;
-    }
-
-    public void testAllEndpoints1() {
-        URL ed1URL = getClass().getResource("/ed1.xml");
-
-        Bundle b = createBundleContaining(ed1URL);
-
-        List<EndpointDescription> endpoints = new EndpointDescriptionBundleParser().getAllEndpointDescriptions(b);
-        assertEquals(4, endpoints.size());
-        EndpointDescription endpoint0 = endpoints.get(0);
-        assertEquals("http://somewhere:12345", endpoint0.getId());
-        assertEquals(Arrays.asList("SomeService"), endpoint0.getInterfaces());
-        assertEquals(Arrays.asList("confidentiality"),
-            endpoint0.getProperties().get("osgi.remote.requires.intents"));
-        assertEquals("testValue", endpoint0.getProperties().get("testKey"));
-
-        EndpointDescription endpoint1 = endpoints.get(1);
-        assertEquals("myScheme://somewhere:12345", endpoint1.getId());
-        assertEquals(Arrays.asList("SomeOtherService", "WithSomeSecondInterface"), endpoint1.getInterfaces());
-
-        EndpointDescription endpoint2 = endpoints.get(2);
-        assertEquals("http://somewhere", endpoint2.getId());
-        assertEquals(Arrays.asList("SomeOtherService", "WithSomeSecondInterface"), endpoint2.getInterfaces());
-
-        EndpointDescription endpoint3 = endpoints.get(3);
-        assertEquals("http://somewhere:1/2/3/4?5", endpoint3.getId());
-        assertEquals(Arrays.asList("SomeOtherService", "WithSomeSecondInterface"), endpoint3.getInterfaces());
-    }
-
-    public void testAllEndpoints2() throws Exception {
-        URL ed2URL = getClass().getResource("/ed2.xml");
-
-        Bundle b = createBundleContaining(ed2URL);
-
-        List<EndpointDescription> endpoints = new EndpointDescriptionBundleParser().getAllEndpointDescriptions(b);
-        assertEquals(2, endpoints.size());
-        EndpointDescription endpoint0 = endpoints.get(0);
-        assertEquals("foo:bar", endpoint0.getId());
-        assertEquals(Arrays.asList("com.acme.HelloService"), endpoint0.getInterfaces());
-        assertEquals(Arrays.asList("SOAP"), endpoint0.getIntents());
-        // changed from exported to imported
-        assertEquals("org.apache.cxf.ws", endpoint0.getProperties().get("service.imported.configs"));
-
-        EndpointDescription endpoint1 = endpoints.get(1);
-        Map<String, Object> props = endpoint1.getProperties();
-        assertEquals(Arrays.asList("com.acme.HelloService", "some.other.Service"), endpoint1.getInterfaces());
-        assertEquals("org.apache.cxf.ws", props.get("service.imported.configs"));
-        // exports should have been removed
-        assertNull(props.get("service.exported.configs"));
-
-        assertEquals(Utils.normXML("<other:t1 xmlns:other='http://www.acme.org/xmlns/other/v1.0.0' "
-            + "xmlns='http://www.acme.org/xmlns/other/v1.0.0'><foo type='bar'>haha</foo>\n"
-            + "        </other:t1>"),
-            Utils.normXML((String) props.get("someXML")));
-        assertEquals(Long.MAX_VALUE, props.get("long"));
-        assertEquals(-1L, props.get("long2"));
-        assertEquals(Double.MAX_VALUE, props.get("double"));
-        assertEquals(1.0d, props.get("Double2"));
-        assertEquals(42.24f, props.get("float"));
-        assertEquals(1.0f, props.get("Float2"));
-        assertEquals(17, props.get("int"));
-        assertEquals(42, props.get("Integer2"));
-        assertEquals((byte) 127, props.get("byte"));
-        assertEquals((byte) -128, props.get("Byte2"));
-        assertEquals(Boolean.TRUE, props.get("boolean"));
-        assertEquals(Boolean.TRUE, props.get("Boolean2"));
-        assertEquals((short) 99, props.get("short"));
-        assertEquals((short) -99, props.get("Short2"));
-        assertEquals('@', props.get("char"));
-        assertEquals('X', props.get("Character2"));
-
-        int[] intArray = (int[]) props.get("int-array");
-        assertTrue(Arrays.equals(new int[] {1, 2}, intArray));
-
-        Integer[] integerArray = (Integer[]) props.get("Integer-array");
-        assertTrue(Arrays.equals(new Integer[] {2, 1}, integerArray));
-
-        assertEquals(Arrays.asList(true, false), props.get("bool-list"));
-        assertEquals(new HashSet<Object>(), props.get("long-set"));
-        Set<String> stringSet = new HashSet<String>();
-        stringSet.add("Hello there");
-        stringSet.add("How are you?");
-        assertEquals(stringSet, props.get("string-set"));
-        assertEquals("Hello", props.get("other1").toString().trim());
-
-        List<?> l = (List<?>) props.get("other2");
-        assertEquals(1, l.size());
-        assertEquals(Utils.normXML("<other:t2 xmlns:other='http://www.acme.org/xmlns/other/v1.0.0' " 
-                                   + "xmlns='http://www.osgi.org/xmlns/rsa/v1.0.0'/>"),
-                                   Utils.normXML((String) l.get(0)));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/test/java/org/apache/cxf/dosgi/endpointdesc/EndpointDescriptionParserTest.java
----------------------------------------------------------------------
diff --git a/discovery/local/src/test/java/org/apache/cxf/dosgi/endpointdesc/EndpointDescriptionParserTest.java b/discovery/local/src/test/java/org/apache/cxf/dosgi/endpointdesc/EndpointDescriptionParserTest.java
deleted file mode 100644
index 97e4b45..0000000
--- a/discovery/local/src/test/java/org/apache/cxf/dosgi/endpointdesc/EndpointDescriptionParserTest.java
+++ /dev/null
@@ -1,49 +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.endpointdesc;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.List;
-
-import org.easymock.EasyMock;
-import org.junit.Assert;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.xmlns.rsa.v1_0.EndpointDescriptionType;
-
-public class EndpointDescriptionParserTest {
-
-    @Test
-    public void testNoRemoteServicesXMLFiles() {
-        Bundle b = EasyMock.createNiceMock(Bundle.class);
-        EasyMock.replay(b);
-
-        List<EndpointDescriptionType> rsElements = new EndpointDescriptionBundleParser().getAllDescriptionElements(b);
-        Assert.assertEquals(0, rsElements.size());
-    }
-
-    @Test
-    public void testEndpointDescriptionsFromURL() throws IOException {
-        URL ed1URL = getClass().getResource("/ed1.xml");
-        List<EndpointDescriptionType> edElements = new EndpointDescriptionParser().
-            getEndpointDescriptions(ed1URL.openStream());
-        Assert.assertEquals(4, edElements.size());
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/test/java/org/apache/cxf/dosgi/endpointdesc/PropertiesMapperTest.java
----------------------------------------------------------------------
diff --git a/discovery/local/src/test/java/org/apache/cxf/dosgi/endpointdesc/PropertiesMapperTest.java b/discovery/local/src/test/java/org/apache/cxf/dosgi/endpointdesc/PropertiesMapperTest.java
deleted file mode 100644
index bc21198..0000000
--- a/discovery/local/src/test/java/org/apache/cxf/dosgi/endpointdesc/PropertiesMapperTest.java
+++ /dev/null
@@ -1,97 +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.endpointdesc;
-
-import java.io.ByteArrayInputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.xml.sax.InputSource;
-
-import org.custommonkey.xmlunit.XMLAssert;
-import org.junit.Test;
-import org.osgi.xmlns.rsa.v1_0.EndpointDescriptionType;
-import org.osgi.xmlns.rsa.v1_0.PropertyType;
-
-public class PropertiesMapperTest {
-    private static final String LF = "\n";
-
-    @Test
-    public void testCreateXML() throws Exception {
-        Map<String, Object> m = new LinkedHashMap<String, Object>();
-        m.put("service.imported.configs", "org.apache.cxf.ws");
-        m.put("endpoint.id", "foo:bar");
-        m.put("objectClass", new String[] {"com.acme.HelloService", "some.other.Service"});
-        m.put("SomeObject", new Object());
-        m.put("long", 9223372036854775807L);
-        m.put("Long2", -1L);
-        m.put("double", 1.7976931348623157E308);
-        m.put("Double2", 1.0d);
-        m.put("float", 42.24f);
-        m.put("Float2", 1.0f);
-        m.put("int", 17);
-        m.put("Integer2", 42);
-        m.put("byte", (byte) 127);
-        m.put("Byte2", (byte) -128);
-        m.put("boolean", true);
-        m.put("Boolean2", false);
-        m.put("short", (short) 99);
-        m.put("Short2", (short) -99);
-        m.put("char", '@');
-        m.put("Character2", 'X');
-
-        List<Boolean> boolList = new ArrayList<Boolean>();
-        boolList.add(true);
-        boolList.add(false);
-        m.put("bool-list", boolList);
-        m.put("empty-set", new HashSet<Object>());
-
-        Set<String> stringSet = new LinkedHashSet<String>();
-        stringSet.add("Hello there");
-        stringSet.add("How are you?");
-        m.put("string-set", stringSet);
-
-        int[] intArray = new int[] {1, 2};
-        m.put("int-array", intArray);
-
-        String xml = "<xml>" + LF
-            + "<t1 xmlns=\"http://www.acme.org/xmlns/other/v1.0.0\">" + LF
-            + "<foo type='bar'>haha</foo>" + LF
-            + "</t1>" + LF
-            + "</xml>";
-        m.put("someXML", xml);
-
-        List<PropertyType> props = new PropertiesMapper().fromProps(m);
-        EndpointDescriptionType epd = new EndpointDescriptionType();
-        epd.getProperty().addAll(props);
-        byte[] epData = new EndpointDescriptionParser().getData(epd);
-
-        URL edURL = getClass().getResource("/ed2-generated.xml");
-        InputSource expectedXml = new InputSource(edURL.openStream());
-        InputSource actualXml = new InputSource(new ByteArrayInputStream(epData)); 
-        XMLAssert.assertXMLEqual(expectedXml, actualXml);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/test/resources/ed1.xml
----------------------------------------------------------------------
diff --git a/discovery/local/src/test/resources/ed1.xml b/discovery/local/src/test/resources/ed1.xml
deleted file mode 100644
index 95b1994..0000000
--- a/discovery/local/src/test/resources/ed1.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-
-<endpoint-descriptions xmlns="http://www.osgi.org/xmlns/rsa/v1.0.0"
-  xmlns:other="http://www.acme.org/xmlns/other/v1.0.0">
-  <endpoint-description>
-    <property name="objectClass">
-      <array>
-        <value>SomeService</value>
-      </array>
-    </property>
-    <property name="osgi.remote.requires.intents">
-      <list>
-        <value>confidentiality</value>
-      </list>
-    </property>
-    <property name="testKey" value="testValue"/>
-    <property name="endpoint.id">http://somewhere:12345</property>
-    <property name="service.imported.configs" value="org.apache.cxf.ws"/>
-  </endpoint-description>
-
-  <endpoint-description>
-    <property name="objectClass">
-      <array>
-        <value>SomeOtherService</value>
-        <value>WithSomeSecondInterface</value>
-      </array>
-    </property>
-    <property name="endpoint.id" value-type="String" value="myScheme://somewhere:12345" />
-    <property name="service.imported.configs" value="org.apache.cxf.ws"/>
-  </endpoint-description>
-
-  <endpoint-description>
-    <property name="objectClass" value-type="String">
-      <array>
-        <value>SomeOtherService</value>
-        <value>WithSomeSecondInterface</value>
-      </array>
-    </property>
-    <property name="endpoint.id" value="http://somewhere" />
-    <property name="service.imported.configs" value="org.apache.cxf.ws"/>
-  </endpoint-description>
-
-  <endpoint-description>
-    <property name="objectClass">
-      <array>
-        <value>SomeOtherService</value>
-        <value>WithSomeSecondInterface</value>
-      </array>
-    </property>
-    <property name="endpoint.id" value-type="String">http://somewhere:1/2/3/4?5</property>
-    <property name="service.imported.configs" value="org.apache.cxf.ws"/>
-  </endpoint-description>
-</endpoint-descriptions>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/test/resources/ed2-generated.xml
----------------------------------------------------------------------
diff --git a/discovery/local/src/test/resources/ed2-generated.xml b/discovery/local/src/test/resources/ed2-generated.xml
deleted file mode 100644
index 5e2a5ef..0000000
--- a/discovery/local/src/test/resources/ed2-generated.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<endpoint-descriptions xmlns="http://www.osgi.org/xmlns/rsa/v1.0.0">
-    <endpoint-description>
-        <property name="service.imported.configs" value="org.apache.cxf.ws" />
-        <property name="endpoint.id" value="foo:bar" />
-        <property name="objectClass">
-            <array>
-                <value>com.acme.HelloService</value>
-                <value>some.other.Service</value>
-            </array>
-        </property>
-        <property name="long" value-type="Long" value="9223372036854775807" />
-        <property name="Long2" value-type="Long" value="-1" />
-        <property name="double" value-type="Double"
-            value="1.7976931348623157E308" />
-        <property name="Double2" value-type="Double" value="1.0" />
-        <property name="float" value-type="Float" value="42.24" />
-        <property name="Float2" value-type="Float" value="1.0" />
-        <property name="int" value-type="Integer" value="17" />
-        <property name="Integer2" value-type="Integer" value="42" />
-        <property name="byte" value-type="Byte" value="127" />
-        <property name="Byte2" value-type="Byte" value="-128" />
-        <property name="boolean" value-type="Boolean" value="true" />
-        <property name="Boolean2" value-type="Boolean" value="false" />
-        <property name="short" value-type="Short" value="99" />
-        <property name="Short2" value-type="Short" value="-99" />
-        <property name="char" value-type="Character" value="@" />
-        <property name="Character2" value-type="Character"
-            value="X" />
-        <property name="bool-list" value-type="Boolean">
-            <list>
-                <value>true</value>
-                <value>false</value>
-            </list>
-        </property>
-        <property name="empty-set">
-            <set />
-        </property>
-        <property name="string-set">
-            <set>
-                <value>Hello there</value>
-                <value>How are you?</value>
-            </set>
-        </property>
-        <property name="int-array" value-type="Integer">
-            <array>
-                <value>1</value>
-                <value>2</value>
-            </array>
-        </property>
-        <property name="someXML"
-            value="&lt;xml&gt;&#xA;&lt;t1 xmlns=&quot;http://www.acme.org/xmlns/other/v1.0.0&quot;&gt;&#xA;&lt;foo type='bar'&gt;haha&lt;/foo&gt;&#xA;&lt;/t1&gt;&#xA;&lt;/xml&gt;" />
-    </endpoint-description>
-</endpoint-descriptions>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/test/resources/ed2.xml
----------------------------------------------------------------------
diff --git a/discovery/local/src/test/resources/ed2.xml b/discovery/local/src/test/resources/ed2.xml
deleted file mode 100644
index e3c42b9..0000000
--- a/discovery/local/src/test/resources/ed2.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<endpoint-descriptions xmlns="http://www.osgi.org/xmlns/rsa/v1.0.0"
-  xmlns:other="http://www.acme.org/xmlns/other/v1.0.0">
-  <endpoint-description>
-    <property name="objectClass">
-      <array>
-        <value>com.acme.HelloService</value>
-      </array>
-    </property>
-    <property name="service.intents">SOAP</property>
-    <property name="service.imported.configs" value="org.apache.cxf.ws"/>
-    <property name="endpoint.id">foo:bar</property>
-  </endpoint-description>
-  <endpoint-description>
-    <property name="service.imported.configs" value="org.apache.cxf.ws"/>
-    <property name="endpoint.id">foo:bar</property>
-    <property name="objectClass" value-type="String">
-      <array>
-        <value>com.acme.HelloService</value>
-        <value>some.other.Service</value>
-      </array>
-    </property>
-
-    <property name="someXML" value-type="String">
-      <!-- Literal XML to be parsed into the String -->
-      <xml>
-        <other:t1 xmlns="http://www.acme.org/xmlns/other/v1.0.0">
-          <foo type="bar">haha</foo>
-        </other:t1>
-      </xml>
-    </property>
-
-    <property name="long" value-type="long">9223372036854775807</property>
-    <property name="Long2" value-type="Long" value="-1"/>
-    <property name="double" value-type="double">1.7976931348623157E308</property>
-    <property name="Double2" value-type="Double">1.0</property>
-    <property name="float" value-type="float">42.24</property>
-    <property name="Float2" value-type="Float" value="1.0"/>
-    <property name="int" value-type="int">17</property>
-    <property name="Integer2" value-type="Integer" value="42"/>
-    <property name="byte" value-type="byte">127</property>
-    <property name="Byte2" value-type="Byte" value="-128"/>
-    <property name="boolean" value-type="boolean">true</property>
-    <property name="Boolean2" value-type="Boolean" value="true"/>
-    <property name="short" value-type="short">99</property>
-    <property name="Short2" value-type="Short" value="-99"/>
-    <property name="char" value-type="char">@</property>
-    <property name="Character2" value-type="Character" value="X"/>
-
-    <property name="bool-list" value-type="boolean">
-      <list>
-        <value>true</value>
-        <value>false</value>
-      </list>
-    </property>
-    <property name="long-set" value-type="long">
-      <set/> <!-- empty set -->
-    </property>
-    <property name="string-set">
-      <set>
-        <value>Hello there</value>
-        <value>How are you?</value>
-      </set>
-    </property>
-    <property name="int-array" value-type="int">
-      <array>
-        <value>1</value>
-        <value>2</value>
-      </array>
-    </property>
-    <property name="Integer-array" value-type="Integer">
-      <array>
-        <value>2</value>
-        <value>1</value>
-      </array>
-    </property>
-    <property name="service.exported.configs">
-      org.apache.cxf.ws
-    </property>
-
-    <property name="other1">
-        Hello
-      <other:t1/>
-      <!-- the above tag is a custom extension -->
-    </property>
-    <property name="other2">
-      <list>
-        <value>
-          <!-- A value specified as literal XML -->
-          <xml>
-            <other:t2/>
-          </xml>
-        </value>
-      </list>
-      <!-- This is a custom extension -->
-      <other:t1/>
-    </property>
-  </endpoint-description>
-</endpoint-descriptions>


[02/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

Posted by cs...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/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
deleted file mode 100644
index 9057e46..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java
+++ /dev/null
@@ -1,278 +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;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-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.AbstractFeature;
-import org.apache.cxf.feature.Feature;
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class IntentManagerImplTest extends Assert {
-
-    @Test
-    public void testIntents() throws Exception {
-        Map<String, Object> intents = new HashMap<String, Object>();
-        intents.put("A", new TestFeature("A"));
-        intents.put("SOAP", new TestFeature("SOAP"));
-        final IntentMap intentMap = new IntentMap(intents);
-
-        IMocksControl control = EasyMock.createNiceControl();
-        List<Feature> features = new ArrayList<Feature>();
-        AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
-        control.replay();
-
-        IntentManager intentManager = new IntentManagerImpl(intentMap, 10000);
-
-        Map<String, Object> props = new HashMap<String, Object>();
-        props.put("osgi.remote.requires.intents", "A");
-
-        List<String> effectiveIntents = Arrays.asList(intentManager.applyIntents(features, factory, props));
-        assertEquals(Arrays.asList("A", "SOAP"), effectiveIntents);
-    }
-
-    @Test
-    public void testMultiIntents() {
-        final IntentMap intentMap = new IntentMap(new DefaultIntentMapFactory().create());
-        intentMap.put("confidentiality.message", new TestFeature("confidentiality.message"));
-        intentMap.put("transactionality", new TestFeature("transactionality"));
-
-        IMocksControl control = EasyMock.createNiceControl();
-        List<Feature> features = new ArrayList<Feature>();
-        AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
-        control.replay();
-
-        IntentManager intentManager = new IntentManagerImpl(intentMap);
-
-        Map<String, Object> props = new HashMap<String, Object>();
-        props.put("osgi.remote.requires.intents", "transactionality confidentiality.message");
-
-        List<String> effectiveIntents = Arrays.asList(intentManager.applyIntents(features, factory, props));
-        assertTrue(effectiveIntents.contains("transactionality"));
-        assertTrue(effectiveIntents.contains("confidentiality.message"));
-    }
-
-    @Test
-    public void testFailedIntent() {
-        Map<String, Object> intents = new HashMap<String, Object>();
-        intents.put("A", new TestFeature("A"));
-        final IntentMap intentMap = new IntentMap(intents);
-
-        IMocksControl control = EasyMock.createNiceControl();
-        List<Feature> features = new ArrayList<Feature>();
-        AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
-        control.replay();
-
-        IntentManager intentManager = new IntentManagerImpl(intentMap);
-
-        Map<String, Object> props = new HashMap<String, Object>();
-        props.put("osgi.remote.requires.intents", "A B");
-        // ServiceEndpointDescription sd =
-        //         new ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
-
-        try {
-            intentManager.applyIntents(features, factory, props);
-            Assert.fail("applyIntents() should have thrown an exception as there was an unsatisfiable intent");
-        } catch (IntentUnsatisfiedException iue) {
-            assertEquals("B", iue.getIntent());
-        }
-    }
-
-    @Test
-    public void testInferIntents() {
-        Map<String, Object> intents = new HashMap<String, Object>();
-        intents.put("SOAP", new TestFeature("SOAP"));
-        intents.put("Prov", "PROVIDED");
-        AbstractFeature feat1 = new TestFeature("feat1");
-        intents.put("A", feat1);
-        intents.put("A_alt", feat1);
-        intents.put("B", new TestFeature("B"));
-        final IntentMap intentMap = new IntentMap(intents);
-
-        IMocksControl control = EasyMock.createNiceControl();
-        List<Feature> features = new ArrayList<Feature>();
-        AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
-        control.replay();
-
-        IntentManager intentManager = new IntentManagerImpl(intentMap);
-
-        Map<String, Object> props = new HashMap<String, Object>();
-        props.put("osgi.remote.requires.intents", "A");
-        // ServiceEndpointDescription sd =
-        //         new ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
-
-        List<String> effectiveIntents = Arrays.asList(intentManager.applyIntents(features, factory, props));
-        assertEquals(4, effectiveIntents.size());
-        assertTrue(effectiveIntents.contains("Prov"));
-        assertTrue(effectiveIntents.contains("A"));
-        assertTrue(effectiveIntents.contains("A_alt"));
-    }
-
-    @Test
-    public void testDefaultBindingIntent() {
-        IMocksControl control = EasyMock.createNiceControl();
-
-        Map<String, Object> intents = new HashMap<String, Object>();
-        BindingConfiguration feat1 = control.createMock(BindingConfiguration.class);
-        intents.put("A", new AbstractFeature() {
-        });
-        intents.put("SOAP", feat1);
-        intents.put("SOAP.1_1", feat1);
-        intents.put("SOAP.1_2", control.createMock(BindingConfiguration.class));
-        final IntentMap intentMap = new IntentMap(intents);
-
-        List<Feature> features = new ArrayList<Feature>();
-        AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
-        control.replay();
-        IntentManager intentManager = new IntentManagerImpl(intentMap);
-
-        Map<String, Object> props = new HashMap<String, Object>();
-        props.put("osgi.remote.requires.intents", "A");
-        // ServiceEndpointDescription sd =
-        //         new ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
-
-        List<String> effectiveIntents = Arrays.asList(intentManager.applyIntents(features, factory, props));
-        assertEquals(3, effectiveIntents.size());
-        assertTrue(effectiveIntents.contains("A"));
-        assertTrue(effectiveIntents.contains("SOAP"));
-        assertTrue(effectiveIntents.contains("SOAP.1_1"));
-    }
-
-    @Test
-    public void testExplicitBindingIntent() {
-        IMocksControl control = EasyMock.createNiceControl();
-
-        Map<String, Object> intents = new HashMap<String, Object>();
-        BindingConfiguration feat1 = control.createMock(BindingConfiguration.class);
-        intents.put("A", new AbstractFeature() {
-        });
-        intents.put("SOAP", feat1);
-        intents.put("SOAP.1_1", feat1);
-        intents.put("SOAP.1_2", control.createMock(BindingConfiguration.class));
-        final IntentMap intentMap = new IntentMap(intents);
-
-        List<Feature> features = new ArrayList<Feature>();
-        AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
-        control.replay();
-
-        IntentManager intentManager = new IntentManagerImpl(intentMap);
-
-        Map<String, Object> props = new HashMap<String, Object>();
-        props.put("osgi.remote.requires.intents", "A SOAP.1_2");
-        // ServiceEndpointDescription sd =
-        //         new ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
-
-        List<String> effectiveIntents = Arrays.asList(intentManager.applyIntents(features, factory, props));
-        assertEquals(2, effectiveIntents.size());
-        assertTrue(effectiveIntents.contains("A"));
-        assertTrue(effectiveIntents.contains("SOAP.1_2"));
-    }
-
-    public void testInheritMasterIntentMapDefault() {
-        List<String> features = runTestInheritMasterIntentMap("A B");
-
-        assertEquals(2, features.size());
-        assertTrue(features.contains("appFeatureA"));
-        assertTrue(features.contains("masterFeatureB"));
-    }
-
-    public void testInheritMasterIntentMap() {
-        List<String> features = runTestInheritMasterIntentMap("A B");
-
-        assertEquals(2, features.size());
-        assertTrue(features.contains("appFeatureA"));
-        assertTrue(features.contains("masterFeatureB"));
-    }
-
-    private List<String> runTestInheritMasterIntentMap(String requestedIntents) {
-        Map<String, Object> masterIntents = new HashMap<String, Object>();
-        masterIntents.put("A", new TestFeature("masterFeatureA"));
-        masterIntents.put("B", new TestFeature("masterFeatureB"));
-        final IntentMap intentMap = new IntentMap(masterIntents);
-        intentMap.put("A", new TestFeature("appFeatureA"));
-
-        IMocksControl control = EasyMock.createNiceControl();
-        List<Feature> features = new ArrayList<Feature>();
-        AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
-        control.replay();
-
-        Map<String, Object> props = new HashMap<String, Object>();
-        props.put("osgi.remote.requires.intents", requestedIntents);
-
-        IntentManagerImpl intentManager = new IntentManagerImpl(intentMap);
-        intentManager.applyIntents(features, factory, props);
-
-        List<String> featureNames = new ArrayList<String>();
-        for (Feature f : features) {
-            featureNames.add(f.toString());
-        }
-        return featureNames;
-    }
-
-    @Test
-    public void testProvidedIntents() {
-        Map<String, Object> masterIntents = new HashMap<String, Object>();
-        masterIntents.put("SOAP", "SOAP");
-        masterIntents.put("A", "Provided");
-        masterIntents.put("B", "PROVIDED");
-        final IntentMap intentMap = new IntentMap(masterIntents);
-
-        IMocksControl control = EasyMock.createNiceControl();
-        List<Feature> features = new ArrayList<Feature>();
-        AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
-        control.replay();
-
-        Map<String, Object> props = new HashMap<String, Object>();
-        props.put("osgi.remote.requires.intents", "B A");
-
-        IntentManager intentManager = new IntentManagerImpl(intentMap);
-
-        Set<String> effectiveIntents = new HashSet<String>(Arrays.asList(intentManager.applyIntents(features,
-                                                                                                    factory,
-                                                                                                    props)));
-        Set<String> expectedIntents = new HashSet<String>(Arrays.asList(new String[] {"A", "B", "SOAP"}));
-        assertEquals(expectedIntents, effectiveIntents);
-    }
-
-    private static final class TestFeature extends AbstractFeature {
-
-        private final String name;
-
-        private TestFeature(String n) {
-            name = n;
-        }
-
-        @Override
-        public String toString() {
-            return name;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/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
deleted file mode 100644
index 748da85..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentMapTest.java
+++ /dev/null
@@ -1,41 +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;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class IntentMapTest {
-
-    @Test
-    public void inheritanceTest() {
-        Map<String, Object> defaultMap = new HashMap<String, Object>();
-        defaultMap.put("key1", "defaultValue");
-        IntentMap intentMap = new IntentMap(defaultMap);
-        Assert.assertEquals("defaultValue", intentMap.get("key1"));
-        intentMap.put("key1", "overridden");
-        Assert.assertEquals("overridden", intentMap.get("key1"));
-        Object curValue = intentMap.remove("key1");
-        Assert.assertEquals("overridden", curValue);
-        Assert.assertEquals("defaultValue", intentMap.get("key1"));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/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
deleted file mode 100644
index b68cf61..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentTrackerTest.java
+++ /dev/null
@@ -1,80 +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;
-
-import org.apache.cxf.dosgi.dsw.Constants;
-import org.apache.cxf.feature.AbstractFeature;
-import org.easymock.Capture;
-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;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-
-import static org.easymock.EasyMock.expect;
-
-public class IntentTrackerTest {
-
-    private static final String MY_INTENT_NAME = "myIntent";
-
-    @Test
-    public void testIntentAsService() throws InvalidSyntaxException {
-        IMocksControl c = EasyMock.createControl();
-        BundleContext bc = c.createMock(BundleContext.class);
-        Filter filter = c.createMock(Filter.class);
-        expect(bc.createFilter(EasyMock.<String>anyObject())).andReturn(filter);
-        final Capture<ServiceListener> capturedListener = EasyMock.newCapture();
-        bc.addServiceListener(EasyMock.capture(capturedListener), EasyMock.<String>anyObject());
-        EasyMock.expectLastCall().atLeastOnce();
-        expect(bc.getServiceReferences(EasyMock.<String>anyObject(),
-                                       EasyMock.<String>anyObject())).andReturn(new ServiceReference[]{});
-        IntentMap intentMap = new IntentMap();
-
-        // Create a custom intent
-        @SuppressWarnings("unchecked")
-        ServiceReference<AbstractFeature> reference = c.createMock(ServiceReference.class);
-        expect(reference.getProperty(Constants.INTENT_NAME_PROP)).andReturn(MY_INTENT_NAME);
-        AbstractFeature testIntent = new AbstractFeature() {
-        };
-        expect(bc.getService(reference)).andReturn(testIntent).atLeastOnce();
-
-        c.replay();
-
-        IntentTracker tracker = new IntentTracker(bc, intentMap);
-        tracker.open();
-
-        Assert.assertFalse("IntentMap should not contain " + MY_INTENT_NAME, intentMap.containsKey(MY_INTENT_NAME));
-        ServiceListener listener = capturedListener.getValue();
-
-        // Simulate adding custom intent service
-        ServiceEvent event = new ServiceEvent(ServiceEvent.REGISTERED, reference);
-        listener.serviceChanged(event);
-
-        // our custom intent should now be available
-        Assert.assertTrue("IntentMap should contain " + MY_INTENT_NAME, intentMap.containsKey(MY_INTENT_NAME));
-        Assert.assertEquals(testIntent, intentMap.get(MY_INTENT_NAME));
-
-        c.verify();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentUtilsTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentUtilsTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentUtilsTest.java
deleted file mode 100644
index f7fe844..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentUtilsTest.java
+++ /dev/null
@@ -1,70 +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;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.cxf.dosgi.dsw.Constants;
-import org.junit.Assert;
-import org.junit.Test;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
-public class IntentUtilsTest {
-
-    @Test
-    public void testMergeArrays() {
-        Assert.assertNull(IntentUtils.mergeArrays(null, null));
-
-        String[] sa1 = {};
-        Assert.assertEquals(0, IntentUtils.mergeArrays(sa1, null).length);
-
-        String[] sa2 = {"X"};
-        Assert.assertEquals(1, IntentUtils.mergeArrays(null, sa2).length);
-        Assert.assertEquals("X", IntentUtils.mergeArrays(null, sa2)[0]);
-
-        String[] sa3 = {"Y", "Z"};
-        String[] sa4 = {"A", "Z"};
-        Assert.assertEquals(3, IntentUtils.mergeArrays(sa3, sa4).length);
-        Assert.assertEquals(new HashSet<String>(Arrays.asList("A", "Y", "Z")),
-                new HashSet<String>(Arrays.asList(IntentUtils.mergeArrays(sa3, sa4))));
-    }
-
-    @SuppressWarnings("deprecation")
-    @Test
-    public void testRequestedIntents() {
-        Map<String, Object> props = new HashMap<String, Object>();
-        Assert.assertEquals(0, IntentUtils.getRequestedIntents(props).size());
-
-        props.put(RemoteConstants.SERVICE_EXPORTED_INTENTS, "one");
-        Assert.assertEquals(Collections.singleton("one"), IntentUtils.getRequestedIntents(props));
-
-        props.put(RemoteConstants.SERVICE_EXPORTED_INTENTS_EXTRA, new String[] {"two", "three"});
-        Set<String> expected1 = new HashSet<String>(Arrays.asList("one", "two", "three"));
-        Assert.assertEquals(expected1, IntentUtils.getRequestedIntents(props));
-
-        props.put(Constants.EXPORTED_INTENTS_OLD, "A B C");
-        Set<String> expected2 = new HashSet<String>(Arrays.asList("one", "two", "three", "A", "B", "C"));
-        Assert.assertEquals(expected2, IntentUtils.getRequestedIntents(props));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/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
deleted file mode 100644
index cc15ea6..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/OsgiUtilsTest.java
+++ /dev/null
@@ -1,152 +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.util;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.Version;
-import org.osgi.service.packageadmin.ExportedPackage;
-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() {
-        assertEquals(Collections.singleton("hi"),
-            OsgiUtils.getMultiValueProperty("hi"));
-    }
-
-    public void testMultiValuePropertyAsArray() {
-        assertEquals(Arrays.asList("a", "b"),
-                OsgiUtils.getMultiValueProperty(new String[] {"a", "b"}));
-    }
-
-    public void testMultiValuePropertyAsCollection() {
-        List<String> list = new ArrayList<String>();
-        list.add("1");
-        list.add("2");
-        list.add("3");
-        assertEquals(list, OsgiUtils.getMultiValueProperty(list));
-    }
-
-    public void testMultiValuePropertyNull() {
-        assertNull(OsgiUtils.getMultiValueProperty(null));
-    }
-
-    @SuppressWarnings({
-     "rawtypes", "unchecked"
-    })
-    public void testGetVersion() {
-        IMocksControl c = EasyMock.createNiceControl();
-        BundleContext bc = c.createMock(BundleContext.class);
-        ServiceReference sref = c.createMock(ServiceReference.class);
-        PackageAdmin pa = c.createMock(PackageAdmin.class);
-        Bundle b = c.createMock(Bundle.class);
-
-        EasyMock.expect(bc.getServiceReference(EasyMock.eq(PackageAdmin.class))).andReturn(sref);
-        EasyMock.expect(bc.getService(EasyMock.eq(sref))).andReturn(pa);
-
-        Class<?> iClass = CharSequence.class;
-
-        c.replay();
-        // version 0.0.0 because of missing bundle
-
-        assertEquals("0.0.0", OsgiUtils.getVersion(iClass, bc));
-
-        c.verify();
-        c.reset();
-        // version 1.2.3
-
-        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);
-
-        ExportedPackage[] exP = new ExportedPackage[] {new MyExportedPackage(iClass.getPackage(), "1.2.3"),
-                                                       new MyExportedPackage(String.class.getPackage(), "4.5.6") };
-
-        EasyMock.expect(pa.getExportedPackages(EasyMock.eq(b))).andReturn(exP).atLeastOnce();
-
-        c.replay();
-        assertEquals("1.2.3", OsgiUtils.getVersion(iClass, bc));
-        c.verify();
-    }
-
-    private static class MyExportedPackage implements ExportedPackage {
-
-        Package package1;
-        String version;
-
-        MyExportedPackage(Package package1, String version) {
-            this.package1 = package1;
-            this.version = version;
-        }
-
-        public Bundle getExportingBundle() {
-            return null;
-        }
-
-        public Bundle[] getImportingBundles() {
-            return null;
-        }
-
-        public String getName() {
-            return package1.getName();
-        }
-
-        public String getSpecificationVersion() {
-            return null;
-        }
-
-        public Version getVersion() {
-            return new Version(version);
-        }
-
-        public boolean isRemovalPending() {
-            return false;
-        }
-    }
-
-    public void testGetProperty() {
-        Map<String, Object> p = new HashMap<String, Object>();
-        p.put(RemoteConstants.ENDPOINT_ID, "http://google.de");
-        p.put("notAString", new Object());
-        p.put(org.osgi.framework.Constants.OBJECTCLASS, new String[]{"my.class"});
-        p.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, new String[]{"my.config"});
-
-        EndpointDescription endpoint = new EndpointDescription(p);
-
-        assertNull(OsgiUtils.getProperty(endpoint, "unknownProp"));
-        assertEquals(p.get(RemoteConstants.ENDPOINT_ID), OsgiUtils.getProperty(endpoint, RemoteConstants.ENDPOINT_ID));
-        assertEquals(null, OsgiUtils.getProperty(endpoint, "notAString"));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/Provider.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/Provider.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/Provider.java
deleted file mode 100644
index ecd7c78..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/Provider.java
+++ /dev/null
@@ -1,23 +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.util;
-
-
-public class Provider {
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/resources/OSGI-INF/remote-service/alt-remote-services.xml
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/resources/OSGI-INF/remote-service/alt-remote-services.xml b/dsw/cxf-dsw/src/test/resources/OSGI-INF/remote-service/alt-remote-services.xml
deleted file mode 100644
index 36409ce..0000000
--- a/dsw/cxf-dsw/src/test/resources/OSGI-INF/remote-service/alt-remote-services.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-
-<service-descriptions xmlns="http://www.osgi.org/xmlns/sd/v1.0.0">
-  <service-description>
-    <provide interface="org.apache.cxf.dosgi.dsw.hooks.TestService" />
-    <provide interface="org.apache.cxf.dosgi.dsw.hooks.CxfPublishHookTest$AdditionalInterface" />
-
-    <property name="osgi.remote.interfaces" value="*" />
-    <property name="osgi.remote.requires.intents" value="SOAP HTTP" />
-    <property name="osgi.remote.configuration.type" value="pojo" />
-    <property name="osgi.remote.configuration.pojo.address" value="http://localhost:9000/hello" />
-  </service-description>
-</service-descriptions>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/resources/OSGI-INF/remote-service/multi-services.xml
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/resources/OSGI-INF/remote-service/multi-services.xml b/dsw/cxf-dsw/src/test/resources/OSGI-INF/remote-service/multi-services.xml
deleted file mode 100644
index 3d20c08..0000000
--- a/dsw/cxf-dsw/src/test/resources/OSGI-INF/remote-service/multi-services.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-
-<service-descriptions xmlns="http://www.osgi.org/xmlns/sd/v1.0.0">
-  <service-description>
-    <provide interface="org.apache.cxf.dosgi.dsw.hooks.TestService" />
-    <provide interface="org.apache.cxf.dosgi.dsw.hooks.CxfPublishHookTest$AdditionalInterface" />
-    <property name="osgi.remote.interfaces">org.apache.cxf.dosgi.dsw.hooks.TestService,org.apache.cxf.dosgi.dsw.hooks.CxfPublishHookTest$AdditionalInterface</property>
-    <property name="osgi.remote.requires.intents">SOAP HTTP</property>
-    <property name="osgi.remote.configuration.type">pojo</property>
-    <property name="osgi.remote.configuration.pojo.address"
-              interface="org.apache.cxf.dosgi.dsw.hooks.TestService">
-      http://localhost:9001/hello
-    </property>
-    <property name="osgi.remote.configuration.pojo.address"
-              interface="org.apache.cxf.dosgi.dsw.hooks.CxfPublishHookTest$AdditionalInterface">
-      http://localhost:9002/hello
-    </property>
-  </service-description>
-</service-descriptions>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/resources/OSGI-INF/remote-service/remote-services.xml
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/resources/OSGI-INF/remote-service/remote-services.xml b/dsw/cxf-dsw/src/test/resources/OSGI-INF/remote-service/remote-services.xml
deleted file mode 100644
index 45b2a20..0000000
--- a/dsw/cxf-dsw/src/test/resources/OSGI-INF/remote-service/remote-services.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-
-<service-descriptions xmlns="http://www.osgi.org/xmlns/sd/v1.0.0">
-  <service-description>
-    <provide interface="org.apache.cxf.dosgi.dsw.hooks.TestService" />
-    <provide interface="org.apache.cxf.dosgi.dsw.hooks.CxfPublishHookTest$AdditionalInterface" />
-
-    <property name="osgi.remote.interfaces">*</property>
-    <property name="osgi.remote.requires.intents">SOAP HTTP</property>
-    <property name="osgi.remote.configuration.type">pojo</property>
-    <property name="osgi.remote.configuration.pojo.address">http://localhost:9000/hello</property>
-  </service-description>
-</service-descriptions>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/resources/test-resources/rs1.xml
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/resources/test-resources/rs1.xml b/dsw/cxf-dsw/src/test/resources/test-resources/rs1.xml
deleted file mode 100644
index f67a833..0000000
--- a/dsw/cxf-dsw/src/test/resources/test-resources/rs1.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-
-<service-descriptions xmlns="http://www.osgi.org/xmlns/sd/v1.0.0">
-  <service-description>
-    <provide interface="SomeService" />
-    <property name="osgi.remote.requires.intents">confidentiality</property>
-  </service-description>
-  <service-description>
-    <provide interface="SomeOtherService" />
-    <provide interface="WithSomeSecondInterface" />
-  </service-description>
-</service-descriptions>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/resources/test-resources/rs2.xml
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/resources/test-resources/rs2.xml b/dsw/cxf-dsw/src/test/resources/test-resources/rs2.xml
deleted file mode 100644
index 098aa21..0000000
--- a/dsw/cxf-dsw/src/test/resources/test-resources/rs2.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-
-<service-descriptions xmlns="http://www.osgi.org/xmlns/sd/v1.0.0">
-  <service-description>
-    <provide interface="org.example.Service" />
-    <property name="deployment.intents">confidentiality.message integrity</property>
-    <property name="osgi.remote.interfaces">*</property>
-  </service-description>
-</service-descriptions>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/resources/test-resources/sd-1.xml
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/resources/test-resources/sd-1.xml b/dsw/cxf-dsw/src/test/resources/test-resources/sd-1.xml
deleted file mode 100644
index 483b196..0000000
--- a/dsw/cxf-dsw/src/test/resources/test-resources/sd-1.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-<test>
-  <some-other-tag/>
-</test>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/resources/test-resources/sd.xml
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/resources/test-resources/sd.xml b/dsw/cxf-dsw/src/test/resources/test-resources/sd.xml
deleted file mode 100644
index c7cebfb..0000000
--- a/dsw/cxf-dsw/src/test/resources/test-resources/sd.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<service-decorations xmlns="http://cxf.apache.org/xmlns/service-decoration/1.0.0">
-  <service-decoration>
-    <match interface="org.acme.foo.*">
-      <match-property name="test.prop" value="xyz"/>
-      <add-property name="test.too" value="ahaha" type="java.lang.String"/>
-    </match>
-  </service-decoration>
-</service-decorations>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/resources/test-resources/sd0.xml
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/resources/test-resources/sd0.xml b/dsw/cxf-dsw/src/test/resources/test-resources/sd0.xml
deleted file mode 100644
index 0ad0ad1..0000000
--- a/dsw/cxf-dsw/src/test/resources/test-resources/sd0.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-<service-decorations xmlns="http://cxf.apache.org/xmlns/service-decoration/1.0.0">
-</service-decorations>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/resources/test-resources/sd1.xml
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/resources/test-resources/sd1.xml b/dsw/cxf-dsw/src/test/resources/test-resources/sd1.xml
deleted file mode 100644
index 6a5e811..0000000
--- a/dsw/cxf-dsw/src/test/resources/test-resources/sd1.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<service-decorations xmlns="http://cxf.apache.org/xmlns/service-decoration/1.0.0">
-  <service-decoration>
-    <match interface="org.test.A">
-      <add-property name="A" value="B"/>
-      <add-property name="C" value="2" type="java.lang.Integer"/>
-    </match>
-  </service-decoration>
-</service-decorations>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/resources/test-resources/sd2.xml
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/resources/test-resources/sd2.xml b/dsw/cxf-dsw/src/test/resources/test-resources/sd2.xml
deleted file mode 100644
index fb6a93a..0000000
--- a/dsw/cxf-dsw/src/test/resources/test-resources/sd2.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<service-decorations xmlns="http://cxf.apache.org/xmlns/service-decoration/1.0.0">
-  <service-decoration>
-    <match interface="org.test.(B|C)">
-      <match-property name="x" value="y"/>
-      <add-property name="bool" value="true" type="java.lang.Boolean"/>
-    </match>
-  </service-decoration>
-  <service-decoration>
-    <match interface="org.test.(B|C)">
-      <match-property name="x" value="z"/>
-      <add-property name="bool" value="false" type="java.lang.Boolean"/>
-    </match>
-  </service-decoration>
-</service-decorations>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/pom.xml
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/pom.xml b/dsw/cxf-topology-manager/pom.xml
deleted file mode 100644
index b6c143e..0000000
--- a/dsw/cxf-topology-manager/pom.xml
+++ /dev/null
@@ -1,111 +0,0 @@
-<?xml version='1.0' encoding='UTF-8' ?>
-<!--
-  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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>cxf-dosgi-ri-topology-manager</artifactId>
-    <packaging>bundle</packaging>
-    <name>Distributed OSGi Topology Manager implementation</name>
-
-    <parent>
-        <groupId>org.apache.cxf.dosgi</groupId>
-        <artifactId>cxf-dosgi-ri-parent</artifactId>
-        <version>1.8-SNAPSHOT</version>
-        <relativePath>../../parent/pom.xml</relativePath>
-    </parent>
-
-    <properties>
-        <topDirectoryLocation>../..</topDirectoryLocation>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.cxf.dosgi</groupId>
-            <artifactId>cxf-dosgi-ri-provider-api</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-jdk14</artifactId>
-            <version>1.7.16</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.easymock</groupId>
-            <artifactId>easymockclassextension</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.hamcrest</groupId>
-            <artifactId>hamcrest-all</artifactId>
-            <version>1.3</version>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <configuration>
-                    <instructions>
-                        <Bundle-Name>CXF dOSGi Topology Manager</Bundle-Name>
-                        <Bundle-Description>The default CXF Topology Manager as described in the OSGi Remote Service Admin specification</Bundle-Description>
-                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
-                        <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
-                        <Bundle-Activator>org.apache.cxf.dosgi.topologymanager.Activator</Bundle-Activator>
-                        <Import-Package>
-                            org.osgi.service.remoteserviceadmin;version="[${remote.service.admin.interfaces.version},2)",
-                            *
-                        </Import-Package>
-                        <Export-Package>
-                            !*
-                        </Export-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
-            </plugin>
-        </plugins>
-    </build>
-</project>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/Activator.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/Activator.java b/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/Activator.java
deleted file mode 100644
index 62ec1a9..0000000
--- a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/Activator.java
+++ /dev/null
@@ -1,192 +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.topologymanager;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.cxf.dosgi.dsw.api.ExportPolicy;
-import org.apache.cxf.dosgi.topologymanager.exporter.DefaultExportPolicy;
-import org.apache.cxf.dosgi.topologymanager.exporter.EndpointListenerNotifier;
-import org.apache.cxf.dosgi.topologymanager.exporter.EndpointRepository;
-import org.apache.cxf.dosgi.topologymanager.exporter.TopologyManagerExport;
-import org.apache.cxf.dosgi.topologymanager.importer.TopologyManagerImport;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
-import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Activator implements BundleActivator {
-    public static final String RSA_EXPORT_POLICY_FILTER = "rsa.export.policy.filter";
-    static final String DOSGI_SERVICES = "(" + RemoteConstants.SERVICE_EXPORTED_INTERFACES + "=*)";
-    private static final Logger LOG = LoggerFactory.getLogger(Activator.class);
-
-    private TopologyManagerExport exportManager;
-    private TopologyManagerImport importManager;
-    private EndpointListenerNotifier notifier;
-    private ServiceTracker<RemoteServiceAdmin, RemoteServiceAdmin> rsaTracker;
-    private ThreadPoolExecutor exportExecutor;
-    private ServiceTracker<EndpointListener, EndpointListener> epListenerTracker;
-    private ServiceTracker<ExportPolicy, ExportPolicy> policyTracker;
-
-    public void start(final BundleContext bc) throws Exception {
-        Dictionary<String, String> props = new Hashtable<String, String>();
-        props.put("name", "default");
-        bc.registerService(ExportPolicy.class, new DefaultExportPolicy(), props);
-
-        Filter policyFilter = exportPolicyFilter(bc);
-        policyTracker = new ServiceTracker<ExportPolicy, ExportPolicy>(bc, policyFilter, null) {
-
-            @Override
-            public ExportPolicy addingService(ServiceReference<ExportPolicy> reference) {
-                ExportPolicy policy = super.addingService(reference);
-                if (exportManager == null) {
-                    doStart(bc, policy);
-                }
-                return policy;
-            }
-
-            @Override
-            public void removedService(ServiceReference<ExportPolicy> reference, ExportPolicy service) {
-                if (exportManager != null) {
-                    doStop(bc);
-                }
-                super.removedService(reference, service);
-            }
-        };
-        policyTracker.open();
-    }
-
-    private Filter exportPolicyFilter(BundleContext bc) throws InvalidSyntaxException {
-        String filter = bc.getProperty(RSA_EXPORT_POLICY_FILTER);
-        if (filter == null) {
-            filter = "(name=default)";
-        }
-        return FrameworkUtil.createFilter(String.format("(&(objectClass=%s)%s)", ExportPolicy.class.getName(), filter));
-    }
-
-    public void doStart(final BundleContext bc, ExportPolicy policy) {
-        LOG.debug("TopologyManager: start()");
-        EndpointRepository endpointRepo = new EndpointRepository();
-        notifier = new EndpointListenerNotifier(endpointRepo);
-        epListenerTracker = new EndpointListenerTracker(bc);
-        endpointRepo.setNotifier(notifier);
-        exportExecutor = new ThreadPoolExecutor(5, 10, 50, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
-        exportManager = new TopologyManagerExport(endpointRepo, exportExecutor, policy);
-        importManager = new TopologyManagerImport(bc);
-        rsaTracker = new RSATracker(bc, RemoteServiceAdmin.class, null);
-        bc.addServiceListener(exportManager);
-        rsaTracker.open();
-        epListenerTracker.open();
-        exportExistingServices(bc);
-        importManager.start();
-    }
-
-    public void stop(BundleContext bc) throws Exception {
-        policyTracker.close();
-    }
-
-    public void doStop(BundleContext bc) {
-        LOG.debug("TopologyManager: stop()");
-        epListenerTracker.close();
-        bc.removeServiceListener(exportManager);
-        exportExecutor.shutdown();
-        importManager.stop();
-        rsaTracker.close();
-        exportManager = null;
-    }
-
-    public void exportExistingServices(BundleContext context) {
-        try {
-            // cast to String is necessary for compiling against OSGi core version >= 4.3
-            ServiceReference<?>[] references = context.getServiceReferences((String)null, DOSGI_SERVICES);
-            if (references != null) {
-                for (ServiceReference<?> sref : references) {
-                    exportManager.serviceChanged(new ServiceEvent(ServiceEvent.REGISTERED, sref));
-                }
-            }
-        } catch (InvalidSyntaxException e) {
-            LOG.error("Error in filter {}. This should not occur!", DOSGI_SERVICES);
-        }
-    }
-    
-    private final class EndpointListenerTracker extends ServiceTracker<EndpointListener, EndpointListener> {
-        private EndpointListenerTracker(BundleContext context) {
-            super(context, EndpointListener.class, null);
-        }
-
-        @Override
-        public EndpointListener addingService(ServiceReference<EndpointListener> reference) {
-            EndpointListener listener = super.addingService(reference);
-            notifier.add(listener, EndpointListenerNotifier.getFiltersFromEndpointListenerScope(reference));
-            return listener;
-        }
-
-        @Override
-        public void modifiedService(ServiceReference<EndpointListener> reference,
-                                    EndpointListener listener) {
-            super.modifiedService(reference, listener);
-            notifier.add(listener, EndpointListenerNotifier.getFiltersFromEndpointListenerScope(reference));
-        }
-
-        @Override
-        public void removedService(ServiceReference<EndpointListener> reference,
-                                   EndpointListener listener) {
-            notifier.remove(listener);
-            super.removedService(reference, listener);
-        }
-    }
-
-    private final class RSATracker extends ServiceTracker<RemoteServiceAdmin, RemoteServiceAdmin> {
-        private RSATracker(BundleContext context, Class<RemoteServiceAdmin> clazz,
-                           ServiceTrackerCustomizer<RemoteServiceAdmin, RemoteServiceAdmin> customizer) {
-            super(context, clazz, customizer);
-        }
-
-        @Override
-        public RemoteServiceAdmin addingService(ServiceReference<RemoteServiceAdmin> reference) {
-            RemoteServiceAdmin rsa = super.addingService(reference);
-            LOG.debug("New RemoteServiceAdmin {} detected, trying to import and export services with it", rsa);
-            importManager.add(rsa);
-            exportManager.add(rsa);
-            return rsa;
-        }
-
-        @Override
-        public void removedService(ServiceReference<RemoteServiceAdmin> reference,
-                                   RemoteServiceAdmin rsa) {
-            exportManager.remove(rsa);
-            importManager.remove(rsa);
-            super.removedService(reference, rsa);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/DefaultExportPolicy.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/DefaultExportPolicy.java b/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/DefaultExportPolicy.java
deleted file mode 100644
index 689ebab..0000000
--- a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/DefaultExportPolicy.java
+++ /dev/null
@@ -1,37 +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.topologymanager.exporter;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.cxf.dosgi.dsw.api.ExportPolicy;
-import org.osgi.framework.ServiceReference;
-
-/**
- * The default is to not customize the way services are exported
- */
-public class DefaultExportPolicy implements ExportPolicy {
-
-    @Override
-    public Map<String, ?> additionalParameters(ServiceReference<?> sref) {
-        return new HashMap<String, Object>();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/EndpointListenerNotifier.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/EndpointListenerNotifier.java b/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/EndpointListenerNotifier.java
deleted file mode 100644
index 13d7dab..0000000
--- a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/EndpointListenerNotifier.java
+++ /dev/null
@@ -1,133 +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.topologymanager.exporter;
-
-import java.util.Dictionary;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Tracks EndpointListeners and allows to notify them of endpoints.
- */
-public class EndpointListenerNotifier implements EndpointListener {
-    private static final Logger LOG = LoggerFactory.getLogger(EndpointListenerNotifier.class);
-    private enum NotifyType { ADDED, REMOVED };
-    private Map<EndpointListener, Set<Filter>> listeners;
-    private EndpointRepository endpointRepo;
-
-    public EndpointListenerNotifier(final EndpointRepository endpointRepo) {
-        this.endpointRepo = endpointRepo;
-        this.listeners = new ConcurrentHashMap<EndpointListener, Set<Filter>>();
-    }
-    
-    public static Set<Filter> getFiltersFromEndpointListenerScope(ServiceReference<EndpointListener> sref) {
-        Set<Filter> filters = new HashSet<Filter>();
-        String[] scopes = StringPlus.parse(sref.getProperty(EndpointListener.ENDPOINT_LISTENER_SCOPE));
-        for (String scope : scopes) {
-            try {
-                filters.add(FrameworkUtil.createFilter(scope));
-            } catch (InvalidSyntaxException e) {
-                LOG.error("invalid endpoint listener scope: {}", scope, e);
-            }
-        }
-        return filters;
-    }
-
-    public void add(EndpointListener ep, Set<Filter> filters) {
-        LOG.debug("new EndpointListener detected");
-        listeners.put(ep, filters);
-        for (EndpointDescription endpoint : endpointRepo.getAllEndpoints()) {
-            notifyListener(NotifyType.ADDED, ep, filters, endpoint);
-        }
-    }
-    
-    public void remove(EndpointListener ep) {
-        LOG.debug("EndpointListener modified");
-        listeners.remove(ep);
-    }
-    
-    @Override
-    public void endpointAdded(EndpointDescription endpoint, String matchedFilter) {
-        notifyListeners(NotifyType.ADDED, endpoint);
-    }
-
-    @Override
-    public void endpointRemoved(EndpointDescription endpoint, String matchedFilter) {
-        notifyListeners(NotifyType.REMOVED, endpoint);
-    }
-
-    /**
-     * Notifies all endpoint listeners about endpoints being added or removed.
-     *
-     * @param added specifies whether endpoints were added (true) or removed (false)
-     * @param endpoints the endpoints the listeners should be notified about
-     */
-    private void notifyListeners(NotifyType type, EndpointDescription endpoint) {
-        for (EndpointListener listener : listeners.keySet()) {
-            notifyListener(type, listener, listeners.get(listener), endpoint);
-        }
-    }
-
-    /**
-     * Notifies an endpoint listener about endpoints being added or removed.
-     *
-     * @param type specifies whether endpoints were added (true) or removed (false)
-     * @param endpointListenerRef the ServiceReference of an EndpointListener to notify
-     * @param endpoints the endpoints the listener should be notified about
-     */
-    private void notifyListener(NotifyType type, EndpointListener listener, Set<Filter> filters, 
-                        EndpointDescription endpoint) {
-        LOG.debug("Endpoint {}", type);
-        Set<Filter> matchingFilters = getMatchingFilters(filters, endpoint);
-        for (Filter filter : matchingFilters) {
-            if (type == NotifyType.ADDED) {
-                listener.endpointAdded(endpoint, filter.toString());
-            } else {
-                listener.endpointRemoved(endpoint, filter.toString());
-            }
-        }
-    }
-    
-    private static Set<Filter> getMatchingFilters(Set<Filter> filters, EndpointDescription endpoint) {
-        Set<Filter> matchingFilters = new HashSet<Filter>();
-        Dictionary<String, Object> dict = new Hashtable<String, Object>(endpoint.getProperties());
-        for (Filter filter : filters) {
-            if (filter.match(dict)) {
-                LOG.debug("Filter {} matches endpoint {}", filter, dict);
-                matchingFilters.add(filter);
-            } else {
-                LOG.trace("Filter {} does not match endpoint {}", filter, dict);
-            }
-        }
-        return matchingFilters;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/EndpointRepository.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/EndpointRepository.java b/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/EndpointRepository.java
deleted file mode 100644
index 2a7bab3..0000000
--- a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/EndpointRepository.java
+++ /dev/null
@@ -1,140 +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.topologymanager.exporter;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Holds all endpoints that are exported by a TopologyManager. For each ServiceReference that is exported a
- * map is maintained which contains information on the endpoints for each RemoteAdminService that created the
- * endpoints.
- */
-@SuppressWarnings("rawtypes")
-public class EndpointRepository {
-
-    private static final Logger LOG = LoggerFactory.getLogger(EndpointRepository.class);
-
-    private final Map<ServiceReference, Map<RemoteServiceAdmin, Collection<EndpointDescription>>> exportedServices
-        = new LinkedHashMap<ServiceReference, Map<RemoteServiceAdmin, Collection<EndpointDescription>>>();
-
-    private EndpointListener notifier;
-    
-    public void setNotifier(EndpointListener notifier) {
-        this.notifier = notifier;
-    }
-    
-    
-    /**
-     * Remove all services exported by the given rsa.
-     *
-     * @param rsa the RemoteServiceAdmin to remove
-     * @return list of removed endpoints
-     */
-    public synchronized List<EndpointDescription> removeRemoteServiceAdmin(RemoteServiceAdmin rsa) {
-        LOG.debug("RemoteServiceAdmin removed: {}", rsa.getClass().getName());
-        List<EndpointDescription> removedEndpoints = new ArrayList<EndpointDescription>();
-        for (Map<RemoteServiceAdmin, Collection<EndpointDescription>> exports : exportedServices.values()) {
-            Collection<EndpointDescription> endpoints = exports.get(rsa);
-            if (endpoints != null) {
-                removedEndpoints.addAll(endpoints);
-                exports.remove(rsa);
-            }
-        }
-        endpointsRemoved(removedEndpoints);
-        return removedEndpoints;
-    }
-
-    public synchronized void removeService(ServiceReference sref) {
-        List<EndpointDescription> removedEndpoints = new ArrayList<EndpointDescription>();
-        Map<RemoteServiceAdmin, Collection<EndpointDescription>> rsaToEndpoints = exportedServices.get(sref);
-        if (rsaToEndpoints != null) {
-            for (Collection<EndpointDescription> endpoints : rsaToEndpoints.values()) {
-                removedEndpoints.addAll(endpoints);
-            }
-            exportedServices.remove(sref);
-        }
-        endpointsRemoved(removedEndpoints);
-    }
-
-    public synchronized void addService(ServiceReference sref) {
-        if (!exportedServices.containsKey(sref)) {
-            LOG.info("Marking service from bundle {} for export", sref.getBundle().getSymbolicName());
-            exportedServices.put(sref, new LinkedHashMap<RemoteServiceAdmin, Collection<EndpointDescription>>());
-        }
-    }
-
-    public synchronized void addEndpoints(ServiceReference sref, RemoteServiceAdmin rsa,
-                                   List<EndpointDescription> endpoints) {
-        addService(sref);
-        Map<RemoteServiceAdmin, Collection<EndpointDescription>> exports = exportedServices.get(sref);
-        exports.put(rsa, endpoints);
-        endpointsAdded(endpoints);
-    }
-
-    synchronized boolean isAlreadyExportedForRsa(ServiceReference sref, RemoteServiceAdmin rsa) {
-        Map<RemoteServiceAdmin, Collection<EndpointDescription>> exports = exportedServices.get(sref);
-        return exports != null && exports.containsKey(rsa);
-    }
-
-    public synchronized Collection<EndpointDescription> getAllEndpoints() {
-        List<EndpointDescription> allEndpoints = new ArrayList<EndpointDescription>();
-        for (Map<RemoteServiceAdmin, Collection<EndpointDescription>> exports : exportedServices.values()) {
-            for (Collection<EndpointDescription> endpoints : exports.values()) {
-                allEndpoints.addAll(endpoints);
-            }
-        }
-        return allEndpoints;
-    }
-
-    public synchronized Set<ServiceReference> getServicesToBeExportedFor(RemoteServiceAdmin rsa) {
-        Set<ServiceReference> servicesToBeExported = new HashSet<ServiceReference>();
-        for (Map.Entry<ServiceReference, Map<RemoteServiceAdmin, Collection<EndpointDescription>>> entry
-                : exportedServices.entrySet()) {
-            if (!entry.getValue().containsKey(rsa)) {
-                servicesToBeExported.add(entry.getKey());
-            }
-        }
-        return servicesToBeExported;
-    }
-
-    private void endpointsAdded(List<EndpointDescription> endpoints) {
-        for (EndpointDescription epd : endpoints) {
-            notifier.endpointAdded(epd, null);
-        }
-    }
-    
-    private void endpointsRemoved(List<EndpointDescription> endpoints) {
-        for (EndpointDescription epd : endpoints) {
-            notifier.endpointRemoved(epd, null);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/StringPlus.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/StringPlus.java b/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/StringPlus.java
deleted file mode 100644
index 1198154..0000000
--- a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/StringPlus.java
+++ /dev/null
@@ -1,57 +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.topologymanager.exporter;
-
-import java.util.Collection;
-
-public final class StringPlus {
-
-    private StringPlus() {
-    }
-
-    /**
-     * Returns the value of a "string+" property as an array of strings.
-     * <p>
-     * A "string+" property can have a value which is either a string,
-     * an array of strings, or a collection of strings.
-     * <p>
-     * If the given value is not of one of the valid types, or is null,
-     * an empty array is returned.
-     *
-     * @param property a "string+" property value
-     * @return the property value as an array of strings, or an empty array
-     */
-    public static String[] parse(Object property) {
-        if (property instanceof String) {
-            return new String[] {(String)property};
-        } else if (property instanceof String[]) {
-            return (String[])property;
-        } else if (property instanceof Collection) {
-            try {
-                @SuppressWarnings("unchecked")
-                Collection<String> strings = (Collection<String>)property;
-                return strings.toArray(new String[strings.size()]);
-            } catch (ArrayStoreException ase) {
-                // ignore collections with wrong type
-            }
-        }
-        return new String[0];
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/TopologyManagerExport.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/TopologyManagerExport.java b/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/TopologyManagerExport.java
deleted file mode 100644
index ad3736c..0000000
--- a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/TopologyManagerExport.java
+++ /dev/null
@@ -1,195 +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.topologymanager.exporter;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Executor;
-
-import org.apache.cxf.dosgi.dsw.api.ExportPolicy;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.ExportReference;
-import org.osgi.service.remoteserviceadmin.ExportRegistration;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Manages exported endpoints of DOSGi services and notifies EndpointListeners of changes.
- *
- * <li> Tracks local RemoteServiceAdmin instances by using a ServiceTracker
- * <li> Uses a ServiceListener to track local OSGi services
- * <li> When a service is published that is supported by DOSGi the
- *      known RemoteServiceAdmins are instructed to export the service and
- *      the EndpointListeners are notified
- * <li> When a service is unpublished the EndpointListeners are notified.
- *      The endpoints are not closed as the ExportRegistration takes care of this
- */
-public class TopologyManagerExport implements ServiceListener {
-    private static final Logger LOG = LoggerFactory.getLogger(TopologyManagerExport.class);
-
-    private final Executor execService;
-    private final EndpointRepository endpointRepo;
-    private ExportPolicy policy;
-    private final Set<RemoteServiceAdmin> rsaSet;
-
-
-    public TopologyManagerExport(final EndpointRepository endpointRepo, Executor executor, ExportPolicy policy) {
-        this.endpointRepo = endpointRepo;
-        this.policy = policy;
-        this.rsaSet = new HashSet<RemoteServiceAdmin>();
-        this.execService = executor;
-    }
-
-    // track all service registrations so we can export any services that are configured to be exported
-    // ServiceListener events may be delivered out of order, concurrently, re-entrant, etc. (see spec or docs)
-    public void serviceChanged(ServiceEvent event) {
-        ServiceReference<?> sref = event.getServiceReference();
-        if (event.getType() == ServiceEvent.REGISTERED) {
-            LOG.debug("Received REGISTERED ServiceEvent: {}", event);
-            export(sref);
-        } else if (event.getType() == ServiceEvent.UNREGISTERING) {
-            LOG.debug("Received UNREGISTERING ServiceEvent: {}", event);
-            endpointRepo.removeService(sref);
-        }
-    }
-
-    public void add(RemoteServiceAdmin rsa) {
-        rsaSet.add(rsa);
-        for (ServiceReference<?> serviceRef : endpointRepo.getServicesToBeExportedFor(rsa)) {
-            export(serviceRef);
-        }
-    };
-    
-    public void remove(RemoteServiceAdmin rsa) {
-        rsaSet.remove(rsa);
-        endpointRepo.removeRemoteServiceAdmin(rsa);
-    };
-
-    private void export(final ServiceReference<?> sref) {
-        execService.execute(new Runnable() {
-            public void run() {
-                doExport(sref);
-            }
-        });
-    }
-
-    private void doExport(final ServiceReference<?> sref) {
-        Map<String, ?> addProps = policy.additionalParameters(sref);
-        if (!shouldExport(sref, addProps)) {
-            LOG.debug("Skipping service {}", sref);
-            return;
-        }
-        LOG.debug("Exporting service {}", sref);
-        endpointRepo.addService(sref); // mark for future export even if there are currently no RSAs
-        if (rsaSet.size() == 0) {
-            LOG.error("No RemoteServiceAdmin available! Unable to export service from bundle {}, interfaces: {}",
-                    getSymbolicName(sref.getBundle()),
-                    sref.getProperty(org.osgi.framework.Constants.OBJECTCLASS));
-            return;
-        }
-
-        for (RemoteServiceAdmin remoteServiceAdmin : rsaSet) {
-            LOG.info("TopologyManager: handling remoteServiceAdmin " + remoteServiceAdmin);
-            if (endpointRepo.isAlreadyExportedForRsa(sref, remoteServiceAdmin)) {
-                // already handled by this remoteServiceAdmin
-                LOG.debug("already handled by this remoteServiceAdmin -> skipping");
-            } else {
-                
-                exportServiceUsingRemoteServiceAdmin(sref, remoteServiceAdmin, addProps);
-            }
-        }
-    }
-
-    private boolean shouldExport(ServiceReference<?> sref, Map<String, ?> addProps) {
-        String exported = (String)sref.getProperty(RemoteConstants.SERVICE_EXPORTED_INTERFACES);
-        String addExported = (String)addProps.get(RemoteConstants.SERVICE_EXPORTED_INTERFACES);
-        String effectiveExported = addExported != null ? addExported : exported;
-        return (effectiveExported != null) && !effectiveExported.isEmpty();
-    }
-
-    private Object getSymbolicName(Bundle bundle) {
-        return bundle == null ? null : bundle.getSymbolicName();
-    }
-
-    private void exportServiceUsingRemoteServiceAdmin(final ServiceReference<?> sref,
-                                                      final RemoteServiceAdmin remoteServiceAdmin, 
-                                                      Map<String, ?> addProps) {
-        // abort if the service was unregistered by the time we got here
-        // (we check again at the end, but this optimization saves unnecessary heavy processing)
-        if (sref.getBundle() == null) {
-            LOG.info("TopologyManager: export aborted for {} since it was unregistered", sref);
-            endpointRepo.removeService(sref);
-            return;
-        }
-        // do the export
-        LOG.debug("exporting {}...", sref);
-        // TODO: additional parameter Map?
-        Collection<ExportRegistration> exportRegs = remoteServiceAdmin.exportService(sref, addProps);
-        // process successful/failed registrations
-        List<EndpointDescription> endpoints = new ArrayList<EndpointDescription>();
-        for (ExportRegistration reg : exportRegs) {
-            if (reg.getException() == null) {
-                EndpointDescription endpoint = getExportedEndpoint(reg);
-                LOG.info("TopologyManager: export succeeded for {}, endpoint ", sref, endpoint);
-                endpoints.add(endpoint);
-            } else {
-                LOG.error("TopologyManager: export failed for {}", sref);
-                reg.close();
-            }
-        }
-        // abort export if service was unregistered in the meanwhile (since we have a race
-        // with the unregister event which may have already been handled, so we'll miss it)
-        if (sref.getBundle() == null) {
-            LOG.info("TopologyManager: export reverted for {} since service was unregistered", sref);
-            endpointRepo.removeService(sref);
-            for (ExportRegistration reg : exportRegs) {
-                reg.close();
-            }
-            return;
-        }
-        // add the new exported endpoints
-        if (!endpoints.isEmpty()) {
-            LOG.info("TopologyManager: export successful for {}, endpoints: {}", sref, endpoints);
-            endpointRepo.addEndpoints(sref, remoteServiceAdmin, endpoints);
-        }
-    }
-
-    /**
-     * Retrieves an exported Endpoint (while safely handling nulls).
-     *
-     * @param exReg an export registration
-     * @return exported Endpoint or null if not present
-     */
-    private EndpointDescription getExportedEndpoint(ExportRegistration exReg) {
-        ExportReference ref = (exReg == null) ? null : exReg.getExportReference();
-        return (ref == null) ? null : ref.getExportedEndpoint();
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/EndpointListenerManager.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/EndpointListenerManager.java b/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/EndpointListenerManager.java
deleted file mode 100644
index 7812e52..0000000
--- a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/EndpointListenerManager.java
+++ /dev/null
@@ -1,98 +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.topologymanager.importer;
-
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.List;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Manages an EndpointListener and adjusts its scope according to requested service filters.
- */
-public class EndpointListenerManager {
-
-    private static final Logger LOG = LoggerFactory.getLogger(EndpointListenerManager.class);
-
-    private final BundleContext bctx;
-    private volatile ServiceRegistration<EndpointListener> serviceRegistration;
-    private final List<String> filters = new ArrayList<String>();
-    private final EndpointListener endpointListener;
-
-    public EndpointListenerManager(BundleContext bc, EndpointListener endpointListener) {
-        this.bctx = bc;
-        this.endpointListener = endpointListener;
-    }
-
-    protected void start() {
-        serviceRegistration = bctx.registerService(EndpointListener.class, endpointListener,
-                                                   getRegistrationProperties());
-    }
-
-    public void stop() {
-        if (serviceRegistration != null) {
-            serviceRegistration.unregister();
-        }
-    }
-
-    protected void extendScope(String filter) {
-        if (filter == null) {
-            return;
-        }
-        LOG.debug("EndpointListener: extending scope by {}", filter);
-        synchronized (filters) {
-            filters.add(filter);
-        }
-        updateRegistration();
-    }
-
-    protected void reduceScope(String filter) {
-        if (filter == null) {
-            return;
-        }
-        LOG.debug("EndpointListener: reducing scope by {}", filter);
-        synchronized (filters) {
-            filters.remove(filter);
-        }
-        updateRegistration();
-    }
-
-    private Dictionary<String, Object> getRegistrationProperties() {
-        Dictionary<String, Object> p = new Hashtable<String, Object>();
-
-        synchronized (filters) {
-            LOG.debug("Current filter: {}", filters);
-            p.put(EndpointListener.ENDPOINT_LISTENER_SCOPE, new ArrayList<String>(filters));
-        }
-
-        return p;
-    }
-
-    private void updateRegistration() {
-        if (serviceRegistration != null) {
-            serviceRegistration.setProperties(getRegistrationProperties());
-        }
-    }
-}


[07/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

Posted by cs...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
deleted file mode 100644
index 356de5e..0000000
--- a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
+++ /dev/null
@@ -1,587 +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.service;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
-import org.apache.cxf.dosgi.dsw.api.Endpoint;
-import org.apache.cxf.dosgi.dsw.api.EndpointHelper;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.ExportReference;
-import org.osgi.service.remoteserviceadmin.ExportRegistration;
-import org.osgi.service.remoteserviceadmin.ImportReference;
-import org.osgi.service.remoteserviceadmin.ImportRegistration;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RemoteServiceAdminCore implements RemoteServiceAdmin {
-
-    private static final Logger LOG = LoggerFactory.getLogger(RemoteServiceAdminCore.class);
-
-    private final Map<Map<String, Object>, Collection<ExportRegistration>> exportedServices
-        = new LinkedHashMap<Map<String, Object>, Collection<ExportRegistration>>();
-    private final Map<EndpointDescription, Collection<ImportRegistrationImpl>> importedServices
-        = new LinkedHashMap<EndpointDescription, Collection<ImportRegistrationImpl>>();
-
-    // Is stored in exportedServices while the export is in progress as a marker
-    private final List<ExportRegistration> exportInProgress = Collections.emptyList();
-
-    private final BundleContext bctx;
-    private final EventProducer eventProducer;
-    private final ServiceListener exportedServiceListener;
-    private DistributionProvider provider;
-    private BundleContext apictx;
-
-    public RemoteServiceAdminCore(BundleContext context, BundleContext apiContext, DistributionProvider provider) {
-        this.bctx = context;
-        this.apictx = apiContext;
-        this.eventProducer = new EventProducer(bctx);
-        this.provider = provider;
-        // listen for exported services being unregistered so we can close the export
-        this.exportedServiceListener = new ServiceListener() {
-            public void serviceChanged(ServiceEvent event) {
-                if (event.getType() == ServiceEvent.UNREGISTERING) {
-                    removeServiceExports(event.getServiceReference());
-                }
-            }
-        };
-        try {
-            String filter = "(" + RemoteConstants.SERVICE_EXPORTED_INTERFACES + "=*)";
-            context.addServiceListener(exportedServiceListener, filter);
-        } catch (InvalidSyntaxException ise) {
-            throw new RuntimeException(ise); // can never happen
-        }
-    }
-
-    @Override
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    public List<ExportRegistration> exportService(ServiceReference serviceReference, Map additionalProperties)
-        throws IllegalArgumentException, UnsupportedOperationException {
-        Map<String, Object> serviceProperties = getProperties(serviceReference);
-        if (additionalProperties != null) {
-            overlayProperties(serviceProperties, additionalProperties);
-        }
-        Map<String, Object> key = makeKey(serviceProperties);
-
-        List<String> interfaceNames = getInterfaceNames(serviceProperties);
-
-        if (isImportedService(serviceReference)) {
-            return Collections.emptyList();
-        }
-
-        List<ExportRegistration> exportRegs = getExistingAndLock(key, interfaceNames);
-        if (exportRegs != null) {
-            return exportRegs;
-        }
-
-        try {
-            ExportRegistration exportReg = exportService(interfaceNames, serviceReference, serviceProperties);
-            exportRegs = new ArrayList<>();
-            exportRegs.add(exportReg);
-            store(key, exportRegs);
-            return exportRegs;
-        } finally {
-            unlock(key);
-        }
-    }
-
-    private void store(Map<String, Object> key, List<ExportRegistration> exportRegs) {
-        if (!exportRegs.isEmpty()) {
-            // enlist initial export registrations in global list of exportRegistrations
-            synchronized (exportedServices) {
-                exportedServices.put(key, new ArrayList<ExportRegistration>(exportRegs));
-            }
-            eventProducer.publishNotification(exportRegs);
-        }
-    }
-
-    private void unlock(Map<String, Object> key) {
-        synchronized (exportedServices) {
-            if (exportedServices.get(key) == exportInProgress) {
-                exportedServices.remove(key);
-            }
-            exportedServices.notifyAll(); // in any case, always notify waiting threads
-        }
-    }
-
-    private List<ExportRegistration> getExistingAndLock(Map<String, Object> key, List<String> interfaces) {
-        synchronized (exportedServices) {
-            // check if it is already exported...
-            Collection<ExportRegistration> existingRegs = exportedServices.get(key);
-
-            // if the export is already in progress, wait for it to be complete
-            while (existingRegs == exportInProgress) {
-                try {
-                    exportedServices.wait();
-                    existingRegs = exportedServices.get(key);
-                } catch (InterruptedException ie) {
-                    LOG.debug("interrupted while waiting for export in progress");
-                    return Collections.emptyList();
-                }
-            }
-
-            // if the export is complete, return a copy of existing export
-            if (existingRegs != null) {
-                LOG.debug("already exported this service. Returning existing exportRegs {} ", interfaces);
-                return copyExportRegistration(existingRegs);
-            }
-
-            // mark export as being in progress
-            exportedServices.put(key, exportInProgress);
-        }
-        return null;
-    }
-
-    private ExportRegistration exportService(List<String> interfaceNames,
-            ServiceReference<?> serviceReference, Map<String, Object> serviceProperties) {
-        LOG.info("interfaces selected for export: " + interfaceNames);
-        try {
-            Class<?>[] interfaces = getInterfaces(interfaceNames, serviceReference.getBundle());
-            Map<String, Object> eprops = createEndpointProps(serviceProperties, interfaces);
-            BundleContext serviceContext = serviceReference.getBundle().getBundleContext();
-            
-            // TODO unget service when export is destroyed
-            Object serviceO = serviceContext.getService(serviceReference);
-            Endpoint endpoint = provider.exportService(serviceO, serviceContext, eprops, interfaces);
-            return new ExportRegistrationImpl(serviceReference, endpoint, this);
-        } catch (Exception e) {
-            return new ExportRegistrationImpl(this, e);
-        }
-    }
-    
-    private Class<?>[] getInterfaces(List<String> interfaceNames, 
-                                         Bundle serviceBundle) throws ClassNotFoundException {
-        List<Class<?>> interfaces = new ArrayList<>();
-        for (String interfaceName : interfaceNames) {
-            interfaces.add(serviceBundle.loadClass(interfaceName));
-        }
-        return interfaces.toArray(new Class[]{});
-    }
-
-    /**
-     * Determines which interfaces should be exported.
-     *
-     * @param serviceProperties the exported service properties
-     * @return the interfaces to be exported
-     * @throws IllegalArgumentException if the service parameters are invalid
-     * @see RemoteServiceAdmin#exportService
-     * @see org.osgi.framework.Constants#OBJECTCLASS
-     * @see RemoteConstants#SERVICE_EXPORTED_INTERFACES
-     */
-    private List<String> getInterfaceNames(Map<String, Object> serviceProperties) {
-        String[] providedInterfaces = (String[])serviceProperties.get(org.osgi.framework.Constants.OBJECTCLASS);
-        if (providedInterfaces == null || providedInterfaces.length == 0) {
-            throw new IllegalArgumentException("service is missing the objectClass property");
-        }
-
-        String[] exportedInterfaces
-            = StringPlus.normalize(serviceProperties.get(RemoteConstants.SERVICE_EXPORTED_INTERFACES));
-        if (exportedInterfaces == null || exportedInterfaces.length == 0) {
-            throw new IllegalArgumentException("service is missing the service.exported.interfaces property");
-        }
-
-        List<String> interfaces = new ArrayList<String>(1);
-        if (exportedInterfaces.length == 1 && "*".equals(exportedInterfaces[0])) {
-            // FIXME: according to the spec, this should only return the interfaces, and not
-            // non-interface classes (which are valid OBJECTCLASS values, even if discouraged)
-            Collections.addAll(interfaces, providedInterfaces);
-        } else {
-            List<String> providedList = Arrays.asList(providedInterfaces);
-            List<String> allowedList = Arrays.asList(exportedInterfaces);
-            if (!providedList.containsAll(allowedList)) {
-                throw new IllegalArgumentException(String.format(
-                    "exported interfaces %s must be a subset of the service's registered types %s",
-                    allowedList, providedList));
-            }
-
-            Collections.addAll(interfaces, exportedInterfaces);
-        }
-        return interfaces;
-    }
-
-    /**
-     * Converts the given properties map into one that can be used as a map key itself.
-     * For example, if a value is an array, it is converted into a list so that the
-     * equals method will compare it properly.
-     *
-     * @param properties a properties map
-     * @return a map that represents the given map, but can be safely used as a map key itself
-     */
-    private Map<String, Object> makeKey(Map<String, Object> properties) {
-        // FIXME: we should also make logically equal values actually compare as equal
-        // (e.g. String+ values should be normalized)
-        Map<String, Object> converted = new HashMap<String, Object>(properties.size());
-        for (Map.Entry<String, Object> entry : properties.entrySet()) {
-            Object val = entry.getValue();
-            // convert arrays into lists so that they can be compared via equals()
-            if (val instanceof Object[]) {
-                val = Arrays.asList((Object[])val);
-            }
-            converted.put(entry.getKey(), val);
-        }
-        return converted;
-    }
-
-    private List<ExportRegistration> copyExportRegistration(Collection<ExportRegistration> regs) {
-        Set<EndpointDescription> copiedEndpoints = new HashSet<EndpointDescription>();
-
-        // create a new list with copies of the exportRegistrations
-        List<ExportRegistration> copy = new ArrayList<ExportRegistration>(regs.size());
-        for (ExportRegistration exportRegistration : regs) {
-            if (exportRegistration instanceof ExportRegistrationImpl) {
-                ExportRegistrationImpl exportRegistrationImpl = (ExportRegistrationImpl) exportRegistration;
-                EndpointDescription epd = exportRegistration.getExportReference().getExportedEndpoint();
-                // create one copy for each distinct endpoint description
-                if (!copiedEndpoints.contains(epd)) {
-                    copiedEndpoints.add(epd);
-                    copy.add(new ExportRegistrationImpl(exportRegistrationImpl));
-                }
-            }
-        }
-
-        regs.addAll(copy);
-
-        eventProducer.publishNotification(copy);
-        return copy;
-    }
-
-    private boolean isImportedService(ServiceReference<?> sref) {
-        return sref.getProperty(RemoteConstants.SERVICE_IMPORTED) != null;
-    }
-
-    @Override
-    public Collection<ExportReference> getExportedServices() {
-        synchronized (exportedServices) {
-            List<ExportReference> ers = new ArrayList<ExportReference>();
-            for (Collection<ExportRegistration> exportRegistrations : exportedServices.values()) {
-                for (ExportRegistration er : exportRegistrations) {
-                    ers.add(new ExportReferenceImpl(er.getExportReference()));
-                }
-            }
-            return Collections.unmodifiableCollection(ers);
-        }
-    }
-
-    @Override
-    public Collection<ImportReference> getImportedEndpoints() {
-        synchronized (importedServices) {
-            List<ImportReference> irs = new ArrayList<ImportReference>();
-            for (Collection<ImportRegistrationImpl> irl : importedServices.values()) {
-                for (ImportRegistrationImpl impl : irl) {
-                    irs.add(impl.getImportReference());
-                }
-            }
-            return Collections.unmodifiableCollection(irs);
-        }
-    }
-
-    /**
-     * Importing form here...
-     */
-    @Override
-    public ImportRegistration importService(EndpointDescription endpoint) {
-        LOG.debug("importService() Endpoint: {}", endpoint.getProperties());
-
-        synchronized (importedServices) {
-            Collection<ImportRegistrationImpl> imRegs = importedServices.get(endpoint);
-            if (imRegs != null && !imRegs.isEmpty()) {
-                LOG.debug("creating copy of existing import registrations");
-                ImportRegistrationImpl irParent = imRegs.iterator().next();
-                ImportRegistrationImpl ir = new ImportRegistrationImpl(irParent);
-                imRegs.add(ir);
-                eventProducer.publishNotification(ir);
-                return ir;
-            }
-
-            if (determineConfigTypesForImport(endpoint).size() == 0) {
-                LOG.info("No matching handler can be found for remote endpoint {}.", endpoint.getId());
-                return null;
-            }
-            
-            // TODO: somehow select the interfaces that should be imported ---> job of the TopologyManager?
-            List<String> matchingInterfaces = endpoint.getInterfaces();
-            
-            if (matchingInterfaces.size() == 0) {
-                LOG.info("No matching interfaces found for remote endpoint {}.", endpoint.getId());
-                return null;
-            }
-            
-            LOG.info("Importing service {} with interfaces {} using handler {}.", 
-                     endpoint.getId(), endpoint.getInterfaces(), provider.getClass());
-
-            ImportRegistrationImpl imReg = exposeServiceFactory(matchingInterfaces.get(0), endpoint, provider);
-            if (imRegs == null) {
-                imRegs = new ArrayList<ImportRegistrationImpl>();
-                importedServices.put(endpoint, imRegs);
-            }
-            imRegs.add(imReg);
-            eventProducer.publishNotification(imReg);
-            return imReg;
-        }
-    }
-    
-    private List<String> determineConfigTypesForImport(EndpointDescription endpoint) {
-        List<String> remoteConfigurationTypes = endpoint.getConfigurationTypes();
-
-        List<String> usableConfigurationTypes = new ArrayList<String>();
-        for (String ct : provider.getSupportedTypes()) {
-            if (remoteConfigurationTypes.contains(ct)) {
-                usableConfigurationTypes.add(ct);
-            }
-        }
-
-        LOG.info("Ignoring endpoint {} as it has no compatible configuration types: {}.", 
-                 endpoint.getId(), remoteConfigurationTypes);
-        return usableConfigurationTypes;
-    }
-
-    protected ImportRegistrationImpl exposeServiceFactory(String interfaceName,
-                                            EndpointDescription epd,
-                                            DistributionProvider handler) {
-        ImportRegistrationImpl imReg = new ImportRegistrationImpl(epd, this);
-        try {
-            EndpointDescription endpoint = imReg.getImportedEndpointDescription();
-            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(endpoint, handler, imReg);
-            imReg.setClientServiceFactory(csf);
-            
-            /**
-             *  Export the factory using the api context as it has very few imports.
-             *  If the bundle publishing the factory does not import the service interface
-             *  package then the factory is visible for all consumers which we want.
-             */
-            ServiceRegistration<?> csfReg = apictx.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;
-    }
-
-    /**
-     * Removes and closes all exports for the given service.
-     * This is called when the service is unregistered.
-     *
-     * @param sref the service whose exports should be removed and closed
-     */
-    protected void removeServiceExports(ServiceReference<?> sref) {
-        List<ExportRegistration> regs = new ArrayList<ExportRegistration>(1);
-        synchronized (exportedServices) {
-            for (Iterator<Collection<ExportRegistration>> it = exportedServices.values().iterator(); it.hasNext();) {
-                Collection<ExportRegistration> value = it.next();
-                for (Iterator<ExportRegistration> it2 = value.iterator(); it2.hasNext();) {
-                    ExportRegistration er = it2.next();
-                    if (er.getExportReference().getExportedService().equals(sref)) {
-                        regs.add(er);
-                    }
-                }
-            }
-            // do this outside of iteration to avoid concurrent modification
-            for (ExportRegistration er : regs) {
-                LOG.debug("closing export for service {}", sref);
-                er.close();
-            }
-        }
-
-    }
-
-    /**
-     * Removes the provided Export Registration from the internal management structures.
-     * This is called from the ExportRegistration itself when it is closed (so should
-     * not attempt to close it again here).
-     *
-     * @param eri the export registration to remove
-     */
-    protected void removeExportRegistration(ExportRegistrationImpl eri) {
-        synchronized (exportedServices) {
-            for (Iterator<Collection<ExportRegistration>> it = exportedServices.values().iterator(); it.hasNext();) {
-                Collection<ExportRegistration> value = it.next();
-                for (Iterator<ExportRegistration> it2 = value.iterator(); it2.hasNext();) {
-                    ExportRegistration er = it2.next();
-                    if (er.equals(eri)) {
-                        eventProducer.notifyRemoval(eri);
-                        it2.remove();
-                        if (value.isEmpty()) {
-                            it.remove();
-                        }
-                        return;
-                    }
-                }
-            }
-        }
-    }
-
-    // remove all export registrations associated with the given bundle
-    protected void removeExportRegistrations(Bundle exportingBundle) {
-        List<ExportRegistration> bundleExports = getExportsForBundle(exportingBundle);
-        for (ExportRegistration export : bundleExports) {
-            export.close();
-        }
-    }
-
-    // remove all import registrations
-    protected void removeImportRegistrations() {
-        Collection<ImportRegistrationImpl> copy = new ArrayList<ImportRegistrationImpl>();
-        synchronized (importedServices) {
-            for (Collection<ImportRegistrationImpl> irs : importedServices.values()) {
-                copy.addAll(irs);
-            }
-        }
-        for (ImportRegistrationImpl ir : copy) {
-            removeImportRegistration(ir);
-        }
-    }
-
-    private List<ExportRegistration> getExportsForBundle(Bundle exportingBundle) {
-        synchronized (exportedServices) {
-            List<ExportRegistration> bundleRegs = new ArrayList<ExportRegistration>();
-            for (Collection<ExportRegistration> regs : exportedServices.values()) {
-                if (!regs.isEmpty()) {
-                    ExportRegistration exportRegistration = regs.iterator().next();
-                    if (exportRegistration.getException() == null) {
-                        Bundle regBundle = exportRegistration.getExportReference().getExportedService().getBundle();
-                        if (exportingBundle.equals(regBundle)) {
-                            bundleRegs.addAll(regs);
-                        }
-                    }
-                }
-            }
-            return bundleRegs;
-        }
-    }
-
-    protected void removeImportRegistration(ImportRegistrationImpl iri) {
-        synchronized (importedServices) {
-            LOG.debug("Removing importRegistration {}", iri);
-
-            Collection<ImportRegistrationImpl> imRegs = importedServices.get(iri.getImportedEndpointAlways());
-            if (imRegs != null && imRegs.contains(iri)) {
-                imRegs.remove(iri);
-                eventProducer.notifyRemoval(iri);
-            }
-            if (imRegs == null || imRegs.isEmpty()) {
-                importedServices.remove(iri.getImportedEndpointAlways());
-            }
-        }
-    }
-
-    public void close() {
-        removeImportRegistrations();
-        bctx.removeServiceListener(exportedServiceListener);
-    }
-
-    static void overlayProperties(Map<String, Object> serviceProperties,
-                                         Map<String, Object> additionalProperties) {
-        Map<String, String> keysLowerCase = new HashMap<String, String>();
-        for (String key : serviceProperties.keySet()) {
-            keysLowerCase.put(key.toLowerCase(), key);
-        }
-    
-        for (Map.Entry<String, Object> e : additionalProperties.entrySet()) {
-            String key = e.getKey();
-            String lowerKey = key.toLowerCase();
-            if (org.osgi.framework.Constants.SERVICE_ID.toLowerCase().equals(lowerKey)
-                || org.osgi.framework.Constants.OBJECTCLASS.toLowerCase().equals(lowerKey)) {
-                // objectClass and service.id must not be overwritten
-                LOG.info("exportService called with additional properties map that contained illegal key: "
-                          + key + ", the key is ignored");
-            } else {
-                String origKey = keysLowerCase.get(lowerKey);
-                if (origKey != null) {
-                    LOG.debug("Overwriting property [{}] with value [{}]", origKey, e.getValue());
-                } else {
-                    origKey = key;
-                    keysLowerCase.put(lowerKey, origKey);
-                }
-                serviceProperties.put(origKey, e.getValue());
-            }
-        }
-    }
-
-    /**
-     * Returns a service's properties as a map.
-     *
-     * @param serviceReference a service reference
-     * @return the service's properties as a map
-     */
-    private Map<String, Object> getProperties(ServiceReference<?> serviceReference) {
-        String[] keys = serviceReference.getPropertyKeys();
-        Map<String, Object> props = new HashMap<String, Object>(keys.length);
-        for (String key : keys) {
-            Object val = serviceReference.getProperty(key);
-            props.put(key, val);
-        }
-        return props;
-    }
-    
-    protected Map<String, Object> createEndpointProps(Map<String, Object> effectiveProps, 
-                                                      Class<?>[] ifaces) {
-        Map<String, Object> props = new HashMap<String, Object>();
-        copyEndpointProperties(effectiveProps, props);
-        props.remove(org.osgi.framework.Constants.SERVICE_ID);
-        EndpointHelper.addObjectClass(props, ifaces);
-        props.put(RemoteConstants.ENDPOINT_SERVICE_ID, effectiveProps.get(org.osgi.framework.Constants.SERVICE_ID));
-        String frameworkUUID = bctx.getProperty(org.osgi.framework.Constants.FRAMEWORK_UUID);
-        props.put(RemoteConstants.ENDPOINT_FRAMEWORK_UUID, frameworkUUID);
-        for (Class<?> iface : ifaces) {
-            String pkg = iface.getPackage().getName();
-            props.put(RemoteConstants.ENDPOINT_PACKAGE_VERSION_ + pkg, PackageUtil.getVersion(iface, bctx));
-        }
-        return props;
-    }
-
-
-
-    private void copyEndpointProperties(Map<String, Object> sd, Map<String, Object> endpointProps) {
-        Set<Map.Entry<String, Object>> keys = sd.entrySet();
-        for (Map.Entry<String, Object> entry : keys) {
-            String skey = entry.getKey();
-            if (!skey.startsWith(".")) {
-                endpointProps.put(skey, entry.getValue());
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminInstance.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminInstance.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminInstance.java
deleted file mode 100644
index fc3a67e..0000000
--- a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminInstance.java
+++ /dev/null
@@ -1,99 +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.service;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.EndpointPermission;
-import org.osgi.service.remoteserviceadmin.ExportReference;
-import org.osgi.service.remoteserviceadmin.ExportRegistration;
-import org.osgi.service.remoteserviceadmin.ImportReference;
-import org.osgi.service.remoteserviceadmin.ImportRegistration;
-import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
-
-public class RemoteServiceAdminInstance implements RemoteServiceAdmin {
-
-    private final BundleContext bctx;
-    private final RemoteServiceAdminCore rsaCore;
-
-    private boolean closed;
-
-    public RemoteServiceAdminInstance(BundleContext bc, RemoteServiceAdminCore core) {
-        bctx = bc;
-        rsaCore = core;
-    }
-
-    @Override
-    @SuppressWarnings("rawtypes")
-    public List<ExportRegistration> exportService(final ServiceReference ref, final Map properties) {
-        checkPermission(new EndpointPermission("*", EndpointPermission.EXPORT));
-        return AccessController.doPrivileged(new PrivilegedAction<List<ExportRegistration>>() {
-            public List<ExportRegistration> run() {
-                return closed ? Collections.<ExportRegistration>emptyList() : rsaCore.exportService(ref, properties);
-            }
-        });
-    }
-
-    @Override
-    public Collection<ExportReference> getExportedServices() {
-        checkPermission(new EndpointPermission("*", EndpointPermission.READ));
-        return closed ? null : rsaCore.getExportedServices();
-    }
-
-    @Override
-    public Collection<ImportReference> getImportedEndpoints() {
-        checkPermission(new EndpointPermission("*", EndpointPermission.READ));
-        return closed ? null : rsaCore.getImportedEndpoints();
-    }
-
-    @Override
-    public ImportRegistration importService(final EndpointDescription endpoint) {
-        String frameworkUUID = bctx.getProperty(Constants.FRAMEWORK_UUID);
-        checkPermission(new EndpointPermission(endpoint, frameworkUUID, EndpointPermission.IMPORT));
-        return AccessController.doPrivileged(new PrivilegedAction<ImportRegistration>() {
-            public ImportRegistration run() {
-                return closed ? null : rsaCore.importService(endpoint);
-            }
-        });
-    }
-
-    public void close(boolean closeAll) {
-        closed = true;
-        rsaCore.removeExportRegistrations(bctx.getBundle());
-        if (closeAll) {
-            rsaCore.close();
-        }
-    }
-
-    private void checkPermission(EndpointPermission permission) {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null) {
-            sm.checkPermission(permission);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java
deleted file mode 100644
index 968ff16..0000000
--- a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java
+++ /dev/null
@@ -1,51 +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.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<RemoteServiceAdmin> {
-
-    private static final Logger LOG = LoggerFactory.getLogger(RemoteServiceadminFactory.class);
-
-    private final RemoteServiceAdminCore rsaCore;
-    private int instances;
-
-    public RemoteServiceadminFactory(RemoteServiceAdminCore rsaCore) {
-        this.rsaCore = rsaCore;
-    }
-
-    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<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/1425743f/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/StringPlus.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/StringPlus.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/StringPlus.java
deleted file mode 100644
index e449f1d..0000000
--- a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/StringPlus.java
+++ /dev/null
@@ -1,72 +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.service;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public final class StringPlus {
-
-    private static final Logger LOG = LoggerFactory.getLogger(StringPlus.class);
-
-    private StringPlus() {
-        // never constructed
-    }
-
-    @SuppressWarnings("rawtypes")
-    public static String[] normalize(Object object) {
-        if (object instanceof String) {
-            String s = (String)object;
-            String[] values = s.split(",");
-            List<String> list = new ArrayList<String>();
-            for (String val : values) {
-                String actualValue = val.trim();
-                if (!actualValue.isEmpty()) {
-                    list.add(actualValue);
-                }
-            }
-            return list.toArray(new String[list.size()]);
-        }
-
-        if (object instanceof String[]) {
-            return (String[])object;
-        }
-        
-        if (object instanceof Collection) {
-            Collection col = (Collection)object;
-            List<String> ar = new ArrayList<String>(col.size());
-            for (Object o : col) {
-                if (o instanceof String) {
-                    String s = (String)o;
-                    ar.add(s);
-                } else {
-                    LOG.warn("stringPlus contained non string element in list! Element was skipped");
-                }
-            }
-            return ar.toArray(new String[ar.size()]);
-        }
-
-        return null;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactoryTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactoryTest.java b/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactoryTest.java
deleted file mode 100644
index fbe2c02..0000000
--- a/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactoryTest.java
+++ /dev/null
@@ -1,92 +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.service;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.framework.wiring.BundleWiring;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.isA;
-
-
-public class ClientServiceFactoryTest extends TestCase {
-
-    @SuppressWarnings({
-     "rawtypes"
-    })
-    public void testGetService() throws ClassNotFoundException {
-        final Object myTestProxyObject = new Object();
-
-        IMocksControl control = EasyMock.createControl();
-        EndpointDescription endpoint = createTestEndpointDesc();
-        ImportRegistrationImpl iri = new ImportRegistrationImpl(endpoint, null);
-
-        BundleContext consumerContext = control.createMock(BundleContext.class);
-        Bundle consumerBundle = control.createMock(Bundle.class);
-        BundleWiring bundleWiring = control.createMock(BundleWiring.class);
-        EasyMock.expect(bundleWiring.getClassLoader()).andReturn(this.getClass().getClassLoader());
-        EasyMock.expect(consumerBundle.adapt(BundleWiring.class)).andReturn(bundleWiring);
-        EasyMock.expect(consumerBundle.getBundleContext()).andReturn(consumerContext);
-        ServiceRegistration sreg = control.createMock(ServiceRegistration.class);
-
-
-        DistributionProvider handler = mockDistributionProvider(myTestProxyObject);
-        control.replay();
-
-        ClientServiceFactory csf = new ClientServiceFactory(endpoint, handler, iri);
-        assertSame(myTestProxyObject, csf.getService(consumerBundle, sreg));
-    }
-
-    /**
-     * Creating dummy class as I was not able to really mock it
-     * @param myTestProxyObject
-     * @return
-     */
-    private DistributionProvider mockDistributionProvider(final Object proxy) {
-        DistributionProvider handler = EasyMock.createMock(DistributionProvider.class);
-        EasyMock.expect(handler.importEndpoint(anyObject(ClassLoader.class), 
-                                               anyObject(BundleContext.class), 
-                                               isA(Class[].class), 
-                                               anyObject(EndpointDescription.class))).andReturn(proxy);
-        EasyMock.replay(handler);
-        return handler;
-    }
-
-    private EndpointDescription createTestEndpointDesc() {
-        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[]{String.class.getName()});
-        EndpointDescription endpoint = new EndpointDescription(map);
-        return endpoint;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderTrackerTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderTrackerTest.java b/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderTrackerTest.java
deleted file mode 100644
index 6ae7004..0000000
--- a/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderTrackerTest.java
+++ /dev/null
@@ -1,82 +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.service;
-
-import java.util.Dictionary;
-
-import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-import org.junit.Test;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceFactory;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
-public class DistributionProviderTrackerTest {
-
-    @SuppressWarnings({
-     "unchecked", "rawtypes"
-    })
-    @Test
-    public void testAddingRemoved() throws InvalidSyntaxException {
-        IMocksControl c = EasyMock.createControl();
-        DistributionProvider provider = c.createMock(DistributionProvider.class);
-        
-        ServiceReference<DistributionProvider> providerRef = c.createMock(ServiceReference.class);
-        EasyMock.expect(providerRef.getProperty(RemoteConstants.REMOTE_INTENTS_SUPPORTED)).andReturn("");
-        EasyMock.expect(providerRef.getProperty(RemoteConstants.REMOTE_CONFIGS_SUPPORTED)).andReturn("");
-
-        BundleContext context = c.createMock(BundleContext.class);
-        Filter filter = FrameworkUtil.createFilter("(objectClass=org.apache.cxf.dosgi.dsw.api.DistributionProvider)");
-        EasyMock.expect(context.createFilter("(objectClass=org.apache.cxf.dosgi.dsw.api.DistributionProvider)"))
-            .andReturn(filter);
-        EasyMock.expect(context.getService(providerRef)).andReturn(provider);
-        ServiceRegistration rsaReg = c.createMock(ServiceRegistration.class);
-        EasyMock.expect(context.registerService(EasyMock.isA(String.class), EasyMock.isA(ServiceFactory.class), 
-                                                EasyMock.isA(Dictionary.class)))
-            .andReturn(rsaReg).atLeastOnce();
-
-        context.addServiceListener(EasyMock.isA(ServiceListener.class), EasyMock.isA(String.class));
-        EasyMock.expectLastCall();
-        
-        final BundleContext apiContext = c.createMock(BundleContext.class);
-        c.replay();
-        DistributionProviderTracker tracker = new DistributionProviderTracker(context) {
-            protected BundleContext getAPIContext() {
-                return apiContext;
-            };
-        };
-        tracker.addingService(providerRef);
-        c.verify();
-        
-        c.reset();
-        rsaReg.unregister();
-        EasyMock.expectLastCall();
-        EasyMock.expect(context.ungetService(providerRef)).andReturn(true);
-        c.replay();
-        tracker.removedService(providerRef, rsaReg);
-        c.verify();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/EventProducerTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/EventProducerTest.java b/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/EventProducerTest.java
deleted file mode 100644
index 71d3ed7..0000000
--- a/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/EventProducerTest.java
+++ /dev/null
@@ -1,189 +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.service;
-
-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.api.Endpoint;
-import org.easymock.EasyMock;
-import org.easymock.IAnswer;
-import org.junit.Assert;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.Version;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventAdmin;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.ExportReference;
-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 epd = EasyMock.createNiceMock(EndpointDescription.class);
-        EasyMock.expect(epd.getServiceId()).andReturn(Long.MAX_VALUE).anyTimes();
-        final String uuid = UUID.randomUUID().toString();
-        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(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);
-
-        final Bundle bundle = EasyMock.createNiceMock(Bundle.class);
-        EasyMock.expect(bundle.getBundleId()).andReturn(42L).anyTimes();
-        EasyMock.expect(bundle.getSymbolicName()).andReturn("test.bundle").anyTimes();
-        Dictionary<String, String> headers = new Hashtable<String, String>();
-        headers.put("Bundle-Version", "1.2.3.test");
-        EasyMock.expect(bundle.getHeaders()).andReturn(headers).anyTimes();
-        EasyMock.replay(bundle);
-
-        EventAdmin ea = EasyMock.createNiceMock(EventAdmin.class);
-        ea.postEvent((Event) EasyMock.anyObject());
-        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
-            @Override
-            public Object answer() throws Throwable {
-                Event event = (Event) EasyMock.getCurrentArguments()[0];
-
-                Assert.assertEquals("org/osgi/service/remoteserviceadmin/EXPORT_REGISTRATION", event.getTopic());
-                Assert.assertSame(bundle, event.getProperty("bundle"));
-                Assert.assertEquals(42L, event.getProperty("bundle.id"));
-                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(epd, event.getProperty("export.registration"));
-
-                Assert.assertEquals(Long.MAX_VALUE, event.getProperty("service.remote.id"));
-                Assert.assertEquals(uuid, event.getProperty("service.remote.uuid"));
-                Assert.assertEquals("foo://bar", event.getProperty("service.remote.uri"));
-                Assert.assertTrue(Arrays.equals(interfaces.toArray(new String[] {}),
-                                                (String[]) event.getProperty("objectClass")));
-
-                Assert.assertNotNull(event.getProperty("timestamp"));
-
-                RemoteServiceAdminEvent rsae = (RemoteServiceAdminEvent) event.getProperty("event");
-                Assert.assertNull(rsae.getException());
-                Assert.assertEquals(RemoteServiceAdminEvent.EXPORT_REGISTRATION, rsae.getType());
-                Assert.assertSame(bundle, rsae.getSource());
-                ExportReference er = rsae.getExportReference();
-                Assert.assertSame(epd, er.getExportedEndpoint());
-                Assert.assertSame(sref, er.getExportedService());
-
-                return null;
-            }
-        });
-        EasyMock.replay(ea);
-
-        ServiceReference eaSref = EasyMock.createNiceMock(ServiceReference.class);
-        EasyMock.replay(eaSref);
-
-        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-        EasyMock.expect(bc.getBundle()).andReturn(bundle).anyTimes();
-        EasyMock.expect(bc.getAllServiceReferences(EventAdmin.class.getName(), null))
-            .andReturn(new ServiceReference[] {eaSref}).anyTimes();
-        EasyMock.expect(bc.getService(eaSref)).andReturn(ea).anyTimes();
-        Endpoint endpoint = EasyMock.mock(Endpoint.class);
-        EasyMock.expect(endpoint.description()).andReturn(epd);
-        EasyMock.replay(endpoint);
-        EasyMock.replay(bc);
-        EventProducer eventProducer = new EventProducer(bc);
-
-        ExportRegistrationImpl ereg = new ExportRegistrationImpl(sref, endpoint, remoteServiceAdminCore);
-        eventProducer.publishNotification(ereg);
-    }
-
-    @Test
-    public void testPublishErrorNotification() throws Exception {
-        RemoteServiceAdminCore rsaCore = EasyMock.createNiceMock(RemoteServiceAdminCore.class);
-        EasyMock.replay(rsaCore);
-
-        final EndpointDescription endpoint = EasyMock.createNiceMock(EndpointDescription.class);
-        EasyMock.expect(endpoint.getInterfaces()).andReturn(Arrays.asList("org.foo.Bar")).anyTimes();
-        EasyMock.replay(endpoint);
-        final ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
-        EasyMock.replay(sref);
-
-        final Bundle bundle = EasyMock.createNiceMock(Bundle.class);
-        EasyMock.expect(bundle.getBundleId()).andReturn(42L).anyTimes();
-        EasyMock.expect(bundle.getSymbolicName()).andReturn("test.bundle").anyTimes();
-        EasyMock.expect(bundle.getHeaders()).andReturn(new Hashtable<String, String>()).anyTimes();
-        EasyMock.replay(bundle);
-
-        final Exception exportException = new Exception();
-
-        EventAdmin ea = EasyMock.createNiceMock(EventAdmin.class);
-        ea.postEvent((Event) EasyMock.anyObject());
-        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
-            @Override
-            public Object answer() throws Throwable {
-                Event event = (Event) EasyMock.getCurrentArguments()[0];
-
-                Assert.assertEquals("org/osgi/service/remoteserviceadmin/EXPORT_ERROR", event.getTopic());
-                Assert.assertSame(bundle, event.getProperty("bundle"));
-                Assert.assertEquals(42L, event.getProperty("bundle.id"));
-                Assert.assertEquals("test.bundle", event.getProperty("bundle.symbolicname"));
-                Assert.assertEquals(new Version("0"), event.getProperty("bundle.version"));
-                Assert.assertSame(exportException, event.getProperty("cause"));
-                Assert.assertEquals(endpoint, event.getProperty("export.registration"));
-                Assert.assertTrue(Arrays.equals(new String[] {"org.foo.Bar"},
-                                                (String[]) event.getProperty("objectClass")));
-
-                RemoteServiceAdminEvent rsae = (RemoteServiceAdminEvent) event.getProperty("event");
-                Assert.assertSame(exportException, rsae.getException());
-                Assert.assertEquals(RemoteServiceAdminEvent.EXPORT_ERROR, rsae.getType());
-                Assert.assertSame(bundle, rsae.getSource());
-                ExportReference er = rsae.getExportReference();
-                Assert.assertSame(endpoint, er.getExportedEndpoint());
-                Assert.assertSame(sref, er.getExportedService());
-
-                return null;
-            }
-        });
-        EasyMock.replay(ea);
-
-        ServiceReference eaSref = EasyMock.createNiceMock(ServiceReference.class);
-        EasyMock.replay(eaSref);
-
-        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-        EasyMock.expect(bc.getBundle()).andReturn(bundle).anyTimes();
-        EasyMock.expect(bc.getAllServiceReferences(EventAdmin.class.getName(), null))
-            .andReturn(new ServiceReference[] {eaSref}).anyTimes();
-        EasyMock.expect(bc.getService(eaSref)).andReturn(ea).anyTimes();
-        EasyMock.replay(bc);
-        EventProducer eventProducer = new EventProducer(bc);
-
-        ExportRegistrationImpl ereg = new ExportRegistrationImpl(rsaCore, exportException);
-        eventProducer.publishNotification(Arrays.<ExportRegistration>asList(ereg));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java b/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java
deleted file mode 100644
index 23902a5..0000000
--- a/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java
+++ /dev/null
@@ -1,178 +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.service;
-
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-public class ImportRegistrationImplTest {
-
-    @Test
-    public void testException() {
-        IMocksControl c = EasyMock.createNiceControl();
-        Exception e = c.createMock(Exception.class);
-        c.replay();
-
-        ImportRegistrationImpl i = new ImportRegistrationImpl(e);
-
-        assertEquals(e, i.getException());
-        assertNull(i.getImportedEndpointDescription());
-        assertNull(i.getImportedService());
-        assertEquals(i, i.getParent());
-    }
-
-    @Test
-    public void testDefaultCtor() {
-        IMocksControl c = EasyMock.createNiceControl();
-        EndpointDescription endpoint = c.createMock(EndpointDescription.class);
-        RemoteServiceAdminCore rsac = c.createMock(RemoteServiceAdminCore.class);
-
-        c.replay();
-
-        ImportRegistrationImpl i = new ImportRegistrationImpl(endpoint, rsac);
-
-        assertNull(i.getException());
-        assertEquals(i, i.getParent());
-        assertEquals(endpoint, i.getImportedEndpointDescription());
-    }
-
-    @SuppressWarnings("rawtypes")
-    @Test
-    public void testCloneAndClose() {
-        IMocksControl c = EasyMock.createControl();
-        EndpointDescription endpoint = c.createMock(EndpointDescription.class);
-        RemoteServiceAdminCore rsac = c.createMock(RemoteServiceAdminCore.class);
-
-        ServiceRegistration sr = c.createMock(ServiceRegistration.class);
-        ServiceReference sref = c.createMock(ServiceReference.class);
-        EasyMock.expect(sr.getReference()).andReturn(sref).anyTimes();
-
-        c.replay();
-
-        ImportRegistrationImpl i1 = new ImportRegistrationImpl(endpoint, rsac);
-
-        ImportRegistrationImpl i2 = new ImportRegistrationImpl(i1);
-
-        ImportRegistrationImpl i3 = new ImportRegistrationImpl(i2);
-
-        try {
-            i2.setImportedServiceRegistration(sr);
-            assertTrue("An exception should be thrown here !", false);
-        } catch (IllegalStateException e) {
-            // must be thrown here
-        }
-
-        i1.setImportedServiceRegistration(sr);
-
-        assertEquals(i1, i1.getParent());
-        assertEquals(i1, i2.getParent());
-        assertEquals(i1, i3.getParent());
-
-        assertEquals(endpoint, i1.getImportedEndpointDescription());
-        assertEquals(endpoint, i2.getImportedEndpointDescription());
-        assertEquals(endpoint, i3.getImportedEndpointDescription());
-
-        c.verify();
-        c.reset();
-
-        rsac.removeImportRegistration(EasyMock.eq(i3));
-        EasyMock.expectLastCall().once();
-
-        c.replay();
-
-        i3.close();
-        i3.close(); // shouldn't change anything
-
-        assertNull(i3.getImportedEndpointDescription());
-
-        c.verify();
-        c.reset();
-
-        rsac.removeImportRegistration(EasyMock.eq(i1));
-        EasyMock.expectLastCall().once();
-
-        c.replay();
-
-        i1.close();
-
-        c.verify();
-        c.reset();
-
-        rsac.removeImportRegistration(EasyMock.eq(i2));
-        EasyMock.expectLastCall().once();
-
-        sr.unregister();
-        EasyMock.expectLastCall().once();
-
-        c.replay();
-
-        i2.close();
-
-        c.verify();
-    }
-
-    @Test
-    public void testCloseAll() {
-        IMocksControl c = EasyMock.createControl();
-        EndpointDescription endpoint = c.createMock(EndpointDescription.class);
-        RemoteServiceAdminCore rsac = c.createMock(RemoteServiceAdminCore.class);
-
-        c.replay();
-
-        ImportRegistrationImpl i1 = new ImportRegistrationImpl(endpoint, rsac);
-
-        ImportRegistrationImpl i2 = new ImportRegistrationImpl(i1);
-
-        ImportRegistrationImpl i3 = new ImportRegistrationImpl(i2);
-
-        assertEquals(i1, i1.getParent());
-        assertEquals(i1, i2.getParent());
-        assertEquals(i1, i3.getParent());
-
-        c.verify();
-        c.reset();
-
-        rsac.removeImportRegistration(EasyMock.eq(i2));
-        EasyMock.expectLastCall().once();
-
-        c.replay();
-
-        i2.close();
-
-        c.verify();
-        c.reset();
-
-        rsac.removeImportRegistration(EasyMock.eq(i1));
-        EasyMock.expectLastCall().once();
-        rsac.removeImportRegistration(EasyMock.eq(i3));
-        EasyMock.expectLastCall().once();
-
-        c.replay();
-        i3.closeAll();
-        c.verify();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java b/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
deleted file mode 100644
index b0f58eb..0000000
--- a/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
+++ /dev/null
@@ -1,517 +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.service;
-
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
-import org.apache.cxf.dosgi.dsw.api.Endpoint;
-import org.easymock.EasyMock;
-import org.easymock.IAnswer;
-import org.easymock.IMocksControl;
-import org.junit.Assert;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.packageadmin.PackageAdmin;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.ExportRegistration;
-import org.osgi.service.remoteserviceadmin.ImportRegistration;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.isA;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-@SuppressWarnings({
-    "rawtypes", "unchecked", "deprecation"
-   })
-public class RemoteServiceAdminCoreTest {
-
-    private static final String MYCONFIG = "myconfig";
-
-    @Test
-    public void testDontExportOwnServiceProxies() throws InvalidSyntaxException {
-        IMocksControl c = EasyMock.createControl();
-        Bundle b = c.createMock(Bundle.class);
-        BundleContext bc = c.createMock(BundleContext.class);
-
-        EasyMock.expect(bc.getBundle()).andReturn(b).anyTimes();
-        bc.addServiceListener(EasyMock.<ServiceListener>anyObject(), EasyMock.<String>anyObject());
-        EasyMock.expectLastCall().anyTimes();
-        bc.removeServiceListener(EasyMock.<ServiceListener>anyObject());
-        EasyMock.expectLastCall().anyTimes();
-
-        Dictionary<String, String> d = new Hashtable<String, String>();
-        EasyMock.expect(b.getHeaders()).andReturn(d).anyTimes();
-
-        ServiceReference sref = c.createMock(ServiceReference.class);
-        EasyMock.expect(sref.getBundle()).andReturn(b).anyTimes();
-        EasyMock.expect(sref.getPropertyKeys())
-            .andReturn(new String[]{"objectClass", "service.exported.interfaces"}).anyTimes();
-        EasyMock.expect(sref.getProperty("objectClass")).andReturn(new String[] {"a.b.C"}).anyTimes();
-        EasyMock.expect(sref.getProperty(RemoteConstants.SERVICE_IMPORTED)).andReturn(true).anyTimes();
-        EasyMock.expect(sref.getProperty("service.exported.interfaces")).andReturn("*").anyTimes();
-
-        DistributionProvider provider = c.createMock(DistributionProvider.class);
-
-        c.replay();
-
-        RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, bc, provider);
-
-        // must return an empty List as sref if from the same bundle
-        List<ExportRegistration> exRefs = rsaCore.exportService(sref, null);
-
-        assertNotNull(exRefs);
-        assertEquals(0, exRefs.size());
-
-        // must be empty
-        assertEquals(rsaCore.getExportedServices().size(), 0);
-
-        c.verify();
-    }
-
-    @Test
-    public void testImport() {
-        IMocksControl c = EasyMock.createNiceControl();
-        Bundle b = c.createMock(Bundle.class);
-        BundleContext bc = c.createMock(BundleContext.class);
-
-        Dictionary<String, String> d = new Hashtable<String, String>();
-        EasyMock.expect(b.getHeaders()).andReturn(d).anyTimes();
-
-        EasyMock.expect(bc.getBundle()).andReturn(b).anyTimes();
-        EasyMock.expect(b.getSymbolicName()).andReturn("BundleName").anyTimes();
-
-        EndpointDescription endpoint = creatEndpointDesc("unsupportedConfiguration");
-
-        DistributionProvider provider = c.createMock(DistributionProvider.class);
-        EasyMock.expect(provider.getSupportedTypes())
-            .andReturn(new String[]{MYCONFIG}).atLeastOnce();
-        c.replay();
-
-        RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, bc, provider);
-
-        // must be null as the endpoint doesn't contain any usable configurations
-        assertNull(rsaCore.importService(endpoint));
-        // must be empty
-        assertEquals(0, rsaCore.getImportedEndpoints().size());
-
-        EndpointDescription endpoint2 = creatEndpointDesc(MYCONFIG);
-
-        ImportRegistration ireg = rsaCore.importService(endpoint2);
-        assertNotNull(ireg);
-
-        assertEquals(1, rsaCore.getImportedEndpoints().size());
-
-        // lets import the same endpoint once more -> should get a copy of the ImportRegistration
-        ImportRegistration ireg2 = rsaCore.importService(endpoint2);
-        assertNotNull(ireg2);
-        assertEquals(2, rsaCore.getImportedEndpoints().size());
-
-        assertEquals(ireg.getImportReference(), (rsaCore.getImportedEndpoints().toArray())[0]);
-
-        assertEquals(ireg.getImportReference().getImportedEndpoint(), ireg2.getImportReference()
-            .getImportedEndpoint());
-
-        // remove the registration
-
-        // first call shouldn't remove the import
-        ireg2.close();
-        assertEquals(1, rsaCore.getImportedEndpoints().size());
-
-        // second call should really close and remove the import
-        ireg.close();
-        assertEquals(0, rsaCore.getImportedEndpoints().size());
-
-        c.verify();
-    }
-
-    private EndpointDescription creatEndpointDesc(String configType) {
-        Map<String, Object> p = new HashMap<String, Object>();
-        p.put(RemoteConstants.ENDPOINT_ID, "http://google.de");
-        p.put(Constants.OBJECTCLASS, new String[] {
-            "es.schaaf.my.class"
-        });
-        p.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, configType);
-        EndpointDescription endpoint = new EndpointDescription(p);
-        return endpoint;
-    }
-
-    @Test
-    public void testExport() throws Exception {
-        BundleContext bc = EasyMock.createMock(BundleContext.class);
-        EasyMock.expect(bc.getProperty(Constants.FRAMEWORK_VERSION)).andReturn(null).anyTimes();
-        bc.addServiceListener(EasyMock.<ServiceListener>anyObject(), EasyMock.<String>anyObject());
-        EasyMock.expectLastCall().anyTimes();
-        bc.removeServiceListener(EasyMock.<ServiceListener>anyObject());
-        EasyMock.expectLastCall().anyTimes();
-        EasyMock.expect(bc.getServiceReferences(EasyMock.<String>anyObject(),
-                                                EasyMock.<String>anyObject())).andReturn(null).anyTimes();
-        EasyMock.expect(bc.getAllServiceReferences(EasyMock.<String>anyObject(),
-                                                   EasyMock.<String>anyObject())).andReturn(null).anyTimes();
-
-        Bundle b = createDummyRsaBundle(bc);
-
-        final Map<String, Object> sProps = new HashMap<String, Object>();
-        sProps.put("objectClass", new String[] {"java.lang.Runnable"});
-        sProps.put("service.id", 51L);
-        sProps.put("myProp", "myVal");
-        sProps.put("service.exported.interfaces", "*");
-        ServiceReference sref = mockServiceReference(sProps);
-
-        Runnable svcObject = EasyMock.createNiceMock(Runnable.class);
-        EasyMock.replay(svcObject);
-
-        EasyMock.expect(bc.getService(sref)).andReturn(svcObject).anyTimes();
-        EasyMock.expect(bc.getBundle()).andReturn(b).anyTimes();
-        EasyMock.expect(bc.createFilter("(service.id=51)"))
-            .andReturn(FrameworkUtil.createFilter("(service.id=51)")).anyTimes();
-        EasyMock.expect(bc.getProperty(org.osgi.framework.Constants.FRAMEWORK_UUID)).andReturn("1111");
-        EasyMock.expect(bc.getServiceReference(PackageAdmin.class)).andReturn(null);
-        EasyMock.replay(bc);
-
-        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"});
-        final EndpointDescription epd = new EndpointDescription(eProps);
-        Endpoint er = new Endpoint() {
-            
-            @Override
-            public void close() throws IOException {
-            }
-            
-            @Override
-            public EndpointDescription description() {
-                return epd;
-            }
-        };
-
-        DistributionProvider handler = EasyMock.createMock(DistributionProvider.class);
-        EasyMock.expect(handler.exportService(anyObject(),
-                                              anyObject(BundleContext.class), 
-                                              anyObject(Map.class), isA(Class[].class))).andReturn(er);
-        EasyMock.replay(handler);
-
-        RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, bc, handler);
-
-        // Export the service for the first time
-        List<ExportRegistration> ereg = rsaCore.exportService(sref, null);
-        assertEquals(1, ereg.size());
-        assertNull(ereg.get(0).getException());
-        assertSame(sref, ereg.get(0).getExportReference().getExportedService());
-        EndpointDescription endpoint = ereg.get(0).getExportReference().getExportedEndpoint();
-
-        Map<String, Object> edProps = endpoint.getProperties();
-        assertEquals("http://something", edProps.get("endpoint.id"));
-        assertNotNull(edProps.get("service.imported"));
-        assertTrue(Arrays.equals(new String[] {"java.lang.Runnable"},
-                                 (Object[]) edProps.get("objectClass")));
-        assertTrue(Arrays.equals(new String[] {"org.apache.cxf.ws"},
-                                 (Object[]) edProps.get("service.imported.configs")));
-
-        // Ask to export the same service again, this should not go through the whole process again but simply return
-        // a copy of the first instance.
-        final Map<String, Object> sProps2 = new HashMap<String, Object>();
-        sProps2.put("objectClass", new String[] {"java.lang.Runnable"});
-        sProps2.put("service.id", 51L);
-        sProps2.put("service.exported.interfaces", "*");
-        ServiceReference sref2 = mockServiceReference(sProps2);
-        Map<String, Object> props2 = new HashMap<String, Object>();
-        props2.put("myProp", "myVal");
-        List<ExportRegistration> ereg2 = rsaCore.exportService(sref2, props2);
-
-        assertEquals(1, ereg2.size());
-        assertNull(ereg2.get(0).getException());
-        assertEquals(ereg.get(0).getExportReference().getExportedEndpoint().getProperties(),
-                ereg2.get(0).getExportReference().getExportedEndpoint().getProperties());
-
-        // Look at the exportedServices data structure
-        Field field = RemoteServiceAdminCore.class.getDeclaredField("exportedServices");
-        field.setAccessible(true);
-        Map<Map<String, Object>, Collection<ExportRegistration>> exportedServices =
-                (Map<Map<String, Object>, Collection<ExportRegistration>>) field.get(rsaCore);
-
-        assertEquals("One service was exported", 1, exportedServices.size());
-        assertEquals("There are 2 export registrations (identical copies)",
-                2, exportedServices.values().iterator().next().size());
-
-        // Unregister one of the exports
-        rsaCore.removeExportRegistration((ExportRegistrationImpl) ereg.get(0));
-        assertEquals("One service was exported", 1, exportedServices.size());
-        assertEquals("There 1 export registrations left",
-                1, exportedServices.values().iterator().next().size());
-
-        // Unregister the other export
-        rsaCore.removeExportRegistration((ExportRegistrationImpl) ereg2.get(0));
-        assertEquals("No more exported services", 0, exportedServices.size());
-    }
-
-    private Bundle createDummyRsaBundle(BundleContext bc) {
-        Bundle b = EasyMock.createNiceMock(Bundle.class);
-        EasyMock.expect(b.getBundleContext()).andReturn(bc).anyTimes();
-        EasyMock.expect(b.getSymbolicName()).andReturn("rsabundle").anyTimes();
-        EasyMock.expect(b.getHeaders()).andReturn(new Hashtable<String, String>()).anyTimes();
-        EasyMock.replay(b);
-        return b;
-    }
-
-    @Test
-    public void testExportException() throws Exception {
-        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-
-        Bundle b = createDummyRsaBundle(bc);
-
-        final Map<String, Object> sProps = new HashMap<String, Object>();
-        sProps.put("objectClass", new String[] {"java.lang.Runnable"});
-        sProps.put("service.id", 51L);
-        sProps.put("service.exported.interfaces", "*");
-        ServiceReference sref = mockServiceReference(sProps);
-
-        Runnable svcObject = EasyMock.createNiceMock(Runnable.class);
-        EasyMock.replay(svcObject);
-
-        EasyMock.expect(bc.getService(sref)).andReturn(svcObject).anyTimes();
-        EasyMock.expect(bc.getBundle()).andReturn(b).anyTimes();
-        EasyMock.replay(bc);
-
-        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"});
-
-        DistributionProvider handler = EasyMock.createMock(DistributionProvider.class);
-        EasyMock.expect(handler.exportService(anyObject(),
-                                              anyObject(BundleContext.class), 
-                                              anyObject(Map.class), isA(Class[].class))).andThrow(new TestException());
-        EasyMock.replay(handler);
-
-        RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, bc, handler);
-
-        List<ExportRegistration> ereg = rsaCore.exportService(sref, sProps);
-        assertEquals(1, ereg.size());
-        assertTrue(ereg.get(0).getException() instanceof TestException);
-
-        // Look at the exportedServices data structure
-        Field field = RemoteServiceAdminCore.class.getDeclaredField("exportedServices");
-        field.setAccessible(true);
-        Map<Map<String, Object>, Collection<ExportRegistration>> exportedServices =
-                (Map<Map<String, Object>, Collection<ExportRegistration>>) field.get(rsaCore);
-
-        assertEquals("One service was exported", 1, exportedServices.size());
-        assertEquals("There is 1 export registration",
-                1, exportedServices.values().iterator().next().size());
-
-    }
-
-    private ServiceReference mockServiceReference(final Map<String, Object> sProps) throws ClassNotFoundException {
-        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-
-        Bundle b = EasyMock.createNiceMock(Bundle.class);
-        EasyMock.expect(b.getBundleContext()).andReturn(bc).anyTimes();
-        EasyMock.expect((Class)b.loadClass(Runnable.class.getName())).andReturn(Runnable.class);
-        EasyMock.replay(b);
-
-        EasyMock.expect(bc.getBundle()).andReturn(b).anyTimes();
-        EasyMock.replay(bc);
-
-        ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
-        EasyMock.expect(sref.getBundle()).andReturn(b).anyTimes();
-        EasyMock.expect(sref.getPropertyKeys()).andReturn(sProps.keySet().toArray(new String[] {})).anyTimes();
-        EasyMock.expect(sref.getProperty((String) EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
-            @Override
-            public Object answer() throws Throwable {
-                return sProps.get(EasyMock.getCurrentArguments()[0]);
-            }
-        }).anyTimes();
-        EasyMock.replay(sref);
-        return sref;
-    }
-
-    @SuppressWarnings("serial")
-    private static class TestException extends RuntimeException {
-    }
-    
-    @Test
-    public void testOverlayProperties() {
-        Map<String, Object> sProps = new HashMap<String, Object>();
-        Map<String, Object> aProps = new HashMap<String, Object>();
-
-        RemoteServiceAdminCore.overlayProperties(sProps, aProps);
-        assertEquals(0, sProps.size());
-
-        sProps.put("aaa", "aval");
-        sProps.put("bbb", "bval");
-        sProps.put(Constants.OBJECTCLASS, new String[] {"X"});
-        sProps.put(Constants.SERVICE_ID, 17L);
-
-        aProps.put("AAA", "achanged");
-        aProps.put("CCC", "CVAL");
-        aProps.put(Constants.OBJECTCLASS, new String[] {"Y"});
-        aProps.put(Constants.SERVICE_ID.toUpperCase(), 51L);
-
-        Map<String, Object> aPropsOrg = new HashMap<String, Object>(aProps);
-        RemoteServiceAdminCore.overlayProperties(sProps, aProps);
-        assertEquals("The additional properties should not be modified", aPropsOrg, aProps);
-
-        assertEquals(5, sProps.size());
-        assertEquals("achanged", sProps.get("aaa"));
-        assertEquals("bval", sProps.get("bbb"));
-        assertEquals("CVAL", sProps.get("CCC"));
-        assertTrue("Should not be possible to override the objectClass property",
-                Arrays.equals(new String[] {"X"}, (Object[]) sProps.get(Constants.OBJECTCLASS)));
-        assertEquals("Should not be possible to override the service.id property",
-                17L, sProps.get(Constants.SERVICE_ID));
-    }
-    
-    @Test
-    public void testOverlayProperties2() {
-        Map<String, Object> original = new HashMap<String, Object>();
-
-        original.put("MyProp", "my value");
-        original.put(Constants.OBJECTCLASS, "myClass");
-
-        Map<String, Object> copy = new HashMap<String, Object>();
-        copy.putAll(original);
-
-        // nothing should change here
-        Map<String, Object> overload = new HashMap<String, Object>();
-        RemoteServiceAdminCore.overlayProperties(copy, overload);
-
-        assertEquals(original.size(), copy.size());
-        for (Object key : original.keySet()) {
-            assertEquals(original.get(key), copy.get(key));
-        }
-
-        copy.clear();
-        copy.putAll(original);
-
-        // a property should be added
-        overload = new HashMap<String, Object>();
-        overload.put("new", "prop");
-
-        RemoteServiceAdminCore.overlayProperties(copy, overload);
-
-        assertEquals(original.size() + 1, copy.size());
-        for (Object key : original.keySet()) {
-            assertEquals(original.get(key), copy.get(key));
-        }
-        assertNotNull(overload.get("new"));
-        assertEquals("prop", overload.get("new"));
-
-        copy.clear();
-        copy.putAll(original);
-
-        // only one property should be added
-        overload = new HashMap<String, Object>();
-        overload.put("new", "prop");
-        overload.put("NEW", "prop");
-
-        RemoteServiceAdminCore.overlayProperties(copy, overload);
-
-        assertEquals(original.size() + 1, copy.size());
-        for (Object key : original.keySet()) {
-            assertEquals(original.get(key), copy.get(key));
-        }
-        assertNotNull(overload.get("new"));
-        assertEquals("prop", overload.get("new"));
-
-        copy.clear();
-        copy.putAll(original);
-
-        // nothing should change here
-        overload = new HashMap<String, Object>();
-        overload.put(Constants.OBJECTCLASS, "assd");
-        overload.put(Constants.SERVICE_ID, "asasdasd");
-        RemoteServiceAdminCore.overlayProperties(copy, overload);
-
-        assertEquals(original.size(), copy.size());
-        for (Object key : original.keySet()) {
-            assertEquals(original.get(key), copy.get(key));
-        }
-
-        copy.clear();
-        copy.putAll(original);
-
-        // overwrite own prop
-        overload = new HashMap<String, Object>();
-        overload.put("MyProp", "newValue");
-        RemoteServiceAdminCore.overlayProperties(copy, overload);
-
-        assertEquals(original.size(), copy.size());
-        for (Object key : original.keySet()) {
-            if (!"MyProp".equals(key)) {
-                assertEquals(original.get(key), copy.get(key));
-            }
-        }
-        assertEquals("newValue", copy.get("MyProp"));
-
-        copy.clear();
-        copy.putAll(original);
-
-        // overwrite own prop in different case
-        overload = new HashMap<String, Object>();
-        overload.put("MYPROP", "newValue");
-        RemoteServiceAdminCore.overlayProperties(copy, overload);
-
-        assertEquals(original.size(), copy.size());
-        for (Object key : original.keySet()) {
-            if (!"MyProp".equals(key)) {
-                assertEquals(original.get(key), copy.get(key));
-            }
-        }
-        assertEquals("newValue", copy.get("MyProp"));
-    }
-    
-    @Test
-    public void testCreateEndpointProps() {
-        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-        EasyMock.expect(bc.getProperty("org.osgi.framework.uuid")).andReturn("some_uuid1");
-        EasyMock.replay(bc);
-
-        Map<String, Object> sd = new HashMap<String, Object>();
-        sd.put(org.osgi.framework.Constants.SERVICE_ID, 42);
-        DistributionProvider provider = null;
-        RemoteServiceAdminCore rsa = new RemoteServiceAdminCore(bc, bc, provider);
-        Map<String, Object> props = rsa.createEndpointProps(sd, new Class[]{String.class});
-
-        Assert.assertFalse(props.containsKey(org.osgi.framework.Constants.SERVICE_ID));
-        assertEquals(42, props.get(RemoteConstants.ENDPOINT_SERVICE_ID));
-        assertEquals("some_uuid1", props.get(RemoteConstants.ENDPOINT_FRAMEWORK_UUID));
-        assertEquals(Arrays.asList("java.lang.String"),
-                     Arrays.asList((Object[]) props.get(org.osgi.framework.Constants.OBJECTCLASS)));
-        assertEquals("0.0.0", props.get("endpoint.package.version.java.lang"));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/StringPlusTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/StringPlusTest.java b/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/StringPlusTest.java
deleted file mode 100644
index 5447966..0000000
--- a/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/StringPlusTest.java
+++ /dev/null
@@ -1,63 +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.service;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-
-public class StringPlusTest {
-
-    @Test
-    public void testSplitString() {
-        String[] values = StringPlus.normalize("1, 2");
-        assertEquals(2, values.length);
-        assertEquals(values[0], "1");
-        assertEquals(values[1], "2");
-    }
-
-    @Test
-    public void testNormalizeStringPlus() {
-        String s1 = "s1";
-        String s2 = "s2";
-        String s3 = "s3";
-
-        String[] sa = new String[] {
-            s1, s2, s3
-        };
-
-        Collection<Object> sl = new ArrayList<Object>(4);
-        sl.add(s1);
-        sl.add(s2);
-        sl.add(s3);
-        sl.add(new Object()); // must be skipped
-
-        assertArrayEquals(null, StringPlus.normalize(new Object()));
-        assertArrayEquals(new String[] {
-            s1
-        }, StringPlus.normalize(s1));
-        assertArrayEquals(sa, StringPlus.normalize(sa));
-        assertArrayEquals(sa, StringPlus.normalize(sl));
-    }
-
-}


[15/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

Posted by cs...@apache.org.
[DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead


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

Branch: refs/heads/master
Commit: 1425743fb41db6c5ede9fba7a8872c73a835a80e
Parents: 9ed37be
Author: Christian Schneider <ch...@die-schneider.net>
Authored: Fri Mar 11 23:53:28 2016 +0100
Committer: Christian Schneider <ch...@die-schneider.net>
Committed: Fri Mar 11 23:53:28 2016 +0100

----------------------------------------------------------------------
 cxf-dsw/pom.xml                                 | 155 +++++
 .../org/apache/cxf/dosgi/dsw/Activator.java     | 160 +++++
 .../org/apache/cxf/dosgi/dsw/Constants.java     | 146 +++++
 .../dosgi/dsw/decorator/DecorationParser.java   |  85 +++
 .../cxf/dosgi/dsw/decorator/InterfaceRule.java  |  96 +++
 .../apache/cxf/dosgi/dsw/decorator/Rule.java    |  41 ++
 .../dosgi/dsw/decorator/ServiceDecorator.java   |  28 +
 .../ServiceDecoratorBundleListener.java         |  48 ++
 .../dsw/decorator/ServiceDecoratorImpl.java     |  97 +++
 .../AbstractPojoConfigurationTypeHandler.java   | 243 ++++++++
 .../dsw/handlers/CXFDistributionProvider.java   | 178 ++++++
 .../cxf/dosgi/dsw/handlers/ClassUtils.java      | 142 +++++
 .../dosgi/dsw/handlers/HttpServiceManager.java  | 176 ++++++
 .../JaxRSPojoConfigurationTypeHandler.java      | 201 +++++++
 .../cxf/dosgi/dsw/handlers/JaxRSUtils.java      | 121 ++++
 .../cxf/dosgi/dsw/handlers/LocalHostUtil.java   |  92 +++
 .../handlers/PojoConfigurationTypeHandler.java  | 172 ++++++
 .../handlers/SecurityDelegatingHttpContext.java | 133 +++++
 .../cxf/dosgi/dsw/handlers/ServerWrapper.java   |  49 ++
 .../dsw/handlers/ServiceInvocationHandler.java  | 100 ++++
 .../handlers/WsdlConfigurationTypeHandler.java  | 160 +++++
 .../dosgi/dsw/qos/DefaultIntentMapFactory.java  |  52 ++
 .../apache/cxf/dosgi/dsw/qos/IntentManager.java |  31 +
 .../cxf/dosgi/dsw/qos/IntentManagerImpl.java    | 155 +++++
 .../org/apache/cxf/dosgi/dsw/qos/IntentMap.java |  62 ++
 .../apache/cxf/dosgi/dsw/qos/IntentTracker.java |  62 ++
 .../apache/cxf/dosgi/dsw/qos/IntentUtils.java   |  86 +++
 .../apache/cxf/dosgi/dsw/util/OsgiUtils.java    | 132 +++++
 .../apache/cxf/dosgi/dsw/util/StringPlus.java   |  72 +++
 .../src/main/resources/service-decoration.xsd   |  67 +++
 .../org/apache/cxf/dosgi/dsw/ActivatorTest.java |  66 +++
 .../org/apache/cxf/dosgi/dsw/TestUtils.java     |  37 ++
 .../dsw/decorator/DecorationParserTest.java     |  63 ++
 .../dosgi/dsw/decorator/InterfaceRuleTest.java  | 163 +++++
 .../ServiceDecoratorBundleListenerTest.java     |  69 +++
 .../dsw/decorator/ServiceDecoratorImplTest.java | 187 ++++++
 .../handlers/CXFDistributionProviderTest.java   | 104 ++++
 .../cxf/dosgi/dsw/handlers/ClassUtilsTest.java  | 134 +++++
 .../dsw/handlers/HttpServiceManagerTest.java    | 125 ++++
 .../cxf/dosgi/dsw/handlers/JaxRSUtilsTest.java  | 195 ++++++
 .../PojoConfigurationTypeHandlerTest.java       | 422 +++++++++++++
 .../SecurityDelegatingHttpContextTest.java      | 267 +++++++++
 .../handlers/ServiceInvocationHandlerTest.java  |  75 +++
 .../WsdlConfigurationTypeHandlerTest.java       |  67 +++
 .../dsw/handlers/jaxws/MyJaxWsEchoService.java  |  26 +
 .../handlers/jaxws/MyJaxWsEchoServiceImpl.java  |  27 +
 .../handlers/simple/MySimpleEchoService.java    |  23 +
 .../simple/MySimpleEchoServiceImpl.java         |  27 +
 .../dsw/hooks/CxfFindListenerHookTest.java      | 341 +++++++++++
 .../cxf/dosgi/dsw/hooks/CxfPublishHookTest.java | 299 ++++++++++
 .../dosgi/dsw/hooks/ServiceHookUtilsTest.java   | 116 ++++
 .../apache/cxf/dosgi/dsw/hooks/TestService.java |  22 +
 .../dosgi/dsw/qos/IntentManagerImplTest.java    | 278 +++++++++
 .../apache/cxf/dosgi/dsw/qos/IntentMapTest.java |  41 ++
 .../cxf/dosgi/dsw/qos/IntentTrackerTest.java    |  80 +++
 .../cxf/dosgi/dsw/qos/IntentUtilsTest.java      |  70 +++
 .../cxf/dosgi/dsw/util/OsgiUtilsTest.java       | 152 +++++
 .../org/apache/cxf/dosgi/dsw/util/Provider.java |  23 +
 .../remote-service/alt-remote-services.xml      |  32 +
 .../OSGI-INF/remote-service/multi-services.xml  |  38 ++
 .../OSGI-INF/remote-service/remote-services.xml |  32 +
 .../src/test/resources/test-resources/rs1.xml   |  31 +
 .../src/test/resources/test-resources/rs2.xml   |  28 +
 .../src/test/resources/test-resources/sd-1.xml  |   3 +
 .../src/test/resources/test-resources/sd.xml    |   8 +
 .../src/test/resources/test-resources/sd0.xml   |   2 +
 .../src/test/resources/test-resources/sd1.xml   |   8 +
 .../src/test/resources/test-resources/sd2.xml   |  14 +
 discovery/distributed/cxf-discovery/pom.xml     | 120 ----
 .../dosgi/discovery/zookeeper/Activator.java    |  43 --
 .../discovery/zookeeper/ZooKeeperDiscovery.java | 164 ------
 .../zookeeper/publish/DiscoveryPlugin.java      |  54 --
 .../publish/PublishingEndpointListener.java     | 216 -------
 .../PublishingEndpointListenerFactory.java      | 105 ----
 .../subscribe/EndpointListenerTracker.java      |  56 --
 .../zookeeper/subscribe/InterfaceMonitor.java   | 262 ---------
 .../subscribe/InterfaceMonitorManager.java      | 218 -------
 .../dosgi/discovery/zookeeper/util/Utils.java   | 165 ------
 .../zookeeper/DiscoveryDriverTest.java          | 135 -----
 .../FindInZooKeeperCustomizerTest.java          | 301 ----------
 .../InterfaceDataMonitorListenerImplTest.java   | 183 ------
 .../PublishingEndpointListenerFactoryTest.java  | 100 ----
 .../publish/PublishingEndpointListenerTest.java | 201 -------
 .../subscribe/InterfaceMonitorManagerTest.java  | 139 -----
 .../subscribe/InterfaceMonitorTest.java         |  67 ---
 .../discovery/zookeeper/util/UtilsTest.java     | 110 ----
 discovery/distributed/pom.xml                   |  42 --
 .../distributed/zookeeper-server-config/pom.xml |  78 ---
 .../zookeeper/server/config/Activator.java      | 110 ----
 discovery/distributed/zookeeper-server/pom.xml  | 114 ----
 .../discovery/zookeeper/server/Activator.java   |  44 --
 .../dosgi/discovery/zookeeper/server/Utils.java | 108 ----
 .../zookeeper/server/ZookeeperStarter.java      | 164 ------
 .../resources/OSGI-INF/metatype/zookeeper.xml   |  34 --
 .../zookeeper/server/ZookeeperStarterTest.java  |  81 ---
 discovery/local/pom.xml                         |  99 ----
 .../discovery/local/internal/Activator.java     |  41 --
 .../local/internal/LocalDiscovery.java          | 242 --------
 .../cxf/dosgi/discovery/local/util/Utils.java   | 125 ----
 .../EndpointDescriptionBundleParser.java        | 104 ----
 .../endpointdesc/EndpointDescriptionParser.java |  90 ---
 .../dosgi/endpointdesc/PropertiesMapper.java    | 345 -----------
 .../src/main/resources/endpoint-description.xsd |  61 --
 .../discovery/local/internal/ActivatorTest.java |  52 --
 .../local/internal/LocalDiscoveryTest.java      | 409 -------------
 .../EndpointDescriptionBundleParserTest.java    | 138 -----
 .../EndpointDescriptionParserTest.java          |  49 --
 .../endpointdesc/PropertiesMapperTest.java      |  97 ---
 discovery/local/src/test/resources/ed1.xml      |  72 ---
 .../local/src/test/resources/ed2-generated.xml  |  54 --
 discovery/local/src/test/resources/ed2.xml      |  99 ----
 discovery/local/src/test/resources/ed3.xml      |  32 -
 discovery/local/src/test/resources/ed4.xml      |  43 --
 discovery/local/src/test/resources/sd.xml       |  23 -
 discovery/local/src/test/resources/sd2.xml      |  32 -
 discovery/pom.xml                               |  41 --
 .../features/src/main/resources/features.xml    |  33 +-
 distribution/multi-bundle/pom.xml               |   5 +-
 dsw/cxf-dosgi-provider-api/pom.xml              |  67 ---
 .../cxf/dosgi/dsw/api/DistributionProvider.java |  56 --
 .../org/apache/cxf/dosgi/dsw/api/Endpoint.java  |  27 -
 .../cxf/dosgi/dsw/api/EndpointHelper.java       |  41 --
 .../apache/cxf/dosgi/dsw/api/ExportPolicy.java  |  46 --
 .../dsw/api/IntentUnsatisfiedException.java     |  35 --
 dsw/cxf-dosgi-rsa/pom.xml                       |  73 ---
 .../apache/cxf/dosgi/dsw/service/Activator.java |  37 --
 .../dosgi/dsw/service/ClientServiceFactory.java | 110 ----
 .../service/DistributionProviderTracker.java    |  73 ---
 .../cxf/dosgi/dsw/service/EventAdminHelper.java | 151 -----
 .../cxf/dosgi/dsw/service/EventProducer.java    | 114 ----
 .../dosgi/dsw/service/ExportReferenceImpl.java  |  77 ---
 .../dsw/service/ExportRegistrationImpl.java     | 152 -----
 .../dsw/service/ImportRegistrationImpl.java     | 230 --------
 .../cxf/dosgi/dsw/service/PackageUtil.java      |  85 ---
 .../dsw/service/RemoteServiceAdminCore.java     | 587 -------------------
 .../dsw/service/RemoteServiceAdminInstance.java |  99 ----
 .../dsw/service/RemoteServiceadminFactory.java  |  51 --
 .../cxf/dosgi/dsw/service/StringPlus.java       |  72 ---
 .../dsw/service/ClientServiceFactoryTest.java   |  92 ---
 .../DistributionProviderTrackerTest.java        |  82 ---
 .../dosgi/dsw/service/EventProducerTest.java    | 189 ------
 .../dsw/service/ImportRegistrationImplTest.java | 178 ------
 .../dsw/service/RemoteServiceAdminCoreTest.java | 517 ----------------
 .../cxf/dosgi/dsw/service/StringPlusTest.java   |  63 --
 dsw/cxf-dosgi-tcp/pom.xml                       |  72 ---
 .../aries/rsa/provider/tcp/Activator.java       |  45 --
 .../provider/tcp/LoaderObjectInputStream.java   |  43 --
 .../aries/rsa/provider/tcp/LocalHostUtil.java   |  92 ---
 .../aries/rsa/provider/tcp/TCPProvider.java     |  67 ---
 .../aries/rsa/provider/tcp/TCPServer.java       | 118 ----
 .../aries/rsa/provider/tcp/TcpEndpoint.java     |  58 --
 .../rsa/provider/tcp/TcpInvocationHandler.java  |  68 ---
 .../aries/rsa/provider/tcp/TcpProviderTest.java | 107 ----
 .../rsa/provider/tcp/myservice/MyService.java   |  30 -
 .../provider/tcp/myservice/MyServiceImpl.java   |  36 --
 dsw/cxf-dsw/pom.xml                             | 155 -----
 .../org/apache/cxf/dosgi/dsw/Activator.java     | 160 -----
 .../org/apache/cxf/dosgi/dsw/Constants.java     | 146 -----
 .../dosgi/dsw/decorator/DecorationParser.java   |  85 ---
 .../cxf/dosgi/dsw/decorator/InterfaceRule.java  |  96 ---
 .../apache/cxf/dosgi/dsw/decorator/Rule.java    |  41 --
 .../dosgi/dsw/decorator/ServiceDecorator.java   |  28 -
 .../ServiceDecoratorBundleListener.java         |  48 --
 .../dsw/decorator/ServiceDecoratorImpl.java     |  97 ---
 .../AbstractPojoConfigurationTypeHandler.java   | 243 --------
 .../dsw/handlers/CXFDistributionProvider.java   | 178 ------
 .../cxf/dosgi/dsw/handlers/ClassUtils.java      | 142 -----
 .../dosgi/dsw/handlers/HttpServiceManager.java  | 176 ------
 .../JaxRSPojoConfigurationTypeHandler.java      | 201 -------
 .../cxf/dosgi/dsw/handlers/JaxRSUtils.java      | 121 ----
 .../cxf/dosgi/dsw/handlers/LocalHostUtil.java   |  92 ---
 .../handlers/PojoConfigurationTypeHandler.java  | 172 ------
 .../handlers/SecurityDelegatingHttpContext.java | 133 -----
 .../cxf/dosgi/dsw/handlers/ServerWrapper.java   |  49 --
 .../dsw/handlers/ServiceInvocationHandler.java  | 100 ----
 .../handlers/WsdlConfigurationTypeHandler.java  | 160 -----
 .../dosgi/dsw/qos/DefaultIntentMapFactory.java  |  52 --
 .../apache/cxf/dosgi/dsw/qos/IntentManager.java |  31 -
 .../cxf/dosgi/dsw/qos/IntentManagerImpl.java    | 155 -----
 .../org/apache/cxf/dosgi/dsw/qos/IntentMap.java |  62 --
 .../apache/cxf/dosgi/dsw/qos/IntentTracker.java |  62 --
 .../apache/cxf/dosgi/dsw/qos/IntentUtils.java   |  86 ---
 .../apache/cxf/dosgi/dsw/util/OsgiUtils.java    | 132 -----
 .../apache/cxf/dosgi/dsw/util/StringPlus.java   |  72 ---
 .../src/main/resources/service-decoration.xsd   |  67 ---
 .../org/apache/cxf/dosgi/dsw/ActivatorTest.java |  66 ---
 .../org/apache/cxf/dosgi/dsw/TestUtils.java     |  37 --
 .../dsw/decorator/DecorationParserTest.java     |  63 --
 .../dosgi/dsw/decorator/InterfaceRuleTest.java  | 163 -----
 .../ServiceDecoratorBundleListenerTest.java     |  69 ---
 .../dsw/decorator/ServiceDecoratorImplTest.java | 187 ------
 .../handlers/CXFDistributionProviderTest.java   | 104 ----
 .../cxf/dosgi/dsw/handlers/ClassUtilsTest.java  | 134 -----
 .../dsw/handlers/HttpServiceManagerTest.java    | 125 ----
 .../cxf/dosgi/dsw/handlers/JaxRSUtilsTest.java  | 195 ------
 .../PojoConfigurationTypeHandlerTest.java       | 422 -------------
 .../SecurityDelegatingHttpContextTest.java      | 267 ---------
 .../handlers/ServiceInvocationHandlerTest.java  |  75 ---
 .../WsdlConfigurationTypeHandlerTest.java       |  67 ---
 .../dsw/handlers/jaxws/MyJaxWsEchoService.java  |  26 -
 .../handlers/jaxws/MyJaxWsEchoServiceImpl.java  |  27 -
 .../handlers/simple/MySimpleEchoService.java    |  23 -
 .../simple/MySimpleEchoServiceImpl.java         |  27 -
 .../dsw/hooks/CxfFindListenerHookTest.java      | 341 -----------
 .../cxf/dosgi/dsw/hooks/CxfPublishHookTest.java | 299 ----------
 .../dosgi/dsw/hooks/ServiceHookUtilsTest.java   | 116 ----
 .../apache/cxf/dosgi/dsw/hooks/TestService.java |  22 -
 .../dosgi/dsw/qos/IntentManagerImplTest.java    | 278 ---------
 .../apache/cxf/dosgi/dsw/qos/IntentMapTest.java |  41 --
 .../cxf/dosgi/dsw/qos/IntentTrackerTest.java    |  80 ---
 .../cxf/dosgi/dsw/qos/IntentUtilsTest.java      |  70 ---
 .../cxf/dosgi/dsw/util/OsgiUtilsTest.java       | 152 -----
 .../org/apache/cxf/dosgi/dsw/util/Provider.java |  23 -
 .../remote-service/alt-remote-services.xml      |  32 -
 .../OSGI-INF/remote-service/multi-services.xml  |  38 --
 .../OSGI-INF/remote-service/remote-services.xml |  32 -
 .../src/test/resources/test-resources/rs1.xml   |  31 -
 .../src/test/resources/test-resources/rs2.xml   |  28 -
 .../src/test/resources/test-resources/sd-1.xml  |   3 -
 .../src/test/resources/test-resources/sd.xml    |   8 -
 .../src/test/resources/test-resources/sd0.xml   |   2 -
 .../src/test/resources/test-resources/sd1.xml   |   8 -
 .../src/test/resources/test-resources/sd2.xml   |  14 -
 dsw/cxf-topology-manager/pom.xml                | 111 ----
 .../cxf/dosgi/topologymanager/Activator.java    | 192 ------
 .../exporter/DefaultExportPolicy.java           |  37 --
 .../exporter/EndpointListenerNotifier.java      | 133 -----
 .../exporter/EndpointRepository.java            | 140 -----
 .../topologymanager/exporter/StringPlus.java    |  57 --
 .../exporter/TopologyManagerExport.java         | 195 ------
 .../importer/EndpointListenerManager.java       |  98 ----
 .../topologymanager/importer/FilterHelper.java  |  43 --
 .../importer/ListenerHookImpl.java              | 119 ----
 .../topologymanager/importer/RSATracker.java    |  26 -
 .../importer/ReferenceCounter.java              |  76 ---
 .../importer/ServiceInterestListener.java       |  26 -
 .../importer/TopologyManagerImport.java         | 345 -----------
 .../dosgi/topologymanager/ActivatorTest.java    |  68 ---
 .../exporter/EndpointListenerNotifierTest.java  | 160 -----
 .../exporter/EndpointRepositoryTest.java        |  82 ---
 .../exporter/TopologyManagerExportTest.java     | 153 -----
 .../importer/EndpointListenerImplTest.java      | 111 ----
 .../importer/ListenerHookImplTest.java          |  89 ---
 .../importer/ReferenceCounterTest.java          |  42 --
 .../importer/TopologyManagerImportTest.java     |  87 ---
 dsw/pom.xml                                     |  46 --
 osgi-api/pom.xml                                |  70 ---
 parent/pom.xml                                  |   3 +
 pom.xml                                         |   5 +-
 systests2/multi-bundle/pom.xml                  |   6 -
 tck/apply-to-tck.sh.template                    |  15 -
 ...gi.impl.service.remoteserviceadmin-4.3.0.lib |   5 -
 252 files changed, 7046 insertions(+), 19308 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/pom.xml
----------------------------------------------------------------------
diff --git a/cxf-dsw/pom.xml b/cxf-dsw/pom.xml
new file mode 100644
index 0000000..92ef7ae
--- /dev/null
+++ b/cxf-dsw/pom.xml
@@ -0,0 +1,155 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>cxf-dosgi-ri-dsw-cxf</artifactId>
+    <packaging>bundle</packaging>
+    <name>CXF dOSGi Distribution provider</name>
+
+    <parent>
+        <groupId>org.apache.cxf.dosgi</groupId>
+        <artifactId>cxf-dosgi-ri-parent</artifactId>
+        <version>1.8-SNAPSHOT</version>
+        <relativePath>../parent/pom.xml</relativePath>
+    </parent>
+
+    <properties>
+        <topDirectoryLocation>..</topDirectoryLocation>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+
+
+        <dependency>
+            <groupId>org.apache.aries.rsa</groupId>
+            <artifactId>spi</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-core</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxws</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+		<dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-rs-client</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-databinding-aegis</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-rs-extension-providers</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-servlet_${servlet.version}_spec</artifactId>
+            <version>1.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymockclassextension</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-jdk14</artifactId>
+            <version>1.7.14</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.jvnet.jaxb2.maven2</groupId>
+                <artifactId>maven-jaxb2-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+                        <Import-Package>
+                            javax.servlet*;version="[0.0,4)",
+                            *
+                        </Import-Package>
+                        <Export-Package>
+                            !*
+                        </Export-Package>
+                        <Bundle-Activator>org.apache.cxf.dosgi.dsw.Activator</Bundle-Activator>
+                    </instructions>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <excludes>
+                        <exclude>**/TestUtils*</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java
new file mode 100644
index 0000000..37b6aab
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java
@@ -0,0 +1,160 @@
+/**
+ * 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;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.aries.rsa.spi.DistributionProvider;
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.dosgi.dsw.decorator.ServiceDecorator;
+import org.apache.cxf.dosgi.dsw.decorator.ServiceDecoratorBundleListener;
+import org.apache.cxf.dosgi.dsw.decorator.ServiceDecoratorImpl;
+import org.apache.cxf.dosgi.dsw.handlers.CXFDistributionProvider;
+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.dosgi.dsw.qos.IntentTracker;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleListener;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+// registered as spring bean -> start / stop called accordingly
+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 IntentTracker intentTracker;
+    private HttpServiceManager httpServiceManager;
+    private BundleContext bc;
+    private BundleListener bundleListener;
+    private Dictionary<String, Object> curConfiguration;
+    private Bus bus;
+
+    public void start(BundleContext bundlecontext) throws Exception {
+        LOG.debug("RemoteServiceAdmin Implementation is starting up");
+        this.bc = bundlecontext;
+        // Disable the fast infoset as it's not compatible (yet) with OSGi
+        System.setProperty("org.apache.cxf.nofastinfoset", "true");
+        curConfiguration = getDefaultConfig();
+        init(curConfiguration);
+        registerManagedService(bc);
+    }
+
+    private Dictionary<String, Object> getDefaultConfig() {
+        return new Hashtable<String, Object>();
+    }
+
+    private synchronized void init(Dictionary<String, Object> config) {
+        bus = BusFactory.newInstance().createBus();
+        
+        String httpBase = (String) config.get(org.apache.cxf.dosgi.dsw.Constants.HTTP_BASE);
+        String cxfServletAlias = (String) config.get(org.apache.cxf.dosgi.dsw.Constants.CXF_SERVLET_ALIAS);
+
+        IntentMap intentMap = new IntentMap(new DefaultIntentMapFactory().create());
+        intentTracker = new IntentTracker(bc, intentMap);
+        intentTracker.open();
+        IntentManager intentManager = new IntentManagerImpl(intentMap, DEFAULT_INTENT_TIMEOUT);
+        httpServiceManager = new HttpServiceManager(bc, httpBase, cxfServletAlias);
+        DistributionProvider cxfProvider
+            = new CXFDistributionProvider(bc, intentManager, httpServiceManager);
+        Dictionary<String, Object> props = new Hashtable<String, Object>();
+        String[] supportedIntents = intentMap.keySet().toArray(new String[] {});
+        props.put("remote.intents.supported", supportedIntents);
+        props.put("remote.configs.supported", cxfProvider.getSupportedTypes());
+        rsaFactoryReg = bc.registerService(DistributionProvider.class.getName(), cxfProvider, props);
+        ServiceDecoratorImpl serviceDecorator = new ServiceDecoratorImpl();
+        bundleListener = new ServiceDecoratorBundleListener(serviceDecorator);
+        bc.addBundleListener(bundleListener);
+        decoratorReg = bc.registerService(ServiceDecorator.class.getName(), serviceDecorator, null);
+    }
+
+    private synchronized void uninit() {
+        if (decoratorReg != null) {
+            decoratorReg.unregister();
+            decoratorReg = null;
+        }
+        if (bundleListener != null) {
+            bc.removeBundleListener(bundleListener);
+            bundleListener = null;
+        }
+        if (rsaFactoryReg != null) {
+            // This also triggers the unimport and unexport of the remote services
+            rsaFactoryReg.unregister();
+            rsaFactoryReg = null;
+        }
+        if (httpServiceManager != null) {
+            httpServiceManager.close();
+            httpServiceManager = null;
+        }
+        if (intentTracker != null) {
+            intentTracker.close();
+            intentTracker = null;
+        }
+    }
+
+    private void registerManagedService(BundleContext bundlecontext) {
+        Dictionary<String, String> props = new Hashtable<String, String>();
+        props.put(Constants.SERVICE_PID, CONFIG_SERVICE_PID);
+        // No need to store the registration. Will be unregistered in stop by framework
+        bundlecontext.registerService(ManagedService.class.getName(), this, props);
+    }
+
+    public void stop(BundleContext context) throws Exception {
+        LOG.debug("RemoteServiceAdmin Implementation is shutting down now");
+        uninit();
+        shutdownCXFBus();
+    }
+
+    /**
+     * Causes also the shutdown of the embedded HTTP server
+     */
+    private void shutdownCXFBus() {
+        if (bus != null) {
+            LOG.debug("Shutting down the CXF Bus");
+            bus.shutdown(true);
+        }
+    }
+
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    public synchronized void updated(Dictionary config) throws ConfigurationException {
+        LOG.debug("RemoteServiceAdmin Implementation configuration is updated with {}", config);
+        // config is null if it doesn't exist, is being deleted or has not yet been loaded
+        // in which case we run with defaults (just like we do manually when bundle is first started)
+        Dictionary<String, Object> configMap = config == null ? getDefaultConfig() : config;
+        if (!configMap.equals(curConfiguration)) { // only if something actually changed
+            curConfiguration = configMap;
+            uninit();
+            init(configMap);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java
new file mode 100644
index 0000000..218bec6
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java
@@ -0,0 +1,146 @@
+/**
+ * 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;
+
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
+
+public final class Constants {
+
+    // Constants from RFC 119, they should ultimately be picked up from an OSGi class.
+    @Deprecated
+    public static final String EXPORTED_INTERFACES = RemoteConstants.SERVICE_EXPORTED_INTERFACES;
+    @Deprecated
+    public static final String EXPORTED_INTERFACES_OLD = "osgi.remote.interfaces"; // for BW compatibility
+
+    @Deprecated
+    public static final String EXPORTED_CONFIGS = RemoteConstants.SERVICE_EXPORTED_CONFIGS;
+    @Deprecated
+    public static final String EXPORTED_CONFIGS_OLD = "osgi.remote.configuration.type"; // for BW compatibility
+
+    @Deprecated
+    public static final String EXPORTED_INTENTS = RemoteConstants.SERVICE_EXPORTED_INTENTS;
+    @Deprecated
+    public static final String EXPORTED_INTENTS_EXTRA = RemoteConstants.SERVICE_EXPORTED_INTENTS_EXTRA;
+    @Deprecated
+    public static final String EXPORTED_INTENTS_OLD = "osgi.remote.requires.intents";
+
+    @Deprecated
+    public static final String IMPORTED = RemoteConstants.SERVICE_IMPORTED;
+    @Deprecated
+    public static final String IMPORTD_CONFIGS = RemoteConstants.SERVICE_IMPORTED_CONFIGS;
+
+    @Deprecated
+    public static final String INTENTS = RemoteConstants.SERVICE_INTENTS;
+
+    // WSDL
+    public static final String WSDL_CONFIG_TYPE = "wsdl";
+    public static final String WSDL_CONFIG_PREFIX = "osgi.remote.configuration" + "." + WSDL_CONFIG_TYPE;
+    public static final String WSDL_SERVICE_NAMESPACE = WSDL_CONFIG_PREFIX + ".service.ns";
+    public static final String WSDL_SERVICE_NAME = WSDL_CONFIG_PREFIX + ".service.name";
+    public static final String WSDL_PORT_NAME = WSDL_CONFIG_PREFIX + ".port.name";
+    public static final String WSDL_LOCATION = WSDL_CONFIG_PREFIX + ".location";
+    public static final String WSDL_HTTP_SERVICE_CONTEXT = WSDL_CONFIG_PREFIX + ".httpservice.context";
+    // Provider prefix
+    public static final String PROVIDER_PREFIX = "org.apache.cxf";
+
+    // WS
+    public static final String WS_CONFIG_TYPE = PROVIDER_PREFIX + ".ws";
+    public static final String WS_ADDRESS_PROPERTY = WS_CONFIG_TYPE + ".address";
+    public static final String WS_PORT_PROPERTY = WS_CONFIG_TYPE + ".port";
+    public static final String WS_HTTP_SERVICE_CONTEXT = WS_CONFIG_TYPE + ".httpservice.context";
+
+    public static final String WS_FRONTEND_PROP_KEY = WS_CONFIG_TYPE + ".frontend";
+    public static final String WS_FRONTEND_JAXWS = "jaxws";
+    public static final String WS_FRONTEND_SIMPLE = "simple";
+
+    public static final String WS_IN_INTERCEPTORS_PROP_KEY = WS_CONFIG_TYPE + ".in.interceptors";
+    public static final String WS_OUT_INTERCEPTORS_PROP_KEY = WS_CONFIG_TYPE + ".out.interceptors";
+    public static final String WS_OUT_FAULT_INTERCEPTORS_PROP_KEY = WS_CONFIG_TYPE + ".out.fault.interceptors";
+    public static final String WS_IN_FAULT_INTERCEPTORS_PROP_KEY = WS_CONFIG_TYPE + ".in.fault.interceptors";
+    public static final String WS_CONTEXT_PROPS_PROP_KEY = WS_CONFIG_TYPE + ".context.properties";
+    public static final String WS_FEATURES_PROP_KEY = WS_CONFIG_TYPE + ".features";
+
+    public static final String WS_DATABINDING_PROP_KEY = WS_CONFIG_TYPE + ".databinding";
+    public static final String WS_DATABINDING_BEAN_PROP_KEY = WS_DATABINDING_PROP_KEY + ".bean";
+    public static final String WS_DATA_BINDING_JAXB = "jaxb";
+    public static final String WS_DATA_BINDING_AEGIS = "aegis";
+
+    public static final String WS_WSDL_SERVICE_NAMESPACE = WS_CONFIG_TYPE + ".service.ns";
+    public static final String WS_WSDL_SERVICE_NAME = WS_CONFIG_TYPE + ".service.name";
+    public static final String WS_WSDL_PORT_NAME = WS_CONFIG_TYPE + ".port.name";
+    public static final String WS_WSDL_LOCATION = WS_CONFIG_TYPE + ".wsdl.location";
+    // Rest
+    public static final String RS_CONFIG_TYPE = PROVIDER_PREFIX + ".rs";
+    public static final String RS_ADDRESS_PROPERTY = RS_CONFIG_TYPE + ".address";
+    public static final String RS_HTTP_SERVICE_CONTEXT = RS_CONFIG_TYPE + ".httpservice.context";
+    public static final String RS_DATABINDING_PROP_KEY = RS_CONFIG_TYPE + ".databinding";
+    public static final String RS_IN_INTERCEPTORS_PROP_KEY = RS_CONFIG_TYPE + ".in.interceptors";
+    public static final String RS_OUT_INTERCEPTORS_PROP_KEY = RS_CONFIG_TYPE + ".out.interceptors";
+    public static final String RS_IN_FAULT_INTERCEPTORS_PROP_KEY = RS_CONFIG_TYPE + ".in.fault.interceptors";
+    public static final String RS_OUT_FAULT_INTERCEPTORS_PROP_KEY = RS_CONFIG_TYPE + ".out.fault.interceptors";
+    public static final String RS_CONTEXT_PROPS_PROP_KEY = RS_CONFIG_TYPE + ".context.properties";
+    public static final String RS_FEATURES_PROP_KEY = RS_CONFIG_TYPE + ".features";
+    public static final String RS_PROVIDER_PROP_KEY = RS_CONFIG_TYPE + ".provider";
+    public static final String RS_PROVIDER_EXPECTED_PROP_KEY = RS_PROVIDER_PROP_KEY + ".expected";
+    public static final String RS_PROVIDER_GLOBAL_PROP_KEY = RS_PROVIDER_PROP_KEY + ".globalquery";
+    public static final String RS_WADL_LOCATION = RS_CONFIG_TYPE + ".wadl.location";
+    // POJO (old value for WS)
+    public static final String WS_CONFIG_TYPE_OLD = "pojo";
+    public static final String WS_CONFIG_OLD_PREFIX = "osgi.remote.configuration." + WS_CONFIG_TYPE_OLD;
+    public static final String WS_ADDRESS_PROPERTY_OLD = WS_CONFIG_OLD_PREFIX + ".address";
+    public static final String WS_HTTP_SERVICE_CONTEXT_OLD = WS_CONFIG_OLD_PREFIX + ".httpservice.context";
+
+    // Common Configuration Properties
+    public static final String CHECK_BUNDLE = "check.bundle";
+
+    // The following constants are not evaluated anymore
+    @Deprecated
+    public static final String DEFAULT_PORT_CONFIG = "default.port";
+    @Deprecated
+    public static final String DEFAULT_HOST_CONFIG = "default.host";
+    @Deprecated
+    public static final String DEFAULT_PORT_VALUE = "9000";
+    @Deprecated
+    public static final String DEFAULT_HOST_VALUE = "localhost";
+    @Deprecated
+    public static final String USE_MASTER_MAP = "use.master.map";
+
+    // DSW Identification - TODO do we really need this one?
+    public static final String DSW_CLIENT_ID = PROVIDER_PREFIX + ".remote.dsw.client";
+
+    public static final String INTENT_NAME_PROP = "org.apache.cxf.dosgi.IntentName";
+
+    /**
+     * Prefix to create an absolute URL from a relative URL.
+     * See HttpServiceManager.getAbsoluteAddress
+     *
+     * Defaults to: http://<host name>:8181
+     */
+    public static final String HTTP_BASE = "httpBase";
+
+    /**
+     * Name of the cxf servlet alias
+     */
+    public static final String CXF_SERVLET_ALIAS = "cxfServletAlias";
+    public static final String DEFAULT_CXF_SERVLET_ALIAS = "/cxf";
+
+    private Constants() {
+        // never constructed
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParser.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParser.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParser.java
new file mode 100644
index 0000000..82753b1
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParser.java
@@ -0,0 +1,85 @@
+/**
+ * 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.decorator;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.JAXBContext;
+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.apache.cxf.xmlns.service_decoration._1_0.ServiceDecorationType;
+import org.apache.cxf.xmlns.service_decoration._1_0.ServiceDecorationsType;
+
+class DecorationParser {
+    private JAXBContext jaxbContext;
+    private Schema schema;
+
+    DecorationParser() {
+        try {
+            jaxbContext = JAXBContext.newInstance(ServiceDecorationsType.class.getPackage().getName(),
+                                                  this.getClass().getClassLoader());
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            URL resource = getClass().getResource("/service-decoration.xsd");
+            schema = schemaFactory.newSchema(resource);
+        } catch (Exception e) {
+            throw new RuntimeException("Error loading decorations schema", e);
+        }
+
+    }
+
+    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 {
+            InputStream is = resourceURL.openStream();
+            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;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java
new file mode 100644
index 0000000..894d01d
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java
@@ -0,0 +1,96 @@
+/**
+ * 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.decorator;
+
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class InterfaceRule implements Rule {
+
+    private static final Logger LOG = LoggerFactory.getLogger(InterfaceRule.class);
+
+    private final Bundle bundle;
+    private final Pattern matchPattern;
+    private final Map<String, String> propMatches = new HashMap<String, String>();
+    private final Map<String, Object> addProps = new HashMap<String, Object>();
+
+    public InterfaceRule(Bundle b, String im) {
+        bundle = b;
+        matchPattern = Pattern.compile(im);
+    }
+
+    public synchronized void addPropMatch(String name, String value) {
+        propMatches.put(name, value);
+    }
+
+    public synchronized void addProperty(String name, String value, String type) {
+        Object obj = value;
+
+        if (type != null && !String.class.getName().equals(type)) {
+            try {
+                Class<?> cls = getClass().getClassLoader().loadClass(type);
+                Constructor<?> ctor = cls.getConstructor(new Class[] {String.class});
+                obj = ctor.newInstance(value);
+            } catch (Throwable th) {
+                LOG.warn("Could not handle property '" + name
+                         + "' with value '" + value + "' of type: " + type, th);
+                return;
+            }
+        }
+
+        addProps.put(name, obj);
+    }
+
+    public synchronized void apply(ServiceReference<?> sref, Map<String, Object> target) {
+        String[] objectClass = (String[]) sref.getProperty(Constants.OBJECTCLASS);
+        boolean matches = false;
+        for (String cls : objectClass) {
+            Matcher m = matchPattern.matcher(cls);
+            if (m.matches()) {
+                for (Map.Entry<String, String> pm : propMatches.entrySet()) {
+                    Object value = sref.getProperty(pm.getKey());
+                    if (value == null || !Pattern.matches(pm.getValue(), value.toString())) {
+                        return;
+                    }
+                }
+                matches = true;
+                break;
+            }
+        }
+        if (!matches) {
+            return;
+        }
+
+        LOG.info("Adding the following properties to " + sref + ": " + addProps);
+        target.putAll(addProps);
+    }
+
+    public Bundle getBundle() {
+        return bundle;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/Rule.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/Rule.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/Rule.java
new file mode 100644
index 0000000..adbd1cf
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/Rule.java
@@ -0,0 +1,41 @@
+/**
+ * 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.decorator;
+
+import java.util.Map;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+
+public interface Rule {
+
+    /**
+     * When the ServiceReference passed in matches the rule's condition,
+     * set the additional properties in the target.
+     * @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);
+
+    /**
+     * Returns the bundle that provided this rule.
+     * @return The Bundle where the Rule was defined.
+     */
+    Bundle getBundle();
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecorator.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecorator.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecorator.java
new file mode 100644
index 0000000..203bd1c
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecorator.java
@@ -0,0 +1,28 @@
+/**
+ * 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.decorator;
+
+import java.util.Map;
+
+import org.osgi.framework.ServiceReference;
+
+public interface ServiceDecorator {
+
+    void decorate(ServiceReference<?> sref, Map<String, Object> properties);
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorBundleListener.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorBundleListener.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorBundleListener.java
new file mode 100644
index 0000000..79c2908
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorBundleListener.java
@@ -0,0 +1,48 @@
+/**
+ * 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.decorator;
+
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
+
+public class ServiceDecoratorBundleListener implements BundleListener {
+    /**
+     * 
+     */
+    private final ServiceDecoratorImpl serviceDecorator;
+
+    /**
+     * @param serviceDecorator
+     */
+    public ServiceDecoratorBundleListener(ServiceDecoratorImpl serviceDecorator) {
+        this.serviceDecorator = serviceDecorator;
+    }
+
+    public void bundleChanged(BundleEvent be) {
+        switch(be.getType()) {
+        case BundleEvent.STARTED:
+            this.serviceDecorator.addDecorations(be.getBundle());
+            break;
+        case BundleEvent.STOPPING:
+            this.serviceDecorator.removeDecorations(be.getBundle());
+            break;
+        default:
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImpl.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImpl.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImpl.java
new file mode 100644
index 0000000..20130c3
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImpl.java
@@ -0,0 +1,97 @@
+/**
+ * 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.decorator;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+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;
+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;
+
+    public ServiceDecoratorImpl() {
+        parser = new DecorationParser();
+    }
+    
+    public void decorate(ServiceReference<?> sref, Map<String, Object> target) {
+        for (Rule matcher : decorations) {
+            matcher.apply(sref, target);
+        }
+    }
+
+    void addDecorations(Bundle bundle) {
+        for (ServiceDecorationType decoration : getDecorationElements(bundle)) {
+            for (MatchType match : decoration.getMatch()) {
+                decorations.add(getRule(bundle, match));
+            }
+        }
+    }
+
+    private Rule getRule(Bundle bundle, MatchType match) {
+        InterfaceRule m = new InterfaceRule(bundle, match.getInterface());
+        for (MatchPropertyType propMatch : match.getMatchProperty()) {
+            m.addPropMatch(propMatch.getName(), propMatch.getValue());
+        }
+        for (AddPropertyType addProp : match.getAddProperty()) {
+            m.addProperty(addProp.getName(), addProp.getValue(), addProp.getType());
+        }
+        return m;
+    }
+
+    List<ServiceDecorationType> getDecorationElements(Bundle bundle) {
+        @SuppressWarnings("rawtypes")
+        Enumeration entries = bundle.findEntries("OSGI-INF/remote-service", "*.xml", false);
+        if (entries == null) {
+            return Collections.emptyList();
+        }
+        List<ServiceDecorationType> elements = new ArrayList<ServiceDecorationType>();
+        while (entries.hasMoreElements()) {
+            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;
+    }
+
+    void removeDecorations(Bundle bundle) {
+        for (Rule r : decorations) {
+            if (bundle.equals(r.getBundle())) {
+                decorations.remove(r); // the iterator doesn't support 'remove'
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
new file mode 100644
index 0000000..d2c8929
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
@@ -0,0 +1,243 @@
+/**
+ * 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.lang.reflect.Proxy;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.aries.rsa.spi.DistributionProvider;
+import org.apache.aries.rsa.spi.Endpoint;
+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.qos.IntentManager;
+import org.apache.cxf.dosgi.dsw.qos.IntentUtils;
+import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
+import org.apache.cxf.dosgi.dsw.util.StringPlus;
+import org.apache.cxf.endpoint.AbstractEndpointFactory;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.feature.AbstractFeature;
+import org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory;
+import org.apache.cxf.frontend.ClientFactoryBean;
+import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.interceptor.Interceptor;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
+
+public abstract class AbstractPojoConfigurationTypeHandler implements DistributionProvider {
+    protected BundleContext bundleContext;
+    protected IntentManager intentManager;
+    protected HttpServiceManager httpServiceManager;
+
+    public AbstractPojoConfigurationTypeHandler(BundleContext dswBC, IntentManager intentManager,
+                                                HttpServiceManager httpServiceManager) {
+        this.bundleContext = dswBC;
+        this.intentManager = intentManager;
+        this.httpServiceManager = httpServiceManager;
+    }
+
+    protected Object getProxy(Object serviceProxy, Class<?> iType) {
+        return Proxy.newProxyInstance(iType.getClassLoader(), new Class[] {
+            iType
+        }, new ServiceInvocationHandler(serviceProxy, iType));
+    }
+
+    protected EndpointDescription createEndpointDesc(Map<String, Object> props, 
+                                                     String[] importedConfigs,
+                                                     String address, 
+                                                     String[] intents) {
+        props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, importedConfigs);
+        for (String configurationType : importedConfigs) {
+            if (Constants.WS_CONFIG_TYPE.equals(configurationType)) {
+                props.put(Constants.WS_ADDRESS_PROPERTY, address);
+            } else if (Constants.RS_CONFIG_TYPE.equals(configurationType)) {
+                props.put(Constants.RS_ADDRESS_PROPERTY, address);
+            } else if (Constants.WS_CONFIG_TYPE_OLD.equals(configurationType)) {
+                props.put(Constants.WS_ADDRESS_PROPERTY_OLD, address);
+                props.put(Constants.WS_ADDRESS_PROPERTY, address);
+            }
+        }
+        String[] sIntents = StringPlus.normalize(props.get(RemoteConstants.SERVICE_INTENTS));
+        String[] allIntents = IntentUtils.mergeArrays(intents, sIntents);
+        props.put(RemoteConstants.SERVICE_INTENTS, allIntents);
+        props.put(RemoteConstants.ENDPOINT_ID, address);
+        return new EndpointDescription(props);
+    }
+
+    protected void setCommonWsdlProperties(AbstractWSDLBasedEndpointFactory factory, BundleContext context,
+                                           Map<String, Object> sd, boolean wsdlType) {
+        String location = OsgiUtils.getProperty(sd, wsdlType ? Constants.WSDL_LOCATION : Constants.WS_WSDL_LOCATION);
+        if (location != null) {
+            URL wsdlURL = context.getBundle().getResource(location);
+            if (wsdlURL != null) {
+                factory.setWsdlURL(wsdlURL.toString());
+            }
+            QName serviceName = getServiceQName(null, sd,
+                    wsdlType ? Constants.WSDL_SERVICE_NAMESPACE : Constants.WS_WSDL_SERVICE_NAMESPACE,
+                    wsdlType ? Constants.WSDL_SERVICE_NAME : Constants.WS_WSDL_SERVICE_NAME);
+            if (serviceName != null) {
+                factory.setServiceName(serviceName);
+                QName portName = getPortQName(serviceName.getNamespaceURI(), sd,
+                        wsdlType ? Constants.WSDL_PORT_NAME : Constants.WS_WSDL_PORT_NAME);
+                if (portName != null) {
+                    factory.setEndpointName(portName);
+                }
+            }
+        }
+    }
+
+    protected void setWsdlProperties(ServerFactoryBean factory, BundleContext callingContext, Map<String, Object> sd,
+                                     boolean wsdlType) {
+        setCommonWsdlProperties(factory, callingContext, sd, wsdlType);
+    }
+
+    protected void setClientWsdlProperties(ClientFactoryBean factory, BundleContext dswContext, Map<String, Object> sd,
+                                           boolean wsdlType) {
+        setCommonWsdlProperties(factory, dswContext, sd, wsdlType);
+    }
+
+    protected static QName getServiceQName(Class<?> iClass, Map<String, Object> sd, String nsPropName,
+                                           String namePropName) {
+        String serviceNs = OsgiUtils.getProperty(sd, nsPropName);
+        String serviceName = OsgiUtils.getProperty(sd, namePropName);
+        if (iClass == null && (serviceNs == null || serviceName == null)) {
+            return null;
+        }
+        if (serviceNs == null) {
+            serviceNs = PackageUtils.getNamespace(PackageUtils.getPackageName(iClass));
+        }
+        if (serviceName == null) {
+            serviceName = iClass.getSimpleName();
+        }
+        return new QName(serviceNs, serviceName);
+    }
+
+    protected static QName getPortQName(String ns, Map<String, Object> sd, String propName) {
+        String portName = OsgiUtils.getProperty(sd, propName);
+        if (portName == null) {
+            return null;
+        }
+        return new QName(ns, portName);
+    }
+
+    protected String getClientAddress(Map<String, Object> sd) {
+        return OsgiUtils.getFirstNonEmptyStringProperty(sd, RemoteConstants.ENDPOINT_ID,
+                                                        Constants.WS_ADDRESS_PROPERTY,
+                                                        Constants.WS_ADDRESS_PROPERTY_OLD,
+                                                        Constants.RS_ADDRESS_PROPERTY);
+    }
+
+    protected String getServerAddress(Map<String, Object> sd, Class<?> iClass) {
+        String address = getClientAddress(sd);
+        return address == null ? httpServiceManager.getDefaultAddress(iClass) : address;
+    }
+    
+    public String getServletContextRoot(Map<String, Object> sd) {
+        return OsgiUtils.getFirstNonEmptyStringProperty(sd,
+                Constants.WS_HTTP_SERVICE_CONTEXT,
+                Constants.WS_HTTP_SERVICE_CONTEXT_OLD,
+                Constants.WSDL_HTTP_SERVICE_CONTEXT,
+                Constants.RS_HTTP_SERVICE_CONTEXT);
+    }
+
+    
+    protected Bus createBus(Long sid, BundleContext callingContext, String contextRoot) {
+        Bus bus = BusFactory.newInstance().createBus();
+        if (contextRoot != null) {
+            httpServiceManager.registerServlet(bus, contextRoot, callingContext, sid);
+        }
+        return bus;
+    }
+
+    protected Endpoint createServerFromFactory(ServerFactoryBean factory, EndpointDescription epd) {
+        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+        try {
+            Thread.currentThread().setContextClassLoader(ServerFactoryBean.class.getClassLoader());
+            Server server = factory.create();
+            return new ServerWrapper(epd, server);
+        } finally {
+            Thread.currentThread().setContextClassLoader(oldClassLoader);
+        }
+    }
+
+    protected static void addWsInterceptorsFeaturesProps(AbstractEndpointFactory factory, BundleContext callingContext,
+                                                         Map<String, Object> sd) {
+        addInterceptors(factory, callingContext, sd, Constants.WS_IN_INTERCEPTORS_PROP_KEY);
+        addInterceptors(factory, callingContext, sd, Constants.WS_OUT_INTERCEPTORS_PROP_KEY);
+        addInterceptors(factory, callingContext, sd, Constants.WS_OUT_FAULT_INTERCEPTORS_PROP_KEY);
+        addInterceptors(factory, callingContext, sd, Constants.WS_IN_FAULT_INTERCEPTORS_PROP_KEY);
+        addFeatures(factory, callingContext, sd, Constants.WS_FEATURES_PROP_KEY);
+        addContextProperties(factory, sd, Constants.WS_CONTEXT_PROPS_PROP_KEY);
+    }
+
+    static void addRsInterceptorsFeaturesProps(AbstractEndpointFactory factory, BundleContext callingContext,
+                                               Map<String, Object> sd) {
+        addInterceptors(factory, callingContext, sd, Constants.RS_IN_INTERCEPTORS_PROP_KEY);
+        addInterceptors(factory, callingContext, sd, Constants.RS_OUT_INTERCEPTORS_PROP_KEY);
+        addInterceptors(factory, callingContext, sd, Constants.RS_OUT_FAULT_INTERCEPTORS_PROP_KEY);
+        addInterceptors(factory, callingContext, sd, Constants.RS_IN_FAULT_INTERCEPTORS_PROP_KEY);
+        addFeatures(factory, callingContext, sd, Constants.RS_FEATURES_PROP_KEY);
+        addContextProperties(factory, sd, Constants.RS_CONTEXT_PROPS_PROP_KEY);
+    }
+
+    private static void addInterceptors(AbstractEndpointFactory factory, BundleContext callingContext,
+                                        Map<String, Object> sd, String propName) {
+        List<Object> providers = ClassUtils.loadProviderClasses(callingContext, sd, propName);
+        boolean in = propName.contains("in.interceptors");
+        boolean out = propName.contains("out.interceptors");
+        boolean inFault = propName.contains("in.fault.interceptors");
+        boolean outFault = propName.contains("out.fault.interceptors");
+        for (Object provider : providers) {
+            Interceptor<?> interceptor = (Interceptor<?>) provider;
+            if (in) {
+                factory.getInInterceptors().add(interceptor);
+            } else if (out) {
+                factory.getOutInterceptors().add(interceptor);
+            } else if (inFault) {
+                factory.getInFaultInterceptors().add(interceptor);
+            } else if (outFault) {
+                factory.getOutFaultInterceptors().add(interceptor);
+            }
+        }
+    }
+
+    private static void addFeatures(AbstractEndpointFactory factory, BundleContext callingContext,
+                                    Map<String, Object> sd, String propName) {
+        List<Object> providers = ClassUtils.loadProviderClasses(callingContext, sd, propName);
+        if (!providers.isEmpty()) {
+            factory.getFeatures().addAll(CastUtils.cast(providers, AbstractFeature.class));
+        }
+    }
+
+    private static void addContextProperties(AbstractEndpointFactory factory, Map<String, Object> sd, String propName) {
+        @SuppressWarnings("unchecked")
+        Map<String, Object> props = (Map<String, Object>)sd.get(propName);
+        if (props != null) {
+            factory.getProperties(true).putAll(props);
+        }
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProvider.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProvider.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProvider.java
new file mode 100644
index 0000000..9069de8
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProvider.java
@@ -0,0 +1,178 @@
+/**
+ * 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.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.aries.rsa.spi.DistributionProvider;
+import org.apache.aries.rsa.spi.Endpoint;
+import org.apache.aries.rsa.spi.IntentUnsatisfiedException;
+import org.apache.cxf.dosgi.dsw.Constants;
+import org.apache.cxf.dosgi.dsw.qos.IntentManager;
+import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
+import org.apache.cxf.dosgi.dsw.util.StringPlus;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CXFDistributionProvider implements DistributionProvider {
+
+    protected static final String DEFAULT_CONFIGURATION_TYPE = Constants.WS_CONFIG_TYPE;
+    private static final Logger LOG = LoggerFactory.getLogger(CXFDistributionProvider.class);
+
+    // protected because of tests
+    protected final String[] supportedConfigurationTypes;
+
+    private IntentManager intentManager;
+    private PojoConfigurationTypeHandler pojoConfigurationTypeHandler;
+    private JaxRSPojoConfigurationTypeHandler jaxRsPojoConfigurationTypeHandler;
+    private WsdlConfigurationTypeHandler wsdlConfigurationTypeHandler;
+    private Set<String> configTypesSet;
+
+    public CXFDistributionProvider(BundleContext bc, IntentManager intentManager,
+                                    HttpServiceManager httpServiceManager) {
+        this.intentManager = intentManager;
+        this.pojoConfigurationTypeHandler = new PojoConfigurationTypeHandler(bc, intentManager, httpServiceManager);
+        this.jaxRsPojoConfigurationTypeHandler = new JaxRSPojoConfigurationTypeHandler(bc,
+                                                                                       intentManager,
+                                                                                       httpServiceManager);
+        this.wsdlConfigurationTypeHandler = new WsdlConfigurationTypeHandler(bc, intentManager, httpServiceManager);
+        supportedConfigurationTypes = new String[] {Constants.WS_CONFIG_TYPE,
+                                                    Constants.WSDL_CONFIG_TYPE, 
+                                                    Constants.RS_CONFIG_TYPE, 
+                                                    Constants.WS_CONFIG_TYPE_OLD};
+        configTypesSet = new HashSet<>(Arrays.asList(supportedConfigurationTypes));
+    }
+    
+    @SuppressWarnings("rawtypes")
+    @Override
+    public Endpoint exportService(Object serviceO, 
+                                  BundleContext serviceContext,
+                                  Map<String, Object> effectiveProperties,
+                                  Class[] exportedInterfaces) {
+        List<String> configurationTypes = determineConfigurationTypes(effectiveProperties);
+        DistributionProvider handler = getHandler(configurationTypes, effectiveProperties);
+        return handler != null ? handler.exportService(serviceO, serviceContext, 
+                                                       effectiveProperties, exportedInterfaces) : null;
+    }
+
+    @SuppressWarnings("rawtypes")
+    @Override
+    public Object importEndpoint(ClassLoader consumerLoader, BundleContext consumerContext, 
+                                 Class[] iClass, EndpointDescription endpoint)
+        throws IntentUnsatisfiedException {
+        List<String> configurationTypes = determineConfigTypesForImport(endpoint);
+        DistributionProvider handler = getHandler(configurationTypes, endpoint.getProperties());
+        return handler != null ? handler.importEndpoint(consumerLoader, consumerContext, iClass, endpoint) : null;
+    }
+
+    DistributionProvider getHandler(List<String> configurationTypes,
+                                            Map<String, Object> serviceProperties) {
+        intentManager.assertAllIntentsSupported(serviceProperties);
+        if (configurationTypes.contains(Constants.WS_CONFIG_TYPE)
+            || configurationTypes.contains(Constants.WS_CONFIG_TYPE_OLD)
+            || configurationTypes.contains(Constants.RS_CONFIG_TYPE)) {
+            boolean jaxrs = isJaxrsRequested(configurationTypes, serviceProperties);
+            return jaxrs ? jaxRsPojoConfigurationTypeHandler : pojoConfigurationTypeHandler;
+        } else if (configurationTypes.contains(Constants.WSDL_CONFIG_TYPE)) {
+            return wsdlConfigurationTypeHandler;
+        }
+        LOG.info("None of the configuration types in " + configurationTypes + " is supported.");
+        return null;
+    }
+
+    private boolean isJaxrsRequested(Collection<String> types, Map<String, Object> serviceProperties) {
+        if (types == null) {
+            return false;
+        }
+
+        if (types.contains(Constants.RS_CONFIG_TYPE)) {
+            Collection<String> intentsProperty
+                = OsgiUtils.getMultiValueProperty(serviceProperties.get(RemoteConstants.SERVICE_EXPORTED_INTENTS));
+            boolean hasHttpIntent = false;
+            boolean hasSoapIntent = false;
+            if (intentsProperty != null) {
+                for (String intent : intentsProperty) {
+                    if (intent.contains("SOAP")) {
+                        hasSoapIntent = true;
+                        break;
+                    }
+
+                    if (intent.contains("HTTP")) {
+                        hasHttpIntent = true;
+                    }
+                }
+            }
+            if ((hasHttpIntent && !hasSoapIntent) || intentsProperty == null) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * determine which configuration types should be used / if the requested are
+     * supported
+     */
+    List<String> determineConfigurationTypes(Map<String, Object> serviceProperties) {
+        String[] requestedConfigurationTypes = StringPlus.normalize(serviceProperties
+                .get(RemoteConstants.SERVICE_EXPORTED_CONFIGS));
+        if (requestedConfigurationTypes == null || requestedConfigurationTypes.length == 0) {
+            return Collections.singletonList(DEFAULT_CONFIGURATION_TYPE);
+        }
+
+        List<String> configurationTypes = new ArrayList<String>();
+        for (String rct : requestedConfigurationTypes) {
+            if (configTypesSet.contains(rct)) {
+                configurationTypes.add(rct);
+            }
+        }
+        LOG.info("Configuration types selected for export: {}.", configurationTypes);
+        return configurationTypes;
+    }
+
+    private List<String> determineConfigTypesForImport(EndpointDescription endpoint) {
+        List<String> remoteConfigurationTypes = endpoint.getConfigurationTypes();
+
+        List<String> usableConfigurationTypes = new ArrayList<String>();
+        for (String ct : supportedConfigurationTypes) {
+            if (remoteConfigurationTypes.contains(ct)) {
+                usableConfigurationTypes.add(ct);
+            }
+        }
+
+        LOG.info("Ignoring endpoint {} as it has no compatible configuration types: {}.", 
+                 endpoint.getId(), remoteConfigurationTypes);
+        return usableConfigurationTypes;
+    }
+
+    public String[] getSupportedTypes() {
+        return supportedConfigurationTypes;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ClassUtils.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ClassUtils.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ClassUtils.java
new file mode 100644
index 0000000..cae19bd
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ClassUtils.java
@@ -0,0 +1,142 @@
+/**
+ * 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.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cxf.helpers.CastUtils;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public final class ClassUtils {
+
+    private static final Logger LOG = LoggerFactory.getLogger(ClassUtils.class);
+
+    private ClassUtils() {
+    }
+
+    public static Class<?> getInterfaceClass(Object service, String interfaceName) {
+        return getInterfaceClass(service.getClass(), interfaceName);
+    }
+
+    private static Class<?> getInterfaceClass(Class<?> serviceClass, String interfaceName) {
+        for (Class<?> iClass : serviceClass.getInterfaces()) {
+            if (iClass.getName().equals(interfaceName)) {
+                return iClass;
+            }
+            Class<?> intf = getInterfaceClass(iClass, interfaceName);
+            if (intf != null) {
+                return intf;
+            }
+        }
+
+        if (serviceClass.getName().equals(interfaceName)) {
+            return serviceClass;
+        }
+
+        Class<?> interfaceOnProxiedClass = getInterfaceClassOnSuperClasses(serviceClass, interfaceName);
+        if (interfaceOnProxiedClass != null) {
+            return interfaceOnProxiedClass;
+        }
+
+        return null;
+    }
+
+    /**
+     * This method tries to deal specifically with classes that might have been proxied
+     * eg. CGLIB proxies of which there might be a chain of proxies as different osgi frameworks
+     * might be proxying the original service class that has been registered and then proxying the proxy.
+     *
+     * @param serviceClass
+     * @param interfaceName
+     * @return
+     */
+    private static Class<?> getInterfaceClassOnSuperClasses(Class<?> serviceClass, String interfaceName) {
+        Class<?> superClass = serviceClass.getSuperclass();
+        if (superClass != null) {
+            for (Class<?> iClass : superClass.getInterfaces()) {
+                if (iClass.getName().equals(interfaceName)) {
+                    return iClass;
+                }
+                Class<?> intf = getInterfaceClass(iClass, interfaceName);
+                if (intf != null) {
+                    return intf;
+                }
+            }
+            Class<?> foundOnSuperclass = getInterfaceClassOnSuperClasses(superClass, interfaceName);
+            if (foundOnSuperclass != null) {
+                return foundOnSuperclass;
+            }
+        }
+        return null;
+    }
+
+    public static List<Object> loadProviderClasses(BundleContext callingContext,
+                                                   Map<String, Object> sd, String propName) {
+        Object serviceProviders = sd.get(propName);
+        if (serviceProviders != null) {
+            if (serviceProviders.getClass().isArray()) {
+                if (serviceProviders.getClass().getComponentType() == String.class) {
+                    return loadProviders(callingContext, (String[])serviceProviders);
+                } else {
+                    return Arrays.asList((Object[])serviceProviders);
+                }
+            } else if (serviceProviders.getClass() == String.class) {
+                String[] classNames = serviceProviders.toString().split(",");
+                return loadProviders(callingContext, classNames);
+            } else if (serviceProviders instanceof List) { 
+                List<Object> list = CastUtils.cast((List<?>)serviceProviders);
+                if (!list.isEmpty()) {
+                    List<Object> providers;
+                    if (list.get(0).getClass() == String.class) {
+                        providers = loadProviders(callingContext, list.toArray(new String[]{}));
+                    } else {
+                        providers = list;
+                    }
+                    return providers;
+                }
+            } else {
+                return Arrays.asList(serviceProviders);
+            }
+        }
+        return Collections.emptyList();
+        
+    }
+
+    private static List<Object> loadProviders(BundleContext callingContext, String[] classNames) {
+        List<Object> providers = new ArrayList<Object>();
+        for (String className : classNames) {
+            try {
+                String realName = className.trim();
+                if (!realName.isEmpty()) {
+                    Class<?> pClass = callingContext.getBundle().loadClass(realName);
+                    providers.add(pClass.newInstance());
+                }
+            } catch (Exception ex) {
+                LOG.warn("Provider " + className.trim() + " can not be loaded or created " + ex.getMessage(), ex);
+            }
+        }
+        return providers;
+    }
+}


[06/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

Posted by cs...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-tcp/pom.xml
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-tcp/pom.xml b/dsw/cxf-dosgi-tcp/pom.xml
deleted file mode 100644
index 8e40ee1..0000000
--- a/dsw/cxf-dosgi-tcp/pom.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.cxf.dosgi</groupId>
-        <artifactId>cxf-dosgi-ri-parent</artifactId>
-        <version>1.8-SNAPSHOT</version>
-        <relativePath>../../parent/pom.xml</relativePath>
-    </parent>
-    <artifactId>cxf-dosgi-ri-tcp</artifactId>
-    <packaging>bundle</packaging>
-    <name>CXF dOSGi Remote Service Admin TCP provider</name>
-    <description>Provider for Java Serialization over TCP</description>
-
-    <properties>
-        <topDirectoryLocation>../..</topDirectoryLocation>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.cxf.dosgi</groupId>
-            <artifactId>cxf-dosgi-ri-provider-api</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.easymock</groupId>
-            <artifactId>easymockclassextension</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-jdk14</artifactId>
-            <version>1.7.14</version>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <extensions>true</extensions>
-                <configuration>
-                    <instructions>
-                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
-                        <Bundle-Activator>org.apache.aries.rsa.provider.tcp.Activator</Bundle-Activator>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-</project>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/Activator.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/Activator.java b/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/Activator.java
deleted file mode 100644
index 128c3d8..0000000
--- a/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/Activator.java
+++ /dev/null
@@ -1,45 +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.aries.rsa.provider.tcp;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
-public class Activator implements BundleActivator {
-
-    @Override
-    public void start(BundleContext context) throws Exception {
-        DistributionProvider provider = new TCPProvider();
-        Dictionary<String, Object> props = new Hashtable<>();
-        props.put(RemoteConstants.REMOTE_INTENTS_SUPPORTED, new String[]{});
-        props.put(RemoteConstants.REMOTE_CONFIGS_SUPPORTED, provider.getSupportedTypes());
-        context.registerService(DistributionProvider.class, provider, props);
-    }
-
-    @Override
-    public void stop(BundleContext context) throws Exception {
-        // unregister happens automatically
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/LoaderObjectInputStream.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/LoaderObjectInputStream.java b/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/LoaderObjectInputStream.java
deleted file mode 100644
index ac60950..0000000
--- a/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/LoaderObjectInputStream.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.aries.rsa.provider.tcp;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectStreamClass;
-
-public class LoaderObjectInputStream extends ObjectInputStream {
-
-    private ClassLoader loader;
-
-    public LoaderObjectInputStream(InputStream in, ClassLoader loader) throws IOException {
-        super(in);
-        this.loader = loader;
-    }
-
-    @Override
-    protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
-        try {
-            return loader.loadClass(desc.getName());
-        } catch (ClassNotFoundException e) {
-            return super.resolveClass(desc);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/LocalHostUtil.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/LocalHostUtil.java b/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/LocalHostUtil.java
deleted file mode 100644
index 3f40bd8..0000000
--- a/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/LocalHostUtil.java
+++ /dev/null
@@ -1,92 +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.aries.rsa.provider.tcp;
-
-import java.net.InetAddress;
-import java.net.NetworkInterface;
-import java.net.SocketException;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-
-/**
- * Utility methods to get the local address even on a linux host.
- */
-public final class LocalHostUtil {
-
-    private LocalHostUtil() {
-        // Util Class
-    }
-
-    /**
-     * Returns an InetAddress representing the address of the localhost. Every
-     * attempt is made to find an address for this host that is not the loopback
-     * address. If no other address can be found, the loopback will be returned.
-     *
-     * @return InetAddress the address of localhost
-     * @throws UnknownHostException if there is a problem determining the address
-     */
-    public static InetAddress getLocalHost() throws UnknownHostException {
-        InetAddress localHost = InetAddress.getLocalHost();
-        if (!localHost.isLoopbackAddress()) {
-            return localHost;
-        }
-        InetAddress[] addrs = getAllLocalUsingNetworkInterface();
-        for (InetAddress addr : addrs) {
-            if (!addr.isLoopbackAddress() && !addr.getHostAddress().contains(":")) {
-                return addr;
-            }
-        }
-        return localHost;
-    }
-
-    /**
-     * Utility method that delegates to the methods of NetworkInterface to
-     * determine addresses for this machine.
-     *
-     * @return all addresses found from the NetworkInterfaces
-     * @throws UnknownHostException if there is a problem determining addresses
-     */
-    private static InetAddress[] getAllLocalUsingNetworkInterface() throws UnknownHostException {
-        try {
-            List<InetAddress> addresses = new ArrayList<InetAddress>();
-            Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces();
-            while (e.hasMoreElements()) {
-                NetworkInterface ni = e.nextElement();
-                for (Enumeration<InetAddress> e2 = ni.getInetAddresses(); e2.hasMoreElements();) {
-                    addresses.add(e2.nextElement());
-                }
-            }
-            return addresses.toArray(new InetAddress[] {});
-        } catch (SocketException ex) {
-            throw new UnknownHostException("127.0.0.1");
-        }
-    }
-
-    public static String getLocalIp() {
-        String localIP;
-        try {
-            localIP = getLocalHost().getHostAddress();
-        } catch (Exception e) {
-            localIP = "localhost";
-        }
-        return localIP;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TCPProvider.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TCPProvider.java b/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TCPProvider.java
deleted file mode 100644
index 07c5a05..0000000
--- a/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TCPProvider.java
+++ /dev/null
@@ -1,67 +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.aries.rsa.provider.tcp;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Proxy;
-import java.net.URI;
-import java.util.Map;
-
-import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
-import org.apache.cxf.dosgi.dsw.api.Endpoint;
-import org.apache.cxf.dosgi.dsw.api.IntentUnsatisfiedException;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
-@SuppressWarnings("rawtypes")
-public class TCPProvider implements DistributionProvider {
-
-    private static final String TCP_CONFIG_TYPE = "aries.tcp";
-
-    @Override
-    public String[] getSupportedTypes() {
-        return new String[] {TCP_CONFIG_TYPE};
-    }
-
-    @Override
-    public Endpoint exportService(Object serviceO, 
-                                  BundleContext serviceContext,
-                                  Map<String, Object> effectiveProperties,
-                                  Class[] exportedInterfaces) {
-        effectiveProperties.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, getSupportedTypes());
-        return new TcpEndpoint(serviceO, effectiveProperties);
-    }
-
-    @Override
-    public Object importEndpoint(ClassLoader cl, 
-                                 BundleContext consumerContext, 
-                                 Class[] interfaces,
-                                 EndpointDescription endpoint)
-        throws IntentUnsatisfiedException {
-        try {
-            URI address = new URI(endpoint.getId());
-            InvocationHandler handler = new TcpInvocationHandler(cl, address.getHost(), address.getPort());
-            return Proxy.newProxyInstance(cl, interfaces, handler);
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TCPServer.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TCPServer.java b/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TCPServer.java
deleted file mode 100644
index e70731d..0000000
--- a/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TCPServer.java
+++ /dev/null
@@ -1,118 +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.aries.rsa.provider.tcp;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.SocketException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TCPServer implements Closeable, Runnable {
-    private Logger log = LoggerFactory.getLogger(TCPServer.class);
-    private ServerSocket serverSocket;
-    private Object service;
-    private boolean running;
-    private ExecutorService executor;
-
-    public TCPServer(Object service, String localip, Integer port, int numThreads) {
-        this.service = service;
-        try {
-            this.serverSocket = new ServerSocket(port);
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-        this.running = true;
-        this.executor = Executors.newCachedThreadPool();
-        for (int c = 0; c < numThreads; c++) {
-            this.executor.execute(this);
-        }
-    }
-    
-    int getPort() {
-        return this.serverSocket.getLocalPort();
-    }
-
-    public void run() {
-        ClassLoader serviceCL = service.getClass().getClassLoader();
-        while (running) {
-            try (
-                Socket socket = this.serverSocket.accept();
-                ObjectInputStream ois = new LoaderObjectInputStream(socket.getInputStream(), serviceCL);
-                ObjectOutputStream objectOutput = new ObjectOutputStream(socket.getOutputStream())
-                ) {
-                String methodName = (String)ois.readObject();
-                Object[] args = (Object[])ois.readObject();
-                Object result = invoke(methodName, args);
-                objectOutput.writeObject(result);
-            } catch (SocketException e) {
-                running = false;
-            } catch (Exception e) {
-                log.warn("Error processing service call.", e);
-            }
-        }
-    }
-
-    private Object invoke(String methodName, Object[] args)
-        throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-        Class<?>[] parameterTypesAr = getTypes(args);
-        Method method = service.getClass().getMethod(methodName, parameterTypesAr);
-        try {
-            return method.invoke(service, args);
-        } catch (Throwable e) {
-            return e;
-        }
-    }
-
-    private Class<?>[] getTypes(Object[] args) {
-        List<Class<?>> parameterTypes = new ArrayList<>();
-        if (args != null) {
-            for (Object arg : args) {
-                parameterTypes.add(arg.getClass());
-            }
-        }
-        Class<?>[] parameterTypesAr = parameterTypes.toArray(new Class[]{});
-        return parameterTypesAr;
-    }
-
-    @Override
-    public void close() throws IOException {
-        this.serverSocket.close();
-        this.running = false;
-        this.executor.shutdown();
-        try {
-            this.executor.awaitTermination(10, TimeUnit.SECONDS);
-        } catch (InterruptedException e) {
-        }
-        this.executor.shutdownNow();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpEndpoint.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpEndpoint.java b/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpEndpoint.java
deleted file mode 100644
index 5bc9d7a..0000000
--- a/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpEndpoint.java
+++ /dev/null
@@ -1,58 +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.aries.rsa.provider.tcp;
-
-import java.io.IOException;
-import java.util.Map;
-
-import org.apache.cxf.dosgi.dsw.api.Endpoint;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
-public class TcpEndpoint implements Endpoint {
-    private EndpointDescription epd;
-    private TCPServer tcpServer;
-    
-    public TcpEndpoint(Object service, Map<String, Object> effectiveProperties) {
-        Integer port = getInt(effectiveProperties, "port", 0);
-        String localip = LocalHostUtil.getLocalIp();
-        int numThreads = getInt(effectiveProperties, "numThreads", 10);
-        tcpServer = new TCPServer(service, localip, port, numThreads);
-        effectiveProperties.put(RemoteConstants.ENDPOINT_ID, "tcp://" + localip + ":" + tcpServer.getPort());
-        effectiveProperties.put(RemoteConstants.SERVICE_EXPORTED_CONFIGS, "");
-        this.epd = new EndpointDescription(effectiveProperties);
-    }
-    
-
-    private Integer getInt(Map<String, Object> effectiveProperties, String key, int defaultValue) {
-        String value = (String)effectiveProperties.get(key);
-        return value != null ? Integer.parseInt(value) : defaultValue;
-    }
-
-    @Override
-    public EndpointDescription description() {
-        return this.epd;
-    }
-
-
-    @Override
-    public void close() throws IOException {
-        tcpServer.close();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpInvocationHandler.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpInvocationHandler.java b/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpInvocationHandler.java
deleted file mode 100644
index cdbf8ec..0000000
--- a/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpInvocationHandler.java
+++ /dev/null
@@ -1,68 +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.aries.rsa.provider.tcp;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.net.Socket;
-import java.net.UnknownHostException;
-
-public class TcpInvocationHandler implements InvocationHandler {
-    private String host;
-    private int port;
-    private ClassLoader cl;
-
-    public TcpInvocationHandler(ClassLoader cl, String host, int port)
-        throws UnknownHostException, IOException {
-        this.cl = cl;
-        this.host = host;
-        this.port = port;
-
-    }
-
-    @Override
-    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-        try (
-            Socket socket = new Socket(this.host, this.port);
-            ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream())
-            ) {
-            out.writeObject(method.getName());
-            out.writeObject(args);
-            out.flush();
-            return parseResult(socket);
-        } catch (Exception  e) {
-            throw new RuntimeException("Error calling " + host + ":" + port + " method: " + method.getName(), e);
-        }
-    }
-
-    private Object parseResult(Socket socket) throws IOException, ClassNotFoundException, Throwable {
-        try (ObjectInputStream in = new LoaderObjectInputStream(socket.getInputStream(), cl)) {
-            Object result = in.readObject();
-            if (result instanceof Throwable) {
-                throw (Throwable)result;
-            } else {
-                return result;
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpProviderTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpProviderTest.java b/dsw/cxf-dosgi-tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpProviderTest.java
deleted file mode 100644
index 583c5e1..0000000
--- a/dsw/cxf-dosgi-tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpProviderTest.java
+++ /dev/null
@@ -1,107 +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.aries.rsa.provider.tcp;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.aries.rsa.provider.tcp.myservice.MyService;
-import org.apache.aries.rsa.provider.tcp.myservice.MyServiceImpl;
-import org.apache.cxf.dosgi.dsw.api.Endpoint;
-import org.apache.cxf.dosgi.dsw.api.EndpointHelper;
-import org.easymock.EasyMock;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.BundleContext;
-
-public class TcpProviderTest {
-
-    private static final int NUM_CALLS = 100;
-    private MyService myServiceProxy;
-    private Endpoint ep;
-    
-    @Before
-    public void createServerAndProxy() {
-        Class<?>[] exportedInterfaces = new Class[] {MyService.class};
-        TCPProvider provider = new TCPProvider();
-        Map<String, Object> props = new HashMap<String, Object>();
-        EndpointHelper.addObjectClass(props, exportedInterfaces);
-        MyService myService = new MyServiceImpl();
-        BundleContext bc = EasyMock.mock(BundleContext.class);
-        ep = provider.exportService(myService, bc, props, exportedInterfaces);
-        myServiceProxy = (MyService)provider.importEndpoint(MyService.class.getClassLoader(), 
-                                                            bc,
-                                                            exportedInterfaces, 
-                                                            ep.description());
-    }
-
-    @Test
-    public void testPerf() throws IOException, InterruptedException {
-        runPerfTest(myServiceProxy);
-        String msg = "test";
-        String result = myServiceProxy.echo(msg);
-        Assert.assertEquals(msg, result);
-    }
-    
-    @Test
-    public void testCall() throws IOException, InterruptedException {
-        myServiceProxy.call("test");
-    }
-    
-    @Test
-    public void testCallOneway() throws IOException, InterruptedException {
-        myServiceProxy.callOneWay("test");
-    }
-    
-    @After
-    public void close() throws IOException {
-        ep.close();
-    }
-
-    private void runPerfTest(final MyService myServiceProxy2) throws InterruptedException {
-        StringBuilder msg = new StringBuilder();
-        for (int c = 0; c < 1000; c++) {
-            msg.append("testing123");
-        }
-        final String msg2 = msg.toString();
-        ExecutorService executor = Executors.newFixedThreadPool(10);
-        Runnable task = new Runnable() {
-            
-            @Override
-            public void run() {
-                String result = myServiceProxy2.echo(msg2);
-                Assert.assertEquals(msg2, result);
-            }
-        };
-        long start = System.currentTimeMillis();
-        for (int c = 0; c < NUM_CALLS; c++) {
-            executor.execute(task);
-        }
-        executor.shutdown();
-        executor.awaitTermination(100, TimeUnit.SECONDS);
-        long tps = NUM_CALLS * 1000 / (System.currentTimeMillis() - start);
-        System.out.println(tps + " tps");
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/MyService.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/MyService.java b/dsw/cxf-dosgi-tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/MyService.java
deleted file mode 100644
index e9d56bf..0000000
--- a/dsw/cxf-dosgi-tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/MyService.java
+++ /dev/null
@@ -1,30 +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.aries.rsa.provider.tcp.myservice;
-
-import javax.jws.Oneway;
-
-public interface MyService {
-    String echo(String msg);
-    void call(String msg);
-
-    // Oneway not yet supported
-    @Oneway
-    void callOneWay(String msg);
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/MyServiceImpl.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dosgi-tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/MyServiceImpl.java b/dsw/cxf-dosgi-tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/MyServiceImpl.java
deleted file mode 100644
index 5f469ed..0000000
--- a/dsw/cxf-dosgi-tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/MyServiceImpl.java
+++ /dev/null
@@ -1,36 +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.aries.rsa.provider.tcp.myservice;
-
-public class MyServiceImpl implements MyService {
-
-    @Override
-    public String echo(String msg) {
-        return msg;
-    }
-
-    @Override
-    public void call(String msg) {
-    }
-
-    @Override
-    public void callOneWay(String msg) {
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/pom.xml
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/pom.xml b/dsw/cxf-dsw/pom.xml
deleted file mode 100644
index 81a3720..0000000
--- a/dsw/cxf-dsw/pom.xml
+++ /dev/null
@@ -1,155 +0,0 @@
-<?xml version='1.0' encoding='UTF-8' ?>
-<!--
-  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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>cxf-dosgi-ri-dsw-cxf</artifactId>
-    <packaging>bundle</packaging>
-    <name>CXF dOSGi Distribution provider</name>
-
-    <parent>
-        <groupId>org.apache.cxf.dosgi</groupId>
-        <artifactId>cxf-dosgi-ri-parent</artifactId>
-        <version>1.8-SNAPSHOT</version>
-        <relativePath>../../parent/pom.xml</relativePath>
-    </parent>
-
-    <properties>
-        <topDirectoryLocation>../..</topDirectoryLocation>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-        </dependency>
-
-
-        <dependency>
-            <groupId>org.apache.cxf.dosgi</groupId>
-            <artifactId>cxf-dosgi-ri-provider-api</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-core</artifactId>
-            <version>${cxf.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-rt-frontend-jaxws</artifactId>
-            <version>${cxf.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
-            <version>${cxf.version}</version>
-        </dependency>
-		<dependency>
-            <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-rt-rs-client</artifactId>
-            <version>${cxf.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-rt-databinding-aegis</artifactId>
-            <version>${cxf.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-rt-rs-extension-providers</artifactId>
-            <version>${cxf.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-servlet_${servlet.version}_spec</artifactId>
-            <version>1.0</version>
-        </dependency>
-
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.easymock</groupId>
-            <artifactId>easymockclassextension</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-jdk14</artifactId>
-            <version>1.7.14</version>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.jvnet.jaxb2.maven2</groupId>
-                <artifactId>maven-jaxb2-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>generate</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <extensions>true</extensions>
-                <configuration>
-                    <instructions>
-                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
-                        <Import-Package>
-                            javax.servlet*;version="[0.0,4)",
-                            *
-                        </Import-Package>
-                        <Export-Package>
-                            !*
-                        </Export-Package>
-                        <Bundle-Activator>org.apache.cxf.dosgi.dsw.Activator</Bundle-Activator>
-                    </instructions>
-                </configuration>
-            </plugin>
-
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <configuration>
-                    <excludes>
-                        <exclude>**/TestUtils*</exclude>
-                    </excludes>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-</project>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/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
deleted file mode 100644
index 743e8f2..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java
+++ /dev/null
@@ -1,160 +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;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
-import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
-import org.apache.cxf.dosgi.dsw.decorator.ServiceDecorator;
-import org.apache.cxf.dosgi.dsw.decorator.ServiceDecoratorBundleListener;
-import org.apache.cxf.dosgi.dsw.decorator.ServiceDecoratorImpl;
-import org.apache.cxf.dosgi.dsw.handlers.CXFDistributionProvider;
-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.dosgi.dsw.qos.IntentTracker;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleListener;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.cm.ConfigurationException;
-import org.osgi.service.cm.ManagedService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-// registered as spring bean -> start / stop called accordingly
-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 IntentTracker intentTracker;
-    private HttpServiceManager httpServiceManager;
-    private BundleContext bc;
-    private BundleListener bundleListener;
-    private Dictionary<String, Object> curConfiguration;
-    private Bus bus;
-
-    public void start(BundleContext bundlecontext) throws Exception {
-        LOG.debug("RemoteServiceAdmin Implementation is starting up");
-        this.bc = bundlecontext;
-        // Disable the fast infoset as it's not compatible (yet) with OSGi
-        System.setProperty("org.apache.cxf.nofastinfoset", "true");
-        curConfiguration = getDefaultConfig();
-        init(curConfiguration);
-        registerManagedService(bc);
-    }
-
-    private Dictionary<String, Object> getDefaultConfig() {
-        return new Hashtable<String, Object>();
-    }
-
-    private synchronized void init(Dictionary<String, Object> config) {
-        bus = BusFactory.newInstance().createBus();
-        
-        String httpBase = (String) config.get(org.apache.cxf.dosgi.dsw.Constants.HTTP_BASE);
-        String cxfServletAlias = (String) config.get(org.apache.cxf.dosgi.dsw.Constants.CXF_SERVLET_ALIAS);
-
-        IntentMap intentMap = new IntentMap(new DefaultIntentMapFactory().create());
-        intentTracker = new IntentTracker(bc, intentMap);
-        intentTracker.open();
-        IntentManager intentManager = new IntentManagerImpl(intentMap, DEFAULT_INTENT_TIMEOUT);
-        httpServiceManager = new HttpServiceManager(bc, httpBase, cxfServletAlias);
-        DistributionProvider cxfProvider
-            = new CXFDistributionProvider(bc, intentManager, httpServiceManager);
-        Dictionary<String, Object> props = new Hashtable<String, Object>();
-        String[] supportedIntents = intentMap.keySet().toArray(new String[] {});
-        props.put("remote.intents.supported", supportedIntents);
-        props.put("remote.configs.supported", cxfProvider.getSupportedTypes());
-        rsaFactoryReg = bc.registerService(DistributionProvider.class.getName(), cxfProvider, props);
-        ServiceDecoratorImpl serviceDecorator = new ServiceDecoratorImpl();
-        bundleListener = new ServiceDecoratorBundleListener(serviceDecorator);
-        bc.addBundleListener(bundleListener);
-        decoratorReg = bc.registerService(ServiceDecorator.class.getName(), serviceDecorator, null);
-    }
-
-    private synchronized void uninit() {
-        if (decoratorReg != null) {
-            decoratorReg.unregister();
-            decoratorReg = null;
-        }
-        if (bundleListener != null) {
-            bc.removeBundleListener(bundleListener);
-            bundleListener = null;
-        }
-        if (rsaFactoryReg != null) {
-            // This also triggers the unimport and unexport of the remote services
-            rsaFactoryReg.unregister();
-            rsaFactoryReg = null;
-        }
-        if (httpServiceManager != null) {
-            httpServiceManager.close();
-            httpServiceManager = null;
-        }
-        if (intentTracker != null) {
-            intentTracker.close();
-            intentTracker = null;
-        }
-    }
-
-    private void registerManagedService(BundleContext bundlecontext) {
-        Dictionary<String, String> props = new Hashtable<String, String>();
-        props.put(Constants.SERVICE_PID, CONFIG_SERVICE_PID);
-        // No need to store the registration. Will be unregistered in stop by framework
-        bundlecontext.registerService(ManagedService.class.getName(), this, props);
-    }
-
-    public void stop(BundleContext context) throws Exception {
-        LOG.debug("RemoteServiceAdmin Implementation is shutting down now");
-        uninit();
-        shutdownCXFBus();
-    }
-
-    /**
-     * Causes also the shutdown of the embedded HTTP server
-     */
-    private void shutdownCXFBus() {
-        if (bus != null) {
-            LOG.debug("Shutting down the CXF Bus");
-            bus.shutdown(true);
-        }
-    }
-
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    public synchronized void updated(Dictionary config) throws ConfigurationException {
-        LOG.debug("RemoteServiceAdmin Implementation configuration is updated with {}", config);
-        // config is null if it doesn't exist, is being deleted or has not yet been loaded
-        // in which case we run with defaults (just like we do manually when bundle is first started)
-        Dictionary<String, Object> configMap = config == null ? getDefaultConfig() : config;
-        if (!configMap.equals(curConfiguration)) { // only if something actually changed
-            curConfiguration = configMap;
-            uninit();
-            init(configMap);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java
deleted file mode 100644
index 218bec6..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java
+++ /dev/null
@@ -1,146 +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;
-
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
-public final class Constants {
-
-    // Constants from RFC 119, they should ultimately be picked up from an OSGi class.
-    @Deprecated
-    public static final String EXPORTED_INTERFACES = RemoteConstants.SERVICE_EXPORTED_INTERFACES;
-    @Deprecated
-    public static final String EXPORTED_INTERFACES_OLD = "osgi.remote.interfaces"; // for BW compatibility
-
-    @Deprecated
-    public static final String EXPORTED_CONFIGS = RemoteConstants.SERVICE_EXPORTED_CONFIGS;
-    @Deprecated
-    public static final String EXPORTED_CONFIGS_OLD = "osgi.remote.configuration.type"; // for BW compatibility
-
-    @Deprecated
-    public static final String EXPORTED_INTENTS = RemoteConstants.SERVICE_EXPORTED_INTENTS;
-    @Deprecated
-    public static final String EXPORTED_INTENTS_EXTRA = RemoteConstants.SERVICE_EXPORTED_INTENTS_EXTRA;
-    @Deprecated
-    public static final String EXPORTED_INTENTS_OLD = "osgi.remote.requires.intents";
-
-    @Deprecated
-    public static final String IMPORTED = RemoteConstants.SERVICE_IMPORTED;
-    @Deprecated
-    public static final String IMPORTD_CONFIGS = RemoteConstants.SERVICE_IMPORTED_CONFIGS;
-
-    @Deprecated
-    public static final String INTENTS = RemoteConstants.SERVICE_INTENTS;
-
-    // WSDL
-    public static final String WSDL_CONFIG_TYPE = "wsdl";
-    public static final String WSDL_CONFIG_PREFIX = "osgi.remote.configuration" + "." + WSDL_CONFIG_TYPE;
-    public static final String WSDL_SERVICE_NAMESPACE = WSDL_CONFIG_PREFIX + ".service.ns";
-    public static final String WSDL_SERVICE_NAME = WSDL_CONFIG_PREFIX + ".service.name";
-    public static final String WSDL_PORT_NAME = WSDL_CONFIG_PREFIX + ".port.name";
-    public static final String WSDL_LOCATION = WSDL_CONFIG_PREFIX + ".location";
-    public static final String WSDL_HTTP_SERVICE_CONTEXT = WSDL_CONFIG_PREFIX + ".httpservice.context";
-    // Provider prefix
-    public static final String PROVIDER_PREFIX = "org.apache.cxf";
-
-    // WS
-    public static final String WS_CONFIG_TYPE = PROVIDER_PREFIX + ".ws";
-    public static final String WS_ADDRESS_PROPERTY = WS_CONFIG_TYPE + ".address";
-    public static final String WS_PORT_PROPERTY = WS_CONFIG_TYPE + ".port";
-    public static final String WS_HTTP_SERVICE_CONTEXT = WS_CONFIG_TYPE + ".httpservice.context";
-
-    public static final String WS_FRONTEND_PROP_KEY = WS_CONFIG_TYPE + ".frontend";
-    public static final String WS_FRONTEND_JAXWS = "jaxws";
-    public static final String WS_FRONTEND_SIMPLE = "simple";
-
-    public static final String WS_IN_INTERCEPTORS_PROP_KEY = WS_CONFIG_TYPE + ".in.interceptors";
-    public static final String WS_OUT_INTERCEPTORS_PROP_KEY = WS_CONFIG_TYPE + ".out.interceptors";
-    public static final String WS_OUT_FAULT_INTERCEPTORS_PROP_KEY = WS_CONFIG_TYPE + ".out.fault.interceptors";
-    public static final String WS_IN_FAULT_INTERCEPTORS_PROP_KEY = WS_CONFIG_TYPE + ".in.fault.interceptors";
-    public static final String WS_CONTEXT_PROPS_PROP_KEY = WS_CONFIG_TYPE + ".context.properties";
-    public static final String WS_FEATURES_PROP_KEY = WS_CONFIG_TYPE + ".features";
-
-    public static final String WS_DATABINDING_PROP_KEY = WS_CONFIG_TYPE + ".databinding";
-    public static final String WS_DATABINDING_BEAN_PROP_KEY = WS_DATABINDING_PROP_KEY + ".bean";
-    public static final String WS_DATA_BINDING_JAXB = "jaxb";
-    public static final String WS_DATA_BINDING_AEGIS = "aegis";
-
-    public static final String WS_WSDL_SERVICE_NAMESPACE = WS_CONFIG_TYPE + ".service.ns";
-    public static final String WS_WSDL_SERVICE_NAME = WS_CONFIG_TYPE + ".service.name";
-    public static final String WS_WSDL_PORT_NAME = WS_CONFIG_TYPE + ".port.name";
-    public static final String WS_WSDL_LOCATION = WS_CONFIG_TYPE + ".wsdl.location";
-    // Rest
-    public static final String RS_CONFIG_TYPE = PROVIDER_PREFIX + ".rs";
-    public static final String RS_ADDRESS_PROPERTY = RS_CONFIG_TYPE + ".address";
-    public static final String RS_HTTP_SERVICE_CONTEXT = RS_CONFIG_TYPE + ".httpservice.context";
-    public static final String RS_DATABINDING_PROP_KEY = RS_CONFIG_TYPE + ".databinding";
-    public static final String RS_IN_INTERCEPTORS_PROP_KEY = RS_CONFIG_TYPE + ".in.interceptors";
-    public static final String RS_OUT_INTERCEPTORS_PROP_KEY = RS_CONFIG_TYPE + ".out.interceptors";
-    public static final String RS_IN_FAULT_INTERCEPTORS_PROP_KEY = RS_CONFIG_TYPE + ".in.fault.interceptors";
-    public static final String RS_OUT_FAULT_INTERCEPTORS_PROP_KEY = RS_CONFIG_TYPE + ".out.fault.interceptors";
-    public static final String RS_CONTEXT_PROPS_PROP_KEY = RS_CONFIG_TYPE + ".context.properties";
-    public static final String RS_FEATURES_PROP_KEY = RS_CONFIG_TYPE + ".features";
-    public static final String RS_PROVIDER_PROP_KEY = RS_CONFIG_TYPE + ".provider";
-    public static final String RS_PROVIDER_EXPECTED_PROP_KEY = RS_PROVIDER_PROP_KEY + ".expected";
-    public static final String RS_PROVIDER_GLOBAL_PROP_KEY = RS_PROVIDER_PROP_KEY + ".globalquery";
-    public static final String RS_WADL_LOCATION = RS_CONFIG_TYPE + ".wadl.location";
-    // POJO (old value for WS)
-    public static final String WS_CONFIG_TYPE_OLD = "pojo";
-    public static final String WS_CONFIG_OLD_PREFIX = "osgi.remote.configuration." + WS_CONFIG_TYPE_OLD;
-    public static final String WS_ADDRESS_PROPERTY_OLD = WS_CONFIG_OLD_PREFIX + ".address";
-    public static final String WS_HTTP_SERVICE_CONTEXT_OLD = WS_CONFIG_OLD_PREFIX + ".httpservice.context";
-
-    // Common Configuration Properties
-    public static final String CHECK_BUNDLE = "check.bundle";
-
-    // The following constants are not evaluated anymore
-    @Deprecated
-    public static final String DEFAULT_PORT_CONFIG = "default.port";
-    @Deprecated
-    public static final String DEFAULT_HOST_CONFIG = "default.host";
-    @Deprecated
-    public static final String DEFAULT_PORT_VALUE = "9000";
-    @Deprecated
-    public static final String DEFAULT_HOST_VALUE = "localhost";
-    @Deprecated
-    public static final String USE_MASTER_MAP = "use.master.map";
-
-    // DSW Identification - TODO do we really need this one?
-    public static final String DSW_CLIENT_ID = PROVIDER_PREFIX + ".remote.dsw.client";
-
-    public static final String INTENT_NAME_PROP = "org.apache.cxf.dosgi.IntentName";
-
-    /**
-     * Prefix to create an absolute URL from a relative URL.
-     * See HttpServiceManager.getAbsoluteAddress
-     *
-     * Defaults to: http://<host name>:8181
-     */
-    public static final String HTTP_BASE = "httpBase";
-
-    /**
-     * Name of the cxf servlet alias
-     */
-    public static final String CXF_SERVLET_ALIAS = "cxfServletAlias";
-    public static final String DEFAULT_CXF_SERVLET_ALIAS = "/cxf";
-
-    private Constants() {
-        // never constructed
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParser.java
----------------------------------------------------------------------
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
deleted file mode 100644
index 82753b1..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/DecorationParser.java
+++ /dev/null
@@ -1,85 +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.decorator;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.XMLConstants;
-import javax.xml.bind.JAXBContext;
-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.apache.cxf.xmlns.service_decoration._1_0.ServiceDecorationType;
-import org.apache.cxf.xmlns.service_decoration._1_0.ServiceDecorationsType;
-
-class DecorationParser {
-    private JAXBContext jaxbContext;
-    private Schema schema;
-
-    DecorationParser() {
-        try {
-            jaxbContext = JAXBContext.newInstance(ServiceDecorationsType.class.getPackage().getName(),
-                                                  this.getClass().getClassLoader());
-            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
-            URL resource = getClass().getResource("/service-decoration.xsd");
-            schema = schemaFactory.newSchema(resource);
-        } catch (Exception e) {
-            throw new RuntimeException("Error loading decorations schema", e);
-        }
-
-    }
-
-    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 {
-            InputStream is = resourceURL.openStream();
-            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;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/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
deleted file mode 100644
index 894d01d..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java
+++ /dev/null
@@ -1,96 +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.decorator;
-
-import java.lang.reflect.Constructor;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class InterfaceRule implements Rule {
-
-    private static final Logger LOG = LoggerFactory.getLogger(InterfaceRule.class);
-
-    private final Bundle bundle;
-    private final Pattern matchPattern;
-    private final Map<String, String> propMatches = new HashMap<String, String>();
-    private final Map<String, Object> addProps = new HashMap<String, Object>();
-
-    public InterfaceRule(Bundle b, String im) {
-        bundle = b;
-        matchPattern = Pattern.compile(im);
-    }
-
-    public synchronized void addPropMatch(String name, String value) {
-        propMatches.put(name, value);
-    }
-
-    public synchronized void addProperty(String name, String value, String type) {
-        Object obj = value;
-
-        if (type != null && !String.class.getName().equals(type)) {
-            try {
-                Class<?> cls = getClass().getClassLoader().loadClass(type);
-                Constructor<?> ctor = cls.getConstructor(new Class[] {String.class});
-                obj = ctor.newInstance(value);
-            } catch (Throwable th) {
-                LOG.warn("Could not handle property '" + name
-                         + "' with value '" + value + "' of type: " + type, th);
-                return;
-            }
-        }
-
-        addProps.put(name, obj);
-    }
-
-    public synchronized void apply(ServiceReference<?> sref, Map<String, Object> target) {
-        String[] objectClass = (String[]) sref.getProperty(Constants.OBJECTCLASS);
-        boolean matches = false;
-        for (String cls : objectClass) {
-            Matcher m = matchPattern.matcher(cls);
-            if (m.matches()) {
-                for (Map.Entry<String, String> pm : propMatches.entrySet()) {
-                    Object value = sref.getProperty(pm.getKey());
-                    if (value == null || !Pattern.matches(pm.getValue(), value.toString())) {
-                        return;
-                    }
-                }
-                matches = true;
-                break;
-            }
-        }
-        if (!matches) {
-            return;
-        }
-
-        LOG.info("Adding the following properties to " + sref + ": " + addProps);
-        target.putAll(addProps);
-    }
-
-    public Bundle getBundle() {
-        return bundle;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/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
deleted file mode 100644
index adbd1cf..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/Rule.java
+++ /dev/null
@@ -1,41 +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.decorator;
-
-import java.util.Map;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceReference;
-
-public interface Rule {
-
-    /**
-     * When the ServiceReference passed in matches the rule's condition,
-     * set the additional properties in the target.
-     * @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);
-
-    /**
-     * Returns the bundle that provided this rule.
-     * @return The Bundle where the Rule was defined.
-     */
-    Bundle getBundle();
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecorator.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecorator.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecorator.java
deleted file mode 100644
index 203bd1c..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecorator.java
+++ /dev/null
@@ -1,28 +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.decorator;
-
-import java.util.Map;
-
-import org.osgi.framework.ServiceReference;
-
-public interface ServiceDecorator {
-
-    void decorate(ServiceReference<?> sref, Map<String, Object> properties);
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorBundleListener.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorBundleListener.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorBundleListener.java
deleted file mode 100644
index 79c2908..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorBundleListener.java
+++ /dev/null
@@ -1,48 +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.decorator;
-
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleListener;
-
-public class ServiceDecoratorBundleListener implements BundleListener {
-    /**
-     * 
-     */
-    private final ServiceDecoratorImpl serviceDecorator;
-
-    /**
-     * @param serviceDecorator
-     */
-    public ServiceDecoratorBundleListener(ServiceDecoratorImpl serviceDecorator) {
-        this.serviceDecorator = serviceDecorator;
-    }
-
-    public void bundleChanged(BundleEvent be) {
-        switch(be.getType()) {
-        case BundleEvent.STARTED:
-            this.serviceDecorator.addDecorations(be.getBundle());
-            break;
-        case BundleEvent.STOPPING:
-            this.serviceDecorator.removeDecorations(be.getBundle());
-            break;
-        default:
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImpl.java
----------------------------------------------------------------------
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
deleted file mode 100644
index 20130c3..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImpl.java
+++ /dev/null
@@ -1,97 +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.decorator;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-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;
-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;
-
-    public ServiceDecoratorImpl() {
-        parser = new DecorationParser();
-    }
-    
-    public void decorate(ServiceReference<?> sref, Map<String, Object> target) {
-        for (Rule matcher : decorations) {
-            matcher.apply(sref, target);
-        }
-    }
-
-    void addDecorations(Bundle bundle) {
-        for (ServiceDecorationType decoration : getDecorationElements(bundle)) {
-            for (MatchType match : decoration.getMatch()) {
-                decorations.add(getRule(bundle, match));
-            }
-        }
-    }
-
-    private Rule getRule(Bundle bundle, MatchType match) {
-        InterfaceRule m = new InterfaceRule(bundle, match.getInterface());
-        for (MatchPropertyType propMatch : match.getMatchProperty()) {
-            m.addPropMatch(propMatch.getName(), propMatch.getValue());
-        }
-        for (AddPropertyType addProp : match.getAddProperty()) {
-            m.addProperty(addProp.getName(), addProp.getValue(), addProp.getType());
-        }
-        return m;
-    }
-
-    List<ServiceDecorationType> getDecorationElements(Bundle bundle) {
-        @SuppressWarnings("rawtypes")
-        Enumeration entries = bundle.findEntries("OSGI-INF/remote-service", "*.xml", false);
-        if (entries == null) {
-            return Collections.emptyList();
-        }
-        List<ServiceDecorationType> elements = new ArrayList<ServiceDecorationType>();
-        while (entries.hasMoreElements()) {
-            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;
-    }
-
-    void removeDecorations(Bundle bundle) {
-        for (Rule r : decorations) {
-            if (bundle.equals(r.getBundle())) {
-                decorations.remove(r); // the iterator doesn't support 'remove'
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/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
deleted file mode 100644
index 9e1356c..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
+++ /dev/null
@@ -1,243 +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.lang.reflect.Proxy;
-import java.net.URL;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-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.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.OsgiUtils;
-import org.apache.cxf.dosgi.dsw.util.StringPlus;
-import org.apache.cxf.endpoint.AbstractEndpointFactory;
-import org.apache.cxf.endpoint.Server;
-import org.apache.cxf.feature.AbstractFeature;
-import org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory;
-import org.apache.cxf.frontend.ClientFactoryBean;
-import org.apache.cxf.frontend.ServerFactoryBean;
-import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.interceptor.Interceptor;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
-public abstract class AbstractPojoConfigurationTypeHandler implements DistributionProvider {
-    protected BundleContext bundleContext;
-    protected IntentManager intentManager;
-    protected HttpServiceManager httpServiceManager;
-
-    public AbstractPojoConfigurationTypeHandler(BundleContext dswBC, IntentManager intentManager,
-                                                HttpServiceManager httpServiceManager) {
-        this.bundleContext = dswBC;
-        this.intentManager = intentManager;
-        this.httpServiceManager = httpServiceManager;
-    }
-
-    protected Object getProxy(Object serviceProxy, Class<?> iType) {
-        return Proxy.newProxyInstance(iType.getClassLoader(), new Class[] {
-            iType
-        }, new ServiceInvocationHandler(serviceProxy, iType));
-    }
-
-    protected EndpointDescription createEndpointDesc(Map<String, Object> props, 
-                                                     String[] importedConfigs,
-                                                     String address, 
-                                                     String[] intents) {
-        props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, importedConfigs);
-        for (String configurationType : importedConfigs) {
-            if (Constants.WS_CONFIG_TYPE.equals(configurationType)) {
-                props.put(Constants.WS_ADDRESS_PROPERTY, address);
-            } else if (Constants.RS_CONFIG_TYPE.equals(configurationType)) {
-                props.put(Constants.RS_ADDRESS_PROPERTY, address);
-            } else if (Constants.WS_CONFIG_TYPE_OLD.equals(configurationType)) {
-                props.put(Constants.WS_ADDRESS_PROPERTY_OLD, address);
-                props.put(Constants.WS_ADDRESS_PROPERTY, address);
-            }
-        }
-        String[] sIntents = StringPlus.normalize(props.get(RemoteConstants.SERVICE_INTENTS));
-        String[] allIntents = IntentUtils.mergeArrays(intents, sIntents);
-        props.put(RemoteConstants.SERVICE_INTENTS, allIntents);
-        props.put(RemoteConstants.ENDPOINT_ID, address);
-        return new EndpointDescription(props);
-    }
-
-    protected void setCommonWsdlProperties(AbstractWSDLBasedEndpointFactory factory, BundleContext context,
-                                           Map<String, Object> sd, boolean wsdlType) {
-        String location = OsgiUtils.getProperty(sd, wsdlType ? Constants.WSDL_LOCATION : Constants.WS_WSDL_LOCATION);
-        if (location != null) {
-            URL wsdlURL = context.getBundle().getResource(location);
-            if (wsdlURL != null) {
-                factory.setWsdlURL(wsdlURL.toString());
-            }
-            QName serviceName = getServiceQName(null, sd,
-                    wsdlType ? Constants.WSDL_SERVICE_NAMESPACE : Constants.WS_WSDL_SERVICE_NAMESPACE,
-                    wsdlType ? Constants.WSDL_SERVICE_NAME : Constants.WS_WSDL_SERVICE_NAME);
-            if (serviceName != null) {
-                factory.setServiceName(serviceName);
-                QName portName = getPortQName(serviceName.getNamespaceURI(), sd,
-                        wsdlType ? Constants.WSDL_PORT_NAME : Constants.WS_WSDL_PORT_NAME);
-                if (portName != null) {
-                    factory.setEndpointName(portName);
-                }
-            }
-        }
-    }
-
-    protected void setWsdlProperties(ServerFactoryBean factory, BundleContext callingContext, Map<String, Object> sd,
-                                     boolean wsdlType) {
-        setCommonWsdlProperties(factory, callingContext, sd, wsdlType);
-    }
-
-    protected void setClientWsdlProperties(ClientFactoryBean factory, BundleContext dswContext, Map<String, Object> sd,
-                                           boolean wsdlType) {
-        setCommonWsdlProperties(factory, dswContext, sd, wsdlType);
-    }
-
-    protected static QName getServiceQName(Class<?> iClass, Map<String, Object> sd, String nsPropName,
-                                           String namePropName) {
-        String serviceNs = OsgiUtils.getProperty(sd, nsPropName);
-        String serviceName = OsgiUtils.getProperty(sd, namePropName);
-        if (iClass == null && (serviceNs == null || serviceName == null)) {
-            return null;
-        }
-        if (serviceNs == null) {
-            serviceNs = PackageUtils.getNamespace(PackageUtils.getPackageName(iClass));
-        }
-        if (serviceName == null) {
-            serviceName = iClass.getSimpleName();
-        }
-        return new QName(serviceNs, serviceName);
-    }
-
-    protected static QName getPortQName(String ns, Map<String, Object> sd, String propName) {
-        String portName = OsgiUtils.getProperty(sd, propName);
-        if (portName == null) {
-            return null;
-        }
-        return new QName(ns, portName);
-    }
-
-    protected String getClientAddress(Map<String, Object> sd) {
-        return OsgiUtils.getFirstNonEmptyStringProperty(sd, RemoteConstants.ENDPOINT_ID,
-                                                        Constants.WS_ADDRESS_PROPERTY,
-                                                        Constants.WS_ADDRESS_PROPERTY_OLD,
-                                                        Constants.RS_ADDRESS_PROPERTY);
-    }
-
-    protected String getServerAddress(Map<String, Object> sd, Class<?> iClass) {
-        String address = getClientAddress(sd);
-        return address == null ? httpServiceManager.getDefaultAddress(iClass) : address;
-    }
-    
-    public String getServletContextRoot(Map<String, Object> sd) {
-        return OsgiUtils.getFirstNonEmptyStringProperty(sd,
-                Constants.WS_HTTP_SERVICE_CONTEXT,
-                Constants.WS_HTTP_SERVICE_CONTEXT_OLD,
-                Constants.WSDL_HTTP_SERVICE_CONTEXT,
-                Constants.RS_HTTP_SERVICE_CONTEXT);
-    }
-
-    
-    protected Bus createBus(Long sid, BundleContext callingContext, String contextRoot) {
-        Bus bus = BusFactory.newInstance().createBus();
-        if (contextRoot != null) {
-            httpServiceManager.registerServlet(bus, contextRoot, callingContext, sid);
-        }
-        return bus;
-    }
-
-    protected Endpoint createServerFromFactory(ServerFactoryBean factory, EndpointDescription epd) {
-        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
-        try {
-            Thread.currentThread().setContextClassLoader(ServerFactoryBean.class.getClassLoader());
-            Server server = factory.create();
-            return new ServerWrapper(epd, server);
-        } finally {
-            Thread.currentThread().setContextClassLoader(oldClassLoader);
-        }
-    }
-
-    protected static void addWsInterceptorsFeaturesProps(AbstractEndpointFactory factory, BundleContext callingContext,
-                                                         Map<String, Object> sd) {
-        addInterceptors(factory, callingContext, sd, Constants.WS_IN_INTERCEPTORS_PROP_KEY);
-        addInterceptors(factory, callingContext, sd, Constants.WS_OUT_INTERCEPTORS_PROP_KEY);
-        addInterceptors(factory, callingContext, sd, Constants.WS_OUT_FAULT_INTERCEPTORS_PROP_KEY);
-        addInterceptors(factory, callingContext, sd, Constants.WS_IN_FAULT_INTERCEPTORS_PROP_KEY);
-        addFeatures(factory, callingContext, sd, Constants.WS_FEATURES_PROP_KEY);
-        addContextProperties(factory, sd, Constants.WS_CONTEXT_PROPS_PROP_KEY);
-    }
-
-    static void addRsInterceptorsFeaturesProps(AbstractEndpointFactory factory, BundleContext callingContext,
-                                               Map<String, Object> sd) {
-        addInterceptors(factory, callingContext, sd, Constants.RS_IN_INTERCEPTORS_PROP_KEY);
-        addInterceptors(factory, callingContext, sd, Constants.RS_OUT_INTERCEPTORS_PROP_KEY);
-        addInterceptors(factory, callingContext, sd, Constants.RS_OUT_FAULT_INTERCEPTORS_PROP_KEY);
-        addInterceptors(factory, callingContext, sd, Constants.RS_IN_FAULT_INTERCEPTORS_PROP_KEY);
-        addFeatures(factory, callingContext, sd, Constants.RS_FEATURES_PROP_KEY);
-        addContextProperties(factory, sd, Constants.RS_CONTEXT_PROPS_PROP_KEY);
-    }
-
-    private static void addInterceptors(AbstractEndpointFactory factory, BundleContext callingContext,
-                                        Map<String, Object> sd, String propName) {
-        List<Object> providers = ClassUtils.loadProviderClasses(callingContext, sd, propName);
-        boolean in = propName.contains("in.interceptors");
-        boolean out = propName.contains("out.interceptors");
-        boolean inFault = propName.contains("in.fault.interceptors");
-        boolean outFault = propName.contains("out.fault.interceptors");
-        for (Object provider : providers) {
-            Interceptor<?> interceptor = (Interceptor<?>) provider;
-            if (in) {
-                factory.getInInterceptors().add(interceptor);
-            } else if (out) {
-                factory.getOutInterceptors().add(interceptor);
-            } else if (inFault) {
-                factory.getInFaultInterceptors().add(interceptor);
-            } else if (outFault) {
-                factory.getOutFaultInterceptors().add(interceptor);
-            }
-        }
-    }
-
-    private static void addFeatures(AbstractEndpointFactory factory, BundleContext callingContext,
-                                    Map<String, Object> sd, String propName) {
-        List<Object> providers = ClassUtils.loadProviderClasses(callingContext, sd, propName);
-        if (!providers.isEmpty()) {
-            factory.getFeatures().addAll(CastUtils.cast(providers, AbstractFeature.class));
-        }
-    }
-
-    private static void addContextProperties(AbstractEndpointFactory factory, Map<String, Object> sd, String propName) {
-        @SuppressWarnings("unchecked")
-        Map<String, Object> props = (Map<String, Object>)sd.get(propName);
-        if (props != null) {
-            factory.getProperties(true).putAll(props);
-        }
-    }
-    
-}


[14/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

Posted by cs...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
new file mode 100644
index 0000000..eca5460
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
@@ -0,0 +1,176 @@
+/**
+ * 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.Collections;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.transport.http.DestinationRegistry;
+import org.apache.cxf.transport.http.DestinationRegistryImpl;
+import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceException;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.HttpContext;
+import org.osgi.service.http.HttpService;
+import org.osgi.util.tracker.ServiceTracker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class HttpServiceManager {
+
+    private static final Logger LOG = LoggerFactory.getLogger(HttpServiceManager.class);
+    private static final long SERVICE_LOOKUP_TIMEOUT = 10000;
+    private ServiceTracker<HttpService, HttpService> tracker;
+    private BundleContext bundleContext;
+    private Map<Long, String> exportedAliases = Collections.synchronizedMap(new HashMap<Long, String>());
+    private String httpBase;
+    private String cxfServletAlias;
+
+    public HttpServiceManager(BundleContext bundleContext, String httpBase, String cxfServletAlias) {
+        this(bundleContext, httpBase, cxfServletAlias,
+             new ServiceTracker<HttpService, HttpService>(bundleContext, HttpService.class, null));
+        this.tracker.open();
+    }
+
+    // Only for tests
+    public HttpServiceManager(BundleContext bundleContext,
+                              String httpBase, String cxfServletAlias,
+                              ServiceTracker<HttpService, HttpService> tracker) {
+        this.bundleContext = bundleContext;
+        this.tracker = tracker;
+        this.httpBase = getWithDefault(httpBase, "http://" + LocalHostUtil.getLocalIp() + ":8181");
+        this.cxfServletAlias = getWithDefault(cxfServletAlias, "/cxf");
+    }
+
+    private String getWithDefault(String value, String defaultValue) {
+        return value == null ? defaultValue : value;
+    }
+
+    public Bus registerServlet(Bus bus, String contextRoot, BundleContext callingContext, Long sid) {
+        bus.setExtension(new DestinationRegistryImpl(), DestinationRegistry.class);
+        CXFNonSpringServlet cxf = new CXFNonSpringServlet();
+        cxf.setBus(bus);
+        try {
+            HttpService httpService = getHttpService();
+            httpService.registerServlet(contextRoot, cxf, new Hashtable<String, String>(),
+                                       getHttpContext(callingContext, httpService));
+
+            registerUnexportHook(sid, contextRoot);
+
+            LOG.info("Successfully registered CXF DOSGi servlet at " + contextRoot);
+        } catch (Exception e) {
+            throw new ServiceException("CXF DOSGi: problem registering CXF HTTP Servlet", e);
+        }
+        return bus;
+    }
+
+    protected HttpService getHttpService() {
+        HttpService service = null;
+        try {
+            service = tracker.waitForService(SERVICE_LOOKUP_TIMEOUT);
+        } catch (InterruptedException ex) {
+            LOG.warn("waitForService interrupeted", ex);
+        }
+        if (service == null) {
+            throw new RuntimeException("No HTTPService found");
+        }
+        return service;
+    }
+
+    private HttpContext getHttpContext(BundleContext bc, HttpService httpService) {
+        HttpContext httpContext = httpService.createDefaultHttpContext();
+        return new SecurityDelegatingHttpContext(bc, httpContext);
+    }
+
+    /**
+     * This listens for service removal events and "un-exports" the service
+     * from the HttpService.
+     *
+     * @param sref the service reference to track
+     * @param alias the HTTP servlet context alias
+     */
+    private void registerUnexportHook(Long sid, String alias) {
+        LOG.debug("Registering service listener for service with ID {}", sid);
+
+        String previous = exportedAliases.put(sid, alias);
+        if (previous != null) {
+            LOG.warn("Overwriting service export for service with ID {}", sid);
+        }
+
+        try {
+            Filter f = bundleContext.createFilter("(" + org.osgi.framework.Constants.SERVICE_ID + "=" + sid + ")");
+            if (f != null) {
+                bundleContext.addServiceListener(new UnregisterListener(), f.toString());
+            } else {
+                LOG.warn("Service listener could not be started. The service will not be automatically unexported.");
+            }
+        } catch (InvalidSyntaxException e) {
+            LOG.warn("Service listener could not be started. The service will not be automatically unexported.", e);
+        }
+    }
+
+    protected String getDefaultAddress(Class<?> type) {
+        return "/" + type.getName().replace('.', '/');
+    }
+
+    protected String getAbsoluteAddress(String contextRoot, String relativeEndpointAddress) {
+        if (relativeEndpointAddress.startsWith("http")) {
+            return relativeEndpointAddress;
+        }
+        String effContextRoot = contextRoot == null ? cxfServletAlias : contextRoot;
+        return this.httpBase + effContextRoot + relativeEndpointAddress;
+    }
+
+    public void close() {
+        tracker.close();
+    }
+
+    private final class UnregisterListener implements ServiceListener {
+
+        public void serviceChanged(ServiceEvent event) {
+            if (!(event.getType() == ServiceEvent.UNREGISTERING)) {
+                return;
+            }
+            final ServiceReference<?> sref = event.getServiceReference();
+            final Long sid = (Long) sref.getProperty(org.osgi.framework.Constants.SERVICE_ID);
+            final String alias = exportedAliases.remove(sid);
+            if (alias == null) {
+                LOG.error("Unable to unexport HTTP servlet for service class '{}',"
+                        + " service-id {}: no servlet alias found",
+                        sref.getProperty(org.osgi.framework.Constants.OBJECTCLASS), sid);
+                return;
+            }
+            LOG.debug("Unexporting HTTP servlet for alias '{}'", alias);
+            try {
+                HttpService http = getHttpService();
+                http.unregister(alias);
+            } catch (Exception e) {
+                LOG.warn("An exception occurred while unregistering service for HTTP servlet alias '{}'", alias, e);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
new file mode 100644
index 0000000..8f4f152
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
@@ -0,0 +1,201 @@
+/**
+ * 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.net.URL;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.aries.rsa.spi.Endpoint;
+import org.apache.aries.rsa.spi.IntentUnsatisfiedException;
+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.qos.IntentManager;
+import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.client.Client;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
+import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
+import org.apache.cxf.jaxrs.model.UserResource;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class JaxRSPojoConfigurationTypeHandler extends AbstractPojoConfigurationTypeHandler {
+
+    private static final Logger LOG = LoggerFactory.getLogger(JaxRSPojoConfigurationTypeHandler.class);
+
+    public JaxRSPojoConfigurationTypeHandler(BundleContext dswBC,
+                                             IntentManager intentManager,
+                                             HttpServiceManager httpServiceManager) {
+        super(dswBC, intentManager, httpServiceManager);
+    }
+
+    public String[] getSupportedTypes() {
+        return new String[] {Constants.RS_CONFIG_TYPE};
+    }
+
+    @SuppressWarnings("rawtypes")
+    public Object importEndpoint(ClassLoader consumerLoader,
+                                 BundleContext consumerContext,
+                                 Class[] interfaces,
+                                 EndpointDescription endpoint) {
+        Class<?> iClass = interfaces[0];
+        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, consumerContext, iClass, null, endpoint);
+        } catch (Throwable e) {
+            Thread.currentThread().setContextClassLoader(oldClassLoader);
+        }
+
+        try {
+            ProxyClassLoader cl = new ProxyClassLoader(iClass.getClassLoader());
+            cl.addLoader(Client.class.getClassLoader());
+            return createJaxrsProxy(address, consumerContext, iClass, cl, endpoint);
+        } catch (Throwable e) {
+            LOG.warn("proxy creation failed", e);
+        }
+
+        return null;
+    }
+
+    protected Object createJaxrsProxy(String address,
+                                      BundleContext callingContext,
+                                      Class<?> iClass,
+                                      ClassLoader loader,
+                                      EndpointDescription endpoint) {
+        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
+        bean.setAddress(address);
+        if (loader != null) {
+            bean.setClassLoader(loader);
+        }
+
+        addRsInterceptorsFeaturesProps(bean, callingContext, endpoint.getProperties());
+
+        List<UserResource> resources = JaxRSUtils.getModel(callingContext, iClass);
+        if (resources != null) {
+            bean.setModelBeansWithServiceClass(resources, iClass);
+        } else {
+            bean.setServiceClass(iClass);
+        }
+        List<Object> providers = JaxRSUtils.getProviders(callingContext, endpoint.getProperties());
+        if (providers != null && !providers.isEmpty()) {
+            bean.setProviders(providers);
+        }
+        Thread.currentThread().setContextClassLoader(JAXRSClientFactoryBean.class.getClassLoader());
+        return getProxy(bean.create(), iClass);
+    }
+
+    @SuppressWarnings("rawtypes")
+    public Endpoint exportService(Object serviceBean,
+                                  BundleContext callingContext,
+                                  Map<String, Object> endpointProps,
+                                  Class[] exportedInterfaces) throws IntentUnsatisfiedException {
+        String contextRoot = getServletContextRoot(endpointProps);
+        String address;
+        Class<?> iClass = exportedInterfaces[0];
+        if (contextRoot == null) {
+            address = getServerAddress(endpointProps, iClass);
+        } else {
+            address = getClientAddress(endpointProps);
+            if (address == null) {
+                address = "/";
+            }
+        }
+        final Long sid = (Long) endpointProps.get(RemoteConstants.ENDPOINT_SERVICE_ID);
+        Bus bus = createBus(sid, callingContext, contextRoot);
+
+        LOG.info("Creating a " + iClass.getName()
+                 + " endpoint via JaxRSPojoConfigurationTypeHandler, address is " + address);
+
+        JAXRSServerFactoryBean factory = createServerFactory(callingContext, endpointProps, 
+                                                             iClass, serviceBean, address, bus);
+        String completeEndpointAddress = httpServiceManager.getAbsoluteAddress(contextRoot, address);
+
+        EndpointDescription epd = createEndpointDesc(endpointProps, new String[] {Constants.RS_CONFIG_TYPE},
+                completeEndpointAddress, new String[] {"HTTP"});
+
+        return createServerFromFactory(factory, epd);
+    }
+
+    private Endpoint createServerFromFactory(JAXRSServerFactoryBean factory,
+                                                       EndpointDescription epd) {
+        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+        try {
+            Thread.currentThread().setContextClassLoader(JAXRSServerFactoryBean.class.getClassLoader());
+            Server server = factory.create();
+            return new ServerWrapper(epd, server);
+        } finally {
+            Thread.currentThread().setContextClassLoader(oldClassLoader);
+        }
+    }
+
+    private JAXRSServerFactoryBean createServerFactory(BundleContext callingContext,
+                                                       Map<String, Object> sd,
+                                                       Class<?> iClass,
+                                                       Object serviceBean,
+                                                       String address,
+                                                       Bus bus) {
+        JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
+        factory.setBus(bus);
+        List<UserResource> resources = JaxRSUtils.getModel(callingContext, iClass);
+        if (resources != null) {
+            factory.setModelBeansWithServiceClass(resources, iClass);
+            factory.setServiceBeanObjects(serviceBean);
+        } else {
+            factory.setServiceClass(iClass);
+            factory.setResourceProvider(iClass, new SingletonResourceProvider(serviceBean));
+        }
+        factory.setAddress(address);
+        List<Object> providers = JaxRSUtils.getProviders(callingContext, sd);
+        if (providers != null && !providers.isEmpty()) {
+            factory.setProviders(providers);
+        }
+        addRsInterceptorsFeaturesProps(factory, callingContext, sd);
+        String location = OsgiUtils.getProperty(sd, Constants.RS_WADL_LOCATION);
+        if (location != null) {
+            URL wadlURL = callingContext.getBundle().getResource(location);
+            if (wadlURL != null) {
+                factory.setDocLocation(wadlURL.toString());
+            }
+        }
+        return factory;
+    }
+
+    protected String getPojoAddress(EndpointDescription endpoint, Class<?> iClass) {
+        String address = OsgiUtils.getProperty(endpoint, Constants.RS_ADDRESS_PROPERTY);
+
+        if (address == null) {
+            address = httpServiceManager.getDefaultAddress(iClass);
+            if (address != null) {
+                LOG.info("Using a default address: " + address);
+            }
+        }
+        return address;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java
new file mode 100644
index 0000000..6e78744
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java
@@ -0,0 +1,121 @@
+/**
+ * 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.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
+import org.apache.cxf.jaxrs.model.UserResource;
+import org.apache.cxf.jaxrs.provider.aegis.AegisElementProvider;
+import org.apache.cxf.jaxrs.utils.ResourceUtils;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public final class JaxRSUtils {
+
+    public static final String MODEL_FOLDER = "/OSGI-INF/cxf/jaxrs/";
+    public static final String DEFAULT_MODEL = "/OSGI-INF/cxf/jaxrs/model.xml";
+    public static final String PROVIDERS_FILTER = "(|"
+            + "(objectClass=javax.ws.rs.ext.MessageBodyReader)"
+            + "(objectClass=javax.ws.rs.ext.MessageBodyWriter)"
+            + "(objectClass=javax.ws.rs.ext.ExceptionMapper)"
+            + "(objectClass=org.apache.cxf.jaxrs.ext.RequestHandler)"
+            + "(objectClass=org.apache.cxf.jaxrs.ext.ResponseHandler)"
+            + "(objectClass=org.apache.cxf.jaxrs.ext.ParameterHandler)"
+            + "(objectClass=org.apache.cxf.jaxrs.ext.ResponseExceptionMapper)"
+            + ")";
+    private static final Logger LOG = LoggerFactory.getLogger(JaxRSUtils.class);
+
+    private 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))) {
+            providers.add(new AegisElementProvider());
+        }
+
+        providers.addAll(ClassUtils.loadProviderClasses(callingContext,
+                                                        sd,
+                                                        org.apache.cxf.dosgi.dsw.Constants.RS_PROVIDER_PROP_KEY));
+
+        Object globalQueryProp = sd.get(org.apache.cxf.dosgi.dsw.Constants.RS_PROVIDER_GLOBAL_PROP_KEY);
+        boolean globalQueryRequired = globalQueryProp == null || OsgiUtils.toBoolean(globalQueryProp);
+        if (!globalQueryRequired) {
+            return providers;
+        }
+
+        boolean cxfProvidersOnly = OsgiUtils.getBooleanProperty(sd,
+                org.apache.cxf.dosgi.dsw.Constants.RS_PROVIDER_EXPECTED_PROP_KEY);
+
+        try {
+            ServiceReference[] refs = callingContext.getServiceReferences((String)null, PROVIDERS_FILTER);
+            if (refs != null) {
+                for (ServiceReference ref : refs) {
+                    if (!cxfProvidersOnly
+                        || OsgiUtils.toBoolean(ref
+                            .getProperty(org.apache.cxf.dosgi.dsw.Constants.RS_PROVIDER_PROP_KEY))) {
+                        providers.add(callingContext.getService(ref));
+                    }
+                }
+            }
+        } catch (Exception ex) {
+            LOG.debug("Problems finding JAXRS providers " + ex.getMessage(), ex);
+        }
+        return providers;
+    }
+
+    static List<UserResource> getModel(BundleContext callingContext, Class<?> iClass) {
+        String classModel = MODEL_FOLDER + iClass.getSimpleName() + "-model.xml";
+        List<UserResource> list = getModel(callingContext, iClass, classModel);
+        return list != null ? list : getModel(callingContext, iClass, DEFAULT_MODEL);
+    }
+
+    private static List<UserResource> getModel(BundleContext callingContext, Class<?> iClass, String name) {
+        InputStream r = iClass.getClassLoader().getResourceAsStream(name);
+        if (r == null) {
+            URL u = callingContext.getBundle().getResource(name);
+            if (u != null) {
+                try {
+                    r = u.openStream();
+                } catch (Exception ex) {
+                    LOG.info("Problems opening a user model resource at " + u.toString());
+                }
+            }
+        }
+        if (r != null) {
+            try {
+                return ResourceUtils.getUserResources(r);
+            } catch (Exception ex) {
+                LOG.info("Problems reading a user model, it will be ignored");
+            }
+        }
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/LocalHostUtil.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/LocalHostUtil.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/LocalHostUtil.java
new file mode 100644
index 0000000..50e2127
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/LocalHostUtil.java
@@ -0,0 +1,92 @@
+/**
+ * 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.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+
+/**
+ * Utility methods to get the local address even on a linux host.
+ */
+public final class LocalHostUtil {
+
+    private LocalHostUtil() {
+        // Util Class
+    }
+
+    /**
+     * Returns an InetAddress representing the address of the localhost. Every
+     * attempt is made to find an address for this host that is not the loopback
+     * address. If no other address can be found, the loopback will be returned.
+     *
+     * @return InetAddress the address of localhost
+     * @throws UnknownHostException if there is a problem determining the address
+     */
+    public static InetAddress getLocalHost() throws UnknownHostException {
+        InetAddress localHost = InetAddress.getLocalHost();
+        if (!localHost.isLoopbackAddress()) {
+            return localHost;
+        }
+        InetAddress[] addrs = getAllLocalUsingNetworkInterface();
+        for (InetAddress addr : addrs) {
+            if (!addr.isLoopbackAddress() && !addr.getHostAddress().contains(":")) {
+                return addr;
+            }
+        }
+        return localHost;
+    }
+
+    /**
+     * Utility method that delegates to the methods of NetworkInterface to
+     * determine addresses for this machine.
+     *
+     * @return all addresses found from the NetworkInterfaces
+     * @throws UnknownHostException if there is a problem determining addresses
+     */
+    private static InetAddress[] getAllLocalUsingNetworkInterface() throws UnknownHostException {
+        try {
+            List<InetAddress> addresses = new ArrayList<InetAddress>();
+            Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces();
+            while (e.hasMoreElements()) {
+                NetworkInterface ni = e.nextElement();
+                for (Enumeration<InetAddress> e2 = ni.getInetAddresses(); e2.hasMoreElements();) {
+                    addresses.add(e2.nextElement());
+                }
+            }
+            return addresses.toArray(new InetAddress[] {});
+        } catch (SocketException ex) {
+            throw new UnknownHostException("127.0.0.1");
+        }
+    }
+
+    public static String getLocalIp() {
+        String localIP;
+        try {
+            localIP = getLocalHost().getHostAddress();
+        } catch (Exception e) {
+            localIP = "localhost";
+        }
+        return localIP;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java
new file mode 100644
index 0000000..bf92141
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java
@@ -0,0 +1,172 @@
+/**
+ * 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 javax.jws.WebService;
+
+import org.apache.aries.rsa.spi.Endpoint;
+import org.apache.aries.rsa.spi.IntentUnsatisfiedException;
+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.qos.IntentManager;
+import org.apache.cxf.frontend.ClientProxyFactoryBean;
+import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.jaxb.JAXBDataBinding;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PojoConfigurationTypeHandler extends AbstractPojoConfigurationTypeHandler {
+
+    private static final Logger LOG = LoggerFactory.getLogger(PojoConfigurationTypeHandler.class);
+
+    public PojoConfigurationTypeHandler(BundleContext dswBC,
+                                        IntentManager intentManager,
+                                        HttpServiceManager httpServiceManager) {
+        super(dswBC, intentManager, httpServiceManager);
+    }
+
+    public String[] getSupportedTypes() {
+        return new String[] {Constants.WS_CONFIG_TYPE, Constants.WS_CONFIG_TYPE_OLD};
+    }
+
+    @SuppressWarnings("rawtypes")
+    public Object importEndpoint(ClassLoader consumerLoader,
+                                 BundleContext consumerContext,
+                                 Class[] interfaces,
+                                 EndpointDescription endpoint) throws IntentUnsatisfiedException {
+        Class<?> iClass = interfaces[0];
+        Map<String, Object> sd = endpoint.getProperties();
+        String address = getClientAddress(sd);
+        if (address == null) {
+            LOG.warn("Remote address is unavailable");
+            // TODO: fire Event
+            return null;
+        }
+
+        LOG.info("Creating a " + iClass.getName() + " client, endpoint address is " + address);
+
+        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+        try {
+            ClientProxyFactoryBean factory = createClientProxyFactoryBean(sd, iClass);
+            factory.getServiceFactory().setDataBinding(getDataBinding(sd, iClass));
+            factory.setServiceClass(iClass);
+            factory.setAddress(address);
+            addWsInterceptorsFeaturesProps(factory.getClientFactoryBean(), consumerContext, sd);
+            setClientWsdlProperties(factory.getClientFactoryBean(), bundleContext, sd, false);
+
+            intentManager.applyIntents(factory.getFeatures(), factory.getClientFactoryBean(), sd);
+
+            Thread.currentThread().setContextClassLoader(ClientProxyFactoryBean.class.getClassLoader());
+            return getProxy(factory.create(), iClass);
+        } catch (Exception e) {
+            LOG.warn("proxy creation failed", e);
+        } finally {
+            Thread.currentThread().setContextClassLoader(oldClassLoader);
+        }
+        return null;
+    }
+
+    @SuppressWarnings("rawtypes")
+    public Endpoint exportService(Object serviceO,
+                                  BundleContext serviceContext,
+                                  Map<String, Object> endpointProps,
+                                  Class[] exportedInterfaces) throws IntentUnsatisfiedException {
+        Class<?> iClass = exportedInterfaces[0];
+        String address = getPojoAddress(endpointProps, iClass);
+        ServerFactoryBean factory = createServerFactoryBean(endpointProps, iClass);
+        factory.setDataBinding(getDataBinding(endpointProps, iClass));
+        String contextRoot = getServletContextRoot(endpointProps);
+
+        final Long sid = (Long) endpointProps.get(RemoteConstants.ENDPOINT_SERVICE_ID);
+        Bus bus = createBus(sid, serviceContext, contextRoot);
+        factory.setBus(bus);
+        factory.setServiceClass(iClass);
+        factory.setAddress(address);
+        
+        factory.setServiceBean(serviceO);
+        addWsInterceptorsFeaturesProps(factory, serviceContext, endpointProps);
+        setWsdlProperties(factory, serviceContext, endpointProps, false);
+        String[] intents = intentManager.applyIntents(factory.getFeatures(), factory, endpointProps);
+
+        String completeEndpointAddress = httpServiceManager.getAbsoluteAddress(contextRoot, address);
+        EndpointDescription epd = createEndpointDesc(endpointProps,
+                                                     new String[]{Constants.WS_CONFIG_TYPE},
+                                                     completeEndpointAddress, intents);
+        return createServerFromFactory(factory, epd);
+    }
+
+    private String getPojoAddress(Map<String, Object> sd, Class<?> iClass) {
+        String address = getClientAddress(sd);
+        if (address != null) {
+            return address;
+        }
+
+        // If the property is not of type string this will cause an ClassCastException which
+        // will be propagated to the ExportRegistration exception property.
+        Object port = sd.get(Constants.WS_PORT_PROPERTY);
+        if (port == null) {
+            port = "9000";
+        }
+
+        address = "http://localhost:" + port + "/" + iClass.getName().replace('.', '/');
+        LOG.info("Using a default address: " + address);
+        return address;
+    }
+
+    private DataBinding getDataBinding(Map<String, Object> sd, Class<?> iClass) {
+        Object dataBindingBeanProp = sd.get(Constants.WS_DATABINDING_BEAN_PROP_KEY);
+        if (dataBindingBeanProp instanceof DataBinding) {
+            return (DataBinding)dataBindingBeanProp;
+        } 
+        return isJAXB(sd, iClass) ? new JAXBDataBinding() : new AegisDatabinding();
+    }
+
+    private boolean isJAXB(Map<String, Object> sd, Class<?> iClass) {
+        String dataBindingName = (String)sd.get(Constants.WS_DATABINDING_PROP_KEY);
+        return (iClass.getAnnotation(WebService.class) != null
+            || Constants.WS_DATA_BINDING_JAXB.equals(dataBindingName))
+            && !Constants.WS_DATA_BINDING_AEGIS.equals(dataBindingName);
+    }
+
+    // Isolated so that it can be substituted for testing
+    protected ClientProxyFactoryBean createClientProxyFactoryBean(Map<String, Object> sd, Class<?> iClass) {
+        return isJAXWS(sd, iClass) ? new JaxWsProxyFactoryBean() : new ClientProxyFactoryBean();
+    }
+
+    // Isolated so that it can be substituted for testing
+    protected ServerFactoryBean createServerFactoryBean(Map<String, Object> sd, Class<?> iClass) {
+        return isJAXWS(sd, iClass) ? new JaxWsServerFactoryBean() : new ServerFactoryBean();
+    }
+
+    private boolean isJAXWS(Map<String, Object> sd, Class<?> iClass) {
+        String frontEnd = (String)sd.get(Constants.WS_FRONTEND_PROP_KEY);
+        return (iClass.getAnnotation(WebService.class) != null
+            || Constants.WS_FRONTEND_JAXWS.equals(frontEnd))
+            && !Constants.WS_FRONTEND_SIMPLE.equals(frontEnd);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContext.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContext.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContext.java
new file mode 100644
index 0000000..7e9710b
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContext.java
@@ -0,0 +1,133 @@
+/**
+ * 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.IOException;
+import java.net.URL;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.HttpContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * <p>
+ * An HttpContext that delegates to another HttpContext for all things other than security. This implementation handles
+ * security by delegating to a {@link FilterChain} based on the set of {@link Filter}s registered with a
+ * {@link #FILTER_PROP} property.
+ * </p>
+ * <p>
+ * If the {@link BundleContext} contains a {@link #FILTER_REQUIRED_PROP} property with value "true", requests will not
+ * be allowed until at least one {@link Filter} with a {@link #FILTER_PROP} property is registered.
+ * </p>
+ */
+public class SecurityDelegatingHttpContext implements HttpContext {
+
+    public static final String FILTER_PROP = "org.apache.cxf.httpservice.filter";
+    public static final String FILTER_REQUIRED_PROP = "org.apache.cxf.httpservice.requirefilter";
+    private static final Logger LOG = LoggerFactory.getLogger(SecurityDelegatingHttpContext.class);
+    private static final String FILTER_FILTER = "(" + FILTER_PROP + "=*)";
+
+    BundleContext bundleContext;
+    HttpContext delegate;
+    boolean requireFilter;
+
+    public SecurityDelegatingHttpContext(BundleContext bundleContext, HttpContext delegate) {
+        this.bundleContext = bundleContext;
+        this.delegate = delegate;
+        requireFilter = Boolean.TRUE.toString().equalsIgnoreCase(bundleContext.getProperty(FILTER_REQUIRED_PROP));
+    }
+
+    public String getMimeType(String name) {
+        return delegate.getMimeType(name);
+    }
+
+    public URL getResource(String name) {
+        return delegate.getResource(name);
+    }
+
+    @SuppressWarnings({
+     "unchecked", "rawtypes"
+    })
+    public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException {
+        ServiceReference[] refs;
+        try {
+            refs = bundleContext.getServiceReferences(Filter.class.getName(), FILTER_FILTER);
+        } catch (InvalidSyntaxException e) {
+            LOG.warn(e.getMessage(), e);
+            return false;
+        }
+        if (refs == null || refs.length == 0) {
+            LOG.info("No filter registered.");
+            return !requireFilter;
+        }
+        Filter[] filters = new Filter[refs.length];
+        try {
+            for (int i = 0; i < refs.length; i++) {
+                filters[i] = (Filter)bundleContext.getService(refs[i]);
+            }
+            try {
+                new Chain(filters).doFilter(request, response);
+                return !response.isCommitted();
+            } catch (ServletException e) {
+                LOG.warn(e.getMessage(), e);
+                return false;
+            }
+        } finally {
+            for (int i = 0; i < refs.length; i++) {
+                if (filters[i] != null) {
+                    bundleContext.ungetService(refs[i]);
+                }
+            }
+        }
+    }
+}
+
+/**
+ * A {@link FilterChain} composed of {@link Filter}s with the
+ */
+class Chain implements FilterChain {
+
+    private static final Logger LOG = LoggerFactory.getLogger(Chain.class);
+
+    int current;
+    final Filter[] filters;
+
+    Chain(Filter[] filters) {
+        this.filters = filters;
+    }
+
+    public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
+        if (current < filters.length && !response.isCommitted()) {
+            Filter filter = filters[current++];
+            LOG.info("doFilter() on {}", filter);
+            filter.doFilter(request, response, this);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServerWrapper.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServerWrapper.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServerWrapper.java
new file mode 100644
index 0000000..bcc4963
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServerWrapper.java
@@ -0,0 +1,49 @@
+/**
+ * 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.IOException;
+
+import org.apache.aries.rsa.spi.Endpoint;
+import org.apache.cxf.endpoint.Server;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+
+public class ServerWrapper implements Endpoint {
+    private EndpointDescription desc;
+    private Server server;
+
+    public ServerWrapper(EndpointDescription desc, Server server) {
+        this.desc = desc;
+        this.server = server;
+    }
+    
+    public Server getServer() {
+        return this.server;
+    }
+
+    @Override
+    public void close() throws IOException {
+        this.server.destroy();
+    }
+
+    @Override
+    public EndpointDescription description() {
+        return this.desc;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandler.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandler.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandler.java
new file mode 100644
index 0000000..6171a53
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandler.java
@@ -0,0 +1,100 @@
+/**
+ * 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.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.osgi.framework.ServiceException;
+
+public class ServiceInvocationHandler implements InvocationHandler {
+
+    private static final String REMOTE_EXCEPTION_TYPE = "REMOTE";
+    private static final Collection<Method> OBJECT_METHODS = Arrays.asList(Object.class.getMethods());
+
+    private Map<Method, List<Class<?>>> exceptionsMap = new HashMap<Method, List<Class<?>>>();
+    private Object serviceObject;
+
+    public ServiceInvocationHandler(Object serviceObject, Class<?> iType) {
+        this.serviceObject = serviceObject;
+        introspectType(iType);
+    }
+
+    public Object invoke(Object proxy, final Method m, Object[] params) throws Throwable {
+        if (OBJECT_METHODS.contains(m)) {
+            if (m.getName().equals("equals")) {
+                params = new Object[] {Proxy.getInvocationHandler(params[0])};
+            }
+            return m.invoke(this, params);
+        }
+
+        ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+        try {
+            Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+            final Object[] paramsFinal = params;
+            return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
+                public Object run() throws Exception {
+                    return m.invoke(serviceObject, paramsFinal);
+                }
+            });
+        } catch (Throwable ex) {
+            Throwable theCause = ex.getCause() == null ? ex : ex.getCause();
+            Throwable theCauseCause = theCause.getCause() == null ? theCause : theCause.getCause();
+            List<Class<?>> excTypes = exceptionsMap.get(m);
+            if (excTypes != null) {
+                for (Class<?> type : excTypes) {
+                    if (type.isAssignableFrom(theCause.getClass())) {
+                        throw theCause;
+                    }
+                    if (type.isAssignableFrom(theCauseCause.getClass())) {
+                        throw theCauseCause;
+                    }
+                }
+            }
+
+            throw new ServiceException(REMOTE_EXCEPTION_TYPE, theCause);
+        } finally {
+            Thread.currentThread().setContextClassLoader(oldCl);
+        }
+    }
+
+    private void introspectType(Class<?> iType) {
+        for (Method m : iType.getDeclaredMethods()) {
+            for (Class<?> excType : m.getExceptionTypes()) {
+                if (Exception.class.isAssignableFrom(excType)) {
+                    List<Class<?>> types = exceptionsMap.get(m);
+                    if (types == null) {
+                        types = new ArrayList<Class<?>>();
+                        exceptionsMap.put(m, types);
+                    }
+                    types.add(excType);
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java
new file mode 100644
index 0000000..5bf16d7
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java
@@ -0,0 +1,160 @@
+/**
+ * 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.net.MalformedURLException;
+import java.net.URL;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import org.apache.aries.rsa.spi.Endpoint;
+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.qos.IntentManager;
+import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
+import org.apache.cxf.jaxb.JAXBDataBinding;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WsdlConfigurationTypeHandler extends AbstractPojoConfigurationTypeHandler {
+
+    private static final Logger LOG = LoggerFactory.getLogger(WsdlConfigurationTypeHandler.class);
+
+    public WsdlConfigurationTypeHandler(BundleContext dswBC,
+                                        IntentManager intentManager,
+                                        HttpServiceManager httpServiceManager) {
+        super(dswBC, intentManager, httpServiceManager);
+    }
+
+    public String[] getSupportedTypes() {
+        return new String[] {Constants.WSDL_CONFIG_TYPE};
+    }
+
+    @SuppressWarnings("rawtypes")
+    public Object importEndpoint(ClassLoader consumerLoader,
+                                 BundleContext consumerContext,
+                                 Class[] interfaces,
+                                 EndpointDescription endpoint) {
+        Class<?> iClass = interfaces[0];
+        String wsdlAddressProp = getWsdlAddress(endpoint, iClass);
+        if (wsdlAddressProp == null) {
+            LOG.warn("WSDL address is unavailable");
+            return null;
+        }
+
+        URL wsdlAddress;
+        try {
+            wsdlAddress = new URL(wsdlAddressProp);
+        } catch (MalformedURLException ex) {
+            LOG.warn("WSDL address is malformed");
+            return null;
+        }
+
+        LOG.info("Creating a " + endpoint.getInterfaces().toArray()[0] + " client, wsdl address is "
+                 + OsgiUtils.getProperty(endpoint, Constants.WSDL_CONFIG_PREFIX));
+
+        String serviceNs = OsgiUtils.getProperty(endpoint, Constants.WSDL_SERVICE_NAMESPACE);
+        if (serviceNs == null) {
+            serviceNs = PackageUtils.getNamespace(PackageUtils.getPackageName(iClass));
+        }
+        String serviceName = OsgiUtils.getProperty(endpoint, Constants.WSDL_SERVICE_NAME);
+        if (serviceName == null) {
+            serviceName = iClass.getSimpleName();
+        }
+        QName serviceQname = getServiceQName(iClass, endpoint.getProperties(),
+                                             Constants.WSDL_SERVICE_NAMESPACE,
+                                             Constants.WSDL_SERVICE_NAME);
+        QName portQname = getPortQName(serviceQname.getNamespaceURI(),
+                endpoint.getProperties(), Constants.WSDL_PORT_NAME);
+        Service service = createWebService(wsdlAddress, serviceQname);
+        Object proxy = getProxy(portQname == null ? service.getPort(iClass) : service.getPort(portQname, iClass),
+                                iClass);
+        // MARC: FIXME!!!! getDistributionProvider().addRemoteService(serviceReference);
+        return proxy;
+    }
+
+    // Isolated so that it can be overridden for test purposes.
+    Service createWebService(URL wsdlAddress, QName serviceQname) {
+        return Service.create(wsdlAddress, serviceQname);
+    }
+
+    @SuppressWarnings("rawtypes")
+    public Endpoint exportService(Object serviceO,
+                                  BundleContext serviceContext,
+                                  Map<String, Object> sd,
+                                  Class[] exportedInterfaces) {
+        Class<?> iClass = exportedInterfaces[0];
+        String location = OsgiUtils.getProperty(sd, Constants.WSDL_LOCATION);
+        if (location == null) {
+            throw new RuntimeException("WSDL location property is unavailable");
+        }
+        URL wsdlURL = serviceContext.getBundle().getResource(location);
+        if (wsdlURL == null) {
+            throw new RuntimeException("WSDL resource at " + location + " is unavailable");
+        }
+
+        String address = getServerAddress(sd, iClass);
+        String contextRoot = getServletContextRoot(sd);
+        if (address == null && contextRoot == null) {
+            throw new RuntimeException("Remote address is unavailable");
+        }
+
+        LOG.info("Creating a " + iClass.getName() + " endpoint from CXF PublishHook, address is " + address);
+
+        DataBinding databinding = new JAXBDataBinding();
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        final Long sid = (Long) sd.get(RemoteConstants.ENDPOINT_SERVICE_ID);
+        Bus bus = createBus(sid, serviceContext, contextRoot);
+        factory.setBus(bus);
+        factory.setServiceClass(iClass);
+        factory.setAddress(address != null ? address : "/");
+        factory.getServiceFactory().setDataBinding(databinding);
+        factory.setServiceBean(serviceO);
+
+        addWsInterceptorsFeaturesProps(factory, serviceContext, sd);
+
+        setWsdlProperties(factory, serviceContext, sd, true);
+
+        String[] intents = intentManager.applyIntents(factory.getFeatures(), factory, sd);
+
+        EndpointDescription epd = createEndpointDesc(sd,
+                                                     new String[]{Constants.WS_CONFIG_TYPE},
+                                                     address, intents);
+        return createServerFromFactory(factory, epd);
+    }
+
+    private String getWsdlAddress(EndpointDescription endpoint, Class<?> iClass) {
+        String address = OsgiUtils.getProperty(endpoint, Constants.WSDL_CONFIG_PREFIX);
+        if (address == null) {
+            address = httpServiceManager.getDefaultAddress(iClass);
+            if (address != null) {
+                address += "?wsdl";
+            }
+        }
+        return address;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/DefaultIntentMapFactory.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/DefaultIntentMapFactory.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/DefaultIntentMapFactory.java
new file mode 100644
index 0000000..7e0dd2e
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/DefaultIntentMapFactory.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.qos;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.cxf.binding.soap.Soap11;
+import org.apache.cxf.binding.soap.Soap12;
+import org.apache.cxf.binding.soap.SoapBindingConfiguration;
+import org.apache.cxf.binding.soap.SoapVersion;
+import org.apache.cxf.feature.LoggingFeature;
+
+public class DefaultIntentMapFactory {
+
+    public Map<String, Object> create() {
+        Map<String, Object> intentMap = new HashMap<String, Object>();
+        intentMap.put("logging", getLoggingFeature());
+        Object soap11 = getSoapBinding(Soap11.getInstance());
+        intentMap.put("SOAP", soap11);
+        intentMap.put("SOAP.1_1", soap11);
+        intentMap.put("SOAP.1_2", getSoapBinding(Soap12.getInstance()));
+        intentMap.put("HTTP", "PROVIDED");
+        return intentMap;
+    }
+
+    private Object getLoggingFeature() {
+        return new LoggingFeature();
+    }
+
+    private Object getSoapBinding(SoapVersion soapVersion) {
+        SoapBindingConfiguration soapBindingConfig = new SoapBindingConfiguration();
+        soapBindingConfig.setVersion(soapVersion);
+        return soapBindingConfig;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManager.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManager.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManager.java
new file mode 100644
index 0000000..ecaf070
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManager.java
@@ -0,0 +1,31 @@
+/**
+ * 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;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cxf.endpoint.AbstractEndpointFactory;
+import org.apache.cxf.feature.Feature;
+
+public interface IntentManager {
+
+    String[] applyIntents(List<Feature> features, AbstractEndpointFactory factory, Map<String, Object> props);
+    void assertAllIntentsSupported(Map<String, Object> serviceProperties);
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImpl.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImpl.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImpl.java
new file mode 100644
index 0000000..e161ef0
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImpl.java
@@ -0,0 +1,155 @@
+/**
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.aries.rsa.spi.IntentUnsatisfiedException;
+import org.apache.cxf.binding.BindingConfiguration;
+import org.apache.cxf.endpoint.AbstractEndpointFactory;
+import org.apache.cxf.feature.Feature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class IntentManagerImpl implements IntentManager {
+
+    static final Logger LOG = LoggerFactory.getLogger(IntentManagerImpl.class);
+    private static final String PROVIDED_INTENT_VALUE = "PROVIDED";
+
+    private final IntentMap intentMap;
+    private final long maxIntentWaitTime;
+
+    public IntentManagerImpl(IntentMap intentMap) {
+        this(intentMap, 0);
+    }
+
+    public IntentManagerImpl(IntentMap intentMap, int maxIntentWaitTime) {
+        this.intentMap = intentMap;
+        this.maxIntentWaitTime = maxIntentWaitTime;
+    }
+
+    public String[] applyIntents(List<Feature> features, AbstractEndpointFactory factory,
+                                 Map<String, Object> props) throws IntentUnsatisfiedException {
+        Set<String> requestedIntents = IntentUtils.getRequestedIntents(props);
+        Set<String> appliedIntents = new HashSet<String>();
+        appliedIntents.addAll(reverseLookup(intentMap, PROVIDED_INTENT_VALUE));
+        boolean bindingApplied = false;
+        for (String intentName : requestedIntents) {
+            bindingApplied |= processIntent(features, factory, intentName, intentMap.get(intentName));
+            appliedIntents.add(intentName);
+        }
+        if (!bindingApplied) {
+            String defaultBindingName = "SOAP";
+            processIntent(features, factory, defaultBindingName, intentMap.get(defaultBindingName));
+            appliedIntents.add(defaultBindingName);
+        }
+        appliedIntents.addAll(addSynonymIntents(appliedIntents, intentMap));
+        return appliedIntents.toArray(new String[appliedIntents.size()]);
+    }
+
+    private boolean processIntent(List<Feature> features, AbstractEndpointFactory factory,
+                                  String intentName, Object intent) throws IntentUnsatisfiedException {
+        if (intent instanceof String) {
+            if (PROVIDED_INTENT_VALUE.equalsIgnoreCase((String) intent)) {
+                return false;
+            }
+        } else if (intent instanceof BindingConfiguration) {
+            BindingConfiguration bindingCfg = (BindingConfiguration)intent;
+            LOG.info("Applying intent: " + intentName + " via binding config: " + bindingCfg);
+            factory.setBindingConfig(bindingCfg);
+            return true;
+        } else if (intent instanceof Feature) {
+            Feature feature = (Feature) intent;
+            LOG.info("Applying intent: " + intentName + " via feature: " + feature);
+            features.add(feature);
+            return false;
+        } else {
+            LOG.info("No mapping for intent: " + intentName);
+            throw new IntentUnsatisfiedException(intentName);
+        }
+        return false;
+    }
+
+    private static Collection<String> addSynonymIntents(Collection<String> appliedIntents,
+                                                 IntentMap map) {
+        // E.g. SOAP and SOAP.1_1 are synonyms
+        List<Object> values = new ArrayList<Object>();
+        for (String key : appliedIntents) {
+            values.add(map.get(key));
+        }
+        return reverseLookup(map, values);
+    }
+
+    private static Collection<String> reverseLookup(IntentMap im, Object obj) {
+        return reverseLookup(im, Collections.singleton(obj));
+    }
+
+    /**
+     * Retrieves all keys whose mapped values are found in the given collection.
+     *
+     * @param im an intent map
+     * @param values a collection of potential values
+     * @return all keys whose mapped values are found in the given collection
+     */
+    private static Collection<String> reverseLookup(IntentMap im, Collection<?> values) {
+        Set<String> intentsFound = new HashSet<String>();
+        for (Map.Entry<String, Object> entry : im.entrySet()) {
+            if (values.contains(entry.getValue())) {
+                intentsFound.add(entry.getKey());
+            }
+        }
+        return intentsFound;
+    }
+
+    public void assertAllIntentsSupported(Map<String, Object> serviceProperties) {
+        long endTime = System.currentTimeMillis() + maxIntentWaitTime;
+        Set<String> requiredIntents = IntentUtils.getRequestedIntents(serviceProperties);
+        List<String> unsupportedIntents = new ArrayList<String>();
+        do {
+            unsupportedIntents.clear();
+            for (String ri : requiredIntents) {
+                if (!intentMap.containsKey(ri)) {
+                    unsupportedIntents.add(ri);
+                }
+            }
+            long remainingSeconds = (endTime - System.currentTimeMillis()) / 1000;
+            if (!unsupportedIntents.isEmpty() && remainingSeconds > 0) {
+                LOG.debug("Waiting for custom intents " + unsupportedIntents + " timeout in " + remainingSeconds);
+                try {
+                    synchronized (intentMap) {
+                        intentMap.wait(1000);
+                    }
+                } catch (InterruptedException e) {
+                    LOG.warn(e.getMessage(), e);
+                }
+            }
+        } while (!unsupportedIntents.isEmpty() && System.currentTimeMillis() < endTime);
+
+        if (!unsupportedIntents.isEmpty()) {
+            throw new RuntimeException("service cannot be exported because the following "
+                                       + "intents are not supported by this RSA: " + unsupportedIntents);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentMap.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentMap.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentMap.java
new file mode 100644
index 0000000..5ed4ef6
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentMap.java
@@ -0,0 +1,62 @@
+/**
+ * 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;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Maps intent names to intent objects
+ * An intent object can be a Feature, a BindingConfiguration or a String
+ *
+ * Also supports a default intent map. Custom intents can override the defaults
+ */
+public class IntentMap extends ConcurrentHashMap<String, Object> {
+
+    private static final long serialVersionUID = 2606460607920520767L;
+    private Map<String, Object> defaultMap;
+
+    public IntentMap() {
+        this(new HashMap<String, Object>());
+    }
+
+    public IntentMap(Map<String, Object> defaultMap) {
+        this.defaultMap = defaultMap;
+        putAll(defaultMap);
+    }
+
+    @Override
+    public Object put(String key, Object value) {
+        Object result = super.put(key, value);
+        synchronized (this) {
+            notifyAll();
+        }
+        return result;
+    }
+
+    @Override
+    public Object remove(Object key) {
+        Object old = super.remove(key);
+        if (defaultMap.containsKey(key)) {
+            put((String)key, defaultMap.get(key));
+        }
+        return old;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentTracker.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentTracker.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentTracker.java
new file mode 100644
index 0000000..e1ceaaa
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentTracker.java
@@ -0,0 +1,62 @@
+/**
+ * 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;
+
+import org.apache.cxf.dosgi.dsw.Constants;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTracker;
+
+@SuppressWarnings({"rawtypes", "unchecked"})
+public class IntentTracker extends ServiceTracker {
+
+    private final IntentMap intentMap;
+
+    
+    public IntentTracker(BundleContext context, IntentMap intentMap) {
+        super(context, getFilter(context), null);
+        this.intentMap = intentMap;
+    }
+
+    static Filter getFilter(BundleContext context) {
+        try {
+            return context.createFilter("(" + Constants.INTENT_NAME_PROP + "=*)");
+        } catch (InvalidSyntaxException e) {
+            throw new RuntimeException(e.getMessage(), e);
+        }
+    }
+
+    @Override
+    public Object addingService(ServiceReference reference) {
+        String intentName = (String) reference.getProperty(Constants.INTENT_NAME_PROP);
+        Object intent = super.addingService(reference);
+        IntentManagerImpl.LOG.info("Adding custom intent " + intentName);
+        intentMap.put(intentName, intent);
+        return intent;
+    }
+
+    @Override
+    public void removedService(ServiceReference reference, Object service) {
+        String intentName = (String) reference.getProperty(Constants.INTENT_NAME_PROP);
+        intentMap.remove(intentName);
+        super.removedService(reference, service);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java
new file mode 100644
index 0000000..31b1e42
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java
@@ -0,0 +1,86 @@
+/**
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.cxf.dosgi.dsw.Constants;
+import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
+
+public final class IntentUtils {
+
+    private IntentUtils() {
+        // never constructed
+    }
+
+    public static String[] mergeArrays(String[] a1, String[] a2) {
+        if (a1 == null) {
+            return a2;
+        }
+        if (a2 == null) {
+            return a1;
+        }
+
+        List<String> list = new ArrayList<String>(a1.length + a2.length);
+        Collections.addAll(list, a1);
+        for (String s : a2) {
+            if (!list.contains(s)) {
+                list.add(s);
+            }
+        }
+
+        return list.toArray(new String[list.size()]);
+    }
+
+    public static Set<String> getRequestedIntents(Map<String, Object> sd) {
+        Collection<String> intents = OsgiUtils.getMultiValueProperty(sd.get(RemoteConstants.SERVICE_EXPORTED_INTENTS));
+        Collection<String> intents2
+            = OsgiUtils.getMultiValueProperty(sd.get(RemoteConstants.SERVICE_EXPORTED_INTENTS_EXTRA));
+        @SuppressWarnings("deprecation")
+        Collection<String> oldIntents = OsgiUtils.getMultiValueProperty(sd.get(Constants.EXPORTED_INTENTS_OLD));
+        Set<String> allIntents = new HashSet<String>();
+        if (intents != null) {
+            allIntents.addAll(parseIntents(intents));
+        }
+        if (intents2 != null) {
+            allIntents.addAll(parseIntents(intents2));
+        }
+        if (oldIntents != null) {
+            allIntents.addAll(parseIntents(oldIntents));
+        }
+
+        return allIntents;
+    }
+
+    private static Collection<String> parseIntents(Collection<String> intents) {
+        List<String> parsed = new ArrayList<String>();
+        for (String intent : intents) {
+            parsed.addAll(Arrays.asList(intent.split("[ ]")));
+        }
+        return parsed;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java
new file mode 100644
index 0000000..9acd0f0
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java
@@ -0,0 +1,132 @@
+/**
+ * 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.util;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.ExportedPackage;
+import org.osgi.service.packageadmin.PackageAdmin;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("deprecation")
+public final class OsgiUtils {
+
+    public static final Logger LOG = LoggerFactory.getLogger(OsgiUtils.class);
+
+    private OsgiUtils() {
+    }
+
+    public static boolean getBooleanProperty(Map<String, Object> sd, String name) {
+        return toBoolean(sd.get(name));
+    }
+
+    public static boolean toBoolean(Object value) {
+        return value instanceof Boolean && (Boolean) value
+            || value instanceof String && Boolean.parseBoolean((String)value);
+    }
+
+    @SuppressWarnings("unchecked")
+    public static Collection<String> getMultiValueProperty(Object property) {
+        if (property == null) {
+            return null;
+        } else if (property instanceof Collection) {
+            return (Collection<String>)property;
+        } else if (property instanceof String[]) {
+            return Arrays.asList((String[])property);
+        } else {
+            return Collections.singleton(property.toString());
+        }
+    }
+
+    public static String getProperty(EndpointDescription endpoint, String name) {
+        return getProperty(endpoint.getProperties(), name);
+    }
+
+    public static String getProperty(Map<String, Object> dict, String name) {
+        Object value = dict.get(name);
+        return value instanceof String ? (String) value : null;
+    }
+
+    public static String getFirstNonEmptyStringProperty(Map<String, Object> dict, String ... keys) {
+        for (String key : keys) {
+            String value = getProperty(dict, key);
+            if (value != null) {
+                return value;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Tries to retrieve the version of iClass via the PackageAdmin.
+     *
+     * @param iClass tThe interface for which the version should be found
+     * @param bc any valid BundleContext
+     * @return the version of the interface or "0.0.0" if no version information could be found or an error
+     *         occurred during the retrieval
+     */
+    public static String getVersion(Class<?> iClass, BundleContext bc) {
+        ServiceReference<PackageAdmin> paRef = bc.getServiceReference(PackageAdmin.class);
+        if (paRef != null) {
+            PackageAdmin pa = bc.getService(paRef);
+            try {
+                Bundle b = pa.getBundle(iClass);
+                if (b == null) {
+                    LOG.info("Unable to find interface version for interface " + iClass.getName()
+                            + ". Falling back to 0.0.0");
+                    return "0.0.0";
+                }
+                LOG.debug("Interface source bundle: {}", b.getSymbolicName());
+
+                ExportedPackage[] ep = pa.getExportedPackages(b);
+                LOG.debug("Exported Packages of the source bundle: {}", (Object)ep);
+
+                String pack = iClass.getPackage().getName();
+                LOG.debug("Looking for Package: {}", pack);
+                if (ep != null) {
+                    for (ExportedPackage p : ep) {
+                        if (p != null
+                            && pack.equals(p.getName())) {
+                            LOG.debug("found package -> Version: {}", p.getVersion());
+                            return p.getVersion().toString();
+                        }
+                    }
+                }
+            } finally {
+                if (pa != null) {
+                    bc.ungetService(paRef);
+                }
+            }
+        } else {
+            LOG.error("Was unable to obtain the package admin service -> can't resolve interface versions");
+        }
+
+        LOG.info("Unable to find interface version for interface " + iClass.getName()
+                 + ". Falling back to 0.0.0");
+        return "0.0.0";
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/StringPlus.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/StringPlus.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/StringPlus.java
new file mode 100644
index 0000000..dbb4cda
--- /dev/null
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/StringPlus.java
@@ -0,0 +1,72 @@
+/**
+ * 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.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public final class StringPlus {
+
+    private static final Logger LOG = LoggerFactory.getLogger(StringPlus.class);
+
+    private StringPlus() {
+        // never constructed
+    }
+
+    @SuppressWarnings("rawtypes")
+    public static String[] normalize(Object object) {
+        if (object instanceof String) {
+            String s = (String)object;
+            String[] values = s.split(",");
+            List<String> list = new ArrayList<String>();
+            for (String val : values) {
+                String actualValue = val.trim();
+                if (!actualValue.isEmpty()) {
+                    list.add(actualValue);
+                }
+            }
+            return list.toArray(new String[list.size()]);
+        }
+
+        if (object instanceof String[]) {
+            return (String[])object;
+        }
+        
+        if (object instanceof Collection) {
+            Collection col = (Collection)object;
+            List<String> ar = new ArrayList<String>(col.size());
+            for (Object o : col) {
+                if (o instanceof String) {
+                    String s = (String)o;
+                    ar.add(s);
+                } else {
+                    LOG.warn("stringPlus contained non string element in list! Element was skipped");
+                }
+            }
+            return ar.toArray(new String[ar.size()]);
+        }
+
+        return null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/resources/service-decoration.xsd
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/resources/service-decoration.xsd b/cxf-dsw/src/main/resources/service-decoration.xsd
new file mode 100644
index 0000000..66e8d30
--- /dev/null
+++ b/cxf-dsw/src/main/resources/service-decoration.xsd
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<schema targetNamespace="http://cxf.apache.org/xmlns/service-decoration/1.0.0" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://cxf.apache.org/xmlns/service-decoration/1.0.0">
+    <element name="service-decorations" type="tns:ServiceDecorationsType"></element>
+
+    <complexType name="ServiceDecorationsType">
+        <sequence>
+            <element maxOccurs="unbounded" minOccurs="0"
+                ref="tns:service-decoration">
+            </element>
+        </sequence>
+    </complexType>
+
+    <complexType name="ServiceDecorationType">
+        <sequence>
+            <element maxOccurs="unbounded" minOccurs="0"
+                ref="tns:match">
+            </element>
+        </sequence>
+    </complexType>
+
+    <complexType name="MatchType">
+        <sequence>
+            <element maxOccurs="unbounded" minOccurs="0"
+                ref="tns:match-property">
+            </element>
+            <element maxOccurs="unbounded" minOccurs="0"
+                ref="tns:add-property">
+            </element>
+        </sequence>
+        <attribute name="interface" type="string"></attribute>
+    </complexType>
+
+    <complexType name="MatchPropertyType">
+        <attribute name="name" type="string"></attribute>
+        <attribute name="value" type="string"></attribute>
+    </complexType>
+
+    <complexType name="AddPropertyType">
+        <attribute name="name" type="string"></attribute>
+        <attribute name="value" type="string"></attribute>
+        <attribute name="type" type="string"></attribute>
+    </complexType>
+    <element name="service-decoration"
+        type="tns:ServiceDecorationType">
+    </element>
+    <element name="match" type="tns:MatchType"></element>
+    <element name="match-property" type="tns:MatchPropertyType"></element>
+    <element name="add-property" type="tns:AddPropertyType"></element>
+</schema>
\ No newline at end of file


[11/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

Posted by cs...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/resources/test-resources/sd.xml
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/resources/test-resources/sd.xml b/cxf-dsw/src/test/resources/test-resources/sd.xml
new file mode 100644
index 0000000..c7cebfb
--- /dev/null
+++ b/cxf-dsw/src/test/resources/test-resources/sd.xml
@@ -0,0 +1,8 @@
+<service-decorations xmlns="http://cxf.apache.org/xmlns/service-decoration/1.0.0">
+  <service-decoration>
+    <match interface="org.acme.foo.*">
+      <match-property name="test.prop" value="xyz"/>
+      <add-property name="test.too" value="ahaha" type="java.lang.String"/>
+    </match>
+  </service-decoration>
+</service-decorations>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/resources/test-resources/sd0.xml
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/resources/test-resources/sd0.xml b/cxf-dsw/src/test/resources/test-resources/sd0.xml
new file mode 100644
index 0000000..0ad0ad1
--- /dev/null
+++ b/cxf-dsw/src/test/resources/test-resources/sd0.xml
@@ -0,0 +1,2 @@
+<service-decorations xmlns="http://cxf.apache.org/xmlns/service-decoration/1.0.0">
+</service-decorations>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/resources/test-resources/sd1.xml
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/resources/test-resources/sd1.xml b/cxf-dsw/src/test/resources/test-resources/sd1.xml
new file mode 100644
index 0000000..6a5e811
--- /dev/null
+++ b/cxf-dsw/src/test/resources/test-resources/sd1.xml
@@ -0,0 +1,8 @@
+<service-decorations xmlns="http://cxf.apache.org/xmlns/service-decoration/1.0.0">
+  <service-decoration>
+    <match interface="org.test.A">
+      <add-property name="A" value="B"/>
+      <add-property name="C" value="2" type="java.lang.Integer"/>
+    </match>
+  </service-decoration>
+</service-decorations>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/resources/test-resources/sd2.xml
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/resources/test-resources/sd2.xml b/cxf-dsw/src/test/resources/test-resources/sd2.xml
new file mode 100644
index 0000000..fb6a93a
--- /dev/null
+++ b/cxf-dsw/src/test/resources/test-resources/sd2.xml
@@ -0,0 +1,14 @@
+<service-decorations xmlns="http://cxf.apache.org/xmlns/service-decoration/1.0.0">
+  <service-decoration>
+    <match interface="org.test.(B|C)">
+      <match-property name="x" value="y"/>
+      <add-property name="bool" value="true" type="java.lang.Boolean"/>
+    </match>
+  </service-decoration>
+  <service-decoration>
+    <match interface="org.test.(B|C)">
+      <match-property name="x" value="z"/>
+      <add-property name="bool" value="false" type="java.lang.Boolean"/>
+    </match>
+  </service-decoration>
+</service-decorations>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/cxf-discovery/pom.xml
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/pom.xml b/discovery/distributed/cxf-discovery/pom.xml
deleted file mode 100644
index b34a1db..0000000
--- a/discovery/distributed/cxf-discovery/pom.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-<?xml version='1.0' encoding='UTF-8' ?>
-<!--
-  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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>cxf-dosgi-ri-discovery-distributed</artifactId>
-    <packaging>bundle</packaging>
-    <name>CXF DOSGi ZooKeeper-based Discovery Service Bundle</name>
-    <description>An implementation of the Distributed OSGi Discovery Service using ZooKeeper</description>
-
-    <parent>
-        <groupId>org.apache.cxf.dosgi</groupId>
-        <artifactId>cxf-dosgi-ri-parent</artifactId>
-        <version>1.8-SNAPSHOT</version>
-        <relativePath>../../../parent/pom.xml</relativePath>
-    </parent>
-
-    <properties>
-        <topDirectoryLocation>../../..</topDirectoryLocation>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.zookeeper</groupId>
-            <artifactId>zookeeper</artifactId>
-            <version>${zookeeper.version}</version>
-            <scope>provided</scope>
-            <exclusions>
-                <exclusion>
-                    <groupId>com.sun.jdmk</groupId>
-                    <artifactId>jmxtools</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>com.sun.jmx</groupId>
-                    <artifactId>jmxri</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>log4j</groupId>
-                    <artifactId>log4j</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-
-        <!--  We need the newer log4j as the one from zookeeper has some ugly dependencies -->
-        <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
-            <version>${log4j.version}</version>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.cxf.dosgi</groupId>
-            <artifactId>cxf-dosgi-ri-discovery-local</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.easymock</groupId>
-            <artifactId>easymockclassextension</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <configuration>
-                    <instructions>
-                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
-                        <Bundle-Activator>org.apache.cxf.dosgi.discovery.zookeeper.Activator</Bundle-Activator>
-                        <Export-Package>
-                            !*
-                        </Export-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-</project>

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/Activator.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/Activator.java b/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/Activator.java
deleted file mode 100644
index cbbea58..0000000
--- a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/Activator.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.discovery.zookeeper;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.service.cm.ManagedService;
-
-public class Activator implements BundleActivator {
-
-    private ZooKeeperDiscovery zkd;
-
-    public synchronized void start(BundleContext bc) throws Exception {
-        zkd = new ZooKeeperDiscovery(bc);
-        Dictionary<String, String> props = new Hashtable<String, String>();
-        props.put(Constants.SERVICE_PID, "org.apache.cxf.dosgi.discovery.zookeeper");
-        bc.registerService(ManagedService.class.getName(), zkd, props);
-    }
-
-    public synchronized void stop(BundleContext bc) throws Exception {
-        zkd.stop(true);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/ZooKeeperDiscovery.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/ZooKeeperDiscovery.java b/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/ZooKeeperDiscovery.java
deleted file mode 100644
index 33e2da4..0000000
--- a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/ZooKeeperDiscovery.java
+++ /dev/null
@@ -1,164 +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.discovery.zookeeper;
-
-import java.io.IOException;
-import java.util.Dictionary;
-
-import org.apache.cxf.dosgi.discovery.zookeeper.publish.PublishingEndpointListenerFactory;
-import org.apache.cxf.dosgi.discovery.zookeeper.subscribe.EndpointListenerTracker;
-import org.apache.cxf.dosgi.discovery.zookeeper.subscribe.InterfaceMonitorManager;
-import org.apache.cxf.dosgi.discovery.zookeeper.util.Utils;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.ZooKeeper;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.cm.ConfigurationException;
-import org.osgi.service.cm.ManagedService;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-import org.osgi.util.tracker.ServiceTracker;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ZooKeeperDiscovery implements Watcher, ManagedService {
-
-    public static final String DISCOVERY_ZOOKEEPER_ID = "org.apache.cxf.dosgi.discovery.zookeeper";
-
-    private static final Logger LOG = LoggerFactory.getLogger(ZooKeeperDiscovery.class);
-
-    private final BundleContext bctx;
-
-    private PublishingEndpointListenerFactory endpointListenerFactory;
-    private ServiceTracker<EndpointListener, EndpointListener> endpointListenerTracker;
-    private InterfaceMonitorManager imManager;
-    private ZooKeeper zk;
-    private boolean closed;
-    private boolean started;
-
-    private Dictionary<String, ?> curConfiguration;
-
-    public ZooKeeperDiscovery(BundleContext bctx) {
-        this.bctx = bctx;
-    }
-
-    private void setDefaults(Dictionary<String, String> configuration) {
-        Utils.setDefault(configuration, "zookeeper.host", "localhost");
-        Utils.setDefault(configuration, "zookeeper.port", "2181");
-        Utils.setDefault(configuration, "zookeeper.timeout", "3000");
-    }
-
-    @SuppressWarnings("unchecked")
-    public synchronized void updated(Dictionary<String, ?> configuration) throws ConfigurationException {
-        LOG.debug("Received configuration update for Zookeeper Discovery: {}", configuration);
-        if (configuration != null) {
-            setDefaults((Dictionary<String, String>)configuration);
-        }
-        // make changes only if config actually changed, to prevent unnecessary ZooKeeper reconnections
-        if (!Utils.toMap(configuration).equals(Utils.toMap(curConfiguration))) {
-            stop(false);
-            curConfiguration = configuration;
-            // config is null if it doesn't exist, is being deleted or has not yet been loaded
-            // in which case we just stop running
-            if (configuration != null) {
-                createZooKeeper(configuration);
-            }
-        }
-    }
-
-    private synchronized void start() {
-        if (closed) {
-            return;
-        }
-        if (started) {
-            // we must be re-entrant, i.e. can be called when already started
-            LOG.debug("ZookeeperDiscovery already started");
-            return;
-        }
-        LOG.debug("starting ZookeeperDiscovery");
-        endpointListenerFactory = new PublishingEndpointListenerFactory(zk, bctx);
-        endpointListenerFactory.start();
-        imManager = new InterfaceMonitorManager(bctx, zk);
-        endpointListenerTracker = new EndpointListenerTracker(bctx, imManager);
-        endpointListenerTracker.open();
-        started = true;
-    }
-
-    public synchronized void stop(boolean close) {
-        if (started) {
-            LOG.debug("stopping ZookeeperDiscovery");
-        }
-        started = false;
-        closed |= close;
-        if (endpointListenerFactory != null) {
-            endpointListenerFactory.stop();
-        }
-        if (endpointListenerTracker != null) {
-            endpointListenerTracker.close();
-        }
-        if (imManager != null) {
-            imManager.close();
-        }
-        if (zk != null) {
-            try {
-                zk.close();
-            } catch (InterruptedException e) {
-                LOG.error("Error closing ZooKeeper", e);
-            }
-        }
-    }
-
-    private synchronized void createZooKeeper(Dictionary<String, ?> configuration) {
-        if (closed) {
-            return;
-        }
-        String host = configuration.get("zookeeper.host").toString();
-        String port = configuration.get("zookeeper.port").toString();
-        int timeout = Integer.parseInt(configuration.get("zookeeper.timeout").toString());
-        LOG.debug("ZooKeeper configuration: connecting to {}:{} with timeout {}",
-                new Object[]{host, port, timeout});
-        try {
-            zk = new ZooKeeper(host + ":" + port, timeout, this);
-        } catch (IOException e) {
-            LOG.error("Failed to start the ZooKeeper Discovery component.", e);
-        }
-    }
-
-    /* Callback for ZooKeeper */
-    public void process(WatchedEvent event) {
-        LOG.debug("got ZooKeeper event " + event);
-        switch (event.getState()) {
-        case SyncConnected:
-            LOG.info("Connection to ZooKeeper established");
-            // this event can be triggered more than once in a row (e.g. after Disconnected event),
-            // so we must be re-entrant here
-            start();
-            break;
-
-        case Expired:
-            LOG.info("Connection to ZooKeeper expired. Trying to create a new connection");
-            stop(false);
-            createZooKeeper(curConfiguration);
-            break;
-
-        default:
-            // ignore other events
-            break;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/DiscoveryPlugin.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/DiscoveryPlugin.java b/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/DiscoveryPlugin.java
deleted file mode 100644
index 5d46585..0000000
--- a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/DiscoveryPlugin.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.discovery.zookeeper.publish;
-
-import java.util.Map;
-
-/**
- * This interface allows transformation of service registration information before it is pushed into the ZooKeeper
- * discovery system.
- * It can be useful for situations where a host name or port number needs to be changed in cases where the host running
- * the service is known differently from the outside to what the local Java process thinks it is.
- * Extra service properties can also be added to the registration which can be useful to refine the remote service
- * lookup process. <p/>
- *
- * DiscoveryPlugins use the OSGi WhiteBoard pattern. To add one to the system, register an instance under this interface
- * with the OSGi Service Registry. All registered DiscoveryPlugin instances are visited and given a chance to
- * process the information before it is pushed into ZooKeeper. <p/>
- *
- * Note that the changes made using this plugin do not modify the local service registration.
- *
- */
-public interface DiscoveryPlugin {
-
-    /**
-     * Process service registration information. Plugins can change this information before it is published into the
-     * ZooKeeper discovery system.
-     *
-     * @param mutableProperties A map of service registration properties. The map is mutable and any changes to the map
-     * will be reflected in the ZooKeeper registration.
-     * @param endpointKey The key under which the service is registered in ZooKeeper. This key typically has the
-     * following format: hostname#port##context. While the actual value of this key is not actually used by the
-     * system (people can use it as a hint to understand where the service is located), the value <i>must</i> be
-     * unique for all services of a given type.
-     * @return The <tt>endpointKey</tt> value to be used. If there is no need to change this simply return the value
-     * of the <tt>endpointKey</tt> parameter.
-     */
-    String process(Map<String, Object> mutableProperties, String endpointKey);
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListener.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListener.java b/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListener.java
deleted file mode 100644
index c703b9f..0000000
--- a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListener.java
+++ /dev/null
@@ -1,216 +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.discovery.zookeeper.publish;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cxf.dosgi.discovery.zookeeper.util.Utils;
-import org.apache.cxf.dosgi.endpointdesc.EndpointDescriptionParser;
-import org.apache.cxf.dosgi.endpointdesc.PropertiesMapper;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.KeeperException.NoNodeException;
-import org.apache.zookeeper.KeeperException.NodeExistsException;
-import org.apache.zookeeper.ZooDefs.Ids;
-import org.apache.zookeeper.ZooKeeper;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.xmlns.rsa.v1_0.EndpointDescriptionType;
-import org.osgi.xmlns.rsa.v1_0.PropertyType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Listens for local Endpoints and publishes them to ZooKeeper.
- */
-public class PublishingEndpointListener implements EndpointListener {
-
-    private static final Logger LOG = LoggerFactory.getLogger(PublishingEndpointListener.class);
-
-    private final ZooKeeper zk;
-    private final ServiceTracker<DiscoveryPlugin, DiscoveryPlugin> discoveryPluginTracker;
-    private final List<EndpointDescription> endpoints = new ArrayList<EndpointDescription>();
-    private boolean closed;
-
-    private final EndpointDescriptionParser endpointDescriptionParser;
-
-    public PublishingEndpointListener(ZooKeeper zk, BundleContext bctx) {
-        this.zk = zk;
-        discoveryPluginTracker = new ServiceTracker<DiscoveryPlugin, DiscoveryPlugin>(bctx, 
-            DiscoveryPlugin.class, null);
-        discoveryPluginTracker.open();
-        endpointDescriptionParser = new EndpointDescriptionParser();
-    }
-
-    public void endpointAdded(EndpointDescription endpoint, String matchedFilter) {
-        LOG.info("Local EndpointDescription added: {}", endpoint);
-
-        synchronized (endpoints) {
-            if (closed) {
-                return;
-            }
-            if (endpoints.contains(endpoint)) {
-                // TODO -> Should the published endpoint be updated here?
-                return;
-            }
-
-            try {
-                addEndpoint(endpoint);
-                endpoints.add(endpoint);
-            } catch (Exception ex) {
-                LOG.error("Exception while processing the addition of an endpoint.", ex);
-            }
-        }
-    }
-
-    private void addEndpoint(EndpointDescription endpoint) throws URISyntaxException, KeeperException,
-                                                                  InterruptedException, IOException {
-        Collection<String> interfaces = endpoint.getInterfaces();
-        String endpointKey = getKey(endpoint.getId());
-        Map<String, Object> props = new HashMap<String, Object>(endpoint.getProperties());
-
-        // process plugins
-        Object[] plugins = discoveryPluginTracker.getServices();
-        if (plugins != null) {
-            for (Object plugin : plugins) {
-                if (plugin instanceof DiscoveryPlugin) {
-                    endpointKey = ((DiscoveryPlugin)plugin).process(props, endpointKey);
-                }
-            }
-        }
-
-        for (String name : interfaces) {
-            String path = Utils.getZooKeeperPath(name);
-            String fullPath = path + '/' + endpointKey;
-            LOG.debug("Creating ZooKeeper node: {}", fullPath);
-            ensurePath(path, zk);
-            List<PropertyType> propsOut = new PropertiesMapper().fromProps(props);
-            EndpointDescriptionType epd = new EndpointDescriptionType();
-            epd.getProperty().addAll(propsOut);
-            byte[] epData = endpointDescriptionParser.getData(epd);
-            createEphemeralNode(fullPath, epData);
-        }
-    }
-
-    private void createEphemeralNode(String fullPath, byte[] data) throws KeeperException, InterruptedException {
-        try {
-            zk.create(fullPath, data, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
-        } catch (NodeExistsException nee) {
-            // this sometimes happens after a ZooKeeper node dies and the ephemeral node
-            // that belonged to the old session was not yet deleted. We need to make our
-            // session the owner of the node so it won't get deleted automatically -
-            // we do this by deleting and recreating it ourselves.
-            LOG.info("node for endpoint already exists, recreating: {}", fullPath);
-            try {
-                zk.delete(fullPath, -1);
-            } catch (NoNodeException nne) {
-                // it's a race condition, but as long as it got deleted - it's ok
-            }
-            zk.create(fullPath, data, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
-        }
-    }
-
-    public void endpointRemoved(EndpointDescription endpoint, String matchedFilter) {
-        LOG.info("Local EndpointDescription removed: {}", endpoint);
-
-        synchronized (endpoints) {
-            if (closed) {
-                return;
-            }
-            if (!endpoints.contains(endpoint)) {
-                return;
-            }
-
-            try {
-                removeEndpoint(endpoint);
-                endpoints.remove(endpoint);
-            } catch (Exception ex) {
-                LOG.error("Exception while processing the removal of an endpoint", ex);
-            }
-        }
-    }
-
-    private void removeEndpoint(EndpointDescription endpoint) throws UnknownHostException, URISyntaxException {
-        Collection<String> interfaces = endpoint.getInterfaces();
-        String endpointKey = getKey(endpoint.getId());
-
-        for (String name : interfaces) {
-            String path = Utils.getZooKeeperPath(name);
-            String fullPath = path + '/' + endpointKey;
-            LOG.debug("Removing ZooKeeper node: {}", fullPath);
-            try {
-                zk.delete(fullPath, -1);
-            } catch (Exception ex) {
-                LOG.debug("Error while removing endpoint: {}", ex); // e.g. session expired
-            }
-        }
-    }
-
-    private static void ensurePath(String path, ZooKeeper zk) throws KeeperException, InterruptedException {
-        StringBuilder current = new StringBuilder();
-        String[] parts = Utils.removeEmpty(path.split("/"));
-        for (String part : parts) {
-            current.append('/');
-            current.append(part);
-            try {
-                zk.create(current.toString(), new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-            } catch (NodeExistsException nee) {
-                // it's not the first node with this path to ever exist - that's normal
-            }
-        }
-    }
-
-    static String getKey(String endpoint) throws URISyntaxException {
-        URI uri = new URI(endpoint);
-
-        StringBuilder sb = new StringBuilder();
-        sb.append(uri.getHost());
-        sb.append("#");
-        sb.append(uri.getPort());
-        sb.append("#");
-        sb.append(uri.getPath().replace('/', '#'));
-        return sb.toString();
-    }
-
-    public void close() {
-        LOG.debug("closing - removing all endpoints");
-        synchronized (endpoints) {
-            closed = true;
-            for (EndpointDescription endpoint : endpoints) {
-                try {
-                    removeEndpoint(endpoint);
-                } catch (Exception ex) {
-                    LOG.error("Exception while removing endpoint during close", ex);
-                }
-            }
-            endpoints.clear();
-        }
-        discoveryPluginTracker.close();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListenerFactory.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListenerFactory.java b/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListenerFactory.java
deleted file mode 100644
index c505bb4..0000000
--- a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListenerFactory.java
+++ /dev/null
@@ -1,105 +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.discovery.zookeeper.publish;
-
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.List;
-
-import org.apache.cxf.dosgi.discovery.zookeeper.ZooKeeperDiscovery;
-import org.apache.cxf.dosgi.discovery.zookeeper.util.Utils;
-import org.apache.zookeeper.ZooKeeper;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceFactory;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Creates local EndpointListeners that publish to ZooKeeper.
- */
-public class PublishingEndpointListenerFactory implements ServiceFactory<PublishingEndpointListener> {
-
-    private static final Logger LOG = LoggerFactory.getLogger(PublishingEndpointListenerFactory.class);
-
-    private final BundleContext bctx;
-    private final ZooKeeper zk;
-    private final List<PublishingEndpointListener> listeners = new ArrayList<PublishingEndpointListener>();
-    private ServiceRegistration serviceRegistration;
-
-    public PublishingEndpointListenerFactory(ZooKeeper zk, BundleContext bctx) {
-        this.bctx = bctx;
-        this.zk = zk;
-    }
-
-    public PublishingEndpointListener getService(Bundle b, ServiceRegistration<PublishingEndpointListener> sr) {
-        LOG.debug("new EndpointListener from factory");
-        synchronized (listeners) {
-            PublishingEndpointListener pel = new PublishingEndpointListener(zk, bctx);
-            listeners.add(pel);
-            return pel;
-        }
-    }
-
-    public void ungetService(Bundle b, ServiceRegistration<PublishingEndpointListener> sr, 
-                             PublishingEndpointListener pel) {
-        LOG.debug("remove EndpointListener");
-        synchronized (listeners) {
-            if (listeners.remove(pel)) {
-                pel.close();
-            }
-        }
-    }
-
-    public synchronized void start() {
-        Dictionary<String, String> props = new Hashtable<String, String>();
-        props.put(EndpointListener.ENDPOINT_LISTENER_SCOPE,
-                  "(&(" + Constants.OBJECTCLASS + "=*)(" + RemoteConstants.ENDPOINT_FRAMEWORK_UUID
-                  + "=" + Utils.getUUID(bctx) + "))");
-        props.put(ZooKeeperDiscovery.DISCOVERY_ZOOKEEPER_ID, "true");
-        serviceRegistration = bctx.registerService(EndpointListener.class.getName(), this, props);
-    }
-
-    public synchronized void stop() {
-        if (serviceRegistration != null) {
-            serviceRegistration.unregister();
-            serviceRegistration = null;
-        }
-        synchronized (listeners) {
-            for (PublishingEndpointListener pel : listeners) {
-                pel.close();
-            }
-            listeners.clear();
-        }
-    }
-
-    /**
-     * Only for the test case!
-     */
-    protected List<PublishingEndpointListener> getListeners() {
-        synchronized (listeners) {
-            return listeners;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/EndpointListenerTracker.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/EndpointListenerTracker.java b/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/EndpointListenerTracker.java
deleted file mode 100644
index 4d0a25f..0000000
--- a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/EndpointListenerTracker.java
+++ /dev/null
@@ -1,56 +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.discovery.zookeeper.subscribe;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * Tracks interest in EndpointListeners. Delegates to InterfaceMonitorManager to manage
- * interest in the scopes of each EndpointListener.
- */
-public class EndpointListenerTracker extends ServiceTracker<EndpointListener, EndpointListener> {
-    private final InterfaceMonitorManager imManager;
-
-    public EndpointListenerTracker(BundleContext bctx, InterfaceMonitorManager imManager) {
-        super(bctx, EndpointListener.class, null);
-        this.imManager = imManager;
-    }
-
-    @Override
-    public EndpointListener addingService(ServiceReference<EndpointListener> endpointListener) {
-        imManager.addInterest(endpointListener);
-        return null;
-    }
-
-    @Override
-    public void modifiedService(ServiceReference<EndpointListener> endpointListener, EndpointListener service) {
-        // called when an EndpointListener updates its service properties,
-        // e.g. when its interest scope is expanded/reduced
-        imManager.addInterest(endpointListener);
-    }
-
-    @Override
-    public void removedService(ServiceReference<EndpointListener> endpointListener, EndpointListener service) {
-        imManager.removeInterest(endpointListener);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitor.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitor.java b/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitor.java
deleted file mode 100644
index 95277d3..0000000
--- a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitor.java
+++ /dev/null
@@ -1,262 +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.discovery.zookeeper.subscribe;
-
-import java.io.ByteArrayInputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cxf.dosgi.discovery.zookeeper.util.Utils;
-import org.apache.cxf.dosgi.endpointdesc.EndpointDescriptionParser;
-import org.apache.cxf.dosgi.endpointdesc.PropertiesMapper;
-import org.apache.zookeeper.AsyncCallback.StatCallback;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.KeeperException.Code;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.ZooKeeper;
-import org.apache.zookeeper.data.Stat;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-import org.osgi.xmlns.rsa.v1_0.EndpointDescriptionType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Monitors ZooKeeper for changes in published endpoints.
- * <p>
- * Specifically, it monitors the node path associated with a given interface class,
- * whose data is a serialized version of an EndpointDescription, and notifies an
- * EndpointListener when changes are detected (which can then propagate the
- * notification to other EndpointListeners with a matching scope).
- * <p>
- * Note that the EndpointListener is used here as a decoupling interface for
- * convenience, and is not necessarily used according to its documented contract.
- */
-public class InterfaceMonitor implements Watcher, StatCallback {
-
-    private static final Logger LOG = LoggerFactory.getLogger(InterfaceMonitor.class);
-
-    private final String znode;
-    private final ZooKeeper zk;
-    private final EndpointListener endpointListener;
-    private final boolean recursive;
-    private volatile boolean closed;
-
-    // This map reference changes, so don't synchronize on it
-    private Map<String, EndpointDescription> nodes = new HashMap<String, EndpointDescription>();
-
-    private EndpointDescriptionParser parser;
-
-    public InterfaceMonitor(ZooKeeper zk, String objClass, EndpointListener endpointListener, String scope) {
-        this.zk = zk;
-        this.znode = Utils.getZooKeeperPath(objClass);
-        this.recursive = objClass == null || objClass.isEmpty();
-        this.endpointListener = endpointListener;
-        this.parser = new EndpointDescriptionParser();
-        LOG.debug("Creating new InterfaceMonitor {} for scope [{}] and objectClass [{}]",
-                new Object[] {recursive ? "(recursive)" : "", scope, objClass});
-    }
-
-    /**
-     * Returns all endpoints that are currently known to this monitor.
-     *
-     * @return all endpoints that are currently known to this monitor
-     */
-    public synchronized List<EndpointDescription> getEndpoints() {
-        return new ArrayList<EndpointDescription>(nodes.values());
-    }
-
-    public void start() {
-        watch();
-    }
-
-    private void watch() {
-        LOG.debug("registering a ZooKeeper.exists({}) callback", znode);
-        zk.exists(znode, this, this, null);
-    }
-
-    /**
-     * Zookeeper Watcher interface callback.
-     */
-    public void process(WatchedEvent event) {
-        LOG.debug("ZooKeeper watcher callback on node {} for event {}", znode, event);
-        processDelta();
-    }
-
-    /**
-     * Zookeeper StatCallback interface callback.
-     */
-    @SuppressWarnings("deprecation")
-    public void processResult(int rc, String path, Object ctx, Stat stat) {
-        LOG.debug("ZooKeeper callback on node: {} code: {}", znode, rc);
-
-        switch (rc) {
-        case Code.Ok:
-        case Code.NoNode:
-            processDelta();
-            return;
-
-        case Code.SessionExpired:
-        case Code.NoAuth:
-        case Code.ConnectionLoss:
-            return;
-
-        default:
-            watch();
-        }
-    }
-
-    private void processDelta() {
-        if (closed) {
-            return;
-        }
-
-        if (zk.getState() != ZooKeeper.States.CONNECTED) {
-            LOG.debug("ZooKeeper connection was already closed! Not processing changed event.");
-            return;
-        }
-
-        try {
-            if (zk.exists(znode, false) != null) {
-                zk.getChildren(znode, this);
-                refreshNodes();
-            } else {
-                LOG.debug("znode {} doesn't exist -> not processing any changes", znode);
-            }
-        } catch (Exception e) {
-            if (zk.getState() != ZooKeeper.States.CONNECTED) {
-                LOG.debug("Error getting Zookeeper data: " + e); // e.g. session expired, handled by ZooKeeperDiscovery
-            } else {
-                LOG.error("Error getting ZooKeeper data.", e);
-            }
-        }
-    }
-
-    public synchronized void close() {
-        closed = true;
-        for (EndpointDescription endpoint : nodes.values()) {
-            endpointListener.endpointRemoved(endpoint, null);
-        }
-        nodes.clear();
-    }
-
-    private synchronized void refreshNodes() {
-        if (closed) {
-            return;
-        }
-        LOG.info("Processing change on node: {}", znode);
-
-        Map<String, EndpointDescription> newNodes = new HashMap<String, EndpointDescription>();
-        Map<String, EndpointDescription> prevNodes = new HashMap<String, EndpointDescription>(nodes);
-        processChildren(znode, newNodes, prevNodes);
-
-        // whatever is left in prevNodes now has been removed from Discovery
-        LOG.debug("processChildren done. Nodes that are missing now and need to be removed: {}", prevNodes.values());
-        for (EndpointDescription endpoint : prevNodes.values()) {
-            endpointListener.endpointRemoved(endpoint, null);
-        }
-        nodes = newNodes;
-    }
-
-    /**
-     * Iterates through all child nodes of the given node and tries to find
-     * endpoints. If the recursive flag is set it also traverses into the child
-     * nodes.
-     *
-     * @return true if an endpoint was found and if the node therefore needs to
-     *         be monitored for changes
-     */
-    private boolean processChildren(String zn, Map<String, EndpointDescription> newNodes,
-            Map<String, EndpointDescription> prevNodes) {
-        List<String> children;
-        try {
-            LOG.debug("Processing the children of {}", zn);
-            children = zk.getChildren(zn, false);
-
-            boolean foundANode = false;
-            for (String child : children) {
-                String childZNode = zn + '/' + child;
-                EndpointDescription endpoint = getEndpointDescriptionFromNode(childZNode);
-                if (endpoint != null) {
-                    EndpointDescription prevEndpoint = prevNodes.get(child);
-                    LOG.info("found new node " + zn + "/[" + child + "]   ( []->child )  props: "
-                            + endpoint.getProperties().values());
-                    newNodes.put(child, endpoint);
-                    prevNodes.remove(child);
-                    foundANode = true;
-                    LOG.debug("Properties: {}", endpoint.getProperties());
-                    if (prevEndpoint == null) {
-                        // This guy is new
-                        endpointListener.endpointAdded(endpoint, null);
-                    } else if (!prevEndpoint.getProperties().equals(endpoint.getProperties())) {
-                        // TODO
-                    }
-                }
-                if (recursive && processChildren(childZNode, newNodes, prevNodes)) {
-                    zk.getChildren(childZNode, this);
-                }
-            }
-
-            return foundANode;
-        } catch (KeeperException e) {
-            LOG.error("Problem processing ZooKeeper node", e);
-        } catch (InterruptedException e) {
-            LOG.error("Problem processing ZooKeeper node", e);
-        }
-        return false;
-    }
-
-    /**
-     * Retrieves data from the given node and parses it into an EndpointDescription.
-     *
-     * @param node a node path
-     * @return endpoint found in the node or null if no endpoint was found
-     */
-    private EndpointDescription getEndpointDescriptionFromNode(String node) {
-        try {
-            Stat stat = zk.exists(node, false);
-            if (stat == null || stat.getDataLength() <= 0) {
-                return null;
-            }
-            byte[] data = zk.getData(node, false, null);
-            LOG.debug("Got data for node: {}", node);
-
-            EndpointDescription endpoint = getFirstEnpointDescription(data);
-            if (endpoint != null) {
-                return endpoint;
-            }
-            LOG.warn("No Discovery information found for node: {}", node);
-        } catch (Exception e) {
-            LOG.error("Problem getting EndpointDescription from node " + node, e);
-        }
-        return null;
-    }
-
-    public EndpointDescription getFirstEnpointDescription(byte[] data) {
-        List<EndpointDescriptionType> elements = parser.getEndpointDescriptions(new ByteArrayInputStream(data));
-        if (elements.isEmpty()) {
-            return null;
-        }
-        Map<String, Object> props = new PropertiesMapper().toProps(elements.get(0).getProperty());
-        return new EndpointDescription(props);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitorManager.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitorManager.java b/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitorManager.java
deleted file mode 100644
index 240e5ea..0000000
--- a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitorManager.java
+++ /dev/null
@@ -1,218 +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.discovery.zookeeper.subscribe;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.apache.cxf.dosgi.discovery.zookeeper.ZooKeeperDiscovery;
-import org.apache.cxf.dosgi.discovery.zookeeper.util.Utils;
-import org.apache.zookeeper.ZooKeeper;
-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.EndpointListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.apache.cxf.dosgi.discovery.local.util.Utils.matchFilter;
-
-/**
- * Manages the EndpointListeners and the scopes they are interested in.
- * For each scope with interested EndpointListeners an InterfaceMonitor is created.
- * The InterfaceMonitor calls back when it detects added or removed external Endpoints.
- * These events are then forwarded to all interested EndpointListeners.
- */
-public class InterfaceMonitorManager {
-
-    private static final Logger LOG = LoggerFactory.getLogger(InterfaceMonitorManager.class);
-
-    private final BundleContext bctx;
-    private final ZooKeeper zk;
-    // map of EndpointListeners and the scopes they are interested in
-    private final Map<ServiceReference<EndpointListener>, List<String>> endpointListenerScopes =
-            new HashMap<ServiceReference<EndpointListener>, List<String>>();
-    // map of scopes and their interest data
-    private final Map<String, Interest> interests = new HashMap<String, Interest>();
-
-    protected static class Interest {
-        List<ServiceReference<EndpointListener>> endpointListeners = 
-            new CopyOnWriteArrayList<ServiceReference<EndpointListener>>();
-        InterfaceMonitor monitor;
-    }
-
-    public InterfaceMonitorManager(BundleContext bctx, ZooKeeper zk) {
-        this.bctx = bctx;
-        this.zk = zk;
-    }
-
-    public void addInterest(ServiceReference<EndpointListener> endpointListener) {
-        if (isOurOwnEndpointListener(endpointListener)) {
-            LOG.debug("Skipping our own EndpointListener");
-            return;
-        }
-
-        LOG.info("updating EndpointListener interests: {}", endpointListener);
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("updated EndpointListener properties: {}", Utils.getProperties(endpointListener));
-        }
-        for (String scope : Utils.getScopes(endpointListener)) {
-            String objClass = Utils.getObjectClass(scope);
-            LOG.debug("Adding interest in scope {}, objectClass {}", scope, objClass);
-            addInterest(endpointListener, scope, objClass);
-        }
-    }
-
-    private static boolean isOurOwnEndpointListener(ServiceReference<EndpointListener> endpointListener) {
-        return Boolean.parseBoolean(String.valueOf(
-                endpointListener.getProperty(ZooKeeperDiscovery.DISCOVERY_ZOOKEEPER_ID)));
-    }
-
-    @SuppressWarnings("unchecked")
-    public synchronized void addInterest(ServiceReference<EndpointListener> endpointListener, 
-                                         String scope, String objClass) {
-        // get or create interest for given scope and add listener to it
-        Interest interest = interests.get(scope);
-        if (interest == null) {
-            // create interest, add listener and start monitor
-            interest = new Interest();
-            interests.put(scope, interest);
-            interest.endpointListeners.add(endpointListener); // add it before monitor starts so we don't miss events
-            interest.monitor = createInterfaceMonitor(scope, objClass, interest);
-            interest.monitor.start();
-        } else {
-            // interest already exists, so just add listener to it
-            if (!interest.endpointListeners.contains(endpointListener)) {
-                interest.endpointListeners.add(endpointListener);
-            }
-            // notify listener of all known endpoints for given scope
-            // (as EndpointListener contract requires of all added/modified listeners)
-            for (EndpointDescription endpoint : interest.monitor.getEndpoints()) {
-                notifyListeners(endpoint, scope, true, Arrays.asList(endpointListener));
-            }
-        }
-
-        // add scope to listener's scopes list
-        List<String> scopes = endpointListenerScopes.get(endpointListener);
-        if (scopes == null) {
-            scopes = new ArrayList<String>(1);
-            endpointListenerScopes.put(endpointListener, scopes);
-        }
-        if (!scopes.contains(scope)) {
-            scopes.add(scope);
-        }
-    }
-
-    public synchronized void removeInterest(ServiceReference<EndpointListener> endpointListener) {
-        LOG.info("removing EndpointListener interests: {}", endpointListener);
-        List<String> scopes = endpointListenerScopes.get(endpointListener);
-        if (scopes == null) {
-            return;
-        }
-
-        for (String scope : scopes) {
-            Interest interest = interests.get(scope);
-            if (interest != null) {
-                interest.endpointListeners.remove(endpointListener);
-                if (interest.endpointListeners.isEmpty()) {
-                    interest.monitor.close();
-                    interests.remove(scope);
-                }
-            }
-        }
-        endpointListenerScopes.remove(endpointListener);
-    }
-
-    protected InterfaceMonitor createInterfaceMonitor(final String scope, String objClass, final Interest interest) {
-        // holding this object's lock in the callbacks can lead to a deadlock with InterfaceMonitor
-        EndpointListener endpointListener = new EndpointListener() {
-
-            public void endpointRemoved(EndpointDescription endpoint, String matchedFilter) {
-                notifyListeners(endpoint, scope, false, interest.endpointListeners);
-            }
-
-            public void endpointAdded(EndpointDescription endpoint, String matchedFilter) {
-                notifyListeners(endpoint, scope, true, interest.endpointListeners);
-            }
-        };
-        return new InterfaceMonitor(zk, objClass, endpointListener, scope);
-    }
-
-    private void notifyListeners(EndpointDescription endpoint, String currentScope, boolean isAdded,
-            List<ServiceReference<EndpointListener>> endpointListeners) {
-        for (ServiceReference<EndpointListener> endpointListenerRef : endpointListeners) {
-            EndpointListener service = bctx.getService(endpointListenerRef);
-            try {
-                EndpointListener endpointListener = (EndpointListener)service;
-                LOG.trace("matching {} against {}", endpoint, currentScope);
-                if (matchFilter(bctx, currentScope, endpoint)) {
-                    LOG.debug("Matched {} against {}", endpoint, currentScope);
-                    notifyListener(endpoint, currentScope, isAdded, endpointListenerRef.getBundle(),
-                                   endpointListener);
-                }
-            } finally {
-                if (service != null) {
-                    bctx.ungetService(endpointListenerRef);
-                }
-            }
-        }
-    }
-
-    private void notifyListener(EndpointDescription endpoint, String currentScope, boolean isAdded,
-                                Bundle endpointListenerBundle, EndpointListener endpointListener) {
-        if (endpointListenerBundle == null) {
-            LOG.info("listening service was unregistered, ignoring");
-        } else if (isAdded) {
-            LOG.info("calling EndpointListener.endpointAdded: " + endpointListener + " from bundle "
-                    + endpointListenerBundle.getSymbolicName() + " for endpoint: " + endpoint);
-            endpointListener.endpointAdded(endpoint, currentScope);
-        } else {
-            LOG.info("calling EndpointListener.endpointRemoved: " + endpointListener + " from bundle "
-                    + endpointListenerBundle.getSymbolicName() + " for endpoint: " + endpoint);
-            endpointListener.endpointRemoved(endpoint, currentScope);
-        }
-    }
-
-    public synchronized void close() {
-        for (Interest interest : interests.values()) {
-            interest.monitor.close();
-        }
-        interests.clear();
-        endpointListenerScopes.clear();
-    }
-
-    /**
-     * Only for test case!
-     */
-    protected synchronized Map<String, Interest> getInterests() {
-        return interests;
-    }
-
-    /**
-     * Only for test case!
-     */
-    protected synchronized Map<ServiceReference<EndpointListener>, List<String>> getEndpointListenerScopes() {
-        return endpointListenerScopes;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/util/Utils.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/util/Utils.java b/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/util/Utils.java
deleted file mode 100644
index 5fcb111..0000000
--- a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/util/Utils.java
+++ /dev/null
@@ -1,165 +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.discovery.zookeeper.util;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-
-public final class Utils {
-
-    static final String PATH_PREFIX = "/osgi/service_registry";
-    static final Pattern OBJECTCLASS_PATTERN = Pattern.compile(".*\\(objectClass=([^)]+)\\).*");
-
-    private Utils() {
-        // never constructed
-    }
-
-    public static String getZooKeeperPath(String name) {
-        return name == null || name.isEmpty() ? PATH_PREFIX : PATH_PREFIX + '/' + name.replace('.', '/');
-    }
-
-    /**
-     * Returns the value of a "string+" property as an array of strings.
-     * <p>
-     * A "string+" property can have a value which is either a string,
-     * an array of strings, or a collection of strings.
-     * <p>
-     * If the given value is not of one of the valid types, or is null,
-     * an empty array is returned.
-     *
-     * @param property a "string+" property value
-     * @return the property value as an array of strings, or an empty array
-     */
-    public static String[] getStringPlusProperty(Object property) {
-        if (property instanceof String) {
-            return new String[] {(String)property};
-        } else if (property instanceof String[]) {
-            return (String[])property;
-        } else if (property instanceof Collection) {
-            try {
-                @SuppressWarnings("unchecked")
-                Collection<String> strings = (Collection<String>)property;
-                return strings.toArray(new String[strings.size()]);
-            } catch (ArrayStoreException ase) {
-                // ignore collections with wrong type
-            }
-        }
-        return new String[0];
-    }
-
-    /**
-     * Removes nulls and empty strings from the given string array.
-     *
-     * @param strings an array of strings
-     * @return a new array containing the non-null and non-empty
-     *         elements of the original array in the same order
-     */
-    public static String[] removeEmpty(String[] strings) {
-        String[] result = new String[strings.length];
-        int copied = 0;
-        for (String s : strings) {
-            if (s != null && !s.isEmpty()) {
-                result[copied++] = s;
-            }
-        }
-        return copied == result.length ? result : Arrays.copyOf(result, copied);
-    }
-
-    public static String[] getScopes(ServiceReference<?> sref) {
-        return removeEmpty(getStringPlusProperty(sref.getProperty(EndpointListener.ENDPOINT_LISTENER_SCOPE)));
-    }
-
-    // copied from the DSW OSGiUtils class
-    public static String getUUID(BundleContext bc) {
-        synchronized ("org.osgi.framework.uuid") {
-            String uuid = bc.getProperty("org.osgi.framework.uuid");
-            if (uuid == null) {
-                uuid = UUID.randomUUID().toString();
-                System.setProperty("org.osgi.framework.uuid", uuid);
-            }
-            return uuid;
-        }
-    }
-
-    /**
-     * Puts the given key-value pair in the given dictionary if the key does not
-     * already exist in it or if its existing value is null.
-     *
-     * @param dict a dictionary
-     * @param key the key
-     * @param value the default value to set
-     */
-    public static void setDefault(Dictionary<String, String> dict, String key, String value) {
-        if (dict.get(key) == null) {
-            dict.put(key, value);
-        }
-    }
-
-    /**
-     * Converts the given Dictionary to a Map.
-     *
-     * @param dict a dictionary
-     * @param <K> the key type
-     * @param <V> the value type
-     * @return the converted map, or an empty map if the given dictionary is null
-     */
-    public static <K, V> Map<K, V> toMap(Dictionary<K, V> dict) {
-        Map<K, V> map = new HashMap<K, V>();
-        if (dict != null) {
-            Enumeration<K> keys = dict.keys();
-            while (keys.hasMoreElements()) {
-                K key = keys.nextElement();
-                map.put(key, dict.get(key));
-            }
-        }
-        return map;
-    }
-
-    public static String getObjectClass(String scope) {
-        Matcher m = OBJECTCLASS_PATTERN.matcher(scope);
-        return m.matches() ? m.group(1) : null;
-    }
-
-    /**
-     * Returns a service's properties as a map.
-     *
-     * @param serviceReference a service reference
-     * @return the service's properties as a map
-     */
-    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) {
-            Object val = serviceReference.getProperty(key);
-            props.put(key, val);
-        }
-        return props;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/DiscoveryDriverTest.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/DiscoveryDriverTest.java b/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/DiscoveryDriverTest.java
deleted file mode 100644
index 84470c2..0000000
--- a/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/DiscoveryDriverTest.java
+++ /dev/null
@@ -1,135 +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.discovery.zookeeper;
-
-import junit.framework.TestCase;
-
-public class DiscoveryDriverTest extends TestCase {
-
-    public void testDUMMY() {
-        assertTrue(true);
-    }
-
-//    public void testDiscoveryDriver() throws Exception {
-//        BundleContext bc = getDefaultBundleContext();
-//        Dictionary<String, String> props = getDefaultProps();
-//
-//        final StringBuilder sb = new StringBuilder();
-//        DiscoveryDriver dd = new DiscoveryDriver(bc, props) {
-//            @Override
-//            ZooKeeper createZooKeeper() throws IOException {
-//                sb.append(zkHost + ":" + zkPort);
-//                ZooKeeper zk = EasyMock.createMock(ZooKeeper.class);
-//                EasyMock.replay(zk);
-//                return zk;
-//            }
-//        };
-//        EasyMock.verify(bc);
-//        assertEquals("somehost:1910", sb.toString());
-//
-//        EasyMock.verify(dd.zooKeeper);
-//        EasyMock.reset(dd.zooKeeper);
-//        dd.zooKeeper.close();
-//        EasyMock.expectLastCall();
-//        EasyMock.replay(dd.zooKeeper);
-//
-//        ServiceTracker st1 = EasyMock.createMock(ServiceTracker.class);
-//        st1.close();
-//        EasyMock.expectLastCall();
-//        EasyMock.replay(st1);
-//        ServiceTracker st2 = EasyMock.createMock(ServiceTracker.class);
-//        st2.close();
-//        EasyMock.expectLastCall();
-//        EasyMock.replay(st2);
-//
-//        dd.lookupTracker = st1;
-//        dd.publicationTracker = st2;
-//
-//        dd.destroy();
-//    }
-//
-//    private void expectServiceTrackerCalls(BundleContext bc, String objectClass)
-//            throws InvalidSyntaxException {
-//        Filter filter = EasyMock.createNiceMock(Filter.class);
-//        EasyMock.replay(filter);
-//
-//        EasyMock.expect(bc.createFilter("(objectClass=" + objectClass + ")"))
-//            .andReturn(filter).anyTimes();
-//        bc.addServiceListener((ServiceListener) EasyMock.anyObject(),
-//            EasyMock.eq("(objectClass=" + objectClass + ")"));
-//        EasyMock.expectLastCall().anyTimes();
-//        EasyMock.expect(bc.getServiceReferences(objectClass, null))
-//            .andReturn(new ServiceReference [0]).anyTimes();
-//    }
-//
-//    public void testProcessEvent() throws Exception {
-//        DiscoveryDriver db = new DiscoveryDriver(getDefaultBundleContext(), getDefaultProps()) {
-//            @Override
-//            ZooKeeper createZooKeeper() throws IOException {
-//                return null;
-//            }
-//        };
-//
-//        FindInZooKeeperCustomizer fc = new FindInZooKeeperCustomizer(null, null);
-//        List<InterfaceMonitor> l1 = new ArrayList<InterfaceMonitor>();
-//        InterfaceMonitor dm1a = EasyMock.createMock(InterfaceMonitor.class);
-//        dm1a.process();
-//        EasyMock.expectLastCall();
-//        EasyMock.replay(dm1a);
-//        InterfaceMonitor dm1b = EasyMock.createMock(InterfaceMonitor.class);
-//        dm1b.process();
-//        EasyMock.expectLastCall();
-//        EasyMock.replay(dm1b);
-//        l1.add(dm1a);
-//        l1.add(dm1b);
-//
-//        List<InterfaceMonitor> l2 = new ArrayList<InterfaceMonitor>();
-//        InterfaceMonitor dm2 = EasyMock.createMock(InterfaceMonitor.class);
-//        dm2.process();
-//        EasyMock.expectLastCall();
-//        EasyMock.replay(dm2);
-//        l2.add(dm2);
-//
-//        fc.watchers.put(EasyMock.createMock(DiscoveredServiceTracker.class), l1);
-//        fc.watchers.put(EasyMock.createMock(DiscoveredServiceTracker.class), l2);
-//
-//        db.finderCustomizer = fc;
-//        db.process(null);
-//
-//        EasyMock.verify(dm1a);
-//        EasyMock.verify(dm1b);
-//        EasyMock.verify(dm2);
-//    }
-//
-//    private BundleContext getDefaultBundleContext() throws InvalidSyntaxException {
-//        BundleContext bc = EasyMock.createMock(BundleContext.class);
-//        expectServiceTrackerCalls(bc, ServicePublication.class.getName());
-//        expectServiceTrackerCalls(bc, DiscoveredServiceTracker.class.getName());
-//        EasyMock.replay(bc);
-//        return bc;
-//    }
-//
-//    private Dictionary<String, String> getDefaultProps() {
-//        Dictionary<String, String> props = new Hashtable<String, String>();
-//        props.put("zookeeper.host", "somehost");
-//        props.put("zookeeper.port", "1910");
-//        props.put("zookeeper.timeout", "1500");
-//        return props;
-//    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/FindInZooKeeperCustomizerTest.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/FindInZooKeeperCustomizerTest.java b/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/FindInZooKeeperCustomizerTest.java
deleted file mode 100644
index cb2180b..0000000
--- a/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/FindInZooKeeperCustomizerTest.java
+++ /dev/null
@@ -1,301 +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.discovery.zookeeper;
-
-import junit.framework.TestCase;
-
-public class FindInZooKeeperCustomizerTest extends TestCase {
-
-    public void testDUMMY() {
-        assertTrue(true);
-    }
-
-//    public void testAddingServiceInterface() {
-//        DiscoveredServiceTracker dst = new DiscoveredServiceTracker() {
-//            public void serviceChanged(DiscoveredServiceNotification dsn) {}
-//        };
-//
-//        ServiceReference sr = EasyMock.createMock(ServiceReference.class);
-//        EasyMock.expect(sr.getProperty(DiscoveredServiceTracker.INTERFACE_MATCH_CRITERIA))
-//            .andReturn(Collections.singleton(String.class.getName()));
-//        EasyMock.expect(sr.getProperty(DiscoveredServiceTracker.FILTER_MATCH_CRITERIA))
-//            .andReturn(null);
-//        EasyMock.replay(sr);
-//
-//        DiscoveredServiceTracker dst2 = new DiscoveredServiceTracker() {
-//            public void serviceChanged(DiscoveredServiceNotification dsn) {}
-//        };
-//
-//        ServiceReference sr2 = EasyMock.createMock(ServiceReference.class);
-//        EasyMock.expect(sr2.getProperty(DiscoveredServiceTracker.INTERFACE_MATCH_CRITERIA))
-//            .andReturn(Arrays.asList(Integer.class.getName(), Comparable.class.getName()));
-//        EasyMock.expect(sr2.getProperty(DiscoveredServiceTracker.FILTER_MATCH_CRITERIA))
-//            .andReturn(null);
-//        EasyMock.replay(sr2);
-//
-//        BundleContext bc = EasyMock.createMock(BundleContext.class);
-//        EasyMock.expect(bc.getService(sr)).andReturn(dst);
-//        EasyMock.expect(bc.getService(sr2)).andReturn(dst2);
-//        EasyMock.replay(bc);
-//
-//        ZooKeeper zk = EasyMock.createMock(ZooKeeper.class);
-//        zkExpectExists(zk, String.class.getName());
-//        zkExpectExists(zk, Integer.class.getName());
-//        zkExpectExists(zk, Comparable.class.getName());
-//        EasyMock.expectLastCall();
-//        EasyMock.replay(zk);
-//
-//        FindInZooKeeperCustomizer fc = new FindInZooKeeperCustomizer(bc, zk);
-//
-//        // ---------------------------------------------------------------
-//        // Test the addingService APIs
-//        // ---------------------------------------------------------------
-//
-//        assertEquals("Precondition failed", 0, fc.watchers.size());
-//        fc.addingService(sr);
-//        assertEquals(1, fc.watchers.size());
-//
-//        DiscoveredServiceTracker key = fc.watchers.keySet().iterator().next();
-//        assertSame(dst, key);
-//        List<InterfaceMonitor> dmList = fc.watchers.get(key);
-//        assertEquals(1, dmList.size());
-//        InterfaceMonitor dm = dmList.iterator().next();
-//        assertNotNull(dm.listener);
-//        assertSame(zk, dm.zookeeper);
-//        assertEquals(Utils.getZooKeeperPath(String.class.getName()), dm.znode);
-//
-//        assertEquals("Precondition failed", 1, fc.watchers.size());
-//        fc.addingService(sr2);
-//        assertEquals(2, fc.watchers.size());
-//
-//        assertTrue(fc.watchers.containsKey(dst));
-//        assertTrue(fc.watchers.containsKey(dst2));
-//        assertEquals(dmList, fc.watchers.get(dst));
-//        List<InterfaceMonitor> dmList2 = fc.watchers.get(dst2);
-//        assertEquals(2, dmList2.size());
-//
-//        Set<String> actual = new HashSet<String>();
-//        for (InterfaceMonitor im : dmList2) {
-//            actual.add(im.znode);
-//        }
-//        Set<String> expected = new HashSet<String>(Arrays.asList(
-//                Utils.getZooKeeperPath(Integer.class.getName()),
-//                Utils.getZooKeeperPath(Comparable.class.getName())));
-//        assertEquals(expected, actual);
-//
-//        EasyMock.verify(zk);
-//
-//        // ---------------------------------------------------------------
-//        // Test the modifiedService APIs
-//        // ---------------------------------------------------------------
-//        EasyMock.reset(zk);
-//        zkExpectExists(zk, List.class.getName());
-//        EasyMock.replay(zk);
-//
-//        EasyMock.reset(sr);
-//        EasyMock.expect(sr.getProperty(DiscoveredServiceTracker.INTERFACE_MATCH_CRITERIA))
-//            .andReturn(Collections.singleton(List.class.getName()));
-//        EasyMock.expect(sr.getProperty(DiscoveredServiceTracker.FILTER_MATCH_CRITERIA))
-//            .andReturn(null);
-//        EasyMock.replay(sr);
-//
-//        assertEquals("Precondition failed", 2, fc.watchers.size());
-//        fc.modifiedService(sr, dst);
-//        assertEquals("Precondition failed", 2, fc.watchers.size());
-//
-//        assertTrue(fc.watchers.containsKey(dst));
-//        assertTrue(fc.watchers.containsKey(dst2));
-//        assertEquals(dmList2, fc.watchers.get(dst2));
-//        List<InterfaceMonitor> dmList3 = fc.watchers.get(dst);
-//        assertEquals(1, dmList3.size());
-//        assertEquals(Utils.getZooKeeperPath(List.class.getName()), dmList3.iterator().next().znode);
-//
-//        EasyMock.verify(zk);
-//
-//        // ---------------------------------------------------------------
-//        // Test the removedService APIs
-//        // ---------------------------------------------------------------
-//        EasyMock.reset(zk);
-//        EasyMock.replay(zk);
-//
-//        assertEquals("Precondition failed", 2, fc.watchers.size());
-//        fc.removedService(sr2, dst2);
-//        assertEquals("Precondition failed", 1, fc.watchers.size());
-//
-//        assertEquals(dmList3, fc.watchers.get(dst));
-//        assertNull(fc.watchers.get(dst2));
-//
-//        EasyMock.verify(zk);
-//    }
-//
-//    public void testAddingServiceFilter() {
-//        DiscoveredServiceTracker dst = new DiscoveredServiceTracker() {
-//            public void serviceChanged(DiscoveredServiceNotification dsn) {}
-//        };
-//
-//        ServiceReference sr = EasyMock.createMock(ServiceReference.class);
-//        EasyMock.expect(sr.getProperty(DiscoveredServiceTracker.INTERFACE_MATCH_CRITERIA))
-//            .andReturn(null);
-//        Set<String> stringFilter = Collections.singleton("(objectClass=java.lang.String)");
-//        EasyMock.expect(sr.getProperty(DiscoveredServiceTracker.FILTER_MATCH_CRITERIA))
-//            .andReturn(stringFilter);
-//        EasyMock.replay(sr);
-//
-//        DiscoveredServiceTracker dst2 = new DiscoveredServiceTracker() {
-//            public void serviceChanged(DiscoveredServiceNotification dsn) {}
-//        };
-//
-//        ServiceReference sr2 = EasyMock.createMock(ServiceReference.class);
-//        EasyMock.expect(sr2.getProperty(DiscoveredServiceTracker.INTERFACE_MATCH_CRITERIA))
-//            .andReturn(null);
-//        List<String> combinedFilter =
-//            Arrays.asList("(objectClass=java.lang.Integer)", "(objectClass=java.lang.Comparable)");
-//        EasyMock.expect(sr2.getProperty(DiscoveredServiceTracker.FILTER_MATCH_CRITERIA))
-//            .andReturn(combinedFilter);
-//        EasyMock.replay(sr2);
-//
-//        BundleContext bc = EasyMock.createMock(BundleContext.class);
-//        EasyMock.expect(bc.getService(sr)).andReturn(dst);
-//        EasyMock.expect(bc.getService(sr2)).andReturn(dst2);
-//        EasyMock.replay(bc);
-//
-//        ZooKeeper zk = EasyMock.createMock(ZooKeeper.class);
-//        zkExpectExists(zk, String.class.getName());
-//        zkExpectExists(zk, Integer.class.getName());
-//        zkExpectExists(zk, Comparable.class.getName());
-//        EasyMock.expectLastCall();
-//        EasyMock.replay(zk);
-//
-//        FindInZooKeeperCustomizer fc = new FindInZooKeeperCustomizer(bc, zk);
-//
-//        // ---------------------------------------------------------------
-//        // Test the addingService APIs
-//        // ---------------------------------------------------------------
-//
-//        assertEquals("Precondition failed", 0, fc.watchers.size());
-//        fc.addingService(sr);
-//        assertEquals(1, fc.watchers.size());
-//
-//        DiscoveredServiceTracker key = fc.watchers.keySet().iterator().next();
-//        assertSame(dst, key);
-//        List<InterfaceMonitor> dmList = fc.watchers.get(key);
-//        assertEquals(1, dmList.size());
-//        InterfaceMonitor dm = dmList.iterator().next();
-//        assertNotNull(dm.listener);
-//        assertSame(zk, dm.zookeeper);
-//        assertEquals(Utils.getZooKeeperPath(String.class.getName()), dm.znode);
-//
-//        assertEquals("Precondition failed", 1, fc.watchers.size());
-//        fc.addingService(sr2);
-//        assertEquals(2, fc.watchers.size());
-//
-//        assertTrue(fc.watchers.containsKey(dst));
-//        assertTrue(fc.watchers.containsKey(dst2));
-//        assertEquals(dmList, fc.watchers.get(dst));
-//        List<InterfaceMonitor> dmList2 = fc.watchers.get(dst2);
-//        assertEquals(2, dmList2.size());
-//        Set<String> actual = new HashSet<String>();
-//        for (InterfaceMonitor im : dmList2) {
-//            actual.add(im.znode);
-//        }
-//        Set<String> expected = new HashSet<String>(Arrays.asList(
-//                Utils.getZooKeeperPath(Integer.class.getName()),
-//                Utils.getZooKeeperPath(Comparable.class.getName())));
-//        assertEquals(expected, actual);
-//
-//        EasyMock.verify(zk);
-//
-//        // ---------------------------------------------------------------
-//        // Test the modifiedService APIs
-//        // ---------------------------------------------------------------
-//        EasyMock.reset(zk);
-//        zkExpectExists(zk, List.class.getName());
-//        EasyMock.replay(zk);
-//
-//        EasyMock.reset(sr);
-//        Set<String> listFilter = Collections.singleton("(objectClass=java.util.List)");
-//        EasyMock.expect(sr.getProperty(DiscoveredServiceTracker.INTERFACE_MATCH_CRITERIA))
-//            .andReturn(null);
-//        EasyMock.expect(sr.getProperty(DiscoveredServiceTracker.FILTER_MATCH_CRITERIA))
-//            .andReturn(listFilter);
-//        EasyMock.replay(sr);
-//
-//        assertEquals("Precondition failed", 2, fc.watchers.size());
-//        fc.modifiedService(sr, dst);
-//        assertEquals("Precondition failed", 2, fc.watchers.size());
-//
-//        assertTrue(fc.watchers.containsKey(dst));
-//        assertTrue(fc.watchers.containsKey(dst2));
-//        assertEquals(dmList2, fc.watchers.get(dst2));
-//        List<InterfaceMonitor> dmList3 = fc.watchers.get(dst);
-//        assertEquals(1, dmList3.size());
-//        assertEquals(Utils.getZooKeeperPath(List.class.getName()), dmList3.iterator().next().znode);
-//
-//        EasyMock.verify(zk);
-//
-//        // ---------------------------------------------------------------
-//        // Test the removedService APIs
-//        // ---------------------------------------------------------------
-//        EasyMock.reset(zk);
-//        EasyMock.replay(zk);
-//
-//        assertEquals("Precondition failed", 2, fc.watchers.size());
-//        fc.removedService(sr2, dst2);
-//        assertEquals("Precondition failed", 1, fc.watchers.size());
-//
-//        assertEquals(dmList3, fc.watchers.get(dst));
-//        assertNull(fc.watchers.get(dst2));
-//
-//        EasyMock.verify(zk);
-//    }
-//
-//    public void testGetInterfacesFromFilter() {
-//        testGetInterfacesFromFilter("objectClass=org.apache_2.Some$FunnyClass",
-//                "org.apache_2.Some$FunnyClass");
-//        testGetInterfacesFromFilter("(&(a=b)(objectClass = org.acme.Q)",
-//                "org.acme.Q");
-//        testGetInterfacesFromFilter("(&(objectClassIdentifier=b)(objectClass = org.acme.Q)",
-//                "org.acme.Q");
-//        testGetInterfacesFromFilter("(|(OBJECTCLASS=   X  )(objectclass = Y)",
-//                "X", "Y");
-//        testGetInterfacesFromFilter(new String[] {"(objectClass=X)", "(objectClass=Y)"},
-//                "X", "Y");
-//    }
-//
-//    private void testGetInterfacesFromFilter(String filter, String ... interfaces) {
-//        testGetInterfacesFromFilter(new String[] {filter}, interfaces);
-//    }
-//
-//    private void testGetInterfacesFromFilter(String[] filters, String ... interfaces) {
-//        FindInZooKeeperCustomizer.getInterfacesFromFilter(Arrays.asList(filters));
-//    }
-//
-//    private void zkExpectExists(ZooKeeper zk, String className) {
-//        zk.exists(EasyMock.eq(Utils.getZooKeeperPath(className)),
-//                (Watcher) EasyMock.anyObject(),
-//                (StatCallback) EasyMock.anyObject(), EasyMock.isNull());
-//        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
-//            public Object answer() throws Throwable {
-//                assertEquals(EasyMock.getCurrentArguments()[1],
-//                        EasyMock.getCurrentArguments()[2]);
-//                return null;
-//            }
-//        });
-//    }
-}


[03/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

Posted by cs...@apache.org.
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/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
deleted file mode 100644
index 002f172..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java
+++ /dev/null
@@ -1,422 +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.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.cxf.dosgi.dsw.Constants;
-import org.apache.cxf.dosgi.dsw.api.Endpoint;
-import org.apache.cxf.dosgi.dsw.api.EndpointHelper;
-import org.apache.cxf.dosgi.dsw.handlers.jaxws.MyJaxWsEchoService;
-import org.apache.cxf.dosgi.dsw.handlers.simple.MySimpleEchoService;
-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.EndpointImpl;
-import org.apache.cxf.endpoint.Server;
-import org.apache.cxf.feature.Feature;
-import org.apache.cxf.frontend.ClientProxyFactoryBean;
-import org.apache.cxf.frontend.ServerFactoryBean;
-import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
-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.IMocksControl;
-import org.junit.Assert;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Version;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
-public class PojoConfigurationTypeHandlerTest extends TestCase {
-
-    public void testGetPojoAddressEndpointURI() {
-        IntentManager intentManager = new IntentManagerImpl(new IntentMap());
-        PojoConfigurationTypeHandler handler = new PojoConfigurationTypeHandler(null,
-                                                                                intentManager,
-                                                                                dummyHttpServiceManager());
-        Map<String, Object> sd = new HashMap<String, Object>();
-        String url = "http://somewhere:1234/blah";
-        sd.put(RemoteConstants.ENDPOINT_ID, url);
-        assertEquals(url, handler.getServerAddress(sd, String.class));
-    }
-
-    private HttpServiceManager dummyHttpServiceManager() {
-        return new HttpServiceManager(null, null, null, null);
-    }
-
-    public void testGetPojoAddressEndpointCxf() {
-        IntentManager intentManager = new IntentManagerImpl(new IntentMap());
-        PojoConfigurationTypeHandler handler = new PojoConfigurationTypeHandler(null,
-                                                                                intentManager,
-                                                                                dummyHttpServiceManager());
-        Map<String, Object> sd = new HashMap<String, Object>();
-        String url = "http://somewhere:29/boo";
-        sd.put("org.apache.cxf.ws.address", url);
-        assertEquals(url, handler.getServerAddress(sd, String.class));
-    }
-
-    public void testGetPojoAddressEndpointPojo() {
-        IntentManager intentManager = new IntentManagerImpl(new IntentMap());
-        PojoConfigurationTypeHandler handler = new PojoConfigurationTypeHandler(null,
-                                                                                intentManager,
-                                                                                dummyHttpServiceManager());
-        Map<String, Object> sd = new HashMap<String, Object>();
-        String url = "http://somewhere:32768/foo";
-        sd.put("osgi.remote.configuration.pojo.address", url);
-        assertEquals(url, handler.getServerAddress(sd, String.class));
-    }
-
-    public void testGetDefaultPojoAddress() {
-        IntentManager intentManager = new IntentManagerImpl(new IntentMap());
-        PojoConfigurationTypeHandler handler = new PojoConfigurationTypeHandler(null,
-                                                                                intentManager,
-                                                                                dummyHttpServiceManager());
-        Map<String, Object> sd = new HashMap<String, Object>();
-        assertEquals("/java/lang/String", handler.getServerAddress(sd, String.class));
-    }
-
-    // todo: add test for data bindings
-    public void testCreateProxy() {
-        IMocksControl c = EasyMock.createNiceControl();
-        BundleContext bc1 = c.createMock(BundleContext.class);
-        
-        BundleContext requestingContext = c.createMock(BundleContext.class);
-
-        final ClientProxyFactoryBean cpfb = c.createMock(ClientProxyFactoryBean.class);
-        ReflectionServiceFactoryBean sf = c.createMock(ReflectionServiceFactoryBean.class);
-        EasyMock.expect(cpfb.getServiceFactory()).andReturn(sf).anyTimes();
-        IntentManager intentManager = new IntentManagerImpl(new IntentMap()) {
-            @Override
-            public String[] applyIntents(List<Feature> features,
-                                         AbstractEndpointFactory factory,
-                                         Map<String, Object> sd) {
-                return new String[0];
-            }
-        };
-        PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(bc1,
-                                                                          intentManager,
-                                                                          dummyHttpServiceManager()) {
-            @Override
-            protected ClientProxyFactoryBean createClientProxyFactoryBean(Map<String, Object> sd, Class<?> iClass) {
-                return cpfb;
-            }
-        };
-
-        Class<?>[] exportedInterfaces = new Class[]{Runnable.class};
-        
-        Map<String, Object> props = new HashMap<String, Object>();
-        props.put(RemoteConstants.ENDPOINT_ID, "http://google.de/");
-        EndpointHelper.addObjectClass(props, exportedInterfaces);
-        props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, new String[]{"my.config"});
-        EndpointDescription endpoint = new EndpointDescription(props);
-
-        cpfb.setAddress((String)EasyMock.eq(props.get(RemoteConstants.ENDPOINT_ID)));
-        EasyMock.expectLastCall().atLeastOnce();
-
-        cpfb.setServiceClass(EasyMock.eq(Runnable.class));
-        EasyMock.expectLastCall().atLeastOnce();
-
-        c.replay();
-        ClassLoader cl = null;
-        Object proxy = p.importEndpoint(cl, requestingContext, exportedInterfaces, endpoint);
-        assertNotNull(proxy);
-        assertTrue("Proxy is not of the requested type! ", proxy instanceof Runnable);
-        c.verify();
-    }
-
-    public void testCreateServerWithAddressProperty() throws Exception {
-        BundleContext dswContext = EasyMock.createNiceMock(BundleContext.class);
-        EasyMock.replay(dswContext);
-
-        String myService = "Hi";
-        final ServerFactoryBean sfb = createMockServerFactoryBean();
-
-        IntentMap intentMap = new IntentMap();
-        IntentManager intentManager = new IntentManagerImpl(intentMap) {
-            @Override
-            public String[] applyIntents(List<Feature> features, AbstractEndpointFactory factory,
-                                         Map<String, Object> sd) {
-                return new String[]{};
-            }
-        };
-        PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(dswContext, intentManager,
-                                                                          dummyHttpServiceManager()) {
-            @Override
-            protected ServerFactoryBean createServerFactoryBean(Map<String, Object> sd, Class<?> iClass) {
-                return sfb;
-            }
-        };
-        BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
-        EasyMock.replay(bundleContext);
-        
-        Class<?>[] exportedInterface = new Class[]{String.class};
-        Map<String, Object> props = new HashMap<String, Object>();
-        EndpointHelper.addObjectClass(props, exportedInterface);
-        props.put(Constants.WS_ADDRESS_PROPERTY, "http://alternate_host:80/myString");
-
-        Endpoint exportResult = p.exportService(myService, bundleContext, props, exportedInterface);
-        Map<String, Object> edProps = exportResult.description().getProperties();
-
-        assertNotNull(edProps.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS));
-        assertEquals(1, ((String[])edProps.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS)).length);
-        assertEquals(Constants.WS_CONFIG_TYPE, ((String[])edProps.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS))[0]);
-        assertEquals("http://alternate_host:80/myString", edProps.get(RemoteConstants.ENDPOINT_ID));
-    }
-
-    public void testAddressing() throws Exception {
-        runAddressingTest(new HashMap<String, Object>(), "http://localhost:9000/java/lang/Runnable");
-
-        Map<String, Object> p1 = new HashMap<String, Object>();
-        p1.put("org.apache.cxf.ws.address", "http://somewhere");
-        runAddressingTest(p1, "http://somewhere");
-
-        Map<String, Object> p2 = new HashMap<String, Object>();
-        p2.put("org.apache.cxf.rs.address", "https://somewhereelse");
-        runAddressingTest(p2, "https://somewhereelse");
-
-        Map<String, Object> p3 = new HashMap<String, Object>();
-        p3.put("org.apache.cxf.ws.port", 65535);
-        runAddressingTest(p3, "http://localhost:65535/java/lang/Runnable");
-
-        Map<String, Object> p4 = new HashMap<String, Object>();
-        p4.put("org.apache.cxf.ws.port", "8181");
-        runAddressingTest(p4, "http://localhost:8181/java/lang/Runnable");
-    }
-
-    private void runAddressingTest(Map<String, Object> properties, String expectedAddress) throws Exception {
-        Class<?>[] exportedInterface = new Class[]{Runnable.class};
-        EndpointHelper.addObjectClass(properties, exportedInterface);
-        BundleContext dswContext = EasyMock.createNiceMock(BundleContext.class);
-        String expectedUUID = UUID.randomUUID().toString();
-        EasyMock.expect(dswContext.getProperty(org.osgi.framework.Constants.FRAMEWORK_UUID)).andReturn(expectedUUID);
-        EasyMock.replay(dswContext);
-
-        IntentManager intentManager = EasyMock.createNiceMock(IntentManager.class);
-        EasyMock.replay(intentManager);
-
-        PojoConfigurationTypeHandler handler = new PojoConfigurationTypeHandler(dswContext,
-                                                                                intentManager,
-                                                                                dummyHttpServiceManager()) {
-            @Override
-            protected Endpoint createServerFromFactory(ServerFactoryBean factory,
-                                                       EndpointDescription epd) {
-                return new ServerWrapper(epd, null);
-            }
-        };
-        Runnable myService = EasyMock.createMock(Runnable.class);
-        EasyMock.replay(myService);
-        
-        BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
-        EasyMock.replay(bundleContext);
-
-        Endpoint result = handler.exportService(myService, bundleContext, properties, exportedInterface);
-        Map<String, Object> props = result.description().getProperties();
-        assertEquals(expectedAddress, props.get("org.apache.cxf.ws.address"));
-        Assert.assertArrayEquals(new String[] {"org.apache.cxf.ws"}, 
-                     (String[]) props.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS));
-        Assert.assertArrayEquals(new String[] {"java.lang.Runnable"}, 
-                     (String[]) props.get(org.osgi.framework.Constants.OBJECTCLASS));
-    }
-
-    public void t2estCreateServerException() {
-        BundleContext dswContext = EasyMock.createNiceMock(BundleContext.class);
-        EasyMock.replay(dswContext);
-
-        IntentManager intentManager = EasyMock.createNiceMock(IntentManager.class);
-        EasyMock.replay(intentManager);
-
-        PojoConfigurationTypeHandler handler = new PojoConfigurationTypeHandler(dswContext,
-                                                                                intentManager,
-                                                                                dummyHttpServiceManager()) {
-            @Override
-            protected Endpoint createServerFromFactory(ServerFactoryBean factory,
-                                                       EndpointDescription epd) {
-                throw new TestException();
-            }
-        };
-
-        Map<String, Object> props = new HashMap<String, Object>();
-
-        Runnable myService = EasyMock.createMock(Runnable.class);
-        EasyMock.replay(myService);
-        try {
-            handler.exportService(myService, null, props, new Class[]{Runnable.class});
-            fail("Expected TestException");
-        } catch (TestException e) {
-            // Expected
-        }
-    }
-
-    private ServerFactoryBean createMockServerFactoryBean() {
-        ReflectionServiceFactoryBean sf = EasyMock.createNiceMock(ReflectionServiceFactoryBean.class);
-        EasyMock.replay(sf);
-
-        final StringBuilder serverURI = new StringBuilder();
-
-        ServerFactoryBean sfb = EasyMock.createNiceMock(ServerFactoryBean.class);
-        Server server = createMockServer(sfb);
-
-        EasyMock.expect(sfb.getServiceFactory()).andReturn(sf).anyTimes();
-        EasyMock.expect(sfb.create()).andReturn(server);
-        sfb.setAddress((String) EasyMock.anyObject());
-        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
-            public Object answer() throws Throwable {
-                serverURI.setLength(0);
-                serverURI.append(EasyMock.getCurrentArguments()[0]);
-                return null;
-            }
-        });
-        EasyMock.expect(sfb.getAddress()).andAnswer(new IAnswer<String>() {
-            public String answer() throws Throwable {
-                return serverURI.toString();
-            }
-        });
-        EasyMock.replay(sfb);
-        return sfb;
-    }
-
-    private Server createMockServer(final ServerFactoryBean sfb) {
-        AttributedURIType addr = EasyMock.createMock(AttributedURIType.class);
-        EasyMock.expect(addr.getValue()).andAnswer(new IAnswer<String>() {
-            public String answer() throws Throwable {
-                return sfb.getAddress();
-            }
-        });
-        EasyMock.replay(addr);
-
-        EndpointReferenceType er = EasyMock.createMock(EndpointReferenceType.class);
-        EasyMock.expect(er.getAddress()).andReturn(addr);
-        EasyMock.replay(er);
-
-        Destination destination = EasyMock.createMock(Destination.class);
-        EasyMock.expect(destination.getAddress()).andReturn(er);
-        EasyMock.replay(destination);
-
-        Server server = EasyMock.createNiceMock(Server.class);
-        EasyMock.expect(server.getDestination()).andReturn(destination);
-        EasyMock.replay(server);
-        return server;
-    }
-
-    public void testCreateEndpointProps() {
-        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-        EasyMock.expect(bc.getProperty("org.osgi.framework.uuid")).andReturn("some_uuid1");
-        EasyMock.replay(bc);
-
-        IntentManager intentManager = new IntentManagerImpl(new IntentMap());
-        PojoConfigurationTypeHandler pch = new PojoConfigurationTypeHandler(bc,
-                                                                            intentManager,
-                                                                            dummyHttpServiceManager());
-        Class<?>[] exportedInterfaces = new Class[] {String.class};
-        Map<String, Object> sd = new HashMap<String, Object>();
-        sd.put(org.osgi.framework.Constants.SERVICE_ID, 42);
-        EndpointHelper.addObjectClass(sd, exportedInterfaces);
-        EndpointDescription epd = pch.createEndpointDesc(sd, new String[] {"org.apache.cxf.ws"},
-                "http://localhost:12345", new String[] {"my_intent", "your_intent"});
-
-        assertEquals("http://localhost:12345", epd.getId());
-        assertEquals(Arrays.asList("java.lang.String"), epd.getInterfaces());
-        assertEquals(Arrays.asList("org.apache.cxf.ws"), epd.getConfigurationTypes());
-        assertEquals(Arrays.asList("my_intent", "your_intent"), epd.getIntents());
-        assertEquals(new Version("0.0.0"), epd.getPackageVersion("java.lang"));
-    }
-
-    public void t2estCreateJaxWsEndpointWithoutIntents() {
-        IMocksControl c = EasyMock.createNiceControl();
-        BundleContext dswBC = c.createMock(BundleContext.class);
-        
-        IntentManager intentManager = new DummyIntentManager();
-        PojoConfigurationTypeHandler handler = new PojoConfigurationTypeHandler(dswBC,
-                                                                                intentManager,
-                                                                                dummyHttpServiceManager());
-
-        Map<String, Object> sd = new HashMap<String, Object>();
-        sd.put(Constants.WS_ADDRESS_PROPERTY, "/somewhere");
-        BundleContext serviceBC = c.createMock(BundleContext.class);
-        Object myService = null;
-        c.replay();
-
-        ServerWrapper serverWrapper = (ServerWrapper)handler.exportService(myService,
-                                                                           serviceBC, 
-                                                                           sd, 
-                                                                           new Class[]{MyJaxWsEchoService.class});
-        c.verify();
-
-        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/",
-                                      "MyJaxWsEchoServiceServiceSoapBinding"),
-                            bindingName);
-    }
-
-    public void t2estCreateSimpleEndpointWithoutIntents() {
-        IMocksControl c = EasyMock.createNiceControl();
-        BundleContext dswBC = c.createMock(BundleContext.class);
-
-        IntentManager intentManager = new DummyIntentManager();
-        PojoConfigurationTypeHandler handler
-            = new PojoConfigurationTypeHandler(dswBC, intentManager, dummyHttpServiceManager());
-        Map<String, Object> sd = new HashMap<String, Object>();
-        sd.put(Constants.WS_ADDRESS_PROPERTY, "/somewhere_else");
-        BundleContext serviceBC = c.createMock(BundleContext.class);
-        c.replay();
-        ServerWrapper serverWrapper = (ServerWrapper)handler.exportService(null, serviceBC, sd, 
-                                                                          new Class[]{MySimpleEchoService.class});
-        c.verify();
-
-        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/",
-                                      "MySimpleEchoServiceSoapBinding"),
-                            bindingName);
-    }
-
-    public static class DummyIntentManager implements IntentManager {
-
-        @Override
-        public String[] applyIntents(List<Feature> features,
-                                     AbstractEndpointFactory factory,
-                                     Map<String, Object> props) {
-            return new String[]{};
-        }
-
-        @Override
-        public void assertAllIntentsSupported(Map<String, Object> serviceProperties) {
-        }
-    }
-
-    @SuppressWarnings("serial")
-    public static class TestException extends RuntimeException {
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/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
deleted file mode 100644
index 58b5f58..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContextTest.java
+++ /dev/null
@@ -1,267 +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.io.PrintWriter;
-import java.net.URL;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import junit.framework.TestCase;
-
-import org.easymock.EasyMock;
-import org.junit.Assert;
-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;
-    protected SecurityDelegatingHttpContext httpContext;
-    protected CommitResponseFilter commitFilter;
-    protected DoNothingFilter doNothingFilter;
-    protected AccessDeniedFilter accessDeniedFilter;
-    protected String mimeType;
-    protected URL url; // does not need to exist
-
-    public void setUp() throws Exception {
-        mimeType = "text/xml";
-        url = new URL("file:test.xml"); // does not need to exist
-
-        // Sample filters
-        commitFilter = new CommitResponseFilter();
-        doNothingFilter = new DoNothingFilter();
-        accessDeniedFilter = new AccessDeniedFilter();
-
-        // Mock up the default http context
-        defaultHttpContext = EasyMock.createNiceMock(HttpContext.class);
-        EasyMock.expect(defaultHttpContext.getMimeType((String)EasyMock.anyObject())).andReturn(mimeType);
-        EasyMock.expect(defaultHttpContext.getResource((String)EasyMock.anyObject())).andReturn(url);
-        EasyMock.replay(defaultHttpContext);
-    }
-
-    public void testFilterRequired() throws Exception {
-        // Mock up the service references
-        ServiceReference[] serviceReferences = new ServiceReference[] {};
-
-        // Mock up the bundle context
-        BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
-        EasyMock.expect(bundleContext.getServiceReferences(Filter.class.getName(),
-                                                           "(org.apache.cxf.httpservice.filter=true)"))
-            .andReturn(serviceReferences);
-        EasyMock.replay(bundleContext);
-
-        // Set up the secure http context
-        httpContext = new SecurityDelegatingHttpContext(bundleContext, defaultHttpContext);
-        httpContext.requireFilter = true;
-
-        // Ensure that the httpContext doesn't allow the request to be processed, since there are no registered servlet
-        // filters
-        HttpServletRequest request = EasyMock.createNiceMock(HttpServletRequest.class);
-        EasyMock.replay(request);
-        HttpServletResponse response = EasyMock.createNiceMock(HttpServletResponse.class);
-        EasyMock.replay(response);
-        boolean requestAllowed = httpContext.handleSecurity(request, response);
-        Assert.assertFalse(requestAllowed);
-
-        // Ensure that the httpContext returns true if there is no requirement for registered servlet filters
-        httpContext.requireFilter = false;
-        requestAllowed = httpContext.handleSecurity(request, response);
-        Assert.assertTrue(requestAllowed);
-    }
-
-    public void testSingleCommitFilter() throws Exception {
-        // Mock up the service references
-        ServiceReference filterReference = EasyMock.createNiceMock(ServiceReference.class);
-        EasyMock.replay(filterReference);
-        ServiceReference[] serviceReferences = new ServiceReference[] {
-            filterReference
-        };
-
-        // Mock up the bundle context
-        BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
-        EasyMock.expect(bundleContext.getServiceReferences((String)EasyMock.anyObject(), (String)EasyMock.anyObject()))
-            .andReturn(serviceReferences);
-        EasyMock.expect(bundleContext.getService((ServiceReference)EasyMock.anyObject())).andReturn(commitFilter);
-        EasyMock.replay(bundleContext);
-
-        // Set up the secure http context
-        httpContext = new SecurityDelegatingHttpContext(bundleContext, defaultHttpContext);
-
-        // Ensure that the httpContext returns false, since the filter has committed the response
-        HttpServletRequest request = EasyMock.createNiceMock(HttpServletRequest.class);
-        EasyMock.replay(request);
-        HttpServletResponse response = EasyMock.createNiceMock(HttpServletResponse.class);
-        EasyMock.expect(response.isCommitted()).andReturn(false); // the first call checks to see whether to invoke the
-                                                                  // filter
-        EasyMock.expect(response.isCommitted()).andReturn(true); // the second is called to determine the handleSecurity
-                                                                 // return value
-        EasyMock.expect(response.getWriter()).andReturn(new PrintWriter(System.out));
-        EasyMock.replay(response);
-        Assert.assertFalse(httpContext.handleSecurity(request, response));
-
-        // Ensure that the appropriate filters were called
-        Assert.assertTrue(commitFilter.called);
-        Assert.assertFalse(doNothingFilter.called);
-        Assert.assertFalse(accessDeniedFilter.called);
-    }
-
-    public void testFilterChain() throws Exception {
-        // Mock up the service references
-        ServiceReference filterReference = EasyMock.createNiceMock(ServiceReference.class);
-        EasyMock.replay(filterReference);
-        ServiceReference[] serviceReferences = new ServiceReference[] {
-            filterReference, filterReference
-        };
-
-        // Mock up the bundle context
-        BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
-        EasyMock.expect(bundleContext.getServiceReferences((String)EasyMock.anyObject(), (String)EasyMock.anyObject()))
-            .andReturn(serviceReferences);
-        EasyMock.expect(bundleContext.getService((ServiceReference)EasyMock.anyObject())).andReturn(doNothingFilter);
-        EasyMock.expect(bundleContext.getService((ServiceReference)EasyMock.anyObject())).andReturn(commitFilter);
-        EasyMock.replay(bundleContext);
-
-        // Set up the secure http context
-        httpContext = new SecurityDelegatingHttpContext(bundleContext, defaultHttpContext);
-
-        // Ensure that the httpContext returns false, since the filter has committed the response
-        HttpServletRequest request = EasyMock.createNiceMock(HttpServletRequest.class);
-        EasyMock.replay(request);
-        HttpServletResponse response = EasyMock.createNiceMock(HttpServletResponse.class);
-        EasyMock.expect(response.isCommitted()).andReturn(false); // doNothingFilter should not commit the response
-        EasyMock.expect(response.getWriter()).andReturn(new PrintWriter(System.out));
-        EasyMock.expect(response.isCommitted()).andReturn(false);
-        EasyMock.expect(response.isCommitted()).andReturn(true); // the commit filter indicating that it committed the
-                                                                 // response
-        EasyMock.replay(response);
-        Assert.assertFalse(httpContext.handleSecurity(request, response));
-
-        // Ensure that the appropriate filters were called
-        Assert.assertTrue(doNothingFilter.called);
-        Assert.assertTrue(commitFilter.called);
-        Assert.assertFalse(accessDeniedFilter.called);
-    }
-
-    public void testAllowRequest() throws Exception {
-        // Mock up the service references
-        ServiceReference filterReference = EasyMock.createNiceMock(ServiceReference.class);
-        EasyMock.replay(filterReference);
-        ServiceReference[] serviceReferences = new ServiceReference[] {
-            filterReference
-        };
-
-        // Mock up the bundle context
-        BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
-        EasyMock.expect(bundleContext.getServiceReferences((String)EasyMock.anyObject(), (String)EasyMock.anyObject()))
-            .andReturn(serviceReferences);
-        EasyMock.expect(bundleContext.getService((ServiceReference)EasyMock.anyObject())).andReturn(doNothingFilter);
-        EasyMock.replay(bundleContext);
-
-        // Set up the secure http context
-        httpContext = new SecurityDelegatingHttpContext(bundleContext, defaultHttpContext);
-
-        // Ensure that the httpContext returns true, since the filter has not committed the response
-        HttpServletRequest request = EasyMock.createNiceMock(HttpServletRequest.class);
-        EasyMock.replay(request);
-        HttpServletResponse response = EasyMock.createNiceMock(HttpServletResponse.class);
-        EasyMock.expect(response.isCommitted()).andReturn(false);
-        EasyMock.replay(response);
-        Assert.assertTrue(httpContext.handleSecurity(request, response));
-
-        // Ensure that the appropriate filters were called
-        Assert.assertTrue(doNothingFilter.called);
-        Assert.assertFalse(commitFilter.called);
-        Assert.assertFalse(accessDeniedFilter.called);
-    }
-
-    public void testDelegation() throws Exception {
-        BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
-        EasyMock.replay(bundleContext);
-
-        // Set up the secure http context
-        httpContext = new SecurityDelegatingHttpContext(bundleContext, defaultHttpContext);
-
-        // Ensure that it delegates non-security calls to the wrapped implementation (in this case, the mock)
-        Assert.assertEquals(mimeType, httpContext.getMimeType(""));
-        Assert.assertEquals(url, httpContext.getResource(""));
-    }
-}
-
-class CommitResponseFilter implements Filter {
-
-    boolean called;
-
-    public void init(FilterConfig filterConfig) throws ServletException {
-    }
-
-    public void destroy() {
-    }
-
-    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
-        throws java.io.IOException, javax.servlet.ServletException {
-        called = true;
-        response.getWriter().write("committing the response");
-    }
-}
-
-class DoNothingFilter implements Filter {
-
-    boolean called;
-
-    public void init(FilterConfig filterConfig) throws ServletException {
-    }
-
-    public void destroy() {
-    }
-
-    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
-        throws java.io.IOException, javax.servlet.ServletException {
-        called = true;
-        chain.doFilter(request, response);
-    }
-}
-
-class AccessDeniedFilter implements Filter {
-
-    boolean called;
-
-    public void init(FilterConfig filterConfig) throws ServletException {
-    }
-
-    public void destroy() {
-    }
-
-    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
-        throws java.io.IOException, javax.servlet.ServletException {
-        called = true;
-        ((HttpServletResponse)response).sendError(HttpServletResponse.SC_FORBIDDEN);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandlerTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandlerTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandlerTest.java
deleted file mode 100644
index 64beeac..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandlerTest.java
+++ /dev/null
@@ -1,75 +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.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-public class ServiceInvocationHandlerTest extends TestCase {
-
-    private static final Map<String, Method> OBJECT_METHODS = new HashMap<String, Method>(); {
-        for (Method m : Object.class.getMethods()) {
-            OBJECT_METHODS.put(m.getName(), m);
-        }
-    }
-
-    public void testInvoke() throws Throwable {
-        ServiceInvocationHandler sih = new ServiceInvocationHandler("hello", String.class);
-        Method m = String.class.getMethod("length", new Class[] {});
-        assertEquals(5, sih.invoke(null, m, new Object[] {}));
-    }
-
-    public void testInvokeObjectMethod() throws Throwable {
-        final List<String> called = new ArrayList<String>();
-        ServiceInvocationHandler sih = new ServiceInvocationHandler("hi", String.class) {
-            public boolean equals(Object obj) {
-                called.add("equals");
-                return super.equals(obj);
-            }
-
-            public int hashCode() {
-                called.add("hashCode");
-                return super.hashCode();
-            }
-
-            public String toString() {
-                called.add("toString");
-                return "somestring";
-            }
-        };
-
-        Object proxy = Proxy.newProxyInstance(
-                getClass().getClassLoader(), new Class[] {Runnable.class}, sih);
-
-        assertEquals(true,
-                sih.invoke(null, OBJECT_METHODS.get("equals"), new Object[] {proxy}));
-        assertEquals(System.identityHashCode(sih),
-                sih.invoke(null, OBJECT_METHODS.get("hashCode"), new Object[] {}));
-        assertEquals("somestring",
-                sih.invoke(null, OBJECT_METHODS.get("toString"), new Object[] {}));
-        assertEquals(Arrays.asList("equals", "hashCode", "toString"), called);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandlerTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandlerTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandlerTest.java
deleted file mode 100644
index df90758..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandlerTest.java
+++ /dev/null
@@ -1,67 +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 junit.framework.TestCase;
-
-public class WsdlConfigurationTypeHandlerTest extends TestCase {
-
-    public void testDUMMY() {
-        assertTrue(true);
-    }
-
-//    private Map<String, Object> handlerProps;
-//
-//    @Override
-//    protected void setUp() throws Exception {
-//        super.setUp();
-//
-//        handlerProps = new HashMap<String, Object>();
-//        handlerProps.put(Constants.DEFAULT_HOST_CONFIG, "somehost");
-//        handlerProps.put(Constants.DEFAULT_PORT_CONFIG, "54321");
-//    }
-//
-//    public void testCreateProxyPopulatesDistributionProvider() {
-//        ServiceReference sr = EasyMock.createNiceMock(ServiceReference.class);
-//        BundleContext dswContext = EasyMock.createNiceMock(BundleContext.class);
-//        BundleContext callingContext = EasyMock.createNiceMock(BundleContext.class);
-//        ServiceEndpointDescription sd = TestUtils.mockServiceDescription("Foo");
-//        EasyMock.replay(sr);
-//        EasyMock.replay(dswContext);
-//        EasyMock.replay(callingContext);
-//        EasyMock.replay(sd);
-//
-//        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext);
-//        WsdlConfigurationTypeHandler w = new WsdlConfigurationTypeHandler(dswContext, dp, handlerProps) {
-//            @Override
-//            Service createWebService(URL wsdlAddress, QName serviceQname) {
-//                Service svc = EasyMock.createMock(Service.class);
-//                EasyMock.expect(svc.getPort(CharSequence.class)).andReturn("Hi").anyTimes();
-//                EasyMock.replay(svc);
-//                return svc;
-//            }
-//        };
-//
-//        assertEquals("Precondition failed", 0, dp.getRemoteServices().size());
-//        w.createProxy(sr, dswContext, callingContext, CharSequence.class, sd);
-//        assertEquals(1, dp.getRemoteServices().size());
-//        assertSame(sr, dp.getRemoteServices().iterator().next());
-//
-//    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/jaxws/MyJaxWsEchoService.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/jaxws/MyJaxWsEchoService.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/jaxws/MyJaxWsEchoService.java
deleted file mode 100644
index 7814267..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/jaxws/MyJaxWsEchoService.java
+++ /dev/null
@@ -1,26 +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.jaxws;
-
-import javax.jws.WebService;
-
-@WebService
-public interface MyJaxWsEchoService {
-    String echo(String message);
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/jaxws/MyJaxWsEchoServiceImpl.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/jaxws/MyJaxWsEchoServiceImpl.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/jaxws/MyJaxWsEchoServiceImpl.java
deleted file mode 100644
index 699c9ae..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/jaxws/MyJaxWsEchoServiceImpl.java
+++ /dev/null
@@ -1,27 +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.jaxws;
-
-public class MyJaxWsEchoServiceImpl implements MyJaxWsEchoService {
-
-    @Override
-    public String echo(String message) {
-        return message;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/simple/MySimpleEchoService.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/simple/MySimpleEchoService.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/simple/MySimpleEchoService.java
deleted file mode 100644
index 7d574ca..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/simple/MySimpleEchoService.java
+++ /dev/null
@@ -1,23 +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.simple;
-
-public interface MySimpleEchoService {
-    String echo(String message);
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/simple/MySimpleEchoServiceImpl.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/simple/MySimpleEchoServiceImpl.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/simple/MySimpleEchoServiceImpl.java
deleted file mode 100644
index 19dda4b..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/simple/MySimpleEchoServiceImpl.java
+++ /dev/null
@@ -1,27 +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.simple;
-
-public class MySimpleEchoServiceImpl implements MySimpleEchoService {
-
-    @Override
-    public String echo(String message) {
-        return message;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfFindListenerHookTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfFindListenerHookTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfFindListenerHookTest.java
deleted file mode 100644
index fde48d2..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfFindListenerHookTest.java
+++ /dev/null
@@ -1,341 +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.hooks;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class CxfFindListenerHookTest extends Assert {
-
-    @Test
-    public void testDUMMY() throws Exception {
-    }
-
-//    private IMocksControl control;
-//
-//    @Before
-//    public void setUp() {
-//        control = EasyMock.createNiceControl();
-//    }
-
-    /* Todo this test doesn't apply at the moment since the ListenerHook doesn't
-     * have a serviceReferencesRequested() API (yet).
-    @Test
-    public void testSyncListenerHook() throws Exception {
-        Bundle bundle = control.createMock(Bundle.class);
-        bundle.findEntries(EasyMock.eq("OSGI-INF/remote-service"),
-            EasyMock.eq("*.xml"), EasyMock.anyBoolean());
-        EasyMock.expectLastCall().andReturn(Collections.enumeration(
-            Arrays.asList(getClass().getResource("/OSGI-INF/remote-service/remote-services.xml"))));
-        Dictionary<String, String> bundleHeaders = new Hashtable<String, String>();
-        bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_NAME,
-                          "Test Bundle");
-        bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_VERSION,
-                          "1.0.0");
-        bundle.getHeaders();
-        EasyMock.expectLastCall().andReturn(bundleHeaders).anyTimes();
-        bundle.loadClass(TestService.class.getName());
-        EasyMock.expectLastCall().andReturn(TestService.class).anyTimes();
-        final BundleContext requestingContext = control.createMock(BundleContext.class);
-        requestingContext.getBundle();
-        EasyMock.expectLastCall().andReturn(bundle).anyTimes();
-
-        BundleTestContext dswContext = new BundleTestContext(bundle);
-        dswContext.addServiceReference(TestService.class.getName(),
-                                       control.createMock(ServiceReference.class));
-        control.replay();
-
-        CxfListenerHook hook = new CxfListenerHook(dswContext, null);
-
-        // TODO : if the next call ends up being executed in a thread of its own then
-        // update the test accordingly, use Futures for ex
-
-        hook.serviceReferencesRequested(requestingContext,
-                                       TestService.class.getName(), null, true);
-
-        List<ServiceReference> registeredRefs = dswContext.getRegisteredReferences();
-        assertNotNull(registeredRefs);
-        assertEquals(1, registeredRefs.size());
-    } */
-
-//    @Test
-//    public void testTrackerPropertiesOnlyClassInFilterWithMatchingInterface() throws Exception {
-//        String filter = "(objectClass=" + TestService.class.getName() + ")";
-//        doTestTrackerPropertiesSet(filter,
-//                                   "osgi.remote.discovery.interest.interfaces",
-//                                   TestService.class.getName(),
-//                                   asList(TestService.class.getName()),
-//                                   Collections.EMPTY_SET);
-//    }
-//
-//    @Test
-//    public void testTrackerPropertiesGenericFilterWithMatchingInterface() throws Exception {
-//        String filter = "(&(objectClass=" + TestService.class.getName()
-//                        + ")(colour=blue))";
-//        doTestTrackerPropertiesSet(filter,
-//                                   "osgi.remote.discovery.interest.filters",
-//                                   replacePredicate(filter),
-//                                   asList(TestService.class.getName()),
-//                                   Collections.EMPTY_SET);
-//    }
-//
-//    @Test
-//    public void testTrackerPropertiesOnlyClassInFilterWithMatchingFilter() throws Exception {
-//        String filter = "(objectClass=" + TestService.class.getName() + ")";
-//        doTestTrackerPropertiesSet(filter,
-//                                   "osgi.remote.discovery.interest.interfaces",
-//                                   TestService.class.getName(),
-//                                   Collections.EMPTY_SET,
-//                                   asList(replacePredicate(filter)));
-//    }
-//
-//    @Test
-//    public void testTrackerPropertiesGenericFilterWithMatchingFilter() throws Exception {
-//        String filter = "(&(objectClass=" + TestService.class.getName()
-//                        + ")(colour=blue))";
-//        doTestTrackerPropertiesSet(filter,
-//                                   "osgi.remote.discovery.interest.filters",
-//                                   replacePredicate(filter),
-//                                   Collections.EMPTY_SET,
-//                                   asList(replacePredicate(filter)));
-//    }
-//
-//    @Test
-//    public void testTrackerPropertiesOnlyClassInFilterWithMatchingBoth() throws Exception {
-//        String filter = "(objectClass=" + TestService.class.getName() + ")";
-//        doTestTrackerPropertiesSet(filter,
-//                                   "osgi.remote.discovery.interest.interfaces",
-//                                   TestService.class.getName(),
-//                                   asList(TestService.class.getName()),
-//                                   asList(replacePredicate(filter)));
-//    }
-//
-//    @Test
-//    public void testTrackerPropertiesGenericFilterWithMatchingBoth() throws Exception {
-//        String filter = "(&(objectClass=" + TestService.class.getName()
-//                        + ")(colour=blue))";
-//        doTestTrackerPropertiesSet(filter,
-//                                   "osgi.remote.discovery.interest.filters",
-//                                   replacePredicate(filter),
-//                                   Collections.EMPTY_SET,
-//                                   asList(replacePredicate(filter)));
-//    }
-//
-//    private void doTestTrackerPropertiesSet(final String filter,
-//                                            String propKey,
-//                                            String propValue,
-//                                            Collection matchingInterfaces,
-//                                            Collection matchingFilters) throws Exception {
-//        Bundle bundle = control.createMock(Bundle.class);
-//        Dictionary<String, String> bundleHeaders = new Hashtable<String, String>();
-//        bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_NAME,
-//                          "Test Bundle");
-//        bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_VERSION,
-//                          "1.0.0");
-//        bundle.getHeaders();
-//        EasyMock.expectLastCall().andReturn(bundleHeaders).times(2);
-//        final String serviceClass = TestService.class.getName();
-//        bundle.loadClass(serviceClass);
-//        EasyMock.expectLastCall().andReturn(TestService.class).times(2);
-//        final BundleContext requestingContext = control.createMock(BundleContext.class);
-//
-//        BundleTestContext dswContext = new BundleTestContext(bundle);
-//        ServiceRegistration serviceRegistration = control.createMock(ServiceRegistration.class);
-//        dswContext.addServiceRegistration(serviceClass, serviceRegistration);
-//        serviceRegistration.unregister();
-//        EasyMock.expectLastCall().times(1);
-//        ServiceReference serviceReference = control.createMock(ServiceReference.class);
-//        dswContext.addServiceReference(serviceClass, serviceReference);
-//
-//        final String trackerClass = DiscoveredServiceTracker.class.getName();
-//        ServiceRegistration trackerRegistration = control.createMock(ServiceRegistration.class);
-//        dswContext.addServiceRegistration(trackerClass, trackerRegistration);
-//        ServiceReference trackerReference = control.createMock(ServiceReference.class);
-//        dswContext.addServiceReference(trackerClass, trackerReference);
-//
-//        List property = asList(propValue);
-//        Dictionary properties = new Hashtable();
-//        properties.put(propKey, property);
-//        trackerRegistration.setProperties(properties);
-//        EasyMock.expectLastCall();
-//
-//        if (matchingInterfaces.size() == 0 && matchingFilters.size() > 0) {
-//            Iterator filters = matchingFilters.iterator();
-//            while (filters.hasNext()) {
-//                Filter f = control.createMock(Filter.class);
-//                dswContext.addFilter((String)filters.next(), f);
-//                f.match(EasyMock.isA(Dictionary.class));
-//                EasyMock.expectLastCall().andReturn(true);
-//            }
-//        }
-//
-//        control.replay();
-//
-//        CxfFindListenerHook hook = new CxfFindListenerHook(dswContext, null);
-//
-//        ListenerHook.ListenerInfo info = new ListenerHook.ListenerInfo() {
-//            public BundleContext getBundleContext() {
-//                return requestingContext;
-//            }
-//
-//            public String getFilter() {
-//                return filter;
-//            }
-//
-//            public boolean isRemoved() {
-//                return false;
-//            }
-//        };
-//        hook.added(Collections.singleton(info));
-//
-//        DiscoveredServiceTracker tracker = (DiscoveredServiceTracker)
-//            dswContext.getService(trackerReference);
-//        assertNotNull(tracker);
-//
-//        Collection interfaces = asList(serviceClass);
-//
-//        notifyAvailable(tracker, matchingInterfaces, matchingFilters, "1234");
-//        notifyAvailable(tracker, matchingInterfaces, matchingFilters, "5678");
-//        notifyAvailable(tracker, matchingInterfaces, matchingFilters, "1234");
-//
-//        notifyUnAvailable(tracker, "1234");
-//        notifyUnAvailable(tracker, "5678");
-//
-//        notifyAvailable(tracker, matchingInterfaces, matchingFilters , "1234");
-//
-//        control.verify();
-//
-//        Map<String, ServiceReference> registeredRefs = dswContext.getRegisteredReferences();
-//        assertNotNull(registeredRefs);
-//        assertEquals(2, registeredRefs.size());
-//        assertNotNull(registeredRefs.get(serviceClass));
-//        assertSame(serviceReference, registeredRefs.get(serviceClass));
-//
-//        Map<String, ServiceRegistration> registeredRegs = dswContext.getRegisteredRegistrations();
-//        assertNotNull(registeredRegs);
-//        assertEquals(2, registeredRegs.size());
-//        assertNotNull(registeredRegs.get(trackerClass));
-//        assertSame(trackerRegistration, registeredRegs.get(trackerClass));
-//
-//        List<Object> registeredServices = dswContext.getRegisteredServices();
-//        assertNotNull(registeredServices);
-//        assertEquals(2, registeredServices.size());
-//    }
-//
-//    @Test
-//    public void testConstructorAndGetters() {
-//        BundleContext bc = control.createMock(BundleContext.class);
-//        CxfRemoteServiceAdmin dp = control.createMock(CxfRemoteServiceAdmin.class);
-//        control.replay();
-//
-//        CxfFindListenerHook clh = new CxfFindListenerHook(bc, dp);
-//        assertSame(bc, clh.getContext());
-//        assertSame(dp, clh.getDistributionProvider());
-//    }
-//
-//    @Test
-//    public void testFindHook() {
-//        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-//
-//        final List<String> lookupCalls = new ArrayList<String>();
-//        CxfFindListenerHook fh = new CxfFindListenerHook(bc, null) {
-//            @Override
-//            protected synchronized void lookupDiscoveryService(
-//                    String interfaceName, String filterValue) {
-//                lookupCalls.add(interfaceName);
-//                lookupCalls.add(filterValue);
-//            }
-//        };
-//
-//        String clazz = "my.app.Class";
-//        String filter = "&(A=B)(C=D)";
-//        fh.find(null, clazz, filter, true, null);
-//
-//        assertEquals(Arrays.asList(clazz, filter), lookupCalls);
-//    }
-//
-//    private void notifyAvailable(DiscoveredServiceTracker tracker,
-//                                 Collection interfaces,
-//                                 Collection filters,
-//                                 String endpointId) {
-//        Map<String, Object> props = new Hashtable<String, Object>();
-//        props.put("osgi.remote.interfaces", "*");
-//        props.put("osgi.remote.endpoint.id", endpointId);
-//        tracker.serviceChanged(new Notification(AVAILABLE,
-//                                                TestService.class.getName(),
-//                                                interfaces,
-//                                                filters,
-//                                                props));
-//    }
-//
-//    private void notifyUnAvailable(DiscoveredServiceTracker tracker,
-//                                   String endpointId) {
-//        Map<String, Object> props = new Hashtable<String, Object>();
-//        props.put("osgi.remote.endpoint.id", endpointId);
-//        tracker.serviceChanged(new Notification(UNAVAILABLE,
-//                                                TestService.class.getName(),
-//                                                Collections.EMPTY_SET,
-//                                                Collections.EMPTY_SET,
-//                                                props));
-//    }
-//
-//    private List<String> asList(String s) {
-//        List l = new ArrayList<String>();
-//        l.add(s);
-//        return l;
-//    }
-//
-//    private String replacePredicate(String filter) {
-//        return filter.replace("objectClass", ServicePublication.SERVICE_INTERFACE_NAME);
-//    }
-//
-//    private class Notification implements DiscoveredServiceNotification {
-//        private int type;
-//        private ServiceEndpointDescription sed;
-//        private Collection interfaces;
-//        private Collection filters;
-//
-//        Notification(int type,
-//                     String interfaceName,
-//                     Collection interfaces,
-//                     Collection filters,
-//                     Map<String, Object> props) {
-//            this.type = type;
-//            this.sed = new ServiceEndpointDescriptionImpl(interfaceName, props);
-//            this.interfaces = interfaces;
-//            this.filters = filters;
-//        }
-//
-//        public int getType() {
-//            return type;
-//        }
-//
-//        public ServiceEndpointDescription getServiceEndpointDescription() {
-//            return sed;
-//        }
-//
-//        public Collection getInterfaces() {
-//            return interfaces;
-//        }
-//
-//        public Collection getFilters() {
-//            return filters;
-//        }
-//    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHookTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHookTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHookTest.java
deleted file mode 100644
index 40b40c5..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHookTest.java
+++ /dev/null
@@ -1,299 +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.hooks;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class CxfPublishHookTest extends Assert {
-
-    @Test
-    public void testDUMMY() throws Exception {
-    }
-
-    //
-    // private IMocksControl control;
-    //
-    // @Before
-    // public void setUp() {
-    // control = EasyMock.createNiceControl();
-    // }
-    //
-    // @Test
-    // public void testPublishSingleInterface() throws Exception {
-    // String[] serviceNames = new String[]{TestService.class.getName()};
-    // String[] addresses = new String[]{"http://localhost:9000/hello"};
-    // doTestPublishHook("remote-services.xml", serviceNames, addresses);
-    // }
-    //
-    // @Test
-    // public void testPublishSingleInterfaceAltFormat() throws Exception {
-    // String[] serviceNames = new String[]{TestService.class.getName()};
-    // String[] addresses = new String[]{"http://localhost:9000/hello"};
-    // doTestPublishHook("alt-remote-services.xml", serviceNames, addresses);
-    // }
-    //
-    // @Test
-    // public void testPublishMultiInterface() throws Exception {
-    // String[] serviceNames = new String[]{TestService.class.getName(),
-    // AdditionalInterface.class.getName()};
-    // String[] addresses = new String[]{"http://localhost:9001/hello",
-    // "http://localhost:9002/hello"};
-    // doTestPublishHook("multi-services.xml", serviceNames, addresses);
-    // }
-    //
-    // @SuppressWarnings("unchecked")
-    // private void doTestPublishHook(String remoteServices,
-    // String[] serviceNames,
-    // String[] addresses) throws Exception {
-    //
-    // Bundle bundle = control.createMock(Bundle.class);
-    // bundle.findEntries(EasyMock.eq("OSGI-INF/remote-service"),
-    // EasyMock.eq("*.xml"), EasyMock.anyBoolean());
-    // EasyMock.expectLastCall().andReturn(Collections.enumeration(
-    // Arrays.asList(getClass().getResource("/OSGI-INF/remote-service/" + remoteServices))));
-    // Dictionary<String, String> bundleHeaders = new Hashtable<String, String>();
-    // bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_NAME,
-    // "Test Bundle");
-    // bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_VERSION,
-    // "1.0.0");
-    // bundle.getHeaders();
-    // EasyMock.expectLastCall().andReturn(bundleHeaders).anyTimes();
-    // BundleContext requestingContext = control.createMock(BundleContext.class);
-    // bundle.getBundleContext();
-    // EasyMock.expectLastCall().andReturn(requestingContext).anyTimes();
-    //
-    // TestService serviceObject = new TestServiceImpl();
-    // Dictionary serviceProps = new Hashtable();
-    //
-    // ServiceReference sref = control.createMock(ServiceReference.class);
-    // sref.getBundle();
-    // EasyMock.expectLastCall().andReturn(bundle).anyTimes();
-    // sref.getProperty(Constants.OBJECTCLASS);
-    // EasyMock.expectLastCall().andReturn(serviceNames).anyTimes();
-    // sref.getPropertyKeys();
-    // EasyMock.expectLastCall().andReturn(new String[]{}).anyTimes();
-    //
-    // BundleTestContext dswContext = new BundleTestContext(bundle);
-    //
-    // ServiceRegistration[] serviceRegistrations =
-    // new ServiceRegistration[serviceNames.length];
-    //
-    // for (int i = 0; i < serviceNames.length ; i++) {
-    // serviceRegistrations[i] =
-    // control.createMock(ServiceRegistration.class);
-    // dswContext.addServiceRegistration(serviceNames[i],
-    // serviceRegistrations[i]);
-    // dswContext.addServiceReference(serviceNames[i], sref);
-    // }
-    // dswContext.registerService(serviceNames, serviceObject, serviceProps);
-    //
-    // Server server = control.createMock(Server.class);
-    //
-    // String publicationClass = ServicePublication.class.getName();
-    // ServiceRegistration publicationRegistration =
-    // control.createMock(ServiceRegistration.class);
-    // publicationRegistration.unregister();
-    // EasyMock.expectLastCall().times(serviceNames.length);
-    // dswContext.addServiceRegistration(publicationClass, publicationRegistration);
-    // ServiceReference publicationReference =
-    // control.createMock(ServiceReference.class);
-    // dswContext.addServiceReference(publicationClass, publicationReference);
-    // control.replay();
-    //
-    // TestPublishHook hook = new TestPublishHook(dswContext,
-    // serviceObject,
-    // server);
-    // hook.publishEndpoint(sref);
-    // hook.verify();
-    //
-    // assertEquals(1, hook.getEndpoints().size());
-    // List<EndpointInfo> list = hook.getEndpoints().get(sref);
-    // assertNotNull(list);
-    // assertEquals(serviceNames.length, list.size());
-    // for (int i = 0; i < serviceNames.length; i++) {
-    // assertNotNull(list.get(i));
-    // ServiceEndpointDescription sd = list.get(i).getServiceDescription();
-    // assertNotNull(sd);
-    // assertNotNull(sd.getProvidedInterfaces());
-    // assertEquals(1, sd.getProvidedInterfaces().size());
-    // Collection names = sd.getProvidedInterfaces();
-    // assertEquals(1, names.size());
-    // assertEquals(serviceNames[i], names.toArray()[0]);
-    // String excludeProp = "osgi.remote.interfaces";
-    // assertNull(sd.getProperties().get(excludeProp));
-    // String addrProp =
-    // org.apache.cxf.dosgi.dsw.Constants.WS_ADDRESS_PROPERTY_OLD;
-    // assertEquals(addresses[i], sd.getProperties().get(addrProp));
-    // }
-    //
-    // Map<String, ServiceRegistration> registeredRegs =
-    // dswContext.getRegisteredRegistrations();
-    // assertNotNull(registeredRegs);
-    // assertEquals(serviceNames.length + 1, registeredRegs.size());
-    // assertNotNull(registeredRegs.get(publicationClass));
-    // assertSame(publicationRegistration, registeredRegs.get(publicationClass));
-    //
-    // Map<String, List<Dictionary>> registeredProps =
-    // dswContext.getRegisteredProperties();
-    // assertNotNull(registeredProps);
-    // assertEquals(serviceNames.length + 1, registeredProps.size());
-    // assertNotNull(registeredProps.get(publicationClass));
-    // List<Dictionary> propsList = registeredProps.get(publicationClass);
-    // assertEquals(serviceNames.length, propsList.size());
-    // for (Dictionary props : propsList) {
-    // Collection interfaces =
-    // (Collection)props.get(SERVICE_INTERFACE_NAME);
-    // assertNotNull(interfaces);
-    // assertTrue(interfaces.contains(TestService.class.getName())
-    // || interfaces.contains(AdditionalInterface.class.getName()));
-    // }
-    //
-    // hook.removeEndpoints();
-    //
-    // control.verify();
-    // }
-    //
-    // @SuppressWarnings("unchecked")
-    // @Test
-    // public void testPublishMultipleTimes() {
-    // Bundle bundle = control.createMock(Bundle.class);
-    // bundle.findEntries(EasyMock.eq("OSGI-INF/remote-service"),
-    // EasyMock.eq("*.xml"), EasyMock.anyBoolean());
-    // EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
-    // public Object answer() throws Throwable {
-    // return Collections.enumeration(Arrays.asList(
-    // getClass().getResource("/OSGI-INF/remote-service/remote-services.xml")));
-    // }
-    // }).anyTimes();
-    // Dictionary<String, String> bundleHeaders = new Hashtable<String, String>();
-    // bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_NAME,
-    // "org.apache.cxf.example.bundle");
-    // bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_VERSION,
-    // "1.0.0");
-    // bundle.getHeaders();
-    // EasyMock.expectLastCall().andReturn(bundleHeaders).anyTimes();
-    // BundleContext requestingContext = control.createMock(BundleContext.class);
-    // bundle.getBundleContext();
-    // EasyMock.expectLastCall().andReturn(requestingContext).anyTimes();
-    //
-    // TestService serviceObject = new TestServiceImpl();
-    // Dictionary serviceProps = new Hashtable();
-    //
-    // ServiceReference sref = control.createMock(ServiceReference.class);
-    // sref.getBundle();
-    // EasyMock.expectLastCall().andReturn(bundle).anyTimes();
-    // sref.getProperty(Constants.OBJECTCLASS);
-    // String[] serviceNames = {TestService.class.getName()};
-    // EasyMock.expectLastCall().andReturn(serviceNames).anyTimes();
-    // sref.getPropertyKeys();
-    // EasyMock.expectLastCall().andReturn(new String[]{}).anyTimes();
-    //
-    // BundleTestContext dswContext = new BundleTestContext(bundle);
-    // ServiceRegistration[] serviceRegistrations =
-    // new ServiceRegistration[serviceNames.length];
-    // for (int i = 0; i < serviceNames.length ; i++) {
-    // serviceRegistrations[i] =
-    // control.createMock(ServiceRegistration.class);
-    // dswContext.addServiceRegistration(serviceNames[i],
-    // serviceRegistrations[i]);
-    // dswContext.addServiceReference(serviceNames[i], sref);
-    // }
-    // dswContext.registerService(serviceNames, serviceObject, serviceProps);
-    //
-    // final Server server = control.createMock(Server.class);
-    // control.replay();
-    //
-    // CxfPublishHook hook = new CxfPublishHook(dswContext, null) {
-    // @Override
-    // Server createServer(ServiceReference sref, ServiceEndpointDescription sd) {
-    // return server;
-    // }
-    // };
-    // assertNull("Precondition not met", hook.getEndpoints().get(sref));
-    // hook.publishEndpoint(sref);
-    // assertEquals(1, hook.getEndpoints().get(sref).size());
-    //
-    // hook.endpoints.put(sref, new ArrayList<EndpointInfo>());
-    // assertEquals("Precondition failed", 0, hook.getEndpoints().get(sref).size());
-    // hook.publishEndpoint(sref);
-    // assertEquals(0, hook.getEndpoints().get(sref).size());
-    //
-    // control.verify();
-    // }
-    //
-    // private static class TestPublishHook extends CxfPublishHook {
-    //
-    // private boolean called;
-    // private TestService serviceObject;
-    // private Server server;
-    //
-    // public TestPublishHook(BundleContext bc, TestService serviceObject,
-    // Server s) {
-    // super(bc, null);
-    // this.serviceObject = serviceObject;
-    // this.server = s;
-    // }
-    //
-    // @Override
-    // protected ConfigurationTypeHandler getHandler(ServiceEndpointDescription sd,
-    // Map<String, Object> props) {
-    // return new ConfigurationTypeHandler() {
-    // public String getType() {
-    // return "test";
-    // }
-    //
-    // public Object createProxy(ServiceReference sr,
-    // BundleContext dswContext, BundleContext callingContext,
-    // Class<?> iClass, ServiceEndpointDescription sd) {
-    // throw new UnsupportedOperationException();
-    // }
-    //
-    // public Server createServer(ServiceReference sr,
-    // BundleContext dswContext, BundleContext callingContext,
-    // ServiceEndpointDescription sd, Class<?> iClass, Object serviceBean) {
-    // Assert.assertSame(serviceBean, serviceObject);
-    // TestPublishHook.this.setCalled();
-    // Map props = sd.getProperties();
-    // String address = (String)props.get(WS_ADDRESS_PROPERTY);
-    // if (address != null) {
-    // props.put(ENDPOINT_LOCATION, address);
-    // }
-    // return server;
-    // }
-    //
-    // };
-    // }
-    //
-    // public void setCalled() {
-    // called = true;
-    // }
-    //
-    // public void verify() {
-    // Assert.assertTrue(called);
-    // }
-    // }
-    //
-    // public interface AdditionalInterface {
-    // }
-    //
-    // private static class TestServiceImpl implements TestService, AdditionalInterface {
-    //
-    // }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtilsTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtilsTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtilsTest.java
deleted file mode 100644
index c004702..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtilsTest.java
+++ /dev/null
@@ -1,116 +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.hooks;
-
-import junit.framework.TestCase;
-
-public class ServiceHookUtilsTest extends TestCase {
-
-    public void testDUMMY() {
-        assertTrue(true);
-    }
-
-/*
-    public void testCreateServer() {
-        IMocksControl control = EasyMock.createNiceControl();
-
-        Server srvr = control.createMock(Server.class);
-        ServiceReference serviceReference = control.createMock(ServiceReference.class);
-        BundleContext dswContext = control.createMock(BundleContext.class);
-        BundleContext callingContext = control.createMock(BundleContext.class);
-        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("java.lang.String");
-        Object service = "hi";
-
-        ConfigurationTypeHandler handler = control.createMock(ConfigurationTypeHandler.class);
-        handler.createServer(serviceReference, dswContext, callingContext, sd, String.class, service);
-        EasyMock.expectLastCall().andReturn(srvr);
-        control.replay();
-
-        assertSame(srvr,
-            ServiceHookUtils.createServer(handler, serviceReference, dswContext, callingContext, sd, service));
-    }
-
-    public void testNoServerWhenNoInterfaceSpecified() {
-        IMocksControl control = EasyMock.createNiceControl();
-
-        Server srvr = control.createMock(Server.class);
-        ServiceReference serviceReference = control.createMock(ServiceReference.class);
-        BundleContext dswContext = control.createMock(BundleContext.class);
-        BundleContext callingContext = control.createMock(BundleContext.class);
-        ServiceEndpointDescription sd = mockServiceDescription(control, "Foo");
-        Object service = "hi";
-
-        ConfigurationTypeHandler handler = control.createMock(ConfigurationTypeHandler.class);
-        handler.createServer(serviceReference, dswContext, callingContext, sd, String.class, service);
-        EasyMock.expectLastCall().andReturn(srvr);
-        control.replay();
-
-        assertNull(ServiceHookUtils.createServer(handler, serviceReference, dswContext,
-                                                 callingContext, sd, service));
-    }
-
-    public void testPublish() throws Exception {
-        Map<String, Object> props = new HashMap<String, Object>();
-        props.put("foo", "bar");
-        props.put(ServicePublication.ENDPOINT_LOCATION, "http:localhost/xyz");
-        ServiceEndpointDescriptionImpl sed = new ServiceEndpointDescriptionImpl(String.class.getName(), props);
-        assertEquals(new URI("http:localhost/xyz"), sed.getLocation());
-
-        final Dictionary<String, Object> expectedProps = new Hashtable<String, Object>();
-        expectedProps.put(ServicePublication.SERVICE_PROPERTIES, props);
-        expectedProps.put(ServicePublication.SERVICE_INTERFACE_NAME, Collections.singleton(String.class.getName()));
-        expectedProps.put(ServicePublication.ENDPOINT_LOCATION, new URI("http:localhost/xyz"));
-
-        BundleContext bc = EasyMock.createMock(BundleContext.class);
-        EasyMock.expect(bc.registerService(
-            EasyMock.eq(ServicePublication.class.getName()),
-            EasyMock.anyObject(),
-            (Dictionary<?, ?>) EasyMock.anyObject()))
-                .andAnswer(new IAnswer<ServiceRegistration>() {
-                    public ServiceRegistration answer() throws Throwable {
-                        assertTrue(EasyMock.getCurrentArguments()[1] instanceof ServicePublication);
-                        Dictionary<?, ?> actualProps =
-                            (Dictionary<?, ?>) EasyMock.getCurrentArguments()[2];
-                        UUID uuid = UUID.fromString(actualProps.get(ServicePublication.ENDPOINT_SERVICE_ID)
-                                                        .toString());
-                        expectedProps.put(ServicePublication.ENDPOINT_SERVICE_ID, uuid.toString());
-                        assertEquals(expectedProps, actualProps);
-                        return EasyMock.createMock(ServiceRegistration.class);
-                    }
-                });
-        EasyMock.replay(bc);
-
-        ServiceHookUtils.publish(bc, null, sed);
-        EasyMock.verify(bc);
-    }
-
-    private ServiceEndpointDescription mockServiceDescription(IMocksControl control,
-                                                              String... interfaceNames) {
-        List<String> iList = new ArrayList<String>();
-        for (String iName : interfaceNames) {
-            iList.add(iName);
-        }
-        ServiceEndpointDescription sd = control.createMock(ServiceEndpointDescription.class);
-        sd.getProvidedInterfaces();
-        EasyMock.expectLastCall().andReturn(iList);
-        return sd;
-    }
-*/
-}
-

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/TestService.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/TestService.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/TestService.java
deleted file mode 100644
index 07b5088..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/TestService.java
+++ /dev/null
@@ -1,22 +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.hooks;
-
-public interface TestService {
-}