Author: cschneider
Date: Thu Nov 29 10:11:16 2012
New Revision: 1415112

URL: http://svn.apache.org/viewvc?rev=1415112&view=rev
Log:
DOSGI-127 DOSGI-126 Move default endpoint creation to HttpServiceManager

Removed:
    
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractConfigurationHandler.java
Modified:
    
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/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/ConfigurationTypeHandler.java
    
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.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/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/test/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactoryTest.java
    
cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.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

Modified: 
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?rev=1415112&r1=1415111&r2=1415112&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
 Thu Nov 29 10:11:16 2012
@@ -65,6 +65,7 @@ public class Activator implements Manage
 
     private void start(BundleContext bc, Map<String, Object> config) {
         this.bc = bc;
+        String servletBase = (String) 
config.get(org.apache.cxf.dosgi.dsw.Constants.SERVLET_BASE);
         // Disable the fast infoset as it's not compatible (yet) with OSGi
         System.setProperty("org.apache.cxf.nofastinfoset", "true");
 
@@ -73,8 +74,8 @@ public class Activator implements Manage
         intentTracker = new IntentTracker(bc, intentMap);
         intentTracker.open();
         IntentManager intentManager = new IntentManagerImpl(intentMap, 
DEFAULT_INTENT_TIMEOUT);
-        HttpServiceManager httpServiceManager = new HttpServiceManager(bc);
-        ConfigTypeHandlerFactory configTypeHandlerFactory = new 
ConfigTypeHandlerFactory(intentManager, httpServiceManager, config);
+        HttpServiceManager httpServiceManager = new HttpServiceManager(bc, 
servletBase);
+        ConfigTypeHandlerFactory configTypeHandlerFactory = new 
ConfigTypeHandlerFactory(bc, intentManager, httpServiceManager);
         RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, 
configTypeHandlerFactory);
         RemoteServiceadminFactory rsaf = new 
RemoteServiceadminFactory(rsaCore);
         Hashtable<String, Object> props = new Hashtable<String, Object>();

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=1415112&r1=1415111&r2=1415112&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
 Thu Nov 29 10:11:16 2012
@@ -18,8 +18,11 @@
   */
 package org.apache.cxf.dosgi.dsw.handlers;
 
+import java.lang.reflect.Proxy;
 import java.net.URL;
+import java.util.HashMap;
 import java.util.Map;
+import java.util.Set;
 
 import javax.xml.namespace.QName;
 
@@ -28,6 +31,7 @@ import org.apache.cxf.common.util.Packag
 import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.dosgi.dsw.Constants;
 import org.apache.cxf.dosgi.dsw.qos.IntentManager;
+import org.apache.cxf.dosgi.dsw.qos.IntentUtils;
 import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.frontend.ClientFactoryBean;
