cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject [2/2] cxf-dosgi git commit: [DOSGI-262] Switch jackson provider example to IntentsProvider
Date Mon, 10 Apr 2017 13:44:45 GMT
[DOSGI-262] Switch jackson provider example to IntentsProvider


Project: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/commit/43ec6113
Tree: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/tree/43ec6113
Diff: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/diff/43ec6113

Branch: refs/heads/master
Commit: 43ec6113775c4293c3c72780899a21a38ee05e14
Parents: fd5accc
Author: Christian Schneider <chris@die-schneider.net>
Authored: Mon Apr 10 15:44:38 2017 +0200
Committer: Christian Schneider <chris@die-schneider.net>
Committed: Mon Apr 10 15:44:38 2017 +0200

----------------------------------------------------------------------
 samples/rest/impl-jackson/pom.xml                     |  9 +++++++--
 .../cxf/dosgi/samples/rest/impl/JacksonIntent.java    |  4 ++++
 .../cxf/dosgi/samples/rest/impl/TaskResourceImpl.java | 14 ++++++++++++--
 3 files changed, 23 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/43ec6113/samples/rest/impl-jackson/pom.xml
----------------------------------------------------------------------
diff --git a/samples/rest/impl-jackson/pom.xml b/samples/rest/impl-jackson/pom.xml
index 18375de..d8840f4 100644
--- a/samples/rest/impl-jackson/pom.xml
+++ b/samples/rest/impl-jackson/pom.xml
@@ -34,6 +34,11 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
+            <groupId>org.apache.cxf.dosgi</groupId>
+            <artifactId>cxf-dosgi-common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
         	<groupId>org.apache.aries.rsa</groupId>
         	<artifactId>org.apache.aries.rsa.spi</artifactId>
         	<version>1.9.0</version>
@@ -46,12 +51,12 @@
 		<dependency>
 			<groupId>org.apache.cxf</groupId>
 			<artifactId>cxf-core</artifactId>
-			<version>3.1.9</version>
+			<version>${cxf.version}</version>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.cxf</groupId>
 			<artifactId>cxf-rt-features-logging</artifactId>
-			<version>3.1.10</version>
+			<version>${cxf.version}</version>
 		</dependency>
     </dependencies>
 

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/43ec6113/samples/rest/impl-jackson/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/JacksonIntent.java
----------------------------------------------------------------------
diff --git a/samples/rest/impl-jackson/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/JacksonIntent.java
b/samples/rest/impl-jackson/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/JacksonIntent.java
index ba38d67..dca20b2 100644
--- a/samples/rest/impl-jackson/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/JacksonIntent.java
+++ b/samples/rest/impl-jackson/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/JacksonIntent.java
@@ -25,6 +25,10 @@ import java.util.concurrent.Callable;
 import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
 import org.osgi.service.component.annotations.Component;
 
+
+/**
+ * Only needed if jackson is used thorugh an external intent
+ */
 @Component //
 (//
     property = "org.apache.cxf.dosgi.IntentName=jackson" //

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/43ec6113/samples/rest/impl-jackson/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/TaskResourceImpl.java
----------------------------------------------------------------------
diff --git a/samples/rest/impl-jackson/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/TaskResourceImpl.java
b/samples/rest/impl-jackson/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/TaskResourceImpl.java
index 0881c53..ab96eb2 100644
--- a/samples/rest/impl-jackson/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/TaskResourceImpl.java
+++ b/samples/rest/impl-jackson/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/TaskResourceImpl.java
@@ -18,9 +18,13 @@
  */
 package org.apache.cxf.dosgi.samples.rest.impl;
 
+import java.util.Arrays;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
+import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
+import org.apache.cxf.dosgi.common.api.IntentsProvider;
 import org.apache.cxf.dosgi.samples.rest.Task;
 import org.apache.cxf.dosgi.samples.rest.TaskResource;
 import org.osgi.service.component.annotations.Component;
@@ -33,12 +37,13 @@ import org.osgi.service.component.annotations.Component;
     { //
       "service.exported.interfaces=*", //
       "service.exported.configs=org.apache.cxf.rs", //
-      "service.exported.intents=jackson", //
+      //"service.exported.intents=jackson", // Only needed when defining jackson as external
intent
       "org.apache.cxf.rs.address=/tasks", //
+      // By default CXF will favor the default json provider
       "cxf.bus.prop.skip.default.json.provider.registration=true"
     } //
 )
-public class TaskResourceImpl implements TaskResource {
+public class TaskResourceImpl implements TaskResource, IntentsProvider {
     Map<Integer, Task> taskMap;
 
     public TaskResourceImpl() {
@@ -75,4 +80,9 @@ public class TaskResourceImpl implements TaskResource {
         taskMap.remove(id);
     }
 
+    @Override
+    public List<?> getIntents() {
+        return Arrays.asList(new JacksonJaxbJsonProvider());
+    }
+
 }


Mime
View raw message