cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r785550 - in /cxf/dosgi/trunk/dsw/cxf-dsw/src: main/java/org/apache/cxf/dosgi/dsw/ main/java/org/apache/cxf/dosgi/dsw/handlers/ main/java/org/apache/cxf/dosgi/dsw/hooks/ test/java/org/apache/cxf/dosgi/dsw/hooks/
Date Wed, 17 Jun 2009 10:54:31 GMT
Author: davidb
Date: Wed Jun 17 10:54:31 2009
New Revision: 785550

URL: http://svn.apache.org/viewvc?rev=785550&view=rev
Log:
Setting the service.imported.configs property on the consumer side.

Modified:
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.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/ConfigurationTypeHandler.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/WsdlConfigurationTypeHandler.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/AbstractClientHook.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/AbstractClientHookTest.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHookTest.java

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java?rev=785550&r1=785549&r2=785550&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java Wed
Jun 17 10:54:31 2009
@@ -30,7 +30,9 @@
     public static final String EXPORTED_INTENTS_EXTRA = "service.exported.intents.extra";
     public static final String EXPORTED_INTENTS_OLD = "osgi.remote.requires.intents";
     
-    public static final String IMPORTED = "service.imported";    
+    public static final String IMPORTED = "service.imported";
+    public static final String IMPORTD_CONFIGS = "service.imported.configs";
+    
     public static final String INTENTS = "service.intents";
         
     // WSDL

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=785550&r1=785549&r2=785550&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
Wed Jun 17 10:54:31 2009
@@ -48,6 +48,7 @@
 public abstract class AbstractPojoConfigurationTypeHandler extends AbstractConfigurationHandler
{
     private static final Logger LOG = Logger.getLogger(AbstractPojoConfigurationTypeHandler.class.getName());
     private static final String PROVIDED_INTENT_VALUE = "PROVIDED";
+    private static final String CONFIGURATION_TYPE = "org.apache.cxf.ws";
     
     private IntentMap masterMap;
     
@@ -175,6 +176,10 @@
         return OsgiUtils.getIntentMap(callingContext);
     }
 
