cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1401268 - in /cxf/dosgi/trunk: dsw/cxf-dsw/ dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/ dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/ dsw/cxf-dsw/src/main/java/...
Date Tue, 23 Oct 2012 12:23:03 GMT
Author: cschneider
Date: Tue Oct 23 12:23:01 2012
New Revision: 1401268

URL: http://svn.apache.org/viewvc?rev=1401268&view=rev
Log:
DOSGI-130 Switch to interfaces for some collections, remove dependency cycles

Added:
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java
      - copied, changed from r1400871, cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java   (with props)
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/ClassUtils.java
      - copied, changed from r1400871, cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/ClassUtils.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java
      - copied, changed from r1400871, cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/OsgiUtils.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/Utils.java
      - copied, changed from r1400871, cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/Utils.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/
    cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/ClassUtilsTest.java
      - copied, changed from r1400064, cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ClassUtilsTest.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/OsgiUtilsTest.java
      - copied, changed from r1400064, cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/OsgiUtilsTest.java
Removed:
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/ClassUtils.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/OsgiUtils.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/Utils.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ClassUtilsTest.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/OsgiUtilsTest.java
Modified:
    cxf/dosgi/trunk/dsw/cxf-dsw/pom.xml
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractConfigurationHandler.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactory.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceConfigurationTypeHandler.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSHttpServiceConfigurationTypeHandler.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminInstance.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClientServiceFactoryTest.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceConfigurationTypeHandlerTest.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/UtilsTest.java
    cxf/dosgi/trunk/felix/   (props changed)

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/pom.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/pom.xml?rev=1401268&r1=1401267&r2=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/pom.xml (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/pom.xml Tue Oct 23 12:23:01 2012
@@ -19,11 +19,9 @@
 -->
 
     <modelVersion>4.0.0</modelVersion>
-    <groupId>org.apache.cxf.dosgi</groupId>
     <artifactId>cxf-dosgi-ri-dsw-cxf</artifactId>
     <packaging>bundle</packaging>
     <name>Distributed OSGi Distribution Software Bundle</name>
-    <version>1.4-SNAPSHOT</version>
 
     <parent>
         <groupId>org.apache.cxf.dosgi</groupId>

Copied: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java (from r1400871, cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java)
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java?p2=cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java&p1=cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java&r1=1400871&r2=1401268&rev=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java Tue Oct 23 12:23:01 2012
@@ -28,6 +28,7 @@ import org.apache.cxf.common.logging.Log
 import org.apache.cxf.dosgi.dsw.decorator.ServiceDecorator;
 import org.apache.cxf.dosgi.dsw.decorator.ServiceDecoratorImpl;
 import org.apache.cxf.dosgi.dsw.qos.IntentMap;
+import org.apache.cxf.dosgi.dsw.qos.IntentUtils;
 import org.apache.cxf.dosgi.dsw.service.RemoteServiceadminFactory;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
@@ -65,7 +66,8 @@ public class Activator implements Manage
     }
 
     private RemoteServiceadminFactory registerRemoteServiceAdminService() {
-        RemoteServiceadminFactory rsaf = new RemoteServiceadminFactory(bc);
+    	IntentMap intentMap = IntentUtils.getIntentMap(bc);
+        RemoteServiceadminFactory rsaf = new RemoteServiceadminFactory(bc, intentMap);
         Hashtable<String, Object> props = new Hashtable<String, Object>();
 
         // TODO .... RemoteAdminService.XXX
@@ -73,8 +75,8 @@ public class Activator implements Manage
         // props.put(DistributionProvider.PRODUCT_VERSION, getHeader("Bundle-Version"));
         // props.put(DistributionProvider.VENDOR_NAME, getHeader("Bundle-Vendor"));
 
-        String[] supportedIntents = getIntentMap().getIntents().keySet().toArray(new String[] {});
-        String siString = OsgiUtils.formatIntents(supportedIntents);
+        String[] supportedIntents = intentMap.getIntents().keySet().toArray(new String[] {});
+        String siString = IntentUtils.formatIntents(supportedIntents);
         props.put("remote.intents.supported", siString);
 
         // // TODO make this a little smarter
@@ -91,10 +93,6 @@ public class Activator implements Manage
         return rsaf;
     }
 
-    IntentMap getIntentMap() {
-        return OsgiUtils.getIntentMap(bc);
-    }
-
     public void stop() {
         LOG.fine("RemoteServiceAdmin Implementation is shutting down now");
         

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractConfigurationHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractConfigurationHandler.java?rev=1401268&r1=1401267&r2=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractConfigurationHandler.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractConfigurationHandler.java Tue Oct 23 12:23:01 2012
@@ -32,8 +32,8 @@ import java.util.logging.Logger;
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.dosgi.dsw.Constants;
-import org.apache.cxf.dosgi.dsw.OsgiUtils;
-import org.apache.cxf.dosgi.dsw.service.Utils;
+import org.apache.cxf.dosgi.dsw.qos.IntentUtils;
+import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.remoteserviceadmin.RemoteConstants;
 
@@ -134,7 +134,7 @@ public abstract class AbstractConfigurat
         }
         
         {
-            String[] allIntents = Utils.mergeArrays(intents, Utils.getInetntsImplementedByTheService(sd));
+            String[] allIntents = IntentUtils.mergeArrays(intents, IntentUtils.getInetntsImplementedByTheService(sd));
             props.put(RemoteConstants.SERVICE_INTENTS, allIntents);
         }
 

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java?rev=1401268&r1=1401267&r2=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java Tue Oct 23 12:23:01 2012
@@ -35,10 +35,11 @@ import javax.xml.namespace.QName;
 import org.apache.cxf.binding.BindingConfiguration;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.PackageUtils;
-import org.apache.cxf.dosgi.dsw.ClassUtils;
 import org.apache.cxf.dosgi.dsw.Constants;
-import org.apache.cxf.dosgi.dsw.OsgiUtils;
 import org.apache.cxf.dosgi.dsw.qos.IntentMap;
+import org.apache.cxf.dosgi.dsw.qos.IntentUtils;
+import org.apache.cxf.dosgi.dsw.util.ClassUtils;
+import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
 import org.apache.cxf.endpoint.AbstractEndpointFactory;
 import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.frontend.ClientFactoryBean;
