You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by da...@apache.org on 2009/06/16 11:54:01 UTC
svn commit: r785135 - in /cxf/dosgi/trunk:
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/hooks/
dsw/cxf-dsw/src/main/java/org/osgi/ser...
Author: davidb
Date: Tue Jun 16 09:54:00 2009
New Revision: 785135
URL: http://svn.apache.org/viewvc?rev=785135&view=rev
Log:
Added support for the new Remote Services properties as they are currently in the draft Remote Services spec.
The following changes have been made:
(old) -> (new)
osgi.remote.interfaces -> service.exported.interfaces
osgi.remote.configuration.type=pojo -> service.exported.configs=org.apach.cxf.ws
osgi.remote.configuration.pojo.address -> org.apach.cxf.ws.address
osgi.remote.configuration.pojo.httpservice.context -> org.apach.cxf.ws.httpservice.context
osgi.remote.requires.intents -> service.exported.intents
and service.exported.intents.extra
osgi.deployment.intents -> service.intents
osgi.remote -> service.imported
Services exposed using the old properties still work for backward compatibility...
Updated the Greeter Demo to use the new properties.
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/Constants.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/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/PojoConfigurationTypeHandler.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/main/java/org/osgi/service/distribution/DistributionConstants.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/OsgiUtilsTest.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/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/hooks/AbstractClientHookTest.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHookTest.java
cxf/dosgi/trunk/samples/greeter/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml
cxf/dosgi/trunk/samples/greeter/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/Activator.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=785135&r1=785134&r2=785135&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 Jun 16 09:54:00 2009
@@ -41,7 +41,6 @@
import org.osgi.framework.hooks.service.ListenerHook;
import org.osgi.service.cm.ConfigurationException;
import org.osgi.service.cm.ManagedService;
-import org.osgi.service.distribution.DistributionConstants;
import org.osgi.service.distribution.DistributionProvider;
public class Activator implements BundleActivator, ServiceListener, ManagedService {
@@ -126,7 +125,8 @@
private void checkExistingServices() throws InvalidSyntaxException {
ServiceReference[] references = bc.getServiceReferences(null,
- "(" + DistributionConstants.REMOTE_INTERFACES + "=*)");
+ "(|(" + org.apache.cxf.dosgi.dsw.Constants.EXPORTED_INTERFACES + "=*)" +
+ "(" + org.apache.cxf.dosgi.dsw.Constants.EXPORTED_INTERFACES_OLD + "=*))");
if (references != null) {
for (ServiceReference sref : references) {
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=785135&r1=785134&r2=785135&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 Tue Jun 16 09:54:00 2009
@@ -19,25 +19,32 @@
package org.apache.cxf.dosgi.dsw;
public class Constants {
- public static final String CONFIGURATION_PROPERTY = "osgi.remote.configuration";
+ // Constants from RFC 119, they should ultimately be picked up from an OSGi class.
+ public static final String EXPORTED_INTERFACES = "service.exported.interfaces";
+ public static final String EXPORTED_INTERFACES_OLD = "osgi.remote.interfaces"; // for BW compatibility
- // SCA
- public static final String SCA_CONFIG_TYPE = "sca";
- public static final String SCA_CONFIG_PREFIX = CONFIGURATION_PROPERTY + "." + SCA_CONFIG_TYPE;
- public static final String SCA_REMOTE_BINDINGS = SCA_CONFIG_PREFIX + ".bindings";
- public static final String SCA_REMOTE_POLICIES = SCA_CONFIG_PREFIX + ".policies";
+ public static final String EXPORTED_CONFIGS = "service.exported.configs";
+ public static final String EXPORTED_CONFIGS_OLD = "osgi.remote.configuration.type"; // for BW comp.
+ public static final String IMPORTED = "service.imported";
+ public static final String INTENTS = "service.intents";
+
// WSDL
public static final String WSDL_CONFIG_TYPE = "wsdl";
- public static final String WSDL_CONFIG_PREFIX = CONFIGURATION_PROPERTY + "." + WSDL_CONFIG_TYPE;
+ public static final String WSDL_CONFIG_PREFIX = "osgi.remote.configuration" + "." + WSDL_CONFIG_TYPE;
public static final String SERVICE_NAMESPACE = WSDL_CONFIG_PREFIX + ".service.ns";
- // POJO
- public static final String POJO_CONFIG_TYPE = "pojo";
- public static final String POJO_CONFIG_PREFIX = CONFIGURATION_PROPERTY + "." + POJO_CONFIG_TYPE;
- public static final String POJO_ADDRESS_PROPERTY = POJO_CONFIG_PREFIX + ".address";
- public static final String POJO_HTTP_SERVICE_CONTEXT = POJO_CONFIG_PREFIX + ".httpservice.context";
-
+ // WS
+ public static final String WS_CONFIG_TYPE = "org.apache.cxf.ws";
+ public static final String WS_ADDRESS_PROPERTY = WS_CONFIG_TYPE + ".address";
+ public static final String WS_HTTP_SERVICE_CONTEXT = WS_CONFIG_TYPE + ".httpservice.context";
+
+ // POJO (old value for WS)
+ public static final String WS_CONFIG_TYPE_OLD = "pojo";
+ public static final String WS_CONFIG_OLD_PREFIX = "osgi.remote.configuration." + WS_CONFIG_TYPE_OLD;
+ public static final String WS_ADDRESS_PROPERTY_OLD = WS_CONFIG_OLD_PREFIX + ".address";
+ public static final String WS_HTTP_SERVICE_CONTEXT_OLD = WS_CONFIG_OLD_PREFIX + ".httpservice.context";
+
// Common Configuration Properties
public static final String CHECK_BUNDLE = "check.bundle";
public static final String DEFAULT_PORT_CONFIG = "default.port";
Modified: 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/OsgiUtils.java?rev=785135&r1=785134&r2=785135&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/OsgiUtils.java Tue Jun 16 09:54:00 2009
@@ -90,10 +90,7 @@
Map<String, Object> userProperties = new HashMap<String, Object>();
for (String key : sref.getPropertyKeys()) {
- // we're after remote properties only
- if (key.startsWith(DistributionConstants.REMOTE)) {
- userProperties.put(key, sref.getProperty(key));
- }
+ userProperties.put(key, sref.getProperty(key));
}
List<ServiceEndpointDescription> srefs = getRemoteReferences(sref.getBundle(),
names,
@@ -121,10 +118,9 @@
continue;
}
- Map<String, Object> remoteProps = getProperties(ref.getChildren(PROPERTY_ELEMENT, ns));
- remoteProps.putAll(userProperties);
- srefs.add(new ServiceEndpointDescriptionImpl(iNames, remoteProps));
-
+ Map<String, Object> remoteProps = new HashMap<String, Object>(userProperties);
+ addProperties(remoteProps, ref.getChildren(PROPERTY_ELEMENT, ns));
+ srefs.add(new ServiceEndpointDescriptionImpl(iNames, remoteProps));
}
return srefs;
@@ -155,8 +151,8 @@
sd.getProvidedInterfaces().toArray(new String[interfaceNameCount]);
list = new ServiceEndpointDescription[iNames.length];
for (int i = 0; i < iNames.length; i++) {
- Map<String, Object> props = excludeProperty(sd.getProperties(),
- DistributionConstants.REMOTE_INTERFACES);
+ Map<String, Object> props = excludeProperty(sd.getProperties(),
+ Constants.EXPORTED_INTERFACES, Constants.EXPORTED_INTERFACES_OLD);
String keys[] = props.keySet().toArray(new String[props.size()]);
for (int j = 0; j < keys.length; j++) {
@@ -180,10 +176,13 @@
}
private static Map<String, Object> excludeProperty(Map properties,
- String exclude) {
+ String ... excludes) {
+ Collection<String> exList = Arrays.asList(excludes);
+
Map<String, Object> pruned = new HashMap<String, Object>();
for (Object key : properties.keySet()) {
- if (key.equals(exclude)) {
+ if (exList.contains(key)) {
+ // exclude
} else {
pruned.put((String)key, properties.get(key));
}
@@ -245,6 +244,7 @@
}
}
+ /*
// TODO : consider creating a new List rather than modifyiing the existing one
public static void matchServiceDescriptions(List<ServiceEndpointDescription> sds,
String interfaceName,
@@ -275,7 +275,7 @@
interfaceNames);
}
return filter.match(props);
- }
+ } */
public static String[] getProvidedInterfaces(ServiceEndpointDescription sd, String interfaceName) {
@@ -330,7 +330,11 @@
private static Map<String, Object> getProperties(List<Element> elements) {
Map<String, Object> props = new HashMap<String, Object>();
+ addProperties(props, elements);
+ return props;
+ }
+ private static void addProperties(Map<String, Object> props, List<Element> elements) {
for (Element p : elements) {
String key = p.getAttributeValue(PROPERTY_NAME_ATTRIBUTE);
String value = p.getAttributeValue(PROPERTY_VALUE_ATTRIBUTE);
@@ -346,8 +350,6 @@
value);
}
}
-
- return props;
}
private static List<String> getProvidedInterfaces(List<Element> elements) {
@@ -485,7 +487,11 @@
public static String[] getPublishableInterfaces(ServiceEndpointDescription sd,
ServiceReference sref) {
Collection<String> publishProperty =
- getMultiValueProperty(sd.getProperty(DistributionConstants.REMOTE_INTERFACES));
+ getMultiValueProperty(sd.getProperty(Constants.EXPORTED_INTERFACES));
+ if (publishProperty == null) {
+ publishProperty = getMultiValueProperty(sd.getProperty(Constants.EXPORTED_INTERFACES_OLD));
+ }
+
String[] actualInterfaces =
(String[])sref.getProperty(org.osgi.framework.Constants.OBJECTCLASS);
String[] publishableInterfaces = null;
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=785135&r1=785134&r2=785135&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 Jun 16 09:54:00 2009
@@ -70,12 +70,11 @@
Map<String, String> registerPublication(Server server, String[] intents) {
Map<String, String> publicationProperties = new HashMap<String, String>();
- publicationProperties.put(DistributionConstants.REMOTE_CONFIGURATION_TYPE,
- Constants.POJO_CONFIG_TYPE);
+ publicationProperties.put(Constants.EXPORTED_CONFIGS, Constants.WS_CONFIG_TYPE);
String intentsValue = OsgiUtils.formatIntents(intents);
if (intentsValue.length() > 0) {
- publicationProperties.put(DistributionConstants.DEPLOYMENT_INTENTS, intentsValue);
+ publicationProperties.put(Constants.INTENTS, intentsValue);
}
return publicationProperties;
}
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=785135&r1=785134&r2=785135&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 Jun 16 09:54:00 2009
@@ -18,6 +18,7 @@
*/
package org.apache.cxf.dosgi.dsw.handlers;
+import java.util.Collection;
import java.util.Map;
import java.util.logging.Logger;
@@ -26,7 +27,6 @@
import org.apache.cxf.dosgi.dsw.service.CxfDistributionProvider;
import org.osgi.framework.BundleContext;
import org.osgi.service.discovery.ServiceEndpointDescription;
-import org.osgi.service.distribution.DistributionConstants;
public final class ConfigTypeHandlerFactory {
@@ -42,26 +42,29 @@
public ConfigurationTypeHandler getHandler(BundleContext dswBC, ServiceEndpointDescription sd,
CxfDistributionProvider dp,
Map<String, Object> handlerProperties) {
- String type = OsgiUtils.getProperty(sd, DistributionConstants.REMOTE_CONFIGURATION_TYPE);
- if (type == null || Constants.POJO_CONFIG_TYPE.equalsIgnoreCase(type)) {
- if (type == null) {
+ Collection<String> types = OsgiUtils.getMultiValueProperty(sd.getProperty(Constants.EXPORTED_CONFIGS));
+ if (types == null) {
+ types = OsgiUtils.getMultiValueProperty(sd.getProperty(Constants.EXPORTED_CONFIGS_OLD));
+ }
+
+ if (types == null ||
+ types.contains(Constants.WS_CONFIG_TYPE) ||
+ types.contains(Constants.WS_CONFIG_TYPE_OLD)) {
+ if (types == null) {
LOG.info("Defaulting to pojo configuration type ");
}
- if (OsgiUtils.getProperty(sd, Constants.POJO_HTTP_SERVICE_CONTEXT) != null) {
- if (OsgiUtils.getProperty(sd, Constants.POJO_ADDRESS_PROPERTY) != null) {
- return null;
- }
-
+ if ((OsgiUtils.getProperty(sd, Constants.WS_HTTP_SERVICE_CONTEXT) != null) ||
+ (OsgiUtils.getProperty(sd, Constants.WS_HTTP_SERVICE_CONTEXT_OLD) != null)) {
return new HttpServiceConfigurationTypeHandler(dswBC, dp, handlerProperties);
} else {
return new PojoConfigurationTypeHandler(dswBC, dp, handlerProperties);
}
- } else if (Constants.WSDL_CONFIG_TYPE.equalsIgnoreCase(type)) {
+ } else if (types.contains(Constants.WSDL_CONFIG_TYPE)) {
return new WsdlConfigurationTypeHandler(dswBC, dp, handlerProperties);
}
- LOG.info("Configuration type " + type + " is not supported");
+ LOG.info("None of the configuration types in " + types + " is supported.");
return null;
}
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=785135&r1=785134&r2=785135&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 Jun 16 09:54:00 2009
@@ -124,10 +124,7 @@
private Map<String, String> registerPublication(Server server, String[] intents, String address) {
Map<String, String> publicationProperties = super.registerPublication(server, intents);
-
-
- publicationProperties.put(Constants.POJO_ADDRESS_PROPERTY, address);
-
+ publicationProperties.put(Constants.WS_ADDRESS_PROPERTY, address);
return publicationProperties;
}
@@ -165,7 +162,11 @@
}
private String getServletContextRoot(ServiceEndpointDescription sd, Class<?> iClass) {
- String context = OsgiUtils.getProperty(sd, Constants.POJO_HTTP_SERVICE_CONTEXT);
+ String context = OsgiUtils.getProperty(sd, Constants.WS_HTTP_SERVICE_CONTEXT);
+ if (context == null) {
+ context = OsgiUtils.getProperty(sd, Constants.WS_HTTP_SERVICE_CONTEXT_OLD);
+ }
+
if (context == null) {
context = "/" + iClass.getName().replace('.', '/');
LOG.info("Using a default address : " + context);
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=785135&r1=785134&r2=785135&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 Jun 16 09:54:00 2009
@@ -126,14 +126,18 @@
@Override
Map<String, String> registerPublication(Server server, String[] intents) {
Map<String, String> publicationProperties = super.registerPublication(server, intents);
- publicationProperties.put(Constants.POJO_ADDRESS_PROPERTY,
+ publicationProperties.put(Constants.WS_ADDRESS_PROPERTY,
server.getDestination().getAddress().getAddress().getValue());
return publicationProperties;
}
private String getPojoAddress(ServiceEndpointDescription sd, Class<?> iClass) {
- String address = OsgiUtils.getProperty(sd, Constants.POJO_ADDRESS_PROPERTY);
+ String address = OsgiUtils.getProperty(sd, Constants.WS_ADDRESS_PROPERTY);
+ if (address == null) {
+ address = OsgiUtils.getProperty(sd, Constants.WS_ADDRESS_PROPERTY_OLD);
+ }
+
if (address == null) {
address = getDefaultAddress(iClass);
if (address != null) {
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=785135&r1=785134&r2=785135&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 Tue Jun 16 09:54:00 2009
@@ -73,9 +73,8 @@
ServiceEndpointDescription sd =
notification.getServiceEndpointDescription();
- if (sd.getProperty(DistributionConstants.REMOTE_INTERFACES) == null) {
- LOG.info("not proxifying service, enabling property not set: "
- + DistributionConstants.REMOTE_INTERFACES);
+ if ((sd.getProperty(Constants.EXPORTED_INTERFACES) == null) &&
+ (sd.getProperty(Constants.EXPORTED_INTERFACES_OLD) == null)) {
return;
}
@@ -186,7 +185,7 @@
Map<String, Object> props = new HashMap<String, Object>();
props.putAll(sd.getProperties());
props.put(Constants.DSW_CLIENT_ID, getIdentificationProperty());
- props.put(DistributionConstants.REMOTE, "true");
+ props.put(Constants.IMPORTED, "true");
return props;
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/osgi/service/distribution/DistributionConstants.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/osgi/service/distribution/DistributionConstants.java?rev=785135&r1=785134&r2=785135&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/osgi/service/distribution/DistributionConstants.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/osgi/service/distribution/DistributionConstants.java Tue Jun 16 09:54:00 2009
@@ -42,7 +42,8 @@
* The value of this property is of type String, String[] or Collection of
* String.
*/
- public static final String REMOTE_INTERFACES = "osgi.remote.interfaces";
+ // This constant is going to go away
+ // public static final String REMOTE_INTERFACES = "osgi.remote.interfaces";
/**
* This optional service registration property contains a list of intents
@@ -64,7 +65,7 @@
* The value of this property is of type String, String[] or Collection of
* String.
*/
- public static final String REMOTE_CONFIGURATION_TYPE = "osgi.remote.configuration.type";
+ // public static final String REMOTE_CONFIGURATION_TYPE = "osgi.remote.configuration.type";
/**
* This optional service registration property contains a list of intents
@@ -87,7 +88,7 @@
* The value of this property is of type String, String[] or Collection of
* String.
*/
- public static final String DEPLOYMENT_INTENTS = "osgi.deployment.intents";
+ // public static final String DEPLOYMENT_INTENTS = "osgi.deployment.intents";
/**
* This service registration property is set on client side service proxies
@@ -97,5 +98,5 @@
* The value of this property is undefined. The simple fact that the
* property is set denotes that the service is running remotely.
*/
- public static final String REMOTE = "osgi.remote";
+ // public static final String REMOTE = "osgi.remote";
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java?rev=785135&r1=785134&r2=785135&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java Tue Jun 16 09:54:00 2009
@@ -148,11 +148,12 @@
EasyMock.expect(sref.getProperty(org.osgi.framework.Constants.OBJECTCLASS)).
andReturn(new String [] {TestService.class.getName()}).anyTimes();
EasyMock.expect(sref.getPropertyKeys()).
- andReturn(new String [] {"osgi.remote.interfaces"}).anyTimes();
- EasyMock.expect(sref.getProperty("osgi.remote.interfaces")).
+ andReturn(new String [] {"service.exported.interfaces"}).anyTimes();
+ EasyMock.expect(sref.getProperty("service.exported.interfaces")).
andReturn("*").anyTimes();
- EasyMock.expect(bc.getServiceReferences(null, "(osgi.remote.interfaces=*)")).
+ EasyMock.expect(bc.getServiceReferences(null,
+ "(|(service.exported.interfaces=*)(osgi.remote.interfaces=*))")).
andReturn(new ServiceReference[] {sref}).anyTimes();
EasyMock.expect(bc.getService(sref)).andReturn(serviceObject).anyTimes();
Modified: 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/OsgiUtilsTest.java?rev=785135&r1=785134&r2=785135&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/OsgiUtilsTest.java Tue Jun 16 09:54:00 2009
@@ -114,7 +114,8 @@
ServiceEndpointDescription sd =
EasyMock.createMock(ServiceEndpointDescription.class);
ServiceReference sref = EasyMock.createMock(ServiceReference.class);
- EasyMock.expect(sd.getProperty("osgi.remote.interfaces")).andReturn(requested);
+ 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);
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=785135&r1=785134&r2=785135&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 Tue Jun 16 09:54:00 2009
@@ -54,7 +54,7 @@
ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
Map<String, Object> sdProps = new HashMap<String, Object>();
- sdProps.put("osgi.remote.configuration.type", Constants.POJO_CONFIG_TYPE);
+ sdProps.put("osgi.remote.configuration.type", Constants.WS_CONFIG_TYPE);
ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(
Collections.singletonList("MyInterface"), sdProps);
@@ -72,7 +72,7 @@
Map<String, Object> sdProps = new HashMap<String, Object>();
// use default for this: sdProps.put(Constants.CONFIG_TYPE_PROPERTY, Constants.POJO_CONFIG_TYPE);
- sdProps.put(Constants.POJO_ADDRESS_PROPERTY, "http://localhost:9876/abcd");
+ sdProps.put(Constants.WS_ADDRESS_PROPERTY, "http://localhost:9876/abcd");
ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(
Collections.singletonList("MyInterface"), sdProps);
@@ -89,8 +89,8 @@
ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
Map<String, Object> sdProps = new HashMap<String, Object>();
- sdProps.put("osgi.remote.configuration.type", Constants.POJO_CONFIG_TYPE);
- sdProps.put(Constants.POJO_HTTP_SERVICE_CONTEXT, "/abc");
+ sdProps.put("osgi.remote.configuration.type", Constants.WS_CONFIG_TYPE);
+ sdProps.put(Constants.WS_HTTP_SERVICE_CONTEXT, "/abc");
ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(
Collections.singletonList("MyInterface"), sdProps);
@@ -100,23 +100,6 @@
assertSame(dp, ((HttpServiceConfigurationTypeHandler) handler).getDistributionProvider());
}
- public void testGetPojoAddressHttpServicesConflictSituation() {
- BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
- EasyMock.replay(bc);
-
- ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
-
- Map<String, Object> sdProps = new HashMap<String, Object>();
- sdProps.put("osgi.remote.configuration.type", Constants.POJO_CONFIG_TYPE);
- sdProps.put(Constants.POJO_ADDRESS_PROPERTY, "http://localhost:9876/abcd");
- sdProps.put(Constants.POJO_HTTP_SERVICE_CONTEXT, "/abc");
- ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(
- Collections.singletonList("MyInterface"), sdProps);
-
- assertNull("Should not get a handler as this is a conflict situation",
- f.getHandler(bc, sd, null, new HashMap<String, Object>()));
- }
-
public void testGetWSDLHandler() {
BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
EasyMock.replay(bc);
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=785135&r1=785134&r2=785135&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 Jun 16 09:54:00 2009
@@ -71,7 +71,7 @@
EasyMock.replay(callingContext);
Map<String, Object> props = new HashMap<String, Object>();
- props.put(Constants.POJO_HTTP_SERVICE_CONTEXT, "/myRunnable");
+ props.put(Constants.WS_HTTP_SERVICE_CONTEXT, "/myRunnable");
ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(Runnable.class.getName(), props);
assertEquals("Precondition failed", 0, dp.getExposedServices().size());
@@ -83,9 +83,9 @@
String hostName = InetAddress.getLocalHost().getHostName();
Map<String, String> expected = new HashMap<String, String>();
- expected.put("osgi.remote.configuration.type", "pojo");
- expected.put("osgi.remote.configuration.pojo.address", "http://" + hostName + ":1327/myRunnable");
- expected.put("osgi.deployment.intents", "a.b.c");
+ expected.put("service.exported.configs", "org.apache.cxf.ws");
+ expected.put("org.apache.cxf.ws.address", "http://" + hostName + ":1327/myRunnable");
+ expected.put("service.intents", "a.b.c");
assertEquals(expected, dp.getExposedProperties(sr));
}
@@ -141,8 +141,8 @@
String hostname = InetAddress.getLocalHost().getHostName();
Map<String, String> expected = new HashMap<String, String>();
- expected.put("osgi.remote.configuration.type", "pojo");
- expected.put("osgi.remote.configuration.pojo.address", "http://" + hostname + ":8080/java/lang/Runnable");
+ expected.put("service.exported.configs", "org.apache.cxf.ws");
+ expected.put("org.apache.cxf.ws.address", "http://" + hostname + ":8080/java/lang/Runnable");
assertEquals(expected, dp.getExposedProperties(sr));
}
@@ -194,8 +194,8 @@
EasyMock.replay(callingContext);
Map<String, Object> props = new HashMap<String, Object>();
- props.put("osgi.remote.configuration.type", Constants.POJO_CONFIG_TYPE);
- props.put(Constants.POJO_HTTP_SERVICE_CONTEXT, "/myRunnable");
+ props.put("osgi.remote.configuration.type", Constants.WS_CONFIG_TYPE);
+ props.put(Constants.WS_HTTP_SERVICE_CONTEXT, "/myRunnable");
ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(Runnable.class.getName(), props);
assertEquals("Precondition failed", 0, dp.getExposedServices().size());
@@ -205,8 +205,8 @@
String hostName = InetAddress.getLocalHost().getHostName();
Map<String, String> expected = new HashMap<String, String>();
- expected.put("osgi.remote.configuration.type", "pojo");
- expected.put("osgi.remote.configuration.pojo.address", "https://" + hostName + ":8432/myRunnable");
+ expected.put("service.exported.configs", "org.apache.cxf.ws");
+ expected.put("org.apache.cxf.ws.address", "https://" + hostName + ":8432/myRunnable");
assertEquals(expected, dp.getExposedProperties(sr));
}
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=785135&r1=785134&r2=785135&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 Jun 16 09:54:00 2009
@@ -139,9 +139,9 @@
assertSame(sr, dp.getExposedServices().iterator().next());
Map<String, String> expected = new HashMap<String, String>();
- expected.put("osgi.remote.configuration.type", "pojo");
- expected.put("osgi.remote.configuration.pojo.address", "http://somehost:54321/java/lang/String");
- expected.put("osgi.deployment.intents", "A B");
+ expected.put("service.exported.configs", "org.apache.cxf.ws");
+ expected.put("org.apache.cxf.ws.address", "http://somehost:54321/java/lang/String");
+ expected.put("service.intents", "A B");
assertEquals(expected, dp.getExposedProperties(sr));
}
@@ -172,7 +172,7 @@
EasyMock.replay(callingContext);
Map<String, Object> props = new HashMap<String, Object>();
- props.put(Constants.POJO_ADDRESS_PROPERTY, "http://alternate_host:80/myString");
+ props.put(Constants.WS_ADDRESS_PROPERTY, "http://alternate_host:80/myString");
ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(Runnable.class.getName(), props);
assertEquals("Precondition failed", 0, dp.getExposedServices().size());
@@ -181,8 +181,8 @@
assertSame(sr, dp.getExposedServices().iterator().next());
Map<String, String> expected = new HashMap<String, String>();
- expected.put("osgi.remote.configuration.type", "pojo");
- expected.put("osgi.remote.configuration.pojo.address", "http://alternate_host:80/myString");
+ expected.put("service.exported.configs", "org.apache.cxf.ws");
+ expected.put("org.apache.cxf.ws.address", "http://alternate_host:80/myString");
assertEquals(expected, dp.getExposedProperties(sr));
}
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=785135&r1=785134&r2=785135&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 Tue Jun 16 09:54:00 2009
@@ -50,7 +50,7 @@
}
};
Map<String, Object> props = ch.getProperties(sed);
- assertTrue(Boolean.valueOf((String) props.get("osgi.remote")));
+ assertTrue(Boolean.valueOf((String) props.get("service.imported")));
}
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=785135&r1=785134&r2=785135&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 Tue Jun 16 09:54:00 2009
@@ -18,6 +18,10 @@
*/
package org.apache.cxf.dosgi.dsw.hooks;
+import static org.apache.cxf.dosgi.dsw.Constants.WS_ADDRESS_PROPERTY;
+import static org.osgi.service.discovery.ServicePublication.ENDPOINT_LOCATION;
+import static org.osgi.service.discovery.ServicePublication.SERVICE_INTERFACE_NAME;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -27,9 +31,7 @@
import java.util.List;
import java.util.Map;
-
import org.apache.cxf.dosgi.dsw.handlers.ConfigurationTypeHandler;
-import org.apache.cxf.dosgi.dsw.hooks.CxfPublishHook;
import org.apache.cxf.endpoint.Server;
import org.easymock.IAnswer;
import org.easymock.classextension.EasyMock;
@@ -45,12 +47,6 @@
import org.osgi.service.discovery.ServiceEndpointDescription;
import org.osgi.service.discovery.ServicePublication;
-import static org.apache.cxf.dosgi.dsw.Constants.POJO_ADDRESS_PROPERTY;
-import static org.osgi.service.discovery.ServicePublication.ENDPOINT_LOCATION;
-import static org.osgi.service.discovery.ServicePublication.SERVICE_INTERFACE_NAME;
-import static org.osgi.service.discovery.ServicePublication.SERVICE_PROPERTIES;
-import static org.osgi.service.discovery.ServicePublication.ENDPOINT_LOCATION;
-
public class CxfPublishHookTest extends Assert {
private IMocksControl control;
@@ -164,7 +160,7 @@
String excludeProp = "osgi.remote.interfaces";
assertNull(sd.getProperties().get(excludeProp));
String addrProp =
- org.apache.cxf.dosgi.dsw.Constants.POJO_ADDRESS_PROPERTY;
+ org.apache.cxf.dosgi.dsw.Constants.WS_ADDRESS_PROPERTY_OLD;
assertEquals(addresses[i], sd.getProperties().get(addrProp));
}
@@ -293,7 +289,7 @@
Assert.assertSame(serviceBean, serviceObject);
TestPublishHook.this.setCalled();
Map props = sd.getProperties();
- String address = (String)props.get(POJO_ADDRESS_PROPERTY);
+ String address = (String)props.get(WS_ADDRESS_PROPERTY);
if (address != null) {
props.put(ENDPOINT_LOCATION, address);
}
Modified: cxf/dosgi/trunk/samples/greeter/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/greeter/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml?rev=785135&r1=785134&r2=785135&view=diff
==============================================================================
--- cxf/dosgi/trunk/samples/greeter/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml (original)
+++ cxf/dosgi/trunk/samples/greeter/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml Tue Jun 16 09:54:00 2009
@@ -16,8 +16,8 @@
<service-descriptions xmlns="http://www.osgi.org/xmlns/sd/v1.0.0">
<service-description>
<provide interface="org.apache.cxf.dosgi.samples.greeter.GreeterService" />
- <property name="osgi.remote.interfaces">*</property>
- <property name="osgi.remote.configuration.type">pojo</property>
- <property name="osgi.remote.configuration.pojo.address">http://localhost:9090/greeter</property>
+ <property name="service.exported.interfaces">*</property>
+ <property name="service.exported.configs">org.apache.cxf.ws</property>
+ <property name="org.apache.cxf.ws.address">http://localhost:9090/greeter</property>
</service-description>
</service-descriptions>
Modified: cxf/dosgi/trunk/samples/greeter/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/Activator.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/greeter/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/Activator.java?rev=785135&r1=785134&r2=785135&view=diff
==============================================================================
--- cxf/dosgi/trunk/samples/greeter/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/Activator.java (original)
+++ cxf/dosgi/trunk/samples/greeter/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/Activator.java Tue Jun 16 09:54:00 2009
@@ -34,9 +34,9 @@
public void start(BundleContext bc) throws Exception {
Dictionary props = new Hashtable();
- props.put("osgi.remote.interfaces", "*");
- props.put("osgi.remote.configuration.type", "pojo");
- props.put("osgi.remote.configuration.pojo.address", "http://localhost:9090/greeter");
+ props.put("service.exported.interfaces", "*");
+ props.put("service.exported.configs", "org.apache.cxf.ws");
+ props.put("org.apache.cxf.ws.address", "http://localhost:9090/greeter");
registration = bc.registerService(GreeterService.class.getName(),
new GreeterServiceImpl(), props);