+    public String getType() {
+        return CONFIGURATION_TYPE;
+    }
+
     private static String[] getRequestedIntents(ServiceEndpointDescription sd) {
         Collection<String> intents = Arrays.asList(
             OsgiUtils.parseIntents(OsgiUtils.getProperty(sd, Constants.EXPORTED_INTENTS)));
       

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigurationTypeHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigurationTypeHandler.java?rev=785550&r1=785549&r2=785550&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigurationTypeHandler.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigurationTypeHandler.java
Wed Jun 17 10:54:31 2009
@@ -24,6 +24,8 @@
 import org.osgi.service.discovery.ServiceEndpointDescription;
 
 public interface ConfigurationTypeHandler {
+    String getType();
+    
     Server createServer(ServiceReference serviceReference,
                         BundleContext dswContext,
                         BundleContext callingContext, 

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=785550&r1=785549&r2=785550&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
Wed Jun 17 10:54:31 2009
@@ -45,7 +45,7 @@
     private static final Logger LOG = Logger.getLogger(HttpServiceConfigurationTypeHandler.class.getName());
 
     Set<ServiceReference> httpServiceReferences = new CopyOnWriteArraySet<ServiceReference>();

-
+    
     protected HttpServiceConfigurationTypeHandler(BundleContext dswBC,
                                                   CxfDistributionProvider dp,
                                                   Map<String, Object> handlerProps)
{

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=785550&r1=785549&r2=785550&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
Wed Jun 17 10:54:31 2009
@@ -36,7 +36,7 @@
 import org.osgi.service.discovery.ServiceEndpointDescription;
 
 public class WsdlConfigurationTypeHandler extends AbstractConfigurationHandler {
-
+    private static final String CONFIGURATION_TYPE = "wsdl";
     private static final Logger LOG = Logger.getLogger(WsdlConfigurationTypeHandler.class.getName());
     
     public WsdlConfigurationTypeHandler(BundleContext dswBC,
@@ -45,6 +45,10 @@
         super(dswBC, dp, handlerProps);
     }
     
+    public String getType() {
+        return CONFIGURATION_TYPE;
+    }
+
     public Object createProxy(ServiceReference serviceReference,
                               BundleContext dswContext,
                               BundleContext callingContext,

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/AbstractClientHook.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/AbstractClientHook.java?rev=785550&r1=785549&r2=785550&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/AbstractClientHook.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/AbstractClientHook.java
Wed Jun 17 10:54:31 2009
@@ -46,7 +46,6 @@
 import org.osgi.service.discovery.DiscoveredServiceNotification;
 import org.osgi.service.discovery.DiscoveredServiceTracker;
 import org.osgi.service.discovery.ServiceEndpointDescription;
-import org.osgi.service.distribution.DistributionConstants;
 
 
 public class AbstractClientHook extends AbstractHook {
@@ -119,7 +118,7 @@
                         ServiceRegistration proxyRegistration = 
                             actualContext.registerService(interfaceName,
                                                           new ClientServiceFactory(actualContext,
iClass, sd, handler),
-                                                          new Hashtable<String, Object>(getProperties(sd)));
+                                                          new Hashtable<String, Object>(getProperties(sd,
handler)));
                         cacheEndpointId(sd, proxyRegistration);
                     }
                 }
@@ -181,11 +180,20 @@
     }
 
     @SuppressWarnings("unchecked")
-    protected Map<String, Object> getProperties(ServiceEndpointDescription sd) {
+    protected Map<String, Object> getProperties(ServiceEndpointDescription sd, ConfigurationTypeHandler
handler) {
         Map<String, Object> props = new HashMap<String, Object>();        
         props.putAll(sd.getProperties());
+        
+        for (Iterator<Map.Entry<String, Object>> i = props.entrySet().iterator();
i.hasNext(); ) {
+            Map.Entry<String, Object> e = i.next();
+            if (e.getKey().startsWith("service.exported")) {
+                i.remove();
+            }
+        }
+        
         props.put(Constants.DSW_CLIENT_ID, getIdentificationProperty());
         props.put(Constants.IMPORTED, "true");
+        props.put(Constants.IMPORTD_CONFIGS, handler.getType());
         return props;
     }
 

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/AbstractClientHookTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/AbstractClientHookTest.java?rev=785550&r1=785549&r2=785550&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/AbstractClientHookTest.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/AbstractClientHookTest.java
Wed Jun 17 10:54:31 2009
@@ -26,6 +26,7 @@
 
 import junit.framework.TestCase;
 
+import org.apache.cxf.dosgi.dsw.handlers.ConfigurationTypeHandler;
 import org.apache.cxf.dosgi.dsw.service.CxfDistributionProvider;
 import org.easymock.EasyMock;
 import org.easymock.IMocksControl;
@@ -41,7 +42,10 @@
         CxfDistributionProvider dp = control.createMock(CxfDistributionProvider.class);
         ServiceEndpointDescription sed = control.createMock(ServiceEndpointDescription.class);
         EasyMock.expect(sed.getProperties()).andReturn(new HashMap<String, Object>()).anyTimes();
+        ConfigurationTypeHandler handler = control.createMock(ConfigurationTypeHandler.class);
+        EasyMock.expect(handler.getType()).andReturn("test").anyTimes();
         control.replay();
+                
         
         AbstractClientHook ch = new AbstractClientHook(bc, dp) {
             @Override
@@ -49,8 +53,9 @@
                 return "ID";
             }            
         };
-        Map<String, Object> props = ch.getProperties(sed);
+        Map<String, Object> props = ch.getProperties(sed, handler);
         assertTrue(Boolean.valueOf((String) props.get("service.imported")));
+        assertEquals("test", props.get("service.imported.configs"));
     }
     
     public void testLookupDiscoveryServiceInterface() {

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHookTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHookTest.java?rev=785550&r1=785549&r2=785550&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHookTest.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHookTest.java
Wed Jun 17 10:54:31 2009
@@ -276,6 +276,9 @@
         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,




Mime
View raw message