@@ -305,7 +306,7 @@ public abstract class AbstractPojoConfig
     }
 
     IntentMap getIntentMap(BundleContext callingContext) {
-        return OsgiUtils.getIntentMap(callingContext);
+        return IntentUtils.getIntentMap(callingContext);
     }
 
     public String getType() {
@@ -314,11 +315,11 @@ public abstract class AbstractPojoConfig
 
     private static String[] getRequestedIntents(Map sd) {
         Collection<String> intents = Arrays.asList(
-            OsgiUtils.parseIntents(OsgiUtils.getProperty(sd, RemoteConstants.SERVICE_EXPORTED_INTENTS)));        
+            IntentUtils.parseIntents(OsgiUtils.getProperty(sd, RemoteConstants.SERVICE_EXPORTED_INTENTS)));        
         Collection<String> extraIntents = Arrays.asList(
-            OsgiUtils.parseIntents(OsgiUtils.getProperty(sd, RemoteConstants.SERVICE_EXPORTED_INTENTS)));
+            IntentUtils.parseIntents(OsgiUtils.getProperty(sd, RemoteConstants.SERVICE_EXPORTED_INTENTS)));
         Collection<String> oldIntents = Arrays.asList(
-            OsgiUtils.parseIntents(OsgiUtils.getProperty(sd, Constants.EXPORTED_INTENTS_OLD))); 
+            IntentUtils.parseIntents(OsgiUtils.getProperty(sd, Constants.EXPORTED_INTENTS_OLD))); 
         
         Set<String> allIntents = new HashSet<String>(intents.size() + extraIntents.size() + oldIntents.size());
         allIntents.addAll(intents);

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactory.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactory.java?rev=1401268&r1=1401267&r2=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactory.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactory.java Tue Oct 23 12:23:01 2012
@@ -25,7 +25,8 @@ import java.util.logging.Logger;
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.dosgi.dsw.Constants;
-import org.apache.cxf.dosgi.dsw.OsgiUtils;
+import org.apache.cxf.dosgi.dsw.qos.IntentUtils;
+import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
 import org.osgi.framework.BundleContext;
 
 public final class ConfigTypeHandlerFactory {
@@ -79,7 +80,7 @@ public final class ConfigTypeHandlerFact
             String intentsProperty = OsgiUtils.getProperty(serviceProperties, Constants.EXPORTED_INTENTS);
             boolean hasHttpIntent = false, hasSoapIntent = false;
             if (intentsProperty != null) {
-                String[] intents = OsgiUtils.parseIntents(intentsProperty);
+                String[] intents = IntentUtils.parseIntents(intentsProperty);
                 for (int i = 0; i < intents.length; i++) {
                     if (intents[i].indexOf("SOAP") > -1) {
                         hasSoapIntent = true;

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceConfigurationTypeHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceConfigurationTypeHandler.java?rev=1401268&r1=1401267&r2=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceConfigurationTypeHandler.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceConfigurationTypeHandler.java Tue Oct 23 12:23:01 2012
@@ -35,8 +35,8 @@ import org.apache.cxf.aegis.databinding.
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.dosgi.dsw.Constants;
-import org.apache.cxf.dosgi.dsw.OsgiUtils;
 import org.apache.cxf.dosgi.dsw.service.ExportRegistrationImpl;
+import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.frontend.ClientProxyFactoryBean;
 import org.apache.cxf.frontend.ServerFactoryBean;

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSHttpServiceConfigurationTypeHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSHttpServiceConfigurationTypeHandler.java?rev=1401268&r1=1401267&r2=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSHttpServiceConfigurationTypeHandler.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSHttpServiceConfigurationTypeHandler.java Tue Oct 23 12:23:01 2012
@@ -26,8 +26,8 @@ import java.util.logging.Logger;
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.dosgi.dsw.Constants;
-import org.apache.cxf.dosgi.dsw.OsgiUtils;
 import org.apache.cxf.dosgi.dsw.service.ExportRegistrationImpl;
+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.lifecycle.SingletonResourceProvider;

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java?rev=1401268&r1=1401267&r2=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java Tue Oct 23 12:23:01 2012
@@ -28,8 +28,8 @@ import java.util.logging.Logger;
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.dosgi.dsw.Constants;
-import org.apache.cxf.dosgi.dsw.OsgiUtils;
 import org.apache.cxf.dosgi.dsw.service.ExportRegistrationImpl;
+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;

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java?rev=1401268&r1=1401267&r2=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java Tue Oct 23 12:23:01 2012
@@ -28,8 +28,8 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.dosgi.dsw.ClassUtils;
-import org.apache.cxf.dosgi.dsw.OsgiUtils;
+import org.apache.cxf.dosgi.dsw.util.ClassUtils;
+import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
 import org.apache.cxf.jaxrs.model.UserResource;
 import org.apache.cxf.jaxrs.provider.AegisElementProvider;
 import org.apache.cxf.jaxrs.utils.ResourceUtils;

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java?rev=1401268&r1=1401267&r2=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java Tue Oct 23 12:23:01 2012
@@ -26,8 +26,8 @@ import org.apache.cxf.aegis.databinding.
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.dosgi.dsw.Constants;
-import org.apache.cxf.dosgi.dsw.OsgiUtils;
 import org.apache.cxf.dosgi.dsw.service.ExportRegistrationImpl;
+import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.frontend.ClientProxyFactoryBean;
 import org.apache.cxf.frontend.ServerFactoryBean;

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java?rev=1401268&r1=1401267&r2=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java Tue Oct 23 12:23:01 2012
@@ -31,8 +31,8 @@ import org.apache.cxf.common.logging.Log
 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.OsgiUtils;
 import org.apache.cxf.dosgi.dsw.service.ExportRegistrationImpl;
+import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.frontend.ServerFactoryBean;
 import org.apache.cxf.jaxb.JAXBDataBinding;

Added: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java?rev=1401268&view=auto
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java (added)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java Tue Oct 23 12:23:01 2012
@@ -0,0 +1,130 @@
+package org.apache.cxf.dosgi.dsw.qos;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+
+import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
+import org.apache.cxf.dosgi.dsw.util.Utils;
+import org.apache.cxf.ws.policy.spring.PolicyNamespaceHandler;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
+import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext;
+
+public class IntentUtils {
+    private static final String[] INTENT_MAP = {
+        "/OSGI-INF/cxf/intents/intent-map.xml"
+    };
+
+	public static String formatIntents(String[] intents) {
+	    StringBuilder sb = new StringBuilder();
+	    boolean first = true;
+	    for (String intent : intents) {
+	        if (first) {
+	            first = false;
+	        } else {
+	            sb.append(' ');
+	        }
+	        sb.append(intent);
+	    }
+	    return sb.toString();
+	}
+
+	public static String[] parseIntents(String intentsSequence) {
+	    return intentsSequence == null ? new String[] {} : intentsSequence.split(" ");
+	}
+
+	public static IntentMap getIntentMap(BundleContext bundleContext) {
+	    IntentMap im = IntentUtils.readIntentMap(bundleContext);
+	    if (im == null) {
+	        // Couldn't read an intent map
+	        OsgiUtils.LOG.log(Level.FINE, "Using default intent map");
+	        im = new IntentMap();
+	        im.setIntents(new HashMap<String, Object>());
+	    }
+	    return im;
+	}
+
+	public static IntentMap readIntentMap(BundleContext bundleContext) {
+	    List<String> springIntentLocations = new ArrayList<String>();
+	    for (String mapFile : INTENT_MAP) {
+	        if (bundleContext.getBundle().getResource(mapFile) == null) {
+	            OsgiUtils.LOG.info("Could not find intent map file " + mapFile);
+	            return null;
+	        }
+	        springIntentLocations.add("classpath:" + mapFile);
+	    }
+	
+	    try {
+	        
+	        // switch to cxf bundle classloader for spring
+	    	ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+	        Thread.currentThread().setContextClassLoader(PolicyNamespaceHandler.class.getClassLoader());
+	        
+	        OsgiUtils.LOG.fine("Loading Intent map from "+springIntentLocations);
+	        OsgiBundleXmlApplicationContext ctx = new OsgiBundleXmlApplicationContext(springIntentLocations
+	            .toArray(new String[] {}));
+	        ctx.setPublishContextAsService(false);
+	        ctx.setBundleContext(bundleContext);
+	        ctx.refresh();
+	        OsgiUtils.LOG.fine("application context: " + ctx);
+	        IntentMap im = (IntentMap)ctx.getBean("intentMap");
+	        OsgiUtils.LOG.fine("retrieved intent map: " + im);
+	
+	        Thread.currentThread().setContextClassLoader(oldClassLoader);
+	
+	        return im;
+	    } catch (Throwable t) {
+	        OsgiUtils.LOG.log(Level.WARNING, "Intent map load failed: ", t);
+	        return null;
+	    }
+	}
+
+    @SuppressWarnings("rawtypes")
+    public static String[] getAllRequiredIntents(Map serviceProperties){
+        // Get the intents that need to be supported by the RSA
+        String[] requiredIntents = Utils.normalizeStringPlus(serviceProperties.get(RemoteConstants.SERVICE_EXPORTED_INTENTS));
+        if(requiredIntents==null){
+            requiredIntents = new String[0];
+        }
+        
+        { // merge with extra intents;
+            String[] requiredExtraIntents = Utils.normalizeStringPlus(serviceProperties.get(RemoteConstants.SERVICE_EXPORTED_INTENTS_EXTRA));
+            if(requiredExtraIntents!= null && requiredExtraIntents.length>0){
+                         
+                requiredIntents = IntentUtils.mergeArrays(requiredIntents, requiredExtraIntents);
+            }
+        }
+        
+        return requiredIntents;
+    }
+
+    @SuppressWarnings("rawtypes")
+    public static String[] getInetntsImplementedByTheService(Map serviceProperties){
+        // Get the Intents that are implemented by the service 
+        String[] serviceIntents = Utils.normalizeStringPlus(serviceProperties.get(RemoteConstants.SERVICE_INTENTS));
+        
+        return serviceIntents;
+    }
+
+    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);
+    
+        for (String s : a1) {
+            list.add(s);  
+        }
+        
+        for (String s : a2) {
+            if(!list.contains(s))
+                list.add(s);  
+        }
+        
+        return list.toArray(new String[list.size()]);
+    }
+
+}

Propchange: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java?rev=1401268&r1=1401267&r2=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java Tue Oct 23 12:23:01 2012
@@ -67,7 +67,7 @@ public class EventAdminHelper {
 
     public void notifyEventAdmin(RemoteServiceAdminEvent rsae) {
 
-        String topic = Utils.remoteServiceAdminEventTypeToString(rsae.getType());
+        String topic = remoteServiceAdminEventTypeToString(rsae.getType());
 
         Properties props = new Properties();
         setIfNotNull(props, "cause", rsae.getException());
@@ -131,4 +131,27 @@ public class EventAdminHelper {
         return eas;
     }
 
+    static String remoteServiceAdminEventTypeToString(int type){
+        switch (type) {
+        case RemoteServiceAdminEvent.EXPORT_ERROR:
+            return "EXPORT_ERROR";
+        case RemoteServiceAdminEvent.EXPORT_REGISTRATION:
+            return "EXPORT_REGISTRATION";
+        case RemoteServiceAdminEvent.EXPORT_UNREGISTRATION:
+            return "EXPORT_UNREGISTRATION";
+        case RemoteServiceAdminEvent.EXPORT_WARNING:
+            return "EXPORT_WARNING";
+        case RemoteServiceAdminEvent.IMPORT_ERROR:
+            return "IMPORT_ERROR";
+        case RemoteServiceAdminEvent.IMPORT_REGISTRATION:
+            return "IMPORT_REGISTRATION";
+        case RemoteServiceAdminEvent.IMPORT_UNREGISTRATION:
+            return "IMPORT_UNREGISTRATION";
+        case RemoteServiceAdminEvent.IMPORT_WARNING:
+            return "IMPORT_WARNING";    
+        default:
+            return "UNKNOWN_EVENT";
+        }
+    }
+
 }

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java?rev=1401268&r1=1401267&r2=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java Tue Oct 23 12:23:01 2012
@@ -33,13 +33,15 @@ import java.util.Properties;
 import java.util.logging.Logger;
 
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.dosgi.dsw.ClassUtils;
 import org.apache.cxf.dosgi.dsw.Constants;
-import org.apache.cxf.dosgi.dsw.OsgiUtils;
 import org.apache.cxf.dosgi.dsw.handlers.ClientServiceFactory;
 import org.apache.cxf.dosgi.dsw.handlers.ConfigTypeHandlerFactory;
 import org.apache.cxf.dosgi.dsw.handlers.ConfigurationTypeHandler;
 import org.apache.cxf.dosgi.dsw.qos.IntentMap;
+import org.apache.cxf.dosgi.dsw.qos.IntentUtils;
+import org.apache.cxf.dosgi.dsw.util.ClassUtils;
+import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
+import org.apache.cxf.dosgi.dsw.util.Utils;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
@@ -60,8 +62,8 @@ public class RemoteServiceAdminCore impl
     private final LinkedHashMap<EndpointDescription, Collection<ImportRegistrationImpl>> importedServices = new LinkedHashMap<EndpointDescription, Collection<ImportRegistrationImpl>>();
 
     private BundleContext bctx;
-
     private EventProducer eventProducer;
+    private IntentMap intentMap;
 
     private volatile boolean useMasterMap = true;
     private volatile String defaultPort;
@@ -79,9 +81,10 @@ public class RemoteServiceAdminCore impl
 
     protected final static String DEFAULT_CONFIGURATION = Constants.WS_CONFIG_TYPE;
 
-    public RemoteServiceAdminCore(BundleContext bc) {
+    public RemoteServiceAdminCore(BundleContext bc, IntentMap intentMap) {
         bctx = bc;
         eventProducer = new EventProducer(bctx);
+        this.intentMap = intentMap;
     }
 
     @SuppressWarnings("rawtypes")
@@ -136,19 +139,17 @@ public class RemoteServiceAdminCore impl
 
 
             if (additionalProperties != null) {// overlay properties with the additionalProperies
-                Utils.overlayProperties(serviceProperties,additionalProperties);
+                OsgiUtils.overlayProperties(serviceProperties,additionalProperties);
             }
 
             // Get the intents that need to be supported by the RSA
-            String[] requiredIntents = Utils.getAllRequiredIntents(serviceProperties);
+            String[] requiredIntents = IntentUtils.getAllRequiredIntents(serviceProperties);
 
             {
-                IntentMap im = OsgiUtils.getIntentMap(bctx);
-
                 List<String> unsupportedIntents = new ArrayList<String>();
 
                 for (String ri : requiredIntents) {
-                    if (!im.getIntents().containsKey(ri)) {
+                    if (!intentMap.getIntents().containsKey(ri)) {
                         unsupportedIntents.add(ri);
                     }
                 }

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminInstance.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminInstance.java?rev=1401268&r1=1401267&r2=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminInstance.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminInstance.java Tue Oct 23 12:23:01 2012
@@ -25,7 +25,7 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.cxf.dosgi.dsw.OsgiUtils;
+import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.remoteserviceadmin.EndpointDescription;

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java?rev=1401268&r1=1401267&r2=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java Tue Oct 23 12:23:01 2012
@@ -24,6 +24,7 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.dosgi.dsw.qos.IntentMap;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceFactory;
@@ -36,8 +37,8 @@ public class RemoteServiceadminFactory i
 
     private RemoteServiceAdminCore rsaCore;
 
-    public RemoteServiceadminFactory(BundleContext bc) {
-        rsaCore = new RemoteServiceAdminCore(bc);
+    public RemoteServiceadminFactory(BundleContext bc, IntentMap intentMap) {
+    	this.rsaCore = new RemoteServiceAdminCore(bc, intentMap);
     }
 
     public Object getService(Bundle b, ServiceRegistration sr) {

Copied: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/ClassUtils.java (from r1400871, cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/ClassUtils.java)
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/ClassUtils.java?p2=cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/ClassUtils.java&p1=cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/ClassUtils.java&r1=1400871&r2=1401268&rev=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/ClassUtils.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/ClassUtils.java Tue Oct 23 12:23:01 2012
@@ -16,7 +16,7 @@
   * specific language governing permissions and limitations 
   * under the License. 
   */
-package org.apache.cxf.dosgi.dsw;
+package org.apache.cxf.dosgi.dsw.util;
 
 import java.util.ArrayList;
 import java.util.Arrays;

Copied: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java (from r1400871, cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/OsgiUtils.java)
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java?p2=cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java&p1=cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/OsgiUtils.java&r1=1400871&r2=1401268&rev=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/OsgiUtils.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java Tue Oct 23 12:23:01 2012
@@ -16,188 +16,36 @@
  * specific language governing permissions and limitations 
  * under the License. 
  */
-package org.apache.cxf.dosgi.dsw;
+package org.apache.cxf.dosgi.dsw.util;
 
-import java.net.URL;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Dictionary;
 import java.util.Enumeration;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.Set;
 import java.util.UUID;
-import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.dosgi.dsw.qos.IntentMap;
-import org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore;
-import org.apache.cxf.ws.policy.spring.PolicyNamespaceHandler;
-import org.jdom.Document;
-import org.jdom.Element;
-import org.jdom.Namespace;
-import org.jdom.input.SAXBuilder;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.Constants;
 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.springframework.osgi.context.support.OsgiBundleXmlApplicationContext;
 
 public final class OsgiUtils {
     
-    private static final Logger LOG = LogUtils.getL7dLogger(OsgiUtils.class);
-
-    private static final String REMOTE_SERVICES_HEADER_NAME = "Remote-Service";
-    private static final String REMOTE_SERVICES_DIRECTORY = "OSGI-INF/remote-service";
-    private static final String REMOTE_SERVICES_NS = "http://www.osgi.org/xmlns/sd/v1.0.0";
-
-    static final String[] INTENT_MAP = {
-        "/OSGI-INF/cxf/intents/intent-map.xml"
-    };
-
-    private static final String SERVICE_DESCRIPTION_ELEMENT = "service-description";
+    public static final Logger LOG = LogUtils.getL7dLogger(OsgiUtils.class);
 
     private OsgiUtils() {
     }
 
-
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public static List<Element> getAllDescriptionElements(Bundle b) {
-        Object directory = null;
-
-        Dictionary headers = b.getHeaders();
-        if (headers != null) {
-            directory = headers.get(REMOTE_SERVICES_HEADER_NAME);
-        }
-
-        if (directory == null) {
-            directory = REMOTE_SERVICES_DIRECTORY;
-        }
-
-        Enumeration urls = b.findEntries(directory.toString(), "*.xml", false);
-        if (urls == null) {
-            return Collections.emptyList();
-        }
-
-        List<Element> elements = new ArrayList<Element>();
-        while (urls.hasMoreElements()) {
-            URL resourceURL = (URL)urls.nextElement();
-            try {
-                Document d = new SAXBuilder().build(resourceURL.openStream());
-                Namespace ns = Namespace.getNamespace(REMOTE_SERVICES_NS);
-                elements.addAll(d.getRootElement().getChildren(SERVICE_DESCRIPTION_ELEMENT, ns));
-            } catch (Exception ex) {
-                LOG.log(Level.WARNING, "Problem parsing: " + resourceURL, ex);
-            }
-        }
-        return elements;
-    }
-
-    public static Filter createFilter(BundleContext bc, String filterValue) {
-
-        if (filterValue == null) {
-            return null;
-        }
-
-        try {
-            return bc.createFilter(filterValue);
-        } catch (InvalidSyntaxException ex) {
-            LOG.warning("Invalid filter expression " + filterValue);
-        } catch (Exception ex) {
-            LOG.warning("Problem creating a Filter from " + filterValue);
-        }
-        return null;
-    }
-
-    public static String[] parseIntents(String intentsSequence) {
-        return intentsSequence == null ? new String[] {} : intentsSequence.split(" ");
-    }
-
-    public static String formatIntents(String[] intents) {
-        StringBuilder sb = new StringBuilder();
-        boolean first = true;
-        for (String intent : intents) {
-            if (first) {
-                first = false;
-            } else {
-                sb.append(' ');
-            }
-            sb.append(intent);
-        }
-        return sb.toString();
-    }
-
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public static <T> OsgiService<T> getOsgiService(BundleContext bc, Class<T> serviceClass) {
-        try {
-            ServiceReference sr = bc.getServiceReference(serviceClass.getName());
-            if (sr != null) {
-                Object o = bc.getService(sr);
-                if (o != null && serviceClass.isAssignableFrom(o.getClass())) {
-                    return new OsgiService(sr, o);
-                }
-            }
-        } catch (Exception ex) {
-            if (LOG.isLoggable(Level.FINE)) {
-                LOG.fine("Problem retrieving an OSGI service " + serviceClass.getName() + ", exception : "
-                         + ex.getMessage());
-            }
-        }
-        return null;
-    }
-
-    public static IntentMap getIntentMap(BundleContext bundleContext) {
-        IntentMap im = readIntentMap(bundleContext);
-        if (im == null) {
-            // Couldn't read an intent map
-            LOG.log(Level.FINE, "Using default intent map");
-            im = new IntentMap();
-            im.setIntents(new HashMap<String, Object>());
-        }
-        return im;
-    }
-
-    static IntentMap readIntentMap(BundleContext bundleContext) {
-        List<String> springIntentLocations = new ArrayList<String>();
-        for (String mapFile : INTENT_MAP) {
-            if (bundleContext.getBundle().getResource(mapFile) == null) {
-                LOG.info("Could not find intent map file " + mapFile);
-                return null;
-            }
-            springIntentLocations.add("classpath:" + mapFile);
-        }
-
-        try {
-            
-            // switch to cxf bundle classloader for spring
-            Thread.currentThread().setContextClassLoader(PolicyNamespaceHandler.class.getClassLoader());
-            
-            LOG.fine("Loading Intent map from "+springIntentLocations);
-            OsgiBundleXmlApplicationContext ctx = new OsgiBundleXmlApplicationContext(springIntentLocations
-                .toArray(new String[] {}));
-            ctx.setPublishContextAsService(false);
-            ctx.setBundleContext(bundleContext);
-            ctx.refresh();
-            LOG.fine("application context: " + ctx);
-            IntentMap im = (IntentMap)ctx.getBean("intentMap");
-            LOG.fine("retrieved intent map: " + im);
-            // switch back 
-            Thread.currentThread().setContextClassLoader(RemoteServiceAdminCore.class.getClassLoader());
-            
-            return im;
-        } catch (Throwable t) {
-            LOG.log(Level.WARNING, "Intent map load failed: ", t);
-            return null;
-        }
-    }
-
     // TODO : move these property helpers into PropertyUtils ?
 
     @SuppressWarnings("rawtypes")
@@ -303,5 +151,43 @@ public final class OsgiUtils {
             return uuid;
         }
     }
+
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    public static void overlayProperties(Properties serviceProperties, Map additionalProperties) {
+        Enumeration<Object> keys = serviceProperties.keys();
+        // Maps lower case key to original key
+        HashMap<String,String> keysLowerCase = new HashMap<String, String>();
+        while(keys.hasMoreElements()){
+            Object o = keys.nextElement(); 
+            if (o instanceof String) {
+                String ks = (String)o;
+                keysLowerCase.put(ks.toLowerCase(), ks);
+            }
+        }
+        
+        Set<Map.Entry> adProps = additionalProperties.entrySet();
+        for (Map.Entry e : adProps) {
+            // objectClass and service.id must not be overwritten
+            Object keyObj = e.getKey();
+            if (keyObj instanceof String && keyObj != null) {
+                String key = ((String)keyObj).toLowerCase();
+                if (org.osgi.framework.Constants.SERVICE_ID.toLowerCase().equals(key)
+                    || org.osgi.framework.Constants.OBJECTCLASS.toLowerCase().equals(key)) {
+                    LOG.info("exportService called with additional properties map that contained illegal key: "
+                              + key + "   The key is ignored");
+                    continue;
+                }else if(keysLowerCase.containsKey(key)){
+                    String origKey = keysLowerCase.get(key);
+                    serviceProperties.put(origKey, e.getValue());
+                    LOG.fine("Overwriting property [" + origKey + "]  with value [" + e.getValue() + "]");
+                }else{
+                    serviceProperties.put(e.getKey(), e.getValue());
+                    keysLowerCase.put(e.getKey().toString().toLowerCase(), e.getKey().toString());
+                }
+            }
+            
+            
+        }
+    }
     
 }

Copied: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/Utils.java (from r1400871, cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/Utils.java)
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/Utils.java?p2=cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/Utils.java&p1=cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/Utils.java&r1=1400871&r2=1401268&rev=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/Utils.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/Utils.java Tue Oct 23 12:23:01 2012
@@ -16,21 +16,14 @@
   * specific language governing permissions and limitations 
   * under the License. 
   */
-package org.apache.cxf.dosgi.dsw.service;
+package org.apache.cxf.dosgi.dsw.util;
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Enumeration;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
 import java.util.logging.Logger;
 
 import org.apache.cxf.common.logging.LogUtils;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-import org.osgi.service.remoteserviceadmin.RemoteServiceAdminEvent;
 
 public class Utils {
 
@@ -71,118 +64,6 @@ public class Utils {
 
         return null;
     }
-    
-    
-    
-    
-    public static String remoteServiceAdminEventTypeToString(int type){
-        switch (type) {
-        case RemoteServiceAdminEvent.EXPORT_ERROR:
-            return "EXPORT_ERROR";
-        case RemoteServiceAdminEvent.EXPORT_REGISTRATION:
-            return "EXPORT_REGISTRATION";
-        case RemoteServiceAdminEvent.EXPORT_UNREGISTRATION:
-            return "EXPORT_UNREGISTRATION";
-        case RemoteServiceAdminEvent.EXPORT_WARNING:
-            return "EXPORT_WARNING";
-        case RemoteServiceAdminEvent.IMPORT_ERROR:
-            return "IMPORT_ERROR";
-        case RemoteServiceAdminEvent.IMPORT_REGISTRATION:
-            return "IMPORT_REGISTRATION";
-        case RemoteServiceAdminEvent.IMPORT_UNREGISTRATION:
-            return "IMPORT_UNREGISTRATION";
-        case RemoteServiceAdminEvent.IMPORT_WARNING:
-            return "IMPORT_WARNING";    
-        default:
-            return "UNKNOWN_EVENT";
-        }
-    }
-    
-    
-    @SuppressWarnings("rawtypes")
-	public static String[] getAllRequiredIntents(Map serviceProperties){
-        // Get the intents that need to be supported by the RSA
-        String[] requiredIntents = Utils.normalizeStringPlus(serviceProperties.get(RemoteConstants.SERVICE_EXPORTED_INTENTS));
-        if(requiredIntents==null){
-            requiredIntents = new String[0];
-        }
-        
-        { // merge with extra intents;
-            String[] requiredExtraIntents = Utils.normalizeStringPlus(serviceProperties.get(RemoteConstants.SERVICE_EXPORTED_INTENTS_EXTRA));
-            if(requiredExtraIntents!= null && requiredExtraIntents.length>0){
-                         
-                requiredIntents = mergeArrays(requiredIntents, requiredExtraIntents);
-            }
-        }
-        
-        return requiredIntents;
-    }
-
-    @SuppressWarnings("rawtypes")
-	public static String[] getInetntsImplementedByTheService(Map serviceProperties){
-        // Get the Intents that are implemented by the service 
-        String[] serviceIntents = Utils.normalizeStringPlus(serviceProperties.get(RemoteConstants.SERVICE_INTENTS));
-        
-        return serviceIntents;
-    }
- 
-    
-    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);
-
-        for (String s : a1) {
-            list.add(s);  
-        }
-        
-        for (String s : a2) {
-            if(!list.contains(s))
-                list.add(s);  
-        }
-        
-        return list.toArray(new String[list.size()]);
-    }
-    
-    
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-	public static void overlayProperties(Properties serviceProperties, Map additionalProperties) {
-        Enumeration<Object> keys = serviceProperties.keys();
-        // Maps lower case key to original key
-        HashMap<String,String> keysLowerCase = new HashMap<String, String>();
-        while(keys.hasMoreElements()){
-            Object o = keys.nextElement(); 
-            if (o instanceof String) {
-                String ks = (String)o;
-                keysLowerCase.put(ks.toLowerCase(), ks);
-            }
-        }
-        
-        Set<Map.Entry> adProps = additionalProperties.entrySet();
-        for (Map.Entry e : adProps) {
-            // objectClass and service.id must not be overwritten
-            Object keyObj = e.getKey();
-            if (keyObj instanceof String && keyObj != null) {
-                String key = ((String)keyObj).toLowerCase();
-                if (org.osgi.framework.Constants.SERVICE_ID.toLowerCase().equals(key)
-                    || org.osgi.framework.Constants.OBJECTCLASS.toLowerCase().equals(key)) {
-                    LOG.info("exportService called with additional properties map that contained illegal key: "
-                              + key + "   The key is ignored");
-                    continue;
-                }else if(keysLowerCase.containsKey(key)){
-                    String origKey = keysLowerCase.get(key);
-                    serviceProperties.put(origKey, e.getValue());
-                    LOG.fine("Overwriting property [" + origKey + "]  with value [" + e.getValue() + "]");
-                }else{
-                    serviceProperties.put(e.getKey(), e.getValue());
-                    keysLowerCase.put(e.getKey().toString().toLowerCase(), e.getKey().toString());
-                }
-            }
-            
-            
-        }
-    }
 
     
 }

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClientServiceFactoryTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClientServiceFactoryTest.java?rev=1401268&r1=1401267&r2=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClientServiceFactoryTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClientServiceFactoryTest.java Tue Oct 23 12:23:01 2012
@@ -23,7 +23,6 @@ import java.util.Map;
 
 import junit.framework.TestCase;
 
-import org.apache.cxf.dosgi.dsw.hooks.TestService;
 import org.apache.cxf.dosgi.dsw.service.ImportRegistrationImpl;
 import org.easymock.EasyMock;
 import org.easymock.IMocksControl;

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceConfigurationTypeHandlerTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceConfigurationTypeHandlerTest.java?rev=1401268&r1=1401267&r2=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceConfigurationTypeHandlerTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceConfigurationTypeHandlerTest.java Tue Oct 23 12:23:01 2012
@@ -26,6 +26,7 @@ import java.util.Map;
 import junit.framework.TestCase;
 
 import org.apache.cxf.dosgi.dsw.Constants;
+import org.apache.cxf.dosgi.dsw.qos.IntentMap;
 import org.apache.cxf.dosgi.dsw.service.ExportRegistrationImpl;
 import org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore;
 import org.apache.cxf.endpoint.AbstractEndpointFactory;
@@ -143,7 +144,8 @@ public class HttpServiceConfigurationTyp
         
         final ServerFactoryBean sfb = createMockServerFactoryBean();
         
-        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext);
+        IntentMap intentMap = new IntentMap();
+		RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext, intentMap );
         Map<String, Object> handlerProps = new HashMap<String, Object>();
         HttpServiceConfigurationTypeHandler h = 
             new HttpServiceConfigurationTypeHandler(dswContext,  handlerProps) {
@@ -216,7 +218,8 @@ public class HttpServiceConfigurationTyp
         
         final ServerFactoryBean sfb = createMockServerFactoryBean();
         
-        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext);
+        IntentMap intentMap = new IntentMap();
+		RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext, intentMap);
         Map<String, Object> handlerProps = new HashMap<String, Object>();
         HttpServiceConfigurationTypeHandler h = 
             new HttpServiceConfigurationTypeHandler(dswContext,  handlerProps) {

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java?rev=1401268&r1=1401267&r2=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java Tue Oct 23 12:23:01 2012
@@ -367,7 +367,7 @@ public class PojoConfigurationTypeHandle
         AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
         control.replay();
 
-        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext);
+        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext, intentMap);
         AbstractPojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(dswContext,  handlerProps) {
             @Override
             IntentMap getIntentMap(BundleContext callingContext) {
@@ -403,7 +403,7 @@ public class PojoConfigurationTypeHandle
         AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
         control.replay();
 
-        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext);
+        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext, intentMap);
         PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(dswContext,  handlerProps) {
             @Override
             IntentMap getIntentMap(BundleContext callingContext) {
@@ -439,7 +439,7 @@ public class PojoConfigurationTypeHandle
         AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
         control.replay();
 
-        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext);
+        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext, intentMap);
         PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(dswContext,  handlerProps) {
             @Override
             IntentMap getIntentMap(BundleContext callingContext) {
@@ -477,7 +477,7 @@ public class PojoConfigurationTypeHandle
         AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
         control.replay();
         
-        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext);
+        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext, intentMap);
         PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(dswContext,  handlerProps) {
             @Override
             IntentMap getIntentMap(BundleContext callingContext) {
@@ -521,7 +521,7 @@ public class PojoConfigurationTypeHandle
         AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
         control.replay();
         
-        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext);
+        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext, intentMap);
         PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(dswContext,  handlerProps) {
             @Override
             IntentMap getIntentMap(BundleContext callingContext) {
@@ -560,7 +560,7 @@ public class PojoConfigurationTypeHandle
         AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
         control.replay();
         
-        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext);
+        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext, intentMap);
         PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(dswContext,  handlerProps) {
             @Override
             IntentMap getIntentMap(BundleContext callingContext) {
@@ -634,7 +634,7 @@ public class PojoConfigurationTypeHandle
         AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
         control.replay();
 
-        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext);
+        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext, masterIntentMap);
 
         Map<String, Object> props = new HashMap<String, Object>();
         props.put("osgi.remote.requires.intents", requestedIntents);
@@ -683,7 +683,7 @@ public class PojoConfigurationTypeHandle
         AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
         control.replay();
         
-        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext);
+        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext, masterIntentMap);
 
         Map<String, Object> props = new HashMap<String, Object>();
         props.put("osgi.remote.requires.intents", "B A");

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java?rev=1401268&r1=1401267&r2=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java Tue Oct 23 12:23:01 2012
@@ -25,6 +25,7 @@ import java.util.Map;
 import java.util.Properties;
 
 import org.apache.cxf.dosgi.dsw.handlers.ConfigurationTypeHandler;
