You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by sh...@apache.org on 2018/02/27 15:55:23 UTC

[05/11] incubator-unomi git commit: UNOMI-5 Upgrade to Karaf 4 Lots of fixes to make sure it works with Karaf 4.1.5: - Update the project from Karaf 4.1.1 to 4.1.5 - Remove XmlRootElement annotations that were causing the new CXF version to wrap the obje

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/7a39ca3f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 81224c5..7d78a49 100644
--- a/pom.xml
+++ b/pom.xml
@@ -67,7 +67,7 @@
         <cxf.version>3.1.10</cxf.version>
         <version.jackson.core>2.8.6</version.jackson.core>
         <version.jackson.jaxb>2.8.6</version.jackson.jaxb>
-        <version.karaf>4.1.1</version.karaf>
+        <version.karaf>4.1.5</version.karaf>
         <version.karaf.cellar>4.1.0</version.karaf.cellar>
         <version.pax.exam>4.11.2</version.pax.exam>
         <elasticsearch.version>5.6.3</elasticsearch.version>
@@ -79,6 +79,16 @@
 
         <gatling.version>2.1.2</gatling.version>
         <scala-maven-plugin.version>3.2.0</scala-maven-plugin.version>
+
+        <!-- Librairies for Karaf packaging -->
+        <xerces.version>2.11.0_1</xerces.version>
+        <servicemix.specs.version>2.9.0</servicemix.specs.version>
+        <xalan.bundle.version>2.7.2_3</xalan.bundle.version>
+        <xalan-serializer.bundle.version>2.7.2_1</xalan-serializer.bundle.version>
+        <jna.version>4.5.0</jna.version>
+        <httpclient-osgi.version>4.5.5</httpclient-osgi.version>
+        <httpcore-osgi.version>4.4.9</httpcore-osgi.version>
+
     </properties>
 
     <mailingLists>
@@ -255,6 +265,30 @@
             <id>jahia.3rdparty</id>
             <url>https://devtools.jahia.com/nexus/content/repositories/thirdparty-releases/</url>
         </repository>
+        <!-- Apache snapshots -->
+        <repository>
+            <id>apache-snapshots</id>
+            <name>Apache Snapshots Repository</name>
+            <url>http://repository.apache.org/content/groups/snapshots-group</url>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+        </repository>
+        <!-- OPS4J SNAPSHOT repository -->
+        <repository>
+            <id>ops4j.sonatype.snapshots.deploy</id>
+            <name>OPS4J snapshot repository</name>
+            <url>https://oss.sonatype.org/content/repositories/ops4j-snapshots/</url>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+        </repository>
     </repositories>
 
     <profiles>
@@ -643,7 +677,6 @@
                 <classifier>features</classifier>
                 <version>${version.karaf}</version>
                 <type>xml</type>
-                <scope>runtime</scope>
             </dependency>
             <dependency>
                 <groupId>org.apache.karaf.features</groupId>
@@ -705,13 +738,18 @@
             <dependency>
                 <groupId>org.apache.httpcomponents</groupId>
                 <artifactId>httpclient-osgi</artifactId>
