Repository: cxf-dosgi
Updated Branches:
refs/heads/master 042b8a784 -> 1fbc19490
[DOSGI-262] Allow to also publish external intents using IntentsProvider interface
Project: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/commit/1fbc1949
Tree: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/tree/1fbc1949
Diff: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/diff/1fbc1949
Branch: refs/heads/master
Commit: 1fbc19490f2af1d29905e90993c13e4215790110
Parents: 042b8a7
Author: Christian Schneider <chris@die-schneider.net>
Authored: Tue Apr 11 17:27:49 2017 +0200
Committer: Christian Schneider <chris@die-schneider.net>
Committed: Tue Apr 11 17:27:49 2017 +0200
----------------------------------------------------------------------
.../common/intent/impl/IntentManagerImpl.java | 9 +++++-
itests/multi-bundle/pom.xml | 10 ++++--
.../dosgi/itests/multi/TestCustomIntent.java | 2 ++
.../customintent/CustomFeatureProvider.java | 33 ++++++++++++++++++++
.../customintent/CustomIntentActivator.java | 2 +-
5 files changed, 52 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1fbc1949/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
index 67d82a7..2571fef 100644
--- 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
@@ -109,7 +109,14 @@ public class IntentManagerImpl implements IntentManager {
} catch (Exception e) {
throw new RuntimeException(e);
}
-
+ } else if (intent instanceof IntentsProvider) {
+ try {
+ IntentsProvider provider = (IntentsProvider)intent;
+ List<?> curIntents = provider.getIntents();
+ intents.addAll(curIntents);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
} else {
intents.add(intent);
}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1fbc1949/itests/multi-bundle/pom.xml
----------------------------------------------------------------------
diff --git a/itests/multi-bundle/pom.xml b/itests/multi-bundle/pom.xml
index 72af8de..5e6aa0c 100644
--- a/itests/multi-bundle/pom.xml
+++ b/itests/multi-bundle/pom.xml
@@ -44,7 +44,13 @@
-->
<dependencies>
- <!-- Pax Exam -->
+ <dependency>
+ <groupId>org.apache.cxf.dosgi</groupId>
+ <artifactId>cxf-dosgi-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- Pax Exam -->
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-atinject_1.0_spec</artifactId>
@@ -208,7 +214,7 @@
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>depends-maven-plugin</artifactId>
- <version>1.3.1</version>
+ <version>1.4.0</version>
<executions>
<execution>
<id>generate-depends-file</id>
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1fbc1949/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestCustomIntent.java
----------------------------------------------------------------------
diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestCustomIntent.java
b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestCustomIntent.java
index 2699b33..814066a 100644
--- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestCustomIntent.java
+++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestCustomIntent.java
@@ -25,6 +25,7 @@ import java.util.concurrent.Callable;
import org.apache.cxf.dosgi.itests.multi.customintent.ChangeTitleInterceptor;
import org.apache.cxf.dosgi.itests.multi.customintent.CustomFeature;
+import org.apache.cxf.dosgi.itests.multi.customintent.CustomFeatureProvider;
import org.apache.cxf.dosgi.itests.multi.customintent.CustomIntentActivator;
import org.apache.cxf.dosgi.samples.soap.Task;
import org.apache.cxf.dosgi.samples.soap.TaskService;
@@ -68,6 +69,7 @@ public class TestCustomIntent extends AbstractDosgiTest {
return TinyBundles.bundle() //
.add(CustomIntentActivator.class) //
.add(CustomFeature.class) //
+ .add(CustomFeatureProvider.class) //
.add(ChangeTitleInterceptor.class) //
.add(DummyTaskServiceImpl.class) //
.set(Constants.BUNDLE_SYMBOLICNAME, "CustomIntent") //
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1fbc1949/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/customintent/CustomFeatureProvider.java
----------------------------------------------------------------------
diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/customintent/CustomFeatureProvider.java
b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/customintent/CustomFeatureProvider.java
new file mode 100644
index 0000000..f2b09a9
--- /dev/null
+++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/customintent/CustomFeatureProvider.java
@@ -0,0 +1,33 @@
+/**
+ * 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.itests.multi.customintent;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.cxf.dosgi.common.api.IntentsProvider;
+
+public class CustomFeatureProvider implements IntentsProvider {
+
+ @Override
+ public List<?> getIntents() {
+ return Collections.singletonList(new CustomFeature());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1fbc1949/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/customintent/CustomIntentActivator.java
----------------------------------------------------------------------
diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/customintent/CustomIntentActivator.java
b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/customintent/CustomIntentActivator.java
index a3e3feb..8c99ddb 100644
--- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/customintent/CustomIntentActivator.java
+++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/customintent/CustomIntentActivator.java
@@ -32,7 +32,7 @@ public class CustomIntentActivator implements BundleActivator {
public void start(BundleContext context) throws Exception {
Dictionary<String, String> props = new Hashtable<String, String>();
props.put("org.apache.cxf.dosgi.IntentName", "myIntent");
- context.registerService(CustomFeature.class, new CustomFeature(), props);
+ context.registerService(CustomFeatureProvider.class, new CustomFeatureProvider(),
props);
Dictionary<String, String> props2 = new Hashtable<String, String>();
props2.put(RemoteConstants.SERVICE_EXPORTED_CONFIGS, "org.apache.cxf.ws");
|