+import org.apache.cxf.dosgi.dsw.qos.IntentMap;
 import org.easymock.IMocksControl;
 import org.easymock.classextension.EasyMock;
 import org.osgi.framework.Bundle;
@@ -59,7 +60,8 @@ public class RemoteServiceAdminCoreTest 
         ServiceReference sref = c.createMock(ServiceReference.class);
         EasyMock.expect(sref.getBundle()).andReturn(b).anyTimes();
 
-        RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc);
+        IntentMap IntentMap = new IntentMap();
+		RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, IntentMap );
 
         c.replay();
 
@@ -90,7 +92,8 @@ public class RemoteServiceAdminCoreTest 
         EasyMock.expect(bc.getBundle()).andReturn(b).anyTimes();
         EasyMock.expect(b.getSymbolicName()).andReturn("BundleName").anyTimes();
 
-        RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc) {
+        IntentMap intentMap = new IntentMap();
+		RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, intentMap ) {
             @Override
             protected void proxifyMatchingInterface(String interfaceName, ImportRegistrationImpl imReg,
                                                     ConfigurationTypeHandler handler,
@@ -155,7 +158,8 @@ public class RemoteServiceAdminCoreTest 
 
         c.replay();
 
-        RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc);
+        IntentMap IntentMap = new IntentMap();
+		RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, IntentMap );
 
         Properties serviceProperties = new Properties();
 