-                <version>4.3.6</version>
+                <version>${httpclient-osgi.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.httpcomponents</groupId>
+                <artifactId>httpclient-osgi</artifactId>
+                <version>${httpclient-osgi.version}</version>
                 <type>bundle</type>
             </dependency>
             <dependency>
                 <groupId>org.apache.httpcomponents</groupId>
                 <artifactId>httpcore-osgi</artifactId>
-                <version>4.3.3</version>
+                <version>${httpcore-osgi.version}</version>
             </dependency>
 
             <!-- Dependencies for pax exam karaf container -->

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/7a39ca3f/samples/trainingplugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/samples/trainingplugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/samples/trainingplugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 41764cc..01ae5ab 100644
--- a/samples/trainingplugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/samples/trainingplugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -23,7 +23,7 @@
     <reference id="profileService" interface="org.apache.unomi.api.services.ProfileService"/>
 
     <!-- Action executor -->
-    <service id="trainingNotifAction" auto-export="interfaces">
+    <service id="trainingNotifAction" interface="org.apache.unomi.api.actions.ActionExecutor">
         <service-properties>
             <entry key="actionExecutorId" value="training"/>
         </service-properties>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/7a39ca3f/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 7ff000a..f5d20aa 100644
--- a/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -133,7 +133,12 @@
         <property name="definitionsService" ref="definitionsServiceImpl"/>
         <property name="bundleContext" ref="blueprintBundleContext"/>
     </bean>
-    <service id="userListService" ref="userListServiceImpl" auto-export="interfaces"/>
+    <service id="userListService" ref="userListServiceImpl">
+        <interfaces>
+            <value>org.osgi.framework.SynchronousBundleListener</value>
+            <value>org.apache.unomi.api.services.UserListService</value>
+        </interfaces>
+    </service>
 
     <bean id="profileServiceImpl" class="org.apache.unomi.services.services.ProfileServiceImpl"
           init-method="postConstruct" destroy-method="preDestroy">
@@ -176,7 +181,7 @@
         <property name="profileService" ref="profileServiceImpl"/>
         <property name="bundleContext" ref="blueprintBundleContext"/>
     </bean>
-    <service id="personalizationService" ref="personalizationServiceImpl" auto-export="interfaces"/>
+    <service id="personalizationService" ref="personalizationServiceImpl" interface="org.apache.unomi.api.services.PersonalizationService" />
 
     <!-- We use a listener here because using the list directly for listening to proxies coming from the same bundle didn't seem to work -->
     <reference-list id="eventListenerServices"
@@ -242,7 +247,7 @@
         </bean>
     </service>
 
-    <service auto-export="interfaces">
+    <service interface="org.apache.unomi.api.PersonalizationStrategy">
         <service-properties>
             <entry key="personalizationStrategyId" value="matching-first"/>
         </service-properties>
@@ -251,7 +256,7 @@
         </bean>
     </service>
 
-    <service auto-export="interfaces">
+    <service interface="org.apache.unomi.api.PersonalizationStrategy">
         <service-properties>
             <entry key="personalizationStrategyId" value="random"/>
         </service-properties>
@@ -260,7 +265,7 @@
         </bean>
     </service>
 
-    <service auto-export="interfaces">
+    <service interface="org.apache.unomi.api.PersonalizationStrategy">
         <service-properties>
             <entry key="personalizationStrategyId" value="score-sorted"/>
         </service-properties>
@@ -279,7 +284,11 @@
         <property name="bundleContext" ref="blueprintBundleContext"/>
     </bean>
 
-    <service id="configSharingService" ref="configSharingServiceImpl" auto-export="interfaces">
+    <service id="configSharingService" ref="configSharingServiceImpl">
+        <interfaces>
+            <value>org.osgi.framework.SynchronousBundleListener</value>
+            <value>org.apache.unomi.api.services.ConfigSharingService</value>
+        </interfaces>
     </service>
 
     <!-- Cluster System Statistics Event Handler -->

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/7a39ca3f/src/site/markdown/versions/master/custom-extensions.md
----------------------------------------------------------------------
diff --git a/src/site/markdown/versions/master/custom-extensions.md b/src/site/markdown/versions/master/custom-extensions.md
index 43b3635..6f089ec 100644
--- a/src/site/markdown/versions/master/custom-extensions.md
+++ b/src/site/markdown/versions/master/custom-extensions.md
@@ -292,7 +292,7 @@ content:
     
         <!-- Action executors -->
     
-        <service auto-export="interfaces">
+        <service interface="org.apache.unomi.api.actions.ActionExecutor">
             <service-properties>
                 <entry key="actionExecutorId" value="addToLists"/>
             </service-properties>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/7a39ca3f/src/site/markdown/versions/master/twitter-sample.md
----------------------------------------------------------------------
diff --git a/src/site/markdown/versions/master/twitter-sample.md b/src/site/markdown/versions/master/twitter-sample.md
index 27b0d56..5d6c25c 100644
--- a/src/site/markdown/versions/master/twitter-sample.md
+++ b/src/site/markdown/versions/master/twitter-sample.md
@@ -321,7 +321,7 @@ The action executor references the actual implementation of the action as define
     <reference id="profileService" interface="org.apache.unomi.api.services.ProfileService"/>
 
     <!-- Action executor -->
-    <service id="incrementTweetNumberAction" auto-export="interfaces">
+    <service id="incrementTweetNumberAction" interface="org.apache.unomi.api.actions.ActionExecutor">
         <service-properties>
             <entry key="actionExecutorId" value="incrementTweetNumber"/>
         </service-properties>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/7a39ca3f/tools/shell-commands/pom.xml
----------------------------------------------------------------------
diff --git a/tools/shell-commands/pom.xml b/tools/shell-commands/pom.xml
index 3bcbb6e..40d35c4 100644
--- a/tools/shell-commands/pom.xml
+++ b/tools/shell-commands/pom.xml
@@ -33,7 +33,7 @@
         <dependency>
             <groupId>org.apache.karaf.shell</groupId>
             <artifactId>org.apache.karaf.shell.console</artifactId>
-            <version>3.0.8</version>
+            <version>${version.karaf}</version>
             <scope>provided</scope>
         </dependency>
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/7a39ca3f/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/utils/ConsoleUtils.java
----------------------------------------------------------------------
diff --git a/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/utils/ConsoleUtils.java b/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/utils/ConsoleUtils.java
index 0f5cb5c..cae0561 100644
--- a/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/utils/ConsoleUtils.java
+++ b/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/utils/ConsoleUtils.java
@@ -16,9 +16,9 @@
  */
 package org.apache.unomi.shell.migration.utils;
 
-import jline.console.ConsoleReader;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.felix.service.command.CommandSession;
+import org.jline.reader.LineReader;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -77,7 +77,7 @@ public class ConsoleUtils {
      * @throws IOException
      */
     public static String promptMessageToUser(CommandSession session, String msg) throws IOException {
-        ConsoleReader reader = (ConsoleReader) session.get(".jline.reader");
+        LineReader reader = (LineReader) session.get(".jline.reader");
         return reader.readLine(msg, null);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/7a39ca3f/tools/shell-commands/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/tools/shell-commands/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/tools/shell-commands/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index a7aa6ce..14ba1ce 100644
--- a/tools/shell-commands/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/tools/shell-commands/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -83,6 +83,6 @@
         </property>
         <property name="bundleContext" ref="blueprintBundleContext"/>
     </bean>
-    <service id="unomiManagementService" ref="unomiManagementServiceImpl" auto-export="interfaces"/>
+    <service id="unomiManagementService" ref="unomiManagementServiceImpl" interface="org.apache.unomi.shell.services.UnomiManagementService" />
 
 </blueprint>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/7a39ca3f/tools/shell-dev-commands/pom.xml
----------------------------------------------------------------------
diff --git a/tools/shell-dev-commands/pom.xml b/tools/shell-dev-commands/pom.xml
index e719c11..4267045 100644
--- a/tools/shell-dev-commands/pom.xml
+++ b/tools/shell-dev-commands/pom.xml
@@ -33,14 +33,14 @@
         <dependency>
             <groupId>org.apache.karaf.shell</groupId>
             <artifactId>org.apache.karaf.shell.console</artifactId>
-            <version>3.0.8</version>
+            <version>${version.karaf}</version>
             <scope>provided</scope>
         </dependency>
 
         <dependency>
             <groupId>org.apache.karaf.shell</groupId>
             <artifactId>org.apache.karaf.shell.table</artifactId>
-            <version>3.0.8</version>
+            <version>${version.karaf}</version>
             <scope>provided</scope>
         </dependency>
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/7a39ca3f/tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/commands/ListCommandSupport.java
----------------------------------------------------------------------
diff --git a/tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/commands/ListCommandSupport.java b/tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/commands/ListCommandSupport.java
index a203aa0..20dde1f 100644
--- a/tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/commands/ListCommandSupport.java
+++ b/tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/commands/ListCommandSupport.java
@@ -18,8 +18,8 @@ package org.apache.unomi.shell.commands;
 
 import org.apache.karaf.shell.commands.Option;
 import org.apache.karaf.shell.console.OsgiCommandSupport;
-import org.apache.karaf.shell.table.Row;
-import org.apache.karaf.shell.table.ShellTable;
+import org.apache.karaf.shell.support.table.Row;
+import org.apache.karaf.shell.support.table.ShellTable;
 import org.apache.unomi.common.DataTable;
 
 import java.util.ArrayList;

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/7a39ca3f/wab/src/main/java/org/apache/unomi/web/ClientServlet.java
----------------------------------------------------------------------
diff --git a/wab/src/main/java/org/apache/unomi/web/ClientServlet.java b/wab/src/main/java/org/apache/unomi/web/ClientServlet.java
index e0aa2e8..f385a53 100644
--- a/wab/src/main/java/org/apache/unomi/web/ClientServlet.java
+++ b/wab/src/main/java/org/apache/unomi/web/ClientServlet.java
@@ -96,9 +96,11 @@ public class ClientServlet extends HttpServlet {
     public void donwloadCurrentProfile(HttpServletRequest request, HttpServletResponse response, String downloadFileType) throws ServletException, IOException {
         String cookieProfileId = null;
         Cookie[] cookies = request.getCookies();
-        for (Cookie cookie : cookies) {
-            if (profileIdCookieName.equals(cookie.getName())) {
-                cookieProfileId = cookie.getValue();
+        if (cookies != null) {
+            for (Cookie cookie : cookies) {
+                if (profileIdCookieName.equals(cookie.getName())) {
+                    cookieProfileId = cookie.getValue();
+                }
             }
         }
         if (cookieProfileId != null) {

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/7a39ca3f/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
----------------------------------------------------------------------
diff --git a/wab/src/main/java/org/apache/unomi/web/ContextServlet.java b/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
index a191855..a507bdd 100644
--- a/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
+++ b/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
@@ -94,9 +94,11 @@ public class ContextServlet extends HttpServlet {
 
         String cookieProfileId = null;
         Cookie[] cookies = httpServletRequest.getCookies();
-        for (Cookie cookie : cookies) {
-            if (profileIdCookieName.equals(cookie.getName())) {
-                cookieProfileId = cookie.getValue();
+        if (cookies != null) {
+            for (Cookie cookie : cookies) {
+                if (profileIdCookieName.equals(cookie.getName())) {
+                    cookieProfileId = cookie.getValue();
+                }
             }
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/7a39ca3f/wab/src/main/java/org/apache/unomi/web/EventsCollectorServlet.java
----------------------------------------------------------------------
diff --git a/wab/src/main/java/org/apache/unomi/web/EventsCollectorServlet.java b/wab/src/main/java/org/apache/unomi/web/EventsCollectorServlet.java
index 07f24e5..e673289 100644
--- a/wab/src/main/java/org/apache/unomi/web/EventsCollectorServlet.java
+++ b/wab/src/main/java/org/apache/unomi/web/EventsCollectorServlet.java
@@ -159,9 +159,11 @@ public class EventsCollectorServlet extends HttpServlet {
             } else {
                 // Session uses anonymous profile, try to find profile from cookie
                 Cookie[] cookies = request.getCookies();
-                for (Cookie cookie : cookies) {
-                    if (profileIdCookieName.equals(cookie.getName())) {
-                        profile = profileService.load(cookie.getValue());
+                if (cookies != null) {
+                    for (Cookie cookie : cookies) {
+                        if (profileIdCookieName.equals(cookie.getName())) {
+                            profile = profileService.load(cookie.getValue());
+                        }
                     }
                 }
                 if (profile == null) {

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/7a39ca3f/wab/src/main/java/org/apache/unomi/web/HttpUtils.java
----------------------------------------------------------------------
diff --git a/wab/src/main/java/org/apache/unomi/web/HttpUtils.java b/wab/src/main/java/org/apache/unomi/web/HttpUtils.java
index 8965aad..5a015d3 100644
--- a/wab/src/main/java/org/apache/unomi/web/HttpUtils.java
+++ b/wab/src/main/java/org/apache/unomi/web/HttpUtils.java
@@ -74,8 +74,12 @@ public class HttpUtils {
     public static String dumpRequestCookies(Cookie[] cookies) {
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.append("Cookies:\n");
-        for (Cookie cookie : cookies) {
-            stringBuilder.append("  ").append(cookie.getName()).append("=").append(cookie.getValue()).append(" domain=").append(cookie.getDomain()).append(" path=").append(cookie.getPath()).append(" maxAge=").append(cookie.getMaxAge()).append(" httpOnly=").append(cookie.isHttpOnly()).append(" secure=").append(cookie.getSecure()).append(" version=").append(cookie.getVersion()).append(" comment=").append(cookie.getComment()).append("\n");
+        if (cookies == null) {
+            stringBuilder.append("  none");
+        } else {
+            for (Cookie cookie : cookies) {
+                stringBuilder.append("  ").append(cookie.getName()).append("=").append(cookie.getValue()).append(" domain=").append(cookie.getDomain()).append(" path=").append(cookie.getPath()).append(" maxAge=").append(cookie.getMaxAge()).append(" httpOnly=").append(cookie.isHttpOnly()).append(" secure=").append(cookie.getSecure()).append(" version=").append(cookie.getVersion()).append(" comment=").append(cookie.getComment()).append("\n");
+            }
         }
         return stringBuilder.toString();
     }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/7a39ca3f/wab/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/wab/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/wab/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 6fd6ca4..416d920 100644
--- a/wab/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/wab/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -90,7 +90,12 @@
         <property name="profileIdCookieName" value="${web.contextserver.profileIdCookieName}"/>
     </bean>
 
-    <service id="clientServletService" auto-export="interfaces" ref="clientServlet">
+    <service id="clientServletService" ref="clientServlet">
+        <interfaces>
+            <value>javax.servlet.Servlet</value>
+            <value>javax.servlet.ServletConfig</value>
+            <value>java.io.Serializable</value>
+        </interfaces>
         <service-properties>
             <entry key="urlPatterns" value="/client/*"/>
         </service-properties>