@@ -42,18 +46,77 @@ import org.osgi.service.remoteserviceadm
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public abstract class AbstractPojoConfigurationTypeHandler extends 
AbstractConfigurationHandler {
+public abstract class AbstractPojoConfigurationTypeHandler implements 
ConfigurationTypeHandler {
     private static final Logger LOG = 
LoggerFactory.getLogger(AbstractPojoConfigurationTypeHandler.class);
-    private static final String CONFIGURATION_TYPE = "org.apache.cxf.ws";
+    protected BundleContext bundleContext;
+    protected IntentManager intentManager;
     protected HttpServiceManager httpServiceManager;
     
     public AbstractPojoConfigurationTypeHandler(BundleContext dswBC,
                                                 IntentManager intentManager,
-                                                HttpServiceManager 
httpServiceManager,
-                                                Map<String, Object> 
handlerProps) {
-        super(dswBC, intentManager, handlerProps);
+                                                HttpServiceManager 
httpServiceManager) {
+        this.bundleContext = dswBC;
+        this.intentManager = intentManager;
         this.httpServiceManager = httpServiceManager;
     }
+    
+    protected Object getProxy(Object serviceProxy, Class<?> iType) {
+        return Proxy.newProxyInstance(iType.getClassLoader(), new Class[] {
+            iType
+        }, new ServiceInvocationHandler(serviceProxy, iType));
+    }
+
+    protected Map<String, Object> createEndpointProps(Map<String, Object> sd, 
Class<?> iClass, String[] importedConfigs,
+                                                      String address, String[] 
intents) {
+        Map<String, Object> props = new HashMap<String, Object>();
+
+        copyEndpointProperties(sd, props);
+
+        String[] sa = new String[] {iClass.getName()};
+        String pkg = iClass.getPackage().getName();
+        
+        props.remove(org.osgi.framework.Constants.SERVICE_ID);
+        props.put(org.osgi.framework.Constants.OBJECTCLASS, sa);
+        props.put(RemoteConstants.ENDPOINT_SERVICE_ID, 
sd.get(org.osgi.framework.Constants.SERVICE_ID));        
+        props.put(RemoteConstants.ENDPOINT_FRAMEWORK_UUID, 
OsgiUtils.getUUID(bundleContext));
+        props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, importedConfigs);
+        props.put(RemoteConstants.ENDPOINT_PACKAGE_VERSION_ + pkg, 
+                OsgiUtils.getVersion(iClass, bundleContext)); 
+
+        for (String configurationType : importedConfigs) {
+            if(Constants.WS_CONFIG_TYPE.equals(configurationType))
+                props.put(Constants.WS_ADDRESS_PROPERTY, address);
+            else if(Constants.RS_CONFIG_TYPE.equals(configurationType))
+                props.put(Constants.RS_ADDRESS_PROPERTY, address);
+            else if(Constants.WS_CONFIG_TYPE_OLD.equals(configurationType)){
+                props.put(Constants.WS_ADDRESS_PROPERTY_OLD, address);
+                props.put(Constants.WS_ADDRESS_PROPERTY, address);
+            }
+        }
+        
+        {
+            String[] allIntents = IntentUtils.mergeArrays(intents, 
IntentUtils.getInetntsImplementedByTheService(sd));
+            props.put(RemoteConstants.SERVICE_INTENTS, allIntents);
+        }
+        
+        props.put(RemoteConstants.ENDPOINT_ID, address);
+        return props;
+
+    }
+
+    private void copyEndpointProperties(Map<String, Object> sd, Map<String, 
Object> endpointProps) {
+        Set<Map.Entry<String, Object>> keys = sd.entrySet();
+        for (Map.Entry<String, Object> entry : keys) {
+            try {
+                String skey = (String)entry.getKey();
+                if (!skey.startsWith("."))
+                    endpointProps.put(skey, entry.getValue());
+            } catch (ClassCastException e) {
+                LOG.warn("ServiceProperties Map contained non String key. 
Skipped  " + entry + "   "
+                            + e.getLocalizedMessage());
+            }
+        }
+    }
 
     // Isolated so that it can be substituted for testing
     ClientProxyFactoryBean createClientProxyFactoryBean(ServiceReference sref, 
Class<?> iClass) {
@@ -144,10 +207,6 @@ public abstract class AbstractPojoConfig
         return new QName(ns, portName);
     }
     
-    public String getType() {
-        return CONFIGURATION_TYPE;
-    }
-    
     protected String getClientAddress(Map<String, Object> sd, Class<?> iClass) 
{
         return OsgiUtils.getFirstNonEmptyStringProperty(sd, 
                 RemoteConstants.ENDPOINT_ID,
@@ -165,7 +224,7 @@ public abstract class AbstractPojoConfig
             LOG.error(e.getMessage(), e);
             return null;
         }
-        return (address == null) ? getDefaultAddress(iClass) : address;
+        return (address == null) ? 
httpServiceManager.getDefaultAddress(iClass) : address;
     }
     
     protected final ExportResult createServerFromFactory(ServerFactoryBean 
factory, Map<String, Object> endpointProps) {

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=1415112&r1=1415111&r2=1415112&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
 Thu Nov 29 10:11:16 2012
@@ -42,18 +42,20 @@ public class ConfigTypeHandlerFactory {
 
     protected final static String DEFAULT_CONFIGURATION_TYPE = 
Constants.WS_CONFIG_TYPE;
     private IntentManager intentManager;
-    private HttpServiceManager httpServiceManager;
-    private Map<String, Object> props;
+    private PojoConfigurationTypeHandler pojoConfigurationTypeHandler;
+    private JaxRSPojoConfigurationTypeHandler 
jaxRsPojoConfigurationTypeHandler;
+    private WsdlConfigurationTypeHandler wsdlConfigurationTypeHandler;
 
-    public ConfigTypeHandlerFactory(IntentManager intentManager, 
HttpServiceManager httpServiceManager, Map<String, Object> props) {
+    public ConfigTypeHandlerFactory(BundleContext bc, IntentManager 
intentManager, HttpServiceManager httpServiceManager) {
+        this.intentManager = intentManager;
+        this.pojoConfigurationTypeHandler = new 
PojoConfigurationTypeHandler(bc, intentManager, httpServiceManager);
+        this.jaxRsPojoConfigurationTypeHandler = new 
JaxRSPojoConfigurationTypeHandler(bc, intentManager, httpServiceManager);
+        this.wsdlConfigurationTypeHandler = new 
WsdlConfigurationTypeHandler(bc, intentManager, httpServiceManager);
         supportedConfigurationTypes = new ArrayList<String>();
         supportedConfigurationTypes.add(Constants.WSDL_CONFIG_TYPE);
         supportedConfigurationTypes.add(Constants.RS_CONFIG_TYPE);
         supportedConfigurationTypes.add(Constants.WS_CONFIG_TYPE);
         supportedConfigurationTypes.add(Constants.WS_CONFIG_TYPE_OLD);
-        this.intentManager = intentManager;
-        this.httpServiceManager = httpServiceManager;
-        this.props = props;
     }
     
     public ConfigurationTypeHandler getHandler(BundleContext dswBC,
@@ -76,10 +78,9 @@ public class ConfigTypeHandlerFactory {
 
             boolean jaxrs = isJaxrsRequested(configurationTypes, 
serviceProperties);
 
-            return jaxrs ? new JaxRSPojoConfigurationTypeHandler(dswBC, 
intentManager, httpServiceManager, props)
-                    : new PojoConfigurationTypeHandler(dswBC, intentManager, 
httpServiceManager, props);
+            return jaxrs ? jaxRsPojoConfigurationTypeHandler : 
pojoConfigurationTypeHandler;
         } else if (configurationTypes.contains(Constants.WSDL_CONFIG_TYPE)) {
-            return new WsdlConfigurationTypeHandler(dswBC, intentManager, 
httpServiceManager, props);
+            return wsdlConfigurationTypeHandler;
         }
         throw new RuntimeException("None of the configuration types in " + 
configurationTypes + " is supported.");
     }

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=1415112&r1=1415111&r2=1415112&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
 Thu Nov 29 10:11:16 2012
@@ -26,7 +26,7 @@ import org.osgi.framework.ServiceReferen
 import org.osgi.service.remoteserviceadmin.EndpointDescription;
 
 public interface ConfigurationTypeHandler {
-    String getType();
+    String[] getSupportedTypes();
     
     ExportResult createServer(ServiceReference serviceReference,
                         BundleContext dswContext,

Modified: 
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
URL: 
http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java?rev=1415112&r1=1415111&r2=1415112&view=diff
==============================================================================
--- 
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
 (original)
+++ 
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
 Thu Nov 29 10:11:16 2012
@@ -45,16 +45,29 @@ public class HttpServiceManager {
     private ServiceTracker tracker;
     private BundleContext bundleContext;
     private Map<Long, String> exportedAliases = 
Collections.synchronizedMap(new HashMap<Long, String>());
+    private String servletBase;
 
-    public HttpServiceManager(BundleContext bundleContext) {
+    public HttpServiceManager(BundleContext bundleContext, String servletBase) 
{
         this.bundleContext = bundleContext;
         this.tracker = new ServiceTracker(bundleContext, 
HttpService.class.getName(), null);
         this.tracker.open();
+        setServletBase(servletBase);
+        
     }
     
-    public HttpServiceManager(BundleContext bundleContext, ServiceTracker 
tracker) {
+    // Only for tests
+    public HttpServiceManager(BundleContext bundleContext, String servletBase, 
ServiceTracker tracker) {
         this.bundleContext = bundleContext;
         this.tracker = tracker;
+        setServletBase(servletBase);
+    }
+    
+    private void setServletBase(String newServletBase) {
+        this.servletBase = newServletBase;
+        if( this.servletBase == null) {
+            // This default only works for Apache Karaf and cxf with default 
settings
+            this.servletBase = "http://"; + LocalHostUtil.getLocalIp() + 
":8181/cxf";
+        }
     }
     
     public Bus registerServletAndGetBus(String contextRoot, BundleContext 
dswContext,
@@ -123,6 +136,17 @@ public class HttpServiceManager {
         }
     }
     
+    protected String getDefaultAddress(Class<?> type) {
+        return "/" + type.getName().replace('.', '/');
+    }
+
+    protected String getAbsoluteAddress(BundleContext ctx, String contextRoot, 
String relativeEndpointAddress) {
+        if (relativeEndpointAddress.startsWith("http")) {
+            return relativeEndpointAddress;
+        }
+        return this.servletBase + relativeEndpointAddress;
+    }
+    
     public void close() {
         tracker.close();
     }

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=1415112&r1=1415111&r2=1415112&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
 Thu Nov 29 10:11:16 2012
@@ -47,10 +47,15 @@ public class JaxRSPojoConfigurationTypeH
 
     Set<ServiceReference> httpServiceReferences = new 
CopyOnWriteArraySet<ServiceReference>();
 
-    protected JaxRSPojoConfigurationTypeHandler(BundleContext dswBC, 
IntentManager intentManager, HttpServiceManager httpServiceManager, Map<String, 
Object> handlerProps) {
-        super(dswBC, intentManager, httpServiceManager, handlerProps);
+    public JaxRSPojoConfigurationTypeHandler(BundleContext dswBC, 
IntentManager intentManager, HttpServiceManager httpServiceManager) {
+        super(dswBC, intentManager, httpServiceManager);
     }
 
+    @Override
+    public String[] getSupportedTypes() {
+        return new String[] {Constants.WSDL_CONFIG_TYPE, 
Constants.WS_CONFIG_TYPE_OLD};
+    }
+    
     public Object createProxy(ServiceReference serviceReference, BundleContext 
dswContext,
                               BundleContext callingContext, Class<?> iClass, 
EndpointDescription sd) throws IntentUnsatifiedException {
 
@@ -121,7 +126,7 @@ public class JaxRSPojoConfigurationTypeH
                  + " endpoint via JaxRSPojoConfigurationTypeHandler, address 
is " + address);
 
         JAXRSServerFactoryBean factory = createServerFactory(dswContext, 
callingContext, sd, iClass, serviceBean, address, bus);
-        String completeEndpointAddress = constructAddress(dswContext, 
contextRoot, address);
+        String completeEndpointAddress = 
httpServiceManager.getAbsoluteAddress(dswContext, contextRoot, address);
 
         // The properties for the EndpointDescription
         Map<String, Object> endpointProps = createEndpointProps(sd, iClass, 
new String[] { Constants.RS_CONFIG_TYPE },
@@ -177,7 +182,7 @@ public class JaxRSPojoConfigurationTypeH
         String address = OsgiUtils.getProperty(sd, 
Constants.RS_ADDRESS_PROPERTY);
 
         if (address == null) {
-            address = getDefaultAddress(iClass);
+            address = httpServiceManager.getDefaultAddress(iClass);
             if (address != null) {
                 LOG.info("Using a default address : " + address);
             }

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=1415112&r1=1415111&r2=1415112&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
 Thu Nov 29 10:11:16 2012
@@ -35,8 +35,13 @@ import org.slf4j.LoggerFactory;
 public class PojoConfigurationTypeHandler extends 
AbstractPojoConfigurationTypeHandler {
     private static final Logger LOG = 
LoggerFactory.getLogger(PojoConfigurationTypeHandler.class);
 
-    public PojoConfigurationTypeHandler(BundleContext dswBC, IntentManager 
intentManager, HttpServiceManager httpServiceManager, Map<String, Object> 
handlerProps) {
-        super(dswBC, intentManager, httpServiceManager, handlerProps);
+    public PojoConfigurationTypeHandler(BundleContext dswBC, IntentManager 
intentManager, HttpServiceManager httpServiceManager) {
+        super(dswBC, intentManager, httpServiceManager);
+    }
+    
+    @Override
+    public String[] getSupportedTypes() {
+        return new String[] {Constants.WS_CONFIG_TYPE, 
Constants.WS_CONFIG_TYPE_OLD};
     }
 
     public Object createProxy(ServiceReference serviceReference, BundleContext 
dswContext,
@@ -88,7 +93,7 @@ public class PojoConfigurationTypeHandle
         setWsdlProperties(factory, callingContext, sd, false);
         String[] intents = intentManager.applyIntents(factory.getFeatures(), 
factory, sd);
         
-        String completeEndpointAddress = constructAddress(dswContext, 
contextRoot, address);
+        String completeEndpointAddress = 
httpServiceManager.getAbsoluteAddress(dswContext, contextRoot, address);
 
         // The properties for the EndpointDescription
         Map<String, Object> endpointProps = createEndpointProps(sd, iClass, 
new String[]{Constants.WS_CONFIG_TYPE}, completeEndpointAddress,intents);

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=1415112&r1=1415111&r2=1415112&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
 Thu Nov 29 10:11:16 2012
@@ -39,22 +39,20 @@ import org.osgi.service.remoteserviceadm
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-@SuppressWarnings("restriction")
 public class WsdlConfigurationTypeHandler extends 
AbstractPojoConfigurationTypeHandler {
-    private static final String CONFIGURATION_TYPE = "wsdl";
     private static final Logger LOG = 
LoggerFactory.getLogger(WsdlConfigurationTypeHandler.class);
     
     public WsdlConfigurationTypeHandler(BundleContext dswBC,
                                         IntentManager intentManager,
-                                        HttpServiceManager httpServiceManager,
-                                        Map<String, Object> handlerProps) {
-        super(dswBC, intentManager, httpServiceManager, handlerProps);
+                                        HttpServiceManager httpServiceManager) 
{
+        super(dswBC, intentManager, httpServiceManager);
     }
     
-    public String getType() {
-        return CONFIGURATION_TYPE;
+    @Override
+    public String[] getSupportedTypes() {
+        return new String[] {Constants.WSDL_CONFIG_TYPE};
     }
-
+    
     public Object createProxy(ServiceReference serviceReference,
                               BundleContext dswContext,
                               BundleContext callingContext,
@@ -154,7 +152,7 @@ public class WsdlConfigurationTypeHandle
     private String getWsdlAddress(EndpointDescription sd, Class<?> iClass) {
         String address = OsgiUtils.getProperty(sd, 
Constants.WSDL_CONFIG_PREFIX);
         if (address == null) {
-            address = getDefaultAddress(iClass);
+            address = httpServiceManager.getDefaultAddress(iClass);
             if (address != null) {
                 address += "?wsdl";    
             }

Modified: 
cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactoryTest.java
URL: 
http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactoryTest.java?rev=1415112&r1=1415111&r2=1415112&view=diff
==============================================================================
--- 
cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactoryTest.java
 (original)
+++ 
cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactoryTest.java
 Thu Nov 29 10:11:16 2012
@@ -85,8 +85,8 @@ public class ConfigTypeHandlerFactoryTes
         serviceProps.put(RemoteConstants.SERVICE_EXPORTED_INTENTS, intents);
         IntentMap intentMap = new IntentMap(new 
DefaultIntentMapFactory().create());
         IntentManager intentManager = new IntentManagerImpl(intentMap);
-        HttpServiceManager httpServiceManager = new HttpServiceManager(bc);
-        ConfigTypeHandlerFactory f = new 
ConfigTypeHandlerFactory(intentManager, httpServiceManager, null);
+        HttpServiceManager httpServiceManager = new HttpServiceManager(bc, 
null);
+        ConfigTypeHandlerFactory f = new ConfigTypeHandlerFactory(bc, 
intentManager, httpServiceManager);
         return f.getHandler(bc, serviceProps);
     }
 }

Modified: 
cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java
URL: 
http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java?rev=1415112&r1=1415111&r2=1415112&view=diff
==============================================================================
--- 
cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java
 (original)
+++ 
cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java
 Thu Nov 29 10:11:16 2012
@@ -64,7 +64,7 @@ public class HttpServiceManagerTest exte
         
expect(sr.getProperty(EasyMock.eq("service.id"))).andReturn(12345l).atLeastOnce();
         c.replay();
         
-        HttpServiceManager h = new HttpServiceManager(dswContext, null) {
+        HttpServiceManager h = new HttpServiceManager(dswContext, null, null) {
 
             @Override
             protected HttpService getHttpService() {

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=1415112&r1=1415111&r2=1415112&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
 Thu Nov 29 10:11:16 2012
@@ -49,9 +49,8 @@ import org.osgi.service.remoteserviceadm
 
 public class PojoConfigurationTypeHandlerTest extends TestCase {
     public void testGetPojoAddressEndpointURI() {
-        Map<String, Object> hp = new HashMap<String, Object>();
         IntentManager intentManager = new IntentManagerImpl(new IntentMap());
-        PojoConfigurationTypeHandler handler = new 
PojoConfigurationTypeHandler(null, intentManager, dummyHttpServiceManager(), 
hp);
+        PojoConfigurationTypeHandler handler = new 
PojoConfigurationTypeHandler(null, intentManager, dummyHttpServiceManager());
         Map<String, Object> sd = new HashMap<String, Object>();
         String url = "http://somewhere:1234/blah";;
         sd.put(RemoteConstants.ENDPOINT_ID, url);
@@ -59,15 +58,12 @@ public class PojoConfigurationTypeHandle
     }
     
     private HttpServiceManager dummyHttpServiceManager() {
-        HttpServiceManager httpServiceManager = 
EasyMock.createNiceMock(HttpServiceManager.class);
-        EasyMock.replay(httpServiceManager);
-        return httpServiceManager;
+        return new HttpServiceManager(null, null, null);
     }
 
     public void testGetPojoAddressEndpointCxf() {
-        Map<String, Object> hp = new HashMap<String, Object>();
         IntentManager intentManager = new IntentManagerImpl(new IntentMap());
-        PojoConfigurationTypeHandler handler = new 
PojoConfigurationTypeHandler(null, intentManager, dummyHttpServiceManager(), 
hp);
+        PojoConfigurationTypeHandler handler = new 
PojoConfigurationTypeHandler(null, intentManager, dummyHttpServiceManager());
         Map<String, Object> sd = new HashMap<String, Object>();
         String url = "http://somewhere:29/boo";;
         sd.put("org.apache.cxf.ws.address", url);
@@ -75,9 +71,8 @@ public class PojoConfigurationTypeHandle
     }
 
     public void testGetPojoAddressEndpointPojo() {
-        Map<String, Object> hp = new HashMap<String, Object>();
         IntentManager intentManager = new IntentManagerImpl(new IntentMap());
-        PojoConfigurationTypeHandler handler = new 
PojoConfigurationTypeHandler(null, intentManager, dummyHttpServiceManager(), 
hp);
+        PojoConfigurationTypeHandler handler = new 
PojoConfigurationTypeHandler(null, intentManager, dummyHttpServiceManager());
         Map<String, Object> sd = new HashMap<String, Object>();
         String url = "http://somewhere:32768/foo";;
         sd.put("osgi.remote.configuration.pojo.address", url);
@@ -85,9 +80,8 @@ public class PojoConfigurationTypeHandle
     }
     
     public void testGetDefaultPojoAddress() {
-        Map<String, Object> hp = new HashMap<String, Object>();
         IntentManager intentManager = new IntentManagerImpl(new IntentMap());
-        PojoConfigurationTypeHandler handler = new 
PojoConfigurationTypeHandler(null, intentManager , dummyHttpServiceManager(), 
hp);
+        PojoConfigurationTypeHandler handler = new 
PojoConfigurationTypeHandler(null, intentManager , dummyHttpServiceManager());
         Map<String, Object> sd = new HashMap<String, Object>(); 
         assertEquals("/java/lang/String", handler.getServerAddress(sd, 
String.class));
     }
@@ -109,7 +103,7 @@ public class PojoConfigurationTypeHandle
                 return new String[0];
             }
         };
-        PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(bc1, 
intentManager, dummyHttpServiceManager(), null) {
+        PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(bc1, 
intentManager, dummyHttpServiceManager()) {
             @Override
             ClientProxyFactoryBean 
createClientProxyFactoryBean(ServiceReference sRef, Class<?> iClass) {
                 return cpfb;
@@ -230,7 +224,7 @@ public class PojoConfigurationTypeHandle
                 return new String []{};
             }
         };
-        PojoConfigurationTypeHandler p = new 
PojoConfigurationTypeHandler(dswContext, intentManager, 
dummyHttpServiceManager(), null) {
+        PojoConfigurationTypeHandler p = new 
PojoConfigurationTypeHandler(dswContext, intentManager, 
dummyHttpServiceManager()) {
             @Override
             ServerFactoryBean createServerFactoryBean(ServiceReference sRef, 
Class<?> iClass) {
                 return sfb;
@@ -316,7 +310,7 @@ public class PojoConfigurationTypeHandle
         EasyMock.replay(bc);
         
         IntentManager intentManager = new IntentManagerImpl(new IntentMap());
-        PojoConfigurationTypeHandler pch = new 
PojoConfigurationTypeHandler(bc, intentManager, dummyHttpServiceManager(), 
null);
+        PojoConfigurationTypeHandler pch = new 
PojoConfigurationTypeHandler(bc, intentManager, dummyHttpServiceManager());
         
         Map<String, Object> sd = new HashMap<String, Object>();
         sd.put(org.osgi.framework.Constants.SERVICE_ID, 42);

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=1415112&r1=1415111&r2=1415112&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
 Thu Nov 29 10:11:16 2012
@@ -105,7 +105,7 @@ public class RemoteServiceAdminCoreTest 
         IntentMap intentMap = new IntentMap(new 
DefaultIntentMapFactory().create());
         IntentManager intentManager = new IntentManagerImpl(intentMap, 10000);
         HttpServiceManager httpServiceManager = 
c.createMock(HttpServiceManager.class);
-        ConfigTypeHandlerFactory configTypeHandlerFactory = new 
ConfigTypeHandlerFactory(intentManager, httpServiceManager, null);
+        ConfigTypeHandlerFactory configTypeHandlerFactory = new 
ConfigTypeHandlerFactory(bc, intentManager, httpServiceManager);
         RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, 
configTypeHandlerFactory ) {
             @Override
             protected void proxifyMatchingInterface(String interfaceName, 
ImportRegistrationImpl imReg,


Reply via email to