You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by cs...@apache.org on 2016/07/11 21:19:06 UTC
[1/2] cxf-dosgi git commit: Small refactoring
Repository: cxf-dosgi
Updated Branches:
refs/heads/master 7f75cc067 -> fc76aefaa
Small refactoring
Project: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/commit/53e649a2
Tree: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/tree/53e649a2
Diff: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/diff/53e649a2
Branch: refs/heads/master
Commit: 53e649a2e38a59112d2e3a261129eeab6cf1f746
Parents: 7f75cc0
Author: Christian Schneider <ch...@die-schneider.net>
Authored: Thu Jul 7 12:37:24 2016 +0200
Committer: Christian Schneider <ch...@die-schneider.net>
Committed: Thu Jul 7 12:37:24 2016 +0200
----------------------------------------------------------------------
.../common/httpservice/HttpServiceManager.java | 8 ++--
.../cxf/dosgi/common/util/ServerEndpoint.java | 49 ++++++++++++++++++++
.../cxf/dosgi/common/util/ServerWrapper.java | 49 --------------------
.../cxf/dosgi/dsw/handlers/rest/RsProvider.java | 4 +-
.../cxf/dosgi/dsw/handlers/ws/WsProvider.java | 4 +-
.../ws/PojoConfigurationTypeHandlerTest.java | 8 ++--
6 files changed, 61 insertions(+), 61 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/53e649a2/common/src/main/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManager.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManager.java b/common/src/main/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManager.java
index e03b605..4f2c40e 100644
--- a/common/src/main/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManager.java
+++ b/common/src/main/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManager.java
@@ -133,12 +133,12 @@ public class HttpServiceManager {
return "/" + type.getName().replace('.', '/');
}
- public String getAbsoluteAddress(String contextRoot, String relativeEndpointAddress) {
- if (relativeEndpointAddress.startsWith("http")) {
- return relativeEndpointAddress;
+ public String getAbsoluteAddress(String contextRoot, String endpointAddress) {
+ if (endpointAddress.startsWith("http")) {
+ return endpointAddress;
}
String effContextRoot = contextRoot == null ? cxfServletAlias : contextRoot;
- return this.httpBase + effContextRoot + relativeEndpointAddress;
+ return this.httpBase + effContextRoot + endpointAddress;
}
private final class UnregisterListener implements ServiceListener {
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/53e649a2/common/src/main/java/org/apache/cxf/dosgi/common/util/ServerEndpoint.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/util/ServerEndpoint.java b/common/src/main/java/org/apache/cxf/dosgi/common/util/ServerEndpoint.java
new file mode 100644
index 0000000..5d6d1a7
--- /dev/null
+++ b/common/src/main/java/org/apache/cxf/dosgi/common/util/ServerEndpoint.java
@@ -0,0 +1,49 @@
+/**
+ * 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.common.util;
+
+import java.io.IOException;
+
+import org.apache.aries.rsa.spi.Endpoint;
+import org.apache.cxf.endpoint.Server;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+
+public class ServerEndpoint implements Endpoint {
+ private EndpointDescription desc;
+ private Server server;
+
+ public ServerEndpoint(EndpointDescription desc, Server server) {
+ this.desc = desc;
+ this.server = server;
+ }
+
+ public Server getServer() {
+ return this.server;
+ }
+
+ @Override
+ public void close() throws IOException {
+ this.server.destroy();
+ }
+
+ @Override
+ public EndpointDescription description() {
+ return this.desc;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/53e649a2/common/src/main/java/org/apache/cxf/dosgi/common/util/ServerWrapper.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/util/ServerWrapper.java b/common/src/main/java/org/apache/cxf/dosgi/common/util/ServerWrapper.java
deleted file mode 100644
index 22144ca..0000000
--- a/common/src/main/java/org/apache/cxf/dosgi/common/util/ServerWrapper.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.common.util;
-
-import java.io.IOException;
-
-import org.apache.aries.rsa.spi.Endpoint;
-import org.apache.cxf.endpoint.Server;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-
-public class ServerWrapper implements Endpoint {
- private EndpointDescription desc;
- private Server server;
-
- public ServerWrapper(EndpointDescription desc, Server server) {
- this.desc = desc;
- this.server = server;
- }
-
- public Server getServer() {
- return this.server;
- }
-
- @Override
- public void close() throws IOException {
- this.server.destroy();
- }
-
- @Override
- public EndpointDescription description() {
- return this.desc;
- }
-}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/53e649a2/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java
----------------------------------------------------------------------
diff --git a/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java b/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java
index 050c642..44d70f4 100644
--- a/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java
+++ b/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java
@@ -36,7 +36,7 @@ import org.apache.cxf.dosgi.common.httpservice.HttpServiceManager;
import org.apache.cxf.dosgi.common.intent.IntentManager;
import org.apache.cxf.dosgi.common.proxy.ProxyFactory;
import org.apache.cxf.dosgi.common.util.OsgiUtils;
-import org.apache.cxf.dosgi.common.util.ServerWrapper;
+import org.apache.cxf.dosgi.common.util.ServerEndpoint;
import org.apache.cxf.endpoint.AbstractEndpointFactory;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
@@ -170,7 +170,7 @@ public class RsProvider implements DistributionProvider {
try {
Thread.currentThread().setContextClassLoader(JAXRSServerFactoryBean.class.getClassLoader());
Server server = factory.create();
- return new ServerWrapper(epd, server);
+ return new ServerEndpoint(epd, server);
} finally {
Thread.currentThread().setContextClassLoader(oldClassLoader);
}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/53e649a2/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java
----------------------------------------------------------------------
diff --git a/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java b/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java
index 26fdfd0..3c5cfd0 100644
--- a/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java
+++ b/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java
@@ -39,7 +39,7 @@ import org.apache.cxf.dosgi.common.httpservice.HttpServiceManager;
import org.apache.cxf.dosgi.common.intent.IntentManager;
import org.apache.cxf.dosgi.common.proxy.ProxyFactory;
import org.apache.cxf.dosgi.common.util.OsgiUtils;
-import org.apache.cxf.dosgi.common.util.ServerWrapper;
+import org.apache.cxf.dosgi.common.util.ServerEndpoint;
import org.apache.cxf.endpoint.AbstractEndpointFactory;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.frontend.ClientProxyFactoryBean;
@@ -213,7 +213,7 @@ public class WsProvider implements DistributionProvider {
try {
Thread.currentThread().setContextClassLoader(ServerFactoryBean.class.getClassLoader());
Server server = factory.create();
- return new ServerWrapper(epd, server);
+ return new ServerEndpoint(epd, server);
} finally {
Thread.currentThread().setContextClassLoader(oldClassLoader);
}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/53e649a2/provider-ws/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ws/PojoConfigurationTypeHandlerTest.java
----------------------------------------------------------------------
diff --git a/provider-ws/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ws/PojoConfigurationTypeHandlerTest.java b/provider-ws/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ws/PojoConfigurationTypeHandlerTest.java
index 4ab9b31..c935f3d 100644
--- a/provider-ws/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ws/PojoConfigurationTypeHandlerTest.java
+++ b/provider-ws/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ws/PojoConfigurationTypeHandlerTest.java
@@ -31,7 +31,7 @@ import org.apache.aries.rsa.util.EndpointHelper;
import org.apache.cxf.dosgi.common.httpservice.HttpServiceManager;
import org.apache.cxf.dosgi.common.intent.IntentManager;
import org.apache.cxf.dosgi.common.intent.IntentManagerImpl;
-import org.apache.cxf.dosgi.common.util.ServerWrapper;
+import org.apache.cxf.dosgi.common.util.ServerEndpoint;
import org.apache.cxf.dosgi.dsw.handlers.jaxws.MyJaxWsEchoService;
import org.apache.cxf.dosgi.dsw.handlers.simple.MySimpleEchoService;
import org.apache.cxf.endpoint.AbstractEndpointFactory;
@@ -214,7 +214,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
@Override
protected Endpoint createServerFromFactory(ServerFactoryBean factory,
EndpointDescription epd) {
- return new ServerWrapper(epd, null);
+ return new ServerEndpoint(epd, null);
}
};
handler.setIntentManager(intentManager);
@@ -356,7 +356,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
Object myService = null;
c.replay();
- ServerWrapper serverWrapper = (ServerWrapper)handler.exportService(myService,
+ ServerEndpoint serverWrapper = (ServerEndpoint)handler.exportService(myService,
serviceBC,
sd,
new Class[]{MyJaxWsEchoService.class});
@@ -383,7 +383,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
sd.put(WsConstants.WS_ADDRESS_PROPERTY, "/somewhere_else");
BundleContext serviceBC = c.createMock(BundleContext.class);
c.replay();
- ServerWrapper serverWrapper = (ServerWrapper)handler.exportService(null, serviceBC, sd,
+ ServerEndpoint serverWrapper = (ServerEndpoint)handler.exportService(null, serviceBC, sd,
new Class[]{MySimpleEchoService.class});
c.verify();
[2/2] cxf-dosgi git commit: [DOSGI-245] Add provider handling for
JAXRS
Posted by cs...@apache.org.
[DOSGI-245] Add provider handling for JAXRS
Project: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/commit/fc76aefa
Tree: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/tree/fc76aefa
Diff: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/diff/fc76aefa
Branch: refs/heads/master
Commit: fc76aefaa751ea1c7fd40c3cf6b0e7bb9911f2e5
Parents: 53e649a
Author: Christian Schneider <ch...@die-schneider.net>
Authored: Mon Jul 11 23:18:53 2016 +0200
Committer: Christian Schneider <ch...@die-schneider.net>
Committed: Mon Jul 11 23:18:53 2016 +0200
----------------------------------------------------------------------
.../common/httpservice/HttpServiceManager.java | 2 +-
.../cxf/dosgi/common/intent/IntentHandler.java | 27 +++
.../cxf/dosgi/common/intent/IntentHelper.java | 63 +++++++
.../cxf/dosgi/common/intent/IntentManager.java | 12 +-
.../dosgi/common/intent/IntentManagerImpl.java | 177 -------------------
.../cxf/dosgi/common/intent/IntentProvider.java | 28 +++
.../intent/impl/DefaultIntentsHandler.java | 55 ++++++
.../common/intent/impl/IntentManagerImpl.java | 153 ++++++++++++++++
provider-rs/pom.xml | 18 ++
.../handlers/rest/ProviderIntentHandler.java | 43 +++++
.../cxf/dosgi/dsw/handlers/rest/RsProvider.java | 46 +++--
.../dsw/handlers/rest/provider/MyReader.java | 55 ++++++
.../dsw/handlers/rest/provider/MyWriter.java | 69 ++++++++
.../rest/provider/RsProviderCustomTest.java | 103 +++++++++++
.../dosgi/dsw/handlers/rest/provider/Task.java | 38 ++++
.../dsw/handlers/rest/provider/TaskService.java | 28 +++
.../handlers/rest/provider/TaskServiceImpl.java | 28 +++
.../handlers/rest/simple/RsProviderTest.java | 77 ++++++++
.../dosgi/dsw/handlers/rest/simple/Task.java | 41 +++++
.../dsw/handlers/rest/simple/TaskService.java | 28 +++
.../handlers/rest/simple/TaskServiceImpl.java | 28 +++
.../cxf/dosgi/dsw/handlers/ws/WsProvider.java | 21 ++-
.../ws/PojoConfigurationTypeHandlerTest.java | 103 +++++------
.../greeter/impl/rest/GreeterServiceImpl.java | 1 -
24 files changed, 969 insertions(+), 275 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/common/src/main/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManager.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManager.java b/common/src/main/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManager.java
index 4f2c40e..5aab6be 100644
--- a/common/src/main/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManager.java
+++ b/common/src/main/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManager.java
@@ -72,7 +72,7 @@ public class HttpServiceManager {
this.context = compContext.getBundleContext();
}
- void initFromConfig(Dictionary<String, Object> config) {
+ public void initFromConfig(Dictionary<String, Object> config) {
if (config == null) {
config = new Hashtable<String, Object>();
}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentHandler.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentHandler.java b/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentHandler.java
new file mode 100644
index 0000000..902a657
--- /dev/null
+++ b/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentHandler.java
@@ -0,0 +1,27 @@
+/**
+ * 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.common.intent;
+
+import org.apache.cxf.endpoint.AbstractEndpointFactory;
+
+public interface IntentHandler {
+
+ boolean apply(AbstractEndpointFactory factory, String intentName, Object intent);
+
+}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentHelper.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentHelper.java b/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentHelper.java
new file mode 100644
index 0000000..ca8dbac
--- /dev/null
+++ b/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentHelper.java
@@ -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.common.intent;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.cxf.dosgi.common.util.OsgiUtils;
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
+
+public final class IntentHelper {
+ private IntentHelper() {
+ }
+
+ public static Set<String> getExported(Map<String, Object> sd) {
+ Set<String> allIntents = new HashSet<String>();
+ Collection<String> intents = OsgiUtils
+ .getMultiValueProperty(sd.get(RemoteConstants.SERVICE_EXPORTED_INTENTS));
+ if (intents != null) {
+ allIntents.addAll(parseIntents(intents));
+ }
+ Collection<String> intents2 = OsgiUtils
+ .getMultiValueProperty(sd.get(RemoteConstants.SERVICE_EXPORTED_INTENTS_EXTRA));
+ if (intents2 != null) {
+ allIntents.addAll(parseIntents(intents2));
+ }
+ return allIntents;
+ }
+
+ public static Set<String> getImported(Map<String, Object> sd) {
+ Collection<String> intents = OsgiUtils.getMultiValueProperty(sd.get(RemoteConstants.SERVICE_INTENTS));
+ return intents == null ? new HashSet<String>() : new HashSet<String>(intents);
+ }
+
+ private static Collection<String> parseIntents(Collection<String> intents) {
+ List<String> parsed = new ArrayList<String>();
+ for (String intent : intents) {
+ parsed.addAll(Arrays.asList(intent.split("[ ]")));
+ }
+ return parsed;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentManager.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentManager.java b/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentManager.java
index baa0b0c..e6609b5 100644
--- a/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentManager.java
+++ b/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentManager.java
@@ -18,15 +18,17 @@
*/
package org.apache.cxf.dosgi.common.intent;
-import java.util.List;
-import java.util.Map;
+import java.util.Set;
+import org.apache.aries.rsa.spi.IntentUnsatisfiedException;
import org.apache.cxf.endpoint.AbstractEndpointFactory;
-import org.apache.cxf.feature.Feature;
public interface IntentManager {
String INTENT_NAME_PROP = "org.apache.cxf.dosgi.IntentName";
- String[] applyIntents(List<Feature> features, AbstractEndpointFactory factory, Map<String, Object> props);
- void assertAllIntentsSupported(Map<String, Object> serviceProperties);
+ String[] assertAllIntentsSupported(Set<String> reuiredIntents);
+ void applyIntents(AbstractEndpointFactory factory, //
+ Set<String> requiredIntents, //
+ IntentHandler ... handlers)
+ throws IntentUnsatisfiedException;
}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentManagerImpl.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentManagerImpl.java b/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentManagerImpl.java
deleted file mode 100644
index 4cb23fd..0000000
--- a/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentManagerImpl.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/**
- * 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.common.intent;
-
-import static org.osgi.service.component.annotations.ReferenceCardinality.MULTIPLE;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.aries.rsa.spi.IntentUnsatisfiedException;
-import org.apache.cxf.binding.BindingConfiguration;
-import org.apache.cxf.databinding.DataBinding;
-import org.apache.cxf.dosgi.common.util.OsgiUtils;
-import org.apache.cxf.endpoint.AbstractEndpointFactory;
-import org.apache.cxf.feature.Feature;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Reference;
-import org.osgi.service.component.annotations.ReferencePolicy;
-import org.osgi.service.component.annotations.ReferencePolicyOption;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@Component(service = IntentManager.class)
-public class IntentManagerImpl implements IntentManager {
-
- static final Logger LOG = LoggerFactory.getLogger(IntentManagerImpl.class);
- private static final int DEFAULT_INTENT_TIMEOUT = 30000;
-
- private final Map<String, Object> intentMap;
- private final long maxIntentWaitTime = DEFAULT_INTENT_TIMEOUT;
-
- public IntentManagerImpl() {
- this.intentMap = new HashMap<String, Object>();
- }
-
- @Reference //
- (//
- cardinality = MULTIPLE, //
- policy = ReferencePolicy.DYNAMIC, //
- target = "(" + IntentManager.INTENT_NAME_PROP + "=*)", //
- policyOption = ReferencePolicyOption.GREEDY
- )
- public synchronized void addIntent(Object intent, Map<String, ?> props) {
- String intentName = (String)props.get(INTENT_NAME_PROP);
- LOG.info("Adding custom intent " + intentName);
- intentMap.put(intentName, intent);
- }
-
- public synchronized void removeIntent(Object intent, Map<String, ?> props) {
- String intentName = (String)props.get(INTENT_NAME_PROP);
- intentMap.remove(intentName);
- }
-
- public synchronized String[] applyIntents(List<Feature> features, AbstractEndpointFactory factory,
- Map<String, Object> props)
- throws IntentUnsatisfiedException {
- Set<String> requiredIntents = IntentManagerImpl.getRequestedIntents(props);
- List<String> missingIntents = getMissingIntents(requiredIntents);
- if (!missingIntents.isEmpty()) {
- throw new IntentUnsatisfiedException(missingIntents.iterator().next());
- }
- Set<String> requestedIntents = IntentManagerImpl.getRequestedIntents(props);
- Set<String> appliedIntents = new HashSet<String>();
- for (String intentName : requestedIntents) {
- processIntent(features, factory, intentName, intentMap.get(intentName));
- appliedIntents.add(intentName);
- }
- return appliedIntents.toArray(new String[appliedIntents.size()]);
- }
-
- private static Set<String> getRequestedIntents(Map<String, Object> sd) {
- Set<String> allIntents = new HashSet<String>();
- Collection<String> intents = OsgiUtils
- .getMultiValueProperty(sd.get(RemoteConstants.SERVICE_EXPORTED_INTENTS));
- if (intents != null) {
- allIntents.addAll(parseIntents(intents));
- }
- Collection<String> intents2 = OsgiUtils
- .getMultiValueProperty(sd.get(RemoteConstants.SERVICE_EXPORTED_INTENTS_EXTRA));
- if (intents2 != null) {
- allIntents.addAll(parseIntents(intents2));
- }
- return allIntents;
- }
-
- private static Collection<String> parseIntents(Collection<String> intents) {
- List<String> parsed = new ArrayList<String>();
- for (String intent : intents) {
- parsed.addAll(Arrays.asList(intent.split("[ ]")));
- }
- return parsed;
- }
-
- private boolean processIntent(List<Feature> features, AbstractEndpointFactory factory, String intentName,
- Object intent)
- throws IntentUnsatisfiedException {
- if (intent instanceof DataBinding) {
- DataBinding dataBinding = (DataBinding) intent;
- LOG.info("Applying intent: " + intentName + " via data binding: " + dataBinding);
- factory.setDataBinding(dataBinding);
- return false;
- } else if (intent instanceof BindingConfiguration) {
- BindingConfiguration bindingCfg = (BindingConfiguration)intent;
- LOG.info("Applying intent: " + intentName + " via binding config: " + bindingCfg);
- factory.setBindingConfig(bindingCfg);
- return true;
- } else if (intent instanceof Feature) {
- Feature feature = (Feature)intent;
- LOG.info("Applying intent: " + intentName + " via feature: " + feature);
- features.add(feature);
- return false;
- } else {
- LOG.info("No mapping for intent: " + intentName);
- throw new IntentUnsatisfiedException(intentName);
- }
- }
-
- public synchronized void assertAllIntentsSupported(Map<String, Object> serviceProperties) {
- long endTime = System.currentTimeMillis() + maxIntentWaitTime;
- Set<String> requiredIntents = IntentManagerImpl.getRequestedIntents(serviceProperties);
-
- List<String> unsupportedIntents;
- do {
- unsupportedIntents = getMissingIntents(requiredIntents);
- long remainingSeconds = (endTime - System.currentTimeMillis()) / 1000;
- if (!unsupportedIntents.isEmpty() && remainingSeconds > 0) {
- LOG.info("Waiting for custom intents " + unsupportedIntents + " timeout in "
- + remainingSeconds);
- try {
- wait(1000);
- } catch (InterruptedException e) {
- LOG.warn(e.getMessage(), e);
- }
- }
- } while (!unsupportedIntents.isEmpty() && System.currentTimeMillis() < endTime);
-
- if (!unsupportedIntents.isEmpty()) {
- throw new RuntimeException("service cannot be exported because the following "
- + "intents are not supported by this RSA: " + unsupportedIntents);
- }
- }
-
- private synchronized List<String> getMissingIntents(Set<String> requiredIntents) {
- List<String> unsupportedIntents = new ArrayList<String>();
- unsupportedIntents.clear();
- for (String ri : requiredIntents) {
- if (!intentMap.containsKey(ri)) {
- unsupportedIntents.add(ri);
- }
- }
- return unsupportedIntents;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentProvider.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentProvider.java b/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentProvider.java
new file mode 100644
index 0000000..10a970a
--- /dev/null
+++ b/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentProvider.java
@@ -0,0 +1,28 @@
+/**
+ * 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.common.intent;
+
+import java.util.List;
+
+/**
+ * Allows to provide a list of intents under one name
+ */
+public interface IntentProvider {
+ List<Object> getIntents();
+}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/common/src/main/java/org/apache/cxf/dosgi/common/intent/impl/DefaultIntentsHandler.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/intent/impl/DefaultIntentsHandler.java b/common/src/main/java/org/apache/cxf/dosgi/common/intent/impl/DefaultIntentsHandler.java
new file mode 100644
index 0000000..396830b
--- /dev/null
+++ b/common/src/main/java/org/apache/cxf/dosgi/common/intent/impl/DefaultIntentsHandler.java
@@ -0,0 +1,55 @@
+/**
+ * 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.common.intent.impl;
+
+import org.apache.cxf.binding.BindingConfiguration;
+import org.apache.cxf.databinding.DataBinding;
+import org.apache.cxf.dosgi.common.intent.IntentHandler;
+import org.apache.cxf.endpoint.AbstractEndpointFactory;
+import org.apache.cxf.feature.Feature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DefaultIntentsHandler implements IntentHandler {
+ static final Logger LOG = LoggerFactory.getLogger(IntentManagerImpl.class);
+
+ @Override
+ public boolean apply(AbstractEndpointFactory factory, String intentName, Object intent) {
+ String prefix = "Applying intent: " + intentName + " via ";
+ if (intent instanceof DataBinding) {
+ DataBinding dataBinding = (DataBinding) intent;
+ LOG.info(prefix + "data binding: " + dataBinding);
+ factory.setDataBinding(dataBinding);
+ return true;
+ } else if (intent instanceof BindingConfiguration) {
+ BindingConfiguration bindingCfg = (BindingConfiguration)intent;
+ LOG.info(prefix + "binding config: " + bindingCfg);
+ factory.setBindingConfig(bindingCfg);
+ return true;
+ } else if (intent instanceof Feature) {
+ Feature feature = (Feature)intent;
+ LOG.info(prefix + "feature: " + feature);
+ factory.getFeatures().add(feature);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/common/src/main/java/org/apache/cxf/dosgi/common/intent/impl/IntentManagerImpl.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/intent/impl/IntentManagerImpl.java b/common/src/main/java/org/apache/cxf/dosgi/common/intent/impl/IntentManagerImpl.java
new file mode 100644
index 0000000..7c0f6c8
--- /dev/null
+++ b/common/src/main/java/org/apache/cxf/dosgi/common/intent/impl/IntentManagerImpl.java
@@ -0,0 +1,153 @@
+/**
+ * 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.common.intent.impl;
+
+import static org.osgi.service.component.annotations.ReferenceCardinality.MULTIPLE;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.aries.rsa.spi.IntentUnsatisfiedException;
+import org.apache.cxf.dosgi.common.intent.IntentHandler;
+import org.apache.cxf.dosgi.common.intent.IntentManager;
+import org.apache.cxf.dosgi.common.intent.IntentProvider;
+import org.apache.cxf.endpoint.AbstractEndpointFactory;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferencePolicy;
+import org.osgi.service.component.annotations.ReferencePolicyOption;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Component(service = IntentManager.class)
+public class IntentManagerImpl implements IntentManager {
+
+ static final Logger LOG = LoggerFactory.getLogger(IntentManagerImpl.class);
+ private static final int DEFAULT_INTENT_TIMEOUT = 30000;
+
+ private final Map<String, Object> intentMap;
+ private final long maxIntentWaitTime = DEFAULT_INTENT_TIMEOUT;
+
+ public IntentManagerImpl() {
+ this.intentMap = new HashMap<String, Object>();
+ }
+
+ @Reference //
+ (//
+ cardinality = MULTIPLE, //
+ policy = ReferencePolicy.DYNAMIC, //
+ target = "(" + IntentManager.INTENT_NAME_PROP + "=*)", //
+ policyOption = ReferencePolicyOption.GREEDY
+ )
+ public synchronized void addIntent(Object intent, Map<String, ?> props) {
+ String intentName = (String)props.get(INTENT_NAME_PROP);
+ LOG.info("Adding custom intent " + intentName);
+ intentMap.put(intentName, intent);
+ }
+
+ public synchronized void removeIntent(Object intent, Map<String, ?> props) {
+ String intentName = (String)props.get(INTENT_NAME_PROP);
+ intentMap.remove(intentName);
+ }
+
+ @Override
+ public synchronized void applyIntents(AbstractEndpointFactory factory,
+ Set<String> requiredIntents,
+ IntentHandler... handlers)
+ throws IntentUnsatisfiedException {
+ Set<String> missingIntents = getMissingIntents(requiredIntents);
+ if (!missingIntents.isEmpty()) {
+ throw new IntentUnsatisfiedException(missingIntents.iterator().next());
+ }
+ List<IntentHandler> allHandlers = new ArrayList<IntentHandler>();
+ allHandlers.add(new DefaultIntentsHandler());
+ allHandlers.addAll(Arrays.asList(handlers));
+ for (String intentName : requiredIntents) {
+ Object intent = intentMap.get(intentName);
+ if (intent instanceof IntentProvider) {
+ applyIntentProvider(factory, intentName, (IntentProvider)intent, allHandlers);
+ } else {
+ applyIntent(factory, intentName, intent, allHandlers);
+ }
+ }
+ }
+
+ private void applyIntentProvider(AbstractEndpointFactory factory,
+ String intentName,
+ IntentProvider intentProvider,
+ List<IntentHandler> handlers) {
+ for (Object intent : intentProvider.getIntents()) {
+ applyIntent(factory, intentName, intent, handlers);
+ }
+
+ }
+
+ private void applyIntent(AbstractEndpointFactory factory, String intentName, Object intent,
+ List<IntentHandler> handlers) {
+ for (IntentHandler handler : handlers) {
+ if (handler.apply(factory, intentName, intent)) {
+ return;
+ }
+ }
+ LOG.info("No mapping for intent: " + intentName);
+ throw new IntentUnsatisfiedException(intentName);
+ }
+
+ public synchronized String[] assertAllIntentsSupported(Set<String> requiredIntents) {
+ long endTime = System.currentTimeMillis() + maxIntentWaitTime;
+ Set<String> unsupportedIntents;
+ do {
+ unsupportedIntents = getMissingIntents(requiredIntents);
+ long remainingSeconds = (endTime - System.currentTimeMillis()) / 1000;
+ if (!unsupportedIntents.isEmpty() && remainingSeconds > 0) {
+ LOG.info("Waiting for custom intents " + Arrays.toString(unsupportedIntents.toArray()) + " timeout in "
+ + remainingSeconds);
+ try {
+ wait(1000);
+ } catch (InterruptedException e) {
+ LOG.warn(e.getMessage(), e);
+ }
+ }
+ } while (!unsupportedIntents.isEmpty() && System.currentTimeMillis() < endTime);
+
+ if (!unsupportedIntents.isEmpty()) {
+ throw new RuntimeException("service cannot be exported because the following "
+ + "intents are not supported by this RSA: " + unsupportedIntents);
+ }
+ return requiredIntents.toArray(new String[]{});
+ }
+
+ private synchronized Set<String> getMissingIntents(Collection<String> requiredIntents) {
+ Set<String> unsupportedIntents = new HashSet<String>();
+ unsupportedIntents.clear();
+ for (String ri : requiredIntents) {
+ if (!intentMap.containsKey(ri)) {
+ unsupportedIntents.add(ri);
+ }
+ }
+ return unsupportedIntents;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/provider-rs/pom.xml
----------------------------------------------------------------------
diff --git a/provider-rs/pom.xml b/provider-rs/pom.xml
index 664b3d7..4efa32a 100644
--- a/provider-rs/pom.xml
+++ b/provider-rs/pom.xml
@@ -57,5 +57,23 @@
<artifactId>cxf-rt-rs-client</artifactId>
<version>${cxf.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-databinding-jaxb</artifactId>
+ <version>${cxf.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http-jetty</artifactId>
+ <version>${cxf.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jdk14</artifactId>
+ <version>1.7.21</version>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/ProviderIntentHandler.java
----------------------------------------------------------------------
diff --git a/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/ProviderIntentHandler.java b/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/ProviderIntentHandler.java
new file mode 100644
index 0000000..3ecae6b
--- /dev/null
+++ b/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/ProviderIntentHandler.java
@@ -0,0 +1,43 @@
+/**
+ * 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.rest;
+
+import java.util.List;
+
+import org.apache.cxf.dosgi.common.intent.IntentHandler;
+import org.apache.cxf.endpoint.AbstractEndpointFactory;
+import org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean;
+
+public class ProviderIntentHandler implements IntentHandler {
+
+ @SuppressWarnings({
+ "rawtypes", "unchecked"
+ })
+ @Override
+ public boolean apply(AbstractEndpointFactory factory, String intentName, Object intent) {
+ if (!(factory instanceof AbstractJAXRSFactoryBean)) {
+ throw new RuntimeException("RsIntentHandler only works on JAXRS factory");
+ }
+ AbstractJAXRSFactoryBean jaxrsFactory = (AbstractJAXRSFactoryBean)factory;
+ List providers = jaxrsFactory.getProviders();
+ providers.add(intent);
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java
----------------------------------------------------------------------
diff --git a/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java b/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java
index 44d70f4..2a61970 100644
--- a/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java
+++ b/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java
@@ -25,6 +25,7 @@ import static org.osgi.service.remoteserviceadmin.RemoteConstants.REMOTE_INTENTS
import java.net.URL;
import java.util.Collection;
import java.util.Map;
+import java.util.Set;
import org.apache.aries.rsa.spi.DistributionProvider;
import org.apache.aries.rsa.spi.Endpoint;
@@ -33,6 +34,7 @@ import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.common.util.ProxyClassLoader;
import org.apache.cxf.dosgi.common.httpservice.HttpServiceManager;
+import org.apache.cxf.dosgi.common.intent.IntentHelper;
import org.apache.cxf.dosgi.common.intent.IntentManager;
import org.apache.cxf.dosgi.common.proxy.ProxyFactory;
import org.apache.cxf.dosgi.common.util.OsgiUtils;
@@ -81,7 +83,8 @@ public class RsProvider implements DistributionProvider {
BundleContext consumerContext,
Class[] interfaces,
EndpointDescription endpoint) {
- intentManager.assertAllIntentsSupported(endpoint.getProperties());
+ Set<String> intents = IntentHelper.getImported(endpoint.getProperties());
+ intentManager.assertAllIntentsSupported(intents);
Class<?> iClass = interfaces[0];
String address = OsgiUtils.getProperty(endpoint, RsConstants.RS_ADDRESS_PROPERTY);
if (address == null) {
@@ -91,7 +94,7 @@ public class RsProvider implements DistributionProvider {
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(JAXRSClientFactoryBean.class.getClassLoader());
- return createJaxrsProxy(address, consumerContext, iClass, null, endpoint);
+ return createJaxrsProxy(address, iClass, null, endpoint);
} catch (Throwable e) {
Thread.currentThread().setContextClassLoader(oldClassLoader);
}
@@ -99,7 +102,7 @@ public class RsProvider implements DistributionProvider {
try {
ProxyClassLoader cl = new ProxyClassLoader(iClass.getClassLoader());
cl.addLoader(Client.class.getClassLoader());
- return createJaxrsProxy(address, consumerContext, iClass, cl, endpoint);
+ return createJaxrsProxy(address, iClass, cl, endpoint);
} catch (Throwable e) {
LOG.warn("proxy creation failed", e);
}
@@ -107,20 +110,22 @@ public class RsProvider implements DistributionProvider {
return null;
}
- protected Object createJaxrsProxy(String address,
- BundleContext callingContext,
+ private Object createJaxrsProxy(String address,
Class<?> iClass,
ClassLoader loader,
EndpointDescription endpoint) {
- JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
- bean.setAddress(address);
+ JAXRSClientFactoryBean factory = new JAXRSClientFactoryBean();
+ factory.setAddress(address);
if (loader != null) {
- bean.setClassLoader(loader);
+ factory.setClassLoader(loader);
}
- addContextProperties(bean, endpoint.getProperties(), RsConstants.RS_CONTEXT_PROPS_PROP_KEY);
- bean.setServiceClass(iClass);
- intentManager.applyIntents(bean.getFeatures(), bean, endpoint.getProperties());
- return ProxyFactory.create(bean.create(), iClass);
+ addContextProperties(factory, endpoint.getProperties(), RsConstants.RS_CONTEXT_PROPS_PROP_KEY);
+ factory.setServiceClass(iClass);
+ Set<String> intents = IntentHelper.getImported(endpoint.getProperties());
+ intentManager.applyIntents(factory, intents, new ProviderIntentHandler());
+ // Apply providers
+ factory.setProviders(factory.getProviders());
+ return ProxyFactory.create(factory.create(), iClass);
}
@SuppressWarnings("rawtypes")
@@ -143,7 +148,8 @@ public class RsProvider implements DistributionProvider {
}
}
final Long sid = (Long) endpointProps.get(RemoteConstants.ENDPOINT_SERVICE_ID);
- intentManager.assertAllIntentsSupported(endpointProps);
+ Set<String> intents = IntentHelper.getExported(endpointProps);
+ intentManager.assertAllIntentsSupported(intents);
Bus bus = BusFactory.newInstance().createBus();
if (contextRoot != null) {
httpServiceManager.registerServlet(bus, contextRoot, callingContext, sid);
@@ -152,10 +158,12 @@ public class RsProvider implements DistributionProvider {
JAXRSServerFactoryBean factory = createServerFactory(callingContext, endpointProps,
iClass, serviceBean, address, bus);
- String[] intents = intentManager.applyIntents(factory.getFeatures(), factory, endpointProps);
+ intentManager.applyIntents(factory, intents, new ProviderIntentHandler());
String completeEndpointAddress = httpServiceManager.getAbsoluteAddress(contextRoot, address);
- EndpointDescription epd = createEndpointDesc(endpointProps, new String[] {RsConstants.RS_CONFIG_TYPE},
- completeEndpointAddress, intents);
+ EndpointDescription epd = createEndpointDesc(endpointProps, //
+ new String[] {RsConstants.RS_CONFIG_TYPE},
+ completeEndpointAddress,
+ intents);
return createServerFromFactory(factory, epd);
}
@@ -203,10 +211,10 @@ public class RsProvider implements DistributionProvider {
}
}
- protected EndpointDescription createEndpointDesc(Map<String, Object> props,
+ private EndpointDescription createEndpointDesc(Map<String, Object> props,
String[] importedConfigs,
String address,
- String[] intents) {
+ Set<String> intents) {
props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, importedConfigs);
props.put(RsConstants.RS_ADDRESS_PROPERTY, address);
props.put(RemoteConstants.SERVICE_INTENTS, intents);
@@ -214,7 +222,7 @@ public class RsProvider implements DistributionProvider {
return new EndpointDescription(props);
}
- protected String getServerAddress(Map<String, Object> sd, Class<?> iClass) {
+ private String getServerAddress(Map<String, Object> sd, Class<?> iClass) {
String address = OsgiUtils.getProperty(sd, RsConstants.RS_ADDRESS_PROPERTY);
return address == null ? httpServiceManager.getDefaultAddress(iClass) : address;
}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/MyReader.java
----------------------------------------------------------------------
diff --git a/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/MyReader.java b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/MyReader.java
new file mode 100644
index 0000000..08c8870
--- /dev/null
+++ b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/MyReader.java
@@ -0,0 +1,55 @@
+/**
+ * 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.rest.provider;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+public class MyReader implements MessageBodyReader<Task> {
+
+ @Override
+ public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations,
+ MediaType mediaType) {
+ return type == Task.class;
+ }
+
+ @Override
+ public Task readFrom(Class<Task> type, Type genericType, Annotation[] annotations, MediaType mediaType,
+ MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
+ throws IOException, WebApplicationException {
+ try (Reader reader = new InputStreamReader(entityStream);
+ BufferedReader breader = new BufferedReader(reader)) {
+ String name = breader.readLine();
+ return new Task(name);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/MyWriter.java
----------------------------------------------------------------------
diff --git a/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/MyWriter.java b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/MyWriter.java
new file mode 100644
index 0000000..30b2366
--- /dev/null
+++ b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/MyWriter.java
@@ -0,0 +1,69 @@
+/**
+ * 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.rest.provider;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Provider;
+
+import org.osgi.service.component.annotations.Component;
+
+@Component//
+(//
+ immediate = true, //
+ property = //
+ {
+ "org.apache.cxf.dosgi.IntentName=mytask", //
+ } //
+)
+@Provider
+public class MyWriter implements MessageBodyWriter<Task> {
+
+ @Override
+ public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations,
+ MediaType mediaType) {
+ return type == Task.class;
+ }
+
+ @Override
+ public long getSize(Task t, Class<?> type, Type genericType, Annotation[] annotations,
+ MediaType mediaType) {
+ return 0;
+ }
+
+ @Override
+ public void writeTo(Task t, Class<?> type, Type genericType, Annotation[] annotations,
+ MediaType mediaType, MultivaluedMap<String, Object> httpHeaders,
+ OutputStream entityStream)
+ throws IOException, WebApplicationException {
+ try (OutputStreamWriter writer = new OutputStreamWriter(entityStream)) {
+ writer.write(t.getName());
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/RsProviderCustomTest.java
----------------------------------------------------------------------
diff --git a/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/RsProviderCustomTest.java b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/RsProviderCustomTest.java
new file mode 100644
index 0000000..19689c1
--- /dev/null
+++ b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/RsProviderCustomTest.java
@@ -0,0 +1,103 @@
+/**
+ * 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.rest.provider;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.aries.rsa.spi.Endpoint;
+import org.apache.cxf.dosgi.common.httpservice.HttpServiceManager;
+import org.apache.cxf.dosgi.common.intent.IntentManager;
+import org.apache.cxf.dosgi.common.intent.IntentProvider;
+import org.apache.cxf.dosgi.common.intent.impl.IntentManagerImpl;
+import org.apache.cxf.dosgi.dsw.handlers.rest.RsConstants;
+import org.apache.cxf.dosgi.dsw.handlers.rest.RsProvider;
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Test;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
+
+public class RsProviderCustomTest {
+
+ @Test
+ public void testCustomProvider() throws IOException {
+ RsProvider rsProvider = new RsProvider();
+ HttpServiceManager httpServiceManager = new HttpServiceManager();
+ Dictionary<String, Object> config = new Hashtable<>();
+ httpServiceManager.initFromConfig(config);
+ rsProvider.setHttpServiceManager(httpServiceManager);
+ IntentManagerImpl intentManager = new IntentManagerImpl();
+ addIntent(intentManager, "my", MyWriter.class, MyReader.class);
+ rsProvider.setIntentManager(intentManager);
+ TaskServiceImpl taskService = new TaskServiceImpl();
+ BundleContext callingContext = EasyMock.createMock(BundleContext.class);
+
+ Map<String, Object> props = new HashMap<>();
+ props.put(Constants.OBJECTCLASS, new String[]{TaskService.class.getName()});
+ String serviceAddress = "http://localhost:8181/";
+ props.put(RsConstants.RS_ADDRESS_PROPERTY, serviceAddress);
+ props.put(RemoteConstants.SERVICE_EXPORTED_INTENTS, "my");
+ Class<?>[] ifaces = new Class[]{TaskService.class};
+ Endpoint endpoint = rsProvider.exportService(taskService,
+ callingContext,
+ props,
+ ifaces);
+ Assert.assertEquals(serviceAddress, endpoint.description().getId());
+ Assert.assertEquals("my", endpoint.description().getIntents().iterator().next());
+
+ List<Object> providers = Arrays.asList((Object)MyReader.class);
+ Task task1 = WebClient.create(serviceAddress, providers).path("/task").get(Task.class);
+ Assert.assertEquals("test", task1.getName());
+
+ TaskService proxy = (TaskService)rsProvider.importEndpoint(TaskService.class.getClassLoader(),
+ callingContext, ifaces, endpoint.description());
+ Task task = proxy.getTask();
+ Assert.assertEquals("test", task.getName());
+ endpoint.close();
+ }
+
+ private void addIntent(IntentManagerImpl intentManager, String name, Object ... intents) {
+ IntentProvider provider = intentProvider(intents);
+ intentManager.addIntent(provider, intentProps(name));
+ }
+
+ private IntentProvider intentProvider(final Object ... intents) {
+ return new IntentProvider() {
+
+ @Override
+ public List<Object> getIntents() {
+ return Arrays.asList(intents);
+ }
+ };
+ }
+
+ private Map<String, String> intentProps(String name) {
+ Map<String, String> props = new HashMap<>();
+ props.put(IntentManager.INTENT_NAME_PROP, name);
+ return props;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/Task.java
----------------------------------------------------------------------
diff --git a/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/Task.java b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/Task.java
new file mode 100644
index 0000000..d45dee6
--- /dev/null
+++ b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/Task.java
@@ -0,0 +1,38 @@
+/**
+ * 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.rest.provider;
+
+public class Task {
+ String name;
+
+ public Task() {
+ }
+
+ public Task(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/TaskService.java
----------------------------------------------------------------------
diff --git a/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/TaskService.java b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/TaskService.java
new file mode 100644
index 0000000..f7868b2
--- /dev/null
+++ b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/TaskService.java
@@ -0,0 +1,28 @@
+/**
+ * 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.rest.provider;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+@Path("/task")
+public interface TaskService {
+ @GET
+ Task getTask();
+}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/TaskServiceImpl.java
----------------------------------------------------------------------
diff --git a/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/TaskServiceImpl.java b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/TaskServiceImpl.java
new file mode 100644
index 0000000..85751c2
--- /dev/null
+++ b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/provider/TaskServiceImpl.java
@@ -0,0 +1,28 @@
+/**
+ * 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.rest.provider;
+
+public class TaskServiceImpl implements TaskService {
+
+ @Override
+ public Task getTask() {
+ return new Task("test");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/simple/RsProviderTest.java
----------------------------------------------------------------------
diff --git a/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/simple/RsProviderTest.java b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/simple/RsProviderTest.java
new file mode 100644
index 0000000..16a49a9
--- /dev/null
+++ b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/simple/RsProviderTest.java
@@ -0,0 +1,77 @@
+/**
+ * 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.rest.simple;
+
+import java.io.IOException;
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.apache.aries.rsa.spi.Endpoint;
+import org.apache.cxf.dosgi.common.httpservice.HttpServiceManager;
+import org.apache.cxf.dosgi.common.intent.impl.IntentManagerImpl;
+import org.apache.cxf.dosgi.dsw.handlers.rest.RsConstants;
+import org.apache.cxf.dosgi.dsw.handlers.rest.RsProvider;
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Test;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+
+public class RsProviderTest {
+
+ @Test
+ public void testDefaultRest() throws IOException {
+ RsProvider rsProvider = new RsProvider();
+ HttpServiceManager httpServiceManager = new HttpServiceManager();
+ Dictionary<String, Object> config = new Hashtable<>();
+ httpServiceManager.initFromConfig(config);
+ rsProvider.setHttpServiceManager(httpServiceManager);
+ IntentManagerImpl intentManager = new IntentManagerImpl();
+ rsProvider.setIntentManager(intentManager);
+ TaskServiceImpl taskService = new TaskServiceImpl();
+ BundleContext callingContext = EasyMock.createMock(BundleContext.class);
+
+ Map<String, Object> props = new HashMap<>();
+ props.put(Constants.OBJECTCLASS, new String[]{TaskService.class.getName()});
+ String serviceAddress = "http://localhost:8181/";
+ props.put(RsConstants.RS_ADDRESS_PROPERTY, serviceAddress);
+ Class<?>[] ifaces = new Class[]{TaskService.class};
+ Endpoint endpoint = rsProvider.exportService(taskService,
+ callingContext,
+ props,
+ ifaces);
+ try {
+ Assert.assertEquals(serviceAddress, endpoint.description().getId());
+
+ Task task1 = WebClient.create(serviceAddress).path("/task").get(Task.class);
+ Assert.assertEquals("test", task1.getName());
+
+ TaskService proxy = (TaskService)rsProvider.importEndpoint(TaskService.class.getClassLoader(),
+ callingContext, ifaces, endpoint.description());
+ Task task = proxy.getTask();
+ Assert.assertEquals("test", task.getName());
+ } finally {
+ endpoint.close();
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/simple/Task.java
----------------------------------------------------------------------
diff --git a/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/simple/Task.java b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/simple/Task.java
new file mode 100644
index 0000000..23c6c8a
--- /dev/null
+++ b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/simple/Task.java
@@ -0,0 +1,41 @@
+/**
+ * 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.rest.simple;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class Task {
+ String name;
+
+ public Task() {
+ }
+
+ public Task(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/simple/TaskService.java
----------------------------------------------------------------------
diff --git a/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/simple/TaskService.java b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/simple/TaskService.java
new file mode 100644
index 0000000..312dc20
--- /dev/null
+++ b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/simple/TaskService.java
@@ -0,0 +1,28 @@
+/**
+ * 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.rest.simple;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+@Path("/task")
+public interface TaskService {
+ @GET
+ Task getTask();
+}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/simple/TaskServiceImpl.java
----------------------------------------------------------------------
diff --git a/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/simple/TaskServiceImpl.java b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/simple/TaskServiceImpl.java
new file mode 100644
index 0000000..2a490de
--- /dev/null
+++ b/provider-rs/src/test/java/org/apache/cxf/dosgi/dsw/handlers/rest/simple/TaskServiceImpl.java
@@ -0,0 +1,28 @@
+/**
+ * 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.rest.simple;
+
+public class TaskServiceImpl implements TaskService {
+
+ @Override
+ public Task getTask() {
+ return new Task("test");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java
----------------------------------------------------------------------
diff --git a/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java b/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java
index 3c5cfd0..73157ab 100644
--- a/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java
+++ b/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java
@@ -24,6 +24,7 @@ import static org.osgi.service.remoteserviceadmin.RemoteConstants.REMOTE_INTENTS
import java.util.Collection;
import java.util.Map;
+import java.util.Set;
import javax.jws.WebService;
@@ -36,6 +37,7 @@ import org.apache.cxf.aegis.databinding.AegisDatabinding;
import org.apache.cxf.binding.soap.SoapBindingConfiguration;
import org.apache.cxf.databinding.DataBinding;
import org.apache.cxf.dosgi.common.httpservice.HttpServiceManager;
+import org.apache.cxf.dosgi.common.intent.IntentHelper;
import org.apache.cxf.dosgi.common.intent.IntentManager;
import org.apache.cxf.dosgi.common.proxy.ProxyFactory;
import org.apache.cxf.dosgi.common.util.OsgiUtils;
@@ -66,7 +68,7 @@ public class WsProvider implements DistributionProvider {
protected BundleContext bundleContext;
protected IntentManager intentManager;
protected HttpServiceManager httpServiceManager;
-
+
@Reference
public void setHttpServiceManager(HttpServiceManager httpServiceManager) {
this.httpServiceManager = httpServiceManager;
@@ -106,17 +108,17 @@ public class WsProvider implements DistributionProvider {
addContextProperties(factory.getClientFactoryBean(), sd, WsConstants.WS_CONTEXT_PROPS_PROP_KEY);
WsdlSupport.setWsdlProperties(factory.getClientFactoryBean(), bundleContext, sd);
- intentManager.assertAllIntentsSupported(sd);
- intentManager.applyIntents(factory.getFeatures(), factory.getClientFactoryBean(), sd);
+ Set<String> intents = IntentHelper.getImported(sd);
+ intentManager.assertAllIntentsSupported(intents);
+ intentManager.applyIntents(factory.getClientFactoryBean(), intents);
Thread.currentThread().setContextClassLoader(ClientProxyFactoryBean.class.getClassLoader());
return ProxyFactory.create(factory.create(), iClass);
} catch (Exception e) {
- LOG.warn("proxy creation failed", e);
+ throw new RuntimeException("proxy creation failed", e);
} finally {
Thread.currentThread().setContextClassLoader(oldClassLoader);
}
- return null;
}
@SuppressWarnings("rawtypes")
@@ -133,17 +135,18 @@ public class WsProvider implements DistributionProvider {
String contextRoot = OsgiUtils.getProperty(endpointProps, WsConstants.WS_HTTP_SERVICE_CONTEXT);
final Long sid = (Long) endpointProps.get(RemoteConstants.ENDPOINT_SERVICE_ID);
- intentManager.assertAllIntentsSupported(endpointProps);
+ Set<String> intents = IntentHelper.getExported(endpointProps);
+ intentManager.assertAllIntentsSupported(intents);
Bus bus = createBus(sid, serviceContext, contextRoot);
factory.setDataBinding(getDataBinding(endpointProps, iClass));
factory.setBindingConfig(new SoapBindingConfiguration());
factory.setBus(bus);
factory.setServiceClass(iClass);
- factory.setAddress(address);
factory.setServiceBean(serviceO);
+ factory.setAddress(address);
addContextProperties(factory, endpointProps, WsConstants.WS_CONTEXT_PROPS_PROP_KEY);
WsdlSupport.setWsdlProperties(factory, serviceContext, endpointProps);
- String[] intents = intentManager.applyIntents(factory.getFeatures(), factory, endpointProps);
+ intentManager.applyIntents(factory, intents);
String completeEndpointAddress = httpServiceManager.getAbsoluteAddress(contextRoot, address);
try {
@@ -164,7 +167,7 @@ public class WsProvider implements DistributionProvider {
protected EndpointDescription createEndpointDesc(Map<String, Object> props,
String[] importedConfigs,
String address,
- String[] intents) {
+ Collection<String> intents) {
props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, importedConfigs);
props.put(WsConstants.WS_ADDRESS_PROPERTY, address);
props.put(RemoteConstants.SERVICE_INTENTS, intents);
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/provider-ws/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ws/PojoConfigurationTypeHandlerTest.java
----------------------------------------------------------------------
diff --git a/provider-ws/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ws/PojoConfigurationTypeHandlerTest.java b/provider-ws/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ws/PojoConfigurationTypeHandlerTest.java
index c935f3d..538fbbf 100644
--- a/provider-ws/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ws/PojoConfigurationTypeHandlerTest.java
+++ b/provider-ws/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ws/PojoConfigurationTypeHandlerTest.java
@@ -30,14 +30,12 @@ import org.apache.aries.rsa.spi.Endpoint;
import org.apache.aries.rsa.util.EndpointHelper;
import org.apache.cxf.dosgi.common.httpservice.HttpServiceManager;
import org.apache.cxf.dosgi.common.intent.IntentManager;
-import org.apache.cxf.dosgi.common.intent.IntentManagerImpl;
+import org.apache.cxf.dosgi.common.intent.impl.IntentManagerImpl;
import org.apache.cxf.dosgi.common.util.ServerEndpoint;
import org.apache.cxf.dosgi.dsw.handlers.jaxws.MyJaxWsEchoService;
import org.apache.cxf.dosgi.dsw.handlers.simple.MySimpleEchoService;
-import org.apache.cxf.endpoint.AbstractEndpointFactory;
import org.apache.cxf.endpoint.EndpointImpl;
import org.apache.cxf.endpoint.Server;
-import org.apache.cxf.feature.Feature;
import org.apache.cxf.frontend.ClientProxyFactoryBean;
import org.apache.cxf.frontend.ServerFactoryBean;
import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
@@ -50,6 +48,7 @@ import org.easymock.IAnswer;
import org.easymock.IMocksControl;
import org.junit.Assert;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
import org.osgi.framework.Version;
import org.osgi.service.remoteserviceadmin.EndpointDescription;
import org.osgi.service.remoteserviceadmin.RemoteConstants;
@@ -97,23 +96,17 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
public void testCreateProxy() {
IMocksControl c = EasyMock.createNiceControl();
BundleContext bc1 = c.createMock(BundleContext.class);
-
+
BundleContext requestingContext = c.createMock(BundleContext.class);
final ClientProxyFactoryBean cpfb = c.createMock(ClientProxyFactoryBean.class);
ReflectionServiceFactoryBean sf = c.createMock(ReflectionServiceFactoryBean.class);
EasyMock.expect(cpfb.getServiceFactory()).andReturn(sf).anyTimes();
- IntentManager intentManager = new IntentManagerImpl() {
- @Override
- public String[] applyIntents(List<Feature> features,
- AbstractEndpointFactory factory,
- Map<String, Object> sd) {
- return new String[0];
- }
- };
+ IntentManager intentManager = new IntentManagerImpl();
WsProvider p = new WsProvider() {
@Override
- protected ClientProxyFactoryBean createClientProxyFactoryBean(Map<String, Object> sd, Class<?> iClass) {
+ protected ClientProxyFactoryBean createClientProxyFactoryBean(Map<String, Object> sd,
+ Class<?> iClass) {
return cpfb;
}
};
@@ -121,12 +114,12 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
p.setHttpServiceManager(dummyHttpServiceManager());
p.activate(bc1);
- Class<?>[] exportedInterfaces = new Class[]{Runnable.class};
-
+ Class<?>[] exportedInterfaces = new Class[] {Runnable.class};
+
Map<String, Object> props = new HashMap<String, Object>();
props.put(RemoteConstants.ENDPOINT_ID, "http://google.de/");
EndpointHelper.addObjectClass(props, exportedInterfaces);
- props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, new String[]{"my.config"});
+ props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, new String[] {"my.config"});
EndpointDescription endpoint = new EndpointDescription(props);
cpfb.setAddress((String)EasyMock.eq(props.get(RemoteConstants.ENDPOINT_ID)));
@@ -150,13 +143,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
String myService = "Hi";
final ServerFactoryBean sfb = createMockServerFactoryBean();
- IntentManager intentManager = new IntentManagerImpl() {
- @Override
- public String[] applyIntents(List<Feature> features, AbstractEndpointFactory factory,
- Map<String, Object> sd) {
- return new String[]{};
- }
- };
+ IntentManager intentManager = new IntentManagerImpl();
WsProvider p = new WsProvider() {
@Override
protected ServerFactoryBean createServerFactoryBean(Map<String, Object> sd, Class<?> iClass) {
@@ -168,8 +155,9 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
p.setHttpServiceManager(dummyHttpServiceManager());
BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
EasyMock.replay(bundleContext);
-
- Class<?>[] exportedInterface = new Class[]{String.class};
+
+ Class<?>[] exportedInterface = new Class[] {String.class
+ };
Map<String, Object> props = new HashMap<String, Object>();
EndpointHelper.addObjectClass(props, exportedInterface);
props.put(WsConstants.WS_ADDRESS_PROPERTY, "http://alternate_host:80/myString");
@@ -179,7 +167,8 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
assertNotNull(edProps.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS));
assertEquals(1, ((String[])edProps.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS)).length);
- assertEquals(WsConstants.WS_CONFIG_TYPE, ((String[])edProps.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS))[0]);
+ assertEquals(WsConstants.WS_CONFIG_TYPE,
+ ((String[])edProps.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS))[0]);
assertEquals("http://alternate_host:80/myString", edProps.get(RemoteConstants.ENDPOINT_ID));
}
@@ -200,11 +189,12 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
}
private void runAddressingTest(Map<String, Object> properties, String expectedAddress) throws Exception {
- Class<?>[] exportedInterface = new Class[]{Runnable.class};
+ Class<?>[] exportedInterface = new Class[] {Runnable.class};
EndpointHelper.addObjectClass(properties, exportedInterface);
BundleContext dswContext = EasyMock.createNiceMock(BundleContext.class);
String expectedUUID = UUID.randomUUID().toString();
- EasyMock.expect(dswContext.getProperty(org.osgi.framework.Constants.FRAMEWORK_UUID)).andReturn(expectedUUID);
+ EasyMock.expect(dswContext.getProperty(org.osgi.framework.Constants.FRAMEWORK_UUID))
+ .andReturn(expectedUUID);
EasyMock.replay(dswContext);
IntentManager intentManager = EasyMock.createNiceMock(IntentManager.class);
@@ -212,8 +202,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
WsProvider handler = new WsProvider() {
@Override
- protected Endpoint createServerFromFactory(ServerFactoryBean factory,
- EndpointDescription epd) {
+ protected Endpoint createServerFromFactory(ServerFactoryBean factory, EndpointDescription epd) {
return new ServerEndpoint(epd, null);
}
};
@@ -222,7 +211,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
handler.activate(dswContext);
Runnable myService = EasyMock.createMock(Runnable.class);
EasyMock.replay(myService);
-
+
BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
EasyMock.replay(bundleContext);
@@ -230,9 +219,9 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
Map<String, Object> props = result.description().getProperties();
assertEquals(expectedAddress, props.get("org.apache.cxf.ws.address"));
Assert.assertArrayEquals(new String[] {"org.apache.cxf.ws"},
- (String[]) props.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS));
+ (String[])props.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS));
Assert.assertArrayEquals(new String[] {"java.lang.Runnable"},
- (String[]) props.get(org.osgi.framework.Constants.OBJECTCLASS));
+ (String[])props.get(org.osgi.framework.Constants.OBJECTCLASS));
}
public void t2estCreateServerException() {
@@ -244,8 +233,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
WsProvider handler = new WsProvider() {
@Override
- protected Endpoint createServerFromFactory(ServerFactoryBean factory,
- EndpointDescription epd) {
+ protected Endpoint createServerFromFactory(ServerFactoryBean factory, EndpointDescription epd) {
throw new TestException();
}
};
@@ -258,7 +246,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
Runnable myService = EasyMock.createMock(Runnable.class);
EasyMock.replay(myService);
try {
- handler.exportService(myService, null, props, new Class[]{Runnable.class});
+ handler.exportService(myService, null, props, new Class[] {Runnable.class});
fail("Expected TestException");
} catch (TestException e) {
// Expected
@@ -276,7 +264,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
EasyMock.expect(sfb.getServiceFactory()).andReturn(sf).anyTimes();
EasyMock.expect(sfb.create()).andReturn(server);
- sfb.setAddress((String) EasyMock.anyObject());
+ sfb.setAddress((String)EasyMock.anyObject());
EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
public Object answer() throws Throwable {
serverURI.setLength(0);
@@ -330,8 +318,11 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
Map<String, Object> sd = new HashMap<String, Object>();
sd.put(org.osgi.framework.Constants.SERVICE_ID, 42);
EndpointHelper.addObjectClass(sd, exportedInterfaces);
- EndpointDescription epd = pch.createEndpointDesc(sd, new String[] {"org.apache.cxf.ws"},
- "http://localhost:12345", new String[] {"my_intent", "your_intent"});
+ List<String> intents = Arrays.asList("my_intent", "your_intent");
+ EndpointDescription epd = pch.createEndpointDesc(sd,
+ new String[] {"org.apache.cxf.ws"},
+ "http://localhost:12345",
+ intents);
assertEquals("http://localhost:12345", epd.getId());
assertEquals(Arrays.asList("java.lang.String"), epd.getInterfaces());
@@ -343,8 +334,8 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
public void t2estCreateJaxWsEndpointWithoutIntents() {
IMocksControl c = EasyMock.createNiceControl();
BundleContext dswBC = c.createMock(BundleContext.class);
-
- IntentManager intentManager = new DummyIntentManager();
+
+ IntentManager intentManager = new IntentManagerImpl();
WsProvider handler = new WsProvider();
handler.setIntentManager(intentManager);
handler.setHttpServiceManager(dummyHttpServiceManager());
@@ -356,10 +347,9 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
Object myService = null;
c.replay();
- ServerEndpoint serverWrapper = (ServerEndpoint)handler.exportService(myService,
- serviceBC,
- sd,
- new Class[]{MyJaxWsEchoService.class});
+ Class<?>[] ifaces = new Class[] {MyJaxWsEchoService.class};
+ ServerEndpoint serverWrapper = (ServerEndpoint)handler.exportService(myService, serviceBC, sd,
+ ifaces);
c.verify();
org.apache.cxf.endpoint.Endpoint ep = serverWrapper.getServer().getEndpoint();
@@ -370,21 +360,22 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
bindingName);
}
- public void t2estCreateSimpleEndpointWithoutIntents() {
+ public void testCreateSimpleEndpointWithoutIntents() {
IMocksControl c = EasyMock.createNiceControl();
BundleContext dswBC = c.createMock(BundleContext.class);
- IntentManager intentManager = new DummyIntentManager();
+ IntentManager intentManager = new IntentManagerImpl();
WsProvider handler = new WsProvider();
handler.setIntentManager(intentManager);
handler.setHttpServiceManager(dummyHttpServiceManager());
handler.activate(dswBC);
Map<String, Object> sd = new HashMap<String, Object>();
+ sd.put(Constants.OBJECTCLASS, new String[]{MySimpleEchoService.class.getName()});
sd.put(WsConstants.WS_ADDRESS_PROPERTY, "/somewhere_else");
BundleContext serviceBC = c.createMock(BundleContext.class);
c.replay();
- ServerEndpoint serverWrapper = (ServerEndpoint)handler.exportService(null, serviceBC, sd,
- new Class[]{MySimpleEchoService.class});
+ Class<?>[] ifaces = new Class[] {MySimpleEchoService.class};
+ ServerEndpoint serverWrapper = (ServerEndpoint)handler.exportService(null, serviceBC, sd, ifaces);
c.verify();
org.apache.cxf.endpoint.Endpoint ep = serverWrapper.getServer().getEndpoint();
@@ -395,20 +386,6 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
bindingName);
}
- public static class DummyIntentManager implements IntentManager {
-
- @Override
- public String[] applyIntents(List<Feature> features,
- AbstractEndpointFactory factory,
- Map<String, Object> props) {
- return new String[]{};
- }
-
- @Override
- public void assertAllIntentsSupported(Map<String, Object> serviceProperties) {
- }
- }
-
@SuppressWarnings("serial")
public static class TestException extends RuntimeException {
}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/fc76aefa/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/rest/GreeterServiceImpl.java
----------------------------------------------------------------------
diff --git a/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/rest/GreeterServiceImpl.java b/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/rest/GreeterServiceImpl.java
index d07084e..1af2e1e 100644
--- a/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/rest/GreeterServiceImpl.java
+++ b/samples/greeter_rest/impl/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl/rest/GreeterServiceImpl.java
@@ -33,7 +33,6 @@ import org.osgi.service.component.annotations.Component;
{
"service.exported.interfaces=*", //
"service.exported.configs=org.apache.cxf.rs", //
- "service.exported.intents=HTTP", //
"org.apache.cxf.rs.httpservice.context=/greeter" //
} //
)