You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2009/06/18 19:59:22 UTC
svn commit: r786187 [1/2] - in /cxf/dosgi/trunk: distribution/single-bundle/
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/...
Author: sergeyb
Date: Thu Jun 18 17:59:18 2009
New Revision: 786187
URL: http://svn.apache.org/viewvc?rev=786187&view=rev
Log:
Initial JAX-RS integration (todo: fix issues with multibundle client proxy creation plus model checks)
Added:
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSHttpServiceConfigurationTypeHandler.java (with props)
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java (with props)
cxf/dosgi/trunk/samples/greeter_rest/
cxf/dosgi/trunk/samples/greeter_rest/client/
cxf/dosgi/trunk/samples/greeter_rest/client/pom.xml (with props)
cxf/dosgi/trunk/samples/greeter_rest/client/src/
cxf/dosgi/trunk/samples/greeter_rest/client/src/main/
cxf/dosgi/trunk/samples/greeter_rest/client/src/main/java/
cxf/dosgi/trunk/samples/greeter_rest/client/src/main/java/org/
cxf/dosgi/trunk/samples/greeter_rest/client/src/main/java/org/apache/
cxf/dosgi/trunk/samples/greeter_rest/client/src/main/java/org/apache/cxf/
cxf/dosgi/trunk/samples/greeter_rest/client/src/main/java/org/apache/cxf/dosgi/
cxf/dosgi/trunk/samples/greeter_rest/client/src/main/java/org/apache/cxf/dosgi/samples/
cxf/dosgi/trunk/samples/greeter_rest/client/src/main/java/org/apache/cxf/dosgi/samples/greeter/
cxf/dosgi/trunk/samples/greeter_rest/client/src/main/java/org/apache/cxf/dosgi/samples/greeter/client/
cxf/dosgi/trunk/samples/greeter_rest/client/src/main/java/org/apache/cxf/dosgi/samples/greeter/client/rest/
cxf/dosgi/trunk/samples/greeter_rest/client/src/main/java/org/apache/cxf/dosgi/samples/greeter/client/rest/Activator.java (with props)
cxf/dosgi/trunk/samples/greeter_rest/client/src/main/resources/
cxf/dosgi/trunk/samples/greeter_rest/client/src/main/resources/OSGI-INF/
cxf/dosgi/trunk/samples/greeter_rest/client/src/main/resources/OSGI-INF/remote-service/
cxf/dosgi/trunk/samples/greeter_rest/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml (with props)
cxf/dosgi/trunk/samples/greeter_rest/impl/
cxf/dosgi/trunk/samples/greeter_rest/impl/pom.xml (with props)
cxf/dosgi/trunk/samples/greeter_rest/impl/src/
cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/
cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/
cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/
cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/apache/
cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/apache/cxf/
cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/
cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/
cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/
cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/
cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/rest/
cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/rest/Activator.java (with props)
cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/rest/GreeterServiceImpl.java (with props)
cxf/dosgi/trunk/samples/greeter_rest/interface/
cxf/dosgi/trunk/samples/greeter_rest/interface/pom.xml (with props)
cxf/dosgi/trunk/samples/greeter_rest/interface/src/
cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/
cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/
cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/
cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/
cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/
cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/
cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/
cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/
cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/
cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreeterException.java (with props)
cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreeterInfo.java (with props)
cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreeterService.java (with props)
cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreetingPhrase.java (with props)
cxf/dosgi/trunk/samples/greeter_rest/pom.xml (with props)
cxf/dosgi/trunk/systests/common_rest/
cxf/dosgi/trunk/systests/common_rest/pom.xml (with props)
cxf/dosgi/trunk/systests/common_rest/src/
cxf/dosgi/trunk/systests/common_rest/src/main/
cxf/dosgi/trunk/systests/common_rest/src/main/java/
cxf/dosgi/trunk/systests/common_rest/src/main/java/org/
cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/
cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/
cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/
cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/
cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/
cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/
cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/AbstractDosgiSystemTest.java (with props)
cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/AbstractJaxRsPublishHookTest.java (with props)
cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/AbstractListenerHookServiceListenerTest.java (with props)
cxf/dosgi/trunk/systests/multi_bundle_distro_rest/
cxf/dosgi/trunk/systests/multi_bundle_distro_rest/pom.xml (with props)
cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/
cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/
cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/
cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/
cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/
cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/
cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/
cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/
cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/
cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/BasicPublishHookTest.java (with props)
cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/ListenerHookServiceListenerTest.java (with props)
cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/MultiBundleDistributionResolver.java (with props)
cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/resources/
cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/resources/OSGI-INF/
cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/resources/OSGI-INF/remote-service/
cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/resources/OSGI-INF/remote-service/remote-services.xml (with props)
cxf/dosgi/trunk/systests/single_bundle_distro_rest/
cxf/dosgi/trunk/systests/single_bundle_distro_rest/pom.xml (with props)
cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/
cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/
cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/
cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/
cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/
cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/
cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/
cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/
cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/
cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/BasicPublishHookTest.java (with props)
cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/ListenerHookServiceListenerTest.java (with props)
cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/SingleBundleDistributionResolver.java (with props)
cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/resources/
cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/resources/OSGI-INF/
cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/resources/OSGI-INF/remote-service/
cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/resources/OSGI-INF/remote-service/remote-services.xml (with props)
Modified:
cxf/dosgi/trunk/distribution/single-bundle/pom.xml
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/ServiceHookUtils.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/samples/pom.xml
cxf/dosgi/trunk/systests/pom.xml
Modified: cxf/dosgi/trunk/distribution/single-bundle/pom.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/distribution/single-bundle/pom.xml?rev=786187&r1=786186&r2=786187&view=diff
==============================================================================
--- cxf/dosgi/trunk/distribution/single-bundle/pom.xml (original)
+++ cxf/dosgi/trunk/distribution/single-bundle/pom.xml Thu Jun 18 17:59:18 2009
@@ -237,6 +237,7 @@
<Embed-Directory>lib</Embed-Directory>
<_exportcontents>
javax.xml.ws.*;version="2.1.0",
+ javax.ws.rs.*;version="1.0.0",
javax.servlet.*;version="2.5.0",
org.apache.cxf.dosgi.*;version="${pom.version}",
org.apache.cxf.*;version="${cxf.version}",
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=786187&r1=786186&r2=786187&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 Thu Jun 18 17:59:18 2009
@@ -40,10 +40,21 @@
public static final String WSDL_CONFIG_PREFIX = "osgi.remote.configuration" + "." + WSDL_CONFIG_TYPE;
public static final String SERVICE_NAMESPACE = WSDL_CONFIG_PREFIX + ".service.ns";
+ // Provider prefix
+ public static final String PROVIDER_PREFIX = "org.apache.cxf";
+
// WS
- public static final String WS_CONFIG_TYPE = "org.apache.cxf.ws";
+ public static final String WS_CONFIG_TYPE = PROVIDER_PREFIX + ".ws";
public static final String WS_ADDRESS_PROPERTY = WS_CONFIG_TYPE + ".address";
public static final String WS_HTTP_SERVICE_CONTEXT = WS_CONFIG_TYPE + ".httpservice.context";
+ public static final String WS_FRONTEND_PROP_KEY = WS_CONFIG_TYPE + ".frontend";
+ public static final String WS_DATABINDING_PROP_KEY = WS_CONFIG_TYPE + ".databinding";
+
+ // Rest
+ public static final String RS_CONFIG_TYPE = PROVIDER_PREFIX + ".rs";
+ public static final String RS_ADDRESS_PROPERTY = RS_CONFIG_TYPE + ".address";
+ public static final String RS_HTTP_SERVICE_CONTEXT = RS_CONFIG_TYPE + ".httpservice.context";
+ public static final String RS_DATABINDING_PROP_KEY = WS_CONFIG_TYPE + ".databinding";
// POJO (old value for WS)
public static final String WS_CONFIG_TYPE_OLD = "pojo";
@@ -59,6 +70,8 @@
public static final String DEFAULT_HOST_VALUE = "localhost";
public final static String USE_MASTER_MAP = "use.master.map";
- // DSW Identification - TODO do we really need this one?
- public static final String DSW_CLIENT_ID = "org.apache.cxf.remote.dsw.client";
+
+ //DSW Identification - TODO do we really need this one?
+ public static final String DSW_CLIENT_ID = PROVIDER_PREFIX + ".remote.dsw.client";
+
}
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=786187&r1=786186&r2=786187&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 Thu Jun 18 17:59:18 2009
@@ -26,8 +26,6 @@
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
@@ -46,7 +44,6 @@
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
import org.osgi.service.discovery.ServiceEndpointDescription;
-import org.osgi.service.distribution.DistributionConstants;
import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext;
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=786187&r1=786186&r2=786187&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 Jun 18 17:59:18 2009
@@ -42,6 +42,8 @@
import org.apache.cxf.feature.AbstractFeature;
import org.apache.cxf.frontend.ClientProxyFactoryBean;
import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
import org.osgi.framework.BundleContext;
import org.osgi.service.discovery.ServiceEndpointDescription;
@@ -59,13 +61,21 @@
}
// Isolated so that it can be substituted for testing
- ClientProxyFactoryBean createClientProxyFactoryBean() {
+ ClientProxyFactoryBean createClientProxyFactoryBean(String frontEndImpl) {
+ if("jaxws".equals(frontEndImpl)) {
+ return new JaxWsProxyFactoryBean();
+ } else {
return new ClientProxyFactoryBean();
+ }
}
// Isolated so that it can be substituted for testing
- ServerFactoryBean createServerFactoryBean() {
+ ServerFactoryBean createServerFactoryBean(String frontEndImpl) {
+ if("jaxws".equals(frontEndImpl)) {
+ return new JaxWsServerFactoryBean();
+ } else {
return new ServerFactoryBean();
+ }
}
Map<String, String> registerPublication(Server server, String[] 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=786187&r1=786186&r2=786187&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 Jun 18 17:59:18 2009
@@ -27,6 +27,7 @@
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 {
@@ -47,18 +48,26 @@
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) {
+ if (types == null
+ || types.contains(Constants.WS_CONFIG_TYPE)
+ || types.contains(Constants.WS_CONFIG_TYPE_OLD)
+ || types.contains(Constants.RS_CONFIG_TYPE)) {
+
+ if (types == null) {
LOG.info("Defaulting to pojo configuration type ");
}
+
+ boolean jaxrs = isJaxrsRequested(types, sd);
- 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);
+ if (OsgiUtils.getProperty(sd, Constants.WS_HTTP_SERVICE_CONTEXT) != null
+ || OsgiUtils.getProperty(sd, Constants.RS_HTTP_SERVICE_CONTEXT) != null
+ || OsgiUtils.getProperty(sd, Constants.WS_HTTP_SERVICE_CONTEXT_OLD) != null) {
+ return jaxrs ? new JaxRSHttpServiceConfigurationTypeHandler(dswBC, dp, handlerProperties)
+ : new HttpServiceConfigurationTypeHandler(dswBC, dp, handlerProperties) ;
+
} else {
- return new PojoConfigurationTypeHandler(dswBC, dp, handlerProperties);
+ return jaxrs ? new JaxRSPojoConfigurationTypeHandler(dswBC, dp, handlerProperties)
+ : new PojoConfigurationTypeHandler(dswBC, dp, handlerProperties);
}
} else if (types.contains(Constants.WSDL_CONFIG_TYPE)) {
return new WsdlConfigurationTypeHandler(dswBC, dp, handlerProperties);
@@ -68,4 +77,35 @@
return null;
}
+
+ private boolean isJaxrsRequested(Collection<String> types, ServiceEndpointDescription sd) {
+
+ if (types == null) {
+ return false;
+ }
+
+ if (types.contains(Constants.RS_CONFIG_TYPE)) {
+ String intentsProperty = OsgiUtils.getProperty(sd,
+ Constants.EXPORTED_INTENTS);
+ boolean hasHttpIntent = false, hasSoapIntent = false;
+ if (intentsProperty != null) {
+ String[] intents = OsgiUtils.parseIntents(intentsProperty);
+ for (int i = 0; i < intents.length; i++) {
+ if (intents[i].indexOf("SOAP") > -1) {
+ hasSoapIntent = true;
+ break;
+ }
+ if("HTTP".equals(intents[i])) {
+ hasHttpIntent = true;
+ }
+ }
+ }
+ if (intentsProperty != null && hasHttpIntent && !hasSoapIntent
+ || intentsProperty == null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
}
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=786187&r1=786186&r2=786187&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 Thu Jun 18 17:59:18 2009
@@ -28,11 +28,13 @@
import org.apache.cxf.Bus;
import org.apache.cxf.aegis.databinding.AegisDatabinding;
+import org.apache.cxf.databinding.DataBinding;
import org.apache.cxf.dosgi.dsw.Constants;
import org.apache.cxf.dosgi.dsw.OsgiUtils;
import org.apache.cxf.dosgi.dsw.service.CxfDistributionProvider;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.jaxb.JAXBDataBinding;
import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceException;
@@ -95,13 +97,20 @@
throw new ServiceException("CXF DOSGi: problem registering CXF HTTP Servlet", e);
}
Bus bus = cxf.getBus();
-
+ DataBinding databinding;
+ String dataBindingImpl = (String) serviceReference.getProperty(Constants.WS_DATABINDING_PROP_KEY);
+ if("jaxb".equals(dataBindingImpl)) {
+ databinding = new JAXBDataBinding();
+ } else {
+ databinding = new AegisDatabinding();
+ }
+ String frontEndImpl = (String) serviceReference.getProperty(Constants.WS_FRONTEND_PROP_KEY);
+ ServerFactoryBean factory = createServerFactoryBean(frontEndImpl);
String address = constructAddress(dswContext, contextRoot);
- ServerFactoryBean factory = createServerFactoryBean();
factory.setBus(bus);
factory.setServiceClass(iClass);
factory.setAddress("/");
- factory.getServiceFactory().setDataBinding(new AegisDatabinding());
+ factory.getServiceFactory().setDataBinding(databinding);
factory.setServiceBean(serviceBean);
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
@@ -122,13 +131,13 @@
}
}
- private Map<String, String> registerPublication(Server server, String[] intents, String address) {
+ protected Map<String, String> registerPublication(Server server, String[] intents, String address) {
Map<String, String> publicationProperties = super.registerPublication(server, intents);
publicationProperties.put(Constants.WS_ADDRESS_PROPERTY, address);
return publicationProperties;
}
- private String constructAddress(BundleContext ctx, String contextRoot) {
+ protected String constructAddress(BundleContext ctx, String contextRoot) {
String port = null;
boolean https = false;
if ("true".equalsIgnoreCase(ctx.getProperty("org.osgi.service.http.secure.enabled"))) {
@@ -151,7 +160,7 @@
return getAddress(https ? "https" : "http", hostName, port, contextRoot);
}
- private HttpService getHttpService() {
+ protected HttpService getHttpService() {
for (ServiceReference sr : httpServiceReferences) {
Object svc = bundleContext.getService(sr);
if (svc instanceof HttpService) {
@@ -161,7 +170,7 @@
throw new ServiceException("CXF DOSGi: No HTTP Service could be found to publish CXF endpoint in.");
}
- private String getServletContextRoot(ServiceEndpointDescription sd, Class<?> iClass) {
+ protected String getServletContextRoot(ServiceEndpointDescription sd, Class<?> iClass) {
String context = OsgiUtils.getProperty(sd, Constants.WS_HTTP_SERVICE_CONTEXT);
if (context == null) {
context = OsgiUtils.getProperty(sd, Constants.WS_HTTP_SERVICE_CONTEXT_OLD);
@@ -173,4 +182,4 @@
}
return context;
}
-}
\ No newline at end of file
+}
Added: 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=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSHttpServiceConfigurationTypeHandler.java (added)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSHttpServiceConfigurationTypeHandler.java Thu Jun 18 17:59:18 2009
@@ -0,0 +1,108 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.dsw.handlers;
+
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.logging.Logger;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.dosgi.dsw.Constants;
+import org.apache.cxf.dosgi.dsw.OsgiUtils;
+import org.apache.cxf.dosgi.dsw.service.CxfDistributionProvider;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
+import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.discovery.ServiceEndpointDescription;
+import org.osgi.service.http.HttpService;
+
+public class JaxRSHttpServiceConfigurationTypeHandler extends HttpServiceConfigurationTypeHandler {
+ private static final Logger LOG = Logger.getLogger(JaxRSHttpServiceConfigurationTypeHandler.class.getName());
+
+ Set<ServiceReference> httpServiceReferences = new CopyOnWriteArraySet<ServiceReference>();
+
+ protected JaxRSHttpServiceConfigurationTypeHandler(BundleContext dswBC,
+ CxfDistributionProvider dp,
+ Map<String, Object> handlerProps) {
+ super(dswBC, dp, handlerProps);
+ }
+
+ public Server createServer(ServiceReference serviceReference,
+ BundleContext dswContext,
+ BundleContext callingContext,
+ ServiceEndpointDescription sd,
+ Class<?> iClass,
+ Object serviceBean) {
+ String contextRoot = getServletContextRoot(sd, iClass);
+ if (contextRoot == null) {
+ LOG.warning("Remote address is unavailable");
+ return null;
+ }
+
+ CXFNonSpringServlet cxf = new CXFNonSpringServlet();
+ HttpService httpService = getHttpService();
+ try {
+ httpService.registerServlet(contextRoot, cxf, new Hashtable<String, String>(), null);
+ LOG.info("Successfully registered CXF DOSGi servlet at " + contextRoot);
+ } catch (Exception e) {
+ throw new ServiceException("CXF DOSGi: problem registering CXF HTTP Servlet", e);
+ }
+ Bus bus = cxf.getBus();
+ JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
+ factory.setServiceClass(iClass);
+ factory.setAddress("/");
+ factory.setResourceProvider(iClass, new SingletonResourceProvider(serviceBean));
+ factory.setBus(bus);
+
+ String address = constructAddress(dswContext, contextRoot);
+
+ ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ String [] intents = new String[] {"HTTP"};
+ Thread.currentThread().setContextClassLoader(JAXRSServerFactoryBean.class.getClassLoader());
+ Server server = factory.create();
+ getDistributionProvider().addExposedService(serviceReference, registerPublication(server, intents, address));
+ addAddressProperty(sd.getProperties(), address);
+ return server;
+ } catch (IntentUnsatifiedException iue) {
+ getDistributionProvider().intentsUnsatisfied(serviceReference);
+ throw iue;
+ } finally {
+ Thread.currentThread().setContextClassLoader(oldClassLoader);
+ }
+ }
+
+ @Override
+ protected String getServletContextRoot(ServiceEndpointDescription sd, Class<?> iClass) {
+ String context = OsgiUtils.getProperty(sd, Constants.RS_HTTP_SERVICE_CONTEXT);
+
+ if (context == null) {
+ context = "/" + iClass.getName().replace('.', '/');
+ LOG.info("Using a default address : " + context);
+ }
+ return context;
+ }
+
+}
Propchange: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSHttpServiceConfigurationTypeHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSHttpServiceConfigurationTypeHandler.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: 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=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java (added)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java Thu Jun 18 17:59:18 2009
@@ -0,0 +1,139 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.dsw.handlers;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.cxf.dosgi.dsw.Constants;
+import org.apache.cxf.dosgi.dsw.OsgiUtils;
+import org.apache.cxf.dosgi.dsw.service.CxfDistributionProvider;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
+import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
+import org.apache.cxf.jaxrs.provider.AegisElementProvider;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.discovery.ServiceEndpointDescription;
+
+public class JaxRSPojoConfigurationTypeHandler extends PojoConfigurationTypeHandler {
+ private static final Logger LOG = Logger.getLogger(JaxRSPojoConfigurationTypeHandler.class.getName());
+
+ Set<ServiceReference> httpServiceReferences = new CopyOnWriteArraySet<ServiceReference>();
+
+ protected JaxRSPojoConfigurationTypeHandler(BundleContext dswBC,
+ CxfDistributionProvider dp,
+ Map<String, Object> handlerProps) {
+ super(dswBC, dp, handlerProps);
+ }
+
+ public Object createProxy(ServiceReference serviceReference,
+ BundleContext dswContext, BundleContext callingContext,
+ Class<?> iClass, ServiceEndpointDescription sd) {
+ String address = getPojoAddress(sd, iClass);
+
+ if (address == null) {
+ LOG.warning("Remote address is unavailable");
+ return null;
+ }
+
+ LOG.info("Creating a " + sd.getProvidedInterfaces().toArray()[0]
+ + " client, endpoint address is " + address);
+
+ ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
+ bean.setAddress(address);
+ bean.setServiceClass(iClass);
+ if (!"jaxb".equals(sd.getProperty(Constants.RS_DATABINDING_PROP_KEY))) {
+ bean.setProvider(new AegisElementProvider());
+ }
+ Thread.currentThread().setContextClassLoader(JAXRSClientFactoryBean.class.getClassLoader());
+ Object proxy = getProxy(bean.create(), iClass);
+ getDistributionProvider().addRemoteService(serviceReference);
+ return proxy;
+ } catch (Exception e) {
+ LOG.log(Level.WARNING, "proxy creation failed", e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(oldClassLoader);
+ }
+ return null;
+ }
+
+
+ public Server createServer(ServiceReference serviceReference,
+ BundleContext dswContext,
+ BundleContext callingContext,
+ ServiceEndpointDescription sd,
+ Class<?> iClass,
+ Object serviceBean) {
+ String address = getPojoAddress(sd, iClass);
+ if (address == null) {
+ LOG.warning("Remote address is unavailable");
+ return null;
+ }
+
+ LOG.info("Creating a " + sd.getProvidedInterfaces().toArray()[0]
+ + " endpoint from CXF PublishHook, address is " + address);
+
+ JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
+ factory.setServiceClass(iClass);
+ factory.setAddress(address);
+ factory.setResourceProvider(iClass, new SingletonResourceProvider(serviceBean));
+ if (!"jaxb".equals(sd.getProperty(Constants.RS_DATABINDING_PROP_KEY))) {
+ List<Object> providers = new ArrayList<Object>();
+ providers.add(new AegisElementProvider());
+ factory.setProviders(providers);
+ }
+
+ ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ String [] intents = new String[]{"HTTP"};
+
+ Thread.currentThread().setContextClassLoader(JAXRSServerFactoryBean.class.getClassLoader());
+ Server server = factory.create();
+ getDistributionProvider().addExposedService(serviceReference, registerPublication(server, intents));
+ addAddressProperty(sd.getProperties(), address);
+ return server;
+ } catch (IntentUnsatifiedException iue) {
+ getDistributionProvider().intentsUnsatisfied(serviceReference);
+ throw iue;
+ } finally {
+ Thread.currentThread().setContextClassLoader(oldClassLoader);
+ }
+ }
+
+ protected String getPojoAddress(ServiceEndpointDescription sd, Class<?> iClass) {
+ String address = OsgiUtils.getProperty(sd, Constants.RS_ADDRESS_PROPERTY);
+
+ if (address == null) {
+ address = getDefaultAddress(iClass);
+ if (address != null) {
+ LOG.info("Using a default address : " + address);
+ }
+ }
+ return address;
+ }
+}
Propchange: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
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=786187&r1=786186&r2=786187&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 Jun 18 17:59:18 2009
@@ -23,12 +23,14 @@
import java.util.logging.Logger;
import org.apache.cxf.aegis.databinding.AegisDatabinding;
+import org.apache.cxf.databinding.DataBinding;
import org.apache.cxf.dosgi.dsw.Constants;
import org.apache.cxf.dosgi.dsw.OsgiUtils;
import org.apache.cxf.dosgi.dsw.service.CxfDistributionProvider;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.frontend.ClientProxyFactoryBean;
import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.jaxb.JAXBDataBinding;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.service.discovery.ServiceEndpointDescription;
@@ -60,10 +62,18 @@
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
try {
- ClientProxyFactoryBean factory = createClientProxyFactoryBean();
+ DataBinding databinding;
+ String dataBindingImpl = (String) serviceReference.getProperty(Constants.WS_DATABINDING_PROP_KEY);
+ if("jaxb".equals(dataBindingImpl)) {
+ databinding = new JAXBDataBinding();
+ } else {
+ databinding = new AegisDatabinding();
+ }
+ String frontEndImpl = (String) serviceReference.getProperty(Constants.WS_FRONTEND_PROP_KEY);
+ ClientProxyFactoryBean factory = createClientProxyFactoryBean(frontEndImpl);
factory.setServiceClass(iClass);
factory.setAddress(address);
- factory.getServiceFactory().setDataBinding(new AegisDatabinding());
+ factory.getServiceFactory().setDataBinding(databinding);
applyIntents(dswContext,
callingContext,
@@ -98,10 +108,19 @@
LOG.info("Creating a " + sd.getProvidedInterfaces().toArray()[0]
+ " endpoint from CXF PublishHook, address is " + address);
- ServerFactoryBean factory = createServerFactoryBean();
+ DataBinding databinding;
+ String dataBindingImpl = (String) serviceReference.getProperty(Constants.WS_DATABINDING_PROP_KEY);
+ if("jaxb".equals(dataBindingImpl)) {
+ databinding = new JAXBDataBinding();
+ } else {
+ databinding = new AegisDatabinding();
+ }
+ String frontEndImpl = (String) serviceReference.getProperty(Constants.WS_FRONTEND_PROP_KEY);
+ ServerFactoryBean factory = createServerFactoryBean(frontEndImpl);
+
factory.setServiceClass(iClass);
factory.setAddress(address);
- factory.getServiceFactory().setDataBinding(new AegisDatabinding());
+ factory.getServiceFactory().setDataBinding(databinding);
factory.setServiceBean(serviceBean);
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
@@ -132,7 +151,7 @@
return publicationProperties;
}
- private String getPojoAddress(ServiceEndpointDescription sd, Class<?> iClass) {
+ protected String getPojoAddress(ServiceEndpointDescription sd, Class<?> iClass) {
String address = OsgiUtils.getProperty(sd, Constants.WS_ADDRESS_PROPERTY);
if (address == null) {
address = OsgiUtils.getProperty(sd, Constants.WS_ADDRESS_PROPERTY_OLD);
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtils.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtils.java?rev=786187&r1=786186&r2=786187&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtils.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtils.java Thu Jun 18 17:59:18 2009
@@ -96,6 +96,7 @@
} catch (Exception ex) {
LOG.warning("WARNING : Problem creating a remote endpoint for " + interfaceName
+ " from CXF PublishHook, reason is " + ex.getMessage());
+ ex.printStackTrace();
}
}
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=786187&r1=786186&r2=786187&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 Thu Jun 18 17:59:18 2009
@@ -135,6 +135,7 @@
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");
Bundle b = EasyMock.createNiceMock(Bundle.class);
EasyMock.replay(b);
@@ -155,6 +156,7 @@
// 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);
}
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=786187&r1=786186&r2=786187&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 Jun 18 17:59:18 2009
@@ -47,6 +47,55 @@
assertSame(dp, ((PojoConfigurationTypeHandler) handler).getDistributionProvider());
}
+
+ public void testGetJaxrsHandlerNoIntents() {
+ BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+ EasyMock.replay(bc);
+
+ ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
+ Map<String, Object> props = new HashMap<String, Object>();
+ props.put(Constants.EXPORTED_CONFIGS, Constants.RS_CONFIG_TYPE);
+
+ ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("MyInterface", props);
+ CxfDistributionProvider dp = new DistributionProviderImpl(bc);
+ ConfigurationTypeHandler handler = f.getHandler(bc, sd, dp, new HashMap<String, Object>());
+ assertTrue(handler instanceof JaxRSPojoConfigurationTypeHandler);
+ assertSame(dp, ((PojoConfigurationTypeHandler) handler).getDistributionProvider());
+ }
+
+ public void testGetJaxrsHandlerHttpIntents() {
+ BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+ EasyMock.replay(bc);
+
+ ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
+ Map<String, Object> props = new HashMap<String, Object>();
+ props.put(Constants.EXPORTED_CONFIGS, Constants.RS_CONFIG_TYPE);
+ props.put(Constants.EXPORTED_INTENTS, "HTTP");
+
+ ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("MyInterface", props);
+ CxfDistributionProvider dp = new DistributionProviderImpl(bc);
+ ConfigurationTypeHandler handler = f.getHandler(bc, sd, dp, new HashMap<String, Object>());
+ assertTrue(handler instanceof JaxRSPojoConfigurationTypeHandler);
+ assertSame(dp, ((PojoConfigurationTypeHandler) handler).getDistributionProvider());
+ }
+
+ public void testJaxrsPropertyIgnored() {
+ BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+ EasyMock.replay(bc);
+
+ ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
+ Map<String, Object> props = new HashMap<String, Object>();
+ props.put(Constants.EXPORTED_CONFIGS, Constants.RS_CONFIG_TYPE);
+ props.put(Constants.EXPORTED_INTENTS, "SOAP HTTP");
+
+ ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("MyInterface", props);
+ CxfDistributionProvider dp = new DistributionProviderImpl(bc);
+ ConfigurationTypeHandler handler = f.getHandler(bc, sd, dp, new HashMap<String, Object>());
+ assertTrue(handler instanceof PojoConfigurationTypeHandler);
+ assertTrue(!(handler instanceof JaxRSPojoConfigurationTypeHandler));
+ assertSame(dp, ((PojoConfigurationTypeHandler) handler).getDistributionProvider());
+ }
+
public void testGetPojoHandler() {
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=786187&r1=786186&r2=786187&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 Thu Jun 18 17:59:18 2009
@@ -46,7 +46,7 @@
HttpServiceConfigurationTypeHandler h =
new HttpServiceConfigurationTypeHandler(dswContext, dp, handlerProps) {
@Override
- ServerFactoryBean createServerFactoryBean() {
+ ServerFactoryBean createServerFactoryBean(String frontend) {
return sfb;
}
@@ -107,7 +107,7 @@
HttpServiceConfigurationTypeHandler h =
new HttpServiceConfigurationTypeHandler(dswContext, dp, handlerProps) {
@Override
- ServerFactoryBean createServerFactoryBean() {
+ ServerFactoryBean createServerFactoryBean(String frontend) {
return sfb;
}
@@ -169,7 +169,7 @@
HttpServiceConfigurationTypeHandler h =
new HttpServiceConfigurationTypeHandler(dswContext, dp, handlerProps) {
@Override
- ServerFactoryBean createServerFactoryBean() {
+ ServerFactoryBean createServerFactoryBean(String frontend) {
return sfb;
}
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=786187&r1=786186&r2=786187&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 Jun 18 17:59:18 2009
@@ -79,7 +79,7 @@
DistributionProviderImpl dp = new DistributionProviderImpl(bc);
PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(bc, dp, handlerProps) {
@Override
- ClientProxyFactoryBean createClientProxyFactoryBean() {
+ ClientProxyFactoryBean createClientProxyFactoryBean(String frontend) {
return cpfb;
}
@@ -115,7 +115,7 @@
DistributionProviderImpl dp = new DistributionProviderImpl(dswContext);
PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(dswContext, dp, handlerProps) {
@Override
- ServerFactoryBean createServerFactoryBean() {
+ ServerFactoryBean createServerFactoryBean(String frontend) {
return sfb;
}
@@ -155,7 +155,7 @@
DistributionProviderImpl dp = new DistributionProviderImpl(dswContext);
PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(dswContext, dp, handlerProps) {
@Override
- ServerFactoryBean createServerFactoryBean() {
+ ServerFactoryBean createServerFactoryBean(String frontend) {
return sfb;
}
@@ -627,7 +627,7 @@
PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(dswContext, dp, handlerProps) {
@Override
- ServerFactoryBean createServerFactoryBean() {
+ ServerFactoryBean createServerFactoryBean(String frontend) {
return sfb;
}
@@ -681,7 +681,7 @@
PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(dswContext, dp, handlerProps) {
@Override
- ServerFactoryBean createServerFactoryBean() {
+ ServerFactoryBean createServerFactoryBean(String frontend) {
return sfb;
}
Added: cxf/dosgi/trunk/samples/greeter_rest/client/pom.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/greeter_rest/client/pom.xml?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/samples/greeter_rest/client/pom.xml (added)
+++ cxf/dosgi/trunk/samples/greeter_rest/client/pom.xml Thu Jun 18 17:59:18 2009
@@ -0,0 +1,79 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.cxf.dosgi.samples</groupId>
+ <artifactId>cxf-dosgi-ri-samples-greeter-rest-client</artifactId>
+ <packaging>bundle</packaging>
+ <name>Distributed OSGI Greeter Bundle Client</name>
+ <version>1.1-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.apache.cxf.dosgi</groupId>
+ <artifactId>cxf-dosgi-ri-parent</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <relativePath>../../../parent/pom.xml</relativePath>
+ </parent>
+
+ <properties>
+ <bundle.import.package>javax.ws.rs.*,*</bundle.import.package>
+ <bundle.private.package>org.apache.cxf.dosgi.samples.greeter.client.rest</bundle.private.package>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.cxf.dosgi.samples</groupId>
+ <artifactId>cxf-dosgi-ri-samples-greeter-rest-interface</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>${felix.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.foundation</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-Name>CXF Distributed OSGi Greeter Rest Demo Client Bundle</Bundle-Name>
+ <Bundle-Description>This bundle contains the implementation the Distributed OSGi Greeter Rest Demo Client</Bundle-Description>
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Bundle-Activator>org.apache.cxf.dosgi.samples.greeter.client.rest.Activator</Bundle-Activator>
+ <Import-Package>${bundle.import.package}</Import-Package>
+ <Private-Package>${bundle.private.package}</Private-Package>
+ <DynamicImport-Package>org.apache.cxf.dosgi.dsw.qos,org.apache.cxf</DynamicImport-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange: cxf/dosgi/trunk/samples/greeter_rest/client/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/dosgi/trunk/samples/greeter_rest/client/pom.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: cxf/dosgi/trunk/samples/greeter_rest/client/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: cxf/dosgi/trunk/samples/greeter_rest/client/src/main/java/org/apache/cxf/dosgi/samples/greeter/client/rest/Activator.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/greeter_rest/client/src/main/java/org/apache/cxf/dosgi/samples/greeter/client/rest/Activator.java?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/samples/greeter_rest/client/src/main/java/org/apache/cxf/dosgi/samples/greeter/client/rest/Activator.java (added)
+++ cxf/dosgi/trunk/samples/greeter_rest/client/src/main/java/org/apache/cxf/dosgi/samples/greeter/client/rest/Activator.java Thu Jun 18 17:59:18 2009
@@ -0,0 +1,91 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.samples.greeter.client.rest;
+
+import javax.swing.JOptionPane;
+
+import org.apache.cxf.dosgi.samples.greeter.rest.GreeterException;
+import org.apache.cxf.dosgi.samples.greeter.rest.GreeterInfo;
+import org.apache.cxf.dosgi.samples.greeter.rest.GreeterService;
+import org.apache.cxf.dosgi.samples.greeter.rest.GreetingPhrase;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class Activator implements BundleActivator {
+ private ServiceTracker tracker;
+
+ public void start(final BundleContext bc) {
+ tracker = new ServiceTracker(bc, GreeterService.class.getName(), null) {
+ @Override
+ public Object addingService(ServiceReference reference) {
+ Object result = super.addingService(reference);
+
+ useService(bc, reference);
+
+ return result;
+ }
+ };
+ tracker.open();
+
+ }
+
+ protected void useService(final BundleContext bc, ServiceReference reference) {
+ Object svc = bc.getService(reference);
+ if (!(svc instanceof GreeterService)) {
+ return;
+ }
+ final GreeterService greeter = (GreeterService) svc;
+
+ Thread t = new Thread(new Runnable() {
+ public void run() {
+ greeterUI(bc, greeter);
+ }
+ });
+ t.start();
+ }
+
+ private void greeterUI(final BundleContext bc, final GreeterService greeter) {
+ while (true) {
+ System.out.println("*** Opening greeter client dialog ***");
+ String name = JOptionPane.showInputDialog("Enter name:");
+ if (name == null) {
+ break;
+ } else {
+ System.out.println("*** Invoking greeter ***");
+ try {
+ GreeterInfo info = greeter.greetMe(name);
+
+ System.out.println("greetMe(\"" + name + "\") returns:");
+ for (GreetingPhrase greeting: info.getGreetings()) {
+ System.out.println(" " + greeting.getPhrase()
+ + " " + greeting.getName());
+ }
+ } catch (GreeterException ex) {
+ System.out.println("GreeterException : " + ex.toString());
+ }
+ }
+ }
+ }
+
+ public void stop(BundleContext bc) throws Exception {
+ tracker.close();
+ }
+}
Propchange: cxf/dosgi/trunk/samples/greeter_rest/client/src/main/java/org/apache/cxf/dosgi/samples/greeter/client/rest/Activator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/dosgi/trunk/samples/greeter_rest/client/src/main/java/org/apache/cxf/dosgi/samples/greeter/client/rest/Activator.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/dosgi/trunk/samples/greeter_rest/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/greeter_rest/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/samples/greeter_rest/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml (added)
+++ cxf/dosgi/trunk/samples/greeter_rest/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml Thu Jun 18 17:59:18 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to you under the Apache License, Version
+ 2.0 (the "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed under
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
+ OR CONDITIONS OF ANY KIND, either express or implied. See the
+ License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<service-descriptions xmlns="http://www.osgi.org/xmlns/sd/v1.0.0">
+ <service-description>
+ <provide interface="org.apache.cxf.dosgi.samples.greeter.rest.GreeterService" />
+ <property name="service.exported.interfaces">*</property>
+ <property name="service.exported.configs">org.apache.cxf.rs</property>
+ <property name="service.exported.intents">HTTP</property>
+ <property name="org.apache.cxf.rs.address">http://localhost:9090/greeter</property>
+ </service-description>
+</service-descriptions>
Propchange: cxf/dosgi/trunk/samples/greeter_rest/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/dosgi/trunk/samples/greeter_rest/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: cxf/dosgi/trunk/samples/greeter_rest/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: cxf/dosgi/trunk/samples/greeter_rest/impl/pom.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/greeter_rest/impl/pom.xml?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/samples/greeter_rest/impl/pom.xml (added)
+++ cxf/dosgi/trunk/samples/greeter_rest/impl/pom.xml Thu Jun 18 17:59:18 2009
@@ -0,0 +1,79 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.cxf.dosgi.samples</groupId>
+ <artifactId>cxf-dosgi-ri-samples-greeter-rest-impl</artifactId>
+ <packaging>bundle</packaging>
+ <name>Distributed OSGI Greeter Implementation Bundle</name>
+ <version>1.1-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.apache.cxf.dosgi</groupId>
+ <artifactId>cxf-dosgi-ri-parent</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <relativePath>../../../parent/pom.xml</relativePath>
+ </parent>
+
+ <properties>
+ <bundle.import.package>javax.ws.rs.*,*</bundle.import.package>
+ <bundle.private.package>org.apache.cxf.dosgi.samples.greeter.impl.rest</bundle.private.package>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>${felix.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.foundation</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf.dosgi.samples</groupId>
+ <artifactId>cxf-dosgi-ri-samples-greeter-rest-interface</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-Name>CXF Distributed OSGi Greeter Demo Service Rest Implementation Bundle</Bundle-Name>
+ <Bundle-Description>This bundle contains the implementation of the CXF Distributed OSGi Greeter Rest Demo Implementation Bundle</Bundle-Description>
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Bundle-Activator>org.apache.cxf.dosgi.samples.greeter.impl.rest.Activator</Bundle-Activator>
+ <Import-Package>${bundle.import.package}</Import-Package>
+ <Private-Package>${bundle.private.package}</Private-Package>
+ <DynamicImport-Package>org.apache.cxf.dosgi.dsw.qos,org.apache.cxf</DynamicImport-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange: cxf/dosgi/trunk/samples/greeter_rest/impl/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/dosgi/trunk/samples/greeter_rest/impl/pom.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: cxf/dosgi/trunk/samples/greeter_rest/impl/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/rest/Activator.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/rest/Activator.java?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/rest/Activator.java (added)
+++ cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/rest/Activator.java Thu Jun 18 17:59:18 2009
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.samples.greeter.impl.rest;
+
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+
+import org.apache.cxf.dosgi.samples.greeter.rest.GreeterService;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+public class Activator implements BundleActivator {
+ private ServiceRegistration registration;
+
+ public void start(BundleContext bc) throws Exception {
+ Dictionary props = new Hashtable();
+
+ props.put("service.exported.interfaces", "*");
+ props.put("service.exported.configs", "org.apache.cxf.rs");
+ props.put("service.exported.intents", "HTTP");
+ props.put("org.apache.cxf.rs.address", "http://localhost:9090/greeter");
+ //props.put("org.apache.cxf.rs.httpservice.context", "/greeter");
+
+
+ registration = bc.registerService(GreeterService.class.getName(),
+ new GreeterServiceImpl(), props);
+ }
+
+ public void stop(BundleContext bc) throws Exception {
+ registration.unregister();
+ }
+}
Propchange: cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/rest/Activator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/rest/Activator.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/rest/GreeterServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/rest/GreeterServiceImpl.java?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/rest/GreeterServiceImpl.java (added)
+++ cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/rest/GreeterServiceImpl.java Thu Jun 18 17:59:18 2009
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.samples.greeter.impl.rest;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cxf.dosgi.samples.greeter.rest.GreeterException;
+import org.apache.cxf.dosgi.samples.greeter.rest.GreeterInfo;
+import org.apache.cxf.dosgi.samples.greeter.rest.GreeterService;
+import org.apache.cxf.dosgi.samples.greeter.rest.GreetingPhrase;
+
+public class GreeterServiceImpl implements GreeterService {
+
+ private final static String STRANGER_NAME = "Stranger";
+
+ public GreeterInfo greetMe(String name) throws GreeterException {
+ System.out.println("Invoking: greetMe(" + name + ")");
+
+ if (name.equals(STRANGER_NAME)) {
+ throw new GreeterException(name);
+ }
+
+ GreeterInfo info = new GreeterInfo();
+ List<GreetingPhrase> list = new ArrayList<GreetingPhrase>();
+ list.add(new GreetingPhrase("Hello", name));
+ list.add(new GreetingPhrase("Hoi", name));
+ list.add(new GreetingPhrase("Hola", name));
+ list.add(new GreetingPhrase("Bonjour", name));
+ info.setGreetings(list);
+ return info;
+ }
+
+}
Propchange: cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/rest/GreeterServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/dosgi/trunk/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/rest/GreeterServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/dosgi/trunk/samples/greeter_rest/interface/pom.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/greeter_rest/interface/pom.xml?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/samples/greeter_rest/interface/pom.xml (added)
+++ cxf/dosgi/trunk/samples/greeter_rest/interface/pom.xml Thu Jun 18 17:59:18 2009
@@ -0,0 +1,76 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.cxf.dosgi.samples</groupId>
+ <artifactId>cxf-dosgi-ri-samples-greeter-rest-interface</artifactId>
+ <packaging>bundle</packaging>
+ <name>Distributed OSGI Greeter Rest Interface Bundle</name>
+ <version>1.1-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.apache.cxf.dosgi</groupId>
+ <artifactId>cxf-dosgi-ri-parent</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <relativePath>../../../parent/pom.xml</relativePath>
+ </parent>
+
+ <properties>
+ <bundle.import.package>javax.ws.rs,*</bundle.import.package>
+ <bundle.export.package>org.apache.cxf.dosgi.samples.greeter.rest</bundle.export.package>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.specs</groupId>
+ <artifactId>org.apache.servicemix.specs.jsr311-api-1.0</artifactId>
+ <version>${servicemix.specs.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-Name>CXF Distributed OSGi Greeter Rest Demo Interface Bundle</Bundle-Name>
+ <Bundle-Description>This bundle contains the implementation of the CXF Distributed OSGi Greeter Rest Demo Interfaces</Bundle-Description>
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Import-Package>${bundle.import.package}</Import-Package>
+ <Export-Package>${bundle.export.package}</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange: cxf/dosgi/trunk/samples/greeter_rest/interface/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/dosgi/trunk/samples/greeter_rest/interface/pom.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: cxf/dosgi/trunk/samples/greeter_rest/interface/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreeterException.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreeterException.java?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreeterException.java (added)
+++ cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreeterException.java Thu Jun 18 17:59:18 2009
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.samples.greeter.rest;
+
+public class GreeterException extends Exception {
+
+ private String name;
+
+ public GreeterException() {
+ }
+
+ public GreeterException(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String theName) {
+ name = theName;
+ }
+
+ @Override
+ public String toString() {
+ return "GreeterService can not greet " + name;
+ }
+}
Propchange: cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreeterException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreeterException.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreeterInfo.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreeterInfo.java?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreeterInfo.java (added)
+++ cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreeterInfo.java Thu Jun 18 17:59:18 2009
@@ -0,0 +1,18 @@
+package org.apache.cxf.dosgi.samples.greeter.rest;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class GreeterInfo {
+ private List<GreetingPhrase> greetings = new ArrayList<GreetingPhrase>();
+
+ public void setGreetings(List<GreetingPhrase> list) {
+ greetings = list;
+ }
+
+ public List<GreetingPhrase> getGreetings() {
+ return greetings;
+ }
+
+
+}
Propchange: cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreeterInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreeterInfo.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreeterService.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreeterService.java?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreeterService.java (added)
+++ cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreeterService.java Thu Jun 18 17:59:18 2009
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.samples.greeter.rest;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+
+@Path("greeter")
+public interface GreeterService {
+
+ @GET
+ @Path("greeting/{name}")
+ GreeterInfo greetMe(@PathParam("name") String name) throws GreeterException;
+
+}
Propchange: cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreeterService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreeterService.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreetingPhrase.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreetingPhrase.java?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreetingPhrase.java (added)
+++ cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreetingPhrase.java Thu Jun 18 17:59:18 2009
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.samples.greeter.rest;
+
+public class GreetingPhrase {
+ private String phrase;
+ private String name;
+
+ public GreetingPhrase() {
+ }
+
+ public GreetingPhrase(String phrase, String name) {
+ this.phrase = phrase;
+ this.name = name;
+ }
+
+ public void setPhrase(String thePhrase) {
+ this.phrase = thePhrase;
+ }
+
+ public String getPhrase() {
+ return phrase;
+ }
+
+ public void setName(String theName) {
+ this.name = theName;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public int hashCode() {
+ return phrase.hashCode() + 37 * name.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (!GreetingPhrase.class.isAssignableFrom(other.getClass())) {
+ return false;
+ }
+
+ return phrase.equals(((GreetingPhrase)other).phrase)
+ && name.equals(((GreetingPhrase)other).name);
+ }
+}
Propchange: cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreetingPhrase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreetingPhrase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date