@@ -178,7 +182,8 @@ public class RemoteServiceAdminCoreTest 
 
         c.replay();
 
-        RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc);
+        IntentMap intentMap = new IntentMap();
+		RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, intentMap );
 
         Properties serviceProperties = new Properties();
 

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/UtilsTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/UtilsTest.java?rev=1401268&r1=1401267&r2=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/UtilsTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/UtilsTest.java Tue Oct 23 12:23:01 2012
@@ -26,6 +26,8 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Properties;
 
+import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
+import org.apache.cxf.dosgi.dsw.util.Utils;
 import org.junit.Test;
 import org.osgi.framework.Constants;
 
@@ -78,7 +80,7 @@ public class UtilsTest {
 
         { // nothing should change here
             Properties overload = new Properties();
-            Utils.overlayProperties(copy,overload);
+            OsgiUtils.overlayProperties(copy,overload);
 
             assertEquals(original.size(), copy.size());
             for (Object key : Collections.list(original.keys())) {
@@ -93,7 +95,7 @@ public class UtilsTest {
             Properties overload = new Properties();
             overload.put("new", "prop");
             
-            Utils.overlayProperties(copy,overload);
+            OsgiUtils.overlayProperties(copy,overload);
 
             assertEquals(original.size()+1, copy.size());
             for (Object key : Collections.list(original.keys())) {
@@ -111,7 +113,7 @@ public class UtilsTest {
             overload.put("new", "prop");
             overload.put("NEW", "prop");
             
-            Utils.overlayProperties(copy,overload);
+            OsgiUtils.overlayProperties(copy,overload);
 
             assertEquals(original.size()+1, copy.size());
             for (Object key : Collections.list(original.keys())) {
@@ -128,7 +130,7 @@ public class UtilsTest {
             Properties overload = new Properties();
             overload.put(Constants.OBJECTCLASS, "assd");
             overload.put(Constants.SERVICE_ID, "asasdasd");
-            Utils.overlayProperties(copy,overload);
+            OsgiUtils.overlayProperties(copy,overload);
 
             assertEquals(original.size(), copy.size());
             for (Object key : Collections.list(original.keys())) {
@@ -142,7 +144,7 @@ public class UtilsTest {
         { // overwrite own prop
             Properties overload = new Properties();
             overload.put("MyProp", "newValue");
-            Utils.overlayProperties(copy,overload);
+            OsgiUtils.overlayProperties(copy,overload);
 
             assertEquals(original.size(), copy.size());
             for (Object key : Collections.list(original.keys())) {
@@ -158,7 +160,7 @@ public class UtilsTest {
         { // overwrite own prop in different case
             Properties overload = new Properties();
             overload.put("MYPROP", "newValue");
-            Utils.overlayProperties(copy,overload);
+            OsgiUtils.overlayProperties(copy,overload);
 
             assertEquals(original.size(), copy.size());
             for (Object key : Collections.list(original.keys())) {

Copied: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/ClassUtilsTest.java (from r1400064, cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ClassUtilsTest.java)
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/ClassUtilsTest.java?p2=cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/ClassUtilsTest.java&p1=cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ClassUtilsTest.java&r1=1400064&r2=1401268&rev=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ClassUtilsTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/ClassUtilsTest.java Tue Oct 23 12:23:01 2012
@@ -16,7 +16,7 @@
   * specific language governing permissions and limitations 
   * under the License. 
   */
-package org.apache.cxf.dosgi.dsw;
+package org.apache.cxf.dosgi.dsw.util;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -24,6 +24,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+
 import junit.framework.TestCase;
 
 public class ClassUtilsTest extends TestCase {

Copied: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/OsgiUtilsTest.java (from r1400064, cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/OsgiUtilsTest.java)
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/OsgiUtilsTest.java?p2=cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/OsgiUtilsTest.java&p1=cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/OsgiUtilsTest.java&r1=1400064&r2=1401268&rev=1401268&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/OsgiUtilsTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/OsgiUtilsTest.java Tue Oct 23 12:23:01 2012
@@ -16,24 +16,20 @@
   * specific language governing permissions and limitations 
   * under the License. 
   */
-package org.apache.cxf.dosgi.dsw;
+package org.apache.cxf.dosgi.dsw.util;
 
-import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.Dictionary;
 import java.util.HashMap;
-import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 
 import junit.framework.TestCase;
 
+import org.apache.cxf.dosgi.dsw.qos.IntentUtils;
 import org.easymock.EasyMock;
 import org.easymock.IMocksControl;
-import org.jdom.Element;
-import org.jdom.Namespace;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
@@ -45,193 +41,6 @@ import org.osgi.service.remoteserviceadm
 
 public class OsgiUtilsTest extends TestCase {
 
-//    public void testGetPublishableInterfacesAll() throws Exception {
-//        doTestGetPublishableInterfaces("foo,bar,snafu",
-//                                       new String[] {"snafu", "foo", "bar"},
-//                                       new String[] {"foo", "bar", "snafu"});
-//    }
-//
-//    public void testGetPublishableInterfacesAllStringArray() throws Exception {
-//        doTestGetPublishableInterfaces(new String[] {"foo", "bar", "snafu"},
-//                                       new String[] {"snafu", "foo", "bar"},
-//                                       new String[] {"foo", "bar", "snafu"});
-//    }
-//
-//    public void testGetPublishableInterfacesAllCollection() throws Exception {
-//        doTestGetPublishableInterfaces(Arrays.asList("foo", "bar", "snafu"),
-//                                       new String[] {"snafu", "foo", "bar"},
-//                                       new String[] {"foo", "bar", "snafu"});
-//    }
-//
-//    public void testGetPublishableInterfacesSubset() throws Exception {
-//        doTestGetPublishableInterfaces("foo,snafu",
-//                                       new String[] {"snafu", "foo", "bar"},
-//                                       new String[] {"foo", "snafu"});
-//    }
-//
-//    public void testGetPublishableInterfacesSubsetStringArray() throws Exception {
-//        doTestGetPublishableInterfaces(new String[] {"foo", "snafu"},
-//                                       new String[] {"snafu", "foo", "bar"},
-//                                       new String[] {"foo", "snafu"});
-//    }
-//
-//    public void testGetPublishableInterfacesSubsetCollection() throws Exception {
-//        doTestGetPublishableInterfaces(Arrays.asList("foo", "snafu"),
-//                                       new String[] {"snafu", "foo", "bar"},
-//                                       new String[] {"foo", "snafu"});
-//    }
-//
-//    public void testGetPublishableInterfacesSuperset() throws Exception {
-//        doTestGetPublishableInterfaces("foo,bar,snafu",
-//                                       new String[] {"snafu", "bar"},
-//                                       new String[] {"bar", "snafu"});
-//    }
-//
-//    public void testGetPublishableInterfacesSupersetStringArray() throws Exception {
-//        doTestGetPublishableInterfaces(new String[] {"foo", "bar", "snafu"},
-//                                       new String[] {"snafu", "bar"},
-//                                       new String[] {"bar", "snafu"});
-//    }
-//
-//    public void testGetPublishableInterfacesSupersetCollection() throws Exception {
-//        doTestGetPublishableInterfaces(Arrays.asList("foo", "bar", "snafu"),
-//                                       new String[] {"snafu", "bar"},
-//                                       new String[] {"bar", "snafu"});
-//    }
-//
-//    public void testGetPublishableInterfacesNonexistant() throws Exception {
-//        doTestGetPublishableInterfaces("foo,bar,tofu",
-//                                       new String[] {"snafu", "foo", "bar"},
-//                                       new String[] {"foo", "bar"});
-//    }
-//
-//    public void testGetPublishableInterfacesNonexistantStringArray() throws Exception {
-//        doTestGetPublishableInterfaces(new String[] {"foo", "bar", "tofu"},
-//                                       new String[] {"snafu", "foo", "bar"},
-//                                       new String[] {"foo", "bar"});
-//    }
-//
-//    public void testGetPublishableInterfacesNonexistantCollection() throws Exception {
-//        doTestGetPublishableInterfaces(Arrays.asList("foo", "bar", "tofu"),
-//                                       new String[] {"snafu", "foo", "bar"},
-//                                       new String[] {"foo", "bar"});
-//    }
-//
-//    public void testGetPublishableInterfacesWildcarded() throws Exception {
-//        doTestGetPublishableInterfaces("*",
-//                                       new String[] {"snafu", "foo", "bar"},
-//                                       new String[] {"snafu", "foo", "bar"});
-//    }
-//
-//    public void testGetPublishableInterfacesWildcardedInArray() throws Exception {
-//        doTestGetPublishableInterfaces(Arrays.asList("*"),
-//                                       new String[] {"snafu", "foo", "bar"},
-//                                       new String[] {"snafu", "foo", "bar"});
-//    }
-
-//    public void doTestGetPublishableInterfaces(Object requested, 
-//                                               String[] actual, 
-//                                               String[] expected)
-//        throws Exception {
-//        ServiceEndpointDescription sd =
-//            EasyMock.createMock(ServiceEndpointDescription.class);
-//        ServiceReference sref = EasyMock.createMock(ServiceReference.class);
-//        EasyMock.expect(sd.getProperty("service.exported.interfaces")).andReturn(requested);
-//        EasyMock.expect(sd.getProperty("osgi.remote.interfaces")).andReturn(null);
-//        EasyMock.expect(sref.getProperty(org.osgi.framework.Constants.OBJECTCLASS)).andReturn(actual);
-//        EasyMock.replay(sd);
-//        EasyMock.replay(sref);
-//        
-//        String[] ret = OsgiUtils.getPublishableInterfaces(sd, sref);
-//
-//        assertNotNull(ret);
-//        assertEquals(expected.length, ret.length);
-//        for (int i = 0; i < expected.length; i++) {
-//            assertEquals(expected[i], ret[i]);
-//        }
-//
-//        EasyMock.verify();
-//    }
-
-//    public void testGetRemoteReferencesFromRegistrationProperties() throws Exception {
-//        final Map<String, Object> props = new HashMap<String, Object>();
-//        props.put(org.osgi.framework.Constants.OBJECTCLASS, new String [] {"myClass"});
-//        props.put("osgi.remote.interfaces", "*");
-//        props.put(Constants.WS_DATABINDING_PROP_KEY, "jaxb");
-//        
-//        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-//        EasyMock.expect(bc.getServiceReferences(ServiceDecorator.class.getName(), null)).
-//            andReturn(null).anyTimes();
-//        EasyMock.replay(bc);
-//        
-//        Bundle b = EasyMock.createNiceMock(Bundle.class);
-//        EasyMock.expect(b.getBundleContext()).andReturn(bc).anyTimes();
-//        EasyMock.replay(b);
-//        
-//        ServiceReference sr = EasyMock.createMock(ServiceReference.class);
-//        // set behaviour for getPropertyKeys() and getProperty() based on the map above.
-//        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.expect(sr.getBundle()).andReturn(b).anyTimes();
-//        EasyMock.replay(sr);
-//        
-//        // Actual test starts here
-//        ServiceEndpointDescription sd = OsgiUtils.getRemoteReference(sr, true);
-//        assertEquals("*", sd.getProperties().get("osgi.remote.interfaces"));
-//        assertEquals("jaxb", sd.getProperties().get(Constants.WS_DATABINDING_PROP_KEY));
-//        
-//        EasyMock.verify(sr);
-//    }
-    
-//    public void testSetAdditionalDecoratorProperties() throws Exception {
-//        final Map<String, Object> props = new HashMap<String, Object>();
-//        props.put(org.osgi.framework.Constants.OBJECTCLASS, new String [] {"myClass"});
-//        
-//        ServiceDecorator decorator = new ServiceDecorator() {            
-//            public void decorate(ServiceReference sref, Map<String, Object> properties) {
-//                properties.put("osgi.remote.interfaces", "*");               
-//            }
-//        };
-//        
-//        ServiceReference decoratorRef = EasyMock.createMock(ServiceReference.class);
-//        EasyMock.replay(decoratorRef);
-//        
-//        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-//        EasyMock.expect(bc.getServiceReferences(ServiceDecorator.class.getName(), null)).
-//            andReturn(new ServiceReference [] {decoratorRef}).anyTimes();
-//        EasyMock.expect(bc.getService(decoratorRef)).andReturn(decorator).anyTimes();
-//        EasyMock.replay(bc);
-//        
-//        Bundle b = EasyMock.createNiceMock(Bundle.class);
-//        EasyMock.expect(b.getBundleContext()).andReturn(bc).anyTimes();
-//        EasyMock.replay(b);
-//        
-//        ServiceReference sr = EasyMock.createMock(ServiceReference.class);
-//        // set behaviour for getPropertyKeys() and getProperty() based on the map above.
-//        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.expect(sr.getBundle()).andReturn(b).anyTimes();
-//        EasyMock.replay(sr);
-//        
-//        // Actual test starts here
-//        ServiceEndpointDescription sd = OsgiUtils.getRemoteReference(sr, true);
-//        assertEquals("*", sd.getProperties().get("osgi.remote.interfaces"));
-//        
-//        EasyMock.verify(sr);
-//    }
-
     public void testNoIntentMap() {
         Bundle b = EasyMock.createNiceMock(Bundle.class);
         EasyMock.replay(b);
@@ -239,84 +48,18 @@ public class OsgiUtilsTest extends TestC
         EasyMock.expect(bc.getBundle()).andReturn(b).anyTimes();
         EasyMock.replay(bc);
         
-        assertNull(OsgiUtils.readIntentMap(bc));
-        assertNotNull(OsgiUtils.getIntentMap(bc));
+        assertNull(IntentUtils.readIntentMap(bc));
+        assertNotNull(IntentUtils.getIntentMap(bc));
     }    
     
     public void testIntentsParsingAndFormatting() {
         String initial = "A SOAP_1.1 integrity";
 
         String[] expected = {"A", "SOAP_1.1", "integrity"};
-        String[] actual = OsgiUtils.parseIntents(initial);
+        String[] actual = IntentUtils.parseIntents(initial);
         assertTrue(Arrays.equals(expected, actual));
         
-        assertEquals(initial, OsgiUtils.formatIntents(actual));
-    }
-    
-    public void testNoRemoteServicesXMLFiles() {
-        Bundle b = EasyMock.createNiceMock(Bundle.class);
-        EasyMock.replay(b);
-        
-        List<Element> rsElements = OsgiUtils.getAllDescriptionElements(b);
-        assertEquals(0, rsElements.size());        
-    }
-    
-    public void testRemoteServicesXMLFiles() {
-        URL rs1URL = getClass().getResource("/test-resources/rs1.xml");
-        
-        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(rs1URL))).anyTimes();
-        EasyMock.replay(b);
-        
-        List<Element> rsElements = OsgiUtils.getAllDescriptionElements(b);
-        assertEquals(2, rsElements.size());
-        Namespace ns = Namespace.getNamespace("http://www.osgi.org/xmlns/sd/v1.0.0");
-        assertEquals("SomeService", rsElements.get(0).getChild("provide", ns).getAttributeValue("interface"));
-        assertEquals("SomeOtherService", rsElements.get(1).getChild("provide", ns).getAttributeValue("interface"));
-    }
-    
-    public void testMultiRemoteServicesXMLFiles() {
-        URL rs1URL = getClass().getResource("/test-resources/rs1.xml");
-        URL rs2URL = getClass().getResource("/test-resources/rs2.xml");
-        
-        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(rs1URL, rs2URL))).anyTimes();
-        EasyMock.replay(b);
-        
-        List<Element> rsElements = OsgiUtils.getAllDescriptionElements(b);
-        assertEquals(3, rsElements.size());
-        Namespace ns = Namespace.getNamespace("http://www.osgi.org/xmlns/sd/v1.0.0");
-        assertEquals("SomeService", rsElements.get(0).getChild("provide", ns).getAttributeValue("interface"));
-        assertEquals("SomeOtherService", rsElements.get(1).getChild("provide", ns).getAttributeValue("interface"));
-        assertEquals("org.example.Service", rsElements.get(2).getChild("provide", ns).getAttributeValue("interface"));
-    }
-    
-    @SuppressWarnings("unchecked")
-    public void testRemoteServicesXMLFileAlternateLocation() {
-        URL rs1URL = getClass().getResource("/test-resources/rs1.xml");
-        Dictionary headers = new Hashtable();        
-        headers.put("Remote-Service", "META-INF/osgi");
-        headers.put("Bundle-Name", "testing bundle");
-        
-        Bundle b = EasyMock.createNiceMock(Bundle.class);
-        EasyMock.expect(b.getHeaders()).andReturn(headers).anyTimes();
-        EasyMock.expect(b.findEntries(
-            EasyMock.eq("META-INF/osgi"), 
-            EasyMock.eq("*.xml"), EasyMock.anyBoolean())).andReturn(
-                Collections.enumeration(Arrays.asList(rs1URL))).anyTimes();
-        EasyMock.replay(b);
-        
-        List<Element> rsElements = OsgiUtils.getAllDescriptionElements(b);
-        assertEquals(2, rsElements.size());
-        Namespace ns = Namespace.getNamespace("http://www.osgi.org/xmlns/sd/v1.0.0");
-        assertEquals("SomeService", rsElements.get(0).getChild("provide", ns).getAttributeValue("interface"));
-        assertEquals("SomeOtherService", rsElements.get(1).getChild("provide", ns).getAttributeValue("interface"));
+        assertEquals(initial, IntentUtils.formatIntents(actual));
     }
 
     public void testMultiValuePropertyAsString() {

Propchange: cxf/dosgi/trunk/felix/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Oct 23 12:23:01 2012
@@ -1,3 +1,5 @@
 .settings
 
 .project
+
+target



Mime
View raw message