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 2017/06/24 18:38:26 UTC

[01/50] [abbrv] incubator-unomi git commit: UNOMI-85 Update build scripts to remove tests that don't work yet - Correct 5 minute quickstart to reflect state of released build (1.1.0) [Forced Update!]

Repository: incubator-unomi
Updated Branches:
  refs/heads/feature-UNOMI-5-KARAF4 89ce8d9fa -> dd2e5bce8 (forced update)


UNOMI-85 Update build scripts to remove tests that don't work yet
- Correct 5 minute quickstart to reflect state of released build (1.1.0)

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/d7cce6a2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/d7cce6a2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/d7cce6a2

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: d7cce6a24c1cd6773a26120b7a3665eb486652e1
Parents: 274dd81
Author: Serge Huber <sh...@apache.org>
Authored: Wed Feb 22 22:49:22 2017 +0100
Committer: Serge Huber <sh...@apache.org>
Committed: Wed Feb 22 22:49:22 2017 +0100

----------------------------------------------------------------------
 generate-package.sh         |  2 +-
 generate-site-and-upload.sh |  2 +-
 generate-site.sh            |  2 +-
 src/site/markdown/index.md  | 15 +++++----------
 4 files changed, 8 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d7cce6a2/generate-package.sh
----------------------------------------------------------------------
diff --git a/generate-package.sh b/generate-package.sh
index 30696e1..7e452e1 100755
--- a/generate-package.sh
+++ b/generate-package.sh
@@ -18,5 +18,5 @@
 #
 ################################################################################
 echo Building...
-mvn clean install -P integration-tests,performance-tests,rat
+mvn clean install -P !integration-tests,!performance-tests,rat
 echo Package building completed.

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d7cce6a2/generate-site-and-upload.sh
----------------------------------------------------------------------
diff --git a/generate-site-and-upload.sh b/generate-site-and-upload.sh
index 6c364bf..ac0e591 100755
--- a/generate-site-and-upload.sh
+++ b/generate-site-and-upload.sh
@@ -23,7 +23,7 @@ if [ $# -ne 2 ]
     exit 1
 fi
 echo Generating site...
-mvn clean install site site:stage -P integration-tests,performance-tests
+mvn clean install site site:stage -P !integration-tests,!performance-tests
 cd rest
 mvn package
 cd -

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d7cce6a2/generate-site.sh
----------------------------------------------------------------------
diff --git a/generate-site.sh b/generate-site.sh
index b5867bb..fe3ebd2 100755
--- a/generate-site.sh
+++ b/generate-site.sh
@@ -18,7 +18,7 @@
 #
 ################################################################################
 echo Generating site...
-mvn site site:stage -P integration-tests,performance-tests
+mvn site site:stage -P !integration-tests,!performance-tests
 cd rest
 mvn package
 cd -

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d7cce6a2/src/site/markdown/index.md
----------------------------------------------------------------------
diff --git a/src/site/markdown/index.md b/src/site/markdown/index.md
index 6c99d2c..2be4fe2 100644
--- a/src/site/markdown/index.md
+++ b/src/site/markdown/index.md
@@ -73,16 +73,11 @@ All communication is done using HTTP REST requests and JSON data formats.
 
 ## 5 Minute Quick start
 1. Install JDK 8 (see [http://www.oracle.com/technetwork/java/javase/downloads/index.html](http://www.oracle.com/technetwork/java/javase/downloads/index.html) and make sure you set the JAVA_HOME variable [https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/](https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/)
-2. Download ElasticSearch 5.1.2, for example using: 
-
-        curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.2.tar.gz
-
-3. Edit the cluster.name in the `conf/elasticSearch.yml` file to `contextElasticSearch`
-4. Download Apache Unomi here : [http://unomi.incubator.apache.org/download.html](http://unomi.incubator.apache.org/download.html)
-5. Start it using : `./bin/karaf`
-6. Wait for startup to complete
-7. Try accessing [https://localhost:9443/cxs/cluster](https://localhost:9443/cxs/cluster) with username/password: karaf/karaf . You might get a certificate warning in your browser, just accept it despite the warning it is safe.
-8. Request your first context by simply accessing : [http://localhost:8181/context.js?session=1234](http://localhost:8181/context.js?session=1234)
+2. Download Apache Unomi here : [http://unomi.incubator.apache.org/download.html](http://unomi.incubator.apache.org/download.html)
+3. Start it using : `./bin/karaf`
+4. Wait for startup to complete
+5. Try accessing [https://localhost:9443/cxs/cluster](https://localhost:9443/cxs/cluster) with username/password: karaf/karaf . You might get a certificate warning in your browser, just accept it despite the warning it is safe.
+6. Request your first context by simply accessing : [http://localhost:8181/context.js?session=1234](http://localhost:8181/context.js?session=1234)
 
 ### News
 


[18/50] [abbrv] incubator-unomi git commit: UNOMI-93 Add rule execution statistics to rule service endpoint - Global statistics endpoint

Posted by sh...@apache.org.
UNOMI-93 Add rule execution statistics to rule service endpoint
- Global statistics endpoint

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/7e81374d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/7e81374d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/7e81374d

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 7e81374d35e3bd5e581530af9dd452c15bb2c767
Parents: 64bf3a9
Author: Serge Huber <sh...@apache.org>
Authored: Mon May 1 21:54:07 2017 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Mon May 1 21:54:07 2017 +0200

----------------------------------------------------------------------
 .../org/apache/unomi/api/services/RulesService.java     |  7 +++++++
 .../org/apache/unomi/rest/RulesServiceEndPoint.java     | 12 ++++++++++++
 .../unomi/services/services/RulesServiceImpl.java       |  4 ++++
 3 files changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/7e81374d/api/src/main/java/org/apache/unomi/api/services/RulesService.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/services/RulesService.java b/api/src/main/java/org/apache/unomi/api/services/RulesService.java
index 63f6dda..acfd9b4 100644
--- a/api/src/main/java/org/apache/unomi/api/services/RulesService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/RulesService.java
@@ -25,6 +25,7 @@ import org.apache.unomi.api.query.Query;
 import org.apache.unomi.api.rules.Rule;
 import org.apache.unomi.api.rules.RuleStatistics;
 
+import java.util.Map;
 import java.util.Set;
 
 /**
@@ -63,6 +64,12 @@ public interface RulesService {
     RuleStatistics getRuleStatistics(String ruleId);
 
     /**
+     * Retrieves the statistics for all the rules
+     * @return a map containing rule IDs as key, and the RuleStatistics object as a value
+     */
+    Map<String,RuleStatistics> getAllRuleStatistics();
+
+    /**
      * Persists the specified rule to the context server.
      *
      * @param rule the rule to be persisted

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/7e81374d/rest/src/main/java/org/apache/unomi/rest/RulesServiceEndPoint.java
----------------------------------------------------------------------
diff --git a/rest/src/main/java/org/apache/unomi/rest/RulesServiceEndPoint.java b/rest/src/main/java/org/apache/unomi/rest/RulesServiceEndPoint.java
index d619a7f..1327731 100644
--- a/rest/src/main/java/org/apache/unomi/rest/RulesServiceEndPoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/RulesServiceEndPoint.java
@@ -31,6 +31,7 @@ import javax.jws.WebMethod;
 import javax.jws.WebService;
 import javax.ws.rs.*;
 import javax.ws.rs.core.MediaType;
+import java.util.Map;
 import java.util.Set;
 
 /**
@@ -81,6 +82,17 @@ public class RulesServiceEndPoint {
     }
 
     /**
+     * Retrieves the metadata for all known rules.
+     *
+     * @return the Set of known metadata
+     */
+    @GET
+    @Path("/statistics")
+    public Map<String,RuleStatistics> getAllRuleStatistics() {
+        return rulesService.getAllRuleStatistics();
+    }
+
+    /**
      * Retrieves rule metadatas for rules matching the specified {@link Query}.
      *
      * @param query the query the rules which metadata we want to retrieve must match

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/7e81374d/services/src/main/java/org/apache/unomi/services/services/RulesServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/RulesServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/RulesServiceImpl.java
index c289891..b3062c1 100644
--- a/services/src/main/java/org/apache/unomi/services/services/RulesServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/services/RulesServiceImpl.java
@@ -281,6 +281,10 @@ public class RulesServiceImpl implements RulesService, EventListenerService, Syn
         return persistenceService.load(ruleId, RuleStatistics.class);
     }
 
+    public Map<String,RuleStatistics> getAllRuleStatistics() {
+        return allRuleStatistics;
+    }
+
     public Set<Metadata> getRuleMetadatas() {
         Set<Metadata> metadatas = new HashSet<Metadata>();
         for (Rule rule : persistenceService.getAllItems(Rule.class, 0, 50, null).getList()) {


[17/50] [abbrv] incubator-unomi git commit: UNOMI-93 Add rule execution statistics to rule service endpoint - Add JavaDoc documentation

Posted by sh...@apache.org.
UNOMI-93 Add rule execution statistics to rule service endpoint
- Add JavaDoc documentation

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/64bf3a96
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/64bf3a96
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/64bf3a96

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 64bf3a96a34fc49a5ed6301bf33d889c04a91223
Parents: df6acb3
Author: Serge Huber <sh...@apache.org>
Authored: Mon May 1 21:36:49 2017 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Mon May 1 21:36:49 2017 +0200

----------------------------------------------------------------------
 .../apache/unomi/api/rules/RuleStatistics.java  | 68 +++++++++++++++++++-
 1 file changed, 65 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/64bf3a96/api/src/main/java/org/apache/unomi/api/rules/RuleStatistics.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/rules/RuleStatistics.java b/api/src/main/java/org/apache/unomi/api/rules/RuleStatistics.java
index 2172461..4dd18c7 100644
--- a/api/src/main/java/org/apache/unomi/api/rules/RuleStatistics.java
+++ b/api/src/main/java/org/apache/unomi/api/rules/RuleStatistics.java
@@ -21,13 +21,14 @@ import org.apache.unomi.api.Item;
 import java.util.Date;
 
 /**
- * A separate item to track rule statistics, because we will manage the persistence and updating of these seperately
- * from the rules themselves. This object contains all the relevant statistics concerning the execution of a rule.
+ * A separate item to track rule statistics, because we will manage the persistence and updating of
+ * these seperately from the rules themselves. This object contains all the relevant statistics
+ * concerning the execution of a rule, including accumulated execution times.
  */
 public class RuleStatistics extends Item {
 
     /**
-     * The Rule ITEM_TYPE.
+     * The RuleStatistics ITEM_TYPE.
      *
      * @see Item for a discussion of ITEM_TYPE
      */
@@ -49,58 +50,119 @@ public class RuleStatistics extends Item {
         super(itemId);
     }
 
+    /**
+     * Retrieve the execution count of the rule in the cluster
+     * @return a long that is the total number of executions of the rule without the local node execution
+     * count
+     */
     public long getExecutionCount() {
         return executionCount;
     }
 
+    /**
+     * Set the execution count of the rule in the cluster
+     * @param executionCount a long that represents the number of execution of the rule in the cluster
+     */
     public void setExecutionCount(long executionCount) {
         this.executionCount = executionCount;
     }
 
+    /**
+     * Retrieve the execution count of the rule on this single node since the last sync with the cluster
+     * @return a long that is the total number of executions on this node since the last sync with the
+     * cluster
+     */
     public long getLocalExecutionCount() {
         return localExecutionCount;
     }
 
+    /**
+     * Sets the number of local execution counts for this node since the last sync with the cluster
+     * @param localExecutionCount a long that represents the number of execution of the rule since the
+     *                            last sync with the cluster
+     */
     public void setLocalExecutionCount(long localExecutionCount) {
         this.localExecutionCount = localExecutionCount;
     }
 
+    /**
+     * Retrieve the accumulated time evaluating the conditions of the rule in the cluster
+     * @return a long representing the accumulated time in milliseconds that represents the time spent
+     * evaluating the conditions of the rule for the whole cluster
+     */
     public long getConditionsTime() {
         return conditionsTime;
     }
 
+    /**
+     * Sets the execution time of the condition of the rule for the whole cluster
+     * @param conditionsTime a long representing a time in milliseconds
+     */
     public void setConditionsTime(long conditionsTime) {
         this.conditionsTime = conditionsTime;
     }
 
+    /**
+     * Retrieve the accumulated execution time of the rule's condition since the last sync with the cluster
+     * @return a long that represents the accumulated time in milliseconds
+     */
     public long getLocalConditionsTime() {
         return localConditionsTime;
     }
 
+    /**
+     * Sets the accumulated execution time of the rule's condition since the last sync with the cluster
+     * @param localConditionsTime a long that represents the accumulated time in milliseconds
+     */
     public void setLocalConditionsTime(long localConditionsTime) {
         this.localConditionsTime = localConditionsTime;
     }
 
+    /**
+     * Retrieve the accumulated time of the rule's actions
+     * @return a long representing the accumulated time in milliseconds
+     */
     public long getActionsTime() {
         return actionsTime;
     }
 
+    /**
+     * Sets the accumulated time for the rule's actions
+     * @param actionsTime a long representing the accumulated time in milliseconds
+     */
     public void setActionsTime(long actionsTime) {
         this.actionsTime = actionsTime;
     }
 
+    /**
+     * Retrieve the accumulated time spent executing the rule's actions since the last sync with the cluster
+     * @return a long representing the accumulated time in milliseconds
+     */
     public long getLocalActionsTime() {
         return localActionsTime;
     }
 
+    /**
+     * Sets the accumulated time spend executing the rule's actions since the last sync with the cluster
+     * @param localActionsTime a long representing the accumulated time in milliseconds
+     */
     public void setLocalActionsTime(long localActionsTime) {
         this.localActionsTime = localActionsTime;
     }
 
+    /**
+     * Retrieve the last sync date
+     * @return a date that was set the last time the statistics were synchronized with the cluster
+     */
     public Date getLastSyncDate() {
         return lastSyncDate;
     }
 
+    /**
+     * Sets the last sync date
+     * @param lastSyncDate a date that represents the last time the statistics were synchronized
+     *                     with the cluster
+     */
     public void setLastSyncDate(Date lastSyncDate) {
         this.lastSyncDate = lastSyncDate;
     }


[13/50] [abbrv] incubator-unomi git commit: UNOMI-90 Empty sessionId is processed as a valid sessionId instead of being ignored.

Posted by sh...@apache.org.
UNOMI-90 Empty sessionId is processed as a valid sessionId instead of being ignored.

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/94b6af7f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/94b6af7f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/94b6af7f

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 94b6af7fa60c117f6b899802c375257f04e6d460
Parents: 91d74da
Author: Serge Huber <sh...@apache.org>
Authored: Tue Apr 4 13:05:28 2017 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Tue Apr 4 13:05:38 2017 +0200

----------------------------------------------------------------------
 wab/src/main/java/org/apache/unomi/web/ContextServlet.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/94b6af7f/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 d3e29fe..a9ef4ef 100644
--- a/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
+++ b/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
@@ -158,7 +158,7 @@ public class ContextServlet extends HttpServlet {
                 }
             }
 
-            if (sessionId != null) {
+            if (sessionId != null && sessionId.trim().length() > 0) {
                 session = profileService.loadSession(sessionId, timestamp);
                 if (session != null) {
                     sessionProfile = session.getProfile();
@@ -199,8 +199,8 @@ public class ContextServlet extends HttpServlet {
                 sessionProfile = privacyService.isRequireAnonymousBrowsing(profile.getItemId()) ? privacyService.getAnonymousProfile(profile) : profile;
                 session = new Session(sessionId, sessionProfile, timestamp, scope);
 
-                if (sessionId != null) {
-                    // Only save session and send event if a session id was provided, otherise keep transient session
+                if (sessionId != null && sessionId.trim().length() > 0) {
+                    // Only save session and send event if a session id was provided, otherwise keep transient session
                     changes |= EventService.SESSION_UPDATED;
                     Event event = new Event("sessionCreated", session, profile, scope, null, session, timestamp);
                     if (sessionProfile.isAnonymousProfile()) {


[20/50] [abbrv] incubator-unomi git commit: Minor change : make sure the scripts stop if Maven build fails.

Posted by sh...@apache.org.
Minor change : make sure the scripts stop if Maven build fails.

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/87e8763e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/87e8763e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/87e8763e

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 87e8763ed45497ecd15ab4e8e688f1322c8fab5e
Parents: 9758103
Author: Serge Huber <sh...@apache.org>
Authored: Sat May 6 23:18:52 2017 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Sat May 6 23:18:52 2017 +0200

----------------------------------------------------------------------
 buildAndRun.sh        | 4 ++++
 buildAndRunNoTests.sh | 4 ++++
 2 files changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/87e8763e/buildAndRun.sh
----------------------------------------------------------------------
diff --git a/buildAndRun.sh b/buildAndRun.sh
index 4037f3a..e7128f9 100755
--- a/buildAndRun.sh
+++ b/buildAndRun.sh
@@ -24,6 +24,10 @@ if [ -f "$DIRNAME/setenv.sh" ]; then
   . "$DIRNAME/setenv.sh"
 fi
 mvn clean install -P integration-tests,performance-tests,rat
+if [ $? -ne 0 ]
+then
+    exit 1;
+fi
 pushd package/target
 echo Uncompressing Unomi package...
 tar zxvf unomi-$UNOMI_VERSION.tar.gz

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/87e8763e/buildAndRunNoTests.sh
----------------------------------------------------------------------
diff --git a/buildAndRunNoTests.sh b/buildAndRunNoTests.sh
index fa53832..4bb0028 100755
--- a/buildAndRunNoTests.sh
+++ b/buildAndRunNoTests.sh
@@ -24,6 +24,10 @@ if [ -f "$DIRNAME/setenv.sh" ]; then
   . "$DIRNAME/setenv.sh"
 fi
 mvn clean install -P \!integration-tests,\!performance-tests,rat
+if [ $? -ne 0 ]
+then
+    exit 1;
+fi
 pushd package/target
 echo Uncompressing Unomi package...
 tar zxvf unomi-$UNOMI_VERSION.tar.gz


[46/50] [abbrv] incubator-unomi git commit: UNOMI-103 : Add parameter in context servlet to invalidate session or profile

Posted by sh...@apache.org.
UNOMI-103 : Add parameter in context servlet to invalidate session or profile


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/cae1d4a6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/cae1d4a6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/cae1d4a6

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: cae1d4a60248d242138f6a85403c2e75655b28b9
Parents: b55a20b
Author: rizak <ri...@gmail.com>
Authored: Tue Jun 20 13:49:33 2017 +0200
Committer: rizak <ri...@gmail.com>
Committed: Tue Jun 20 13:49:33 2017 +0200

----------------------------------------------------------------------
 wab/src/main/java/org/apache/unomi/web/ContextServlet.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/cae1d4a6/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 61f36a3..ad70c18 100644
--- a/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
+++ b/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
@@ -111,6 +111,8 @@ public class ContextServlet extends HttpServlet {
         }
 
         String sessionId = request.getParameter("sessionId");
+        boolean invalidateSession = request.getParameter("invalidateSession")!=null?new Boolean(request.getParameter("invalidateSession")):false;
+        boolean invalidateProfile = request.getParameter("invalidateProfile")!=null?new Boolean(request.getParameter("invalidateProfile")):false;
 
         if (cookieProfileId == null && sessionId == null && personaId == null) {
             ((HttpServletResponse)response).sendError(HttpServletResponse.SC_BAD_REQUEST);
@@ -142,8 +144,8 @@ public class ContextServlet extends HttpServlet {
             boolean profileCreated = false;
 
             // Not a persona, resolve profile now
-            if (cookieProfileId == null) {
-                // no profileId cookie was found, we generate a new one and create the profile in the profile service
+            if (cookieProfileId == null || invalidateProfile) {
+                // no profileId cookie was found or the profile has to be invalidated, we generate a new one and create the profile in the profile service
                 profile = createNewProfile(null, response, timestamp);
                 profileCreated = true;
             } else {
@@ -195,7 +197,7 @@ public class ContextServlet extends HttpServlet {
                 }
             }
 
-            if (session == null) {
+            if (session == null || invalidateSession) {
                 sessionProfile = privacyService.isRequireAnonymousBrowsing(profile.getItemId()) ? privacyService.getAnonymousProfile(profile) : profile;
                 session = new Session(sessionId, sessionProfile, timestamp, scope);
 


[47/50] [abbrv] incubator-unomi git commit: UNOMI-101 : Update inactive routes

Posted by sh...@apache.org.
UNOMI-101 : Update inactive routes


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/d19be221
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/d19be221
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/d19be221

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: d19be22158f31d539528d8772006d10f3bc77a1a
Parents: cae1d4a
Author: Abdelkader Midani <am...@apache.org>
Authored: Sat Jun 24 06:44:43 2017 +0200
Committer: Abdelkader Midani <am...@apache.org>
Committed: Sat Jun 24 06:44:43 2017 +0200

----------------------------------------------------------------------
 .../unomi/router/core/context/ProfileImportCamelContext.java | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d19be221/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java
index 9bb50f8..7942f02 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java
@@ -20,6 +20,7 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.Route;
 import org.apache.camel.component.jackson.JacksonDataFormat;
 import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.model.RouteDefinition;
 import org.apache.unomi.router.api.ImportConfiguration;
 import org.apache.unomi.router.api.services.ImportConfigurationService;
 import org.apache.unomi.router.core.processor.ImportConfigByFileNameProcessor;
@@ -107,10 +108,17 @@ public class ProfileImportCamelContext implements SynchronousBundleListener {
     }
 
     public void updateProfileImportReaderRoute(ImportConfiguration importConfiguration) throws Exception {
+        //Active routes
         Route route = camelContext.getRoute(importConfiguration.getItemId());
         if (route != null && stopRoute(importConfiguration.getItemId())) {
             camelContext.removeRoute(importConfiguration.getItemId());
         }
+
+        //Inactive routes
+        RouteDefinition routeDefinition = camelContext.getRouteDefinition(importConfiguration.getItemId());
+        if (routeDefinition != null) {
+            camelContext.removeRouteDefinition(routeDefinition);
+        }
         //Handle transforming an import config oneshot <--> recurrent
         if (IMPORT_CONFIG_TYPE_RECURRENT.equals(importConfiguration.getConfigType())) {
             ProfileImportFromSourceRouteBuilder builder = new ProfileImportFromSourceRouteBuilder(kafkaProps, configType);


[42/50] [abbrv] incubator-unomi git commit: UNOMI-99 Improve network unavailable and connection timeout handling - Force mail template delimiters to $ instead of < >

Posted by sh...@apache.org.
UNOMI-99 Improve network unavailable and connection timeout handling
- Force mail template delimiters to $ instead of < >

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/18af860b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/18af860b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/18af860b

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 18af860b5618d6452905bcca118d8f2a40c8573c
Parents: b38d44c
Author: Serge Huber <sh...@apache.org>
Authored: Fri Jun 16 16:47:43 2017 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Fri Jun 16 16:47:43 2017 +0200

----------------------------------------------------------------------
 .../java/org/apache/unomi/plugins/mail/actions/SendMailAction.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/18af860b/plugins/mail/src/main/java/org/apache/unomi/plugins/mail/actions/SendMailAction.java
----------------------------------------------------------------------
diff --git a/plugins/mail/src/main/java/org/apache/unomi/plugins/mail/actions/SendMailAction.java b/plugins/mail/src/main/java/org/apache/unomi/plugins/mail/actions/SendMailAction.java
index 8810bbc..9e1aadb 100644
--- a/plugins/mail/src/main/java/org/apache/unomi/plugins/mail/actions/SendMailAction.java
+++ b/plugins/mail/src/main/java/org/apache/unomi/plugins/mail/actions/SendMailAction.java
@@ -115,7 +115,7 @@ public class SendMailAction implements ActionExecutor {
         event.getProfile().getSystemProperties().put("notificationAck", profileNotif);
         persistenceService.update(event.getProfile().getItemId(), null, Profile.class, "systemProperties", event.getProfile().getSystemProperties());
 
-        ST stringTemplate = new ST(template);
+        ST stringTemplate = new ST(template, '$', '$');
         stringTemplate.add("profile", event.getProfile());
         stringTemplate.add("event", event);
         // load your HTML email template


[02/50] [abbrv] incubator-unomi git commit: This closes #24

Posted by sh...@apache.org.
This closes #24


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/044fd888
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/044fd888
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/044fd888

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 044fd888374376c307a2b7cba92438601a0de900
Parents: d7cce6a e1e5b58
Author: Serge Huber <sh...@apache.org>
Authored: Fri Feb 24 09:15:47 2017 +0100
Committer: Serge Huber <sh...@apache.org>
Committed: Fri Feb 24 09:15:47 2017 +0100

----------------------------------------------------------------------
 .../apache/unomi/api/services/DefinitionsService.java    |  6 ++++++
 .../apache/unomi/rest/DefinitionsServiceEndPoint.java    | 10 ++++++++++
 .../unomi/services/services/DefinitionsServiceImpl.java  | 11 +++++++++++
 3 files changed, 27 insertions(+)
----------------------------------------------------------------------



[50/50] [abbrv] incubator-unomi git commit: UNOMI-5 Also upgrading to ElasticSearch 5.2

Posted by sh...@apache.org.
UNOMI-5
Also upgrading to ElasticSearch 5.2

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/dd2e5bce
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/dd2e5bce
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/dd2e5bce

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: dd2e5bce8b394e4269665b59821f7061d176121f
Parents: bc2f09f
Author: Serge Huber <sh...@apache.org>
Authored: Tue Feb 14 10:33:01 2017 +0100
Committer: Serge Huber <sh...@apache.org>
Committed: Sat Jun 24 20:37:51 2017 +0200

----------------------------------------------------------------------
 pom.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dd2e5bce/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index a26d297..cf8d65d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -64,9 +64,9 @@
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <cxf.version>3.1.0</cxf.version>
-        <version.jackson.core>2.6.6</version.jackson.core> <!-- version used by CXF -->
-        <version.jackson.jaxb>2.6.6</version.jackson.jaxb> <!-- version used by CXF -->
+        <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.0.8</version.karaf>
         <version.karaf.cellar>4.0.3</version.karaf.cellar>
         <version.pax.exam>4.11.2</version.pax.exam>


[22/50] [abbrv] incubator-unomi git commit: UNOMI-95 Change default SSH port - Switched port to 8102

Posted by sh...@apache.org.
UNOMI-95 Change default SSH port
- Switched port to 8102

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/32447a71
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/32447a71
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/32447a71

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 32447a71d4a424499b7f40af41279f468895bd88
Parents: 7f7cafd
Author: Serge Huber <sh...@apache.org>
Authored: Wed May 10 14:27:12 2017 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Wed May 10 14:27:12 2017 +0200

----------------------------------------------------------------------
 .../resources/etc/org.apache.karaf.shell.cfg    | 104 +++++++++++++++++++
 .../markdown/versions/master/configuration.md   |  11 +-
 2 files changed, 114 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/32447a71/package/src/main/resources/etc/org.apache.karaf.shell.cfg
----------------------------------------------------------------------
diff --git a/package/src/main/resources/etc/org.apache.karaf.shell.cfg b/package/src/main/resources/etc/org.apache.karaf.shell.cfg
new file mode 100644
index 0000000..2f0ee02
--- /dev/null
+++ b/package/src/main/resources/etc/org.apache.karaf.shell.cfg
@@ -0,0 +1,104 @@
+################################################################################
+#
+#    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.
+#
+################################################################################
+
+#
+# These properties are used to configure Karaf's ssh shell.
+#
+
+#
+# Via sshPort and sshHost you define the address you can login into Karaf.
+#
+sshPort = 8102
+sshHost = 0.0.0.0
+
+#
+# The sshIdleTimeout defines the inactivity timeout to logout the SSH session.
+# The sshIdleTimeout is in milliseconds, and the default is set to 30 minutes.
+#
+sshIdleTimeout = 1800000
+
+#
+# sshRealm defines which JAAS domain to use for password authentication.
+#
+sshRealm = karaf
+
+#
+# The location of the hostKey file defines where the private/public key of the server
+# is located. If no file is at the defined location it will be ignored.
+#
+hostKey = ${karaf.etc}/host.key
+
+#
+# Self defined key size in 1024, 2048, 3072, or 4096
+# If not set, this defaults to 4096.
+#
+# keySize = 4096
+
+#
+# Specify host key algorithm, defaults to RSA
+#
+# algorithm = RSA
+
+#
+# Specify the client log level (default is WARN)
+# 0: ERROR
+# 1: WARN
+# 2: INFO
+# 3: DEBUG
+# 4: TRACE
+#
+#logLevel=1
+
+#
+# Specify an additional welcome banner to be displayed when a user logs into the server.
+#
+# welcomeBanner =
+
+#
+# Defines the completion mode on the Karaf shell console. The possible values are:
+# - GLOBAL: it's the same behavior as in previous Karaf releases. The completion displays all commands and all aliases
+#           ignoring if you are in a subshell or not.
+# - FIRST: the completion displays all commands and all aliases only when you are not in a subshell. When you are
+#          in a subshell, the completion displays only the commands local to the subshell.
+# - SUBSHELL: the completion displays only the subshells on the root level. When you are in a subshell, the completion
+#             displays only the commands local to the subshell.
+# This property define the default value when you use the Karaf shell console.
+# You can change the completion mode directly in the shell console, using shell:completion command.
+#
+completionMode = GLOBAL
+
+#
+# Enable the console logger.
+# The console logger allows to generate log messages for all actions/commands performed in the shell console.
+#
+# consoleLogger property enable/disable the logger. The logger is disabled by default
+#
+consoleLogger = false
+#
+# consoleLoggerName allows you to define the logger name used for the log messages
+#
+consoleLoggerName = org.apache.karaf.shell.console.Logger
+#
+# consoleLoggerOutLevel allows you to define the log level for the log messages corresponding to the System.out stream
+#
+consoleLoggerOutLevel = debug
+#
+# consoleLoggerErrLevel allows you to define the log level for the log messages corresponding to the System.err stream
+#
+consoleLoggerErrLevel = error

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/32447a71/src/site/markdown/versions/master/configuration.md
----------------------------------------------------------------------
diff --git a/src/site/markdown/versions/master/configuration.md b/src/site/markdown/versions/master/configuration.md
index 9d7efa0..5d776e2 100644
--- a/src/site/markdown/versions/master/configuration.md
+++ b/src/site/markdown/versions/master/configuration.md
@@ -302,4 +302,13 @@ that contains the following default settings:
     defaultLatitude=46.1884341
     defaultLongitude=6.1282508
 
-You might want to change these for testing or for demonstration purposes.
\ No newline at end of file
+You might want to change these for testing or for demonstration purposes.
+
+Apache Karaf SSH Console
+--------------------------------------
+The Apache Karaf SSH console is available inside Apache Unomi, but the port has been changed from the default value of
+8101 to 8102 to avoid conflicts with other Karaf-based products. So to connect to the SSH console you should use:
+
+    ssh -p 8102 karaf@localhost
+    
+or the user/password you have setup to protect the system if you have changed it.
\ No newline at end of file


[12/50] [abbrv] incubator-unomi git commit: UNOMI-87 : Typo

Posted by sh...@apache.org.
UNOMI-87 : Typo


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/91d74da4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/91d74da4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/91d74da4

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 91d74da4efcb6d6da6c393555bf0fe9479f7a1ce
Parents: 22f297c
Author: Abdelkader Midani <am...@apache.org>
Authored: Wed Mar 29 18:27:41 2017 +0200
Committer: Abdelkader Midani <am...@apache.org>
Committed: Wed Mar 29 18:27:41 2017 +0200

----------------------------------------------------------------------
 .../main/resources/org.apache.unomi.persistence.elasticsearch.cfg  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/91d74da4/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg b/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
index 12980e1..77eb091 100644
--- a/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
+++ b/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
@@ -15,7 +15,7 @@
 # limitations under the License.
 #
 
-cluster.name=contextElasticSearch_amidani
+cluster.name=contextElasticSearch
 # The elasticSearchAddresses may be a comma seperated list of host names and ports such as
 # hostA:9300,hostB:9300
 # Note: the port number must be repeated for each host.


[15/50] [abbrv] incubator-unomi git commit: This closes pull request number #27

Posted by sh...@apache.org.
This closes pull request number #27


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/28b63e66
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/28b63e66
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/28b63e66

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 28b63e6651ec01bfb08b8b19dbd1ebb7d567107c
Parents: daaa332 a8e5203
Author: Abdelkader Midani <am...@apache.org>
Authored: Fri Apr 14 15:04:18 2017 +0200
Committer: Abdelkader Midani <am...@apache.org>
Committed: Fri Apr 14 15:04:18 2017 +0200

----------------------------------------------------------------------
 .../org/apache/unomi/api/ContextRequest.java    | 38 +++++---------------
 .../markdown/versions/1.1/getting-started.md    |  8 +++--
 .../markdown/versions/master/getting-started.md |  8 +++--
 .../org/apache/unomi/web/ContextServlet.java    | 33 +++++++++++------
 4 files changed, 41 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/28b63e66/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
----------------------------------------------------------------------


[25/50] [abbrv] incubator-unomi git commit: UNOMI-94 New action : add a profile to a list - Correct typo

Posted by sh...@apache.org.
UNOMI-94 New action : add a profile to a list
- Correct typo

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/4f4ade0c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/4f4ade0c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/4f4ade0c

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 4f4ade0c84fa47fd619d551f02ab29cece8d05b0
Parents: 84a9929
Author: Serge Huber <sh...@apache.org>
Authored: Thu May 11 19:21:33 2017 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Thu May 11 19:21:43 2017 +0200

----------------------------------------------------------------------
 .../src/main/resources/META-INF/cxs/actions/addToLists.json        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/4f4ade0c/extensions/lists-extension/actions/src/main/resources/META-INF/cxs/actions/addToLists.json
----------------------------------------------------------------------
diff --git a/extensions/lists-extension/actions/src/main/resources/META-INF/cxs/actions/addToLists.json b/extensions/lists-extension/actions/src/main/resources/META-INF/cxs/actions/addToLists.json
index d42adf3..7c7e096 100644
--- a/extensions/lists-extension/actions/src/main/resources/META-INF/cxs/actions/addToLists.json
+++ b/extensions/lists-extension/actions/src/main/resources/META-INF/cxs/actions/addToLists.json
@@ -5,7 +5,7 @@
     "description": "",
     "tags": [
       "demographic",
-      "hidden.availableToEndUsers"
+      "hidden.availableToEndUser"
     ],
     "readOnly": true
   },


[21/50] [abbrv] incubator-unomi git commit: UNOMI-94 New action : add a profile to a list - Add some tags on some actions to define them as end-user available, and allow multiple instances of them or not in rules

Posted by sh...@apache.org.
UNOMI-94 New action : add a profile to a list
- Add some tags on some actions to define them as end-user available, and allow multiple instances of them or not in rules

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/7f7cafdd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/7f7cafdd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/7f7cafdd

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 7f7cafddb6713f57c4399d5e61c52fa4ff51d3ff
Parents: 87e8763
Author: Serge Huber <sh...@apache.org>
Authored: Sun May 7 16:37:31 2017 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Sun May 7 16:37:31 2017 +0200

----------------------------------------------------------------------
 .../src/main/resources/META-INF/cxs/actions/addToLists.json      | 3 ++-
 .../main/resources/META-INF/cxs/actions/setPropertyAction.json   | 4 +++-
 .../src/main/resources/META-INF/cxs/actions/sendMailAction.json  | 4 +++-
 3 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/7f7cafdd/extensions/lists-extension/actions/src/main/resources/META-INF/cxs/actions/addToLists.json
----------------------------------------------------------------------
diff --git a/extensions/lists-extension/actions/src/main/resources/META-INF/cxs/actions/addToLists.json b/extensions/lists-extension/actions/src/main/resources/META-INF/cxs/actions/addToLists.json
index 8875fa9..d42adf3 100644
--- a/extensions/lists-extension/actions/src/main/resources/META-INF/cxs/actions/addToLists.json
+++ b/extensions/lists-extension/actions/src/main/resources/META-INF/cxs/actions/addToLists.json
@@ -4,7 +4,8 @@
     "name": "addToListsAction",
     "description": "",
     "tags": [
-      "demographic"
+      "demographic",
+      "hidden.availableToEndUsers"
     ],
     "readOnly": true
   },

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/7f7cafdd/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/setPropertyAction.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/setPropertyAction.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/setPropertyAction.json
index c076eb7..53c1b64 100644
--- a/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/setPropertyAction.json
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/actions/setPropertyAction.json
@@ -4,7 +4,9 @@
     "name": "setPropertyAction",
     "description": "",
     "tags": [
-      "demographic"
+      "demographic",
+      "hidden.availableToEndUser",
+      "hidden.allowMultipleInstances"
     ],
     "readOnly": true
   },

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/7f7cafdd/plugins/mail/src/main/resources/META-INF/cxs/actions/sendMailAction.json
----------------------------------------------------------------------
diff --git a/plugins/mail/src/main/resources/META-INF/cxs/actions/sendMailAction.json b/plugins/mail/src/main/resources/META-INF/cxs/actions/sendMailAction.json
index cfd1679..ffe346a 100644
--- a/plugins/mail/src/main/resources/META-INF/cxs/actions/sendMailAction.json
+++ b/plugins/mail/src/main/resources/META-INF/cxs/actions/sendMailAction.json
@@ -4,7 +4,9 @@
     "name": "sendMailAction",
     "description": "",
     "tags": [
-      "event"
+      "event",
+      "hidden.availableToEndUser",
+      "hidden.allowMultipleInstances"
     ],
     "readOnly": true
   },


[03/50] [abbrv] incubator-unomi git commit: Add instructions on how to merge pull requests

Posted by sh...@apache.org.
Add instructions on how to merge pull requests

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/c70f0a3c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/c70f0a3c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/c70f0a3c

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: c70f0a3c5e412e6da0ae55d552cb6b4be01bcdf6
Parents: 044fd88
Author: Serge Huber <sh...@apache.org>
Authored: Fri Feb 24 09:28:57 2017 +0100
Committer: Serge Huber <sh...@apache.org>
Committed: Fri Feb 24 09:28:57 2017 +0100

----------------------------------------------------------------------
 MERGING-PULL-REQUESTS | 81 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c70f0a3c/MERGING-PULL-REQUESTS
----------------------------------------------------------------------
diff --git a/MERGING-PULL-REQUESTS b/MERGING-PULL-REQUESTS
new file mode 100644
index 0000000..0f9b101
--- /dev/null
+++ b/MERGING-PULL-REQUESTS
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+Merging Github Pull Requests
+============================
+
+When a developer submits a Pull Request (PR) to the Apache Unomi project on GitHub, you can follow these steps to
+accept and merge that PR into the Apache Unomi code base.
+
+Step-by-step guide
+------------------
+
+1. Carefully review the PR
+
+  Make sure that the code for the PR looks good and, ideally, includes JUnit tests that prove that the code works.
+  Check which branch the PR is targeting and make sure you want the code to go into that branch
+  If the PR is large or adds new files, then make sure the person who submitted the request has an Apache ICLA on file.
+  Ask the contributor to fill out this form and follow the instructions on the form to sent it in to
+  Apache: https://www.apache.org/licenses/icla.txt
+  Check the code to ensure that it does not bring in any code or dependencies with licenses more restrictive than the
+  Apache Software License (ASLv2). For example, we cannot bring in any code or dependencies that are under GPL or
+  LGPL license.
+
+2. Configure your Git client to map GitHub PRs to ref
+
+  Add this to your Git config for the Apache Unomi project. If you already have a remote for GitHub then add the two
+  lines that mention "refs" to it.
+
+        [remote "github"]
+        url = https://github.com/apache/incubating-unomi.git
+        fetch = +refs/heads/*:refs/remotes/github/*
+        fetch = +refs/pull/*/head:refs/remotes/github/pr/*
+
+  NOTE: For the rest of this guide we will assume that Apache Git is the remote named "origin" and GitHub is the remote named "github".
+
+3. Fetch the latest PR refs from GitHub
+
+  Use git's fetch command to pull in the latest PR refs from GitHub.
+
+        git fetch github
+
+4. Checkout the PR code
+
+  Now you can fetch the code for the Pull Request like so:
+
+        git checkout pr/<pull request number>
+
+5. Merge the PR into the desired branch
+
+   First checkout the desired branch and make sure it is up to date, for example:
+
+        git checkout master
+        git pull origin
+
+  Next, use the merge command to merge the code into the target branch. And make sure to include a
+  "This closes #" message (be sure to include the # sign) so that Apache's GitHub integration feature will close the
+  PR. For example:
+
+        git merge -m "This closes pull request number #<pull request number>" pr/<pull request number>
+
+6. Push the code
+
+  Push the code to Apache Git.
+
+        git push origin
+
+  Thank the contributor for their code.


[43/50] [abbrv] incubator-unomi git commit: UNOMI-101 : Execution History

Posted by sh...@apache.org.
UNOMI-101 : Execution History


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/6570c8ad
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/6570c8ad
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/6570c8ad

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 6570c8adad7e3accd3f7011977cff86435901a7b
Parents: 18af860
Author: Abdelkader Midani <am...@apache.org>
Authored: Sat Jun 17 06:11:04 2017 +0200
Committer: Abdelkader Midani <am...@apache.org>
Committed: Sat Jun 17 06:11:29 2017 +0200

----------------------------------------------------------------------
 .../unomi/router/api/ImportConfiguration.java   | 46 ++++++++-
 .../unomi/router/api/ImportLineError.java       | 76 +++++++++++++++
 .../services/ImportConfigurationService.java    |  4 +-
 extensions/router/router-core/pom.xml           |  1 +
 .../unomi/router/core/RouterConstants.java      |  3 +-
 .../core/context/ProfileImportCamelContext.java | 25 +++--
 .../core/processor/LineSplitFailureHandler.java | 11 ++-
 .../core/processor/LineSplitProcessor.java      |  2 +-
 .../processor/RouteCompletionProcessor.java     | 99 ++++++++++++++++++++
 .../ProfileImportFromSourceRouteBuilder.java    | 50 +++++++---
 .../route/ProfileImportToUnomiRouteBuilder.java | 31 ++++--
 .../strategy/ArrayListAggregationStrategy.java  | 46 +++++++++
 .../resources/OSGI-INF/blueprint/blueprint.xml  | 12 +++
 .../main/resources/org.apache.unomi.router.cfg  |  5 +-
 extensions/router/router-rest/pom.xml           |  1 +
 .../ImportConfigurationServiceImpl.java         |  5 +-
 16 files changed, 371 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/6570c8ad/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ImportConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ImportConfiguration.java b/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ImportConfiguration.java
index 127de39..bf17a31 100644
--- a/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ImportConfiguration.java
+++ b/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ImportConfiguration.java
@@ -19,9 +19,8 @@ package org.apache.unomi.router.api;
 import org.apache.unomi.api.Item;
 import org.apache.unomi.api.MetadataItem;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import javax.lang.model.type.MirroredTypeException;
+import java.util.*;
 
 /**
  * Created by amidani on 28/04/2017.
@@ -45,6 +44,9 @@ public class ImportConfiguration extends Item {
     private String columnSeparator = ",";
     private String lineSeparator = "\n";
     private boolean active = false;
+    private boolean running = false;
+
+    private List<Map<String, Object>> executions = new ArrayList();
 
     /**
      * Sets the property identified by the specified name to the specified value. If a property with that name already exists, replaces its value, otherwise adds the new
@@ -160,6 +162,24 @@ public class ImportConfiguration extends Item {
     }
 
     /**
+     * Retrieves the import configuration running flag.
+     *
+     * @return true if the import configuration is running false if not
+     */
+    public boolean isRunning() {
+        return this.running;
+    }
+
+    /**
+     * Sets the running flag true/false.
+     *
+     * @param running a boolean to set to running or inactive the import configuration
+     */
+    public void setRunning(boolean running) {
+        this.running = running;
+    }
+
+    /**
      * Retrieves the import configuration overwriteExistingProfiles flag.
      *
      * @return true if during the import existing profiles must be overwritten
@@ -186,7 +206,7 @@ public class ImportConfiguration extends Item {
     }
 
     /**
-     * gets the column separator.
+     * Retrieves the column separator.
      */
     public String getColumnSeparator() {
         return this.columnSeparator;
@@ -203,7 +223,7 @@ public class ImportConfiguration extends Item {
     }
 
     /**
-     * gets the line separator.
+     * Retrieves the line separator.
      */
     public String getLineSeparator() {
         return this.lineSeparator;
@@ -219,5 +239,21 @@ public class ImportConfiguration extends Item {
         }
     }
 
+    /**
+     * Retrieves the executions
+     */
+    public List<Map<String, Object>> getExecutions() {
+        return this.executions;
+    }
+
+
+    /**
+     * Sets the executions
+     * @param executions
+     */
+    public void setExecutions(List<Map<String, Object>> executions) {
+        this.executions = executions;
+    }
+
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/6570c8ad/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ImportLineError.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ImportLineError.java b/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ImportLineError.java
new file mode 100644
index 0000000..822352d
--- /dev/null
+++ b/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ImportLineError.java
@@ -0,0 +1,76 @@
+/*
+ * 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.unomi.router.api;
+
+/**
+ * A line error object to carry failure
+ */
+public class ImportLineError {
+
+    private long lineNb;
+    private String errorCode;
+    private String lineContent;
+
+    /**
+     * Retrieves the number of the line which failed to be imported
+     * @return lineNb
+     */
+    public long getLineNb() {
+        return lineNb;
+    }
+
+    /**
+     * Sets the number of the line which failed to be imported
+     * @param lineNb
+     */
+    public void setLineNb(long lineNb) {
+        this.lineNb = lineNb;
+    }
+
+    /**
+     * Retrieves the error code
+     * @return errorCode
+     */
+    public String getErrorCode() {
+        return errorCode;
+    }
+
+    /**
+     * Sets the error code
+     * @param errorCode
+     */
+    public void setErrorCode(String errorCode) {
+        this.errorCode = errorCode;
+    }
+
+    /**
+     * Retrieves the line original content
+     * @return lineContent
+     */
+    public String getLineContent() {
+        return lineContent;
+    }
+
+    /**
+     * Sets the line content
+     * @param lineContent
+     */
+    public void setLineContent(String lineContent) {
+        this.lineContent = lineContent;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/6570c8ad/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/services/ImportConfigurationService.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/services/ImportConfigurationService.java b/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/services/ImportConfigurationService.java
index cacd671..92991fe 100644
--- a/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/services/ImportConfigurationService.java
+++ b/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/services/ImportConfigurationService.java
@@ -44,10 +44,10 @@ public interface ImportConfigurationService {
     /**
      * Saves the specified import configuration in the context server.
      *
-     * @param profile the import configuration to be saved
+     * @param importConfiguration the import configuration to be saved
      * @return the newly saved import configuration
      */
-    public ImportConfiguration save(ImportConfiguration profile);
+    public ImportConfiguration save(ImportConfiguration importConfiguration);
 
     /**
      * Deletes the import configuration identified by the specified identifier.

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/6570c8ad/extensions/router/router-core/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/pom.xml b/extensions/router/router-core/pom.xml
index c6fbf5d..e20dfc5 100644
--- a/extensions/router/router-core/pom.xml
+++ b/extensions/router/router-core/pom.xml
@@ -135,6 +135,7 @@
                             org.apache.camel.model,
                             org.apache.camel.model.dataformat,
                             org.apache.camel.model.rest,
+                            org.apache.camel.processor.aggregate,
                             org.apache.camel.spi,
                             org.apache.unomi.api,
                             org.apache.unomi.router.api,

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/6570c8ad/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/RouterConstants.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/RouterConstants.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/RouterConstants.java
index f09e993..d15f2c3 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/RouterConstants.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/RouterConstants.java
@@ -28,7 +28,8 @@ public interface RouterConstants {
 
     String HEADER_IMPORT_CONFIG_ONESHOT = "importConfigOneShot";
     String HEADER_CONFIG_TYPE = "configType";
-    String HEADER_PROFILES_COUNT = "profilesCount";
+
+    String HEADER_FAILED_MESSAGE = "failedMessage";
 
     String DIRECTION_FROM = "from";
     String DIRECTION_TO = "to";

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/6570c8ad/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java
index 9a4a004..f54beb1 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java
@@ -23,10 +23,11 @@ import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.unomi.router.api.ImportConfiguration;
 import org.apache.unomi.router.api.services.ImportConfigurationService;
 import org.apache.unomi.router.core.processor.ImportConfigByFileNameProcessor;
+import org.apache.unomi.router.core.processor.RouteCompletionProcessor;
 import org.apache.unomi.router.core.processor.UnomiStorageProcessor;
-import org.apache.unomi.router.core.route.ProfileImportToUnomiRouteBuilder;
-import org.apache.unomi.router.core.route.ProfileImportOneShotRouteBuilder;
 import org.apache.unomi.router.core.route.ProfileImportFromSourceRouteBuilder;
+import org.apache.unomi.router.core.route.ProfileImportOneShotRouteBuilder;
+import org.apache.unomi.router.core.route.ProfileImportToUnomiRouteBuilder;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
@@ -44,19 +45,17 @@ import java.util.concurrent.TimeUnit;
  */
 public class ProfileImportCamelContext implements SynchronousBundleListener {
 
+    private final String IMPORT_CONFIG_TYPE_RECURRENT = "recurrent";
     private Logger logger = LoggerFactory.getLogger(ProfileImportCamelContext.class.getName());
-
     private CamelContext camelContext;
     private UnomiStorageProcessor unomiStorageProcessor;
+    private RouteCompletionProcessor routeCompletionProcessor;
     private ImportConfigByFileNameProcessor importConfigByFileNameProcessor;
     private ImportConfigurationService importConfigurationService;
     private JacksonDataFormat jacksonDataFormat;
     private String uploadDir;
     private Map<String, String> kafkaProps;
     private String configType;
-
-    private final String IMPORT_CONFIG_TYPE_RECURRENT = "recurrent";
-
     private BundleContext bundleContext;
 
     public void setBundleContext(BundleContext bundleContext) {
@@ -66,9 +65,9 @@ public class ProfileImportCamelContext implements SynchronousBundleListener {
     public void initCamelContext() throws Exception {
         logger.info("Initialize Camel Context...");
         camelContext = new DefaultCamelContext();
-        List<ImportConfiguration> importConfigurationList = importConfigurationService.getImportConfigurations();
+
         ProfileImportFromSourceRouteBuilder builderReader = new ProfileImportFromSourceRouteBuilder(kafkaProps, configType);
-        builderReader.setImportConfigurationList(importConfigurationList);
+        builderReader.setImportConfigurationService(importConfigurationService);
         builderReader.setJacksonDataFormat(jacksonDataFormat);
         builderReader.setContext(camelContext);
         camelContext.addRoutes(builderReader);
@@ -84,6 +83,7 @@ public class ProfileImportCamelContext implements SynchronousBundleListener {
 
         ProfileImportToUnomiRouteBuilder builderProcessor = new ProfileImportToUnomiRouteBuilder(kafkaProps, configType);
         builderProcessor.setUnomiStorageProcessor(unomiStorageProcessor);
+        builderProcessor.setRouteCompletionProcessor(routeCompletionProcessor);
         builderProcessor.setJacksonDataFormat(jacksonDataFormat);
         builderProcessor.setContext(camelContext);
         camelContext.addRoutes(builderProcessor);
@@ -109,13 +109,14 @@ public class ProfileImportCamelContext implements SynchronousBundleListener {
 
     public void updateProfileImportReaderRoute(ImportConfiguration importConfiguration) throws Exception {
         Route route = camelContext.getRoute(importConfiguration.getItemId());
-        if(route!=null && stopRoute(importConfiguration.getItemId())) {
+        if (route != null && stopRoute(importConfiguration.getItemId())) {
             camelContext.removeRoute(importConfiguration.getItemId());
         }
         //Handle transforming an import config oneshot <--> recurrent
-        if(IMPORT_CONFIG_TYPE_RECURRENT.equals(importConfiguration.getConfigType())){
+        if (IMPORT_CONFIG_TYPE_RECURRENT.equals(importConfiguration.getConfigType())) {
             ProfileImportFromSourceRouteBuilder builder = new ProfileImportFromSourceRouteBuilder(kafkaProps, configType);
             builder.setImportConfigurationList(Arrays.asList(importConfiguration));
+            builder.setImportConfigurationService(importConfigurationService);
             builder.setJacksonDataFormat(jacksonDataFormat);
             builder.setContext(camelContext);
             camelContext.addRoutes(builder);
@@ -130,6 +131,10 @@ public class ProfileImportCamelContext implements SynchronousBundleListener {
         this.unomiStorageProcessor = unomiStorageProcessor;
     }
 
+    public void setRouteCompletionProcessor(RouteCompletionProcessor routeCompletionProcessor) {
+        this.routeCompletionProcessor = routeCompletionProcessor;
+    }
+
     public void setImportConfigByFileNameProcessor(ImportConfigByFileNameProcessor importConfigByFileNameProcessor) {
         this.importConfigByFileNameProcessor = importConfigByFileNameProcessor;
     }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/6570c8ad/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitFailureHandler.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitFailureHandler.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitFailureHandler.java
index b1de82a..8f14f67 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitFailureHandler.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitFailureHandler.java
@@ -18,6 +18,9 @@ package org.apache.unomi.router.core.processor;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
+import org.apache.unomi.router.api.ImportLineError;
+import org.apache.unomi.router.core.RouterConstants;
+import org.apache.unomi.router.core.exception.BadProfileDataFormatException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -29,6 +32,12 @@ public class LineSplitFailureHandler implements Processor {
     private static final Logger logger = LoggerFactory.getLogger(LineSplitFailureHandler.class.getName());
 
     public void process(Exchange exchange) throws Exception {
-        logger.error("{}", exchange.getProperty(Exchange.EXCEPTION_CAUGHT));
+        logger.debug("Route: {}, Error: {}", exchange.getProperty(Exchange.FAILURE_ROUTE_ID), exchange.getProperty(Exchange.EXCEPTION_CAUGHT));
+        ImportLineError importLineError = new ImportLineError();
+        importLineError.setErrorCode(((BadProfileDataFormatException)exchange.getProperty(Exchange.EXCEPTION_CAUGHT)).getCause().getMessage());
+        importLineError.setLineContent(exchange.getIn().getBody(String.class));
+        importLineError.setLineNb(((Integer)exchange.getProperty("CamelSplitIndex")+1));
+        exchange.getIn().setHeader(RouterConstants.HEADER_FAILED_MESSAGE, new Boolean(true));
+        exchange.getIn().setBody(importLineError, ImportLineError.class);
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/6570c8ad/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitProcessor.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitProcessor.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitProcessor.java
index da14aa5..a03c833 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitProcessor.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitProcessor.java
@@ -57,7 +57,7 @@ public class LineSplitProcessor implements Processor {
         profileToImport.setScope("system");
         if(profileData.length > 0 && StringUtils.isNotBlank(profileData[0])) {
             if(fieldsMapping.size() != (profileData.length - 1)) {
-                throw new BadProfileDataFormatException("The index does not match the number of column : line ["+((Integer)exchange.getProperty("CamelSplitIndex")+1)+"]", new Throwable("MAPPING_COLUMN_MATCH"));
+                throw new BadProfileDataFormatException("The mapping does not match the number of column : line ["+((Integer)exchange.getProperty("CamelSplitIndex")+1)+"]", new Throwable("MAPPING_COLUMN_MATCH"));
             }
             Map<String, Object> properties = new HashMap<>();
             for (String fieldMappingKey : fieldsMapping.keySet()) {

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/6570c8ad/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/RouteCompletionProcessor.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/RouteCompletionProcessor.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/RouteCompletionProcessor.java
new file mode 100644
index 0000000..e4f01cc
--- /dev/null
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/RouteCompletionProcessor.java
@@ -0,0 +1,99 @@
+/*
+ * 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.unomi.router.core.processor;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.unomi.router.api.ImportConfiguration;
+import org.apache.unomi.router.api.ImportLineError;
+import org.apache.unomi.router.api.ProfileToImport;
+import org.apache.unomi.router.api.services.ImportConfigurationService;
+import org.apache.unomi.router.core.RouterConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.*;
+
+/**
+ * Created by amidani on 14/06/2017.
+ */
+public class RouteCompletionProcessor implements Processor {
+
+    private static final Logger logger = LoggerFactory.getLogger(RouteCompletionProcessor.class.getName());
+    private ImportConfigurationService importConfigurationService;
+    private int executionsHistorySize;
+
+    @Override
+    public void process(Exchange exchange) throws Exception {
+        String importConfigId = null;
+        ImportConfiguration importConfigOneShot = (ImportConfiguration) exchange.getIn().getHeader(RouterConstants.HEADER_IMPORT_CONFIG_ONESHOT);
+        if(importConfigOneShot!=null) {
+            importConfigId = importConfigOneShot.getItemId();
+        } else {
+            importConfigId = exchange.getFromRouteId();
+        }
+        ImportConfiguration importConfiguration = importConfigurationService.load(importConfigId);
+        long successCount = 0;
+        long failureCount = 0;
+        long ignoreCount = 0;
+        List<ImportLineError> errors = new ArrayList<ImportLineError>();
+
+        for(Object line : exchange.getIn().getBody(ArrayList.class)){
+            if(line instanceof ProfileToImport) {
+                successCount++;
+            } else if(line instanceof ImportLineError) {
+                failureCount++;
+                errors.add(((ImportLineError) line));
+            } else {
+                ignoreCount++;
+            }
+        }
+
+        Map execution = new HashMap();
+        execution.put("date", ((Date)exchange.getProperty("CamelCreatedTimestamp")).getTime());
+        execution.put("totalLinesNb", exchange.getProperty("CamelSplitSize"));
+        execution.put("successCount", successCount);
+        execution.put("failureCount", failureCount);
+        execution.put("errors", errors);
+
+        if(importConfiguration.getExecutions().size() >= executionsHistorySize) {
+            int oldestExecIndex = 0;
+            long oldestExecDate = (Long)importConfiguration.getExecutions().get(0).get("date");
+            for(int i = 1 ; i < importConfiguration.getExecutions().size() ; i++) {
+                if((Long)importConfiguration.getExecutions().get(i).get("date") < oldestExecDate) {
+                    oldestExecDate = (Long)importConfiguration.getExecutions().get(i).get("date");
+                    oldestExecIndex = i;
+                }
+            }
+            importConfiguration.getExecutions().remove(oldestExecIndex);
+        }
+
+        importConfiguration.getExecutions().add(execution);
+        //Set running to false, route is complete
+        importConfiguration.setRunning(false);
+        importConfigurationService.save(importConfiguration);
+        logger.info("Processing route {} completed.", exchange.getFromRouteId());
+    }
+
+    public void setImportConfigurationService(ImportConfigurationService importConfigurationService) {
+        this.importConfigurationService = importConfigurationService;
+    }
+
+    public void setExecutionsHistorySize(int executionsHistorySize) {
+        this.executionsHistorySize = executionsHistorySize;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/6570c8ad/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportFromSourceRouteBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportFromSourceRouteBuilder.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportFromSourceRouteBuilder.java
index 9be6fb6..ca64091 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportFromSourceRouteBuilder.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportFromSourceRouteBuilder.java
@@ -16,18 +16,23 @@
  */
 package org.apache.unomi.router.core.route;
 
+import org.apache.camel.Exchange;
 import org.apache.camel.LoggingLevel;
+import org.apache.camel.Processor;
 import org.apache.camel.component.kafka.KafkaEndpoint;
 import org.apache.camel.model.ProcessorDefinition;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.unomi.router.api.ImportConfiguration;
+import org.apache.unomi.router.api.services.ImportConfigurationService;
 import org.apache.unomi.router.core.RouterConstants;
 import org.apache.unomi.router.core.exception.BadProfileDataFormatException;
 import org.apache.unomi.router.core.processor.LineSplitFailureHandler;
 import org.apache.unomi.router.core.processor.LineSplitProcessor;
+import org.apache.unomi.router.core.processor.RouteCompletionProcessor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -40,7 +45,7 @@ public class ProfileImportFromSourceRouteBuilder extends ProfileImportAbstractRo
     private static final Logger logger = LoggerFactory.getLogger(ProfileImportFromSourceRouteBuilder.class.getName());
 
     private List<ImportConfiguration> importConfigurationList;
-
+    private ImportConfigurationService importConfigurationService;
 
     public ProfileImportFromSourceRouteBuilder(Map<String, String> kafkaProps, String configType) {
         super(kafkaProps, configType);
@@ -51,8 +56,12 @@ public class ProfileImportFromSourceRouteBuilder extends ProfileImportAbstractRo
 
         logger.info("Configure Recurrent Route 'From Source'");
 
+        if(importConfigurationList == null) {
+            importConfigurationList = importConfigurationService.getImportConfigurations();
+        }
+
         //Loop on multiple import configuration
-        for (ImportConfiguration importConfiguration : importConfigurationList) {
+        for (final ImportConfiguration importConfiguration : importConfigurationList) {
             if (importConfiguration.getProperties().size() > 0 &&
                     StringUtils.isNotEmpty((String) importConfiguration.getProperties().get("source"))) {
                 //Prepare Split Processor
@@ -63,24 +72,39 @@ public class ProfileImportFromSourceRouteBuilder extends ProfileImportAbstractRo
                 lineSplitProcessor.setMergingProperty(importConfiguration.getMergingProperty());
                 lineSplitProcessor.setColumnSeparator(importConfiguration.getColumnSeparator());
 
-                onException(BadProfileDataFormatException.class)
+                ProcessorDefinition prDefErr = onException(BadProfileDataFormatException.class)
                         .log(LoggingLevel.ERROR, "Error processing record ${exchangeProperty.CamelSplitIndex}++ !")
                         .handled(true)
-                        .process(new LineSplitFailureHandler())
-                        .to("direct:errors");
+                        .process(new LineSplitFailureHandler());
 
-                errorHandler(deadLetterChannel("direct:errors"));
+                if (RouterConstants.CONFIG_TYPE_KAFKA.equals(configType)) {
+                    prDefErr.to((KafkaEndpoint) getEndpointURI(RouterConstants.DIRECTION_FROM));
+                } else {
+                    prDefErr.to((String) getEndpointURI(RouterConstants.DIRECTION_FROM));
+                }
 
                 ProcessorDefinition prDef = from((String) importConfiguration.getProperties().get("source"))
                         .routeId(importConfiguration.getItemId())// This allow identification of the route for manual start/stop
                         .autoStartup(importConfiguration.isActive())// Auto-start if the import configuration is set active
+                        .onCompletion()
+                        // this route is only invoked when the original route is complete as a kind
+                        // of completion callback
+                        .log(LoggingLevel.DEBUG, "ROUTE [" + importConfiguration.getItemId() + "] is now complete [" + new Date().toString() + "]")
+                        // must use end to denote the end of the onCompletion route
+                        .end()
+                        .process(new Processor() {
+                            @Override
+                            public void process(Exchange exchange) throws Exception {
+                                importConfiguration.setRunning(true);
+                                importConfigurationService.save(importConfiguration);
+                            }
+                        })
                         .split(bodyAs(String.class).tokenize(importConfiguration.getLineSeparator()))
-                        .log(LoggingLevel.INFO, "Splitted into ${exchangeProperty.CamelSplitSize} records")
-                        .setHeader(RouterConstants.HEADER_PROFILES_COUNT, exchangeProperty("CamelSplitSize}"))
+                        .log(LoggingLevel.DEBUG, "Splitted into ${exchangeProperty.CamelSplitSize} records")
                         .setHeader(RouterConstants.HEADER_CONFIG_TYPE, constant(configType))
                         .process(lineSplitProcessor)
-                        .log(LoggingLevel.INFO, "Split IDX ${exchangeProperty.CamelSplitIndex} record")
-                        .to("log:org.apache.unomi.router?level=INFO")
+                        .log(LoggingLevel.DEBUG, "Split IDX ${exchangeProperty.CamelSplitIndex} record")
+                        .to("log:org.apache.unomi.router?level=DEBUG")
                         .marshal(jacksonDataFormat)
                         .convertBodyTo(String.class);
 
@@ -89,8 +113,6 @@ public class ProfileImportFromSourceRouteBuilder extends ProfileImportAbstractRo
                 } else {
                     prDef.to((String) getEndpointURI(RouterConstants.DIRECTION_FROM));
                 }
-
-                from("direct:errors").to("log:org.apache.unomi.router?level=ERROR");
             }
         }
     }
@@ -99,4 +121,8 @@ public class ProfileImportFromSourceRouteBuilder extends ProfileImportAbstractRo
         this.importConfigurationList = importConfigurationList;
     }
 
+    public void setImportConfigurationService(ImportConfigurationService importConfigurationService) {
+        this.importConfigurationService = importConfigurationService;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/6570c8ad/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportToUnomiRouteBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportToUnomiRouteBuilder.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportToUnomiRouteBuilder.java
index 9bec24b..91c0bf0 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportToUnomiRouteBuilder.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportToUnomiRouteBuilder.java
@@ -16,15 +16,15 @@
  */
 package org.apache.unomi.router.core.route;
 
-import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.LoggingLevel;
 import org.apache.camel.component.jackson.JacksonDataFormat;
-import org.apache.camel.component.kafka.KafkaComponent;
-import org.apache.camel.component.kafka.KafkaConfiguration;
 import org.apache.camel.component.kafka.KafkaEndpoint;
+import org.apache.camel.model.Constants;
 import org.apache.camel.model.RouteDefinition;
-import org.apache.commons.lang3.StringUtils;
 import org.apache.unomi.router.core.RouterConstants;
+import org.apache.unomi.router.core.processor.RouteCompletionProcessor;
 import org.apache.unomi.router.core.processor.UnomiStorageProcessor;
+import org.apache.unomi.router.core.strategy.ArrayListAggregationStrategy;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -38,6 +38,7 @@ public class ProfileImportToUnomiRouteBuilder extends ProfileImportAbstractRoute
     private Logger logger = LoggerFactory.getLogger(ProfileImportToUnomiRouteBuilder.class.getName());
 
     private UnomiStorageProcessor unomiStorageProcessor;
+    private RouteCompletionProcessor routeCompletionProcessor;
 
     public ProfileImportToUnomiRouteBuilder(Map<String, String> kafkaProps, String configType) {
         super(kafkaProps, configType);
@@ -49,21 +50,33 @@ public class ProfileImportToUnomiRouteBuilder extends ProfileImportAbstractRoute
         logger.info("Configure Recurrent Route 'To Target'");
 
         RouteDefinition rtDef;
-        if(RouterConstants.CONFIG_TYPE_KAFKA.equals(configType)){
-            rtDef=from((KafkaEndpoint)getEndpointURI(RouterConstants.DIRECTION_TO));
+        if (RouterConstants.CONFIG_TYPE_KAFKA.equals(configType)) {
+            rtDef = from((KafkaEndpoint) getEndpointURI(RouterConstants.DIRECTION_TO));
         } else {
-            rtDef=from((String)getEndpointURI(RouterConstants.DIRECTION_TO));
+            rtDef = from((String) getEndpointURI(RouterConstants.DIRECTION_TO));
         }
-        rtDef.unmarshal(jacksonDataFormat)
+        rtDef.choice()
+                .when(header(RouterConstants.HEADER_FAILED_MESSAGE).isNull())
+                .unmarshal(jacksonDataFormat)
                 .process(unomiStorageProcessor)
+                .otherwise()
+                .log(LoggingLevel.DEBUG, "Failed message, skip processing!")
+                .end()
+                .aggregate(constant(true), new ArrayListAggregationStrategy())
+                .completionPredicate(exchangeProperty("CamelSplitComplete").isEqualTo("true"))
+                .eagerCheckCompletion()
+                .process(routeCompletionProcessor)
                 .to("log:org.apache.unomi.router?level=INFO");
-
     }
 
     public void setUnomiStorageProcessor(UnomiStorageProcessor unomiStorageProcessor) {
         this.unomiStorageProcessor = unomiStorageProcessor;
     }
 
+    public void setRouteCompletionProcessor(RouteCompletionProcessor routeCompletionProcessor) {
+        this.routeCompletionProcessor = routeCompletionProcessor;
+    }
+
     public void setJacksonDataFormat(JacksonDataFormat jacksonDataFormat) {
         this.jacksonDataFormat = jacksonDataFormat;
     }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/6570c8ad/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/strategy/ArrayListAggregationStrategy.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/strategy/ArrayListAggregationStrategy.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/strategy/ArrayListAggregationStrategy.java
new file mode 100644
index 0000000..a53e34b
--- /dev/null
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/strategy/ArrayListAggregationStrategy.java
@@ -0,0 +1,46 @@
+/*
+ * 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.unomi.router.core.strategy;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.processor.aggregate.AggregationStrategy;
+import org.apache.camel.processor.aggregate.CompletionAwareAggregationStrategy;
+import org.apache.unomi.router.core.processor.RouteCompletionProcessor;
+
+import java.util.ArrayList;
+
+/**
+ * Created by amidani on 16/06/2017.
+ */
+public class ArrayListAggregationStrategy implements AggregationStrategy {
+
+
+    public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
+        Object newBody = newExchange.getIn().getBody();
+        ArrayList<Object> list = null;
+        if (oldExchange == null) {
+            list = new ArrayList<Object>();
+            list.add(newBody);
+            newExchange.getIn().setBody(list);
+            return newExchange;
+        } else {
+            list = oldExchange.getIn().getBody(ArrayList.class);
+            list.add(newBody);
+            return oldExchange;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/6570c8ad/extensions/router/router-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/extensions/router/router-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 53efbf3..86bcf47 100644
--- a/extensions/router/router-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/extensions/router/router-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -33,6 +33,7 @@
             <cm:property name="kafka.import.consumerCount" value="10"/>
             <cm:property name="kafka.import.autoCommit" value="true"/>
             <cm:property name="import.oneshot.uploadDir" value="/tmp/oneshot_import_configs/"/>
+            <cm:property name="import.executionsHistory.size" value="5"/>
         </cm:default-properties>
     </cm:property-placeholder>
 
@@ -40,6 +41,11 @@
         <property name="profileImportService" ref="profileImportService"/>
     </bean>
 
+    <bean id="routeCompletionProcessor" class="org.apache.unomi.router.core.processor.RouteCompletionProcessor">
+        <property name="importConfigurationService" ref="importConfigurationService"/>
+        <property name="executionsHistorySize" value="${import.executionsHistory.size}"/>
+    </bean>
+
     <bean id="importConfigByFileNameProcessor" class="org.apache.unomi.router.core.processor.ImportConfigByFileNameProcessor">
         <property name="importConfigurationService" ref="importConfigurationService"/>
     </bean>
@@ -53,6 +59,11 @@
         <property name="library" value="Jackson"/>
     </bean>
 
+    <bean id="jacksonDataFormatImportLineError" class="org.apache.camel.model.dataformat.JsonDataFormat">
+        <property name="unmarshalType" value="org.apache.unomi.router.api.ImportLineError"/>
+        <property name="library" value="Jackson"/>
+    </bean>
+
     <bean class="org.apache.camel.component.servlet.osgi.OsgiServletRegisterer"
           init-method="register"
           destroy-method="unregister">
@@ -79,6 +90,7 @@
         </property>
         <property name="uploadDir" value="${import.oneshot.uploadDir}"/>
         <property name="unomiStorageProcessor" ref="unomiStorageProcessor"/>
+        <property name="routeCompletionProcessor" ref="routeCompletionProcessor"/>
         <property name="importConfigByFileNameProcessor" ref="importConfigByFileNameProcessor"/>
         <property name="importConfigurationService" ref="importConfigurationService"/>
         <property name="jacksonDataFormat" ref="jacksonDataFormat"/>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/6570c8ad/extensions/router/router-core/src/main/resources/org.apache.unomi.router.cfg
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/resources/org.apache.unomi.router.cfg b/extensions/router/router-core/src/main/resources/org.apache.unomi.router.cfg
index 0ce4bb2..e301b58 100644
--- a/extensions/router/router-core/src/main/resources/org.apache.unomi.router.cfg
+++ b/extensions/router/router-core/src/main/resources/org.apache.unomi.router.cfg
@@ -29,4 +29,7 @@ import.config.type=nobroker
 #kafka.import.autoCommit=true
 
 #Import One Shot upload directory
-import.oneshot.uploadDir=/tmp/unomi_oneshot_import_configs/
\ No newline at end of file
+import.oneshot.uploadDir=${karaf.data}/tmp/unomi_oneshot_import_configs/
+
+#Import executions history size
+import.executionsHistory.size=5
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/6570c8ad/extensions/router/router-rest/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/router/router-rest/pom.xml b/extensions/router/router-rest/pom.xml
index fc1065f..e151363 100644
--- a/extensions/router/router-rest/pom.xml
+++ b/extensions/router/router-rest/pom.xml
@@ -68,6 +68,7 @@
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
+            <version>${version.jackson.core}</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/6570c8ad/extensions/router/router-service/src/main/java/org/apache/unomi/router/services/ImportConfigurationServiceImpl.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-service/src/main/java/org/apache/unomi/router/services/ImportConfigurationServiceImpl.java b/extensions/router/router-service/src/main/java/org/apache/unomi/router/services/ImportConfigurationServiceImpl.java
index a4f6131..5283cce 100644
--- a/extensions/router/router-service/src/main/java/org/apache/unomi/router/services/ImportConfigurationServiceImpl.java
+++ b/extensions/router/router-service/src/main/java/org/apache/unomi/router/services/ImportConfigurationServiceImpl.java
@@ -95,10 +95,7 @@ public class ImportConfigurationServiceImpl implements ImportConfigurationServic
         if (importConfiguration.getItemId() == null) {
             importConfiguration.setItemId(UUID.randomUUID().toString());
         }
-        if(persistenceService.save(importConfiguration)) {
-
-        }
-
+        persistenceService.save(importConfiguration);
         return persistenceService.load(importConfiguration.getItemId(), ImportConfiguration.class);
     }
 



[09/50] [abbrv] incubator-unomi git commit: DMF-599 "User was not on the site in the last" doesn't work in preview with persona / Last visit

Posted by sh...@apache.org.
DMF-599 "User was not on the site in the last" doesn't work in preview with persona / Last visit

- Fixed by introducing a new previousVisit property and fixing the context servlet to properly override the profile inside the session too.

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/cd3bc9ff
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/cd3bc9ff
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/cd3bc9ff

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: cd3bc9ff0e5a6df2cb33954b69a827667006e164
Parents: 4ff30d4
Author: Serge Huber <sh...@apache.org>
Authored: Fri Mar 17 16:45:19 2017 +0100
Committer: Serge Huber <sh...@apache.org>
Committed: Fri Mar 17 16:45:19 2017 +0100

----------------------------------------------------------------------
 .../cxs/properties/profiles/system/previousVisit.json     | 10 ++++++++++
 .../main/java/org/apache/unomi/web/ContextServlet.java    |  1 +
 2 files changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/cd3bc9ff/services/src/main/resources/META-INF/cxs/properties/profiles/system/previousVisit.json
----------------------------------------------------------------------
diff --git a/services/src/main/resources/META-INF/cxs/properties/profiles/system/previousVisit.json b/services/src/main/resources/META-INF/cxs/properties/profiles/system/previousVisit.json
new file mode 100644
index 0000000..6094746
--- /dev/null
+++ b/services/src/main/resources/META-INF/cxs/properties/profiles/system/previousVisit.json
@@ -0,0 +1,10 @@
+{
+  "metadata": {     "id": "previousVisit", "name": "Previous visit"   },
+  "type": "date",
+  "tags": [ "systemProfileProperties" ],
+  "defaultValue": "",
+  "automaticMappingsFrom": [ ],
+  "mergeStrategy": "mostRecentMergeStrategy",
+  "rank": "103.1",
+  "protected": true
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/cd3bc9ff/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 c1c096c..d3e29fe 100644
--- a/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
+++ b/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
@@ -380,6 +380,7 @@ public class ContextServlet extends HttpServlet {
 
             if (contextRequest.getProfilePropertiesOverrides() != null) {
                 profile.setProperties(contextRequest.getProfilePropertiesOverrides());
+                session.getProfile().setProperties(contextRequest.getProfilePropertiesOverrides());
             }
 
             if (contextRequest.getSessionPropertiesOverrides() != null) {


[10/50] [abbrv] incubator-unomi git commit: UNOMI-87 : Rewrite the queries for the scroring plans update

Posted by sh...@apache.org.
UNOMI-87 : Rewrite the queries for the scroring plans update


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/2f687915
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/2f687915
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/2f687915

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 2f687915a8929af291e43ee2536ba4208e752496
Parents: cd3bc9f
Author: Abdelkader Midani <am...@apache.org>
Authored: Mon Mar 20 12:09:36 2017 +0100
Committer: Abdelkader Midani <am...@apache.org>
Committed: Mon Mar 20 12:09:42 2017 +0100

----------------------------------------------------------------------
 .../ElasticSearchPersistenceServiceImpl.java    | 124 ++++++++++++++-----
 ...g.apache.unomi.persistence.elasticsearch.cfg |   4 +-
 persistence-elasticsearch/pom.xml               |   1 -
 .../persistence/spi/PersistenceService.java     |  12 ++
 .../PropertyConditionESQueryBuilder.java        |   3 +
 .../conditions/PropertyConditionEvaluator.java  |   3 -
 pom.xml                                         |   2 +-
 .../services/services/SegmentServiceImpl.java   | 119 +++++++++---------
 8 files changed, 169 insertions(+), 99 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/2f687915/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
index e2d1645..4e66418 100644
--- a/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
+++ b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
@@ -56,7 +56,11 @@ import org.elasticsearch.index.IndexNotFoundException;
 import org.elasticsearch.index.query.QueryBuilder;
 import org.elasticsearch.index.query.QueryBuilders;
 import org.elasticsearch.index.query.RangeQueryBuilder;
+import org.elasticsearch.index.reindex.BulkIndexByScrollResponse;
+import org.elasticsearch.index.reindex.UpdateByQueryAction;
+import org.elasticsearch.index.reindex.UpdateByQueryRequestBuilder;
 import org.elasticsearch.script.Script;
+import org.elasticsearch.script.ScriptException;
 import org.elasticsearch.script.ScriptType;
 import org.elasticsearch.search.SearchHit;
 import org.elasticsearch.search.SearchHits;
@@ -92,22 +96,21 @@ import java.util.*;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 
+import static org.elasticsearch.index.query.QueryBuilders.termQuery;
+
 @SuppressWarnings("rawtypes")
 public class ElasticSearchPersistenceServiceImpl implements PersistenceService, SynchronousBundleListener {
 
-    private static final Logger logger = LoggerFactory.getLogger(ElasticSearchPersistenceServiceImpl.class.getName());
-
     public static final String NUMBER_OF_SHARDS = "number_of_shards";
     public static final String NUMBER_OF_REPLICAS = "number_of_replicas";
     public static final String CLUSTER_NAME = "cluster.name";
-
     public static final String BULK_PROCESSOR_NAME = "bulkProcessor.name";
     public static final String BULK_PROCESSOR_CONCURRENT_REQUESTS = "bulkProcessor.concurrentRequests";
     public static final String BULK_PROCESSOR_BULK_ACTIONS = "bulkProcessor.bulkActions";
     public static final String BULK_PROCESSOR_BULK_SIZE = "bulkProcessor.bulkSize";
     public static final String BULK_PROCESSOR_FLUSH_INTERVAL = "bulkProcessor.flushInterval";
     public static final String BULK_PROCESSOR_BACKOFF_POLICY = "bulkProcessor.backoffPolicy";
-
+    private static final Logger logger = LoggerFactory.getLogger(ElasticSearchPersistenceServiceImpl.class.getName());
     private TransportClient client;
     private BulkProcessor bulkProcessor;
     private String elasticSearchAddresses;
@@ -123,7 +126,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
     private ConditionEvaluatorDispatcher conditionEvaluatorDispatcher;
     private ConditionESQueryBuilderDispatcher conditionESQueryBuilderDispatcher;
 
-    private Map<String,String> indexNames;
+    private Map<String, String> indexNames;
     private List<String> itemsMonthlyIndexed;
     private Map<String, String> routingByType;
     private Set<String> existingIndexNames = new TreeSet<String>();
@@ -135,7 +138,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
     private String bulkProcessorName = "unomi-bulk";
     private String bulkProcessorConcurrentRequests = "1";
     private String bulkProcessorBulkActions = "1000";
-    private String bulkProcessorBulkSize= "5MB";
+    private String bulkProcessorBulkSize = "5MB";
     private String bulkProcessorFlushInterval = "5s";
     private String bulkProcessorBackoffPolicy = "exponential";
 
@@ -306,8 +309,8 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
                 }
                 if (!indexExists) {
                     logger.info("{} index doesn't exist yet, creating it...", indexName);
-                    Map<String,String> indexMappings = new HashMap<String,String>();
-                    indexMappings.put("_default_",mappings.get("_default_"));
+                    Map<String, String> indexMappings = new HashMap<String, String>();
+                    indexMappings.put("_default_", mappings.get("_default_"));
                     for (Map.Entry<String, String> entry : mappings.entrySet()) {
                         if (!itemsMonthlyIndexed.contains(entry.getKey()) && !indexNames.containsKey(entry.getKey())) {
                             indexMappings.put(entry.getKey(), entry.getValue());
@@ -455,7 +458,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
                     int paramEndPos = backoffPolicyStr.indexOf(")", paramStartPos);
                     int paramSeparatorPos = backoffPolicyStr.indexOf(",", paramStartPos);
                     TimeValue delay = TimeValue.parseTimeValue(backoffPolicyStr.substring(paramStartPos, paramSeparatorPos), new TimeValue(5, TimeUnit.SECONDS), BULK_PROCESSOR_BACKOFF_POLICY);
-                    int maxNumberOfRetries = Integer.parseInt(backoffPolicyStr.substring(paramSeparatorPos+1, paramEndPos));
+                    int maxNumberOfRetries = Integer.parseInt(backoffPolicyStr.substring(paramSeparatorPos + 1, paramEndPos));
                     bulkProcessorBuilder.setBackoffPolicy(BackoffPolicy.constantBackoff(delay, maxNumberOfRetries));
                 } else if (backoffPolicyStr.startsWith("exponential")) {
                     if (!backoffPolicyStr.contains("(")) {
@@ -466,7 +469,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
                         int paramEndPos = backoffPolicyStr.indexOf(")", paramStartPos);
                         int paramSeparatorPos = backoffPolicyStr.indexOf(",", paramStartPos);
                         TimeValue delay = TimeValue.parseTimeValue(backoffPolicyStr.substring(paramStartPos, paramSeparatorPos), new TimeValue(5, TimeUnit.SECONDS), BULK_PROCESSOR_BACKOFF_POLICY);
-                        int maxNumberOfRetries = Integer.parseInt(backoffPolicyStr.substring(paramSeparatorPos+1, paramEndPos));
+                        int maxNumberOfRetries = Integer.parseInt(backoffPolicyStr.substring(paramSeparatorPos + 1, paramEndPos));
                         bulkProcessorBuilder.setBackoffPolicy(BackoffPolicy.exponentialBackoff(delay, maxNumberOfRetries));
                     }
                 }
@@ -551,8 +554,8 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
             if (!indexExists) {
                 logger.info("{} index doesn't exist yet, creating it...", monthlyIndexName);
 
-                Map<String,String> indexMappings = new HashMap<String,String>();
-                indexMappings.put("_default_",mappings.get("_default_"));
+                Map<String, String> indexMappings = new HashMap<String, String>();
+                indexMappings.put("_default_", mappings.get("_default_"));
                 for (Map.Entry<String, String> entry : mappings.entrySet()) {
                     if (itemsMonthlyIndexed.contains(entry.getKey())) {
                         indexMappings.put(entry.getKey(), entry.getValue());
@@ -749,6 +752,60 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
     }
 
     @Override
+    public boolean updateWithQueryAndScript(final Date dateHint, final Class<?> clazz, final String[] scripts, final Map<String, Object>[] scriptParams, final Condition[] conditions) {
+        return new InClassLoaderExecute<Boolean>() {
+            protected Boolean execute(Object... args) throws Exception {
+                try {
+                    String itemType = (String) clazz.getField("ITEM_TYPE").get(null);
+
+                    String index = indexNames.containsKey(itemType) ? indexNames.get(itemType) :
+                            (itemsMonthlyIndexed.contains(itemType) && dateHint != null ? getMonthlyIndex(dateHint) : indexName);
+
+                    for (int i = 0; i < scripts.length; i++) {
+                        Script actualScript = new Script(ScriptType.INLINE, "painless", scripts[i], scriptParams[i]);
+
+                        client.admin().indices().prepareRefresh(index).get();
+
+                        UpdateByQueryRequestBuilder ubqrb = UpdateByQueryAction.INSTANCE.newRequestBuilder(client);
+                        ubqrb.source(index).source().setTypes(itemType);
+                        BulkIndexByScrollResponse response = ubqrb.setSlices(2)
+                                .setMaxRetries(1000).abortOnVersionConflict(false).script(actualScript)
+                                .filter(conditionESQueryBuilderDispatcher.buildFilter(conditions[i])).get();
+                        if (response.getBulkFailures().size() > 0) {
+                            for (BulkItemResponse.Failure failure : response.getBulkFailures()) {
+                                logger.error("Failure : cause={} , message={}", failure.getCause(), failure.getMessage());
+                            }
+                        } else {
+                            logger.info("Update By Query has processed {} in {}.", response.getUpdated(), response.getTook().toString());
+                        }
+                        if (response.isTimedOut()) {
+                            logger.error("Update By Query ended with timeout!");
+                        }
+                        if (response.getVersionConflicts() > 0) {
+                            logger.warn("Update By Query ended with {} Version Conflicts!", response.getVersionConflicts());
+                        }
+                        if (response.getNoops() > 0) {
+                            logger.warn("Update By Query ended with {} noops!", response.getNoops());
+                        }
+                    }
+                    return true;
+                } catch (IndexNotFoundException e) {
+                    throw new Exception("No index found for itemType=" + clazz.getName(), e);
+                } catch (NoSuchFieldException e) {
+                    throw new Exception("Error updating item ", e);
+                } catch (IllegalAccessException e) {
+                    throw new Exception("Error updating item ", e);
+                } catch (ScriptException e) {
+                    logger.error("Error in the update script : {}\n{}\n{}", e.getScript(), e.getDetailedMessage(), e.getScriptStack());
+                    throw new Exception("Error in the update script");
+                } finally {
+                    return false;
+                }
+            }
+        }.catchingExecuteInClassLoader(true);
+    }
+
+    @Override
     public boolean updateWithScript(final String itemId, final Date dateHint, final Class<?> clazz, final String script, final Map<String, Object> scriptParams) {
         return new InClassLoaderExecute<Boolean>() {
             protected Boolean execute(Object... args) throws Exception {
@@ -758,13 +815,15 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
                     String index = indexNames.containsKey(itemType) ? indexNames.get(itemType) :
                             (itemsMonthlyIndexed.contains(itemType) && dateHint != null ? getMonthlyIndex(dateHint) : indexName);
 
-                    Script actualScript = new Script(ScriptType.INLINE, "groovy", script, scriptParams);
+                    Script actualScript = new Script(ScriptType.INLINE, "painless", script, scriptParams);
+
                     if (bulkProcessor == null) {
                         client.prepareUpdate(index, itemType, itemId).setScript(actualScript)
                                 .execute()
                                 .actionGet();
                     } else {
-                        UpdateRequest updateRequest = client.prepareUpdate(index, itemType, itemId).setScript(actualScript).request();
+                        UpdateRequest updateRequest = client.prepareUpdate(index, itemType, itemId).setScript(actualScript).
+                                setRefreshPolicy(WriteRequest.RefreshPolicy.WAIT_UNTIL).request();
                         bulkProcessor.add(updateRequest);
                     }
                     return true;
@@ -852,8 +911,8 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
                 IndicesExistsResponse indicesExistsResponse = client.admin().indices().prepareExists(indexName).execute().actionGet();
                 boolean indexExists = indicesExistsResponse.isExists();
                 if (!indexExists) {
-                    Map<String,String> indexMappings = new HashMap<String,String>();
-                    indexMappings.put("_default_",mappings.get("_default_"));
+                    Map<String, String> indexMappings = new HashMap<String, String>();
+                    indexMappings.put("_default_", mappings.get("_default_"));
                     for (Map.Entry<String, String> entry : mappings.entrySet()) {
                         if (indexNames.containsKey(entry.getKey()) && indexNames.get(entry.getKey()).equals(indexName)) {
                             indexMappings.put(entry.getKey(), entry.getValue());
@@ -880,7 +939,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
         }.catchingExecuteInClassLoader(true);
     }
 
-    private void internalCreateIndex(String indexName, Map<String,String> mappings) {
+    private void internalCreateIndex(String indexName, Map<String, String> mappings) {
         CreateIndexRequestBuilder builder = client.admin().indices().prepareCreate(indexName)
                 .setSettings("{\n" +
                         "    \"index\" : {\n" +
@@ -995,14 +1054,14 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
     }
 
     private String getPropertyNameWithData(String name, String itemType) {
-        Map<String,Object> propertyMapping = getPropertyMapping(name,itemType);
+        Map<String, Object> propertyMapping = getPropertyMapping(name, itemType);
         if (propertyMapping == null) {
             return null;
         }
         if (propertyMapping != null
                 && "text".equals(propertyMapping.get("type"))
                 && propertyMapping.containsKey("fields")
-                && ((Map)propertyMapping.get("fields")).containsKey("keyword")) {
+                && ((Map) propertyMapping.get("fields")).containsKey("keyword")) {
             name += ".keyword";
         }
         return name;
@@ -1107,12 +1166,12 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
 
     @Override
     public <T extends Item> PartialList<T> query(String fieldName, String fieldValue, String sortBy, Class<T> clazz, int offset, int size) {
-        return query(QueryBuilders.termQuery(fieldName, ConditionContextHelper.foldToASCII(fieldValue)), sortBy, clazz, offset, size, getRouting(fieldName, new String[]{fieldValue}, clazz), null);
+        return query(termQuery(fieldName, ConditionContextHelper.foldToASCII(fieldValue)), sortBy, clazz, offset, size, getRouting(fieldName, new String[]{fieldValue}, clazz), null);
     }
 
     @Override
     public <T extends Item> PartialList<T> queryFullText(String fieldName, String fieldValue, String fulltext, String sortBy, Class<T> clazz, int offset, int size) {
-        return query(QueryBuilders.boolQuery().must(QueryBuilders.queryStringQuery(fulltext).defaultField("_all")).must(QueryBuilders.termQuery(fieldName, fieldValue)), sortBy, clazz, offset, size, getRouting(fieldName, new String[]{fieldValue}, clazz), null);
+        return query(QueryBuilders.boolQuery().must(QueryBuilders.queryStringQuery(fulltext).defaultField("_all")).must(termQuery(fieldName, fieldValue)), sortBy, clazz, offset, size, getRouting(fieldName, new String[]{fieldValue}, clazz), null);
     }
 
     @Override
@@ -1207,7 +1266,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
                                     requestBuilder = requestBuilder.addSort(distanceSortBuilder.order(SortOrder.ASC));
                                 }
                             } else {
-                                String name = getPropertyNameWithData(StringUtils.substringBeforeLast(sortByElement,":"), itemType);
+                                String name = getPropertyNameWithData(StringUtils.substringBeforeLast(sortByElement, ":"), itemType);
                                 if (name != null) {
                                     if (sortByElement.endsWith(":desc")) {
                                         requestBuilder = requestBuilder.addSort(name, SortOrder.DESC);
@@ -1451,7 +1510,6 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
     }
 
 
-
     @Override
     public void refresh() {
         new InClassLoaderExecute<Boolean>() {
@@ -1514,7 +1572,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
         new InClassLoaderExecute<Void>() {
             @Override
             protected Void execute(Object... args) {
-                QueryBuilder query = QueryBuilders.termQuery("scope", scope);
+                QueryBuilder query = termQuery("scope", scope);
 
                 BulkRequestBuilder deleteByScope = client.prepareBulk();
 
@@ -1610,6 +1668,14 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
                 (itemsMonthlyIndexed.contains(itemType) ? indexName + "-*" : indexName);
     }
 
+    private String getConfig(Map<String, String> settings, String key,
+                             String defaultValue) {
+        if (settings != null && settings.get(key) != null) {
+            return settings.get(key);
+        }
+        return defaultValue;
+    }
+
     public abstract static class InClassLoaderExecute<T> {
 
         protected abstract T execute(Object... args) throws Exception;
@@ -1624,7 +1690,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
             }
         }
 
-        public T catchingExecuteInClassLoader( boolean logError, Object... args) {
+        public T catchingExecuteInClassLoader(boolean logError, Object... args) {
             try {
                 return executeInClassLoader(args);
             } catch (Exception e) {
@@ -1634,13 +1700,5 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
         }
     }
 
-    private String getConfig(Map<String,String> settings, String key,
-                             String defaultValue) {
-        if (settings != null && settings.get(key) != null) {
-            return settings.get(key);
-        }
-        return defaultValue;
-    }
-
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/2f687915/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg b/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
index 4e52a1c..12980e1 100644
--- a/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
+++ b/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
@@ -15,7 +15,7 @@
 # limitations under the License.
 #
 
-cluster.name=contextElasticSearch
+cluster.name=contextElasticSearch_amidani
 # The elasticSearchAddresses may be a comma seperated list of host names and ports such as
 # hostA:9300,hostB:9300
 # Note: the port number must be repeated for each host.
@@ -42,4 +42,4 @@ bulkProcessor.backoffPolicy=exponential
 # for each node in the ElasticSearch cluster:
 #   minimalElasticSearchVersion <= ElasticSearch node version < maximalElasticSearchVersion
 minimalElasticSearchVersion=5.0.0
-maximalElasticSearchVersion=5.2.0
\ No newline at end of file
+maximalElasticSearchVersion=5.3.0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/2f687915/persistence-elasticsearch/pom.xml
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/pom.xml b/persistence-elasticsearch/pom.xml
index 5d25fd5..70a85ea 100644
--- a/persistence-elasticsearch/pom.xml
+++ b/persistence-elasticsearch/pom.xml
@@ -32,7 +32,6 @@
 
     <modules>
         <module>core</module>
-        <module>plugins</module>
     </modules>
 
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/2f687915/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PersistenceService.java
----------------------------------------------------------------------
diff --git a/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PersistenceService.java b/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PersistenceService.java
index a6b175f..1397659 100644
--- a/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PersistenceService.java
+++ b/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PersistenceService.java
@@ -116,6 +116,18 @@ public interface PersistenceService {
     boolean updateWithScript(String itemId, Date dateHint, Class<?> clazz, String script, Map<String, Object> scriptParams);
 
     /**
+     * Updates the items of the specified class by a query with a new property value for the specified property name based on a provided script.
+     *
+     * @param dateHint      a Date helping in identifying where the item is located
+     * @param clazz         the Item subclass of the item to update
+     * @param scripts       inline scripts array
+     * @param scriptParams  script params array
+     * @param conditions    conditions array
+     * @return {@code true} if the update was successful, {@code false} otherwise
+     */
+    boolean updateWithQueryAndScript(Date dateHint, Class<?> clazz, String[] scripts, Map<String, Object>[] scriptParams, Condition[] conditions);
+
+    /**
      * Retrieves the item identified with the specified identifier and with the specified Item subclass if it exists.
      *
      * @param <T>    the type of the Item subclass we want to retrieve

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/2f687915/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java
index e83bad2..b1aa234 100644
--- a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java
+++ b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java
@@ -87,6 +87,9 @@ public class PropertyConditionESQueryBuilder implements ConditionESQueryBuilder
             case "contains":
                 checkRequiredValue(expectedValue, name, comparisonOperator, false);
                 return QueryBuilders.regexpQuery(name, ".*" + expectedValue + ".*");
+            case "notContains":
+                checkRequiredValue(expectedValue, name, comparisonOperator, false);
+                return QueryBuilders.boolQuery().mustNot(QueryBuilders.regexpQuery(name, ".*" + expectedValue + ".*"));
             case "startsWith":
                 checkRequiredValue(expectedValue, name, comparisonOperator, false);
                 return QueryBuilders.prefixQuery(name, expectedValue);

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/2f687915/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionEvaluator.java
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionEvaluator.java b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionEvaluator.java
index 1de3ae0..d7c2d2c 100644
--- a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionEvaluator.java
+++ b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionEvaluator.java
@@ -22,7 +22,6 @@ import ognl.Ognl;
 import ognl.OgnlContext;
 import ognl.OgnlException;
 import ognl.enhance.ExpressionAccessor;
-import org.apache.commons.beanutils.BeanUtilsBean;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.unomi.api.Event;
@@ -52,8 +51,6 @@ public class PropertyConditionEvaluator implements ConditionEvaluator {
 
     private static final SimpleDateFormat yearMonthDayDateFormat = new SimpleDateFormat("yyyyMMdd");
 
-    private BeanUtilsBean beanUtilsBean = BeanUtilsBean.getInstance();
-
     private Map<String, Map<String, ExpressionAccessor>> expressionCache = new HashMap<>(64);
 
     private int compare(Object actualValue, String expectedValue, Object expectedValueDate, Object expectedValueInteger, Object expectedValueDateExpr) {

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/2f687915/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 9a0872c..18bc4c1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -70,7 +70,7 @@
         <version.karaf>3.0.8</version.karaf>
         <version.karaf.cellar>3.0.3</version.karaf.cellar>
         <version.pax.exam>4.9.1</version.pax.exam>
-        <elasticsearch.version>5.1.1</elasticsearch.version>
+        <elasticsearch.version>5.2.2</elasticsearch.version>
 
         <maven.compiler.source>1.7</maven.compiler.source>
         <maven.compiler.target>1.7</maven.compiler.target>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/2f687915/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java
index 770936d..4367b4d 100644
--- a/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java
@@ -147,7 +147,7 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
     }
 
     private void cancelTimers() {
-        if(segmentTimer != null) {
+        if (segmentTimer != null) {
             segmentTimer.cancel();
         }
         logger.info("Segment purge: Purge unscheduled");
@@ -258,7 +258,7 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
     }
 
     private boolean checkSegmentDeletionImpact(Condition condition, String segmentToDeleteId) {
-        if(condition != null) {
+        if (condition != null) {
             @SuppressWarnings("unchecked")
             final List<Condition> subConditions = (List<Condition>) condition.getParameter("subConditions");
             if (subConditions != null) {
@@ -283,6 +283,7 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
      * Return an updated condition that do not contain a condition on the segmentId anymore
      * it's remove the unnecessary boolean condition (if a condition is the only one of a boolean the boolean will be remove and the subcondition returned)
      * it's return null when there is no more condition after (if the condition passed was only a segment condition on the segmentId)
+     *
      * @param condition the condition to update
      * @param segmentId the segment id to remove in the condition
      * @return updated condition
@@ -294,12 +295,12 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
             List<Condition> updatedSubConditions = new LinkedList<>();
             for (Condition subCondition : subConditions) {
                 Condition updatedCondition = updateSegmentDependentCondition(subCondition, segmentId);
-                if(updatedCondition != null) {
+                if (updatedCondition != null) {
                     updatedSubConditions.add(updatedCondition);
                 }
             }
-            if(!updatedSubConditions.isEmpty()){
-                if(updatedSubConditions.size() == 1) {
+            if (!updatedSubConditions.isEmpty()) {
+                if (updatedSubConditions.size() == 1) {
                     return updatedSubConditions.get(0);
                 } else {
                     condition.setParameter("subConditions", updatedSubConditions);
@@ -308,12 +309,12 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
             } else {
                 return null;
             }
-        } else if("profileSegmentCondition".equals(condition.getConditionTypeId())) {
+        } else if ("profileSegmentCondition".equals(condition.getConditionTypeId())) {
             @SuppressWarnings("unchecked")
             final List<String> referencedSegmentIds = (List<String>) condition.getParameter("segments");
             if (referencedSegmentIds.indexOf(segmentId) >= 0) {
                 referencedSegmentIds.remove(segmentId);
-                if(referencedSegmentIds.isEmpty()) {
+                if (referencedSegmentIds.isEmpty()) {
                     return null;
                 } else {
                     condition.setParameter("segments", referencedSegmentIds);
@@ -379,7 +380,7 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
             for (Segment segment : impactedSegments) {
                 Condition updatedCondition = updateSegmentDependentCondition(segment.getCondition(), segmentId);
                 segment.setCondition(updatedCondition);
-                if(updatedCondition == null) {
+                if (updatedCondition == null) {
                     clearAutoGeneratedRules(persistenceService.query("linkedItems", segment.getMetadata().getId(), null, Rule.class), segment.getMetadata().getId());
                     segment.getMetadata().setEnabled(false);
                 }
@@ -455,7 +456,7 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
 
     public SegmentsAndScores getSegmentsAndScoresForProfile(Profile profile) {
         Set<String> segments = new HashSet<String>();
-        Map<String,Integer> scores = new HashMap<String, Integer>();
+        Map<String, Integer> scores = new HashMap<String, Integer>();
 
         List<Segment> allSegments = this.allSegments;
         for (Segment segment : allSegments) {
@@ -542,18 +543,18 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
 
         persistenceService.createMapping(Profile.ITEM_TYPE, String.format(
                 "{\n" +
-                "    \"profile\": {\n" +
-                "        \"properties\" : {\n" +
-                "            \"scores\": {\n" +
-                "                \"properties\": {\n" +
-                "                    \"%s\": {\n" +
-                "                        \"type\": \"long\"\n" +
-                "                    }\n" +
-                "                }\n" +
-                "            }\n" +
-                "        }\n" +
-                "    }\n" +
-                "}\n", scoring.getItemId()));
+                        "    \"profile\": {\n" +
+                        "        \"properties\" : {\n" +
+                        "            \"scores\": {\n" +
+                        "                \"properties\": {\n" +
+                        "                    \"%s\": {\n" +
+                        "                        \"type\": \"long\"\n" +
+                        "                    }\n" +
+                        "                }\n" +
+                        "            }\n" +
+                        "        }\n" +
+                        "    }\n" +
+                        "}\n", scoring.getItemId()));
 
         updateExistingProfilesForScoring(scoring);
     }
@@ -571,7 +572,7 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
     }
 
     private boolean checkScoringDeletionImpact(Condition condition, String scoringToDeleteId) {
-        if(condition != null) {
+        if (condition != null) {
             @SuppressWarnings("unchecked")
             final List<Condition> subConditions = (List<Condition>) condition.getParameter("subConditions");
             if (subConditions != null) {
@@ -593,6 +594,7 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
      * Return an updated condition that do not contain a condition on the scoringId anymore
      * it's remove the unnecessary boolean condition (if a condition is the only one of a boolean the boolean will be remove and the subcondition returned)
      * it's return null when there is no more condition after (if the condition passed was only a scoring condition on the scoringId)
+     *
      * @param condition the condition to update
      * @param scoringId the scoring id to remove in the condition
      * @return updated condition
@@ -604,12 +606,12 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
             List<Condition> updatedSubConditions = new LinkedList<>();
             for (Condition subCondition : subConditions) {
                 Condition updatedCondition = updateScoringDependentCondition(subCondition, scoringId);
-                if(updatedCondition != null) {
+                if (updatedCondition != null) {
                     updatedSubConditions.add(updatedCondition);
                 }
             }
-            if(!updatedSubConditions.isEmpty()){
-                if(updatedSubConditions.size() == 1) {
+            if (!updatedSubConditions.isEmpty()) {
+                if (updatedSubConditions.size() == 1) {
                     return updatedSubConditions.get(0);
                 } else {
                     condition.setParameter("subConditions", updatedSubConditions);
@@ -671,7 +673,7 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
             for (Segment segment : impactedSegments) {
                 Condition updatedCondition = updateScoringDependentCondition(segment.getCondition(), scoringId);
                 segment.setCondition(updatedCondition);
-                if(updatedCondition == null) {
+                if (updatedCondition == null) {
                     clearAutoGeneratedRules(persistenceService.query("linkedItems", segment.getMetadata().getId(), null, Rule.class), segment.getMetadata().getId());
                     segment.getMetadata().setEnabled(false);
                 }
@@ -741,8 +743,8 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
         Set<String> tags = condition.getConditionType().getMetadata().getTags();
         if (tags.contains("eventCondition") && !tags.contains("profileCondition")) {
             try {
-                Map<String,Object> m = new HashMap<>(3);
-                m.put("scope",metadata.getScope());
+                Map<String, Object> m = new HashMap<>(3);
+                m.put("scope", metadata.getScope());
                 m.put("condition", condition);
                 m.put("numberOfDays", parentCondition.getParameter("numberOfDays"));
                 String key = CustomObjectMapper.getObjectMapper().writeValueAsString(m);
@@ -750,7 +752,7 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
                 parentCondition.setParameter("generatedPropertyKey", key);
                 Rule rule = rulesService.getRule(key);
                 if (rule == null) {
-                    rule = new Rule(new Metadata(metadata.getScope(), key, "Auto generated rule for "+metadata.getName(), ""));
+                    rule = new Rule(new Metadata(metadata.getScope(), key, "Auto generated rule for " + metadata.getName(), ""));
                     rule.setCondition(condition);
                     rule.getMetadata().setHidden(true);
                     final Action action = new Action();
@@ -809,10 +811,10 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
         for (Map.Entry<String, Long> entry : eventCountByProfile.entrySet()) {
             String profileId = entry.getKey();
             if (!profileId.startsWith("_")) {
-                Map<String,Long> pastEventCounts = new HashMap<>();
+                Map<String, Long> pastEventCounts = new HashMap<>();
                 pastEventCounts.put(propertyKey, entry.getValue());
-                Map<String,Object> systemProperties = new HashMap<>();
-                systemProperties.put("pastEvents",pastEventCounts);
+                Map<String, Object> systemProperties = new HashMap<>();
+                systemProperties.put("pastEvents", pastEventCounts);
                 try {
                     persistenceService.update(profileId, null, Profile.class, "systemProperties", systemProperties);
                 } catch (Exception e) {
@@ -821,7 +823,7 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
             }
         }
 
-        logger.info("Profiles past condition updated in {}ms", System.currentTimeMillis()-t);
+        logger.info("Profiles past condition updated in {}ms", System.currentTimeMillis() - t);
     }
 
     private void updateExistingProfilesForSegment(Segment segment) {
@@ -835,7 +837,7 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
         segmentCondition.setParameter("comparisonOperator", "equals");
         segmentCondition.setParameter("propertyValue", segment.getItemId());
 
-        if(segment.getMetadata().isEnabled()) {
+        if (segment.getMetadata().isEnabled()) {
 
             ConditionType booleanConditionType = definitionsService.getConditionType("booleanCondition");
             ConditionType notConditionType = definitionsService.getConditionType("notCondition");
@@ -904,7 +906,7 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
                 }
             }
         }
-        logger.info("{} profiles updated in {}ms", updatedProfileCount, System.currentTimeMillis()-t);
+        logger.info("{} profiles updated in {}ms", updatedProfileCount, System.currentTimeMillis() - t);
     }
 
     private void updateExistingProfilesForScoring(Scoring scoring) {
@@ -913,32 +915,31 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
         scoringCondition.setConditionType(definitionsService.getConditionType("profilePropertyCondition"));
         scoringCondition.setParameter("propertyName", "scores." + scoring.getItemId());
         scoringCondition.setParameter("comparisonOperator", "exists");
-        List<Profile> previousProfiles = persistenceService.query(scoringCondition, null, Profile.class);
 
-        HashMap<String, Object> scriptParams = new HashMap<>();
-        scriptParams.put("scoringId", scoring.getItemId());
+        String[] scripts = new String[scoring.getElements().size() + 1];
+        HashMap<String, Object>[] scriptParams = new HashMap[scoring.getElements().size() + 1];
+        Condition[] conditions = new Condition[scoring.getElements().size() + 1];
 
-        for (Profile profileToRemove : previousProfiles) {
-            persistenceService.updateWithScript(profileToRemove.getItemId(), null, Profile.class, "if (ctx._source.systemProperties.scoreModifiers == null) { ctx._source.systemProperties.scoreModifiers=[:] } ; if (ctx._source.systemProperties.scoreModifiers.containsKey(scoringId)) { ctx._source.scores[scoringId] = ctx._source.systemProperties.scoreModifiers[scoringId] } else { ctx._source.scores.remove(scoringId) }", scriptParams);
-        }
-        if(scoring.getMetadata().isEnabled()) {
-            String script = "if (ctx._source.scores == null) { ctx._source.scores=[:] } ; if (ctx._source.scores.containsKey(scoringId)) { ctx._source.scores[scoringId] += scoringValue } else { ctx._source.scores[scoringId] = scoringValue }";
-            Map<String, Event> updatedProfiles = new HashMap<>();
+        scriptParams[0] = new HashMap<String, Object>();
+        scriptParams[0].put("scoringId", scoring.getItemId());
+        scripts[0] = "if( ctx._source.containsKey(\"systemProperties\") && ctx._source.systemProperties.containsKey(\"scoreModifiers\") && ctx._source.systemProperties.scoreModifiers.containsKey(params.scoringId) ) { ctx._source.scores.put(params.scoringId, ctx._source.systemProperties.scoreModifiers.get(params.scoringId)) } else { ctx._source.scores.remove(params.scoringId) }";
+        conditions[0] = scoringCondition;
+
+        if (scoring.getMetadata().isEnabled()) {
+            String scriptToAdd = "if( !ctx._source.containsKey(\"scores\") ){ ctx._source.put(\"scores\", [:])} if( ctx._source.scores.containsKey(params.scoringId) ) { ctx._source.scores.put(params.scoringId, ctx._source.scores.get(params.scoringId)+params.scoringValue) } else { ctx._source.scores.put(params.scoringId, params.scoringValue) }";
+            int idx = 1;
             for (ScoringElement element : scoring.getElements()) {
-                scriptParams.put("scoringValue", element.getValue());
-                for (Profile p : persistenceService.query(element.getCondition(), null, Profile.class)) {
-                    persistenceService.updateWithScript(p.getItemId(), null, Profile.class, script, scriptParams);
-                    Event profileUpdated = new Event("profileUpdated", null, p, null, null, p, new Date());
-                    profileUpdated.setPersistent(false);
-                    updatedProfiles.put(p.getItemId(), profileUpdated);
-                }
-            }
-            Iterator<Map.Entry<String, Event>> entries = updatedProfiles.entrySet().iterator();
-            while (entries.hasNext()) {
-                eventService.send(entries.next().getValue());
+                scriptParams[idx] = new HashMap<>();
+                scriptParams[idx].put("scoringId", scoring.getItemId());
+                scriptParams[idx].put("scoringValue", element.getValue());
+                scripts[idx] = scriptToAdd;
+                conditions[idx] = element.getCondition();
+                idx++;
             }
         }
-        logger.info("Profiles updated in {}ms", System.currentTimeMillis()-t);
+
+        persistenceService.updateWithQueryAndScript(null, Profile.class, scripts, scriptParams, conditions);
+        logger.info("Profiles updated in {}ms", System.currentTimeMillis() - t);
     }
 
     private void updateExistingProfilesForRemovedScoring(String scoringId) {
@@ -955,7 +956,7 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
         for (Profile profileToRemove : previousProfiles) {
             persistenceService.updateWithScript(profileToRemove.getItemId(), null, Profile.class, "ctx._source.scores.remove(scoringId)", scriptParams);
         }
-        logger.info("Profiles updated in {}ms", System.currentTimeMillis()-t);
+        logger.info("Profiles updated in {}ms", System.currentTimeMillis() - t);
     }
 
     private String getMD5(String md5) {
@@ -976,7 +977,7 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
         switch (event.getType()) {
             case BundleEvent.STARTED:
                 processBundleStartup(event.getBundle().getBundleContext());
-               break;
+                break;
             case BundleEvent.STOPPING:
                 processBundleStop(event.getBundle().getBundleContext());
                 break;
@@ -1034,7 +1035,7 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
     }
 
     private <T extends MetadataItem> PartialList<Metadata> getMetadatas(Query query, Class<T> clazz) {
-        if(query.isForceRefresh()){
+        if (query.isForceRefresh()) {
             persistenceService.refresh();
         }
         definitionsService.resolveConditionType(query.getCondition());



[07/50] [abbrv] incubator-unomi git commit: Remove break row

Posted by sh...@apache.org.
Remove break row


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/4ff30d4c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/4ff30d4c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/4ff30d4c

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 4ff30d4c092e0b0aba7456afc4cb790c4cdeb9d5
Parents: 585d427
Author: Abdelkader Midani <am...@jahia.com>
Authored: Mon Mar 6 17:46:33 2017 +0100
Committer: Abdelkader Midani <am...@jahia.com>
Committed: Mon Mar 6 17:46:33 2017 +0100

----------------------------------------------------------------------
 README.md | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/4ff30d4c/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 4965e0f..e4778d1 100644
--- a/README.md
+++ b/README.md
@@ -27,6 +27,5 @@ The source code is available under the Apache License V2
 
 Documentation
 -------------
-
 You can find all the updated documentation, including building and deployment instructions, on the [Apache Unomi 
 web site](http://unomi.incubator.apache.org).


[41/50] [abbrv] incubator-unomi git commit: UNOMI-99 Improve network unavailable and connection timeout handling - Fix send mail action to work even if we don't specify a notification type, id and frequency

Posted by sh...@apache.org.
UNOMI-99 Improve network unavailable and connection timeout handling
- Fix send mail action to work even if we don't specify a notification type, id and frequency

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/b38d44c8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/b38d44c8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/b38d44c8

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: b38d44c8d22f91e0956a4e3ff8b373d09ec519f4
Parents: 15ba3c9
Author: Serge Huber <sh...@apache.org>
Authored: Fri Jun 16 14:56:19 2017 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Fri Jun 16 14:56:19 2017 +0200

----------------------------------------------------------------------
 .../apache/unomi/plugins/mail/actions/SendMailAction.java | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b38d44c8/plugins/mail/src/main/java/org/apache/unomi/plugins/mail/actions/SendMailAction.java
----------------------------------------------------------------------
diff --git a/plugins/mail/src/main/java/org/apache/unomi/plugins/mail/actions/SendMailAction.java b/plugins/mail/src/main/java/org/apache/unomi/plugins/mail/actions/SendMailAction.java
index fc8b85a..8810bbc 100644
--- a/plugins/mail/src/main/java/org/apache/unomi/plugins/mail/actions/SendMailAction.java
+++ b/plugins/mail/src/main/java/org/apache/unomi/plugins/mail/actions/SendMailAction.java
@@ -82,6 +82,16 @@ public class SendMailAction implements ActionExecutor {
         String subject = (String) action.getParameterValues().get("subject");
         String template = (String) action.getParameterValues().get("template");
 
+        if (notifType == null) {
+            notifType = "default";
+        }
+        if (notifTypeId == null) {
+            notifTypeId = subject;
+        }
+        if (notifyOnce == null) {
+            notifyOnce = false;
+        }
+
         Map profileNotif = (HashMap) event.getProfile().getSystemProperties().get("notificationAck");
         if (profileNotif != null && profileNotif.get(notifType) != null && ((HashMap) profileNotif.get(notifType)).get(notifTypeId) != null) {
             Integer notifTypeAck = (Integer) ((HashMap) profileNotif.get(notifType) ).get(notifTypeId);


[40/50] [abbrv] incubator-unomi git commit: UNOMI-99 Improve network unavailable and connection timeout handling - Try to improve error handling. - Avoid going to persistence API if requesting a condition type using a null id.

Posted by sh...@apache.org.
UNOMI-99 Improve network unavailable and connection timeout handling
- Try to improve error handling.
- Avoid going to persistence API if requesting a condition type using a null id.

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/15ba3c9e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/15ba3c9e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/15ba3c9e

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 15ba3c9e30126b66413e15c19e9a9e5e7e491110
Parents: 38489fe
Author: Serge Huber <sh...@apache.org>
Authored: Fri Jun 16 13:58:24 2017 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Fri Jun 16 13:58:24 2017 +0200

----------------------------------------------------------------------
 .../services/services/ClusterServiceImpl.java   | 26 +++++++++++---------
 .../services/DefinitionsServiceImpl.java        |  3 +++
 2 files changed, 17 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/15ba3c9e/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java
index da54208..095e2d4 100644
--- a/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java
@@ -260,6 +260,8 @@ public class ClusterServiceImpl implements ClusterService {
                 handleTimeouts(serviceUrl, ce);
             } catch (java.rmi.ConnectException ce) {
                 handleTimeouts(serviceUrl, ce);
+            } catch (java.rmi.ConnectIOException coie) {
+                handleTimeouts(serviceUrl, coie);
             } catch (IOException e) {
                 logger.error("Error retrieving remote JMX data", e);
             } catch (MalformedObjectNameException e) {
@@ -276,19 +278,19 @@ public class ClusterServiceImpl implements ClusterService {
     }
 
     private void handleTimeouts(String serviceUrl, Throwable throwable) {
-        if (throwable.getMessage() != null &&
-                (throwable.getMessage().contains("timed out") || throwable.getMessage().contains("Network is unreachable"))) {
-            logger.warn("RMI Connection timed out or network is unreachable, will reconnect on next request.");
-            JMXConnector jmxConnector = jmxConnectors.remove(serviceUrl);
-            try {
-                if (jmxConnector != null) {
-                    jmxConnector.close();
-                }
-            } catch (Throwable t) {
-                // ignore any exception when closing a timed out connection.
+        Throwable rootCause = throwable;
+        while (rootCause.getCause() != null) {
+            rootCause = rootCause.getCause();
+        }
+        logger.warn("JMX RMI Connection error, will reconnect on next request. Active debug logging for access to detailed stack trace. Root cause=" + rootCause.getMessage());
+        logger.debug("Detailed stacktrace", throwable);
+        JMXConnector jmxConnector = jmxConnectors.remove(serviceUrl);
+        try {
+            if (jmxConnector != null) {
+                jmxConnector.close();
             }
-        } else {
-            logger.error("Error retrieving remote JMX data", throwable);
+        } catch (Throwable t) {
+            // ignore any exception when closing a timed out connection.
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/15ba3c9e/services/src/main/java/org/apache/unomi/services/services/DefinitionsServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/DefinitionsServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/DefinitionsServiceImpl.java
index e839836..caaadf5 100644
--- a/services/src/main/java/org/apache/unomi/services/services/DefinitionsServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/services/DefinitionsServiceImpl.java
@@ -286,6 +286,9 @@ public class DefinitionsServiceImpl implements DefinitionsService, SynchronousBu
     }
 
     public ConditionType getConditionType(String id) {
+        if (id == null) {
+            return null;
+        }
         ConditionType type = conditionTypeById.get(id);
         if (type == null) {
             type = persistenceService.load(id, ConditionType.class);


[34/50] [abbrv] incubator-unomi git commit: UNOMI-101 : Update POM version

Posted by sh...@apache.org.
UNOMI-101 : Update POM version


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/c8a070f1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/c8a070f1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/c8a070f1

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: c8a070f17b5aaf64ecd28daaaca96a6cff13dcb0
Parents: 89d4c8e
Author: Abdelkader Midani <am...@apache.org>
Authored: Mon Jun 12 20:03:40 2017 +0200
Committer: Abdelkader Midani <am...@apache.org>
Committed: Mon Jun 12 20:11:37 2017 +0200

----------------------------------------------------------------------
 extensions/router/pom.xml                      |  2 +-
 extensions/router/router-api/pom.xml           |  2 +-
 extensions/router/router-core/pom.xml          |  2 +-
 extensions/router/router-karaf-feature/pom.xml |  2 +-
 extensions/router/router-rest/pom.xml          |  2 +-
 extensions/router/router-service/pom.xml       |  2 +-
 itests/pom.xml                                 |  2 +-
 package/pom.xml                                | 10 ++++++++++
 performance-tests/pom.xml                      |  2 +-
 persistence-elasticsearch/plugins/pom.xml      |  2 +-
 10 files changed, 19 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c8a070f1/extensions/router/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/router/pom.xml b/extensions/router/pom.xml
index c69320c..225f3d1 100644
--- a/extensions/router/pom.xml
+++ b/extensions/router/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-extensions</artifactId>
-        <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version>
+        <version>1.2.0-incubating-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-router</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c8a070f1/extensions/router/router-api/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/router/router-api/pom.xml b/extensions/router/router-api/pom.xml
index 06207b3..9085a30 100644
--- a/extensions/router/router-api/pom.xml
+++ b/extensions/router/router-api/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <artifactId>unomi-router</artifactId>
         <groupId>org.apache.unomi</groupId>
-        <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version>
+        <version>1.2.0-incubating-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c8a070f1/extensions/router/router-core/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/pom.xml b/extensions/router/router-core/pom.xml
index 53780e7..c6fbf5d 100644
--- a/extensions/router/router-core/pom.xml
+++ b/extensions/router/router-core/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <artifactId>unomi-router</artifactId>
         <groupId>org.apache.unomi</groupId>
-        <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version>
+        <version>1.2.0-incubating-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c8a070f1/extensions/router/router-karaf-feature/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/router/router-karaf-feature/pom.xml b/extensions/router/router-karaf-feature/pom.xml
index 8a8e62c..06c16da 100644
--- a/extensions/router/router-karaf-feature/pom.xml
+++ b/extensions/router/router-karaf-feature/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <artifactId>unomi-router</artifactId>
         <groupId>org.apache.unomi</groupId>
-        <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version>
+        <version>1.2.0-incubating-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c8a070f1/extensions/router/router-rest/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/router/router-rest/pom.xml b/extensions/router/router-rest/pom.xml
index e39e919..fc1065f 100644
--- a/extensions/router/router-rest/pom.xml
+++ b/extensions/router/router-rest/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <artifactId>unomi-router</artifactId>
         <groupId>org.apache.unomi</groupId>
-        <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version>
+        <version>1.2.0-incubating-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c8a070f1/extensions/router/router-service/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/router/router-service/pom.xml b/extensions/router/router-service/pom.xml
index 0aed70e..750cd1e 100644
--- a/extensions/router/router-service/pom.xml
+++ b/extensions/router/router-service/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <artifactId>unomi-router</artifactId>
         <groupId>org.apache.unomi</groupId>
-        <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version>
+        <version>1.2.0-incubating-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c8a070f1/itests/pom.xml
----------------------------------------------------------------------
diff --git a/itests/pom.xml b/itests/pom.xml
index 55fe567..036cb1d 100644
--- a/itests/pom.xml
+++ b/itests/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-root</artifactId>
-        <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version>
+        <version>1.2.0-incubating-SNAPSHOT</version>
     </parent>
     <artifactId>unomi-itests</artifactId>
     <name>Apache Unomi :: Integration Tests</name>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c8a070f1/package/pom.xml
----------------------------------------------------------------------
diff --git a/package/pom.xml b/package/pom.xml
index cff7721..da235b2 100644
--- a/package/pom.xml
+++ b/package/pom.xml
@@ -90,6 +90,15 @@
             <type>xml</type>
             <scope>runtime</scope>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+            <artifactId>unomi-router-karaf-feature</artifactId>
+            <version>1.2.0-incubating-SNAPSHOT</version>
+            <classifier>features</classifier>
+            <type>xml</type>
+            <scope>runtime</scope>
+        </dependency>
     </dependencies>
 
     <build>
@@ -329,6 +338,7 @@
                                 <feature>cxf</feature>
                                 <feature>cellar</feature>
                                 <feature>unomi-kar</feature>
+                                <feature>unomi-router-karaf-feature</feature>
                             </bootFeatures>
                         </configuration>
                     </plugin>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c8a070f1/performance-tests/pom.xml
----------------------------------------------------------------------
diff --git a/performance-tests/pom.xml b/performance-tests/pom.xml
index 44117fc..4429f3a 100644
--- a/performance-tests/pom.xml
+++ b/performance-tests/pom.xml
@@ -20,7 +20,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-root</artifactId>
-        <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version>
+        <version>1.2.0-incubating-SNAPSHOT</version>
     </parent>
     <artifactId>unomi-performance-tests</artifactId>
     <name>Apache Unomi :: Performance Tests</name>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c8a070f1/persistence-elasticsearch/plugins/pom.xml
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/plugins/pom.xml b/persistence-elasticsearch/plugins/pom.xml
index 57eec00..9114ece 100644
--- a/persistence-elasticsearch/plugins/pom.xml
+++ b/persistence-elasticsearch/plugins/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-persistence-elasticsearch</artifactId>
-        <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version>
+        <version>1.2.0-incubating-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-persistence-elasticsearch-plugins</artifactId>


[38/50] [abbrv] incubator-unomi git commit: Make ES Cluster Name configurable in Maven Setting

Posted by sh...@apache.org.
Make ES Cluster Name configurable in Maven Setting


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/b4fed6ad
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/b4fed6ad
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/b4fed6ad

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: b4fed6ad054d587898016ac8f0585963bdcfdc02
Parents: 8231d56
Author: Abdelkader Midani <am...@apache.org>
Authored: Thu Jun 15 13:41:43 2017 +0200
Committer: Abdelkader Midani <am...@apache.org>
Committed: Thu Jun 15 13:41:43 2017 +0200

----------------------------------------------------------------------
 persistence-elasticsearch/core/pom.xml          | 24 ++++++++++-
 ...g.apache.unomi.persistence.elasticsearch.cfg | 45 ++++++++++++++++++++
 ...g.apache.unomi.persistence.elasticsearch.cfg | 45 --------------------
 3 files changed, 68 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b4fed6ad/persistence-elasticsearch/core/pom.xml
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/pom.xml b/persistence-elasticsearch/core/pom.xml
index eb169ef..a98cde6 100644
--- a/persistence-elasticsearch/core/pom.xml
+++ b/persistence-elasticsearch/core/pom.xml
@@ -146,6 +146,12 @@
     </dependencies>
 
     <build>
+        <resources>
+            <resource>
+                <directory>src/main/resources-filtered</directory>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
         <plugins>
             <plugin>
                 <groupId>org.apache.felix</groupId>
@@ -241,7 +247,7 @@
                             <artifacts>
                                 <artifact>
                                     <file>
-                                        src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
+                                        ${project.build.outputDirectory}/org.apache.unomi.persistence.elasticsearch.cfg
                                     </file>
                                     <type>cfg</type>
                                     <classifier>elasticsearchcfg</classifier>
@@ -255,4 +261,20 @@
 
     </build>
 
+    <profiles>
+        <profile>
+            <id>esClusterName</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+                <property>
+                    <name>!esClusterName</name>
+                </property>
+            </activation>
+
+            <properties>
+                <esClusterName>contextElasticSearch</esClusterName>
+            </properties>
+        </profile>
+    </profiles>
+
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b4fed6ad/persistence-elasticsearch/core/src/main/resources-filtered/org.apache.unomi.persistence.elasticsearch.cfg
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources-filtered/org.apache.unomi.persistence.elasticsearch.cfg b/persistence-elasticsearch/core/src/main/resources-filtered/org.apache.unomi.persistence.elasticsearch.cfg
new file mode 100644
index 0000000..28bf705
--- /dev/null
+++ b/persistence-elasticsearch/core/src/main/resources-filtered/org.apache.unomi.persistence.elasticsearch.cfg
@@ -0,0 +1,45 @@
+#
+# 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.
+#
+
+cluster.name=${esClusterName}
+# The elasticSearchAddresses may be a comma seperated list of host names and ports such as
+# hostA:9300,hostB:9300
+# Note: the port number must be repeated for each host.
+elasticSearchAddresses=localhost:9300
+index.name=context
+monthlyIndex.numberOfShards=3
+monthlyIndex.numberOfReplicas=0
+numberOfShards=5
+numberOfReplicas=0
+defaultQueryLimit=10
+
+# The following settings control the behavior of the BulkProcessor API. You can find more information about these
+# settings and their behavior here : https://www.elastic.co/guide/en/elasticsearch/client/java-api/2.4/java-docs-bulk-processor.html
+# The values used here are the default values of the API
+bulkProcessor.name=unomi-bulk
+bulkProcessor.concurrentRequests=1
+bulkProcessor.bulkActions=1000
+bulkProcessor.bulkSize=5MB
+bulkProcessor.flushInterval=5s
+bulkProcessor.backoffPolicy=exponential
+
+# The following settings are used to perform version checks on the connected ElasticSearch cluster, to make sure that
+# appropriate versions are used. The check is performed like this :
+# for each node in the ElasticSearch cluster:
+#   minimalElasticSearchVersion <= ElasticSearch node version < maximalElasticSearchVersion
+minimalElasticSearchVersion=5.0.0
+maximalElasticSearchVersion=5.3.0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b4fed6ad/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg b/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
deleted file mode 100644
index 77eb091..0000000
--- a/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
+++ /dev/null
@@ -1,45 +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.
-#
-
-cluster.name=contextElasticSearch
-# The elasticSearchAddresses may be a comma seperated list of host names and ports such as
-# hostA:9300,hostB:9300
-# Note: the port number must be repeated for each host.
-elasticSearchAddresses=localhost:9300
-index.name=context
-monthlyIndex.numberOfShards=3
-monthlyIndex.numberOfReplicas=0
-numberOfShards=5
-numberOfReplicas=0
-defaultQueryLimit=10
-
-# The following settings control the behavior of the BulkProcessor API. You can find more information about these
-# settings and their behavior here : https://www.elastic.co/guide/en/elasticsearch/client/java-api/2.4/java-docs-bulk-processor.html
-# The values used here are the default values of the API
-bulkProcessor.name=unomi-bulk
-bulkProcessor.concurrentRequests=1
-bulkProcessor.bulkActions=1000
-bulkProcessor.bulkSize=5MB
-bulkProcessor.flushInterval=5s
-bulkProcessor.backoffPolicy=exponential
-
-# The following settings are used to perform version checks on the connected ElasticSearch cluster, to make sure that
-# appropriate versions are used. The check is performed like this :
-# for each node in the ElasticSearch cluster:
-#   minimalElasticSearchVersion <= ElasticSearch node version < maximalElasticSearchVersion
-minimalElasticSearchVersion=5.0.0
-maximalElasticSearchVersion=5.3.0
\ No newline at end of file


[08/50] [abbrv] incubator-unomi git commit: UNOMI-86 : Implement overrides for scores and put segments, scores and profileproperties in the same object (Profile object)

Posted by sh...@apache.org.
UNOMI-86 : Implement overrides for scores and put segments,scores and profileproperties in the same object (Profile object)


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/a8e52038
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/a8e52038
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/a8e52038

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: a8e5203820f8b38283f1f03ce6ef882d6a1d1dd8
Parents: 4ff30d4
Author: rizak <ri...@gmail.com>
Authored: Thu Mar 16 10:09:11 2017 +0100
Committer: rizak <ri...@gmail.com>
Committed: Thu Mar 16 10:09:11 2017 +0100

----------------------------------------------------------------------
 .../org/apache/unomi/api/ContextRequest.java    | 38 +++++---------------
 .../markdown/versions/1.1/getting-started.md    |  8 +++--
 .../markdown/versions/master/getting-started.md |  8 +++--
 .../org/apache/unomi/web/ContextServlet.java    | 32 +++++++++++------
 4 files changed, 41 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/a8e52038/api/src/main/java/org/apache/unomi/api/ContextRequest.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/ContextRequest.java b/api/src/main/java/org/apache/unomi/api/ContextRequest.java
index 5e2c115..1803bf6 100644
--- a/api/src/main/java/org/apache/unomi/api/ContextRequest.java
+++ b/api/src/main/java/org/apache/unomi/api/ContextRequest.java
@@ -60,9 +60,7 @@ public class ContextRequest {
     // the following overrides make it possible to override temporarily the current profile segments, properties or
     // even session properties. This is useful for building UIs to temporarily override one of these parameters to
     // test different filter results.
-
-    private Set<String> segmentOverrides;
-    private Map<String, Object> profilePropertiesOverrides;
+    private Profile profileOverrides;
     private Map<String, Object> sessionPropertiesOverrides;
 
     /**
@@ -182,39 +180,21 @@ public class ContextRequest {
     }
 
     /**
-     * Retrieves the segment overrides.
-     *
-     * @return the segment overrides
-     */
-    public Set<String> getSegmentOverrides() {
-        return segmentOverrides;
-    }
-
-    /**
-     * Sets the segment overrides.
-     *
-     * @param segmentOverrides the segment overrides
-     */
-    public void setSegmentOverrides(Set<String> segmentOverrides) {
-        this.segmentOverrides = segmentOverrides;
-    }
-
-    /**
-     * Retrieves the profile properties overrides.
+     * Retrieves the overrides.
      *
-     * @return the profile properties overrides
+     * @return the overrides
      */
-    public Map<String, Object> getProfilePropertiesOverrides() {
-        return profilePropertiesOverrides;
+    public Profile getProfileOverrides() {
+        return profileOverrides;
     }
 
     /**
-     * Sets the profile properties overrides.
+     * Sets the overrides.
      *
-     * @param profilePropertiesOverrides the profile properties overrides
+     * @param overrides the collection<String> overrides out of profileProperties and sessionProperties
      */
-    public void setProfilePropertiesOverrides(Map<String, Object> profilePropertiesOverrides) {
-        this.profilePropertiesOverrides = profilePropertiesOverrides;
+    public void setProfileOverrides(Profile overrides) {
+        this.profileOverrides = overrides;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/a8e52038/src/site/markdown/versions/1.1/getting-started.md
----------------------------------------------------------------------
diff --git a/src/site/markdown/versions/1.1/getting-started.md b/src/site/markdown/versions/1.1/getting-started.md
index f052649..80d3b95 100644
--- a/src/site/markdown/versions/1.1/getting-started.md
+++ b/src/site/markdown/versions/1.1/getting-started.md
@@ -198,8 +198,10 @@ Let's look at the context request structure:
     requiredProfileProperties: <optional array of property identifiers>,
     requiredSessionProperties: <optional array of property identifiers>,
     filters: <optional array of filters to evaluate>,
-    segmentOverrides: <optional array of segment identifiers>,
-    profilePropertiesOverrides: <optional map of property name / value pairs>,
+    profileOverrides: <optional profile containing segments,scores or profile properties to override>,
+        - segments: <optional array of segment identifiers>,
+        - profileProperties: <optional map of property name / value pairs>,
+        - scores: <optional map of score id / value pairs>
     sessionPropertiesOverrides: <optional map of property name / value pairs>,
     requiresSegments: <boolean, whether to return the associated segments>
 }
@@ -214,7 +216,7 @@ A context request payload needs to at least specify some information about the s
 A client wishing to perform content personalization might also specify filtering conditions to be evaluated by the context server so that it can tell the client whether the content associated with the filter should be activated for this profile/session. This is accomplished by providing a list of filter definitions to be evaluated by the context server via the `filters` field of the payload. If provided, the evaluation results will be provided in the `filteringResults` field of the resulting `cxs` object the context server will send.
 
 #### Overrides
-It is also possible for clients wishing to perform user impersonation to specify properties or segments to override the proper ones so as to emulate a specific profile, in which case the overridden value will temporarily replace the proper values so that all rules will be evaluated with these values instead of the proper ones. The `segmentOverrides` (array of segment identifiers), `profilePropertiesOverrides` and `sessionPropertiesOverrides` (maps of property name and associated object value) fields allow to provide such information. Providing such overrides will, of course, impact content filtering results and segments matching for this specific request.
+It is also possible for clients wishing to perform user impersonation to specify properties, segments or scores to override the proper ones so as to emulate a specific profile, in which case the overridden value will temporarily replace the proper values so that all rules will be evaluated with these values instead of the proper ones. The `segments` (array of segment identifiers), `profileProperties` (maps of property name and associated object value) and `scores` (maps of score id and value) all wrapped in a profileOverrides object and the `sessionPropertiesOverrides` (maps of property name and associated object value) fields allow to provide such information. Providing such overrides will, of course, impact content filtering results and segments matching for this specific request.
 
 #### Controlling the content of the response
 The clients can also specify which information to include in the response by setting the `requiresSegments` property to true if segments the current profile matches should be returned or provide an array of property identifiers for `requiredProfileProperties` or `requiredSessionProperties` fields to ask the context server to return the values for the specified profile or session properties, respectively. This information is provided by the `profileProperties`, `sessionProperties` and `profileSegments` fields of the context server response.

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/a8e52038/src/site/markdown/versions/master/getting-started.md
----------------------------------------------------------------------
diff --git a/src/site/markdown/versions/master/getting-started.md b/src/site/markdown/versions/master/getting-started.md
index f052649..2885965 100644
--- a/src/site/markdown/versions/master/getting-started.md
+++ b/src/site/markdown/versions/master/getting-started.md
@@ -198,8 +198,10 @@ Let's look at the context request structure:
     requiredProfileProperties: <optional array of property identifiers>,
     requiredSessionProperties: <optional array of property identifiers>,
     filters: <optional array of filters to evaluate>,
-    segmentOverrides: <optional array of segment identifiers>,
-    profilePropertiesOverrides: <optional map of property name / value pairs>,
+    profileOverrides: <optional profile containing segments,scores or profile properties to override>,
+            - segments: <optional array of segment identifiers>,
+            - profileProperties: <optional map of property name / value pairs>,
+            - scores: <optional map of score id / value pairs>
     sessionPropertiesOverrides: <optional map of property name / value pairs>,
     requiresSegments: <boolean, whether to return the associated segments>
 }
@@ -214,7 +216,7 @@ A context request payload needs to at least specify some information about the s
 A client wishing to perform content personalization might also specify filtering conditions to be evaluated by the context server so that it can tell the client whether the content associated with the filter should be activated for this profile/session. This is accomplished by providing a list of filter definitions to be evaluated by the context server via the `filters` field of the payload. If provided, the evaluation results will be provided in the `filteringResults` field of the resulting `cxs` object the context server will send.
 
 #### Overrides
-It is also possible for clients wishing to perform user impersonation to specify properties or segments to override the proper ones so as to emulate a specific profile, in which case the overridden value will temporarily replace the proper values so that all rules will be evaluated with these values instead of the proper ones. The `segmentOverrides` (array of segment identifiers), `profilePropertiesOverrides` and `sessionPropertiesOverrides` (maps of property name and associated object value) fields allow to provide such information. Providing such overrides will, of course, impact content filtering results and segments matching for this specific request.
+It is also possible for clients wishing to perform user impersonation to specify properties or segments to override the proper ones so as to emulate a specific profile, in which case the overridden value will temporarily replace the proper values so that all rules will be evaluated with these values instead of the proper ones. The `segments` (array of segment identifiers), `profileProperties` (maps of property name and associated object value) and `scores` (maps of score id and value) all wrapped in a profileOverrides object and the `sessionPropertiesOverrides` (maps of property name and associated object value) fields allow to provide such information. Providing such overrides will, of course, impact content filtering results and segments matching for this specific request.
 
 #### Controlling the content of the response
 The clients can also specify which information to include in the response by setting the `requiresSegments` property to true if segments the current profile matches should be returned or provide an array of property identifiers for `requiredProfileProperties` or `requiredSessionProperties` fields to ask the context server to return the values for the specified profile or session properties, respectively. This information is provided by the `profileProperties`, `sessionProperties` and `profileSegments` fields of the context server response.

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/a8e52038/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 c1c096c..d3cd840 100644
--- a/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
+++ b/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
@@ -372,18 +372,30 @@ public class ContextServlet extends HttpServlet {
         return changes;
     }
 
+    /**
+     * This function will update the profile if it is from Persona instance.
+     * The profile will be updated using the overrides attributes :
+     * - profileOverrides for profile properties, segments and scores
+     * - sessionPropertiesOverrides for session properties
+     * @param contextRequest
+     * @param profile
+     * @param session
+     */
     private void processOverrides(ContextRequest contextRequest, Profile profile, Session session) {
         if (profile instanceof Persona) {
-            if (contextRequest.getSegmentOverrides() != null) {
-                profile.setSegments(contextRequest.getSegmentOverrides());
-            }
-
-            if (contextRequest.getProfilePropertiesOverrides() != null) {
-                profile.setProperties(contextRequest.getProfilePropertiesOverrides());
-            }
-
-            if (contextRequest.getSessionPropertiesOverrides() != null) {
-                session.setProperties(contextRequest.getSessionPropertiesOverrides()); // we do this just in case a cache is behind this
+            if (contextRequest.getProfileOverrides() != null) {
+                if(contextRequest.getProfileOverrides().getScores()!=null){
+                    profile.setScores(contextRequest.getProfileOverrides().getScores());
+                }
+                if(contextRequest.getProfileOverrides().getSegments()!=null){
+                    profile.setSegments(contextRequest.getProfileOverrides().getSegments());
+                }
+                if(contextRequest.getProfileOverrides().getProperties()!=null){
+                    profile.setProperties(contextRequest.getProfileOverrides().getProperties());
+                }
+                if(contextRequest.getSessionPropertiesOverrides()!=null){
+                    session.setProperties(contextRequest.getSessionPropertiesOverrides());
+                }
             }
         }
     }


[37/50] [abbrv] incubator-unomi git commit: UNOMI-101 : No broker config allowed

Posted by sh...@apache.org.
UNOMI-101 : No broker config allowed


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/8231d564
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/8231d564
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/8231d564

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 8231d5640d45f1f9ee8b20a8b239c54a4205ab7c
Parents: f597a69
Author: Abdelkader Midani <am...@apache.org>
Authored: Wed Jun 14 12:12:20 2017 +0200
Committer: Abdelkader Midani <am...@apache.org>
Committed: Wed Jun 14 12:12:33 2017 +0200

----------------------------------------------------------------------
 .../unomi/router/core/RouterConstants.java      |  35 ++++++
 .../core/context/ProfileImportCamelContext.java |  17 ++-
 .../BadProfileDataFormatException.java          |  35 ++++++
 .../ImportConfigByFileNameProcessor.java        |   3 +-
 .../core/processor/LineSplitFailureHandler.java |  34 ++++++
 .../core/processor/LineSplitProcessor.java      |  31 +++--
 .../ProfileImportAbstractRouteBuilder.java      |  83 +++++++++++++
 .../ProfileImportFromSourceRouteBuilder.java    | 102 ++++++++++++++++
 .../ProfileImportKafkaToUnomiRouteBuilder.java  |  77 ------------
 .../route/ProfileImportOneShotRouteBuilder.java |  42 +++----
 .../ProfileImportSourceToKafkaRouteBuilder.java | 120 -------------------
 .../route/ProfileImportToUnomiRouteBuilder.java |  70 +++++++++++
 .../resources/OSGI-INF/blueprint/blueprint.xml  |   6 +
 .../main/resources/org.apache.unomi.router.cfg  |  15 ++-
 14 files changed, 422 insertions(+), 248 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/8231d564/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/RouterConstants.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/RouterConstants.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/RouterConstants.java
new file mode 100644
index 0000000..f09e993
--- /dev/null
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/RouterConstants.java
@@ -0,0 +1,35 @@
+/*
+ * 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.unomi.router.core;
+
+/**
+ * Created by amidani on 13/06/2017.
+ */
+public interface RouterConstants {
+
+    String CONFIG_TYPE_NOBROKER = "nobroker";
+    String CONFIG_TYPE_KAFKA = "kafka";
+
+    String DIRECT_DEPOSIT_BUFFER = "direct:depositBuffer";
+
+    String HEADER_IMPORT_CONFIG_ONESHOT = "importConfigOneShot";
+    String HEADER_CONFIG_TYPE = "configType";
+    String HEADER_PROFILES_COUNT = "profilesCount";
+
+    String DIRECTION_FROM = "from";
+    String DIRECTION_TO = "to";
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/8231d564/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java
index df734d3..9a4a004 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java
@@ -24,9 +24,9 @@ import org.apache.unomi.router.api.ImportConfiguration;
 import org.apache.unomi.router.api.services.ImportConfigurationService;
 import org.apache.unomi.router.core.processor.ImportConfigByFileNameProcessor;
 import org.apache.unomi.router.core.processor.UnomiStorageProcessor;
-import org.apache.unomi.router.core.route.ProfileImportKafkaToUnomiRouteBuilder;
+import org.apache.unomi.router.core.route.ProfileImportToUnomiRouteBuilder;
 import org.apache.unomi.router.core.route.ProfileImportOneShotRouteBuilder;
-import org.apache.unomi.router.core.route.ProfileImportSourceToKafkaRouteBuilder;
+import org.apache.unomi.router.core.route.ProfileImportFromSourceRouteBuilder;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
@@ -53,6 +53,7 @@ public class ProfileImportCamelContext implements SynchronousBundleListener {
     private JacksonDataFormat jacksonDataFormat;
     private String uploadDir;
     private Map<String, String> kafkaProps;
+    private String configType;
 
     private final String IMPORT_CONFIG_TYPE_RECURRENT = "recurrent";
 
@@ -66,14 +67,14 @@ public class ProfileImportCamelContext implements SynchronousBundleListener {
         logger.info("Initialize Camel Context...");
         camelContext = new DefaultCamelContext();
         List<ImportConfiguration> importConfigurationList = importConfigurationService.getImportConfigurations();
-        ProfileImportSourceToKafkaRouteBuilder builderReader = new ProfileImportSourceToKafkaRouteBuilder(kafkaProps);
+        ProfileImportFromSourceRouteBuilder builderReader = new ProfileImportFromSourceRouteBuilder(kafkaProps, configType);
         builderReader.setImportConfigurationList(importConfigurationList);
         builderReader.setJacksonDataFormat(jacksonDataFormat);
         builderReader.setContext(camelContext);
         camelContext.addRoutes(builderReader);
 
         //One shot import route
-        ProfileImportOneShotRouteBuilder builderOneShot = new ProfileImportOneShotRouteBuilder(kafkaProps);
+        ProfileImportOneShotRouteBuilder builderOneShot = new ProfileImportOneShotRouteBuilder(kafkaProps, configType);
         builderOneShot.setImportConfigByFileNameProcessor(importConfigByFileNameProcessor);
         builderOneShot.setJacksonDataFormat(jacksonDataFormat);
         builderOneShot.setUploadDir(uploadDir);
@@ -81,7 +82,7 @@ public class ProfileImportCamelContext implements SynchronousBundleListener {
         camelContext.addRoutes(builderOneShot);
 
 
-        ProfileImportKafkaToUnomiRouteBuilder builderProcessor = new ProfileImportKafkaToUnomiRouteBuilder(kafkaProps);
+        ProfileImportToUnomiRouteBuilder builderProcessor = new ProfileImportToUnomiRouteBuilder(kafkaProps, configType);
         builderProcessor.setUnomiStorageProcessor(unomiStorageProcessor);
         builderProcessor.setJacksonDataFormat(jacksonDataFormat);
         builderProcessor.setContext(camelContext);
@@ -113,7 +114,7 @@ public class ProfileImportCamelContext implements SynchronousBundleListener {
         }
         //Handle transforming an import config oneshot <--> recurrent
         if(IMPORT_CONFIG_TYPE_RECURRENT.equals(importConfiguration.getConfigType())){
-            ProfileImportSourceToKafkaRouteBuilder builder = new ProfileImportSourceToKafkaRouteBuilder(kafkaProps);
+            ProfileImportFromSourceRouteBuilder builder = new ProfileImportFromSourceRouteBuilder(kafkaProps, configType);
             builder.setImportConfigurationList(Arrays.asList(importConfiguration));
             builder.setJacksonDataFormat(jacksonDataFormat);
             builder.setContext(camelContext);
@@ -149,6 +150,10 @@ public class ProfileImportCamelContext implements SynchronousBundleListener {
         this.kafkaProps = kafkaProps;
     }
 
+    public void setConfigType(String configType) {
+        this.configType = configType;
+    }
+
     public void preDestroy() throws Exception {
         bundleContext.removeBundleListener(this);
         //This is to shutdown Camel context

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/8231d564/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/exception/BadProfileDataFormatException.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/exception/BadProfileDataFormatException.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/exception/BadProfileDataFormatException.java
new file mode 100644
index 0000000..6c947ff
--- /dev/null
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/exception/BadProfileDataFormatException.java
@@ -0,0 +1,35 @@
+/*
+ * 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.unomi.router.core.exception;
+
+/**
+ * Created by amidani on 13/06/2017.
+ */
+public class BadProfileDataFormatException extends Exception{
+
+    public BadProfileDataFormatException() {
+        super();
+    }
+
+    public BadProfileDataFormatException(String message) {
+        super(message);
+    }
+
+    public BadProfileDataFormatException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/8231d564/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ImportConfigByFileNameProcessor.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ImportConfigByFileNameProcessor.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ImportConfigByFileNameProcessor.java
index 7fc7730..c2968cd 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ImportConfigByFileNameProcessor.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ImportConfigByFileNameProcessor.java
@@ -21,6 +21,7 @@ import org.apache.camel.Processor;
 import org.apache.camel.component.file.GenericFile;
 import org.apache.unomi.router.api.ImportConfiguration;
 import org.apache.unomi.router.api.services.ImportConfigurationService;
+import org.apache.unomi.router.core.RouterConstants;
 
 /**
  * Created by amidani on 22/05/2017.
@@ -35,7 +36,7 @@ public class ImportConfigByFileNameProcessor implements Processor{
         String fileName = exchange.getIn().getBody(GenericFile.class).getFileName();
         String importConfigId = fileName.substring(0, fileName.indexOf('.'));
         ImportConfiguration importConfiguration = importConfigurationService.load(importConfigId);
-        exchange.getIn().setHeader("importConfigOneShot", importConfiguration);
+        exchange.getIn().setHeader(RouterConstants.HEADER_IMPORT_CONFIG_ONESHOT, importConfiguration);
     }
 
     public void setImportConfigurationService(ImportConfigurationService importConfigurationService) {

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/8231d564/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitFailureHandler.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitFailureHandler.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitFailureHandler.java
new file mode 100644
index 0000000..b1de82a
--- /dev/null
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitFailureHandler.java
@@ -0,0 +1,34 @@
+/*
+ * 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.unomi.router.core.processor;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Created by amidani on 14/06/2017.
+ */
+public class LineSplitFailureHandler implements Processor {
+
+    private static final Logger logger = LoggerFactory.getLogger(LineSplitFailureHandler.class.getName());
+
+    public void process(Exchange exchange) throws Exception {
+        logger.error("{}", exchange.getProperty(Exchange.EXCEPTION_CAUGHT));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/8231d564/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitProcessor.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitProcessor.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitProcessor.java
index 150ef6d..da14aa5 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitProcessor.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitProcessor.java
@@ -22,11 +22,10 @@ import org.apache.camel.component.kafka.KafkaConstants;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.unomi.router.api.ImportConfiguration;
 import org.apache.unomi.router.api.ProfileToImport;
+import org.apache.unomi.router.core.RouterConstants;
+import org.apache.unomi.router.core.exception.BadProfileDataFormatException;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
+import java.util.*;
 
 /**
  * Created by amidani on 29/12/2016.
@@ -42,7 +41,8 @@ public class LineSplitProcessor implements Processor {
     @Override
     public void process(Exchange exchange) throws Exception {
         //In case of one shot import we check the header and overwrite import config
-        ImportConfiguration importConfigOneShot = (ImportConfiguration) exchange.getIn().getHeader("importConfigOneShot");
+        ImportConfiguration importConfigOneShot = (ImportConfiguration) exchange.getIn().getHeader(RouterConstants.HEADER_IMPORT_CONFIG_ONESHOT);
+        String configType = (String) exchange.getIn().getHeader(RouterConstants.HEADER_CONFIG_TYPE);
         if(importConfigOneShot!=null) {
             fieldsMapping = (Map<String, Integer>)importConfigOneShot.getProperties().get("mapping");
             propertiesToOverwrite = importConfigOneShot.getPropertiesToOverwrite();
@@ -50,15 +50,18 @@ public class LineSplitProcessor implements Processor {
             overwriteExistingProfiles = importConfigOneShot.isOverwriteExistingProfiles();
             columnSeparator = importConfigOneShot.getColumnSeparator();
         }
-        String[] profileData = ((String)exchange.getIn().getBody()).split(columnSeparator);
+        String[] profileData = ((String)exchange.getIn().getBody()).split(columnSeparator, -1);
         ProfileToImport profileToImport = new ProfileToImport();
         profileToImport.setItemId(UUID.randomUUID().toString());
         profileToImport.setItemType("profile");
         profileToImport.setScope("system");
-        if(profileData.length > 0) {
+        if(profileData.length > 0 && StringUtils.isNotBlank(profileData[0])) {
+            if(fieldsMapping.size() != (profileData.length - 1)) {
+                throw new BadProfileDataFormatException("The index does not match the number of column : line ["+((Integer)exchange.getProperty("CamelSplitIndex")+1)+"]", new Throwable("MAPPING_COLUMN_MATCH"));
+            }
             Map<String, Object> properties = new HashMap<>();
-            for(String fieldMappingKey : fieldsMapping.keySet()) {
-                if(profileData.length > fieldsMapping.get(fieldMappingKey)) {
+            for (String fieldMappingKey : fieldsMapping.keySet()) {
+                if (profileData.length > fieldsMapping.get(fieldMappingKey)) {
                     properties.put(fieldMappingKey, profileData[fieldsMapping.get(fieldMappingKey)].trim());
                 }
             }
@@ -66,13 +69,17 @@ public class LineSplitProcessor implements Processor {
             profileToImport.setMergingProperty(mergingProperty);
             profileToImport.setPropertiesToOverwrite(propertiesToOverwrite);
             profileToImport.setOverwriteExistingProfiles(overwriteExistingProfiles);
-            if(StringUtils.isNotBlank(profileData[profileData.length - 1]) && Boolean.parseBoolean(profileData[profileData.length - 1].trim())) {
+            if (StringUtils.isNotBlank(profileData[profileData.length - 1]) && Boolean.parseBoolean(profileData[profileData.length - 1].trim())) {
                 profileToImport.setProfileToDelete(true);
             }
+        } else {
+            throw new BadProfileDataFormatException("Empty line : line ["+((Integer)exchange.getProperty("CamelSplitIndex")+1)+"]", new Throwable("EMPTY_LINE"));
         }
         exchange.getIn().setBody(profileToImport, ProfileToImport.class);
-        exchange.getIn().setHeader(KafkaConstants.PARTITION_KEY, 0);
-        exchange.getIn().setHeader(KafkaConstants.KEY, "1");
+        if(RouterConstants.CONFIG_TYPE_KAFKA.equals(configType)) {
+            exchange.getIn().setHeader(KafkaConstants.PARTITION_KEY, 0);
+            exchange.getIn().setHeader(KafkaConstants.KEY, "1");
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/8231d564/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportAbstractRouteBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportAbstractRouteBuilder.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportAbstractRouteBuilder.java
new file mode 100644
index 0000000..ca28baf
--- /dev/null
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportAbstractRouteBuilder.java
@@ -0,0 +1,83 @@
+/*
+ * 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.unomi.router.core.route;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jackson.JacksonDataFormat;
+import org.apache.camel.component.kafka.KafkaComponent;
+import org.apache.camel.component.kafka.KafkaConfiguration;
+import org.apache.camel.component.kafka.KafkaEndpoint;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.unomi.router.core.RouterConstants;
+
+import java.util.Map;
+
+/**
+ * Created by amidani on 13/06/2017.
+ */
+public abstract class ProfileImportAbstractRouteBuilder extends RouteBuilder {
+
+    protected JacksonDataFormat jacksonDataFormat;
+
+    protected String kafkaHost;
+    protected String kafkaPort;
+    protected String kafkaImportTopic;
+    protected String kafkaImportGroupId;
+    protected String kafkaImportConsumerCount;
+    protected String kafkaImportAutoCommit;
+
+    protected String configType;
+
+    public ProfileImportAbstractRouteBuilder(Map<String, String> kafkaProps, String configType) {
+        this.kafkaHost = kafkaProps.get("kafkaHost");
+        this.kafkaPort = kafkaProps.get("kafkaPort");
+        this.kafkaImportTopic = kafkaProps.get("kafkaImportTopic");
+        this.kafkaImportGroupId = kafkaProps.get("kafkaImportGroupId");
+        this.kafkaImportConsumerCount = kafkaProps.get("kafkaImportConsumerCount");
+        this.kafkaImportAutoCommit = kafkaProps.get("kafkaImportAutoCommit");
+        this.configType = configType;
+    }
+
+    public Object getEndpointURI(String direction) {
+        Object endpoint;
+        if(RouterConstants.CONFIG_TYPE_KAFKA.equals(configType)) {
+            //Prepare Kafka Deposit
+            StringBuilder kafkaUri = new StringBuilder("kafka:");
+            kafkaUri.append(kafkaHost).append(":").append(kafkaPort).append("?topic=").append(kafkaImportTopic);
+            if (StringUtils.isNotBlank(kafkaImportGroupId)) {
+                kafkaUri.append("&groupId=" + kafkaImportGroupId);
+            }
+            if(RouterConstants.DIRECTION_TO.equals(direction)) {
+                kafkaUri.append("&autoCommitEnable="+kafkaImportAutoCommit+"&consumersCount="+kafkaImportConsumerCount);
+            }
+            KafkaConfiguration kafkaConfiguration = new KafkaConfiguration();
+            kafkaConfiguration.setBrokers(kafkaHost + ":" + kafkaPort);
+            kafkaConfiguration.setTopic(kafkaImportTopic);
+            kafkaConfiguration.setGroupId(kafkaImportGroupId);
+            endpoint = new KafkaEndpoint(kafkaUri.toString(), new KafkaComponent(this.getContext()));
+            ((KafkaEndpoint)endpoint).setConfiguration(kafkaConfiguration);
+        } else {
+            endpoint = RouterConstants.DIRECT_DEPOSIT_BUFFER;
+        }
+
+        return endpoint;
+    }
+
+    public void setJacksonDataFormat(JacksonDataFormat jacksonDataFormat) {
+        this.jacksonDataFormat = jacksonDataFormat;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/8231d564/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportFromSourceRouteBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportFromSourceRouteBuilder.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportFromSourceRouteBuilder.java
new file mode 100644
index 0000000..9be6fb6
--- /dev/null
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportFromSourceRouteBuilder.java
@@ -0,0 +1,102 @@
+/*
+ * 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.unomi.router.core.route;
+
+import org.apache.camel.LoggingLevel;
+import org.apache.camel.component.kafka.KafkaEndpoint;
+import org.apache.camel.model.ProcessorDefinition;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.unomi.router.api.ImportConfiguration;
+import org.apache.unomi.router.core.RouterConstants;
+import org.apache.unomi.router.core.exception.BadProfileDataFormatException;
+import org.apache.unomi.router.core.processor.LineSplitFailureHandler;
+import org.apache.unomi.router.core.processor.LineSplitProcessor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by amidani on 26/04/2017.
+ */
+
+public class ProfileImportFromSourceRouteBuilder extends ProfileImportAbstractRouteBuilder {
+
+    private static final Logger logger = LoggerFactory.getLogger(ProfileImportFromSourceRouteBuilder.class.getName());
+
+    private List<ImportConfiguration> importConfigurationList;
+
+
+    public ProfileImportFromSourceRouteBuilder(Map<String, String> kafkaProps, String configType) {
+        super(kafkaProps, configType);
+    }
+
+    @Override
+    public void configure() throws Exception {
+
+        logger.info("Configure Recurrent Route 'From Source'");
+
+        //Loop on multiple import configuration
+        for (ImportConfiguration importConfiguration : importConfigurationList) {
+            if (importConfiguration.getProperties().size() > 0 &&
+                    StringUtils.isNotEmpty((String) importConfiguration.getProperties().get("source"))) {
+                //Prepare Split Processor
+                LineSplitProcessor lineSplitProcessor = new LineSplitProcessor();
+                lineSplitProcessor.setFieldsMapping((Map<String, Integer>) importConfiguration.getProperties().get("mapping"));
+                lineSplitProcessor.setOverwriteExistingProfiles(importConfiguration.isOverwriteExistingProfiles());
+                lineSplitProcessor.setPropertiesToOverwrite(importConfiguration.getPropertiesToOverwrite());
+                lineSplitProcessor.setMergingProperty(importConfiguration.getMergingProperty());
+                lineSplitProcessor.setColumnSeparator(importConfiguration.getColumnSeparator());
+
+                onException(BadProfileDataFormatException.class)
+                        .log(LoggingLevel.ERROR, "Error processing record ${exchangeProperty.CamelSplitIndex}++ !")
+                        .handled(true)
+                        .process(new LineSplitFailureHandler())
+                        .to("direct:errors");
+
+                errorHandler(deadLetterChannel("direct:errors"));
+
+                ProcessorDefinition prDef = from((String) importConfiguration.getProperties().get("source"))
+                        .routeId(importConfiguration.getItemId())// This allow identification of the route for manual start/stop
+                        .autoStartup(importConfiguration.isActive())// Auto-start if the import configuration is set active
+                        .split(bodyAs(String.class).tokenize(importConfiguration.getLineSeparator()))
+                        .log(LoggingLevel.INFO, "Splitted into ${exchangeProperty.CamelSplitSize} records")
+                        .setHeader(RouterConstants.HEADER_PROFILES_COUNT, exchangeProperty("CamelSplitSize}"))
+                        .setHeader(RouterConstants.HEADER_CONFIG_TYPE, constant(configType))
+                        .process(lineSplitProcessor)
+                        .log(LoggingLevel.INFO, "Split IDX ${exchangeProperty.CamelSplitIndex} record")
+                        .to("log:org.apache.unomi.router?level=INFO")
+                        .marshal(jacksonDataFormat)
+                        .convertBodyTo(String.class);
+
+                if (RouterConstants.CONFIG_TYPE_KAFKA.equals(configType)) {
+                    prDef.to((KafkaEndpoint) getEndpointURI(RouterConstants.DIRECTION_FROM));
+                } else {
+                    prDef.to((String) getEndpointURI(RouterConstants.DIRECTION_FROM));
+                }
+
+                from("direct:errors").to("log:org.apache.unomi.router?level=ERROR");
+            }
+        }
+    }
+
+    public void setImportConfigurationList(List<ImportConfiguration> importConfigurationList) {
+        this.importConfigurationList = importConfigurationList;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/8231d564/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportKafkaToUnomiRouteBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportKafkaToUnomiRouteBuilder.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportKafkaToUnomiRouteBuilder.java
deleted file mode 100644
index 1b056fe..0000000
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportKafkaToUnomiRouteBuilder.java
+++ /dev/null
@@ -1,77 +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.unomi.router.core.route;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.jackson.JacksonDataFormat;
-import org.apache.camel.component.kafka.KafkaComponent;
-import org.apache.camel.component.kafka.KafkaConfiguration;
-import org.apache.camel.component.kafka.KafkaEndpoint;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.unomi.router.core.processor.UnomiStorageProcessor;
-
-import java.util.Map;
-
-/**
- * Created by amidani on 26/04/2017.
- */
-public class ProfileImportKafkaToUnomiRouteBuilder extends RouteBuilder {
-
-    private UnomiStorageProcessor unomiStorageProcessor;
-    private JacksonDataFormat jacksonDataFormat;
-    private String kafkaHost;
-    private String kafkaPort;
-    private String kafkaImportTopic;
-    private String kafkaImportGroupId;
-
-    public ProfileImportKafkaToUnomiRouteBuilder(Map<String, String> kafkaProps) {
-        kafkaHost = kafkaProps.get("kafkaHost");
-        kafkaPort = kafkaProps.get("kafkaPort");
-        kafkaImportTopic = kafkaProps.get("kafkaImportTopic");
-        kafkaImportGroupId = kafkaProps.get("kafkaImportGroupId");
-    }
-
-    @Override
-    public void configure() throws Exception {
-
-        StringBuilder kafkaUri = new StringBuilder("kafka:");
-        kafkaUri.append(kafkaHost).append(":").append(kafkaPort).append("?topic=").append(kafkaImportTopic);
-        if(StringUtils.isNotBlank(kafkaImportGroupId)) {
-            kafkaUri.append("&groupId="+kafkaImportGroupId);
-        }
-        kafkaUri.append("&autoCommitEnable=true&consumersCount=10");
-        KafkaConfiguration kafkaConfiguration = new KafkaConfiguration();
-        kafkaConfiguration.setBrokers(kafkaHost+":"+kafkaPort);
-        kafkaConfiguration.setTopic(kafkaImportTopic);
-        kafkaConfiguration.setGroupId(kafkaImportGroupId);
-        KafkaEndpoint endpoint = new KafkaEndpoint(kafkaUri.toString(), new KafkaComponent(this.getContext()));
-        endpoint.setConfiguration(kafkaConfiguration);
-        from(endpoint)
-                .unmarshal(jacksonDataFormat)
-                .process(unomiStorageProcessor)
-                .to("log:org.apache.unomi.router?level=INFO");
-
-    }
-
-    public void setUnomiStorageProcessor(UnomiStorageProcessor unomiStorageProcessor) {
-        this.unomiStorageProcessor = unomiStorageProcessor;
-    }
-
-    public void setJacksonDataFormat(JacksonDataFormat jacksonDataFormat) {
-        this.jacksonDataFormat = jacksonDataFormat;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/8231d564/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportOneShotRouteBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportOneShotRouteBuilder.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportOneShotRouteBuilder.java
index d095f3e..84b220c 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportOneShotRouteBuilder.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportOneShotRouteBuilder.java
@@ -21,7 +21,9 @@ import org.apache.camel.component.jackson.JacksonDataFormat;
 import org.apache.camel.component.kafka.KafkaComponent;
 import org.apache.camel.component.kafka.KafkaConfiguration;
 import org.apache.camel.component.kafka.KafkaEndpoint;
+import org.apache.camel.model.ProcessorDefinition;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.unomi.router.core.RouterConstants;
 import org.apache.unomi.router.core.processor.ImportConfigByFileNameProcessor;
 import org.apache.unomi.router.core.processor.LineSplitProcessor;
 import org.slf4j.Logger;
@@ -32,57 +34,41 @@ import java.util.Map;
 /**
  * Created by amidani on 22/05/2017.
  */
-public class ProfileImportOneShotRouteBuilder extends RouteBuilder {
+public class ProfileImportOneShotRouteBuilder extends ProfileImportAbstractRouteBuilder {
 
     private Logger logger = LoggerFactory.getLogger(ProfileImportOneShotRouteBuilder.class.getName());
 
     private ImportConfigByFileNameProcessor importConfigByFileNameProcessor;
-    private JacksonDataFormat jacksonDataFormat;
     private String uploadDir;
-    private String kafkaHost;
-    private String kafkaPort;
-    private String kafkaImportTopic;
-    private String kafkaImportGroupId;
 
     private final String IMPORT_ONESHOT_ROUTE_ID = "ONE_SHOT_ROUTE";
 
-    public ProfileImportOneShotRouteBuilder(Map<String, String> kafkaProps) {
-        kafkaHost = kafkaProps.get("kafkaHost");
-        kafkaPort = kafkaProps.get("kafkaPort");
-        kafkaImportTopic = kafkaProps.get("kafkaImportTopic");
-        kafkaImportGroupId = kafkaProps.get("kafkaImportGroupId");
+    public ProfileImportOneShotRouteBuilder(Map<String, String> kafkaProps, String configType) {
+        super(kafkaProps, configType);
     }
 
     @Override
     public void configure() throws Exception {
 
-        //Prepare Kafka Deposit
-        StringBuilder kafkaUri = new StringBuilder("kafka:");
-        kafkaUri.append(kafkaHost).append(":").append(kafkaPort).append("?topic=").append(kafkaImportTopic);
-        if(StringUtils.isNotBlank(kafkaImportGroupId)) {
-            kafkaUri.append("&groupId="+ kafkaImportGroupId);
-        }
-
-        KafkaConfiguration kafkaConfiguration = new KafkaConfiguration();
-        kafkaConfiguration.setBrokers(kafkaHost+":"+kafkaPort);
-        kafkaConfiguration.setTopic(kafkaImportTopic);
-        kafkaConfiguration.setGroupId(kafkaImportGroupId);
-        KafkaEndpoint endpoint = new KafkaEndpoint(kafkaUri.toString(), new KafkaComponent(this.getContext()));
-        endpoint.setConfiguration(kafkaConfiguration);
+        logger.info("Configure OneShot Route...");
 
         LineSplitProcessor lineSplitProcessor = new LineSplitProcessor();
 
-
-        from("file://"+uploadDir+"?include=.*.csv&consumer.delay=1m")
+        ProcessorDefinition prDef = from("file://"+uploadDir+"?include=.*.csv&consumer.delay=1m")
                 .routeId(IMPORT_ONESHOT_ROUTE_ID)
                 .autoStartup(true)
                 .process(importConfigByFileNameProcessor)
                 .split(bodyAs(String.class).tokenize("${in.header.importConfigOneShot.getLineSeparator}"))
+                .setHeader("configType", constant(configType))
                 .process(lineSplitProcessor)
                 .to("log:org.apache.unomi.router?level=INFO")
                 .marshal(jacksonDataFormat)
-                .convertBodyTo(String.class)
-                .to(endpoint);
+                .convertBodyTo(String.class);
+        if(RouterConstants.CONFIG_TYPE_KAFKA.equals(configType)){
+            prDef.to((KafkaEndpoint) getEndpointURI(RouterConstants.DIRECTION_FROM));
+        } else {
+            prDef.to((String) getEndpointURI(RouterConstants.DIRECTION_FROM));
+        }
     }
 
     public void setImportConfigByFileNameProcessor(ImportConfigByFileNameProcessor importConfigByFileNameProcessor) {

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/8231d564/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportSourceToKafkaRouteBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportSourceToKafkaRouteBuilder.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportSourceToKafkaRouteBuilder.java
deleted file mode 100644
index 37ae59e..0000000
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportSourceToKafkaRouteBuilder.java
+++ /dev/null
@@ -1,120 +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.unomi.router.core.route;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.jackson.JacksonDataFormat;
-import org.apache.camel.component.kafka.KafkaComponent;
-import org.apache.camel.component.kafka.KafkaConfiguration;
-import org.apache.camel.component.kafka.KafkaEndpoint;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.unomi.router.api.ImportConfiguration;
-import org.apache.unomi.router.core.processor.LineSplitProcessor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Created by amidani on 26/04/2017.
- */
-
-public class ProfileImportSourceToKafkaRouteBuilder extends RouteBuilder {
-
-    private static final Logger logger = LoggerFactory.getLogger(ProfileImportSourceToKafkaRouteBuilder.class.getName());
-
-    private List<ImportConfiguration> importConfigurationList;
-    private JacksonDataFormat jacksonDataFormat;
-    private String kafkaHost;
-    private String kafkaPort;
-    private String kafkaImportTopic;
-    private String kafkaImportGroupId;
-
-    public ProfileImportSourceToKafkaRouteBuilder(Map<String, String> kafkaProps) {
-        kafkaHost = kafkaProps.get("kafkaHost");
-        kafkaPort = kafkaProps.get("kafkaPort");
-        kafkaImportTopic = kafkaProps.get("kafkaImportTopic");
-        kafkaImportGroupId = kafkaProps.get("kafkaImportGroupId");
-    }
-
-    @Override
-    public void configure() throws Exception {
-        //Prepare Kafka Deposit
-        StringBuilder kafkaUri = new StringBuilder("kafka:");
-        kafkaUri.append(kafkaHost).append(":").append(kafkaPort).append("?topic=").append(kafkaImportTopic);
-        if(StringUtils.isNotBlank(kafkaImportGroupId)) {
-            kafkaUri.append("&groupId="+ kafkaImportGroupId);
-        }
-
-        KafkaConfiguration kafkaConfiguration = new KafkaConfiguration();
-        kafkaConfiguration.setBrokers(kafkaHost+":"+kafkaPort);
-        kafkaConfiguration.setTopic(kafkaImportTopic);
-        kafkaConfiguration.setGroupId(kafkaImportGroupId);
-        KafkaEndpoint endpoint = new KafkaEndpoint(kafkaUri.toString(), new KafkaComponent(this.getContext()));
-        endpoint.setConfiguration(kafkaConfiguration);
-
-        //Loop on multiple import configuration
-        for(ImportConfiguration importConfiguration : importConfigurationList) {
-            if(importConfiguration.getProperties().size() > 0 &&
-                    StringUtils.isNotEmpty((String) importConfiguration.getProperties().get("source"))) {
-                //Prepare Split Processor
-                LineSplitProcessor lineSplitProcessor = new LineSplitProcessor();
-                lineSplitProcessor.setFieldsMapping((Map<String, Integer>) importConfiguration.getProperties().get("mapping"));
-                lineSplitProcessor.setOverwriteExistingProfiles(importConfiguration.isOverwriteExistingProfiles());
-                lineSplitProcessor.setPropertiesToOverwrite(importConfiguration.getPropertiesToOverwrite());
-                lineSplitProcessor.setMergingProperty(importConfiguration.getMergingProperty());
-                lineSplitProcessor.setColumnSeparator(importConfiguration.getColumnSeparator());
-
-                from((String) importConfiguration.getProperties().get("source"))
-                        .routeId(importConfiguration.getItemId())// This allow identification of the route for manual start/stop
-                        .autoStartup(importConfiguration.isActive())// Auto-start if the import configuration is set active
-                        .split(bodyAs(String.class).tokenize(importConfiguration.getLineSeparator()))
-                        .process(lineSplitProcessor)
-                        .to("log:org.apache.unomi.router?level=INFO")
-                        .marshal(jacksonDataFormat)
-                        .convertBodyTo(String.class)
-                        .to(endpoint);
-            }
-        }
-    }
-
-    public void setImportConfigurationList(List<ImportConfiguration> importConfigurationList) {
-        this.importConfigurationList = importConfigurationList;
-    }
-
-    public void setJacksonDataFormat(JacksonDataFormat jacksonDataFormat) {
-        this.jacksonDataFormat = jacksonDataFormat;
-    }
-
-    public void setKafkaHost(String kafkaHost) {
-        this.kafkaHost = kafkaHost;
-    }
-
-    public void setKafkaPort(String kafkaPort) {
-        this.kafkaPort = kafkaPort;
-    }
-
-    public void setKafkaImportTopic(String kafkaImportTopic) {
-        this.kafkaImportTopic = kafkaImportTopic;
-    }
-
-    public void setKafkaImportGroupId(String kafkaImportGroupId) {
-        this.kafkaImportGroupId = kafkaImportGroupId;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/8231d564/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportToUnomiRouteBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportToUnomiRouteBuilder.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportToUnomiRouteBuilder.java
new file mode 100644
index 0000000..9bec24b
--- /dev/null
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportToUnomiRouteBuilder.java
@@ -0,0 +1,70 @@
+/*
+ * 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.unomi.router.core.route;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jackson.JacksonDataFormat;
+import org.apache.camel.component.kafka.KafkaComponent;
+import org.apache.camel.component.kafka.KafkaConfiguration;
+import org.apache.camel.component.kafka.KafkaEndpoint;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.unomi.router.core.RouterConstants;
+import org.apache.unomi.router.core.processor.UnomiStorageProcessor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+
+/**
+ * Created by amidani on 26/04/2017.
+ */
+public class ProfileImportToUnomiRouteBuilder extends ProfileImportAbstractRouteBuilder {
+
+    private Logger logger = LoggerFactory.getLogger(ProfileImportToUnomiRouteBuilder.class.getName());
+
+    private UnomiStorageProcessor unomiStorageProcessor;
+
+    public ProfileImportToUnomiRouteBuilder(Map<String, String> kafkaProps, String configType) {
+        super(kafkaProps, configType);
+    }
+
+    @Override
+    public void configure() throws Exception {
+
+        logger.info("Configure Recurrent Route 'To Target'");
+
+        RouteDefinition rtDef;
+        if(RouterConstants.CONFIG_TYPE_KAFKA.equals(configType)){
+            rtDef=from((KafkaEndpoint)getEndpointURI(RouterConstants.DIRECTION_TO));
+        } else {
+            rtDef=from((String)getEndpointURI(RouterConstants.DIRECTION_TO));
+        }
+        rtDef.unmarshal(jacksonDataFormat)
+                .process(unomiStorageProcessor)
+                .to("log:org.apache.unomi.router?level=INFO");
+
+    }
+
+    public void setUnomiStorageProcessor(UnomiStorageProcessor unomiStorageProcessor) {
+        this.unomiStorageProcessor = unomiStorageProcessor;
+    }
+
+    public void setJacksonDataFormat(JacksonDataFormat jacksonDataFormat) {
+        this.jacksonDataFormat = jacksonDataFormat;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/8231d564/extensions/router/router-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/extensions/router/router-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 4c36b9e..53efbf3 100644
--- a/extensions/router/router-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/extensions/router/router-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -25,10 +25,13 @@
 
     <cm:property-placeholder persistent-id="org.apache.unomi.router" update-strategy="reload">
         <cm:default-properties>
+            <cm:property name="import.config.type" value="nobroker"/>
             <cm:property name="kafka.host" value="localhost"/>
             <cm:property name="kafka.port" value="9092"/>
             <cm:property name="kafka.import.topic" value="camel-deposit"/>
             <cm:property name="kafka.import.groupId" value="unomi-import-group"/>
+            <cm:property name="kafka.import.consumerCount" value="10"/>
+            <cm:property name="kafka.import.autoCommit" value="true"/>
             <cm:property name="import.oneshot.uploadDir" value="/tmp/oneshot_import_configs/"/>
         </cm:default-properties>
     </cm:property-placeholder>
@@ -63,12 +66,15 @@
 
     <bean id="camelContext" class="org.apache.unomi.router.core.context.ProfileImportCamelContext"
           init-method="initCamelContext" destroy-method="preDestroy">
+        <property name="configType" value="${import.config.type}"/>
         <property name="kafkaProps">
             <map>
                 <entry key="kafkaHost" value="${kafka.host}"/>
                 <entry key="kafkaPort" value="${kafka.port}"/>
                 <entry key="kafkaImportTopic" value="${kafka.import.topic}"/>
                 <entry key="kafkaImportGroupId" value="${kafka.import.groupId}"/>
+                <entry key="kafkaImportConsumerCount" value="${kafka.import.consumerCount}"/>
+                <entry key="kafkaImportAutoCommit" value="${kafka.import.autoCommit}"/>
             </map>
         </property>
         <property name="uploadDir" value="${import.oneshot.uploadDir}"/>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/8231d564/extensions/router/router-core/src/main/resources/org.apache.unomi.router.cfg
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/resources/org.apache.unomi.router.cfg b/extensions/router/router-core/src/main/resources/org.apache.unomi.router.cfg
index ff2c8ef..0ce4bb2 100644
--- a/extensions/router/router-core/src/main/resources/org.apache.unomi.router.cfg
+++ b/extensions/router/router-core/src/main/resources/org.apache.unomi.router.cfg
@@ -15,11 +15,18 @@
 # limitations under the License.
 #
 
+#Configuration Type values {'nobroker', 'kafka'}
+import.config.type=nobroker
+
+#Uncomment and update Kafka settings to use Kafka as a broker
+
 #Kafka
- settingskafka.host=localhost
-kafka.port=9092
-kafka.import.topic=camel-deposit
-kafka.import.groupId=unomi-import-group
+#kafka.host=localhost
+#kafka.port=9092
+#kafka.import.topic=camel-deposit
+#kafka.import.groupId=unomi-import-group
+#kafka.import.consumerCount=10
+#kafka.import.autoCommit=true
 
 #Import One Shot upload directory
 import.oneshot.uploadDir=/tmp/unomi_oneshot_import_configs/
\ No newline at end of file


[35/50] [abbrv] incubator-unomi git commit: UNOMI-101 : Typo

Posted by sh...@apache.org.
UNOMI-101 : Typo


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/9cfa2a00
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/9cfa2a00
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/9cfa2a00

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 9cfa2a00794f1855727c10289a0e266952fc093d
Parents: c8a070f
Author: Abdelkader Midani <am...@apache.org>
Authored: Mon Jun 12 20:14:24 2017 +0200
Committer: Abdelkader Midani <am...@apache.org>
Committed: Mon Jun 12 20:14:24 2017 +0200

----------------------------------------------------------------------
 .../main/resources/org.apache.unomi.persistence.elasticsearch.cfg  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/9cfa2a00/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg b/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
index 12980e1..77eb091 100644
--- a/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
+++ b/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
@@ -15,7 +15,7 @@
 # limitations under the License.
 #
 
-cluster.name=contextElasticSearch_amidani
+cluster.name=contextElasticSearch
 # The elasticSearchAddresses may be a comma seperated list of host names and ports such as
 # hostA:9300,hostB:9300
 # Note: the port number must be repeated for each host.


[36/50] [abbrv] incubator-unomi git commit: UNOMI-99 Improve network unavailable and connection timeout handling - Try to improve error handling.

Posted by sh...@apache.org.
UNOMI-99 Improve network unavailable and connection timeout handling
- Try to improve error handling.

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/f597a69a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/f597a69a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/f597a69a

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: f597a69a2cec921cb86eafd6c8e04e880f7ab7a2
Parents: 9cfa2a0
Author: Serge Huber <sh...@apache.org>
Authored: Tue Jun 13 22:27:48 2017 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Tue Jun 13 22:27:48 2017 +0200

----------------------------------------------------------------------
 .../services/services/ClusterServiceImpl.java   | 34 ++++++++++++--------
 1 file changed, 20 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/f597a69a/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java
index a77b978..da54208 100644
--- a/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java
@@ -257,20 +257,9 @@ public class ClusterServiceImpl implements ClusterService {
             } catch (MalformedURLException e) {
                 logger.error("Error connecting to remote JMX server", e);
             } catch (ConnectException ce) {
-                if (ce.getMessage() != null &&
-                        (ce.getMessage().contains("timed out") || ce.getMessage().contains("Network is unreachable"))) {
-                    logger.warn("RMI Connection timed out or network is unreachable, will reconnect on next request.");
-                    JMXConnector jmxConnector = jmxConnectors.remove(serviceUrl);
-                    try {
-                        if (jmxConnector != null) {
-                            jmxConnector.close();
-                        }
-                    } catch (Throwable t) {
-                        // ignore any exception when closing a timed out connection.
-                    }
-                } else {
-                    logger.error("Error retrieving remote JMX data", ce);
-                }
+                handleTimeouts(serviceUrl, ce);
+            } catch (java.rmi.ConnectException ce) {
+                handleTimeouts(serviceUrl, ce);
             } catch (IOException e) {
                 logger.error("Error retrieving remote JMX data", e);
             } catch (MalformedObjectNameException e) {
@@ -286,6 +275,23 @@ public class ClusterServiceImpl implements ClusterService {
         return new ArrayList<ClusterNode>(clusterNodes.values());
     }
 
+    private void handleTimeouts(String serviceUrl, Throwable throwable) {
+        if (throwable.getMessage() != null &&
+                (throwable.getMessage().contains("timed out") || throwable.getMessage().contains("Network is unreachable"))) {
+            logger.warn("RMI Connection timed out or network is unreachable, will reconnect on next request.");
+            JMXConnector jmxConnector = jmxConnectors.remove(serviceUrl);
+            try {
+                if (jmxConnector != null) {
+                    jmxConnector.close();
+                }
+            } catch (Throwable t) {
+                // ignore any exception when closing a timed out connection.
+            }
+        } else {
+            logger.error("Error retrieving remote JMX data", throwable);
+        }
+    }
+
     @Override
     public void purge(Date date) {
         persistenceService.purge(date);


[48/50] [abbrv] incubator-unomi git commit: [jgitflow-maven-plugin]updating poms for unomi_5_karaf_4 version

Posted by sh...@apache.org.
[jgitflow-maven-plugin]updating poms for unomi_5_karaf_4 version

Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/d607e911
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/d607e911
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/d607e911

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: d607e911c3921aebd3a71d1605807a78d5e1445b
Parents: d19be22
Author: Serge Huber <sh...@apache.org>
Authored: Mon Jan 30 20:16:04 2017 +0100
Committer: Serge Huber <sh...@apache.org>
Committed: Sat Jun 24 20:33:58 2017 +0200

----------------------------------------------------------------------
 api/pom.xml                                     |  2 +-
 extensions/geonames/pom.xml                     |  2 +-
 extensions/geonames/rest/pom.xml                |  8 +++---
 extensions/geonames/services/pom.xml            |  8 +++---
 extensions/lists-extension/pom.xml              |  4 +--
 extensions/lists-extension/rest/pom.xml         |  8 +++---
 extensions/lists-extension/services/pom.xml     |  8 +++---
 extensions/pom.xml                              |  2 +-
 extensions/privacy-extension/pom.xml            |  4 +--
 extensions/privacy-extension/rest/pom.xml       |  8 +++---
 extensions/privacy-extension/services/pom.xml   |  8 +++---
 kar/pom.xml                                     | 30 ++++++++++----------
 lifecycle-watcher/pom.xml                       |  6 ++--
 package/pom.xml                                 |  4 +--
 persistence-elasticsearch/core/pom.xml          |  6 ++--
 persistence-elasticsearch/plugins/pom.xml       |  2 +-
 .../plugins/security/pom.xml                    |  2 +-
 persistence-elasticsearch/pom.xml               |  2 +-
 persistence-spi/pom.xml                         |  4 +--
 plugins/baseplugin/pom.xml                      |  6 ++--
 plugins/hover-event/pom.xml                     |  4 +--
 plugins/mail/pom.xml                            |  4 +--
 plugins/optimization-test/pom.xml               |  2 +-
 plugins/past-event/pom.xml                      |  6 ++--
 plugins/pom.xml                                 |  4 +--
 plugins/request/pom.xml                         |  2 +-
 plugins/tracked-event/pom.xml                   |  6 ++--
 pom.xml                                         |  2 +-
 rest/pom.xml                                    |  6 ++--
 samples/pom.xml                                 |  2 +-
 samples/tweet-button-plugin/pom.xml             |  4 +--
 services/pom.xml                                |  6 ++--
 wab/pom.xml                                     |  6 ++--
 33 files changed, 88 insertions(+), 90 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/api/pom.xml
----------------------------------------------------------------------
diff --git a/api/pom.xml b/api/pom.xml
index 6662b6f..e162a36 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-root</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-api</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/extensions/geonames/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/geonames/pom.xml b/extensions/geonames/pom.xml
index f601a7c..9e9d215 100644
--- a/extensions/geonames/pom.xml
+++ b/extensions/geonames/pom.xml
@@ -27,7 +27,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-extensions</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>cxs-geonames</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/extensions/geonames/rest/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/geonames/rest/pom.xml b/extensions/geonames/rest/pom.xml
index cec5546..244682a 100644
--- a/extensions/geonames/rest/pom.xml
+++ b/extensions/geonames/rest/pom.xml
@@ -20,7 +20,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>cxs-geonames</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
@@ -33,14 +33,14 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-api</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
 
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>cxs-geonames-services</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
 
@@ -76,7 +76,7 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-persistence-spi</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/extensions/geonames/services/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/geonames/services/pom.xml b/extensions/geonames/services/pom.xml
index e1e7310..273e697 100644
--- a/extensions/geonames/services/pom.xml
+++ b/extensions/geonames/services/pom.xml
@@ -20,7 +20,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>cxs-geonames</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <modelVersion>4.0.0</modelVersion>
@@ -28,20 +28,20 @@
     <artifactId>cxs-geonames-services</artifactId>
     <name>Apache Unomi :: Extensions :: Geonames Database :: Service</name>
     <description>Service implementation for the Apache Unomi Context Server extension that integrates with the Geonames database</description>
-    <version>1.2.0-incubating-SNAPSHOT</version>
+    <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <dependencies>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-api</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-persistence-spi</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/extensions/lists-extension/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/lists-extension/pom.xml b/extensions/lists-extension/pom.xml
index 6542575..6517da0 100644
--- a/extensions/lists-extension/pom.xml
+++ b/extensions/lists-extension/pom.xml
@@ -28,12 +28,12 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-extensions</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>cxs-lists-extension</artifactId>
     <name>Apache Unomi :: Extensions :: Lists</name>
     <description>List extension for the Apache Unomi Context Server</description>
-    <version>1.2.0-incubating-SNAPSHOT</version>
+    <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     <packaging>pom</packaging>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/extensions/lists-extension/rest/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/lists-extension/rest/pom.xml b/extensions/lists-extension/rest/pom.xml
index e4e9414..cc10c7e 100644
--- a/extensions/lists-extension/rest/pom.xml
+++ b/extensions/lists-extension/rest/pom.xml
@@ -20,7 +20,7 @@
     <parent>
         <artifactId>cxs-lists-extension</artifactId>
         <groupId>org.apache.unomi</groupId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
@@ -34,14 +34,14 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-api</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
 
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>cxs-lists-extension-services</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
 
@@ -77,7 +77,7 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-persistence-spi</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/extensions/lists-extension/services/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/lists-extension/services/pom.xml b/extensions/lists-extension/services/pom.xml
index d7ebedb..c481bf7 100644
--- a/extensions/lists-extension/services/pom.xml
+++ b/extensions/lists-extension/services/pom.xml
@@ -20,7 +20,7 @@
     <parent>
         <artifactId>cxs-lists-extension</artifactId>
         <groupId>org.apache.unomi</groupId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
@@ -28,20 +28,20 @@
     <name>Apache Unomi :: Extensions :: Lists :: Service</name>
     <description>List extension service implementation for the Apache Unomi Context Server</description>
 
-    <version>1.2.0-incubating-SNAPSHOT</version>
+    <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <dependencies>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-api</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-persistence-spi</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/extensions/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/pom.xml b/extensions/pom.xml
index dea4bc2..fcc7129 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-root</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-extensions</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/extensions/privacy-extension/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/privacy-extension/pom.xml b/extensions/privacy-extension/pom.xml
index 46e4315..7b8a401 100644
--- a/extensions/privacy-extension/pom.xml
+++ b/extensions/privacy-extension/pom.xml
@@ -27,12 +27,12 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-extensions</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>cxs-privacy-extension</artifactId>
     <name>Apache Unomi :: Extensions :: Privacy</name>
     <description>Privacy management extension for the Apache Unomi Context Server</description>
-    <version>1.2.0-incubating-SNAPSHOT</version>
+    <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     <packaging>pom</packaging>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/extensions/privacy-extension/rest/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/privacy-extension/rest/pom.xml b/extensions/privacy-extension/rest/pom.xml
index 0388a60..75e1230 100644
--- a/extensions/privacy-extension/rest/pom.xml
+++ b/extensions/privacy-extension/rest/pom.xml
@@ -20,7 +20,7 @@
     <parent>
         <artifactId>cxs-privacy-extension</artifactId>
         <groupId>org.apache.unomi</groupId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
@@ -33,14 +33,14 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-api</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
 
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>cxs-privacy-extension-services</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
 
@@ -76,7 +76,7 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-persistence-spi</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/extensions/privacy-extension/services/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/privacy-extension/services/pom.xml b/extensions/privacy-extension/services/pom.xml
index 4afcde8..65ccfc1 100644
--- a/extensions/privacy-extension/services/pom.xml
+++ b/extensions/privacy-extension/services/pom.xml
@@ -20,27 +20,27 @@
     <parent>
         <artifactId>cxs-privacy-extension</artifactId>
         <groupId>org.apache.unomi</groupId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>cxs-privacy-extension-services</artifactId>
     <name>Apache Unomi :: Extensions :: Privacy :: Services</name>
     <description>Privacy management extension service implementation for the Apache Unomi Context Server</description>
-    <version>1.2.0-incubating-SNAPSHOT</version>
+    <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <dependencies>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-api</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-persistence-spi</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/kar/pom.xml
----------------------------------------------------------------------
diff --git a/kar/pom.xml b/kar/pom.xml
index 20d4257..8e33ba1 100644
--- a/kar/pom.xml
+++ b/kar/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-root</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-kar</artifactId>
@@ -34,52 +34,52 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-wab</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-api</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-services</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-persistence-elasticsearch-core</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-plugins-base</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-plugins-request</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-plugins-mail</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-plugins-optimization-test</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>cxs-lists-extension-services</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>cxs-lists-extension-rest</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
@@ -89,22 +89,22 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>cxs-geonames-services</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>cxs-geonames-rest</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>cxs-privacy-extension-services</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>cxs-privacy-extension-rest</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.servicemix.bundles</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/lifecycle-watcher/pom.xml
----------------------------------------------------------------------
diff --git a/lifecycle-watcher/pom.xml b/lifecycle-watcher/pom.xml
index 419f7bf..0ea80f1 100644
--- a/lifecycle-watcher/pom.xml
+++ b/lifecycle-watcher/pom.xml
@@ -16,13 +16,11 @@
   ~ limitations under the License.
   -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <parent>
         <artifactId>unomi-root</artifactId>
         <groupId>org.apache.unomi</groupId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/package/pom.xml
----------------------------------------------------------------------
diff --git a/package/pom.xml b/package/pom.xml
index da235b2..d84ec38 100644
--- a/package/pom.xml
+++ b/package/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-root</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi</artifactId>
@@ -85,7 +85,7 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-kar</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <classifier>features</classifier>
             <type>xml</type>
             <scope>runtime</scope>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/persistence-elasticsearch/core/pom.xml
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/pom.xml b/persistence-elasticsearch/core/pom.xml
index eb169ef..e520fa3 100644
--- a/persistence-elasticsearch/core/pom.xml
+++ b/persistence-elasticsearch/core/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-persistence-elasticsearch</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-persistence-elasticsearch-core</artifactId>
@@ -45,13 +45,13 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-api</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-persistence-spi</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/persistence-elasticsearch/plugins/pom.xml
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/plugins/pom.xml b/persistence-elasticsearch/plugins/pom.xml
index 9114ece..556c7e4 100644
--- a/persistence-elasticsearch/plugins/pom.xml
+++ b/persistence-elasticsearch/plugins/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-persistence-elasticsearch</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-persistence-elasticsearch-plugins</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/persistence-elasticsearch/plugins/security/pom.xml
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/plugins/security/pom.xml b/persistence-elasticsearch/plugins/security/pom.xml
index c980ba2..90af370 100644
--- a/persistence-elasticsearch/plugins/security/pom.xml
+++ b/persistence-elasticsearch/plugins/security/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-persistence-elasticsearch-plugins</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-persistence-elasticsearch-plugins-security</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/persistence-elasticsearch/pom.xml
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/pom.xml b/persistence-elasticsearch/pom.xml
index 70a85ea..262fd6d 100644
--- a/persistence-elasticsearch/pom.xml
+++ b/persistence-elasticsearch/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-root</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-persistence-elasticsearch</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/persistence-spi/pom.xml
----------------------------------------------------------------------
diff --git a/persistence-spi/pom.xml b/persistence-spi/pom.xml
index 976f46c..531da43 100644
--- a/persistence-spi/pom.xml
+++ b/persistence-spi/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-root</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-persistence-spi</artifactId>
@@ -34,7 +34,7 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-api</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/plugins/baseplugin/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/pom.xml b/plugins/baseplugin/pom.xml
index 6efb0e5..a1acb9a 100644
--- a/plugins/baseplugin/pom.xml
+++ b/plugins/baseplugin/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-plugins</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-plugins-base</artifactId>
@@ -56,13 +56,13 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-persistence-elasticsearch-core</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-persistence-spi</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/plugins/hover-event/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/hover-event/pom.xml b/plugins/hover-event/pom.xml
index d83c662..790d53f 100644
--- a/plugins/hover-event/pom.xml
+++ b/plugins/hover-event/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-plugins</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-plugins-hover-event</artifactId>
@@ -34,7 +34,7 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-persistence-elasticsearch-core</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/plugins/mail/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/mail/pom.xml b/plugins/mail/pom.xml
index e7dfdf6..c54adf7 100644
--- a/plugins/mail/pom.xml
+++ b/plugins/mail/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-plugins</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-plugins-mail</artifactId>
@@ -34,7 +34,7 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-persistence-spi</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/plugins/optimization-test/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/optimization-test/pom.xml b/plugins/optimization-test/pom.xml
index 445e457..7f9e5ab 100644
--- a/plugins/optimization-test/pom.xml
+++ b/plugins/optimization-test/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-plugins</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-plugins-optimization-test</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/plugins/past-event/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/past-event/pom.xml b/plugins/past-event/pom.xml
index eb37f52..de6607f 100644
--- a/plugins/past-event/pom.xml
+++ b/plugins/past-event/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-plugins</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-plugins-past-event</artifactId>
@@ -34,13 +34,13 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-persistence-elasticsearch-core</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-persistence-spi</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/plugins/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/pom.xml b/plugins/pom.xml
index 5de8cfb..d86a16e 100644
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-root</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-plugins</artifactId>
@@ -44,7 +44,7 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-api</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/plugins/request/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/request/pom.xml b/plugins/request/pom.xml
index cd17202..42a6f45 100644
--- a/plugins/request/pom.xml
+++ b/plugins/request/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-plugins</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-plugins-request</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/plugins/tracked-event/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/tracked-event/pom.xml b/plugins/tracked-event/pom.xml
index 68d3fdd..23212ab 100644
--- a/plugins/tracked-event/pom.xml
+++ b/plugins/tracked-event/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-plugins</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-plugins-tracked-event</artifactId>
@@ -34,13 +34,13 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-persistence-elasticsearch-core</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-persistence-spi</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 376cf21..128b896 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,7 @@
         event tracking server.
     </description>
     <url>http://unomi.incubator.apache.org</url>
-    <version>1.2.0-incubating-SNAPSHOT</version>
+    <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <licenses>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/rest/pom.xml
----------------------------------------------------------------------
diff --git a/rest/pom.xml b/rest/pom.xml
index f089dc0..40f5f4b 100644
--- a/rest/pom.xml
+++ b/rest/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-root</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-rest</artifactId>
@@ -42,7 +42,7 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-api</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
 
@@ -84,7 +84,7 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-persistence-spi</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <!--<dependency>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/samples/pom.xml
----------------------------------------------------------------------
diff --git a/samples/pom.xml b/samples/pom.xml
index 67e0d6f..f4b8bf2 100644
--- a/samples/pom.xml
+++ b/samples/pom.xml
@@ -19,7 +19,7 @@
     <parent>
         <artifactId>unomi-root</artifactId>
         <groupId>org.apache.unomi</groupId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/samples/tweet-button-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/samples/tweet-button-plugin/pom.xml b/samples/tweet-button-plugin/pom.xml
index c1725d5..608c388 100644
--- a/samples/tweet-button-plugin/pom.xml
+++ b/samples/tweet-button-plugin/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <artifactId>samples</artifactId>
         <groupId>org.apache.unomi</groupId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>tweet-button-plugin</artifactId>
@@ -33,7 +33,7 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-api</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/services/pom.xml
----------------------------------------------------------------------
diff --git a/services/pom.xml b/services/pom.xml
index 2d5f345..69a120b 100644
--- a/services/pom.xml
+++ b/services/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-root</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-services</artifactId>
@@ -34,7 +34,7 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-api</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
 
@@ -53,7 +53,7 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-persistence-spi</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d607e911/wab/pom.xml
----------------------------------------------------------------------
diff --git a/wab/pom.xml b/wab/pom.xml
index cb29c05..735cf7a 100644
--- a/wab/pom.xml
+++ b/wab/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-root</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-wab</artifactId>
@@ -43,13 +43,13 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-api</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-persistence-spi</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>1.2.0-incubating-unomi_5_karaf_4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
 



[05/50] [abbrv] incubator-unomi git commit: Fix Jenkins URL

Posted by sh...@apache.org.
Fix Jenkins URL

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/26db159f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/26db159f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/26db159f

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 26db159f08ed63543b0afeea6721ffb0f8ed81ff
Parents: 3110e43
Author: Serge Huber <sh...@apache.org>
Authored: Fri Feb 24 15:12:52 2017 +0100
Committer: Serge Huber <sh...@apache.org>
Committed: Fri Feb 24 15:12:52 2017 +0100

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/26db159f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7234fbb..9a0872c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -57,7 +57,7 @@
 
     <ciManagement>
         <system>Jenkins</system>
-        <url>https://builds.apache.org/job/unomi</url>
+        <url>https://builds.apache.org/job/unomi-master</url>
     </ciManagement>
 
     <inceptionYear>2014</inceptionYear>


[39/50] [abbrv] incubator-unomi git commit: Rollback previous commit issue with bundle startup when we filter the cfg

Posted by sh...@apache.org.
Rollback previous commit issue with bundle startup when we filter the cfg


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/38489fee
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/38489fee
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/38489fee

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 38489feedfe9d157c96488a4b0b6df6df88321ac
Parents: b4fed6a
Author: Abdelkader Midani <am...@apache.org>
Authored: Thu Jun 15 15:17:44 2017 +0200
Committer: Abdelkader Midani <am...@apache.org>
Committed: Thu Jun 15 15:17:44 2017 +0200

----------------------------------------------------------------------
 persistence-elasticsearch/core/pom.xml          | 24 +----------
 ...g.apache.unomi.persistence.elasticsearch.cfg | 45 --------------------
 ...g.apache.unomi.persistence.elasticsearch.cfg | 45 ++++++++++++++++++++
 3 files changed, 46 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/38489fee/persistence-elasticsearch/core/pom.xml
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/pom.xml b/persistence-elasticsearch/core/pom.xml
index a98cde6..eb169ef 100644
--- a/persistence-elasticsearch/core/pom.xml
+++ b/persistence-elasticsearch/core/pom.xml
@@ -146,12 +146,6 @@
     </dependencies>
 
     <build>
-        <resources>
-            <resource>
-                <directory>src/main/resources-filtered</directory>
-                <filtering>true</filtering>
-            </resource>
-        </resources>
         <plugins>
             <plugin>
                 <groupId>org.apache.felix</groupId>
@@ -247,7 +241,7 @@
                             <artifacts>
                                 <artifact>
                                     <file>
-                                        ${project.build.outputDirectory}/org.apache.unomi.persistence.elasticsearch.cfg
+                                        src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
                                     </file>
                                     <type>cfg</type>
                                     <classifier>elasticsearchcfg</classifier>
@@ -261,20 +255,4 @@
 
     </build>
 
-    <profiles>
-        <profile>
-            <id>esClusterName</id>
-            <activation>
-                <activeByDefault>true</activeByDefault>
-                <property>
-                    <name>!esClusterName</name>
-                </property>
-            </activation>
-
-            <properties>
-                <esClusterName>contextElasticSearch</esClusterName>
-            </properties>
-        </profile>
-    </profiles>
-
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/38489fee/persistence-elasticsearch/core/src/main/resources-filtered/org.apache.unomi.persistence.elasticsearch.cfg
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources-filtered/org.apache.unomi.persistence.elasticsearch.cfg b/persistence-elasticsearch/core/src/main/resources-filtered/org.apache.unomi.persistence.elasticsearch.cfg
deleted file mode 100644
index 28bf705..0000000
--- a/persistence-elasticsearch/core/src/main/resources-filtered/org.apache.unomi.persistence.elasticsearch.cfg
+++ /dev/null
@@ -1,45 +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.
-#
-
-cluster.name=${esClusterName}
-# The elasticSearchAddresses may be a comma seperated list of host names and ports such as
-# hostA:9300,hostB:9300
-# Note: the port number must be repeated for each host.
-elasticSearchAddresses=localhost:9300
-index.name=context
-monthlyIndex.numberOfShards=3
-monthlyIndex.numberOfReplicas=0
-numberOfShards=5
-numberOfReplicas=0
-defaultQueryLimit=10
-
-# The following settings control the behavior of the BulkProcessor API. You can find more information about these
-# settings and their behavior here : https://www.elastic.co/guide/en/elasticsearch/client/java-api/2.4/java-docs-bulk-processor.html
-# The values used here are the default values of the API
-bulkProcessor.name=unomi-bulk
-bulkProcessor.concurrentRequests=1
-bulkProcessor.bulkActions=1000
-bulkProcessor.bulkSize=5MB
-bulkProcessor.flushInterval=5s
-bulkProcessor.backoffPolicy=exponential
-
-# The following settings are used to perform version checks on the connected ElasticSearch cluster, to make sure that
-# appropriate versions are used. The check is performed like this :
-# for each node in the ElasticSearch cluster:
-#   minimalElasticSearchVersion <= ElasticSearch node version < maximalElasticSearchVersion
-minimalElasticSearchVersion=5.0.0
-maximalElasticSearchVersion=5.3.0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/38489fee/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg b/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
new file mode 100644
index 0000000..77eb091
--- /dev/null
+++ b/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
@@ -0,0 +1,45 @@
+#
+# 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.
+#
+
+cluster.name=contextElasticSearch
+# The elasticSearchAddresses may be a comma seperated list of host names and ports such as
+# hostA:9300,hostB:9300
+# Note: the port number must be repeated for each host.
+elasticSearchAddresses=localhost:9300
+index.name=context
+monthlyIndex.numberOfShards=3
+monthlyIndex.numberOfReplicas=0
+numberOfShards=5
+numberOfReplicas=0
+defaultQueryLimit=10
+
+# The following settings control the behavior of the BulkProcessor API. You can find more information about these
+# settings and their behavior here : https://www.elastic.co/guide/en/elasticsearch/client/java-api/2.4/java-docs-bulk-processor.html
+# The values used here are the default values of the API
+bulkProcessor.name=unomi-bulk
+bulkProcessor.concurrentRequests=1
+bulkProcessor.bulkActions=1000
+bulkProcessor.bulkSize=5MB
+bulkProcessor.flushInterval=5s
+bulkProcessor.backoffPolicy=exponential
+
+# The following settings are used to perform version checks on the connected ElasticSearch cluster, to make sure that
+# appropriate versions are used. The check is performed like this :
+# for each node in the ElasticSearch cluster:
+#   minimalElasticSearchVersion <= ElasticSearch node version < maximalElasticSearchVersion
+minimalElasticSearchVersion=5.0.0
+maximalElasticSearchVersion=5.3.0
\ No newline at end of file


[33/50] [abbrv] incubator-unomi git commit: UNOMI-101 : New feature to add the ability to import profiles

Posted by sh...@apache.org.
UNOMI-101 : New feature to add the ability to import profiles


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/89d4c8eb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/89d4c8eb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/89d4c8eb

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 89d4c8eb9646705cfd6c4bdb79fdac27ee9a5634
Parents: 0f44140
Author: Abdelkader Midani <am...@apache.org>
Authored: Tue May 23 02:30:28 2017 +0200
Committer: Abdelkader Midani <am...@apache.org>
Committed: Mon Jun 12 20:09:59 2017 +0200

----------------------------------------------------------------------
 extensions/pom.xml                              |   1 +
 extensions/router/README.md                     | 113 ++++++++++
 extensions/router/pom.xml                       |  64 ++++++
 extensions/router/router-api/pom.xml            |  43 ++++
 .../unomi/router/api/ImportConfiguration.java   | 223 +++++++++++++++++++
 .../unomi/router/api/ProfileToImport.java       |  77 +++++++
 .../services/ImportConfigurationService.java    |  60 +++++
 .../api/services/ProfileImportService.java      |  29 +++
 extensions/router/router-core/pom.xml           | 182 +++++++++++++++
 .../core/context/ProfileImportCamelContext.java | 170 ++++++++++++++
 .../core/processor/ConfigUpdateProcessor.java   |  44 ++++
 .../ImportConfigByFileNameProcessor.java        |  44 ++++
 .../core/processor/LineSplitProcessor.java      | 114 ++++++++++
 .../core/processor/UnomiStorageProcessor.java   |  46 ++++
 .../ProfileImportConfigUpdateRouteBuilder.java  |  62 ++++++
 .../ProfileImportKafkaToUnomiRouteBuilder.java  |  77 +++++++
 .../route/ProfileImportOneShotRouteBuilder.java |  99 ++++++++
 .../ProfileImportSourceToKafkaRouteBuilder.java | 120 ++++++++++
 .../resources/OSGI-INF/blueprint/blueprint.xml  |  94 ++++++++
 .../main/resources/org.apache.unomi.router.cfg  |  25 +++
 extensions/router/router-karaf-feature/pom.xml  | 157 +++++++++++++
 extensions/router/router-rest/pom.xml           |  75 +++++++
 .../ImportConfigurationServiceEndPoint.java     | 176 +++++++++++++++
 .../resources/OSGI-INF/blueprint/blueprint.xml  |  80 +++++++
 extensions/router/router-service/pom.xml        | 104 +++++++++
 .../ImportConfigurationServiceImpl.java         | 114 ++++++++++
 .../services/ProfileImportServiceImpl.java      | 121 ++++++++++
 .../resources/OSGI-INF/blueprint/blueprint.xml  |  39 ++++
 itests/pom.xml                                  |   8 +-
 package/pom.xml                                 |  11 +
 performance-tests/pom.xml                       |   4 +-
 ...g.apache.unomi.persistence.elasticsearch.cfg |   2 +-
 persistence-elasticsearch/plugins/pom.xml       |   2 +-
 samples/trainingplugin.zip                      | Bin 0 -> 48508 bytes
 samples/trainingplugin/pom.xml                  |  55 +++++
 .../training/TrainedNotificationAction.java     |  61 +++++
 .../cxs/actions/trainingNotifAction.json        |  13 ++
 .../META-INF/cxs/rules/trainedNotification.json |  20 ++
 .../resources/OSGI-INF/blueprint/blueprint.xml  |  34 +++
 39 files changed, 2755 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 7126b61..dea4bc2 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -34,6 +34,7 @@
         <module>lists-extension</module>
         <module>privacy-extension</module>
         <module>geonames</module>
+        <module>router</module>
     </modules>
 
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/README.md
----------------------------------------------------------------------
diff --git a/extensions/router/README.md b/extensions/router/README.md
new file mode 100644
index 0000000..0d382d4
--- /dev/null
+++ b/extensions/router/README.md
@@ -0,0 +1,113 @@
+<!--
+  ~ 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.
+  -->
+
+Unomi Router
+==========================
+
+## Getting started
+Unomi Router Extension a Karaf Feature that provide an Enterprise Application Integration tool.
+It is optional so you must configure it and install it in Karaf, and can be used for Machine - Machine or Human - Machine integration with Unomi.
+Mainly Unomi Router Extension aim to make it easy to import third party applications/platforms profiles into Unomi.
+This extension is implemented using Apache Camel routes and is using Apache Kafka to buffer import process and make it failsafe. 
+
+## Getting started
+1. Configure your Unomi Router:
+    In the `etc/org.apache.unomi.router.cfg` file, you might want to update the following settings:
+    Kafka settings 
+    >`#Kafka settings`
+    
+    >`kafka.host=localhost`
+    
+    >`kafka.port=9092`
+    
+    >`kafka.import.topic=camel-deposit`
+    
+    >`kafka.import.groupId=unomi-import-group`
+    
+    Kafka host and port with the topic name and the groupId ti which the topic is assigned
+    
+    >`#Import One Shot upload directory`
+    
+    >`import.oneshot.uploadDir=/tmp/unomi_oneshot_import_configs/`
+   
+    Path to the folder where unomi should stock file imported for a oneshot processing
+    
+
+2. Deploy into Apache Unomi using the following commands from the Apache Karaf shell:
+    ```sh
+    $ feature:repo-add mvn:org.apache.unomi/unomi-router-karaf-feature/${version}/xml/features
+    $ feature:install unomi-router-karaf-feature
+    ```
+    
+3. Send your import configuration:
+
+    An import configuration is nothing else than a simple JSON to describe how you want to import your data (Profiles).
+    To create/update an import configuration
+    
+    `POST /cxs/importConfiguration`
+    ```json
+     {
+         "itemId": "f57f1f86-97bf-4ba0-b4e4-7d5e77e7c0bd",
+         "itemType": "importConfig",
+         "scope": "integration",
+         "name": "Test Recurrent",
+         "description": "Just test recurrent import",
+         "configType": "recurrent",
+         "properties": {
+           "source": "{file/ftp}://{path}?fileName={file-name}.csv&move=.done&consumer.delay=20000",
+           "mapping": {
+             "firstName": 0,
+             "lastName": 1,
+             ...
+           }
+         },
+         "mergingProperty": "email",
+         "overwriteExistingProfiles": true,
+         "propertiesToOverwrite": ["firstName", "lastName"],
+         "active": true
+     }
+    ```
+    
+    Omit the `itemId` when creating new entry, `configType` can be '**recurrent**' for file/ftp/network path polling or  '**oneshot**' for one time import.
+    
+    The `properties.source` attribute is an Apache Camel endpoint uri (See http://camel.apache.org/uris.html for more details). Unomi Router is designed to use **File** and **FTP** Camel components. 
+    
+    The attribute `properties.mapping` is a Map of:
+    * Key: Profile property id in Unomi
+    * Value: Index of the column in the imported file to copy the in the previous property.
+        
+    The attribute `mergingProperty` is the profile property id in Unomi to use to check for duplication.
+    
+    The attribute `propertiesToOverwrite` is a list of profile properties ids to overwrite, if **null** all properties
+    will be overwritten.
+    
+    The attribute `active` is the flag to activate or deactivate the import configuration.
+    
+    Concerning oneshot import configuration using the previously described service will only create the import configuration, to send the file to process
+    you need to call : 
+    
+    `POST /cxs/importConfiguration/oneshot`
+    
+    `Content-Type : multipart/form-data`
+    
+    First multipart with the name '**importConfigId**' is the importConfiguration to use to import the file, second one with the name '**file**' is the file to import.
+    
+    
+   
+
+    
+    
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/router/pom.xml b/extensions/router/pom.xml
new file mode 100644
index 0000000..c69320c
--- /dev/null
+++ b/extensions/router/pom.xml
@@ -0,0 +1,64 @@
+<!--
+  ~ 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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.unomi</groupId>
+        <artifactId>unomi-extensions</artifactId>
+        <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>unomi-router</artifactId>
+    <name>Apache Unomi :: Extensions :: Router</name>
+    <description>Apache Camel Router for the Apache Unomi Context server</description>
+    <packaging>pom</packaging>
+
+    <properties>
+        <camel.version>2.18.3</camel.version>
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
+                        <Import-Package>
+                            sun.misc;resolution:=optional,
+                            *
+                        </Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <modules>
+        <module>router-api</module>
+        <module>router-service</module>
+        <module>router-core</module>
+        <module>router-rest</module>
+        <module>router-karaf-feature</module>
+    </modules>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-api/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/router/router-api/pom.xml b/extensions/router/router-api/pom.xml
new file mode 100644
index 0000000..06207b3
--- /dev/null
+++ b/extensions/router/router-api/pom.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>unomi-router</artifactId>
+        <groupId>org.apache.unomi</groupId>
+        <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>unomi-router-api</artifactId>
+    <name>Apache Unomi :: Extensions :: Router :: API</name>
+    <description>Router Specification API</description>
+    <packaging>bundle</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+            <artifactId>unomi-api</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ImportConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ImportConfiguration.java b/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ImportConfiguration.java
new file mode 100644
index 0000000..127de39
--- /dev/null
+++ b/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ImportConfiguration.java
@@ -0,0 +1,223 @@
+/*
+ * 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.unomi.router.api;
+
+import org.apache.unomi.api.Item;
+import org.apache.unomi.api.MetadataItem;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by amidani on 28/04/2017.
+ */
+public class ImportConfiguration extends Item {
+
+    /**
+     * The ImportConfiguration ITEM_TYPE
+     *
+     * @see Item for a discussion of ITEM_TYPE
+     */
+    public static final String ITEM_TYPE = "importConfig";
+    private String name;
+    private String description;
+    private String configType;
+    private Map<String, Object> properties = new HashMap<>();
+    private String mergingProperty;
+    private boolean overwriteExistingProfiles = false;
+    private List<String> propertiesToOverwrite;
+
+    private String columnSeparator = ",";
+    private String lineSeparator = "\n";
+    private boolean active = false;
+
+    /**
+     * Sets the property identified by the specified name to the specified value. If a property with that name already exists, replaces its value, otherwise adds the new
+     * property with the specified name and value.
+     *
+     * @param name  the name of the property to set
+     * @param value the value of the property
+     */
+    public void setProperty(String name, Object value) {
+        properties.put(name, value);
+    }
+
+    /**
+     * Retrieves the name of the import configuration
+     * @return the name of the import configuration
+     */
+    public String getName() { return this.name; }
+
+    /**
+     * Sets the name of the import configuration
+     * @param name the name of the import configuration
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Retrieves the description of the import configuration
+     * @return the description of the import configuration
+     */
+    public String getDescription() { return this.description; }
+
+    /**
+     * Sets the description of the import configuration
+     * @param description the description of the import configuration
+     */
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+
+    /**
+     * Retrieves the config type of the import configuration
+     * @return the config type of the import configuration
+     */
+    public String getConfigType() { return this.configType; }
+
+    /**
+     * Sets the config type of the import configuration
+     * @param configType the config type of the import configuration
+     */
+    public void setConfigType(String configType) {
+        this.configType = configType;
+    }
+
+    /**
+     * Retrieves the property identified by the specified name.
+     *
+     * @param name the name of the property to retrieve
+     * @return the value of the specified property or {@code null} if no such property exists
+     */
+    public Object getProperty(String name) {
+        return properties.get(name);
+    }
+
+    /**
+     * Retrieves a Map of all property name - value pairs for this import configuration.
+     *
+     * @return a Map of all property name - value pairs for this import configuration
+     */
+    public Map<String, Object> getProperties() {
+        return properties;
+    }
+
+    /**
+     * Sets the property name - value pairs for this import configuration.
+     *
+     * @param properties a Map containing the property name - value pairs for this import configuration
+     */
+    public void setProperties(Map<String, Object> properties) {
+        this.properties = properties;
+    }
+
+    public String getMergingProperty() {
+        return mergingProperty;
+    }
+
+    /**
+     * Sets the merging property.
+     * @param mergingProperty property used to check if the profile exist when merging
+     */
+    public void setMergingProperty(String mergingProperty) {
+        this.mergingProperty = mergingProperty;
+    }
+
+
+    /**
+     * Retrieves the import configuration active flag.
+     *
+     * @return true if the import configuration is active false if not
+     */
+    public boolean isActive() {
+        return this.active;
+    }
+
+    /**
+     * Sets the active flag true/false.
+     *
+     * @param active a boolean to set to active or inactive the import configuration
+     */
+    public void setActive(boolean active) {
+        this.active = active;
+    }
+
+    /**
+     * Retrieves the import configuration overwriteExistingProfiles flag.
+     *
+     * @return true if during the import existing profiles must be overwritten
+     */
+    public boolean isOverwriteExistingProfiles() {
+        return this.overwriteExistingProfiles;
+    }
+
+    /**
+     * Sets the overwriteExistingProfiles flag true/false.
+     *
+     * @param overwriteExistingProfiles a boolean to set overwriteExistingProfiles in the import configuration
+     */
+    public void setOverwriteExistingProfiles(boolean overwriteExistingProfiles) {
+        this.overwriteExistingProfiles = overwriteExistingProfiles;
+    }
+
+    public List<String> getPropertiesToOverwrite() {
+        return propertiesToOverwrite;
+    }
+
+    public void setPropertiesToOverwrite(List<String> propertiesToOverwrite) {
+        this.propertiesToOverwrite = propertiesToOverwrite;
+    }
+
+    /**
+     * gets the column separator.
+     */
+    public String getColumnSeparator() {
+        return this.columnSeparator;
+    }
+
+    /**
+     * Sets the column separator.
+     * @param columnSeparator property used to specify a line separator. Defaults to ','
+     */
+    public void setColumnSeparator(String columnSeparator) {
+        if(this.columnSeparator !=null) {
+            this.columnSeparator = columnSeparator;
+        }
+    }
+
+    /**
+     * gets the line separator.
+     */
+    public String getLineSeparator() {
+        return this.lineSeparator;
+    }
+
+    /**
+     * Sets the line separator.
+     * @param lineSeparator property used to specify a line separator. Defaults to '\n'
+     */
+    public void setLineSeparator(String lineSeparator) {
+        if(lineSeparator != null) {
+            this.lineSeparator = lineSeparator;
+        }
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ProfileToImport.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ProfileToImport.java b/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ProfileToImport.java
new file mode 100644
index 0000000..30e40e0
--- /dev/null
+++ b/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ProfileToImport.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.unomi.router.api;
+
+import org.apache.unomi.api.Profile;
+
+import java.util.List;
+
+/**
+ * An extension of {@link Profile} to handle merge strategy and deletion when importing profiles
+ */
+public class ProfileToImport extends Profile {
+
+    private List<String> propertiesToOverwrite;
+    private String mergingProperty;
+    private boolean profileToDelete;
+    private boolean overwriteExistingProfiles;
+
+
+    public List<String> getPropertiesToOverwrite() {
+        return this.propertiesToOverwrite;
+    }
+
+    public void setPropertiesToOverwrite(List<String> propertiesToOverwrite) {
+        this.propertiesToOverwrite = propertiesToOverwrite;
+    }
+
+    public boolean isProfileToDelete() {
+        return this.profileToDelete;
+    }
+
+    public void setProfileToDelete(boolean profileToDelete) {
+        this.profileToDelete = profileToDelete;
+    }
+
+    public boolean isOverwriteExistingProfiles() {
+        return this.overwriteExistingProfiles;
+    }
+
+    /**
+     * Sets the overwriteExistingProfiles flag.
+     * @param overwriteExistingProfiles flag used to specify if we want to overwrite existing profiles
+     */
+    public void setOverwriteExistingProfiles(boolean overwriteExistingProfiles) {
+        this.overwriteExistingProfiles = overwriteExistingProfiles;
+    }
+
+    public String getMergingProperty() {
+        return this.mergingProperty;
+    }
+
+    /**
+     * Sets the merging property.
+     * @param mergingProperty property used to check if the profile exist when merging
+     */
+    public void setMergingProperty(String mergingProperty) {
+        this.mergingProperty = mergingProperty;
+    }
+
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/services/ImportConfigurationService.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/services/ImportConfigurationService.java b/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/services/ImportConfigurationService.java
new file mode 100644
index 0000000..cacd671
--- /dev/null
+++ b/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/services/ImportConfigurationService.java
@@ -0,0 +1,60 @@
+/*
+ * 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.unomi.router.api.services;
+
+import org.apache.unomi.router.api.ImportConfiguration;
+
+import java.util.List;
+
+/**
+ * A service to access and operate on {@link ImportConfiguration}s.
+ */
+public interface ImportConfigurationService {
+
+    /**
+     * Retrieves all the import configurations.
+     *
+     * @return the list of import configurations
+     */
+    public List<ImportConfiguration> getImportConfigurations();
+
+    /**
+     * Retrieves the import configuration identified by the specified identifier.
+     *
+     * @param configId the identifier of the profile to retrieve
+     * @return the import configuration identified by the specified identifier or
+     *  {@code null} if no such import configuration exists
+     */
+    public ImportConfiguration load(String configId);
+
+    /**
+     * Saves the specified import configuration in the context server.
+     *
+     * @param profile the import configuration to be saved
+     * @return the newly saved import configuration
+     */
+    public ImportConfiguration save(ImportConfiguration profile);
+
+    /**
+     * Deletes the import configuration identified by the specified identifier.
+     *
+     * @param configId the identifier of the import configuration to delete
+     */
+    public void delete(String configId);
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/services/ProfileImportService.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/services/ProfileImportService.java b/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/services/ProfileImportService.java
new file mode 100644
index 0000000..aa7d182
--- /dev/null
+++ b/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/services/ProfileImportService.java
@@ -0,0 +1,29 @@
+/*
+ * 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.unomi.router.api.services;
+
+import org.apache.unomi.router.api.ProfileToImport;
+
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * Created by amidani on 20/05/2017.
+ */
+public interface ProfileImportService {
+
+    boolean saveMergeDeleteImportedProfile(ProfileToImport profileToImport) throws InvocationTargetException, IllegalAccessException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-core/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/pom.xml b/extensions/router/router-core/pom.xml
new file mode 100644
index 0000000..53780e7
--- /dev/null
+++ b/extensions/router/router-core/pom.xml
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>unomi-router</artifactId>
+        <groupId>org.apache.unomi</groupId>
+        <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>unomi-router-core</artifactId>
+    <name>Apache Unomi :: Extensions :: Router :: Core</name>
+    <description>Router Core (Apache Camel Routes)</description>
+    <packaging>bundle</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+            <artifactId>unomi-api</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+            <artifactId>unomi-services</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+            <artifactId>unomi-router-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-core</artifactId>
+            <version>${camel.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-jackson</artifactId>
+            <version>${camel.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-http-common</artifactId>
+            <version>${camel.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-servlet</artifactId>
+            <version>${camel.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-kafka</artifactId>
+            <version>${camel.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>commons-net</groupId>
+            <artifactId>commons-net</artifactId>
+            <version>3.5</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.servicemix.bundles</groupId>
+            <artifactId>org.apache.servicemix.bundles.jsch</artifactId>
+            <version>0.1.54_1</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.kafka</groupId>
+            <artifactId>kafka-clients</artifactId>
+            <version>0.10.1.0</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
+                        <Import-Package>
+                            org.osgi.service.event;resolution:=optional,
+                            org.apache.camel,
+                            org.apache.camel.builder,
+                            org.apache.camel.component.file.remote,
+                            org.apache.camel.component.file,
+                            org.apache.camel.component.jackson,
+                            org.apache.camel.component.kafka,
+                            org.apache.camel.component.servlet,
+                            org.apache.camel.component.servlet.osgi,
+                            org.apache.camel.impl,
+                            org.apache.camel.model,
+                            org.apache.camel.model.dataformat,
+                            org.apache.camel.model.rest,
+                            org.apache.camel.spi,
+                            org.apache.unomi.api,
+                            org.apache.unomi.router.api,
+                            org.apache.unomi.api.services,
+                            org.apache.unomi.router.api.services,
+                            org.apache.kafka.clients.producer;resolution:=optional,
+                            org.apache.kafka.clients.consumer;resolution:=optional,
+                            com.jcraft.jsch,
+                            org.osgi.framework,
+                            org.osgi.service.http,
+                            org.slf4j
+                        </Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>attach-artifacts</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>attach-artifact</goal>
+                        </goals>
+                        <configuration>
+                            <artifacts>
+                                <artifact>
+                                    <file>
+                                        src/main/resources/org.apache.unomi.router.cfg
+                                    </file>
+                                    <type>cfg</type>
+                                    <classifier>routercfg</classifier>
+                                </artifact>
+                            </artifacts>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java
new file mode 100644
index 0000000..df734d3
--- /dev/null
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java
@@ -0,0 +1,170 @@
+/*
+ * 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.unomi.router.core.context;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Route;
+import org.apache.camel.component.jackson.JacksonDataFormat;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.unomi.router.api.ImportConfiguration;
+import org.apache.unomi.router.api.services.ImportConfigurationService;
+import org.apache.unomi.router.core.processor.ImportConfigByFileNameProcessor;
+import org.apache.unomi.router.core.processor.UnomiStorageProcessor;
+import org.apache.unomi.router.core.route.ProfileImportKafkaToUnomiRouteBuilder;
+import org.apache.unomi.router.core.route.ProfileImportOneShotRouteBuilder;
+import org.apache.unomi.router.core.route.ProfileImportSourceToKafkaRouteBuilder;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.SynchronousBundleListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Created by amidani on 04/05/2017.
+ */
+public class ProfileImportCamelContext implements SynchronousBundleListener {
+
+    private Logger logger = LoggerFactory.getLogger(ProfileImportCamelContext.class.getName());
+
+    private CamelContext camelContext;
+    private UnomiStorageProcessor unomiStorageProcessor;
+    private ImportConfigByFileNameProcessor importConfigByFileNameProcessor;
+    private ImportConfigurationService importConfigurationService;
+    private JacksonDataFormat jacksonDataFormat;
+    private String uploadDir;
+    private Map<String, String> kafkaProps;
+
+    private final String IMPORT_CONFIG_TYPE_RECURRENT = "recurrent";
+
+    private BundleContext bundleContext;
+
+    public void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
+
+    public void initCamelContext() throws Exception {
+        logger.info("Initialize Camel Context...");
+        camelContext = new DefaultCamelContext();
+        List<ImportConfiguration> importConfigurationList = importConfigurationService.getImportConfigurations();
+        ProfileImportSourceToKafkaRouteBuilder builderReader = new ProfileImportSourceToKafkaRouteBuilder(kafkaProps);
+        builderReader.setImportConfigurationList(importConfigurationList);
+        builderReader.setJacksonDataFormat(jacksonDataFormat);
+        builderReader.setContext(camelContext);
+        camelContext.addRoutes(builderReader);
+
+        //One shot import route
+        ProfileImportOneShotRouteBuilder builderOneShot = new ProfileImportOneShotRouteBuilder(kafkaProps);
+        builderOneShot.setImportConfigByFileNameProcessor(importConfigByFileNameProcessor);
+        builderOneShot.setJacksonDataFormat(jacksonDataFormat);
+        builderOneShot.setUploadDir(uploadDir);
+        builderOneShot.setContext(camelContext);
+        camelContext.addRoutes(builderOneShot);
+
+
+        ProfileImportKafkaToUnomiRouteBuilder builderProcessor = new ProfileImportKafkaToUnomiRouteBuilder(kafkaProps);
+        builderProcessor.setUnomiStorageProcessor(unomiStorageProcessor);
+        builderProcessor.setJacksonDataFormat(jacksonDataFormat);
+        builderProcessor.setContext(camelContext);
+        camelContext.addRoutes(builderProcessor);
+
+        camelContext.start();
+
+        logger.debug("postConstruct {" + bundleContext.getBundle() + "}");
+
+        processBundleStartup(bundleContext);
+        for (Bundle bundle : bundleContext.getBundles()) {
+            if (bundle.getBundleContext() != null) {
+                processBundleStartup(bundle.getBundleContext());
+            }
+        }
+        bundleContext.addBundleListener(this);
+        logger.info("Camel Context {} initialized successfully.");
+
+    }
+
+    private boolean stopRoute(String routeId) throws Exception {
+        return camelContext.stopRoute(routeId, 10L, TimeUnit.SECONDS, true);
+    }
+
+    public void updateProfileImportReaderRoute(ImportConfiguration importConfiguration) throws Exception {
+        Route route = camelContext.getRoute(importConfiguration.getItemId());
+        if(route!=null && stopRoute(importConfiguration.getItemId())) {
+            camelContext.removeRoute(importConfiguration.getItemId());
+        }
+        //Handle transforming an import config oneshot <--> recurrent
+        if(IMPORT_CONFIG_TYPE_RECURRENT.equals(importConfiguration.getConfigType())){
+            ProfileImportSourceToKafkaRouteBuilder builder = new ProfileImportSourceToKafkaRouteBuilder(kafkaProps);
+            builder.setImportConfigurationList(Arrays.asList(importConfiguration));
+            builder.setJacksonDataFormat(jacksonDataFormat);
+            builder.setContext(camelContext);
+            camelContext.addRoutes(builder);
+        }
+    }
+
+    public CamelContext getCamelContext() {
+        return camelContext;
+    }
+
+    public void setUnomiStorageProcessor(UnomiStorageProcessor unomiStorageProcessor) {
+        this.unomiStorageProcessor = unomiStorageProcessor;
+    }
+
+    public void setImportConfigByFileNameProcessor(ImportConfigByFileNameProcessor importConfigByFileNameProcessor) {
+        this.importConfigByFileNameProcessor = importConfigByFileNameProcessor;
+    }
+
+    public void setImportConfigurationService(ImportConfigurationService importConfigurationService) {
+        this.importConfigurationService = importConfigurationService;
+    }
+
+    public void setJacksonDataFormat(JacksonDataFormat jacksonDataFormat) {
+        this.jacksonDataFormat = jacksonDataFormat;
+    }
+
+    public void setUploadDir(String uploadDir) {
+        this.uploadDir = uploadDir;
+    }
+
+    public void setKafkaProps(Map<String, String> kafkaProps) {
+        this.kafkaProps = kafkaProps;
+    }
+
+    public void preDestroy() throws Exception {
+        bundleContext.removeBundleListener(this);
+        //This is to shutdown Camel context
+        //(will stop all routes/components/endpoints etc and clear internal state/cache)
+        this.camelContext.stop();
+        logger.info("Camel context for profile import is shutdown.");
+    }
+
+    private void processBundleStartup(BundleContext bundleContext) {
+        if (bundleContext == null) {
+            return;
+        }
+    }
+
+    @Override
+    public void bundleChanged(BundleEvent bundleEvent) {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ConfigUpdateProcessor.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ConfigUpdateProcessor.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ConfigUpdateProcessor.java
new file mode 100644
index 0000000..e4eaa19
--- /dev/null
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ConfigUpdateProcessor.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.unomi.router.core.processor;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.Processor;
+import org.apache.unomi.router.api.ImportConfiguration;
+import org.apache.unomi.router.core.context.ProfileImportCamelContext;
+
+/**
+ * Created by amidani on 10/05/2017.
+ */
+public class ConfigUpdateProcessor implements Processor{
+
+    private ProfileImportCamelContext profileImportCamelContext;
+
+    @Override
+    public void process(Exchange exchange) throws Exception {
+        if (exchange.getIn() != null) {
+            Message message = exchange.getIn();
+            ImportConfiguration importConfiguration = message.getBody(ImportConfiguration.class);
+            profileImportCamelContext.updateProfileImportReaderRoute(importConfiguration);
+        }
+    }
+
+    public void setProfileImportCamelContext(ProfileImportCamelContext profileImportCamelContext) {
+        this.profileImportCamelContext = profileImportCamelContext;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ImportConfigByFileNameProcessor.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ImportConfigByFileNameProcessor.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ImportConfigByFileNameProcessor.java
new file mode 100644
index 0000000..7fc7730
--- /dev/null
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ImportConfigByFileNameProcessor.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.unomi.router.core.processor;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.component.file.GenericFile;
+import org.apache.unomi.router.api.ImportConfiguration;
+import org.apache.unomi.router.api.services.ImportConfigurationService;
+
+/**
+ * Created by amidani on 22/05/2017.
+ */
+public class ImportConfigByFileNameProcessor implements Processor{
+
+    private ImportConfigurationService importConfigurationService;
+
+    @Override
+    public void process(Exchange exchange) throws Exception {
+
+        String fileName = exchange.getIn().getBody(GenericFile.class).getFileName();
+        String importConfigId = fileName.substring(0, fileName.indexOf('.'));
+        ImportConfiguration importConfiguration = importConfigurationService.load(importConfigId);
+        exchange.getIn().setHeader("importConfigOneShot", importConfiguration);
+    }
+
+    public void setImportConfigurationService(ImportConfigurationService importConfigurationService) {
+        this.importConfigurationService = importConfigurationService;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitProcessor.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitProcessor.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitProcessor.java
new file mode 100644
index 0000000..150ef6d
--- /dev/null
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitProcessor.java
@@ -0,0 +1,114 @@
+/*
+ * 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.unomi.router.core.processor;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.component.kafka.KafkaConstants;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.unomi.router.api.ImportConfiguration;
+import org.apache.unomi.router.api.ProfileToImport;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * Created by amidani on 29/12/2016.
+ */
+public class LineSplitProcessor implements Processor {
+
+    private Map<String, Integer> fieldsMapping;
+    private List<String> propertiesToOverwrite;
+    private String mergingProperty;
+    private boolean overwriteExistingProfiles;
+    private String columnSeparator;
+
+    @Override
+    public void process(Exchange exchange) throws Exception {
+        //In case of one shot import we check the header and overwrite import config
+        ImportConfiguration importConfigOneShot = (ImportConfiguration) exchange.getIn().getHeader("importConfigOneShot");
+        if(importConfigOneShot!=null) {
+            fieldsMapping = (Map<String, Integer>)importConfigOneShot.getProperties().get("mapping");
+            propertiesToOverwrite = importConfigOneShot.getPropertiesToOverwrite();
+            mergingProperty = importConfigOneShot.getMergingProperty();
+            overwriteExistingProfiles = importConfigOneShot.isOverwriteExistingProfiles();
+            columnSeparator = importConfigOneShot.getColumnSeparator();
+        }
+        String[] profileData = ((String)exchange.getIn().getBody()).split(columnSeparator);
+        ProfileToImport profileToImport = new ProfileToImport();
+        profileToImport.setItemId(UUID.randomUUID().toString());
+        profileToImport.setItemType("profile");
+        profileToImport.setScope("system");
+        if(profileData.length > 0) {
+            Map<String, Object> properties = new HashMap<>();
+            for(String fieldMappingKey : fieldsMapping.keySet()) {
+                if(profileData.length > fieldsMapping.get(fieldMappingKey)) {
+                    properties.put(fieldMappingKey, profileData[fieldsMapping.get(fieldMappingKey)].trim());
+                }
+            }
+            profileToImport.setProperties(properties);
+            profileToImport.setMergingProperty(mergingProperty);
+            profileToImport.setPropertiesToOverwrite(propertiesToOverwrite);
+            profileToImport.setOverwriteExistingProfiles(overwriteExistingProfiles);
+            if(StringUtils.isNotBlank(profileData[profileData.length - 1]) && Boolean.parseBoolean(profileData[profileData.length - 1].trim())) {
+                profileToImport.setProfileToDelete(true);
+            }
+        }
+        exchange.getIn().setBody(profileToImport, ProfileToImport.class);
+        exchange.getIn().setHeader(KafkaConstants.PARTITION_KEY, 0);
+        exchange.getIn().setHeader(KafkaConstants.KEY, "1");
+    }
+
+    /**
+     * Setter of fieldsMapping
+     * @param fieldsMapping map String,Integer fieldName in ES and the matching column index in the import file
+     */
+    public void setFieldsMapping(Map<String, Integer> fieldsMapping) {
+        this.fieldsMapping = fieldsMapping;
+    }
+
+    public void setPropertiesToOverwrite(List<String> propertiesToOverwrite) {
+        this.propertiesToOverwrite = propertiesToOverwrite;
+    }
+
+    public void setOverwriteExistingProfiles(boolean overwriteExistingProfiles) {
+        this.overwriteExistingProfiles = overwriteExistingProfiles;
+    }
+
+    public String getMergingProperty() {
+        return this.mergingProperty;
+    }
+
+    /**
+     * Sets the merging property.
+     * @param mergingProperty property used to check if the profile exist when merging
+     */
+    public void setMergingProperty(String mergingProperty) {
+        this.mergingProperty = mergingProperty;
+    }
+
+    /**
+     * Sets the line separator.
+     * @param columnSeparator property used to specify a line separator. Defaults to ','
+     */
+    public void setColumnSeparator(String columnSeparator) {
+        this.columnSeparator = columnSeparator;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/UnomiStorageProcessor.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/UnomiStorageProcessor.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/UnomiStorageProcessor.java
new file mode 100644
index 0000000..7e55185
--- /dev/null
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/UnomiStorageProcessor.java
@@ -0,0 +1,46 @@
+/*
+ * 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.unomi.router.core.processor;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.Processor;
+import org.apache.unomi.router.api.ProfileToImport;
+import org.apache.unomi.router.api.services.ProfileImportService;
+
+/**
+ * Created by amidani on 29/12/2016.
+ */
+public class UnomiStorageProcessor implements Processor {
+
+    private ProfileImportService profileImportService;
+
+    @Override
+    public void process(Exchange exchange)
+            throws Exception {
+        if (exchange.getIn() != null) {
+            Message message = exchange.getIn();
+
+            ProfileToImport profileToImport = (ProfileToImport) message.getBody();
+            profileImportService.saveMergeDeleteImportedProfile(profileToImport);
+        }
+    }
+
+    public void setProfileImportService(ProfileImportService profileImportService) {
+        this.profileImportService = profileImportService;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportConfigUpdateRouteBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportConfigUpdateRouteBuilder.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportConfigUpdateRouteBuilder.java
new file mode 100644
index 0000000..40575d5
--- /dev/null
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportConfigUpdateRouteBuilder.java
@@ -0,0 +1,62 @@
+/*
+ * 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.unomi.router.core.route;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.rest.RestBindingMode;
+import org.apache.unomi.router.api.ImportConfiguration;
+import org.apache.unomi.router.core.context.ProfileImportCamelContext;
+import org.apache.unomi.router.core.processor.ConfigUpdateProcessor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Created by amidani on 10/05/2017.
+ */
+public class ProfileImportConfigUpdateRouteBuilder extends RouteBuilder {
+
+    private static final Logger logger = LoggerFactory.getLogger(ProfileImportConfigUpdateRouteBuilder.class.getName());
+
+    private ProfileImportCamelContext profileImportCamelContext;
+
+    @Override
+    public void configure() throws Exception {
+        logger.info("Preparing REST Configuration for servlet with context path [/importConfigAdmin]");
+        restConfiguration().component("servlet")
+                .contextPath("/importConfigAdmin")
+                .enableCORS(false)
+                .bindingMode(RestBindingMode.json)
+                .dataFormatProperty("prettyPrint", "true");
+
+        rest().put("/").consumes("application/json").type(ImportConfiguration.class)
+                .to("direct:importConfigRestDeposit");
+        ConfigUpdateProcessor profileImportConfigUpdateProcessor = new ConfigUpdateProcessor();
+        profileImportConfigUpdateProcessor.setProfileImportCamelContext(profileImportCamelContext);
+        from("direct:importConfigRestDeposit")
+                .process(profileImportConfigUpdateProcessor)
+                .transform().constant("Success.")
+                .onException(Exception.class)
+                .transform().constant("Failure!");
+
+
+    }
+
+    public void setProfileImportCamelContext(ProfileImportCamelContext profileImportCamelContext) {
+        this.profileImportCamelContext = profileImportCamelContext;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportKafkaToUnomiRouteBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportKafkaToUnomiRouteBuilder.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportKafkaToUnomiRouteBuilder.java
new file mode 100644
index 0000000..1b056fe
--- /dev/null
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportKafkaToUnomiRouteBuilder.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.unomi.router.core.route;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jackson.JacksonDataFormat;
+import org.apache.camel.component.kafka.KafkaComponent;
+import org.apache.camel.component.kafka.KafkaConfiguration;
+import org.apache.camel.component.kafka.KafkaEndpoint;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.unomi.router.core.processor.UnomiStorageProcessor;
+
+import java.util.Map;
+
+/**
+ * Created by amidani on 26/04/2017.
+ */
+public class ProfileImportKafkaToUnomiRouteBuilder extends RouteBuilder {
+
+    private UnomiStorageProcessor unomiStorageProcessor;
+    private JacksonDataFormat jacksonDataFormat;
+    private String kafkaHost;
+    private String kafkaPort;
+    private String kafkaImportTopic;
+    private String kafkaImportGroupId;
+
+    public ProfileImportKafkaToUnomiRouteBuilder(Map<String, String> kafkaProps) {
+        kafkaHost = kafkaProps.get("kafkaHost");
+        kafkaPort = kafkaProps.get("kafkaPort");
+        kafkaImportTopic = kafkaProps.get("kafkaImportTopic");
+        kafkaImportGroupId = kafkaProps.get("kafkaImportGroupId");
+    }
+
+    @Override
+    public void configure() throws Exception {
+
+        StringBuilder kafkaUri = new StringBuilder("kafka:");
+        kafkaUri.append(kafkaHost).append(":").append(kafkaPort).append("?topic=").append(kafkaImportTopic);
+        if(StringUtils.isNotBlank(kafkaImportGroupId)) {
+            kafkaUri.append("&groupId="+kafkaImportGroupId);
+        }
+        kafkaUri.append("&autoCommitEnable=true&consumersCount=10");
+        KafkaConfiguration kafkaConfiguration = new KafkaConfiguration();
+        kafkaConfiguration.setBrokers(kafkaHost+":"+kafkaPort);
+        kafkaConfiguration.setTopic(kafkaImportTopic);
+        kafkaConfiguration.setGroupId(kafkaImportGroupId);
+        KafkaEndpoint endpoint = new KafkaEndpoint(kafkaUri.toString(), new KafkaComponent(this.getContext()));
+        endpoint.setConfiguration(kafkaConfiguration);
+        from(endpoint)
+                .unmarshal(jacksonDataFormat)
+                .process(unomiStorageProcessor)
+                .to("log:org.apache.unomi.router?level=INFO");
+
+    }
+
+    public void setUnomiStorageProcessor(UnomiStorageProcessor unomiStorageProcessor) {
+        this.unomiStorageProcessor = unomiStorageProcessor;
+    }
+
+    public void setJacksonDataFormat(JacksonDataFormat jacksonDataFormat) {
+        this.jacksonDataFormat = jacksonDataFormat;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportOneShotRouteBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportOneShotRouteBuilder.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportOneShotRouteBuilder.java
new file mode 100644
index 0000000..d095f3e
--- /dev/null
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportOneShotRouteBuilder.java
@@ -0,0 +1,99 @@
+/*
+ * 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.unomi.router.core.route;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jackson.JacksonDataFormat;
+import org.apache.camel.component.kafka.KafkaComponent;
+import org.apache.camel.component.kafka.KafkaConfiguration;
+import org.apache.camel.component.kafka.KafkaEndpoint;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.unomi.router.core.processor.ImportConfigByFileNameProcessor;
+import org.apache.unomi.router.core.processor.LineSplitProcessor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+
+/**
+ * Created by amidani on 22/05/2017.
+ */
+public class ProfileImportOneShotRouteBuilder extends RouteBuilder {
+
+    private Logger logger = LoggerFactory.getLogger(ProfileImportOneShotRouteBuilder.class.getName());
+
+    private ImportConfigByFileNameProcessor importConfigByFileNameProcessor;
+    private JacksonDataFormat jacksonDataFormat;
+    private String uploadDir;
+    private String kafkaHost;
+    private String kafkaPort;
+    private String kafkaImportTopic;
+    private String kafkaImportGroupId;
+
+    private final String IMPORT_ONESHOT_ROUTE_ID = "ONE_SHOT_ROUTE";
+
+    public ProfileImportOneShotRouteBuilder(Map<String, String> kafkaProps) {
+        kafkaHost = kafkaProps.get("kafkaHost");
+        kafkaPort = kafkaProps.get("kafkaPort");
+        kafkaImportTopic = kafkaProps.get("kafkaImportTopic");
+        kafkaImportGroupId = kafkaProps.get("kafkaImportGroupId");
+    }
+
+    @Override
+    public void configure() throws Exception {
+
+        //Prepare Kafka Deposit
+        StringBuilder kafkaUri = new StringBuilder("kafka:");
+        kafkaUri.append(kafkaHost).append(":").append(kafkaPort).append("?topic=").append(kafkaImportTopic);
+        if(StringUtils.isNotBlank(kafkaImportGroupId)) {
+            kafkaUri.append("&groupId="+ kafkaImportGroupId);
+        }
+
+        KafkaConfiguration kafkaConfiguration = new KafkaConfiguration();
+        kafkaConfiguration.setBrokers(kafkaHost+":"+kafkaPort);
+        kafkaConfiguration.setTopic(kafkaImportTopic);
+        kafkaConfiguration.setGroupId(kafkaImportGroupId);
+        KafkaEndpoint endpoint = new KafkaEndpoint(kafkaUri.toString(), new KafkaComponent(this.getContext()));
+        endpoint.setConfiguration(kafkaConfiguration);
+
+        LineSplitProcessor lineSplitProcessor = new LineSplitProcessor();
+
+
+        from("file://"+uploadDir+"?include=.*.csv&consumer.delay=1m")
+                .routeId(IMPORT_ONESHOT_ROUTE_ID)
+                .autoStartup(true)
+                .process(importConfigByFileNameProcessor)
+                .split(bodyAs(String.class).tokenize("${in.header.importConfigOneShot.getLineSeparator}"))
+                .process(lineSplitProcessor)
+                .to("log:org.apache.unomi.router?level=INFO")
+                .marshal(jacksonDataFormat)
+                .convertBodyTo(String.class)
+                .to(endpoint);
+    }
+
+    public void setImportConfigByFileNameProcessor(ImportConfigByFileNameProcessor importConfigByFileNameProcessor) {
+        this.importConfigByFileNameProcessor = importConfigByFileNameProcessor;
+    }
+
+    public void setUploadDir(String uploadDir) {
+        this.uploadDir = uploadDir;
+    }
+
+    public void setJacksonDataFormat(JacksonDataFormat jacksonDataFormat) {
+        this.jacksonDataFormat = jacksonDataFormat;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportSourceToKafkaRouteBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportSourceToKafkaRouteBuilder.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportSourceToKafkaRouteBuilder.java
new file mode 100644
index 0000000..37ae59e
--- /dev/null
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportSourceToKafkaRouteBuilder.java
@@ -0,0 +1,120 @@
+/*
+ * 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.unomi.router.core.route;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jackson.JacksonDataFormat;
+import org.apache.camel.component.kafka.KafkaComponent;
+import org.apache.camel.component.kafka.KafkaConfiguration;
+import org.apache.camel.component.kafka.KafkaEndpoint;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.unomi.router.api.ImportConfiguration;
+import org.apache.unomi.router.core.processor.LineSplitProcessor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by amidani on 26/04/2017.
+ */
+
+public class ProfileImportSourceToKafkaRouteBuilder extends RouteBuilder {
+
+    private static final Logger logger = LoggerFactory.getLogger(ProfileImportSourceToKafkaRouteBuilder.class.getName());
+
+    private List<ImportConfiguration> importConfigurationList;
+    private JacksonDataFormat jacksonDataFormat;
+    private String kafkaHost;
+    private String kafkaPort;
+    private String kafkaImportTopic;
+    private String kafkaImportGroupId;
+
+    public ProfileImportSourceToKafkaRouteBuilder(Map<String, String> kafkaProps) {
+        kafkaHost = kafkaProps.get("kafkaHost");
+        kafkaPort = kafkaProps.get("kafkaPort");
+        kafkaImportTopic = kafkaProps.get("kafkaImportTopic");
+        kafkaImportGroupId = kafkaProps.get("kafkaImportGroupId");
+    }
+
+    @Override
+    public void configure() throws Exception {
+        //Prepare Kafka Deposit
+        StringBuilder kafkaUri = new StringBuilder("kafka:");
+        kafkaUri.append(kafkaHost).append(":").append(kafkaPort).append("?topic=").append(kafkaImportTopic);
+        if(StringUtils.isNotBlank(kafkaImportGroupId)) {
+            kafkaUri.append("&groupId="+ kafkaImportGroupId);
+        }
+
+        KafkaConfiguration kafkaConfiguration = new KafkaConfiguration();
+        kafkaConfiguration.setBrokers(kafkaHost+":"+kafkaPort);
+        kafkaConfiguration.setTopic(kafkaImportTopic);
+        kafkaConfiguration.setGroupId(kafkaImportGroupId);
+        KafkaEndpoint endpoint = new KafkaEndpoint(kafkaUri.toString(), new KafkaComponent(this.getContext()));
+        endpoint.setConfiguration(kafkaConfiguration);
+
+        //Loop on multiple import configuration
+        for(ImportConfiguration importConfiguration : importConfigurationList) {
+            if(importConfiguration.getProperties().size() > 0 &&
+                    StringUtils.isNotEmpty((String) importConfiguration.getProperties().get("source"))) {
+                //Prepare Split Processor
+                LineSplitProcessor lineSplitProcessor = new LineSplitProcessor();
+                lineSplitProcessor.setFieldsMapping((Map<String, Integer>) importConfiguration.getProperties().get("mapping"));
+                lineSplitProcessor.setOverwriteExistingProfiles(importConfiguration.isOverwriteExistingProfiles());
+                lineSplitProcessor.setPropertiesToOverwrite(importConfiguration.getPropertiesToOverwrite());
+                lineSplitProcessor.setMergingProperty(importConfiguration.getMergingProperty());
+                lineSplitProcessor.setColumnSeparator(importConfiguration.getColumnSeparator());
+
+                from((String) importConfiguration.getProperties().get("source"))
+                        .routeId(importConfiguration.getItemId())// This allow identification of the route for manual start/stop
+                        .autoStartup(importConfiguration.isActive())// Auto-start if the import configuration is set active
+                        .split(bodyAs(String.class).tokenize(importConfiguration.getLineSeparator()))
+                        .process(lineSplitProcessor)
+                        .to("log:org.apache.unomi.router?level=INFO")
+                        .marshal(jacksonDataFormat)
+                        .convertBodyTo(String.class)
+                        .to(endpoint);
+            }
+        }
+    }
+
+    public void setImportConfigurationList(List<ImportConfiguration> importConfigurationList) {
+        this.importConfigurationList = importConfigurationList;
+    }
+
+    public void setJacksonDataFormat(JacksonDataFormat jacksonDataFormat) {
+        this.jacksonDataFormat = jacksonDataFormat;
+    }
+
+    public void setKafkaHost(String kafkaHost) {
+        this.kafkaHost = kafkaHost;
+    }
+
+    public void setKafkaPort(String kafkaPort) {
+        this.kafkaPort = kafkaPort;
+    }
+
+    public void setKafkaImportTopic(String kafkaImportTopic) {
+        this.kafkaImportTopic = kafkaImportTopic;
+    }
+
+    public void setKafkaImportGroupId(String kafkaImportGroupId) {
+        this.kafkaImportGroupId = kafkaImportGroupId;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/extensions/router/router-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100644
index 0000000..4c36b9e
--- /dev/null
+++ b/extensions/router/router-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
+           xmlns:camel="http://camel.apache.org/schema/blueprint"
+           xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
+                               http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
+                               http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
+
+    <cm:property-placeholder persistent-id="org.apache.unomi.router" update-strategy="reload">
+        <cm:default-properties>
+            <cm:property name="kafka.host" value="localhost"/>
+            <cm:property name="kafka.port" value="9092"/>
+            <cm:property name="kafka.import.topic" value="camel-deposit"/>
+            <cm:property name="kafka.import.groupId" value="unomi-import-group"/>
+            <cm:property name="import.oneshot.uploadDir" value="/tmp/oneshot_import_configs/"/>
+        </cm:default-properties>
+    </cm:property-placeholder>
+
+    <bean id="unomiStorageProcessor" class="org.apache.unomi.router.core.processor.UnomiStorageProcessor">
+        <property name="profileImportService" ref="profileImportService"/>
+    </bean>
+
+    <bean id="importConfigByFileNameProcessor" class="org.apache.unomi.router.core.processor.ImportConfigByFileNameProcessor">
+        <property name="importConfigurationService" ref="importConfigurationService"/>
+    </bean>
+
+    <bean id="jacksonDataFormat" class="org.apache.camel.component.jackson.JacksonDataFormat">
+        <property name="unmarshalType" value="org.apache.unomi.router.api.ProfileToImport"/>
+    </bean>
+
+    <bean id="jacksonDataFormatImportConfig" class="org.apache.camel.model.dataformat.JsonDataFormat">
+        <property name="unmarshalType" value="org.apache.unomi.router.api.ImportConfiguration"/>
+        <property name="library" value="Jackson"/>
+    </bean>
+
+    <bean class="org.apache.camel.component.servlet.osgi.OsgiServletRegisterer"
+          init-method="register"
+          destroy-method="unregister">
+        <property name="alias" value="/importConfigAdmin"/>
+        <property name="httpService" ref="httpService"/>
+        <property name="servlet" ref="camelServlet"/>
+    </bean>
+
+    <bean id="camelServlet" class="org.apache.camel.component.servlet.CamelHttpTransportServlet"/>
+
+
+    <bean id="camelContext" class="org.apache.unomi.router.core.context.ProfileImportCamelContext"
+          init-method="initCamelContext" destroy-method="preDestroy">
+        <property name="kafkaProps">
+            <map>
+                <entry key="kafkaHost" value="${kafka.host}"/>
+                <entry key="kafkaPort" value="${kafka.port}"/>
+                <entry key="kafkaImportTopic" value="${kafka.import.topic}"/>
+                <entry key="kafkaImportGroupId" value="${kafka.import.groupId}"/>
+            </map>
+        </property>
+        <property name="uploadDir" value="${import.oneshot.uploadDir}"/>
+        <property name="unomiStorageProcessor" ref="unomiStorageProcessor"/>
+        <property name="importConfigByFileNameProcessor" ref="importConfigByFileNameProcessor"/>
+        <property name="importConfigurationService" ref="importConfigurationService"/>
+        <property name="jacksonDataFormat" ref="jacksonDataFormat"/>
+        <property name="bundleContext" ref="blueprintBundleContext"/>
+    </bean>
+
+    <camel:camelContext id="httpEndpoint" xmlns="http://camel.apache.org/schema/blueprint">
+        <camel:routeBuilder ref="profileImportConfigUpdateRouteBuilder" />
+    </camel:camelContext>
+
+    <bean id="profileImportConfigUpdateRouteBuilder" class="org.apache.unomi.router.core.route.ProfileImportConfigUpdateRouteBuilder">
+        <property name="profileImportCamelContext" ref="camelContext"/>
+    </bean>
+
+    <reference id="httpService" interface="org.osgi.service.http.HttpService"/>
+    <reference id="profileImportService" interface="org.apache.unomi.router.api.services.ProfileImportService"/>
+    <reference id="importConfigurationService" interface="org.apache.unomi.router.api.services.ImportConfigurationService"/>
+
+</blueprint>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-core/src/main/resources/org.apache.unomi.router.cfg
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/resources/org.apache.unomi.router.cfg b/extensions/router/router-core/src/main/resources/org.apache.unomi.router.cfg
new file mode 100644
index 0000000..ff2c8ef
--- /dev/null
+++ b/extensions/router/router-core/src/main/resources/org.apache.unomi.router.cfg
@@ -0,0 +1,25 @@
+#
+# 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.
+#
+
+#Kafka
+ settingskafka.host=localhost
+kafka.port=9092
+kafka.import.topic=camel-deposit
+kafka.import.groupId=unomi-import-group
+
+#Import One Shot upload directory
+import.oneshot.uploadDir=/tmp/unomi_oneshot_import_configs/
\ No newline at end of file


[16/50] [abbrv] incubator-unomi git commit: UNOMI-93 Add rule execution statistics to rule service endpoint - Initial commit

Posted by sh...@apache.org.
UNOMI-93 Add rule execution statistics to rule service endpoint
- Initial commit

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/df6acb3f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/df6acb3f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/df6acb3f

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: df6acb3f1ca5c526cebddc3b66c5fd32d88b6974
Parents: 28b63e6
Author: Serge Huber <sh...@apache.org>
Authored: Mon May 1 21:08:54 2017 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Mon May 1 21:08:54 2017 +0200

----------------------------------------------------------------------
 .../apache/unomi/api/rules/RuleStatistics.java  | 107 +++++++++++++++++
 .../apache/unomi/api/services/RulesService.java |   8 ++
 itests/pom.xml                                  |   4 +-
 .../apache/unomi/rest/RulesServiceEndPoint.java |  13 +++
 .../services/services/RulesServiceImpl.java     | 117 ++++++++++++++++++-
 5 files changed, 244 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/df6acb3f/api/src/main/java/org/apache/unomi/api/rules/RuleStatistics.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/rules/RuleStatistics.java b/api/src/main/java/org/apache/unomi/api/rules/RuleStatistics.java
new file mode 100644
index 0000000..2172461
--- /dev/null
+++ b/api/src/main/java/org/apache/unomi/api/rules/RuleStatistics.java
@@ -0,0 +1,107 @@
+/*
+ * 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.unomi.api.rules;
+
+import org.apache.unomi.api.Item;
+
+import java.util.Date;
+
+/**
+ * A separate item to track rule statistics, because we will manage the persistence and updating of these seperately
+ * from the rules themselves. This object contains all the relevant statistics concerning the execution of a rule.
+ */
+public class RuleStatistics extends Item {
+
+    /**
+     * The Rule ITEM_TYPE.
+     *
+     * @see Item for a discussion of ITEM_TYPE
+     */
+    public static final String ITEM_TYPE = "rulestats";
+    private static final long serialVersionUID = 1L;
+
+    private long executionCount = 0;
+    private long localExecutionCount = 0;
+    private long conditionsTime = 0;
+    private long localConditionsTime = 0;
+    private long actionsTime = 0;
+    private long localActionsTime = 0;
+    private Date lastSyncDate;
+
+    public RuleStatistics() {
+    }
+
+    public RuleStatistics(String itemId) {
+        super(itemId);
+    }
+
+    public long getExecutionCount() {
+        return executionCount;
+    }
+
+    public void setExecutionCount(long executionCount) {
+        this.executionCount = executionCount;
+    }
+
+    public long getLocalExecutionCount() {
+        return localExecutionCount;
+    }
+
+    public void setLocalExecutionCount(long localExecutionCount) {
+        this.localExecutionCount = localExecutionCount;
+    }
+
+    public long getConditionsTime() {
+        return conditionsTime;
+    }
+
+    public void setConditionsTime(long conditionsTime) {
+        this.conditionsTime = conditionsTime;
+    }
+
+    public long getLocalConditionsTime() {
+        return localConditionsTime;
+    }
+
+    public void setLocalConditionsTime(long localConditionsTime) {
+        this.localConditionsTime = localConditionsTime;
+    }
+
+    public long getActionsTime() {
+        return actionsTime;
+    }
+
+    public void setActionsTime(long actionsTime) {
+        this.actionsTime = actionsTime;
+    }
+
+    public long getLocalActionsTime() {
+        return localActionsTime;
+    }
+
+    public void setLocalActionsTime(long localActionsTime) {
+        this.localActionsTime = localActionsTime;
+    }
+
+    public Date getLastSyncDate() {
+        return lastSyncDate;
+    }
+
+    public void setLastSyncDate(Date lastSyncDate) {
+        this.lastSyncDate = lastSyncDate;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/df6acb3f/api/src/main/java/org/apache/unomi/api/services/RulesService.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/services/RulesService.java b/api/src/main/java/org/apache/unomi/api/services/RulesService.java
index 75d1f07..63f6dda 100644
--- a/api/src/main/java/org/apache/unomi/api/services/RulesService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/RulesService.java
@@ -23,6 +23,7 @@ import org.apache.unomi.api.PartialList;
 import org.apache.unomi.api.conditions.Condition;
 import org.apache.unomi.api.query.Query;
 import org.apache.unomi.api.rules.Rule;
+import org.apache.unomi.api.rules.RuleStatistics;
 
 import java.util.Set;
 
@@ -55,6 +56,13 @@ public interface RulesService {
     Rule getRule(String ruleId);
 
     /**
+     * Retrieves the statistics for a rule
+     * @param ruleId the identifier of the rule
+     * @return a long representing the number of times the rule was matched and executed.
+     */
+    RuleStatistics getRuleStatistics(String ruleId);
+
+    /**
      * Persists the specified rule to the context server.
      *
      * @param rule the rule to be persisted

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/df6acb3f/itests/pom.xml
----------------------------------------------------------------------
diff --git a/itests/pom.xml b/itests/pom.xml
index 3b02af1..868fb1f 100644
--- a/itests/pom.xml
+++ b/itests/pom.xml
@@ -144,12 +144,12 @@
                 <groupId>com.github.alexcojocaru</groupId>
                 <artifactId>elasticsearch-maven-plugin</artifactId>
                 <!-- REPLACE THE FOLLOWING WITH THE PLUGIN VERSION YOU NEED -->
-                <version>5.0</version>
+                <version>5.7</version>
                 <configuration>
                     <clusterName>contextElasticSearch</clusterName>
                     <transportPort>9300</transportPort>
                     <httpPort>9200</httpPort>
-                    <version>5.0.2</version>
+                    <version>${elasticsearch.version}</version>
                 </configuration>
                 <executions>
                     <!--

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/df6acb3f/rest/src/main/java/org/apache/unomi/rest/RulesServiceEndPoint.java
----------------------------------------------------------------------
diff --git a/rest/src/main/java/org/apache/unomi/rest/RulesServiceEndPoint.java b/rest/src/main/java/org/apache/unomi/rest/RulesServiceEndPoint.java
index 8559ed4..d619a7f 100644
--- a/rest/src/main/java/org/apache/unomi/rest/RulesServiceEndPoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/RulesServiceEndPoint.java
@@ -22,6 +22,7 @@ import org.apache.unomi.api.Metadata;
 import org.apache.unomi.api.PartialList;
 import org.apache.unomi.api.query.Query;
 import org.apache.unomi.api.rules.Rule;
+import org.apache.unomi.api.rules.RuleStatistics;
 import org.apache.unomi.api.services.RulesService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -104,6 +105,18 @@ public class RulesServiceEndPoint {
     }
 
     /**
+     * Retrieves the statistics for the rule with the specified identifier
+     *
+     * @param ruleId the identifier of the rule we want to retrieve
+     * @return the statistics for the specified rule or {@code null} if no such rule exists.
+     */
+    @GET
+    @Path("/{ruleId}/statistics")
+    public RuleStatistics getRuleStatistics(@PathParam("ruleId") String ruleId) {
+        return rulesService.getRuleStatistics(ruleId);
+    }
+
+    /**
      * Deletes the rule identified by the specified identifier.
      *
      * @param ruleId the identifier of the rule we want to delete

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/df6acb3f/services/src/main/java/org/apache/unomi/services/services/RulesServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/RulesServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/RulesServiceImpl.java
index 2df2fff..c289891 100644
--- a/services/src/main/java/org/apache/unomi/services/services/RulesServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/services/RulesServiceImpl.java
@@ -26,6 +26,7 @@ import org.apache.unomi.api.actions.ActionExecutor;
 import org.apache.unomi.api.conditions.Condition;
 import org.apache.unomi.api.query.Query;
 import org.apache.unomi.api.rules.Rule;
+import org.apache.unomi.api.rules.RuleStatistics;
 import org.apache.unomi.api.services.DefinitionsService;
 import org.apache.unomi.api.services.EventListenerService;
 import org.apache.unomi.api.services.EventService;
@@ -57,6 +58,9 @@ public class RulesServiceImpl implements RulesService, EventListenerService, Syn
     private List<Rule> allRules;
 
     private Timer rulesTimer;
+    private Timer ruleStatisticsTimer;
+
+    private Map<String,RuleStatistics> allRuleStatistics = new HashMap<String,RuleStatistics>();
 
     public void setBundleContext(BundleContext bundleContext) {
         this.bundleContext = bundleContext;
@@ -102,7 +106,7 @@ public class RulesServiceImpl implements RulesService, EventListenerService, Syn
 
         bundleContext.addBundleListener(this);
 
-        initializeTimer();
+        initializeTimers();
         logger.info("Rule service initialized.");
     }
 
@@ -116,6 +120,9 @@ public class RulesServiceImpl implements RulesService, EventListenerService, Syn
         if(rulesTimer != null) {
             rulesTimer.cancel();
         }
+        if (ruleStatisticsTimer != null) {
+            ruleStatisticsTimer.cancel();
+        }
         logger.info("Rule purge: Purge unscheduled");
     }
 
@@ -161,41 +168,50 @@ public class RulesServiceImpl implements RulesService, EventListenerService, Syn
         List<Rule> allItems = allRules;
 
         for (Rule rule : allItems) {
+            RuleStatistics ruleStatistics = getLocalRuleStatistics(rule);
+            long ruleConditionStartTime = System.currentTimeMillis();
             String scope = rule.getMetadata().getScope();
             if (scope.equals(Metadata.SYSTEM_SCOPE) || scope.equals(event.getScope())) {
                 Condition eventCondition = definitionsService.extractConditionByTag(rule.getCondition(), "eventCondition");
 
                 if (eventCondition == null) {
+                    updateRuleStatistics(ruleStatistics, ruleConditionStartTime);
                     continue;
                 }
 
                 if (!persistenceService.testMatch(eventCondition, event)) {
+                    updateRuleStatistics(ruleStatistics, ruleConditionStartTime);
                     continue;
                 }
 
                 Condition sourceCondition = definitionsService.extractConditionByTag(rule.getCondition(), "sourceEventCondition");
                 if (sourceCondition != null && !persistenceService.testMatch(sourceCondition, event.getSource())) {
+                    updateRuleStatistics(ruleStatistics, ruleConditionStartTime);
                     continue;
                 }
 
                 if (rule.isRaiseEventOnlyOnceForProfile()) {
                     hasEventAlreadyBeenRaisedForProfile = hasEventAlreadyBeenRaisedForProfile != null ? hasEventAlreadyBeenRaisedForProfile : eventService.hasEventAlreadyBeenRaised(event, false);
                     if (hasEventAlreadyBeenRaisedForProfile) {
+                        updateRuleStatistics(ruleStatistics, ruleConditionStartTime);
                         continue;
                     }
                 } else if (rule.isRaiseEventOnlyOnceForSession()) {
                     hasEventAlreadyBeenRaisedForSession = hasEventAlreadyBeenRaisedForSession != null ? hasEventAlreadyBeenRaisedForSession : eventService.hasEventAlreadyBeenRaised(event, true);
                     if (hasEventAlreadyBeenRaisedForSession) {
+                        updateRuleStatistics(ruleStatistics, ruleConditionStartTime);
                         continue;
                     }
                 }
 
                 Condition profileCondition = definitionsService.extractConditionByTag(rule.getCondition(), "profileCondition");
                 if (profileCondition != null && !persistenceService.testMatch(profileCondition, event.getProfile())) {
+                    updateRuleStatistics(ruleStatistics, ruleConditionStartTime);
                     continue;
                 }
                 Condition sessionCondition = definitionsService.extractConditionByTag(rule.getCondition(), "sessionCondition");
                 if (sessionCondition != null && !persistenceService.testMatch(sessionCondition, event.getSession())) {
+                    updateRuleStatistics(ruleStatistics, ruleConditionStartTime);
                     continue;
                 }
                 matchedRules.add(rule);
@@ -205,6 +221,20 @@ public class RulesServiceImpl implements RulesService, EventListenerService, Syn
         return matchedRules;
     }
 
+    private RuleStatistics getLocalRuleStatistics(Rule rule) {
+        RuleStatistics ruleStatistics = this.allRuleStatistics.get(rule.getItemId());
+        if (ruleStatistics == null) {
+            ruleStatistics = new RuleStatistics(rule.getItemId());
+        }
+        return ruleStatistics;
+    }
+
+    private void updateRuleStatistics(RuleStatistics ruleStatistics, long ruleConditionStartTime) {
+        long totalRuleConditionTime = System.currentTimeMillis() - ruleConditionStartTime;
+        ruleStatistics.setLocalConditionsTime(ruleStatistics.getLocalConditionsTime() + totalRuleConditionTime);
+        allRuleStatistics.put(ruleStatistics.getItemId(), ruleStatistics);
+    }
+
     private List<Rule> getAllRules() {
         List<Rule> allItems = persistenceService.getAllItems(Rule.class, 0, -1, "priority").getList();
         for (Rule rule : allItems) {
@@ -225,18 +255,32 @@ public class RulesServiceImpl implements RulesService, EventListenerService, Syn
         int changes = EventService.NO_CHANGE;
         for (Rule rule : rules) {
             logger.debug("Fired rule " + rule.getMetadata().getId() + " for " + event.getEventType() + " - " + event.getItemId());
+            long actionsStartTime = System.currentTimeMillis();
             for (Action action : rule.getActions()) {
                 changes |= actionExecutorDispatcher.execute(action, event);
             }
-
+            long totalActionsTime = System.currentTimeMillis() - actionsStartTime;
             Event ruleFired = new Event("ruleFired", event.getSession(), event.getProfile(), event.getScope(), event, rule, event.getTimeStamp());
             ruleFired.getAttributes().putAll(event.getAttributes());
             ruleFired.setPersistent(false);
             changes |= eventService.send(ruleFired);
+
+            RuleStatistics ruleStatistics = getLocalRuleStatistics(rule);
+            ruleStatistics.setLocalExecutionCount(ruleStatistics.getLocalExecutionCount()+1);
+            ruleStatistics.setLocalActionsTime(ruleStatistics.getLocalActionsTime() + totalActionsTime);
+            this.allRuleStatistics.put(rule.getItemId(), ruleStatistics);
         }
         return changes;
     }
 
+    @Override
+    public RuleStatistics getRuleStatistics(String ruleId) {
+        if (allRuleStatistics.containsKey(ruleId)) {
+            return allRuleStatistics.get(ruleId);
+        }
+        return persistenceService.load(ruleId, RuleStatistics.class);
+    }
+
     public Set<Metadata> getRuleMetadatas() {
         Set<Metadata> metadatas = new HashSet<Metadata>();
         for (Rule rule : persistenceService.getAllItems(Rule.class, 0, 50, null).getList()) {
@@ -309,7 +353,7 @@ public class RulesServiceImpl implements RulesService, EventListenerService, Syn
         persistenceService.remove(ruleId, Rule.class);
     }
 
-    private void initializeTimer() {
+    private void initializeTimers() {
         rulesTimer = new Timer();
         TimerTask task = new TimerTask() {
             @Override
@@ -318,6 +362,14 @@ public class RulesServiceImpl implements RulesService, EventListenerService, Syn
             }
         };
         rulesTimer.schedule(task, 0, 1000);
+        ruleStatisticsTimer = new Timer();
+        TimerTask statisticsTask = new TimerTask() {
+            @Override
+            public void run() {
+                syncRuleStatistics();
+            }
+        };
+        ruleStatisticsTimer.schedule(statisticsTask, 0, 10000);
     }
 
     public void bundleChanged(BundleEvent event) {
@@ -330,4 +382,63 @@ public class RulesServiceImpl implements RulesService, EventListenerService, Syn
                 break;
         }
     }
+
+    private void syncRuleStatistics() {
+        List<RuleStatistics> allPersistedRuleStatisticsList = persistenceService.getAllItems(RuleStatistics.class);
+        Map<String,RuleStatistics> allPersistedRuleStatistics = new HashMap<>();
+        for (RuleStatistics ruleStatistics : allPersistedRuleStatisticsList) {
+            allPersistedRuleStatistics.put(ruleStatistics.getItemId(), ruleStatistics);
+        }
+        // first we iterate over the rules we have in memory
+        for (RuleStatistics ruleStatistics : allRuleStatistics.values()) {
+            boolean mustPersist = false;
+            if (allPersistedRuleStatistics.containsKey(ruleStatistics.getItemId())) {
+                // we must sync with the data coming from the persistence service.
+                RuleStatistics persistedRuleStatistics = allPersistedRuleStatistics.get(ruleStatistics.getItemId());
+                ruleStatistics.setExecutionCount(persistedRuleStatistics.getExecutionCount() + ruleStatistics.getLocalExecutionCount());
+                if (ruleStatistics.getLocalExecutionCount() > 0) {
+                    ruleStatistics.setLocalExecutionCount(0);
+                    mustPersist = true;
+                }
+                ruleStatistics.setConditionsTime(persistedRuleStatistics.getConditionsTime() + ruleStatistics.getLocalConditionsTime());
+                if (ruleStatistics.getLocalConditionsTime() > 0) {
+                    ruleStatistics.setLocalConditionsTime(0);
+                    mustPersist = true;
+                }
+                ruleStatistics.setActionsTime(persistedRuleStatistics.getActionsTime() + ruleStatistics.getLocalActionsTime());
+                if (ruleStatistics.getLocalActionsTime() > 0) {
+                    ruleStatistics.setLocalActionsTime(0);
+                    mustPersist = true;
+                }
+                ruleStatistics.setLastSyncDate(new Date());
+            } else {
+                ruleStatistics.setExecutionCount(ruleStatistics.getExecutionCount() + ruleStatistics.getLocalExecutionCount());
+                if (ruleStatistics.getLocalExecutionCount() > 0) {
+                    ruleStatistics.setLocalExecutionCount(0);
+                    mustPersist = true;
+                }
+                ruleStatistics.setConditionsTime(ruleStatistics.getConditionsTime() + ruleStatistics.getLocalConditionsTime());
+                if (ruleStatistics.getLocalConditionsTime() > 0) {
+                    ruleStatistics.setLocalConditionsTime(0);
+                    mustPersist = true;
+                }
+                ruleStatistics.setActionsTime(ruleStatistics.getActionsTime() + ruleStatistics.getLocalActionsTime());
+                if (ruleStatistics.getLocalActionsTime() > 0) {
+                    ruleStatistics.setLocalActionsTime(0);
+                    mustPersist = true;
+                }
+                ruleStatistics.setLastSyncDate(new Date());
+            }
+            allRuleStatistics.put(ruleStatistics.getItemId(), ruleStatistics);
+            if (mustPersist) {
+                persistenceService.save(ruleStatistics);
+            }
+        }
+        // now let's iterate over the rules coming from the persistence service, as we may have new ones.
+        for (RuleStatistics ruleStatistics : allPersistedRuleStatistics.values()) {
+            if (!allRuleStatistics.containsKey(ruleStatistics.getItemId())) {
+                allRuleStatistics.put(ruleStatistics.getItemId(), ruleStatistics);
+            }
+        }
+    }
 }


[31/50] [abbrv] incubator-unomi git commit: UNOMI-100 fix issue with isDay and isNotDay date wasn't converted as ISO, add unit test

Posted by sh...@apache.org.
UNOMI-100 fix issue with isDay and isNotDay date wasn't converted as ISO, add unit test


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/0f441403
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/0f441403
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/0f441403

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 0f4414039274750a3fe2b62fdcbecbfda73eaed4
Parents: 46be002
Author: dgaillard <dg...@jahia.com>
Authored: Wed Jun 7 18:51:09 2017 +0200
Committer: dgaillard <dg...@jahia.com>
Committed: Wed Jun 7 18:51:09 2017 +0200

----------------------------------------------------------------------
 .../test/java/org/apache/unomi/itests/ConditionBuilder.java  | 8 ++++++++
 .../java/org/apache/unomi/itests/ConditionEvaluatorIT.java   | 3 +++
 .../conditions/PropertyConditionESQueryBuilder.java          | 2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/0f441403/itests/src/test/java/org/apache/unomi/itests/ConditionBuilder.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/unomi/itests/ConditionBuilder.java b/itests/src/test/java/org/apache/unomi/itests/ConditionBuilder.java
index 0fbffcd..38356b5 100644
--- a/itests/src/test/java/org/apache/unomi/itests/ConditionBuilder.java
+++ b/itests/src/test/java/org/apache/unomi/itests/ConditionBuilder.java
@@ -129,6 +129,14 @@ public class ConditionBuilder {
             return op("in").dateValues(values);
         }
 
+        public ComparisonCondition isDay(Date value) {
+            return op("isDay").dateValue(value);
+        }
+
+        public ComparisonCondition isNotDay(Date value) {
+            return op("isNotDay").dateValue(value);
+        }
+
         public ComparisonCondition in(Integer... values) {
             return op("in").integerValues(values);
         }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/0f441403/itests/src/test/java/org/apache/unomi/itests/ConditionEvaluatorIT.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/unomi/itests/ConditionEvaluatorIT.java b/itests/src/test/java/org/apache/unomi/itests/ConditionEvaluatorIT.java
index b75a8f5..5fb6b6f 100644
--- a/itests/src/test/java/org/apache/unomi/itests/ConditionEvaluatorIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/ConditionEvaluatorIT.java
@@ -112,6 +112,9 @@ public class ConditionEvaluatorIT extends BaseIT {
         assertTrue(eval(builder.profileProperty("properties.lastVisit").all(lastVisit).build()));
         assertFalse(eval(builder.profileProperty("properties.lastVisit")
                 .all(new Date(lastVisit.getTime() + 10000), lastVisit).build()));
+
+        assertTrue(eval(builder.profileProperty("properties.lastVisit").isDay(lastVisit).build()));
+        assertTrue(eval(builder.profileProperty("properties.lastVisit").isNotDay(new Date(lastVisit.getTime() + 10000)).build()));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/0f441403/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java
index 26e480a..b06c94e 100644
--- a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java
+++ b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java
@@ -166,7 +166,7 @@ public class PropertyConditionESQueryBuilder implements ConditionESQueryBuilder
         DateTime date = new DateTime(value);
         DateTime dayStart = date.withTimeAtStartOfDay();
         DateTime dayAfterStart = date.plusDays(1).withTimeAtStartOfDay();
-        return QueryBuilders.rangeQuery(name).gte(dayStart.toDate()).lte(dayAfterStart.toDate());
+        return QueryBuilders.rangeQuery(name).gte(convertDateToISO(dayStart.toDate())).lte(convertDateToISO(dayAfterStart.toDate()));
     }
 
     private Object convertDateToISO(Object dateValue) {


[11/50] [abbrv] incubator-unomi git commit: UNOMI-89 : Add an endpoint/Service for userLists metadatas

Posted by sh...@apache.org.
UNOMI-89 : Add an endpoint/Service for userLists metadatas


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/22f297c0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/22f297c0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/22f297c0

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 22f297c0399ff53bf887293be31c1374ab7b429f
Parents: 2f68791
Author: Abdelkader Midani <am...@apache.org>
Authored: Mon Mar 27 14:04:33 2017 +0200
Committer: Abdelkader Midani <am...@apache.org>
Committed: Mon Mar 27 14:04:33 2017 +0200

----------------------------------------------------------------------
 .../org/apache/unomi/api/lists/UserList.java    | 55 ++++++++++++++
 .../unomi/api/services/UserListService.java     | 49 +++++++++++++
 .../conditions/profileUserListCondition.json    | 33 +++++++++
 .../unomi/rest/UserListServiceEndPoint.java     | 75 ++++++++++++++++++++
 .../resources/OSGI-INF/blueprint/blueprint.xml  | 17 +++++
 .../services/services/AbstractServiceImpl.java  | 68 ++++++++++++++++++
 .../services/services/SegmentServiceImpl.java   | 36 +---------
 .../services/services/UserListServiceImpl.java  | 67 +++++++++++++++++
 .../resources/OSGI-INF/blueprint/blueprint.xml  |  8 +++
 9 files changed, 373 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/22f297c0/api/src/main/java/org/apache/unomi/api/lists/UserList.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/lists/UserList.java b/api/src/main/java/org/apache/unomi/api/lists/UserList.java
new file mode 100644
index 0000000..d463a58
--- /dev/null
+++ b/api/src/main/java/org/apache/unomi/api/lists/UserList.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.unomi.api.lists;
+
+import org.apache.unomi.api.Item;
+import org.apache.unomi.api.Metadata;
+import org.apache.unomi.api.MetadataItem;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * Created by amidani on 24/03/2017.
+ */
+@XmlRootElement
+public class UserList extends MetadataItem{
+
+    /**
+     * The Segment ITEM_TYPE.
+     *
+     * @see Item for a discussion of ITEM_TYPE
+     */
+    public static final String ITEM_TYPE = "userList";
+
+    private static final long serialVersionUID = -1384533444875433496L;
+
+    /**
+     * Instantiates a new UserList.
+     */
+    public UserList() {}
+
+    /**
+     * Instantiates a new UserList with the specified metadata.
+     *
+     * @param metadata the metadata
+     */
+    public UserList(Metadata metadata) {
+        super(metadata);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/22f297c0/api/src/main/java/org/apache/unomi/api/services/UserListService.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/services/UserListService.java b/api/src/main/java/org/apache/unomi/api/services/UserListService.java
new file mode 100644
index 0000000..04d109a
--- /dev/null
+++ b/api/src/main/java/org/apache/unomi/api/services/UserListService.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.unomi.api.services;
+
+import org.apache.unomi.api.Metadata;
+import org.apache.unomi.api.PartialList;
+import org.apache.unomi.api.lists.UserList;
+
+import java.util.List;
+
+/**
+ * Created by amidani on 24/03/2017.
+ */
+public interface UserListService {
+    /**
+     *
+     * @return a {@link List} of {@link UserList}
+     */
+    List<UserList> getAllUserLists();
+
+    /**
+     * Retrieves user lists metadatas, ordered according to the specified {@code sortBy} String and and paged: only {@code size} of them are retrieved, starting with the {@code
+     * offset}-th one.
+     *
+     * @param offset zero or a positive integer specifying the position of the first element in the total ordered collection of matching elements
+     * @param size   a positive integer specifying how many matching elements should be retrieved or {@code -1} if all of them should be retrieved
+     * @param sortBy an optional ({@code null} if no sorting is required) String of comma ({@code ,}) separated property names on which ordering should be performed, ordering elements according to the property order in the
+     *               String, considering each in turn and moving on to the next one in case of equality of all preceding ones. Each property name is optionally followed by
+     *               a column ({@code :}) and an order specifier: {@code asc} or {@code desc}.
+     * @return a {@link PartialList} of {@link UserList} metadata
+     */
+    public PartialList<Metadata> getUserListMetadatas(int offset, int size, String sortBy);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/22f297c0/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profileUserListCondition.json
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profileUserListCondition.json b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profileUserListCondition.json
new file mode 100644
index 0000000..221f5f9
--- /dev/null
+++ b/plugins/baseplugin/src/main/resources/META-INF/cxs/conditions/profileUserListCondition.json
@@ -0,0 +1,33 @@
+{
+  "metadata": {
+    "id": "profileUserListCondition",
+    "name": "profileUserListCondition",
+    "description": "",
+    "tags": [
+      "aggregated",
+      "profileCondition"
+    ],
+    "readOnly": true
+  },
+  "parentCondition": {
+    "type": "profilePropertyCondition",
+    "parameterValues": {
+      "propertyName": "systemProperties.lists",
+      "propertyValues": "parameter::lists",
+      "comparisonOperator": "parameter::matchType"
+    }
+  },
+
+  "parameters": [
+    {
+      "id": "lists",
+      "type": "string",
+      "multivalued": true
+    },
+    {
+      "id": "matchType",
+      "type": "string",
+      "multivalued": false
+    }
+  ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/22f297c0/rest/src/main/java/org/apache/unomi/rest/UserListServiceEndPoint.java
----------------------------------------------------------------------
diff --git a/rest/src/main/java/org/apache/unomi/rest/UserListServiceEndPoint.java b/rest/src/main/java/org/apache/unomi/rest/UserListServiceEndPoint.java
new file mode 100644
index 0000000..ee27411
--- /dev/null
+++ b/rest/src/main/java/org/apache/unomi/rest/UserListServiceEndPoint.java
@@ -0,0 +1,75 @@
+/*
+ * 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.unomi.rest;
+
+/**
+ * Created by amidani on 24/03/2017.
+ */
+
+import org.apache.cxf.rs.security.cors.CrossOriginResourceSharing;
+import org.apache.unomi.api.Metadata;
+import org.apache.unomi.api.lists.UserList;
+import org.apache.unomi.api.services.UserListService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import java.util.List;
+
+/**
+ * A JAX-RS endpoint to manage {@link UserList}s.
+ */
+@WebService
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@CrossOriginResourceSharing(
+        allowAllOrigins = true,
+        allowCredentials = true
+)
+public class UserListServiceEndPoint {
+
+    private static final Logger logger = LoggerFactory.getLogger(UserListServiceEndPoint.class.getName());
+
+    private UserListService userListService;
+
+    public UserListServiceEndPoint() {
+        logger.info("Initializing user lists service endpoint...");
+    }
+
+    @WebMethod(exclude=true)
+    public void setUserListService(UserListService userListService) {
+        this.userListService = userListService;
+    }
+
+    /**
+     * Retrieves the 50 first {@link UserList} metadatas.
+     *
+     * @return a List of the 50 first {@link UserList} metadata
+     */
+    @GET
+    @Path("/")
+    public List<Metadata> getUserListsMetadatas() {
+        return userListService.getUserListMetadatas(0, 50, null).getList();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/22f297c0/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 0c81d6e..6c43256 100644
--- a/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -70,6 +70,18 @@
         </jaxrs:serviceBeans>
     </jaxrs:server>
 
+    <jaxrs:server address="/userList" id="restUserListService">
+        <jaxrs:providers>
+            <ref component-id="jaxb-provider"/>
+            <ref component-id="cors-filter"/>
+            <ref component-id="jaas-filter"/>
+        </jaxrs:providers>
+
+        <jaxrs:serviceBeans>
+            <ref component-id="userListServiceEndPoint"/>
+        </jaxrs:serviceBeans>
+    </jaxrs:server>
+
     <jaxrs:server address="/scoring" id="restScoringService">
         <jaxrs:providers>
             <ref component-id="jaxb-provider"/>
@@ -167,6 +179,7 @@
     </jaxrs:server>
 
     <reference id="segmentService" interface="org.apache.unomi.api.services.SegmentService"/>
+    <reference id="userListService" interface="org.apache.unomi.api.services.UserListService"/>
     <reference id="definitionsService" interface="org.apache.unomi.api.services.DefinitionsService"/>
     <reference id="goalsService" interface="org.apache.unomi.api.services.GoalsService"/>
     <reference id="rulesService" interface="org.apache.unomi.api.services.RulesService"/>
@@ -179,6 +192,10 @@
         <property name="segmentService" ref="segmentService"/>
     </bean>
 
+    <bean id="userListServiceEndPoint" class="org.apache.unomi.rest.UserListServiceEndPoint">
+        <property name="userListService" ref="userListService"/>
+    </bean>
+
     <bean id="scoringServiceEndPoint" class="org.apache.unomi.rest.ScoringServiceEndPoint">
         <property name="segmentService" ref="segmentService"/>
     </bean>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/22f297c0/services/src/main/java/org/apache/unomi/services/services/AbstractServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/AbstractServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/AbstractServiceImpl.java
new file mode 100644
index 0000000..c9f967d
--- /dev/null
+++ b/services/src/main/java/org/apache/unomi/services/services/AbstractServiceImpl.java
@@ -0,0 +1,68 @@
+/*
+ * 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.unomi.services.services;
+
+import org.apache.unomi.api.Metadata;
+import org.apache.unomi.api.MetadataItem;
+import org.apache.unomi.api.PartialList;
+import org.apache.unomi.api.query.Query;
+import org.apache.unomi.api.services.DefinitionsService;
+import org.apache.unomi.persistence.spi.PersistenceService;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Created by amidani on 24/03/2017.
+ */
+public abstract class AbstractServiceImpl {
+
+    PersistenceService persistenceService;
+
+    DefinitionsService definitionsService;
+
+    public void setPersistenceService(PersistenceService persistenceService) {
+        this.persistenceService = persistenceService;
+    }
+
+    public void setDefinitionsService(DefinitionsService definitionsService) {
+        this.definitionsService = definitionsService;
+    }
+
+    <T extends MetadataItem> PartialList<Metadata> getMetadatas(int offset, int size, String sortBy, Class<T> clazz) {
+        PartialList<T> items = persistenceService.getAllItems(clazz, offset, size, sortBy);
+        List<Metadata> details = new LinkedList<>();
+        for (T definition : items.getList()) {
+            details.add(definition.getMetadata());
+        }
+        return new PartialList<>(details, items.getOffset(), items.getPageSize(), items.getTotalSize());
+    }
+
+    <T extends MetadataItem> PartialList<Metadata> getMetadatas(Query query, Class<T> clazz) {
+        if (query.isForceRefresh()) {
+            persistenceService.refresh();
+        }
+        definitionsService.resolveConditionType(query.getCondition());
+        PartialList<T> items = persistenceService.query(query.getCondition(), query.getSortby(), clazz, query.getOffset(), query.getLimit());
+        List<Metadata> details = new LinkedList<>();
+        for (T definition : items.getList()) {
+            details.add(definition.getMetadata());
+        }
+        return new PartialList<>(details, items.getOffset(), items.getPageSize(), items.getTotalSize());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/22f297c0/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java
index 4367b4d..979c3cb 100644
--- a/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java
@@ -45,16 +45,12 @@ import java.net.URL;
 import java.security.MessageDigest;
 import java.util.*;
 
-public class SegmentServiceImpl implements SegmentService, SynchronousBundleListener {
+public class SegmentServiceImpl extends AbstractServiceImpl implements SegmentService, SynchronousBundleListener {
 
     private static final Logger logger = LoggerFactory.getLogger(SegmentServiceImpl.class.getName());
 
     private BundleContext bundleContext;
 
-    private PersistenceService persistenceService;
-
-    private DefinitionsService definitionsService;
-
     private EventService eventService;
 
     private RulesService rulesService;
@@ -105,14 +101,6 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
         this.bundleContext = bundleContext;
     }
 
-    public void setPersistenceService(PersistenceService persistenceService) {
-        this.persistenceService = persistenceService;
-    }
-
-    public void setDefinitionsService(DefinitionsService definitionsService) {
-        this.definitionsService = definitionsService;
-    }
-
     public void setEventService(EventService eventService) {
         this.eventService = eventService;
     }
@@ -1025,26 +1013,4 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
         this.taskExecutionPeriod = taskExecutionPeriod;
     }
 
-    private <T extends MetadataItem> PartialList<Metadata> getMetadatas(int offset, int size, String sortBy, Class<T> clazz) {
-        PartialList<T> items = persistenceService.getAllItems(clazz, offset, size, sortBy);
-        List<Metadata> details = new LinkedList<>();
-        for (T definition : items.getList()) {
-            details.add(definition.getMetadata());
-        }
-        return new PartialList<>(details, items.getOffset(), items.getPageSize(), items.getTotalSize());
-    }
-
-    private <T extends MetadataItem> PartialList<Metadata> getMetadatas(Query query, Class<T> clazz) {
-        if (query.isForceRefresh()) {
-            persistenceService.refresh();
-        }
-        definitionsService.resolveConditionType(query.getCondition());
-        PartialList<T> items = persistenceService.query(query.getCondition(), query.getSortby(), clazz, query.getOffset(), query.getLimit());
-        List<Metadata> details = new LinkedList<>();
-        for (T definition : items.getList()) {
-            details.add(definition.getMetadata());
-        }
-        return new PartialList<>(details, items.getOffset(), items.getPageSize(), items.getTotalSize());
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/22f297c0/services/src/main/java/org/apache/unomi/services/services/UserListServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/UserListServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/UserListServiceImpl.java
new file mode 100644
index 0000000..e3156ea
--- /dev/null
+++ b/services/src/main/java/org/apache/unomi/services/services/UserListServiceImpl.java
@@ -0,0 +1,67 @@
+/*
+ * 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.unomi.services.services;
+
+import org.apache.unomi.api.Metadata;
+import org.apache.unomi.api.PartialList;
+import org.apache.unomi.api.lists.UserList;
+import org.apache.unomi.api.services.UserListService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.SynchronousBundleListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+
+/**
+ * Created by amidani on 24/03/2017.
+ */
+public class UserListServiceImpl extends AbstractServiceImpl implements UserListService, SynchronousBundleListener {
+
+    private static final Logger logger = LoggerFactory.getLogger(UserListServiceImpl.class.getName());
+
+    private BundleContext bundleContext;
+
+    public void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
+
+    public void postConstruct() {
+        logger.debug("postConstruct {" + bundleContext.getBundle() + "}");
+        bundleContext.addBundleListener(this);
+        logger.info("User list service initialized.");
+    }
+
+    public void preDestroy() {
+        bundleContext.removeBundleListener(this);
+        logger.info("User list service shutdown.");
+    }
+
+    public List<UserList> getAllUserLists() {
+        return persistenceService.getAllItems(UserList.class);
+    }
+
+    public PartialList<Metadata> getUserListMetadatas(int offset, int size, String sortBy) {
+        return getMetadatas(offset, size, sortBy, UserList.class);
+    }
+
+
+    @Override
+    public void bundleChanged(BundleEvent bundleEvent) { }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/22f297c0/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 23af746..c5dfdd6 100644
--- a/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -127,6 +127,14 @@
     </bean>
     <service id="segmentService" ref="segmentServiceImpl" auto-export="interfaces"/>
 
+    <bean id="userListServiceImpl" class="org.apache.unomi.services.services.UserListServiceImpl"
+          init-method="postConstruct" destroy-method="preDestroy">
+        <property name="persistenceService" ref="persistenceService"/>
+        <property name="definitionsService" ref="definitionsServiceImpl"/>
+        <property name="bundleContext" ref="blueprintBundleContext"/>
+    </bean>
+    <service id="userListService" ref="userListServiceImpl" auto-export="interfaces"/>
+
     <bean id="profileServiceImpl" class="org.apache.unomi.services.services.ProfileServiceImpl"
           init-method="postConstruct" destroy-method="preDestroy">
         <property name="persistenceService" ref="persistenceService"/>


[04/50] [abbrv] incubator-unomi git commit: This closes pull request number #25

Posted by sh...@apache.org.
This closes pull request number #25


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/3110e43a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/3110e43a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/3110e43a

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 3110e43af7ca6ca77b29c8d42f482a33033c2077
Parents: c70f0a3 9ed047c
Author: Serge Huber <sh...@apache.org>
Authored: Fri Feb 24 09:33:02 2017 +0100
Committer: Serge Huber <sh...@apache.org>
Committed: Fri Feb 24 09:33:02 2017 +0100

----------------------------------------------------------------------
 .../unomi/persistence/spi/PropertyHelper.java   | 20 ++++++++++++++++++++
 .../baseplugin/actions/SetPropertyAction.java   | 14 ++++++++++++--
 .../META-INF/cxs/actions/setPropertyAction.json |  5 +++++
 .../resources/META-INF/cxs/values/boolean.json  |  3 +++
 .../main/resources/org.apache.unomi.cluster.cfg |  8 ++++----
 5 files changed, 44 insertions(+), 6 deletions(-)
----------------------------------------------------------------------



[26/50] [abbrv] incubator-unomi git commit: UNOMI-98 Provide an example of integrating with an externally triggered login - First commit of the login integration example

Posted by sh...@apache.org.
UNOMI-98 Provide an example of integrating with an externally triggered login
- First commit of the login integration example

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/ef860382
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/ef860382
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/ef860382

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: ef8603824a887c6ebeb8cf56d27f8cd7c6593cd1
Parents: 4f4ade0
Author: Serge Huber <sh...@apache.org>
Authored: Mon May 29 13:57:03 2017 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Mon May 29 13:57:03 2017 +0200

----------------------------------------------------------------------
 samples/login-integration/pom.xml               |  64 +++++++++
 .../META-INF/cxs/rules/exampleLogin.json        |  34 +++++
 .../src/main/webapp/WEB-INF/web.xml             |  24 ++++
 .../src/main/webapp/index.html                  |  70 ++++++++++
 .../src/main/webapp/javascript/login-example.js | 136 +++++++++++++++++++
 samples/pom.xml                                 |   2 +-
 6 files changed, 329 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ef860382/samples/login-integration/pom.xml
----------------------------------------------------------------------
diff --git a/samples/login-integration/pom.xml b/samples/login-integration/pom.xml
new file mode 100644
index 0000000..675807f
--- /dev/null
+++ b/samples/login-integration/pom.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>samples</artifactId>
+        <groupId>org.apache.unomi</groupId>
+        <version>1.2.0-incubating-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>login-integration-sample</artifactId>
+    <name>Apache Unomi :: Samples :: External Login plugin</name>
+    <packaging>bundle</packaging>
+    <description>This is a simple Apache Unomi plugin.</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+            <artifactId>unomi-api</artifactId>
+            <version>1.2.0-incubating-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet.jsp</groupId>
+            <artifactId>jsp-api</artifactId>
+            <version>2.1</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <_wab>src/main/webapp</_wab>
+                        <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
+                        <Embed-Directory>WEB-INF/lib</Embed-Directory>
+                        <Web-ContextPath>/login</Web-ContextPath>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ef860382/samples/login-integration/src/main/resources/META-INF/cxs/rules/exampleLogin.json
----------------------------------------------------------------------
diff --git a/samples/login-integration/src/main/resources/META-INF/cxs/rules/exampleLogin.json b/samples/login-integration/src/main/resources/META-INF/cxs/rules/exampleLogin.json
new file mode 100644
index 0000000..6e3604b
--- /dev/null
+++ b/samples/login-integration/src/main/resources/META-INF/cxs/rules/exampleLogin.json
@@ -0,0 +1,34 @@
+{
+  "metadata": {
+    "id": "exampleLogin",
+    "name": "Example Login",
+    "description": "Copy event properties to profile properties on login"
+  },
+  "condition": {
+    "parameterValues": {
+      "subConditions": [
+        {
+          "parameterValues": {
+          },
+          "type": "loginEventCondition"
+        }
+      ],
+      "operator": "and"
+    },
+    "type": "booleanCondition"
+  },
+  "actions": [
+    {
+      "parameterValues": {
+        "mergeProfilePropertyValue": "eventProperty::target.properties(email)",
+        "mergeProfilePropertyName": "mergeIdentifier"
+      },
+      "type": "mergeProfilesOnPropertyAction"
+    },
+    {
+      "parameterValues": {
+      },
+      "type": "allEventToProfilePropertiesAction"
+    }
+  ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ef860382/samples/login-integration/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/samples/login-integration/src/main/webapp/WEB-INF/web.xml b/samples/login-integration/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..dc145f2
--- /dev/null
+++ b/samples/login-integration/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,24 @@
+<!--
+  ~ 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.
+  -->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+         version="3.0">
+    <welcome-file-list>
+        <welcome-file>index.html</welcome-file>
+    </welcome-file-list>
+</web-app>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ef860382/samples/login-integration/src/main/webapp/index.html
----------------------------------------------------------------------
diff --git a/samples/login-integration/src/main/webapp/index.html b/samples/login-integration/src/main/webapp/index.html
new file mode 100644
index 0000000..8b03cbd
--- /dev/null
+++ b/samples/login-integration/src/main/webapp/index.html
@@ -0,0 +1,70 @@
+<!--
+~ 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.
+-->
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Login integration example</title>
+    <!-- Latest compiled and minified CSS -->
+    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
+          integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
+    <!-- Optional theme -->
+    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css"
+          integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
+    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
+    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
+    <!-- Latest compiled and minified JavaScript -->
+    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
+            integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
+            crossorigin="anonymous"></script>
+    <script src="javascript/login-example.js"></script>
+</head>
+<body>
+<div class="container">
+    <h1>Login integration example</h1>
+    <p>This is a small example of integrating Apache Unomi with an event login in order to merge profile based on emails
+    as merge keys (see associated rule file in src/main/resources/META-INF/cxs/rules/exampleLogin.json).</p>
+    <p>Important: note that login events should normally always be sent from the server performing the login, not through
+    Javascript for security reasons. Here we provide this type of example only for brievety and clarity.</p>
+    <div id="alert_placeholder"></div>
+    <form id="loginForm">
+        <div class="form-group">
+            <label for="firstname">First name</label>
+            <input type="text" name="firstName" id="firstname" class="form-control"
+                   placeholder="Enter your first name here"/>
+        </div>
+        <div class="form-group">
+            <label for="lastname">Last name</label>
+            <input type="text" name="lastName" id="lastname" class="form-control"
+                   placeholder="Enter your last name here"/>
+        </div>
+        <div class="form-group">
+            <label for="email">Email</label>
+            <input type="text" name="email" id="email" class="form-control" placeholder="Enter your email here"
+            >
+        </div>
+        <div class="form-group">
+            <label for="email">Password</label>
+            <input type="password" name="password" id="password" class="form-control"
+                   placeholder="Enter your password here">
+        </div>
+        <button id="loginButton" type="submit" class="btn btn-default">Login</button>
+    </form>
+</div>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ef860382/samples/login-integration/src/main/webapp/javascript/login-example.js
----------------------------------------------------------------------
diff --git a/samples/login-integration/src/main/webapp/javascript/login-example.js b/samples/login-integration/src/main/webapp/javascript/login-example.js
new file mode 100644
index 0000000..3c01113
--- /dev/null
+++ b/samples/login-integration/src/main/webapp/javascript/login-example.js
@@ -0,0 +1,136 @@
+/*
+ * 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.
+ */
+
+(function () {
+
+    // We use this method to generate unique sessions IDs
+    function generateGuid() {
+        function s4() {
+            return Math.floor((1 + Math.random()) * 0x10000)
+                .toString(16)
+                .substring(1);
+        }
+
+        return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
+            s4() + '-' + s4() + s4() + s4();
+    }
+
+    // -- COOKIE HELPER METHODS ---
+
+    function createCookie(name, value, days) {
+        var expires;
+
+        if (days) {
+            var date = new Date();
+            date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
+            expires = "; expires=" + date.toGMTString();
+        } else {
+            expires = "";
+        }
+        document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + expires + "; path=/";
+    }
+
+    function readCookie(name) {
+        var nameEQ = encodeURIComponent(name) + "=";
+        var ca = document.cookie.split(';');
+        for (var i = 0; i < ca.length; i++) {
+            var c = ca[i];
+            while (c.charAt(0) === ' ') c = c.substring(1, c.length);
+            if (c.indexOf(nameEQ) === 0) return decodeURIComponent(c.substring(nameEQ.length, c.length));
+        }
+        return null;
+    }
+
+    function eraseCookie(name) {
+        createCookie(name, "", -1);
+    }
+
+    // -- BOOTSTRAP HELPER METHODS ---
+
+    bootstrapAlert = {};
+    bootstrapAlert.success = function (message) {
+        $('#alert_placeholder').html('<div class="alert alert-success"><a class="close" data-dismiss="alert">×</a><span>' + message + '</span></div>')
+    };
+    bootstrapAlert.danger = function (message) {
+        $('#alert_placeholder').html('<div class="alert alert-danger"><a class="close" data-dismiss="alert">×</a><span>' + message + '</span></div>')
+    };
+
+    $(document).ready(function () {
+
+        // first we check if we have an existing session ID cookie, if not we generate a new session identifier and
+        // store it in the cookie.
+        var unomiSessionId = readCookie('unomi-session-id');
+        if (!unomiSessionId) {
+            unomiSessionId = generateGuid();
+            console.log("No existing session cookie found, creating a new one with value " + unomiSessionId);
+            createCookie('unomi-session-id', unomiSessionId, 1);
+        }
+        console.log("Setting up form listener...");
+        $("#loginForm").submit(function (event) {
+            var email = $('#email').val();
+            var firstName = $('#firstname').val();
+            var lastName = $('#lastname').val();
+            var password = $('#password').val();
+            if (password != 'test1234') {
+                bootstrapAlert.danger("Wrong password (default is : test1234)");
+                event.preventDefault();
+                return false;
+            }
+            var contextRequest = {
+                source: { // the source is required for the request to be process properly
+                    itemId: location.pathname,
+                    itemType: 'webpage',
+                    scope: 'test' // the scope is used to regroup events and sessions into sub-groups (eg sites)
+                },
+                events: [{ // here we provide a simple login event, but as this is actually an array we could provide other events at the same time (page view, clicks, mouse movements, ...)
+                    eventType: "login",
+                    properties: {},
+                    target: {
+                        itemId: email,
+                        itemType: "exampleUser",
+                        properties: {
+                            preferredLanguage: "en",
+                            email: email,
+                            firstName: firstName,
+                            lastName: lastName
+                        }
+                    }
+                }],
+                requiredProfileProperties: ['*'], // this tells Unomi to send us back all the profile properties (by default none are returned)
+                requiredSessionProperties: ['*']  // this tells Unomi to send us back all the session properties (by default none are returned)
+            };
+            // now let's perform the actual call to Apache Unomi, asking it to process the events and give us back the updated (or created) profile.
+            // as we have a rule listening to a login event, it will be executed and its actions will be processed.
+            $.ajax({
+                url: "http://localhost:8181/context.json?sessionId=" + unomiSessionId,
+                type: 'POST',
+                data: JSON.stringify(contextRequest), // make sure you sent JSON and not form-encoded, otherwise Unomi will generate an error
+                contentType: 'application/json; charset=utf-8',
+                dataType: 'json',
+                async: false,
+                success: function (data) {
+                    console.log("Unomi response:", data);
+                    bootstrapAlert.success("Successfully sent login event to Apache Unomi ! (profileId=" + data.profileId + ",properties.email=" + data.profileProperties.email + ",nbOfVisits=" + data.profileProperties.nbOfVisits + ")");
+                }
+            });
+            event.preventDefault();
+            return false;
+        });
+    });
+
+})();
+

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ef860382/samples/pom.xml
----------------------------------------------------------------------
diff --git a/samples/pom.xml b/samples/pom.xml
index 8941427..67e0d6f 100644
--- a/samples/pom.xml
+++ b/samples/pom.xml
@@ -28,7 +28,7 @@
     <packaging>pom</packaging>
     <modules>
         <module>tweet-button-plugin</module>
+        <module>login-integration</module>
     </modules>
 
-
 </project>
\ No newline at end of file


[28/50] [abbrv] incubator-unomi git commit: UNOMI-98 Provide an example of integrating with an externally triggered login Add a README file in the top level samples directory

Posted by sh...@apache.org.
UNOMI-98 Provide an example of integrating with an externally triggered login
Add a README file in the top level samples directory

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/21a9b34a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/21a9b34a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/21a9b34a

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 21a9b34a871f08691c03261be5e6455d0ad237ca
Parents: 53fb16e
Author: Serge Huber <sh...@apache.org>
Authored: Mon May 29 14:15:39 2017 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Mon May 29 14:15:39 2017 +0200

----------------------------------------------------------------------
 samples/README.md | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/21a9b34a/samples/README.md
----------------------------------------------------------------------
diff --git a/samples/README.md b/samples/README.md
new file mode 100644
index 0000000..73811d2
--- /dev/null
+++ b/samples/README.md
@@ -0,0 +1 @@
+In this directory you can find different samples of how to integrate Unomi. 


[24/50] [abbrv] incubator-unomi git commit: UNOMI-96 improved ip check to allow ipv6 and avoid local or network address

Posted by sh...@apache.org.
UNOMI-96 improved ip check to allow ipv6 and avoid local or network address


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/84a99295
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/84a99295
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/84a99295

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 84a992951a69faf5d3030997cbb635e1b6401cb0
Parents: c559ecd
Author: dgaillard <dg...@jahia.com>
Authored: Thu May 11 18:10:35 2017 +0200
Committer: dgaillard <dg...@jahia.com>
Committed: Thu May 11 18:10:57 2017 +0200

----------------------------------------------------------------------
 .../actions/SetRemoteHostInfoAction.java        | 51 ++++++++++++++------
 1 file changed, 35 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/84a99295/plugins/request/src/main/java/org/apache/unomi/plugins/request/actions/SetRemoteHostInfoAction.java
----------------------------------------------------------------------
diff --git a/plugins/request/src/main/java/org/apache/unomi/plugins/request/actions/SetRemoteHostInfoAction.java b/plugins/request/src/main/java/org/apache/unomi/plugins/request/actions/SetRemoteHostInfoAction.java
index f8f70e3..f0d29a2 100644
--- a/plugins/request/src/main/java/org/apache/unomi/plugins/request/actions/SetRemoteHostInfoAction.java
+++ b/plugins/request/src/main/java/org/apache/unomi/plugins/request/actions/SetRemoteHostInfoAction.java
@@ -23,6 +23,7 @@ import com.maxmind.geoip2.model.CityResponse;
 import net.sf.uadetector.ReadableUserAgent;
 import net.sf.uadetector.UserAgentStringParser;
 import net.sf.uadetector.service.UADetectorServiceFactory;
+import org.apache.http.conn.util.InetAddressUtils;
 import org.apache.unomi.api.Event;
 import org.apache.unomi.api.Session;
 import org.apache.unomi.api.actions.Action;
@@ -36,13 +37,15 @@ import javax.servlet.http.HttpServletRequest;
 import java.io.File;
 import java.io.IOException;
 import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.net.UnknownHostException;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.regex.Pattern;
 
 public class SetRemoteHostInfoAction implements ActionExecutor {
-    public static final Pattern IPV4 = Pattern.compile("[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}");
     private static final Logger logger = LoggerFactory.getLogger(SetRemoteHostInfoAction.class.getName());
+
     private DatabaseReader databaseReader;
     private String pathToGeoLocationDatabase;
 
@@ -117,8 +120,8 @@ public class SetRemoteHostInfoAction implements ActionExecutor {
         session.setProperty("remoteAddr", remoteAddr);
         session.setProperty("remoteHost", httpServletRequest.getRemoteHost());
         try {
-            if (!remoteAddr.equals("127.0.0.1") && IPV4.matcher(remoteAddr).matches()) {
-                ipLookup(remoteAddr, session);
+            if (isAValidIPAddress(remoteAddr)) {
+                ipLookupInDatabase(remoteAddr, session);
             } else {
                 session.setProperty("sessionCountryCode", defaultSessionCountryCode);
                 session.setProperty("sessionCountryName", defaultSessionCountryName);
@@ -149,13 +152,6 @@ public class SetRemoteHostInfoAction implements ActionExecutor {
         return EventService.SESSION_UPDATED;
     }
 
-    private boolean ipLookup(String remoteAddr, Session session) {
-        if (databaseReader != null) {
-            return ipLookupInDatabase(remoteAddr, session);
-        }
-        return false;
-    }
-
     @PostConstruct
     public void postConstruct() {
         // A File object pointing to your GeoIP2 or GeoLite2 database
@@ -177,16 +173,15 @@ public class SetRemoteHostInfoAction implements ActionExecutor {
 
     }
 
-    public boolean ipLookupInDatabase(String remoteAddr, Session session) {
+    private boolean ipLookupInDatabase(String remoteAddr, Session session) {
         if (databaseReader == null) {
             return false;
         }
 
-        // Replace "city" with the appropriate method for your database, e.g.,
-        // "country".
-        CityResponse cityResponse = null;
         try {
-            cityResponse = databaseReader.city(InetAddress.getByName(remoteAddr));
+            // Replace "city" with the appropriate method for your database, e.g.,
+            // "country".
+            CityResponse cityResponse = databaseReader.city(InetAddress.getByName(remoteAddr));
 
             if (cityResponse.getCountry().getName() != null) {
                 session.setProperty("sessionCountryCode", cityResponse.getCountry().getIsoCode());
@@ -220,4 +215,28 @@ public class SetRemoteHostInfoAction implements ActionExecutor {
         }
         return false;
     }
+
+    private static boolean isAValidIPAddress(String remoteAddr) {
+        if (InetAddressUtils.isIPv4Address(remoteAddr) || InetAddressUtils.isIPv6Address(remoteAddr)) {
+            InetAddress addr;
+            try {
+                addr = InetAddress.getByName(remoteAddr);
+            } catch (UnknownHostException e) {
+                logger.debug("Cannot resolve IP", e);
+                return false;
+            }
+            // Check if the address is a valid special local or loop back
+            if (addr.isAnyLocalAddress() || addr.isLoopbackAddress()) {
+                return false;
+            }
+
+            // Check if the address is not defined on any interface
+            try {
+                return NetworkInterface.getByInetAddress(addr) == null;
+            } catch (SocketException e) {
+                return false;
+            }
+        }
+        return false;
+    }
 }


[49/50] [abbrv] incubator-unomi git commit: UNOMI-5 Upgrade to Karaf 4

Posted by sh...@apache.org.
UNOMI-5 Upgrade to Karaf 4

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/bc2f09fb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/bc2f09fb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/bc2f09fb

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: bc2f09fb963bf7cfee7a8d9b2b3bf7ef8fd1e57a
Parents: d607e91
Author: Serge Huber <sh...@apache.org>
Authored: Mon Jan 30 20:24:45 2017 +0100
Committer: Serge Huber <sh...@apache.org>
Committed: Sat Jun 24 20:36:54 2017 +0200

----------------------------------------------------------------------
 .../resources/OSGI-INF/blueprint/blueprint.xml  |  2 +-
 .../resources/OSGI-INF/blueprint/blueprint.xml  |  2 +-
 .../resources/OSGI-INF/blueprint/blueprint.xml  |  2 +-
 kar/src/main/feature/feature.xml                |  2 +-
 package/pom.xml                                 | 43 +++++++++++++++-----
 .../resources/OSGI-INF/blueprint/blueprint.xml  | 16 ++++----
 .../resources/OSGI-INF/blueprint/blueprint.xml  |  2 +-
 .../resources/OSGI-INF/blueprint/blueprint.xml  |  4 +-
 pom.xml                                         | 19 ++++++---
 .../resources/OSGI-INF/blueprint/blueprint.xml  |  2 +-
 services/pom.xml                                |  5 ---
 .../services/services/SegmentServiceImpl.java   | 33 ---------------
 .../resources/OSGI-INF/blueprint/blueprint.xml  | 26 ++++++------
 .../markdown/versions/master/getting-started.md |  2 +-
 .../resources/OSGI-INF/blueprint/blueprint.xml  | 14 ++++++-
 15 files changed, 87 insertions(+), 87 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/bc2f09fb/extensions/geonames/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/extensions/geonames/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/extensions/geonames/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 95a7366..767cc09 100644
--- a/extensions/geonames/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/extensions/geonames/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -44,6 +44,6 @@
         <property name="pathToGeonamesDatabase" value="${request.geonamesDatabase.location}"/>
         <property name="forceDbImport" value="${request.geonamesDatabase.forceImport}"/>
     </bean>
-    <service id="geonamesService" ref="geonamesServiceImpl" auto-export="interfaces"/>
+    <service id="geonamesService" ref="geonamesServiceImpl" interface="org.apache.unomi.geonames.services.GeonamesService"/>
 
 </blueprint>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/bc2f09fb/extensions/lists-extension/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/extensions/lists-extension/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/extensions/lists-extension/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 9b1f44b..9398d0e 100644
--- a/extensions/lists-extension/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/extensions/lists-extension/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -31,5 +31,5 @@
         <property name="persistenceService" ref="persistenceService"/>
         <property name="definitionsService" ref="definitionsService"/>
     </bean>
-    <service id="userListService" ref="userListServiceImpl" auto-export="interfaces"/>
+    <service id="userListService" ref="userListServiceImpl" interface="org.apache.unomi.services.UserListService"/>
 </blueprint>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/bc2f09fb/extensions/privacy-extension/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/extensions/privacy-extension/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/extensions/privacy-extension/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 2755772..06302db 100644
--- a/extensions/privacy-extension/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/extensions/privacy-extension/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -45,5 +45,5 @@
         <property name="defaultDeniedProperties" value="${defaultDeniedProperties}" />
         <property name="bundleContext" ref="blueprintBundleContext"/>
     </bean>
-    <service id="privacyService" ref="privacyServiceImpl" auto-export="interfaces"/>
+    <service id="privacyService" ref="privacyServiceImpl" interface="org.apache.unomi.api.services.PrivacyService"/>
 </blueprint>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/bc2f09fb/kar/src/main/feature/feature.xml
----------------------------------------------------------------------
diff --git a/kar/src/main/feature/feature.xml b/kar/src/main/feature/feature.xml
index e3351b7..a692461 100644
--- a/kar/src/main/feature/feature.xml
+++ b/kar/src/main/feature/feature.xml
@@ -16,7 +16,7 @@
   ~ limitations under the License.
   -->
 
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="unomi-kar">
+<features name="unomi-kar" xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.3.0 http://karaf.apache.org/xmlns/features/v1.3.0">
     <feature description="unomi-kar" version="${project.version}" name="unomi-kar"
              start-level="70">
         <feature>war</feature>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/bc2f09fb/package/pom.xml
----------------------------------------------------------------------
diff --git a/package/pom.xml b/package/pom.xml
index d84ec38..e283e53 100644
--- a/package/pom.xml
+++ b/package/pom.xml
@@ -36,6 +36,8 @@
 
     <dependencies>
 
+        <!-- Standard Apache Karaf Features -->
+
         <dependency>
             <!-- scope is compile so all features (there is only one) are installed into startup.properties and the feature repo itself is not installed -->
             <groupId>org.apache.karaf.features</groupId>
@@ -45,13 +47,19 @@
         <dependency>
             <!-- scope is runtime so the feature repo is listed in the features service config file, and features may be installed using the karaf-maven-plugin configuration -->
             <groupId>org.apache.karaf.features</groupId>
-            <artifactId>standard</artifactId>
+            <artifactId>framework</artifactId>
             <classifier>features</classifier>
             <type>xml</type>
             <scope>runtime</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.karaf.features</groupId>
+            <artifactId>standard</artifactId>
+            <classifier>features</classifier>
+            <type>xml</type>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.karaf.features</groupId>
             <artifactId>spring</artifactId>
             <classifier>features</classifier>
             <type>xml</type>
@@ -65,7 +73,8 @@
             <scope>runtime</scope>
         </dependency>
 
-        <!--
+        <!-- Aditionnal Apache Unomi features -->
+
         <dependency>
             <groupId>org.apache.cxf.karaf</groupId>
             <artifactId>apache-cxf</artifactId>
@@ -73,7 +82,6 @@
             <type>xml</type>
             <scope>runtime</scope>
         </dependency>
-        -->
         <dependency>
             <groupId>org.apache.karaf.cellar</groupId>
             <artifactId>apache-karaf-cellar</artifactId>
@@ -309,16 +317,16 @@
                         <artifactId>karaf-maven-plugin</artifactId>
                         <executions>
                             <execution>
-                                <id>install-kar</id>
-                                <phase>compile</phase>
+                                <id>process-resources</id>
+                                <phase>process-resources</phase>
                                 <goals>
-                                    <goal>install-kars</goal>
+                                    <goal>assembly</goal>
                                 </goals>
                             </execution>
                             <execution>
                                 <id>package</id>
                                 <goals>
-                                    <goal>instance-create-archive</goal>
+                                    <goal>archive</goal>
                                 </goals>
                             </execution>
                         </executions>
@@ -327,13 +335,26 @@
                                 <feature>wrapper</feature>
                             </installedFeatures>
                             <bootFeatures>
-                                <feature>standard</feature>
-                                <feature>management</feature>
+                                <feature>framework</feature>
+                                <feature>wrap</feature>
+                                <feature>aries-blueprint</feature>
+                                <feature>shell</feature>
+                                <feature>shell-compat</feature>
+                                <feature>feature</feature>
+                                <feature>jaas</feature>
                                 <feature>ssh</feature>
+                                <feature>management</feature>
+                                <feature>bundle</feature>
                                 <feature>config</feature>
-                                <feature>region</feature>
-                                <feature>package</feature>
+                                <feature>deployer</feature>
+                                <feature>diagnostic</feature>
+                                <feature>feature</feature>
+                                <feature>instance</feature>
                                 <feature>kar</feature>
+                                <feature>log</feature>
+                                <feature>package</feature>
+                                <feature>service</feature>
+                                <feature>system</feature>
                                 <feature>war</feature>
                                 <feature>cxf</feature>
                                 <feature>cellar</feature>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/bc2f09fb/plugins/baseplugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/plugins/baseplugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index d6c1b10..263881e 100644
--- a/plugins/baseplugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/plugins/baseplugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -144,7 +144,7 @@
 
     <!-- Action executors -->
 
-    <service auto-export="interfaces">
+    <service interface="org.apache.unomi.api.actions.ActionExecutor">
         <service-properties>
             <entry key="actionExecutorId" value="allEventToProfileProperties"/>
         </service-properties>
@@ -154,7 +154,7 @@
         </bean>
     </service>
 
-    <service auto-export="interfaces">
+    <service interface="org.apache.unomi.api.actions.ActionExecutor">
         <service-properties>
             <entry key="actionExecutorId" value="eventToProfileProperty"/>
         </service-properties>
@@ -163,7 +163,7 @@
         </bean>
     </service>
 
-    <service auto-export="interfaces">
+    <service interface="org.apache.unomi.api.actions.ActionExecutor">
         <service-properties>
             <entry key="actionExecutorId" value="setProperty"/>
         </service-properties>
@@ -172,7 +172,7 @@
         </bean>
     </service>
 
-    <service auto-export="interfaces">
+    <service interface="org.apache.unomi.api.actions.ActionExecutor">
         <service-properties>
             <entry key="actionExecutorId" value="evaluateProfileSegments"/>
         </service-properties>
@@ -181,14 +181,14 @@
         </bean>
     </service>
 
-    <service auto-export="interfaces">
+    <service interface="org.apache.unomi.api.actions.ActionExecutor">
         <service-properties>
             <entry key="actionExecutorId" value="evaluateProfileAge"/>
         </service-properties>
         <bean class="org.apache.unomi.plugins.baseplugin.actions.EvaluateProfileAgeAction"/>
     </service>
 
-    <service auto-export="interfaces">
+    <service interface="org.apache.unomi.api.actions.ActionExecutor">
         <service-properties>
             <entry key="actionExecutorId" value="setEventOccurenceCount"/>
         </service-properties>
@@ -198,7 +198,7 @@
         </bean>
     </service>
 
-    <service auto-export="interfaces">
+    <service interface="org.apache.unomi.api.actions.ActionExecutor">
         <service-properties>
             <entry key="actionExecutorId" value="sendEvent"/>
         </service-properties>
@@ -207,7 +207,7 @@
         </bean>
     </service>
 
-    <service auto-export="interfaces">
+    <service interface="org.apache.unomi.api.actions.ActionExecutor">
         <service-properties>
             <entry key="actionExecutorId" value="mergeProfilesOnProperty"/>
         </service-properties>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/bc2f09fb/plugins/mail/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/plugins/mail/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/plugins/mail/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index e8e1849..0d9fa50 100644
--- a/plugins/mail/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/plugins/mail/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -42,7 +42,7 @@
         <property name="mailServerPassword" value="${mail.server.password}"/>
         <property name="mailServerSSLOnConnect" value="${mail.server.sslOnConnect}"/>
     </bean>
-    <service id="sendMailAction" ref="sendMailActionImpl" auto-export="interfaces">
+    <service id="sendMailAction" ref="sendMailActionImpl" interface="org.apache.unomi.api.actions.ActionExecutor">
         <service-properties>
             <entry key="actionExecutorId" value="sendMail"/>
         </service-properties>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/bc2f09fb/plugins/request/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/plugins/request/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/plugins/request/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 478657a..839ad18 100644
--- a/plugins/request/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/plugins/request/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -45,7 +45,7 @@
           class="org.apache.unomi.plugins.request.actions.RequestHeaderToProfilePropertyAction">
     </bean>
     <service id="requestHeaderToProfilePropertyAction" ref="requestHeaderToProfilePropertyActionImpl"
-             auto-export="interfaces">
+             interface="org.apache.unomi.api.actions.ActionExecutor">
         <service-properties>
             <entry key="actionExecutorId" value="requestHeaderToProfileProperty"/>
         </service-properties>
@@ -55,7 +55,7 @@
           class="org.apache.unomi.plugins.request.actions.RequestParameterToProfilePropertyAction">
     </bean>
     <service id="RequestParameterToProfilePropertyAction" ref="requestParameterToProfilePropertyActionImpl"
-             auto-export="interfaces">
+             interface="org.apache.unomi.api.actions.ActionExecutor">
         <service-properties>
             <entry key="actionExecutorId" value="requestParameterToProfileProperty"/>
         </service-properties>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/bc2f09fb/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 128b896..a26d297 100644
--- a/pom.xml
+++ b/pom.xml
@@ -64,12 +64,12 @@
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <cxf.version>3.0.2</cxf.version>
+        <cxf.version>3.1.0</cxf.version>
         <version.jackson.core>2.6.6</version.jackson.core> <!-- version used by CXF -->
         <version.jackson.jaxb>2.6.6</version.jackson.jaxb> <!-- version used by CXF -->
-        <version.karaf>3.0.8</version.karaf>
-        <version.karaf.cellar>3.0.3</version.karaf.cellar>
-        <version.pax.exam>4.11.0</version.pax.exam>
+        <version.karaf>4.0.8</version.karaf>
+        <version.karaf.cellar>4.0.3</version.karaf.cellar>
+        <version.pax.exam>4.11.2</version.pax.exam>
         <elasticsearch.version>5.2.2</elasticsearch.version>
 
         <maven.compiler.source>1.7</maven.compiler.source>
@@ -612,14 +612,20 @@
 
             <!-- Apache Karaf dependencies -->
             <dependency>
-                <!-- scope is compile so all features (there is only one) are installed into startup.properties and the feature repo itself is not installed -->
                 <groupId>org.apache.karaf.features</groupId>
                 <artifactId>framework</artifactId>
                 <version>${version.karaf}</version>
                 <type>kar</type>
             </dependency>
             <dependency>
-                <!-- scope is runtime so the feature repo is listed in the features service config file, and features may be installed using the karaf-maven-plugin configuration -->
+                <groupId>org.apache.karaf.features</groupId>
+                <artifactId>framework</artifactId>
+                <classifier>features</classifier>
+                <version>${version.karaf}</version>
+                <type>xml</type>
+                <scope>runtime</scope>
+            </dependency>
+            <dependency>
                 <groupId>org.apache.karaf.features</groupId>
                 <artifactId>standard</artifactId>
                 <classifier>features</classifier>
@@ -863,6 +869,7 @@
                     <groupId>org.apache.felix</groupId>
                     <artifactId>maven-bundle-plugin</artifactId>
                     <version>3.2.0</version>
+                    <extensions>true</extensions>
                     <configuration>
                         <instructions>
                             <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/bc2f09fb/samples/tweet-button-plugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/samples/tweet-button-plugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/samples/tweet-button-plugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 101c07c..0059ec7 100644
--- a/samples/tweet-button-plugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/samples/tweet-button-plugin/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="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/bc2f09fb/services/pom.xml
----------------------------------------------------------------------
diff --git a/services/pom.xml b/services/pom.xml
index 69a120b..5c097dd 100644
--- a/services/pom.xml
+++ b/services/pom.xml
@@ -80,11 +80,6 @@
         </dependency>
 
         <dependency>
-            <groupId>org.glassfish</groupId>
-            <artifactId>javax.json</artifactId>
-        </dependency>
-
-        <dependency>
           <groupId>com.fasterxml.jackson.core</groupId>
           <artifactId>jackson-core</artifactId>
           <scope>provided</scope>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/bc2f09fb/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java
index 979c3cb..e3e03b4 100644
--- a/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java
@@ -39,7 +39,6 @@ import org.osgi.framework.SynchronousBundleListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.json.*;
 import java.io.IOException;
 import java.net.URL;
 import java.security.MessageDigest;
@@ -65,38 +64,6 @@ public class SegmentServiceImpl extends AbstractServiceImpl implements SegmentSe
         logger.info("Initializing segment service...");
     }
 
-    public static void dumpJSON(JsonValue tree, String key, String depthPrefix) {
-        if (key != null)
-            logger.info(depthPrefix + "Key " + key + ": ");
-        switch (tree.getValueType()) {
-            case OBJECT:
-                logger.info(depthPrefix + "OBJECT");
-                JsonObject object = (JsonObject) tree;
-                for (String name : object.keySet())
-                    dumpJSON(object.get(name), name, depthPrefix + "  ");
-                break;
-            case ARRAY:
-                logger.info(depthPrefix + "ARRAY");
-                JsonArray array = (JsonArray) tree;
-                for (JsonValue val : array)
-                    dumpJSON(val, null, depthPrefix + "  ");
-                break;
-            case STRING:
-                JsonString st = (JsonString) tree;
-                logger.info(depthPrefix + "STRING " + st.getString());
-                break;
-            case NUMBER:
-                JsonNumber num = (JsonNumber) tree;
-                logger.info(depthPrefix + "NUMBER " + num.toString());
-                break;
-            case TRUE:
-            case FALSE:
-            case NULL:
-                logger.info(depthPrefix + tree.getValueType().toString());
-                break;
-        }
-    }
-
     public void setBundleContext(BundleContext bundleContext) {
         this.bundleContext = bundleContext;
     }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/bc2f09fb/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 fa2d3dd..a0edde1 100644
--- a/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -64,7 +64,7 @@
         <property name="persistenceService" ref="persistenceService"/>
         <property name="bundleContext" ref="blueprintBundleContext"/>
     </bean>
-    <service id="definitionsService" ref="definitionsServiceImpl" auto-export="interfaces"/>
+    <service id="definitionsService" ref="definitionsServiceImpl" interface="org.apache.unomi.api.services.DefinitionsService"/>
 
     <bean id="eventServiceImpl" class="org.apache.unomi.services.services.EventServiceImpl"
         init-method="init" destroy-method="destroy">
@@ -92,7 +92,7 @@
             <cm:cm-properties persistent-id="org.apache.unomi.thirdparty" update="true" />
         </property>
     </bean>
-    <service id="eventService" ref="eventServiceImpl" auto-export="interfaces"/>
+    <service id="eventService" ref="eventServiceImpl" interface="org.apache.unomi.api.services.EventService"/>
 
     <bean id="goalsServiceImpl" class="org.apache.unomi.services.services.GoalsServiceImpl"
           init-method="postConstruct" destroy-method="preDestroy">
@@ -101,7 +101,7 @@
         <property name="rulesService" ref="rulesServiceImpl"/>
         <property name="bundleContext" ref="blueprintBundleContext"/>
     </bean>
-    <service id="goalsService" ref="goalsServiceImpl" auto-export="interfaces"/>
+    <service id="goalsService" ref="goalsServiceImpl" interface="org.apache.unomi.api.services.GoalsService"/>
 
     <bean id="actionExecutorDispatcherImpl"
           class="org.apache.unomi.services.actions.ActionExecutorDispatcher">
@@ -115,7 +115,7 @@
         <property name="actionExecutorDispatcher" ref="actionExecutorDispatcherImpl"/>
         <property name="bundleContext" ref="blueprintBundleContext"/>
     </bean>
-    <service id="rulesService" ref="rulesServiceImpl" auto-export="interfaces"/>
+    <service id="rulesService" ref="rulesServiceImpl" interface="org.apache.unomi.api.services.RulesService"/>
 
     <bean id="segmentServiceImpl" class="org.apache.unomi.services.services.SegmentServiceImpl"
           init-method="postConstruct" destroy-method="preDestroy">
@@ -127,7 +127,7 @@
         <property name="taskExecutionPeriod" value="86400000"/>
         <property name="segmentUpdateBatchSize" value="${services.segment.update.batchSize}" />
     </bean>
-    <service id="segmentService" ref="segmentServiceImpl" auto-export="interfaces"/>
+    <service id="segmentService" ref="segmentServiceImpl" interface="org.apache.unomi.api.services.SegmentService"/>
 
     <bean id="userListServiceImpl" class="org.apache.unomi.services.services.UserListServiceImpl"
           init-method="postConstruct" destroy-method="preDestroy">
@@ -149,14 +149,14 @@
         <property name="purgeProfileExistTime" value="${services.profile.purge.existTime}"/>
         <property name="purgeSessionsAndEventsTime" value="${services.event.purge.existTime}"/>
     </bean>
-    <service id="profileService" ref="profileServiceImpl" auto-export="interfaces"/>
+    <service id="profileService" ref="profileServiceImpl" interface="org.apache.unomi.api.services.ProfileService"/>
 
     <bean id="queryServiceImpl" class="org.apache.unomi.services.services.QueryServiceImpl"
           init-method="postConstruct" destroy-method="preDestroy">
         <property name="persistenceService" ref="persistenceService"/>
         <property name="definitionsService" ref="definitionsServiceImpl"/>
     </bean>
-    <service id="queryService" ref="queryServiceImpl" auto-export="interfaces"/>
+    <service id="queryService" ref="queryServiceImpl" interface="org.apache.unomi.api.services.QueryService"/>
 
     <bean id="clusterServiceImpl" class="org.apache.unomi.services.services.ClusterServiceImpl"
           init-method="init" destroy-method="destroy">
@@ -176,7 +176,7 @@
         <property name="karafJMXPassword" value="${cluster.jmxPassword}" />
         <property name="karafJMXPort" value="${cluster.jmxPort}" />
     </bean>
-    <service id="clusterService" ref="clusterServiceImpl" auto-export="interfaces"/>
+    <service id="clusterService" ref="clusterServiceImpl" interface="org.apache.unomi.api.services.ClusterService"/>
 
     <!-- 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"
@@ -195,7 +195,7 @@
 
     <!-- Property merge strategy executors -->
 
-    <service auto-export="interfaces">
+    <service interface="org.apache.unomi.api.PropertyMergeStrategyExecutor">
         <service-properties>
             <entry key="propertyMergeStrategyExecutorId" value="defaultPropertyMergeStrategyExecutor"/>
         </service-properties>
@@ -203,7 +203,7 @@
         </bean>
     </service>
 
-    <service auto-export="interfaces">
+    <service interface="org.apache.unomi.api.PropertyMergeStrategyExecutor">
         <service-properties>
             <entry key="propertyMergeStrategyExecutorId" value="addPropertyMergeStrategyExecutor"/>
         </service-properties>
@@ -211,7 +211,7 @@
         </bean>
     </service>
 
-    <service auto-export="interfaces">
+    <service interface="org.apache.unomi.api.PropertyMergeStrategyExecutor">
         <service-properties>
             <entry key="propertyMergeStrategyExecutorId" value="mostRecentPropertyMergeStrategyExecutor"/>
         </service-properties>
@@ -219,7 +219,7 @@
         </bean>
     </service>
 
-    <service auto-export="interfaces">
+    <service interface="org.apache.unomi.api.PropertyMergeStrategyExecutor">
         <service-properties>
             <entry key="propertyMergeStrategyExecutorId" value="oldestPropertyMergeStrategyExecutor"/>
         </service-properties>
@@ -227,7 +227,7 @@
         </bean>
     </service>
 
-    <service auto-export="interfaces">
+    <service interface="org.apache.unomi.api.PropertyMergeStrategyExecutor">
         <service-properties>
             <entry key="propertyMergeStrategyExecutorId" value="nonEmptyPropertyMergeStrategyExecutor"/>
         </service-properties>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/bc2f09fb/src/site/markdown/versions/master/getting-started.md
----------------------------------------------------------------------
diff --git a/src/site/markdown/versions/master/getting-started.md b/src/site/markdown/versions/master/getting-started.md
index 2885965..0531f56 100644
--- a/src/site/markdown/versions/master/getting-started.md
+++ b/src/site/markdown/versions/master/getting-started.md
@@ -344,7 +344,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/bc2f09fb/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 6103121..8acfb67 100644
--- a/wab/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/wab/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -42,7 +42,12 @@
         <property name="profileIdCookieDomain" value="${web.contextserver.domain}" />
     </bean>
 
-    <service id="contextServletService" auto-export="interfaces" ref="contextServlet">
+    <service id="contextServletService" ref="contextServlet">
+        <interfaces>
+            <value>javax.servlet.Servlet</value>
+            <value>javax.servlet.ServletConfig</value>
+            <value>java.io.Serializable</value>
+        </interfaces>
         <service-properties>
             <entry key="urlPatterns">
                 <array value-type="java.lang.String">
@@ -58,7 +63,12 @@
         <property name="eventService" ref="eventService"/>
         <property name="privacyService" ref="privacyService" />
     </bean>
-    <service id="eventsCollectorServletService" auto-export="interfaces" ref="eventsCollectorServlet">
+    <service id="eventsCollectorServletService" ref="eventsCollectorServlet">
+        <interfaces>
+            <value>javax.servlet.Servlet</value>
+            <value>javax.servlet.ServletConfig</value>
+            <value>java.io.Serializable</value>
+        </interfaces>
         <service-properties>
             <entry key="urlPatterns" value="/eventcollector"/>
         </service-properties>


[23/50] [abbrv] incubator-unomi git commit: UNOMI-62 Add multivalue comparison operator ('hasAllOf', 'hasNoneOf', 'hasSomeOf') - Reintroduce notContains operator that seems to have been lost in some kind of merge.

Posted by sh...@apache.org.
UNOMI-62 Add multivalue comparison operator ('hasAllOf', 'hasNoneOf', 'hasSomeOf')
- Reintroduce notContains operator that seems to have been lost in some kind of merge.

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/c559ecd8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/c559ecd8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/c559ecd8

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: c559ecd8c39d006c2f3e012ae230b87e3452095d
Parents: 32447a7
Author: Serge Huber <sh...@apache.org>
Authored: Wed May 10 14:37:11 2017 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Wed May 10 14:37:11 2017 +0200

----------------------------------------------------------------------
 .../plugins/baseplugin/conditions/PropertyConditionEvaluator.java  | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c559ecd8/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionEvaluator.java
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionEvaluator.java b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionEvaluator.java
index d7c2d2c..67178a6 100644
--- a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionEvaluator.java
+++ b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionEvaluator.java
@@ -220,6 +220,8 @@ public class PropertyConditionEvaluator implements ConditionEvaluator {
                             (expectedValuesDateExpr != null && expectedValuesDateExpr.size() >= 2) ? (String) expectedValuesDateExpr.get(1) : null) <= 0;
         } else if (op.equals("contains")) {
             return actualValue.toString().contains(expectedValue);
+        } else if (op.equals("notContains")) {
+            return !actualValue.toString().contains(expectedValue);
         } else if (op.equals("startsWith")) {
             return actualValue.toString().startsWith(expectedValue);
         } else if (op.equals("endsWith")) {


[32/50] [abbrv] incubator-unomi git commit: UNOMI-101 : New feature to add the ability to import profiles

Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-karaf-feature/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/router/router-karaf-feature/pom.xml b/extensions/router/router-karaf-feature/pom.xml
new file mode 100644
index 0000000..8a8e62c
--- /dev/null
+++ b/extensions/router/router-karaf-feature/pom.xml
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>unomi-router</artifactId>
+        <groupId>org.apache.unomi</groupId>
+        <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>unomi-router-karaf-feature</artifactId>
+    <name>Apache Unomi :: Extensions :: Router :: Apache Karaf Feature</name>
+    <description>Apache Karaf feature for the Apache Unomi Context Server extension</description>
+    <packaging>feature</packaging>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.servicemix.bundles</groupId>
+            <artifactId>org.apache.servicemix.bundles.jsch</artifactId>
+            <version>0.1.54_1</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-net</groupId>
+            <artifactId>commons-net</artifactId>
+            <version>3.5</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.kafka</groupId>
+            <artifactId>kafka-clients</artifactId>
+            <version>0.10.1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-core</artifactId>
+            <version>${camel.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-blueprint</artifactId>
+            <version>${camel.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-jackson</artifactId>
+            <version>${camel.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-http-common</artifactId>
+            <version>${camel.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-servlet</artifactId>
+            <version>${camel.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-ftp</artifactId>
+            <version>${camel.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-stream</artifactId>
+            <version>${camel.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-kafka</artifactId>
+            <version>${camel.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-rs-security-cors</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+
+        <!-- UNOMI ROUTER Modules Dependencies -->
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+            <artifactId>unomi-persistence-spi</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+            <artifactId>unomi-router-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+            <artifactId>unomi-router-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+            <artifactId>unomi-router-service</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+            <artifactId>unomi-router-rest</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient-osgi</artifactId>
+            <type>bundle</type>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpcore-osgi</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.karaf.tooling</groupId>
+                    <artifactId>karaf-maven-plugin</artifactId>
+                    <extensions>true</extensions>
+                    <configuration>
+                        <includeTransitiveDependency>false</includeTransitiveDependency>
+                    </configuration>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+
+        <plugins>
+            <plugin>
+                <groupId>org.apache.karaf.tooling</groupId>
+                <artifactId>karaf-maven-plugin</artifactId>
+                <configuration>
+                    <startLevel>90</startLevel>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-rest/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/router/router-rest/pom.xml b/extensions/router/router-rest/pom.xml
new file mode 100644
index 0000000..e39e919
--- /dev/null
+++ b/extensions/router/router-rest/pom.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>unomi-router</artifactId>
+        <groupId>org.apache.unomi</groupId>
+        <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>unomi-router-rest</artifactId>
+    <name>Apache Unomi :: Extensions :: Router :: REST API</name>
+    <description>Router REST API</description>
+    <packaging>bundle</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+            <artifactId>unomi-router-api</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+            <artifactId>unomi-api</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>javax.ws.rs-api</artifactId>
+            <version>2.0.1</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-rs-security-cors</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient-osgi</artifactId>
+            <type>bundle</type>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpcore-osgi</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/ImportConfigurationServiceEndPoint.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/ImportConfigurationServiceEndPoint.java b/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/ImportConfigurationServiceEndPoint.java
new file mode 100644
index 0000000..42670b2
--- /dev/null
+++ b/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/ImportConfigurationServiceEndPoint.java
@@ -0,0 +1,176 @@
+/*
+ * 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.unomi.router.rest;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.cxf.jaxrs.ext.multipart.Multipart;
+import org.apache.cxf.jaxrs.ext.multipart.Attachment;
+import org.apache.cxf.rs.security.cors.CrossOriginResourceSharing;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.unomi.router.api.ImportConfiguration;
+import org.apache.unomi.router.api.services.ImportConfigurationService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.ws.rs.*;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.List;
+
+/**
+ * A JAX-RS endpoint to manage {@link org.apache.unomi.router.api.ImportConfiguration}s.
+ */
+@WebService
+@CrossOriginResourceSharing(
+        allowAllOrigins = true,
+        allowCredentials = true
+)
+public class ImportConfigurationServiceEndPoint {
+
+    private static final Logger logger = LoggerFactory.getLogger(ImportConfigurationServiceEndPoint.class.getName());
+    private final String CONFIG_TYPE_RECURRENT = "recurrent";
+
+    private ImportConfigurationService importConfigurationService;
+    private String uploadDir;
+    private String serverPort;
+
+    public ImportConfigurationServiceEndPoint () {
+        logger.info("Initializing import configuration service endpoint...");
+    }
+
+    @WebMethod(exclude = true)
+    public void setImportConfigurationService(ImportConfigurationService importConfigurationService) {
+        this.importConfigurationService = importConfigurationService;
+    }
+
+    @WebMethod(exclude = true)
+    public void setUploadDir(String uploadDir) {
+        this.uploadDir = uploadDir;
+    }
+
+    @WebMethod(exclude = true)
+    public void setServerPort(String serverPort) {
+        this.serverPort = serverPort;
+    }
+
+    /**
+     * Retrieves all the import configurations.
+     *
+     * @return all the import configurations.
+     */
+    @GET
+    @Path("/")
+    @Produces(MediaType.APPLICATION_JSON)
+    @Consumes(MediaType.APPLICATION_JSON)
+    public List<ImportConfiguration> getImportConfigurations() {
+        return importConfigurationService.getImportConfigurations();
+    }
+
+    /**
+     * Retrieves an import configuration by id.
+     *
+     * @return the import configuration that matches the given id.
+     */
+    @GET
+    @Path("/{configId}")
+    @Produces(MediaType.APPLICATION_JSON)
+    @Consumes(MediaType.APPLICATION_JSON)
+    public ImportConfiguration getImportConfiguration(@PathParam("configId") String configId) {
+        return importConfigurationService.load(configId);
+    }
+
+    /**
+     * Delete an import configuration by id.
+     *
+     * @return the deleted import configuration.
+     */
+    @DELETE
+    @Path("/{configId}")
+    @Produces(MediaType.APPLICATION_JSON)
+    @Consumes(MediaType.APPLICATION_JSON)
+    public void deleteImportConfiguration(@PathParam("configId") String configId) {
+        importConfigurationService.delete(configId);
+    }
+
+
+
+    /**
+     * Save the given import configuration.
+     *
+     * @return the import configuration saved.
+     */
+    @POST
+    @Path("/")
+    @Produces(MediaType.APPLICATION_JSON)
+    @Consumes(MediaType.APPLICATION_JSON)
+    public ImportConfiguration saveImportConfiguration(ImportConfiguration importConfiguration) {
+        ImportConfiguration importConfigSaved = importConfigurationService.save(importConfiguration);
+        if(CONFIG_TYPE_RECURRENT.equals(importConfigSaved.getConfigType())) {
+            CloseableHttpClient httpClient = HttpClients.createDefault();
+            try {
+                HttpPut httpPut = new HttpPut("http://localhost:"+serverPort+"/importConfigAdmin/");
+                StringEntity input = new StringEntity(new ObjectMapper().writeValueAsString(importConfigSaved));
+                input.setContentType(MediaType.APPLICATION_JSON);
+                httpPut.setEntity(input);
+
+                HttpResponse response = httpClient.execute(httpPut);
+
+                if (response.getStatusLine().getStatusCode() != 200) {
+                    throw new RuntimeException("Failed : HTTP error code : "
+                            + response.getStatusLine().getStatusCode());
+                }
+            } catch (IOException e) {
+                logger.warn("Unable to update Camel route [{}]", importConfiguration.getItemId());
+            }
+        }
+        return importConfigSaved;
+    }
+
+    /**
+     * Save/Update the given import configuration.
+     * Prepare the file to be processed with Camel routes
+     * @return OK / NOK Http Code.
+     */
+    @POST
+    @Path("/oneshot")
+    @Consumes(MediaType.MULTIPART_FORM_DATA)
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response processOneshotImportConfigurationCSV(@Multipart(value = "importConfigId") String importConfigId, @Multipart(value = "file") Attachment file) {
+        try {
+            java.nio.file.Path path = Paths.get(uploadDir+importConfigId+".csv");
+            Files.deleteIfExists(path);
+            InputStream in = file.getObject(InputStream.class);
+
+            Files.copy(in, path);
+
+        } catch (IOException e) {
+            e.printStackTrace();
+            return Response.serverError().build();
+        }
+        return Response.ok().build();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/extensions/router/router-rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/extensions/router/router-rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100644
index 0000000..8728a7f
--- /dev/null
+++ b/extensions/router/router-rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
+           xmlns:cxf="http://cxf.apache.org/blueprint/core" xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
+           xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
+                              http://cxf.apache.org/blueprint/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
+                              http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd
+                              http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd">
+    <cm:property-placeholder persistent-id="org.apache.unomi.router" update-strategy="reload">
+        <cm:default-properties>
+            <cm:property name="import.oneshot.uploadDir" value="/tmp/oneshot_import_configs/"/>
+        </cm:default-properties>
+    </cm:property-placeholder>
+
+    <cm:property-placeholder persistent-id="org.apache.unomi.cluster"
+                             update-strategy="reload" placeholder-prefix="${cluster.">
+        <cm:default-properties>
+            <cm:property name="cluster.contextserver.port" value="8181"/>
+        </cm:default-properties>
+    </cm:property-placeholder>
+
+    <cxf:bus id="cxsServiceBus">
+        <cxf:features>
+            <cxf:logging/>
+        </cxf:features>
+    </cxf:bus>
+
+    <bean id="cors-filter" class="org.apache.cxf.rs.security.cors.CrossOriginResourceSharingFilter"/>
+    <bean id="jacksonMapper" class="com.fasterxml.jackson.databind.ObjectMapper"/>
+    <bean id="json-provider" class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider">
+        <argument index="0" ref="jacksonMapper" type="com.fasterxml.jackson.databind.ObjectMapper"/>
+    </bean>
+    <bean id="jaas-filter" class="org.apache.cxf.jaxrs.security.JAASAuthenticationFilter">
+        <!-- Name of the JAAS Context -->
+        <property name="contextName" value="karaf"/>
+        <!-- Hint to the filter on how to have Principals representing users and roles separated
+             while initializing a SecurityContext -->
+        <property name="rolePrefix" value="ROLE_"/>
+        <property name="realmName" value="cxs"/>
+    </bean>
+
+    <jaxrs:server address="/importConfiguration" id="restImportConfigurationService">
+        <jaxrs:providers>
+            <ref component-id="json-provider"/>
+            <ref component-id="cors-filter"/>
+            <ref component-id="jaas-filter"/>
+        </jaxrs:providers>
+
+        <jaxrs:serviceBeans>
+            <ref component-id="importConfigurationServiceEndPoint"/>
+        </jaxrs:serviceBeans>
+    </jaxrs:server>
+
+    <reference id="importConfigurationService" interface="org.apache.unomi.router.api.services.ImportConfigurationService"/>
+
+    <bean id="importConfigurationServiceEndPoint" class="org.apache.unomi.router.rest.ImportConfigurationServiceEndPoint">
+        <property name="importConfigurationService" ref="importConfigurationService"/>
+        <property name="uploadDir" value="${import.oneshot.uploadDir}"/>
+        <property name="serverPort" value="${cluster.contextserver.port}"/>
+    </bean>
+
+</blueprint>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-service/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/router/router-service/pom.xml b/extensions/router/router-service/pom.xml
new file mode 100644
index 0000000..0aed70e
--- /dev/null
+++ b/extensions/router/router-service/pom.xml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>unomi-router</artifactId>
+        <groupId>org.apache.unomi</groupId>
+        <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>unomi-router-service</artifactId>
+    <name>Apache Unomi :: Extensions :: Router :: Services</name>
+    <description>Router Services</description>
+    <packaging>bundle</packaging>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
+                        <Import-Package>
+                            sun.misc;resolution:=optional,
+                            *
+                        </Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+            <artifactId>unomi-api</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+            <artifactId>unomi-router-api</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+            <artifactId>unomi-persistence-spi</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-beanutils</groupId>
+            <artifactId>commons-beanutils</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+    </dependencies>
+
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-service/src/main/java/org/apache/unomi/router/services/ImportConfigurationServiceImpl.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-service/src/main/java/org/apache/unomi/router/services/ImportConfigurationServiceImpl.java b/extensions/router/router-service/src/main/java/org/apache/unomi/router/services/ImportConfigurationServiceImpl.java
new file mode 100644
index 0000000..a4f6131
--- /dev/null
+++ b/extensions/router/router-service/src/main/java/org/apache/unomi/router/services/ImportConfigurationServiceImpl.java
@@ -0,0 +1,114 @@
+/*
+ * 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.unomi.router.services;
+
+import org.apache.unomi.router.api.ImportConfiguration;
+import org.apache.unomi.router.api.services.ImportConfigurationService;
+import org.apache.unomi.persistence.spi.PersistenceService;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.SynchronousBundleListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * Created by amidani on 28/04/2017.
+ */
+public class ImportConfigurationServiceImpl implements ImportConfigurationService,SynchronousBundleListener {
+
+    private static final Logger logger = LoggerFactory.getLogger(ImportConfigurationServiceImpl.class.getName());
+
+    private BundleContext bundleContext;
+    private PersistenceService persistenceService;
+
+    public ImportConfigurationServiceImpl() {
+        logger.info("Initializing import configuration service...");
+    }
+
+    public void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
+
+    public void setPersistenceService(PersistenceService persistenceService) {
+        this.persistenceService = persistenceService;
+    }
+
+    public void postConstruct() {
+        logger.debug("postConstruct {" + bundleContext.getBundle() + "}");
+
+        processBundleStartup(bundleContext);
+        for (Bundle bundle : bundleContext.getBundles()) {
+            if (bundle.getBundleContext() != null) {
+                processBundleStartup(bundle.getBundleContext());
+            }
+        }
+        bundleContext.addBundleListener(this);
+        logger.info("Import configuration service initialized.");
+    }
+
+    public void preDestroy() {
+        bundleContext.removeBundleListener(this);
+        logger.info("Import configuration service shutdown.");
+    }
+
+    private void processBundleStartup(BundleContext bundleContext) {
+        if (bundleContext == null) {
+            return;
+        }
+    }
+
+    private void processBundleStop(BundleContext bundleContext) {
+    }
+
+
+    @Override
+    public List<ImportConfiguration> getImportConfigurations() {
+        return persistenceService.getAllItems(ImportConfiguration.class);
+    }
+
+    @Override
+    public ImportConfiguration load(String configId) {
+        return persistenceService.load(configId, ImportConfiguration.class);
+    }
+
+    @Override
+    public ImportConfiguration save(ImportConfiguration importConfiguration) {
+        if (importConfiguration.getItemId() == null) {
+            importConfiguration.setItemId(UUID.randomUUID().toString());
+        }
+        if(persistenceService.save(importConfiguration)) {
+
+        }
+
+        return persistenceService.load(importConfiguration.getItemId(), ImportConfiguration.class);
+    }
+
+    @Override
+    public void delete(String configId) {
+        persistenceService.remove(configId, ImportConfiguration.class);
+    }
+
+    @Override
+    public void bundleChanged(BundleEvent bundleEvent) {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-service/src/main/java/org/apache/unomi/router/services/ProfileImportServiceImpl.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-service/src/main/java/org/apache/unomi/router/services/ProfileImportServiceImpl.java b/extensions/router/router-service/src/main/java/org/apache/unomi/router/services/ProfileImportServiceImpl.java
new file mode 100644
index 0000000..cb1d706
--- /dev/null
+++ b/extensions/router/router-service/src/main/java/org/apache/unomi/router/services/ProfileImportServiceImpl.java
@@ -0,0 +1,121 @@
+/*
+ * 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.unomi.router.services;
+
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.unomi.api.Profile;
+import org.apache.unomi.api.services.EventListenerService;
+import org.apache.unomi.persistence.spi.PersistenceService;
+import org.apache.unomi.router.api.ProfileToImport;
+import org.apache.unomi.router.api.services.ProfileImportService;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.SynchronousBundleListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+/**
+ * Created by amidani on 18/05/2017.
+ */
+public class ProfileImportServiceImpl implements ProfileImportService, SynchronousBundleListener {
+
+    private static final Logger logger = LoggerFactory.getLogger(ProfileImportServiceImpl.class.getName());
+
+    private PersistenceService persistenceService;
+
+    private BundleContext bundleContext;
+
+    public void setPersistenceService(PersistenceService persistenceService) {
+        this.persistenceService = persistenceService;
+    }
+
+    public void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
+
+    public void postConstruct() {
+        logger.debug("postConstruct {" + bundleContext.getBundle() + "}");
+
+        processBundleStartup(bundleContext);
+        for (Bundle bundle : bundleContext.getBundles()) {
+            if (bundle.getBundleContext() != null) {
+                processBundleStartup(bundle.getBundleContext());
+            }
+        }
+        bundleContext.addBundleListener(this);
+        logger.info("Import configuration service initialized.");
+    }
+
+    public void preDestroy() {
+        bundleContext.removeBundleListener(this);
+        logger.info("Import configuration service shutdown.");
+    }
+
+    private void processBundleStartup(BundleContext bundleContext) {
+        if (bundleContext == null) {
+            return;
+        }
+    }
+
+    private void processBundleStop(BundleContext bundleContext) {
+    }
+
+
+    public boolean saveMergeDeleteImportedProfile(ProfileToImport profileToImport) throws InvocationTargetException, IllegalAccessException {
+        logger.debug("Importing profile with ID : {}", profileToImport.getItemId());
+        Profile existingProfile = new Profile();
+        List<Profile> existingProfiles = persistenceService.query("properties."+profileToImport.getMergingProperty(), (String)profileToImport.getProperties().get(profileToImport.getMergingProperty()), null, Profile.class);
+        logger.debug("Query existing profile with mergingProperty: {}. Found: {}", profileToImport.getMergingProperty(), existingProfiles.size());
+
+        //Profile already exist, and import config allow to overwrite profiles
+        if(existingProfiles.size() == 1) {
+            existingProfile = existingProfiles.get(0);
+            if(profileToImport.isProfileToDelete()) {
+                logger.debug("Profile is to delete!");
+                persistenceService.remove(existingProfile.getItemId(), Profile.class);
+                return true;
+            }
+            List<String> propertiesToOverwrite = profileToImport.getPropertiesToOverwrite();
+            if(profileToImport.isOverwriteExistingProfiles() && propertiesToOverwrite!=null && propertiesToOverwrite.size() > 0) { // We overwrite only properties marked to overwrite
+                logger.debug("Properties to overwrite: {}", propertiesToOverwrite);
+                for(String propName : propertiesToOverwrite) {
+                    existingProfile.getProperties().put(propName, profileToImport.getProperties().get(propName));
+                }
+            } else { //If no property is marked to overwrite we replace the whole properties map
+                logger.debug("Overwrite all properties");
+                existingProfile.setProperties(profileToImport.getProperties());
+            }
+        } else if(existingProfiles.size() == 0) {
+            logger.debug("New profile to add...");
+            BeanUtils.copyProperties(existingProfile, profileToImport);
+        } else {
+            logger.warn("{} occurences found for profile with {} = {}. Profile import is skipped", existingProfiles.size(),
+                    profileToImport.getMergingProperty(), profileToImport.getProperties().get(profileToImport.getMergingProperty()));
+        }
+        logger.debug("-------------------------------------");
+        return persistenceService.save(existingProfile);
+    }
+
+    @Override
+    public void bundleChanged(BundleEvent bundleEvent) {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/extensions/router/router-service/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/extensions/router/router-service/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/extensions/router/router-service/src/main/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100644
index 0000000..61200f2
--- /dev/null
+++ b/extensions/router/router-service/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+    <reference id="persistenceService" interface="org.apache.unomi.persistence.spi.PersistenceService"/>
+
+    <bean id="importConfigurationServiceImpl" class="org.apache.unomi.router.services.ImportConfigurationServiceImpl"
+          init-method="postConstruct" destroy-method="preDestroy">
+        <property name="persistenceService" ref="persistenceService"/>
+        <property name="bundleContext" ref="blueprintBundleContext"/>
+    </bean>
+    <service id="importConfigurationService" ref="importConfigurationServiceImpl" auto-export="interfaces"/>
+
+    <bean id="profileImportServiceImpl" class="org.apache.unomi.router.services.ProfileImportServiceImpl"
+          init-method="postConstruct" destroy-method="preDestroy">
+        <property name="persistenceService" ref="persistenceService"/>
+        <property name="bundleContext" ref="blueprintBundleContext"/>
+    </bean>
+    <service id="profileImportService" ref="profileImportServiceImpl" auto-export="interfaces"/>
+
+</blueprint>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/itests/pom.xml
----------------------------------------------------------------------
diff --git a/itests/pom.xml b/itests/pom.xml
index 6f3724c..55fe567 100644
--- a/itests/pom.xml
+++ b/itests/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-root</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version>
     </parent>
     <artifactId>unomi-itests</artifactId>
     <name>Apache Unomi :: Integration Tests</name>
@@ -32,19 +32,19 @@
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-kar</artifactId>
             <classifier>features</classifier>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>${project.version}</version>
             <type>xml</type>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-persistence-spi</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>${project.version}</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-wab</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
         

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/package/pom.xml
----------------------------------------------------------------------
diff --git a/package/pom.xml b/package/pom.xml
index 19a8e4c..cff7721 100644
--- a/package/pom.xml
+++ b/package/pom.xml
@@ -269,6 +269,17 @@
                                             </outputDirectory>
                                             <destFileName>org.apache.unomi.plugins.mail.cfg</destFileName>
                                         </artifactItem>
+                                        <artifactItem>
+                                            <groupId>org.apache.unomi</groupId>
+                                            <artifactId>unomi-router-core</artifactId>
+                                            <version>${project.version}</version>
+                                            <classifier>routercfg</classifier>
+                                            <type>cfg</type>
+                                            <outputDirectory>
+                                                ${project.build.directory}/assembly/etc
+                                            </outputDirectory>
+                                            <destFileName>org.apache.unomi.router.cfg</destFileName>
+                                        </artifactItem>
                                         <!-- UNOMI-75 : We install the blueprint core bundle in a different version to fix a problem with offline startup -->
                                         <artifactItem>
                                             <groupId>org.apache.aries.blueprint</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/performance-tests/pom.xml
----------------------------------------------------------------------
diff --git a/performance-tests/pom.xml b/performance-tests/pom.xml
index 72c7abd..44117fc 100644
--- a/performance-tests/pom.xml
+++ b/performance-tests/pom.xml
@@ -20,7 +20,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-root</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version>
     </parent>
     <artifactId>unomi-performance-tests</artifactId>
     <name>Apache Unomi :: Performance Tests</name>
@@ -30,7 +30,7 @@
         <dependency>
             <groupId>org.apache.unomi</groupId>
             <artifactId>unomi-wab</artifactId>
-            <version>1.2.0-incubating-SNAPSHOT</version>
+            <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg b/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
index 77eb091..12980e1 100644
--- a/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
+++ b/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
@@ -15,7 +15,7 @@
 # limitations under the License.
 #
 
-cluster.name=contextElasticSearch
+cluster.name=contextElasticSearch_amidani
 # The elasticSearchAddresses may be a comma seperated list of host names and ports such as
 # hostA:9300,hostB:9300
 # Note: the port number must be repeated for each host.

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/persistence-elasticsearch/plugins/pom.xml
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/plugins/pom.xml b/persistence-elasticsearch/plugins/pom.xml
index 9114ece..57eec00 100644
--- a/persistence-elasticsearch/plugins/pom.xml
+++ b/persistence-elasticsearch/plugins/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.unomi</groupId>
         <artifactId>unomi-persistence-elasticsearch</artifactId>
-        <version>1.2.0-incubating-SNAPSHOT</version>
+        <version>1.2.0-incubating-dmf_1343-SNAPSHOT</version>
     </parent>
 
     <artifactId>unomi-persistence-elasticsearch-plugins</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/samples/trainingplugin.zip
----------------------------------------------------------------------
diff --git a/samples/trainingplugin.zip b/samples/trainingplugin.zip
new file mode 100644
index 0000000..1226fc1
Binary files /dev/null and b/samples/trainingplugin.zip differ

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/samples/trainingplugin/pom.xml
----------------------------------------------------------------------
diff --git a/samples/trainingplugin/pom.xml b/samples/trainingplugin/pom.xml
new file mode 100644
index 0000000..34711a7
--- /dev/null
+++ b/samples/trainingplugin/pom.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>samples</artifactId>
+        <groupId>org.apache.unomi</groupId>
+        <version>1.2.0-incubating-SNAPSHOT</version>
+    </parent>
+    <artifactId>training-plugin</artifactId>
+    <name>Apache Unomi :: Samples :: Training plugin</name>
+    <packaging>bundle</packaging>
+    <description>This is a simple Apache Unomi plugin.</description>
+    <modelVersion>4.0.0</modelVersion>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+            <artifactId>unomi-api</artifactId>
+            <version>1.2.0-incubating-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/samples/trainingplugin/src/main/java/org/apache/unomi/training/TrainedNotificationAction.java
----------------------------------------------------------------------
diff --git a/samples/trainingplugin/src/main/java/org/apache/unomi/training/TrainedNotificationAction.java b/samples/trainingplugin/src/main/java/org/apache/unomi/training/TrainedNotificationAction.java
new file mode 100644
index 0000000..7f64cbd
--- /dev/null
+++ b/samples/trainingplugin/src/main/java/org/apache/unomi/training/TrainedNotificationAction.java
@@ -0,0 +1,61 @@
+/*
+ * 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.unomi.training;
+
+import org.apache.unomi.api.Event;
+import org.apache.unomi.api.Metadata;
+import org.apache.unomi.api.Profile;
+import org.apache.unomi.api.PropertyType;
+import org.apache.unomi.api.actions.Action;
+import org.apache.unomi.api.actions.ActionExecutor;
+import org.apache.unomi.api.services.EventService;
+import org.apache.unomi.api.services.ProfileService;
+
+import java.util.Collections;
+
+/**
+ * Created by amidani on 11/04/2017.
+ */
+public class TrainedNotificationAction implements ActionExecutor {
+
+    private static final String TRAINED_NB_PROPERTY = "trained";
+    private static final String TARGET = "profiles";
+
+    private ProfileService service;
+
+    public void setProfileService(ProfileService service) {
+        this.service = service;
+    }
+
+    @Override
+    public int execute(Action action, Event event) {
+        final Profile profile = event.getProfile();
+        Integer trained = (Integer) profile.getProperty(TRAINED_NB_PROPERTY);
+
+        if (trained == null) {
+            // create trained flag property type
+            PropertyType propertyType = new PropertyType(new Metadata(event.getScope(), TRAINED_NB_PROPERTY, TRAINED_NB_PROPERTY, "Am I trained"));
+            propertyType.setValueTypeId("boolean");
+            propertyType.setTagIds(Collections.singleton("training"));
+            propertyType.setTarget(TARGET);
+            service.setPropertyType(propertyType);
+        }
+
+        profile.setProperty(TRAINED_NB_PROPERTY, true);
+        return EventService.PROFILE_UPDATED;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/samples/trainingplugin/src/main/resources/META-INF/cxs/actions/trainingNotifAction.json
----------------------------------------------------------------------
diff --git a/samples/trainingplugin/src/main/resources/META-INF/cxs/actions/trainingNotifAction.json b/samples/trainingplugin/src/main/resources/META-INF/cxs/actions/trainingNotifAction.json
new file mode 100644
index 0000000..2ac9763
--- /dev/null
+++ b/samples/trainingplugin/src/main/resources/META-INF/cxs/actions/trainingNotifAction.json
@@ -0,0 +1,13 @@
+{
+  "metadata": {
+    "id": "trainingNotifAction",
+    "name": "Training Action",
+    "description": "",
+    "tags": [
+      "event"
+    ],
+    "readOnly": true
+  },
+  "actionExecutor": "training",
+  "parameters": []
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/samples/trainingplugin/src/main/resources/META-INF/cxs/rules/trainedNotification.json
----------------------------------------------------------------------
diff --git a/samples/trainingplugin/src/main/resources/META-INF/cxs/rules/trainedNotification.json b/samples/trainingplugin/src/main/resources/META-INF/cxs/rules/trainedNotification.json
new file mode 100644
index 0000000..e098e3e
--- /dev/null
+++ b/samples/trainingplugin/src/main/resources/META-INF/cxs/rules/trainedNotification.json
@@ -0,0 +1,20 @@
+{
+  "metadata": {
+    "id": "smp:trainedRule",
+    "name": "Trained",
+    "description": "..."
+  },
+  "raiseEventOnlyOnceForSession": false,
+  "condition": {
+    "type": "eventTypeCondition",
+    "parameterValues": {
+      "eventTypeId": "trainingEvent"
+    }
+  },
+  "actions": [
+    {
+      "type": "trainingNotifAction",
+      "parameterValues": {}
+    }
+  ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/89d4c8eb/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
new file mode 100644
index 0000000..41764cc
--- /dev/null
+++ b/samples/trainingplugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+    <reference id="profileService" interface="org.apache.unomi.api.services.ProfileService"/>
+
+    <!-- Action executor -->
+    <service id="trainingNotifAction" auto-export="interfaces">
+        <service-properties>
+            <entry key="actionExecutorId" value="training"/>
+        </service-properties>
+        <bean class="org.apache.unomi.training.TrainedNotificationAction">
+            <property name="profileService" ref="profileService"/>
+        </bean>
+    </service>
+</blueprint>


[44/50] [abbrv] incubator-unomi git commit: UNOMI-101 : Execution History and Import Status improvement

Posted by sh...@apache.org.
UNOMI-101 : Execution History and Import Status improvement


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/6203e994
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/6203e994
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/6203e994

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 6203e9947f5da98dc54eff20d7906fc5b51d1259
Parents: 6570c8a
Author: Abdelkader Midani <am...@apache.org>
Authored: Sun Jun 18 08:36:08 2017 +0200
Committer: Abdelkader Midani <am...@apache.org>
Committed: Sun Jun 18 08:36:08 2017 +0200

----------------------------------------------------------------------
 .../unomi/router/api/ImportConfiguration.java     | 18 +++++++++---------
 .../apache/unomi/router/core/RouterConstants.java | 13 +++++++++----
 .../core/processor/RouteCompletionProcessor.java  |  8 +++++++-
 .../ProfileImportFromSourceRouteBuilder.java      |  2 +-
 4 files changed, 26 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/6203e994/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ImportConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ImportConfiguration.java b/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ImportConfiguration.java
index bf17a31..ee0184a 100644
--- a/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ImportConfiguration.java
+++ b/extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ImportConfiguration.java
@@ -44,7 +44,7 @@ public class ImportConfiguration extends Item {
     private String columnSeparator = ",";
     private String lineSeparator = "\n";
     private boolean active = false;
-    private boolean running = false;
+    private String status;
 
     private List<Map<String, Object>> executions = new ArrayList();
 
@@ -162,21 +162,21 @@ public class ImportConfiguration extends Item {
     }
 
     /**
-     * Retrieves the import configuration running flag.
+     * Retrieves the import configuration status for last execution.
      *
-     * @return true if the import configuration is running false if not
+     * @return status of the last execution
      */
-    public boolean isRunning() {
-        return this.running;
+    public String getStatus() {
+        return this.status;
     }
 
     /**
-     * Sets the running flag true/false.
+     * Sets status of the last execution.
      *
-     * @param running a boolean to set to running or inactive the import configuration
+     * @param status of the last execution
      */
-    public void setRunning(boolean running) {
-        this.running = running;
+    public void setStatus(String status) {
+        this.status = status;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/6203e994/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/RouterConstants.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/RouterConstants.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/RouterConstants.java
index d15f2c3..04e3709 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/RouterConstants.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/RouterConstants.java
@@ -24,13 +24,18 @@ public interface RouterConstants {
     String CONFIG_TYPE_NOBROKER = "nobroker";
     String CONFIG_TYPE_KAFKA = "kafka";
 
+    String CONFIG_STATUS_RUNNING = "RUNNING";
+    String CONFIG_STATUS_COMPLETE_ERRORS = "ERRORS";
+    String CONFIG_STATUS_COMPLETE_SUCCESS = "SUCCESS";
+    String CONFIG_STATUS_COMPLETE_WITH_ERRORS = "WITH_ERRORS";
+
     String DIRECT_DEPOSIT_BUFFER = "direct:depositBuffer";
 
-    String HEADER_IMPORT_CONFIG_ONESHOT = "importConfigOneShot";
+    String DIRECTION_FROM = "from";
+    String DIRECTION_TO = "to";
+
     String HEADER_CONFIG_TYPE = "configType";
 
     String HEADER_FAILED_MESSAGE = "failedMessage";
-
-    String DIRECTION_FROM = "from";
-    String DIRECTION_TO = "to";
+    String HEADER_IMPORT_CONFIG_ONESHOT = "importConfigOneShot";
 }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/6203e994/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/RouteCompletionProcessor.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/RouteCompletionProcessor.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/RouteCompletionProcessor.java
index e4f01cc..5952764 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/RouteCompletionProcessor.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/RouteCompletionProcessor.java
@@ -84,7 +84,13 @@ public class RouteCompletionProcessor implements Processor {
 
         importConfiguration.getExecutions().add(execution);
         //Set running to false, route is complete
-        importConfiguration.setRunning(false);
+        if(failureCount>0 && successCount>0) {
+            importConfiguration.setStatus(RouterConstants.CONFIG_STATUS_COMPLETE_WITH_ERRORS);
+        } else if(failureCount>0 && successCount==0) {
+            importConfiguration.setStatus(RouterConstants.CONFIG_STATUS_COMPLETE_ERRORS);
+        } else if(failureCount==0 && successCount>0) {
+            importConfiguration.setStatus(RouterConstants.CONFIG_STATUS_COMPLETE_SUCCESS);
+        }
         importConfigurationService.save(importConfiguration);
         logger.info("Processing route {} completed.", exchange.getFromRouteId());
     }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/6203e994/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportFromSourceRouteBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportFromSourceRouteBuilder.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportFromSourceRouteBuilder.java
index ca64091..7d6bd07 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportFromSourceRouteBuilder.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportFromSourceRouteBuilder.java
@@ -95,7 +95,7 @@ public class ProfileImportFromSourceRouteBuilder extends ProfileImportAbstractRo
                         .process(new Processor() {
                             @Override
                             public void process(Exchange exchange) throws Exception {
-                                importConfiguration.setRunning(true);
+                                importConfiguration.setStatus(RouterConstants.CONFIG_STATUS_RUNNING);
                                 importConfigurationService.save(importConfiguration);
                             }
                         })


[14/50] [abbrv] incubator-unomi git commit: UNOMI-91 : Add internal address in the cluster/node info returned

Posted by sh...@apache.org.
UNOMI-91 : Add internal address in the cluster/node info returned


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/daaa332a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/daaa332a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/daaa332a

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: daaa332a2ed6b8296db881c0e7b291d81bd2a481
Parents: 94b6af7
Author: Abdelkader Midani <am...@apache.org>
Authored: Thu Apr 6 16:00:09 2017 +0200
Committer: Abdelkader Midani <am...@apache.org>
Committed: Thu Apr 6 16:00:44 2017 +0200

----------------------------------------------------------------------
 .../java/org/apache/unomi/api/ClusterNode.java  | 38 ++++++++++++++++++++
 .../services/services/ClusterServiceImpl.java   | 19 ++++++++++
 .../resources/OSGI-INF/blueprint/blueprint.xml  |  4 +++
 .../main/resources/org.apache.unomi.cluster.cfg |  2 ++
 4 files changed, 63 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/daaa332a/api/src/main/java/org/apache/unomi/api/ClusterNode.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/ClusterNode.java b/api/src/main/java/org/apache/unomi/api/ClusterNode.java
index ba4d579..6aee44e 100644
--- a/api/src/main/java/org/apache/unomi/api/ClusterNode.java
+++ b/api/src/main/java/org/apache/unomi/api/ClusterNode.java
@@ -32,6 +32,8 @@ public class ClusterNode implements Serializable {
     private int publicPort;
     private String secureHostAddress;
     private int securePort;
+    private String internalHostAddress;
+    private int internalPort;
     private long uptime;
     private boolean master;
     private boolean data;
@@ -133,6 +135,42 @@ public class ClusterNode implements Serializable {
     }
 
     /**
+     * Retrieves the secure host address which uses the HTTP/HTTPS protocol for communications between clients and the context server.
+     *
+     * @return the secure host address
+     */
+    public String getInternalHostAddress() {
+        return internalHostAddress;
+    }
+
+    /**
+     * Sets the internal host address which uses the HTTP/HTTPS protocol for communications between clients and the context server.
+     *
+     * @param internalHostAddress the internal host address
+     */
+    public void setInternalHostAddress(String internalHostAddress) {
+        this.internalHostAddress = internalHostAddress;
+    }
+
+    /**
+     * Retrieves the internal port.
+     *
+     * @return the internal port
+     */
+    public int getInternalPort() {
+        return internalPort;
+    }
+
+    /**
+     * Sets the internal port.
+     *
+     * @param internalPort the internal port
+     */
+    public void setInternalPort(int internalPort) {
+        this.internalPort = internalPort;
+    }
+
+    /**
      * Retrieves the load average for the last minute, five minutes and fifteen minutes.
      *
      * @return an array of {@code double} containing, in order and starting from index {@code 0}, the load average for the last minute, last five minutes and last fifteen minutes

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/daaa332a/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java
index 0e9744c..4055080 100644
--- a/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java
@@ -51,6 +51,7 @@ public class ClusterServiceImpl implements ClusterService {
     public static final String KARAF_CELLAR_CLUSTER_NODE_CONFIGURATION = "org.apache.unomi.nodes";
     public static final String KARAF_CLUSTER_CONFIGURATION_PUBLIC_ENDPOINTS = "publicEndpoints";
     public static final String KARAF_CLUSTER_CONFIGURATION_SECURE_ENDPOINTS = "secureEndpoints";
+    public static final String KARAF_CLUSTER_CONFIGURATION_INTERNAL_ENDPOINTS = "internalEndpoints";
 
     private ClusterManager karafCellarClusterManager;
     private EventProducer karafCellarEventProducer;
@@ -64,6 +65,8 @@ public class ClusterServiceImpl implements ClusterService {
     private String port;
     private String secureAddress;
     private String securePort;
+    private String internalAddress;
+    private String internalPort;
 
     private Map<String,JMXConnector> jmxConnectors = new LinkedHashMap<>();
 
@@ -121,6 +124,14 @@ public class ClusterServiceImpl implements ClusterService {
         this.securePort = securePort;
     }
 
+    public void setInternalAddress(String internalAddress) {
+        this.internalAddress = internalAddress;
+    }
+
+    public void setInternalPort(String internalPort) {
+        this.internalPort = internalPort;
+    }
+
     public void init() {
         if (karafCellarEventProducer != null && karafCellarClusterManager != null) {
 
@@ -193,9 +204,11 @@ public class ClusterServiceImpl implements ClusterService {
         Properties karafCellarClusterNodeConfiguration = clusterConfigurations.get(KARAF_CELLAR_CLUSTER_NODE_CONFIGURATION);
         Map<String, String> publicNodeEndpoints = new TreeMap<>();
         Map<String, String> secureNodeEndpoints = new TreeMap<>();
+        Map<String, String> internalNodeEndpoints = new TreeMap<>();
         if (karafCellarClusterNodeConfiguration != null) {
             publicNodeEndpoints = getMapProperty(karafCellarClusterNodeConfiguration, KARAF_CLUSTER_CONFIGURATION_PUBLIC_ENDPOINTS, thisKarafNode.getId() + "=" + address + ":" + port);
             secureNodeEndpoints = getMapProperty(karafCellarClusterNodeConfiguration, KARAF_CLUSTER_CONFIGURATION_SECURE_ENDPOINTS, thisKarafNode.getId() + "=" + secureAddress + ":" + securePort);
+            internalNodeEndpoints = getMapProperty(karafCellarClusterNodeConfiguration, KARAF_CLUSTER_CONFIGURATION_INTERNAL_ENDPOINTS, thisKarafNode.getId() + "=" + internalAddress + ":" + internalPort);
         }
         for (org.apache.karaf.cellar.core.Node karafCellarNode : karafCellarNodes) {
             ClusterNode clusterNode = new ClusterNode();
@@ -213,6 +226,12 @@ public class ClusterServiceImpl implements ClusterService {
                 clusterNode.setMaster(false);
                 clusterNode.setData(false);
             }
+            String internalEndpoint = internalNodeEndpoints.get(karafCellarNode.getId());
+            if (internalEndpoint != null) {
+                String[] internalEndpointParts = internalEndpoint.split(":");
+                clusterNode.setInternalHostAddress(internalEndpointParts[0]);
+                clusterNode.setInternalPort(Integer.parseInt(internalEndpointParts[1]));
+            }
             try {
                 String serviceUrl = "service:jmx:rmi:///jndi/rmi://"+karafCellarNode.getHost() + ":"+karafJMXPort+"/karaf-root";
                 JMXConnector jmxConnector = getJMXConnector(serviceUrl);

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/daaa332a/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 c5dfdd6..fa2d3dd 100644
--- a/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -44,6 +44,8 @@
             <cm:property name="contextserver.port" value="8181"/>
             <cm:property name="contextserver.secureAddress" value="localhost"/>
             <cm:property name="contextserver.securePort" value="9443"/>
+            <cm:property name="contextserver.internalAddress" value="127.0.0.1"/>
+            <cm:property name="contextserver.internalPort" value="8181"/>
         </cm:default-properties>
     </cm:property-placeholder>
 
@@ -162,6 +164,8 @@
         <property name="port" value="${cluster.contextserver.port}"/>
         <property name="secureAddress" value="${cluster.contextserver.secureAddress}"/>
         <property name="securePort" value="${cluster.contextserver.securePort}"/>
+        <property name="internalAddress" value="${cluster.contextserver.internalAddress}"/>
+        <property name="internalPort" value="${cluster.contextserver.internalPort}"/>
         <property name="persistenceService" ref="persistenceService"/>
         <property name="karafCellarClusterManager" ref="karafCellarClusterManager" />
         <property name="karafCellarEventProducer" ref="karafCellarEventProducer" />

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/daaa332a/services/src/main/resources/org.apache.unomi.cluster.cfg
----------------------------------------------------------------------
diff --git a/services/src/main/resources/org.apache.unomi.cluster.cfg b/services/src/main/resources/org.apache.unomi.cluster.cfg
index f2bf05a..f4beddf 100644
--- a/services/src/main/resources/org.apache.unomi.cluster.cfg
+++ b/services/src/main/resources/org.apache.unomi.cluster.cfg
@@ -22,3 +22,5 @@ contextserver.address=localhost
 contextserver.port=8181
 contextserver.secureAddress=localhost
 contextserver.securePort=9443
+contextserver.internalAddress=127.0.0.1
+contextserver.internalPort=8181


[06/50] [abbrv] incubator-unomi git commit: UNOMI-79 : Implement save persona with sessions.

Posted by sh...@apache.org.
UNOMI-79 : Implement save persona with sessions.


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/585d427b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/585d427b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/585d427b

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 585d427ba9dfa18d3a9a8e1e1cf25c3de6cef1d7
Parents: 26db159
Author: rizak <ri...@gmail.com>
Authored: Mon Feb 27 16:23:02 2017 +0100
Committer: rizak <ri...@gmail.com>
Committed: Mon Feb 27 16:23:02 2017 +0100

----------------------------------------------------------------------
 .../apache/unomi/api/PersonaWithSessions.java   |  4 ++--
 .../unomi/api/services/ProfileService.java      |  8 +++++++
 .../unomi/rest/ProfileServiceEndPoint.java      | 12 ++++++++++
 .../services/services/ProfileServiceImpl.java   | 23 ++++++++++++++++++++
 4 files changed, 45 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/585d427b/api/src/main/java/org/apache/unomi/api/PersonaWithSessions.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/PersonaWithSessions.java b/api/src/main/java/org/apache/unomi/api/PersonaWithSessions.java
index 64b6a85..18483a7 100644
--- a/api/src/main/java/org/apache/unomi/api/PersonaWithSessions.java
+++ b/api/src/main/java/org/apache/unomi/api/PersonaWithSessions.java
@@ -54,6 +54,6 @@ public class PersonaWithSessions {
 
     @XmlTransient
     public PersonaSession getLastSession() {
-        return sessions.get(0);
+        return sessions.size()>0?sessions.get(0):null;
     }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/585d427b/api/src/main/java/org/apache/unomi/api/services/ProfileService.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/services/ProfileService.java b/api/src/main/java/org/apache/unomi/api/services/ProfileService.java
index 3422054..f400746 100644
--- a/api/src/main/java/org/apache/unomi/api/services/ProfileService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/ProfileService.java
@@ -227,6 +227,14 @@ public interface ProfileService {
     PartialList<Session> getPersonaSessions(String personaId, int offset, int size, String sortBy);
 
     /**
+     * Save a persona with its sessions.
+     *
+     * @param personaToSave the persona object containing all the persona information and sessions
+     */
+    PersonaWithSessions savePersonaWithSessions(PersonaWithSessions personaToSave);
+
+
+    /**
      * Retrieves all the property types associated with the specified target.
      *
      * TODO: move to a different class

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/585d427b/rest/src/main/java/org/apache/unomi/rest/ProfileServiceEndPoint.java
----------------------------------------------------------------------
diff --git a/rest/src/main/java/org/apache/unomi/rest/ProfileServiceEndPoint.java b/rest/src/main/java/org/apache/unomi/rest/ProfileServiceEndPoint.java
index 260e7a1..3b234b2 100644
--- a/rest/src/main/java/org/apache/unomi/rest/ProfileServiceEndPoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/ProfileServiceEndPoint.java
@@ -306,6 +306,18 @@ public class ProfileServiceEndPoint {
     }
 
     /**
+     * Save the posted persona with its sessions
+     *
+     * @param personaWithSessions the persona to save with its sessions.
+     * @return a {@link PersonaWithSessions} instance with the persona identified by the specified identifier and all its associated sessions
+     */
+    @POST
+    @Path("/personasWithSessions")
+    public PersonaWithSessions savePersonaWithSessions(PersonaWithSessions personaWithSessions) {
+        return profileService.savePersonaWithSessions(personaWithSessions);
+    }
+
+    /**
      * Persists the specified {@link Persona} in the context server.
      *
      * @param persona the persona to persist

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/585d427b/services/src/main/java/org/apache/unomi/services/services/ProfileServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/ProfileServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/ProfileServiceImpl.java
index efe1d86..4aed515 100644
--- a/services/src/main/java/org/apache/unomi/services/services/ProfileServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/services/ProfileServiceImpl.java
@@ -683,6 +683,29 @@ public class ProfileServiceImpl implements ProfileService, SynchronousBundleList
         return persistenceService.query("profileId", personaId, sortBy, Session.class, offset, size);
     }
 
+    public PersonaWithSessions savePersonaWithSessions(PersonaWithSessions personaToSave){
+        if(personaToSave !=null){
+            //Generate a UUID if no itemId is set on the persona
+            if(personaToSave.getPersona().getItemId() == null){
+                personaToSave.getPersona().setItemId("persona-"+UUID.randomUUID().toString());
+            }
+            boolean savedPersona = persistenceService.save(personaToSave.getPersona());
+            //Browse persona sessions
+            List<PersonaSession> sessions = personaToSave.getSessions();
+            for (PersonaSession session : sessions) {
+                //Generate a UUID if no itemId is set on the session
+                if(session.getItemId() == null){
+                    session.setItemId(UUID.randomUUID().toString());
+                }
+                //link the session to the persona
+                session.setProfile(personaToSave.getPersona());
+                persistenceService.save(session);
+            }
+            return personaToSave;
+        }
+        return null;
+    }
+
     private void loadPredefinedPersonas(BundleContext bundleContext) {
         if (bundleContext == null) {
             return;


[30/50] [abbrv] incubator-unomi git commit: UNOMI-99 Improve network unavailable and connection timeout handling - Try to improve error handling.

Posted by sh...@apache.org.
UNOMI-99 Improve network unavailable and connection timeout handling
- Try to improve error handling.

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/46be0021
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/46be0021
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/46be0021

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 46be0021749e46503e5f85169e82b2066e903693
Parents: 1a9f9cd
Author: Serge Huber <sh...@apache.org>
Authored: Sun Jun 4 16:45:07 2017 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Sun Jun 4 16:45:07 2017 +0200

----------------------------------------------------------------------
 .../apache/unomi/services/services/ClusterServiceImpl.java   | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/46be0021/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java
index b7f1594..a77b978 100644
--- a/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java
@@ -257,8 +257,9 @@ public class ClusterServiceImpl implements ClusterService {
             } catch (MalformedURLException e) {
                 logger.error("Error connecting to remote JMX server", e);
             } catch (ConnectException ce) {
-                if (ce.getMessage() != null && ce.getMessage().contains("timed out")) {
-                    logger.warn("RMI Connection timed out, will reconnect on next request.");
+                if (ce.getMessage() != null &&
+                        (ce.getMessage().contains("timed out") || ce.getMessage().contains("Network is unreachable"))) {
+                    logger.warn("RMI Connection timed out or network is unreachable, will reconnect on next request.");
                     JMXConnector jmxConnector = jmxConnectors.remove(serviceUrl);
                     try {
                         if (jmxConnector != null) {
@@ -323,7 +324,8 @@ public class ClusterServiceImpl implements ClusterService {
                 try {
                     jmxConnector.close();
                 } catch (IOException e1) {
-                    logger.error("Error closing invalid JMX connection", e1);
+                    logger.warn("Closing invalid JMX connection resulted in :" + e1.getMessage() + ", this is probably ok.");
+                    logger.debug("Error closing invalid JMX connection", e1);
                 }
                 if (e.getMessage() != null && e.getMessage().contains("Connection closed")) {
                     logger.warn("JMX connection to url {} was closed (Cause:{}). Reconnecting...", url, e.getMessage());


[45/50] [abbrv] incubator-unomi git commit: UNOMI-101 : Java style, improvement of error handler

Posted by sh...@apache.org.
UNOMI-101 : Java style, improvement of error handler


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/b55a20b7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/b55a20b7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/b55a20b7

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: b55a20b72e2c389da9a0cbdefd36563bc3258539
Parents: 6203e99
Author: Abdelkader Midani <am...@apache.org>
Authored: Tue Jun 20 13:41:05 2017 +0200
Committer: Abdelkader Midani <am...@apache.org>
Committed: Tue Jun 20 13:41:05 2017 +0200

----------------------------------------------------------------------
 .../core/context/ProfileImportCamelContext.java |  1 -
 .../BadProfileDataFormatException.java          |  2 +-
 .../core/processor/ConfigUpdateProcessor.java   |  2 +-
 .../ImportConfigByFileNameProcessor.java        |  2 +-
 .../core/processor/LineSplitFailureHandler.java |  4 +--
 .../core/processor/LineSplitProcessor.java      | 24 +++++++++++-------
 .../processor/RouteCompletionProcessor.java     | 26 ++++++++++----------
 .../ProfileImportAbstractRouteBuilder.java      |  8 +++---
 .../ProfileImportFromSourceRouteBuilder.java    |  3 +--
 .../route/ProfileImportOneShotRouteBuilder.java | 18 +++++++++++---
 .../route/ProfileImportToUnomiRouteBuilder.java |  1 -
 11 files changed, 52 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b55a20b7/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java
index f54beb1..9bb50f8 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/ProfileImportCamelContext.java
@@ -36,7 +36,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.util.Arrays;
-import java.util.List;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b55a20b7/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/exception/BadProfileDataFormatException.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/exception/BadProfileDataFormatException.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/exception/BadProfileDataFormatException.java
index 6c947ff..50acbe4 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/exception/BadProfileDataFormatException.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/exception/BadProfileDataFormatException.java
@@ -19,7 +19,7 @@ package org.apache.unomi.router.core.exception;
 /**
  * Created by amidani on 13/06/2017.
  */
-public class BadProfileDataFormatException extends Exception{
+public class BadProfileDataFormatException extends Exception {
 
     public BadProfileDataFormatException() {
         super();

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b55a20b7/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ConfigUpdateProcessor.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ConfigUpdateProcessor.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ConfigUpdateProcessor.java
index e4eaa19..d8e4b9e 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ConfigUpdateProcessor.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ConfigUpdateProcessor.java
@@ -25,7 +25,7 @@ import org.apache.unomi.router.core.context.ProfileImportCamelContext;
 /**
  * Created by amidani on 10/05/2017.
  */
-public class ConfigUpdateProcessor implements Processor{
+public class ConfigUpdateProcessor implements Processor {
 
     private ProfileImportCamelContext profileImportCamelContext;
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b55a20b7/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ImportConfigByFileNameProcessor.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ImportConfigByFileNameProcessor.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ImportConfigByFileNameProcessor.java
index c2968cd..a910a1d 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ImportConfigByFileNameProcessor.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ImportConfigByFileNameProcessor.java
@@ -26,7 +26,7 @@ import org.apache.unomi.router.core.RouterConstants;
 /**
  * Created by amidani on 22/05/2017.
  */
-public class ImportConfigByFileNameProcessor implements Processor{
+public class ImportConfigByFileNameProcessor implements Processor {
 
     private ImportConfigurationService importConfigurationService;
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b55a20b7/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitFailureHandler.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitFailureHandler.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitFailureHandler.java
index 8f14f67..bfb92fb 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitFailureHandler.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitFailureHandler.java
@@ -34,9 +34,9 @@ public class LineSplitFailureHandler implements Processor {
     public void process(Exchange exchange) throws Exception {
         logger.debug("Route: {}, Error: {}", exchange.getProperty(Exchange.FAILURE_ROUTE_ID), exchange.getProperty(Exchange.EXCEPTION_CAUGHT));
         ImportLineError importLineError = new ImportLineError();
-        importLineError.setErrorCode(((BadProfileDataFormatException)exchange.getProperty(Exchange.EXCEPTION_CAUGHT)).getCause().getMessage());
+        importLineError.setErrorCode(((BadProfileDataFormatException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT)).getCause().getMessage());
         importLineError.setLineContent(exchange.getIn().getBody(String.class));
-        importLineError.setLineNb(((Integer)exchange.getProperty("CamelSplitIndex")+1));
+        importLineError.setLineNb(((Integer) exchange.getProperty("CamelSplitIndex") + 1));
         exchange.getIn().setHeader(RouterConstants.HEADER_FAILED_MESSAGE, new Boolean(true));
         exchange.getIn().setBody(importLineError, ImportLineError.class);
     }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b55a20b7/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitProcessor.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitProcessor.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitProcessor.java
index a03c833..afff204 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitProcessor.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitProcessor.java
@@ -25,7 +25,10 @@ import org.apache.unomi.router.api.ProfileToImport;
 import org.apache.unomi.router.core.RouterConstants;
 import org.apache.unomi.router.core.exception.BadProfileDataFormatException;
 
-import java.util.*;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
 
 /**
  * Created by amidani on 29/12/2016.
@@ -43,21 +46,21 @@ public class LineSplitProcessor implements Processor {
         //In case of one shot import we check the header and overwrite import config
         ImportConfiguration importConfigOneShot = (ImportConfiguration) exchange.getIn().getHeader(RouterConstants.HEADER_IMPORT_CONFIG_ONESHOT);
         String configType = (String) exchange.getIn().getHeader(RouterConstants.HEADER_CONFIG_TYPE);
-        if(importConfigOneShot!=null) {
-            fieldsMapping = (Map<String, Integer>)importConfigOneShot.getProperties().get("mapping");
+        if (importConfigOneShot != null) {
+            fieldsMapping = (Map<String, Integer>) importConfigOneShot.getProperties().get("mapping");
             propertiesToOverwrite = importConfigOneShot.getPropertiesToOverwrite();
             mergingProperty = importConfigOneShot.getMergingProperty();
             overwriteExistingProfiles = importConfigOneShot.isOverwriteExistingProfiles();
             columnSeparator = importConfigOneShot.getColumnSeparator();
         }
-        String[] profileData = ((String)exchange.getIn().getBody()).split(columnSeparator, -1);
+        String[] profileData = ((String) exchange.getIn().getBody()).split(columnSeparator, -1);
         ProfileToImport profileToImport = new ProfileToImport();
         profileToImport.setItemId(UUID.randomUUID().toString());
         profileToImport.setItemType("profile");
         profileToImport.setScope("system");
-        if(profileData.length > 0 && StringUtils.isNotBlank(profileData[0])) {
-            if(fieldsMapping.size() != (profileData.length - 1)) {
-                throw new BadProfileDataFormatException("The mapping does not match the number of column : line ["+((Integer)exchange.getProperty("CamelSplitIndex")+1)+"]", new Throwable("MAPPING_COLUMN_MATCH"));
+        if (profileData.length > 0 && StringUtils.isNotBlank(profileData[0])) {
+            if (fieldsMapping.size() != (profileData.length - 1)) {
+                throw new BadProfileDataFormatException("The mapping does not match the number of column : line [" + ((Integer) exchange.getProperty("CamelSplitIndex") + 1) + "]", new Throwable("MAPPING_COLUMN_MATCH"));
             }
             Map<String, Object> properties = new HashMap<>();
             for (String fieldMappingKey : fieldsMapping.keySet()) {
@@ -73,10 +76,10 @@ public class LineSplitProcessor implements Processor {
                 profileToImport.setProfileToDelete(true);
             }
         } else {
-            throw new BadProfileDataFormatException("Empty line : line ["+((Integer)exchange.getProperty("CamelSplitIndex")+1)+"]", new Throwable("EMPTY_LINE"));
+            throw new BadProfileDataFormatException("Empty line : line [" + ((Integer) exchange.getProperty("CamelSplitIndex") + 1) + "]", new Throwable("EMPTY_LINE"));
         }
         exchange.getIn().setBody(profileToImport, ProfileToImport.class);
-        if(RouterConstants.CONFIG_TYPE_KAFKA.equals(configType)) {
+        if (RouterConstants.CONFIG_TYPE_KAFKA.equals(configType)) {
             exchange.getIn().setHeader(KafkaConstants.PARTITION_KEY, 0);
             exchange.getIn().setHeader(KafkaConstants.KEY, "1");
         }
@@ -84,6 +87,7 @@ public class LineSplitProcessor implements Processor {
 
     /**
      * Setter of fieldsMapping
+     *
      * @param fieldsMapping map String,Integer fieldName in ES and the matching column index in the import file
      */
     public void setFieldsMapping(Map<String, Integer> fieldsMapping) {
@@ -104,6 +108,7 @@ public class LineSplitProcessor implements Processor {
 
     /**
      * Sets the merging property.
+     *
      * @param mergingProperty property used to check if the profile exist when merging
      */
     public void setMergingProperty(String mergingProperty) {
@@ -112,6 +117,7 @@ public class LineSplitProcessor implements Processor {
 
     /**
      * Sets the line separator.
+     *
      * @param columnSeparator property used to specify a line separator. Defaults to ','
      */
     public void setColumnSeparator(String columnSeparator) {

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b55a20b7/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/RouteCompletionProcessor.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/RouteCompletionProcessor.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/RouteCompletionProcessor.java
index 5952764..36ec319 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/RouteCompletionProcessor.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/RouteCompletionProcessor.java
@@ -41,7 +41,7 @@ public class RouteCompletionProcessor implements Processor {
     public void process(Exchange exchange) throws Exception {
         String importConfigId = null;
         ImportConfiguration importConfigOneShot = (ImportConfiguration) exchange.getIn().getHeader(RouterConstants.HEADER_IMPORT_CONFIG_ONESHOT);
-        if(importConfigOneShot!=null) {
+        if (importConfigOneShot != null) {
             importConfigId = importConfigOneShot.getItemId();
         } else {
             importConfigId = exchange.getFromRouteId();
@@ -52,10 +52,10 @@ public class RouteCompletionProcessor implements Processor {
         long ignoreCount = 0;
         List<ImportLineError> errors = new ArrayList<ImportLineError>();
 
-        for(Object line : exchange.getIn().getBody(ArrayList.class)){
-            if(line instanceof ProfileToImport) {
+        for (Object line : exchange.getIn().getBody(ArrayList.class)) {
+            if (line instanceof ProfileToImport) {
                 successCount++;
-            } else if(line instanceof ImportLineError) {
+            } else if (line instanceof ImportLineError) {
                 failureCount++;
                 errors.add(((ImportLineError) line));
             } else {
@@ -64,18 +64,18 @@ public class RouteCompletionProcessor implements Processor {
         }
 
         Map execution = new HashMap();
-        execution.put("date", ((Date)exchange.getProperty("CamelCreatedTimestamp")).getTime());
+        execution.put("date", ((Date) exchange.getProperty("CamelCreatedTimestamp")).getTime());
         execution.put("totalLinesNb", exchange.getProperty("CamelSplitSize"));
         execution.put("successCount", successCount);
         execution.put("failureCount", failureCount);
         execution.put("errors", errors);
 
-        if(importConfiguration.getExecutions().size() >= executionsHistorySize) {
+        if (importConfiguration.getExecutions().size() >= executionsHistorySize) {
             int oldestExecIndex = 0;
-            long oldestExecDate = (Long)importConfiguration.getExecutions().get(0).get("date");
-            for(int i = 1 ; i < importConfiguration.getExecutions().size() ; i++) {
-                if((Long)importConfiguration.getExecutions().get(i).get("date") < oldestExecDate) {
-                    oldestExecDate = (Long)importConfiguration.getExecutions().get(i).get("date");
+            long oldestExecDate = (Long) importConfiguration.getExecutions().get(0).get("date");
+            for (int i = 1; i < importConfiguration.getExecutions().size(); i++) {
+                if ((Long) importConfiguration.getExecutions().get(i).get("date") < oldestExecDate) {
+                    oldestExecDate = (Long) importConfiguration.getExecutions().get(i).get("date");
                     oldestExecIndex = i;
                 }
             }
@@ -84,11 +84,11 @@ public class RouteCompletionProcessor implements Processor {
 
         importConfiguration.getExecutions().add(execution);
         //Set running to false, route is complete
-        if(failureCount>0 && successCount>0) {
+        if (failureCount > 0 && successCount > 0) {
             importConfiguration.setStatus(RouterConstants.CONFIG_STATUS_COMPLETE_WITH_ERRORS);
-        } else if(failureCount>0 && successCount==0) {
+        } else if (failureCount > 0 && successCount == 0) {
             importConfiguration.setStatus(RouterConstants.CONFIG_STATUS_COMPLETE_ERRORS);
-        } else if(failureCount==0 && successCount>0) {
+        } else if (failureCount == 0 && successCount > 0) {
             importConfiguration.setStatus(RouterConstants.CONFIG_STATUS_COMPLETE_SUCCESS);
         }
         importConfigurationService.save(importConfiguration);

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b55a20b7/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportAbstractRouteBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportAbstractRouteBuilder.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportAbstractRouteBuilder.java
index ca28baf..f4f7a43 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportAbstractRouteBuilder.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportAbstractRouteBuilder.java
@@ -54,22 +54,22 @@ public abstract class ProfileImportAbstractRouteBuilder extends RouteBuilder {
 
     public Object getEndpointURI(String direction) {
         Object endpoint;
-        if(RouterConstants.CONFIG_TYPE_KAFKA.equals(configType)) {
+        if (RouterConstants.CONFIG_TYPE_KAFKA.equals(configType)) {
             //Prepare Kafka Deposit
             StringBuilder kafkaUri = new StringBuilder("kafka:");
             kafkaUri.append(kafkaHost).append(":").append(kafkaPort).append("?topic=").append(kafkaImportTopic);
             if (StringUtils.isNotBlank(kafkaImportGroupId)) {
                 kafkaUri.append("&groupId=" + kafkaImportGroupId);
             }
-            if(RouterConstants.DIRECTION_TO.equals(direction)) {
-                kafkaUri.append("&autoCommitEnable="+kafkaImportAutoCommit+"&consumersCount="+kafkaImportConsumerCount);
+            if (RouterConstants.DIRECTION_TO.equals(direction)) {
+                kafkaUri.append("&autoCommitEnable=" + kafkaImportAutoCommit + "&consumersCount=" + kafkaImportConsumerCount);
             }
             KafkaConfiguration kafkaConfiguration = new KafkaConfiguration();
             kafkaConfiguration.setBrokers(kafkaHost + ":" + kafkaPort);
             kafkaConfiguration.setTopic(kafkaImportTopic);
             kafkaConfiguration.setGroupId(kafkaImportGroupId);
             endpoint = new KafkaEndpoint(kafkaUri.toString(), new KafkaComponent(this.getContext()));
-            ((KafkaEndpoint)endpoint).setConfiguration(kafkaConfiguration);
+            ((KafkaEndpoint) endpoint).setConfiguration(kafkaConfiguration);
         } else {
             endpoint = RouterConstants.DIRECT_DEPOSIT_BUFFER;
         }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b55a20b7/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportFromSourceRouteBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportFromSourceRouteBuilder.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportFromSourceRouteBuilder.java
index 7d6bd07..0af561f 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportFromSourceRouteBuilder.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportFromSourceRouteBuilder.java
@@ -28,7 +28,6 @@ import org.apache.unomi.router.core.RouterConstants;
 import org.apache.unomi.router.core.exception.BadProfileDataFormatException;
 import org.apache.unomi.router.core.processor.LineSplitFailureHandler;
 import org.apache.unomi.router.core.processor.LineSplitProcessor;
-import org.apache.unomi.router.core.processor.RouteCompletionProcessor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -56,7 +55,7 @@ public class ProfileImportFromSourceRouteBuilder extends ProfileImportAbstractRo
 
         logger.info("Configure Recurrent Route 'From Source'");
 
-        if(importConfigurationList == null) {
+        if (importConfigurationList == null) {
             importConfigurationList = importConfigurationService.getImportConfigurations();
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b55a20b7/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportOneShotRouteBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportOneShotRouteBuilder.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportOneShotRouteBuilder.java
index 84b220c..c86e5e0 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportOneShotRouteBuilder.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportOneShotRouteBuilder.java
@@ -16,15 +16,14 @@
  */
 package org.apache.unomi.router.core.route;
 
-import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.LoggingLevel;
 import org.apache.camel.component.jackson.JacksonDataFormat;
-import org.apache.camel.component.kafka.KafkaComponent;
-import org.apache.camel.component.kafka.KafkaConfiguration;
 import org.apache.camel.component.kafka.KafkaEndpoint;
 import org.apache.camel.model.ProcessorDefinition;
-import org.apache.commons.lang3.StringUtils;
 import org.apache.unomi.router.core.RouterConstants;
+import org.apache.unomi.router.core.exception.BadProfileDataFormatException;
 import org.apache.unomi.router.core.processor.ImportConfigByFileNameProcessor;
+import org.apache.unomi.router.core.processor.LineSplitFailureHandler;
 import org.apache.unomi.router.core.processor.LineSplitProcessor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -52,6 +51,17 @@ public class ProfileImportOneShotRouteBuilder extends ProfileImportAbstractRoute
 
         logger.info("Configure OneShot Route...");
 
+        ProcessorDefinition prDefErr = onException(BadProfileDataFormatException.class)
+                .log(LoggingLevel.ERROR, "Error processing record ${exchangeProperty.CamelSplitIndex}++ !")
+                .handled(true)
+                .process(new LineSplitFailureHandler());
+
+        if (RouterConstants.CONFIG_TYPE_KAFKA.equals(configType)) {
+            prDefErr.to((KafkaEndpoint) getEndpointURI(RouterConstants.DIRECTION_FROM));
+        } else {
+            prDefErr.to((String) getEndpointURI(RouterConstants.DIRECTION_FROM));
+        }
+
         LineSplitProcessor lineSplitProcessor = new LineSplitProcessor();
 
         ProcessorDefinition prDef = from("file://"+uploadDir+"?include=.*.csv&consumer.delay=1m")

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b55a20b7/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportToUnomiRouteBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportToUnomiRouteBuilder.java b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportToUnomiRouteBuilder.java
index 91c0bf0..94c1cef 100644
--- a/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportToUnomiRouteBuilder.java
+++ b/extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportToUnomiRouteBuilder.java
@@ -19,7 +19,6 @@ package org.apache.unomi.router.core.route;
 import org.apache.camel.LoggingLevel;
 import org.apache.camel.component.jackson.JacksonDataFormat;
 import org.apache.camel.component.kafka.KafkaEndpoint;
-import org.apache.camel.model.Constants;
 import org.apache.camel.model.RouteDefinition;
 import org.apache.unomi.router.core.RouterConstants;
 import org.apache.unomi.router.core.processor.RouteCompletionProcessor;


[27/50] [abbrv] incubator-unomi git commit: UNOMI-72 Fix integration and performance tests - Integration tests should now execute again, but some tests still fail.

Posted by sh...@apache.org.
UNOMI-72 Fix integration and performance tests
- Integration tests should now execute again, but some tests still fail.

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/53fb16ea
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/53fb16ea
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/53fb16ea

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 53fb16eadfe81d001007e0c306303e81f0648eed
Parents: ef86038
Author: Serge Huber <sh...@apache.org>
Authored: Mon May 29 14:10:22 2017 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Mon May 29 14:10:22 2017 +0200

----------------------------------------------------------------------
 itests/pom.xml                                  | 11 ++++--
 .../java/org/apache/unomi/itests/BaseIT.java    |  4 ++-
 .../ElasticSearchPersistenceServiceImpl.java    |  9 ++++-
 .../resources/OSGI-INF/blueprint/blueprint.xml  |  2 +-
 .../PropertyConditionESQueryBuilder.java        | 35 ++++++++++++++++++--
 pom.xml                                         |  8 +++--
 .../services/services/ClusterServiceImpl.java   | 17 +++++++++-
 7 files changed, 75 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/53fb16ea/itests/pom.xml
----------------------------------------------------------------------
diff --git a/itests/pom.xml b/itests/pom.xml
index 868fb1f..6f3724c 100644
--- a/itests/pom.xml
+++ b/itests/pom.xml
@@ -122,6 +122,12 @@
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <version>1.6.6</version>
+            <scope>test</scope>
+        </dependency>
 
     </dependencies>
 
@@ -147,8 +153,8 @@
                 <version>5.7</version>
                 <configuration>
                     <clusterName>contextElasticSearch</clusterName>
-                    <transportPort>9300</transportPort>
-                    <httpPort>9200</httpPort>
+                    <transportPort>9500</transportPort>
+                    <httpPort>9400</httpPort>
                     <version>${elasticsearch.version}</version>
                 </configuration>
                 <executions>
@@ -175,6 +181,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-failsafe-plugin</artifactId>
+                <version>2.18.1</version>
                 <configuration>
                     <includes>
                         <include>**/*AllITs.java</include>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/53fb16ea/itests/src/test/java/org/apache/unomi/itests/BaseIT.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/unomi/itests/BaseIT.java b/itests/src/test/java/org/apache/unomi/itests/BaseIT.java
index 6a10a4d..cfb8ed3 100644
--- a/itests/src/test/java/org/apache/unomi/itests/BaseIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/BaseIT.java
@@ -85,11 +85,13 @@ public abstract class BaseIT {
                         .unpackDirectory(new File("target/exam"))
                         .useDeployFolder(false),
                 keepRuntimeFolder(),
-                configureConsole().ignoreLocalConsole().ignoreRemoteShell(),
+                configureConsole().ignoreLocalConsole(),
                 logLevel(LogLevel.INFO),
 //                editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", HTTP_PORT),
 //                systemProperty("org.osgi.service.http.port").value(HTTP_PORT),
                 systemProperty("org.ops4j.pax.exam.rbc.rmi.port").value("1199"),
+                systemProperty("org.apache.unomi.itests.elasticsearch.transport.port").value("9500"),
+                systemProperty("org.apache.unomi.itests.elasticsearch.http.port").value("9400"),
                 features(karafPaxWebRepo, "war"),
                 features(karafCxfRepo, "cxf"),
                 features(karafCellarRepo, "cellar"),

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/53fb16ea/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
index 4e66418..bdd676d 100644
--- a/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
+++ b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
@@ -143,7 +143,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
     private String bulkProcessorBackoffPolicy = "exponential";
 
     private String minimalElasticSearchVersion = "5.0.0";
-    private String maximalElasticSearchVersion = "5.2.0";
+    private String maximalElasticSearchVersion = "5.3.0";
 
     private Map<String, Map<String, Map<String, Object>>> knownMappings = new HashMap<>();
 
@@ -258,6 +258,13 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
 
                 Settings transportSettings = Settings.builder()
                         .put(CLUSTER_NAME, clusterName).build();
+
+                // this property is used for integration tests, to make sure we don't conflict with an already running ElasticSearch instance.
+                if (System.getProperty("org.apache.unomi.itests.elasticsearch.transport.port") != null) {
+                    elasticSearchAddressList.clear();
+                    elasticSearchAddressList.add("localhost:" + System.getProperty("org.apache.unomi.itests.elasticsearch.transport.port"));
+                }
+
                 client = new PreBuiltTransportClient(transportSettings);
                 for (String elasticSearchAddress : elasticSearchAddressList) {
                     String[] elasticSearchAddressParts = elasticSearchAddress.split(":");

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/53fb16ea/persistence-elasticsearch/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/persistence-elasticsearch/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 3ca23a9..ce6d99b 100644
--- a/persistence-elasticsearch/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/persistence-elasticsearch/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -47,7 +47,7 @@
             <cm:property name="bulkProcessor.backoffPolicy" value="exponential" />
 
             <cm:property name="minimalElasticSearchVersion" value="5.0.0" />
-            <cm:property name="maximalElasticSearchVersion" value="5.2.0" />
+            <cm:property name="maximalElasticSearchVersion" value="5.3.0" />
 
         </cm:default-properties>
     </cm:property-placeholder>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/53fb16ea/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java
index b1aa234..26e480a 100644
--- a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java
+++ b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java
@@ -26,13 +26,20 @@ import org.elasticsearch.index.query.BoolQueryBuilder;
 import org.elasticsearch.index.query.QueryBuilder;
 import org.elasticsearch.index.query.QueryBuilders;
 import org.joda.time.DateTime;
+import org.joda.time.format.DateTimeFormatter;
+import org.joda.time.format.ISODateTimeFormat;
 
+import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
 public class PropertyConditionESQueryBuilder implements ConditionESQueryBuilder {
 
+    DateTimeFormatter dateTimeFormatter;
+
     public PropertyConditionESQueryBuilder() {
+        dateTimeFormatter = ISODateTimeFormat.dateTime();
     }
 
     @Override
@@ -46,12 +53,12 @@ public class PropertyConditionESQueryBuilder implements ConditionESQueryBuilder
 
         String expectedValue = ConditionContextHelper.foldToASCII((String) condition.getParameter("propertyValue"));
         Object expectedValueInteger = condition.getParameter("propertyValueInteger");
-        Object expectedValueDate = condition.getParameter("propertyValueDate");
+        Object expectedValueDate = convertDateToISO(condition.getParameter("propertyValueDate"));
         Object expectedValueDateExpr = condition.getParameter("propertyValueDateExpr");
 
         List<?> expectedValues = ConditionContextHelper.foldToASCII((List<?>) condition.getParameter("propertyValues"));
         List<?> expectedValuesInteger = (List<?>) condition.getParameter("propertyValuesInteger");
-        List<?> expectedValuesDate = (List<?>) condition.getParameter("propertyValuesDate");
+        List<?> expectedValuesDate = convertDatesToISO((List<?>) condition.getParameter("propertyValuesDate"));
         List<?> expectedValuesDateExpr = (List<?>) condition.getParameter("propertyValuesDateExpr");
 
         Object value = ObjectUtils.firstNonNull(expectedValue, expectedValueInteger, expectedValueDate, expectedValueDateExpr);
@@ -161,4 +168,28 @@ public class PropertyConditionESQueryBuilder implements ConditionESQueryBuilder
         DateTime dayAfterStart = date.plusDays(1).withTimeAtStartOfDay();
         return QueryBuilders.rangeQuery(name).gte(dayStart.toDate()).lte(dayAfterStart.toDate());
     }
+
+    private Object convertDateToISO(Object dateValue) {
+        if (dateValue == null) {
+            return dateValue;
+        }
+        if (dateValue instanceof Date) {
+            return dateTimeFormatter.print(new DateTime(dateValue));
+        } else {
+            return dateValue;
+        }
+    }
+
+    private List<?> convertDatesToISO(List<?> datesValues) {
+        List<Object> results = new ArrayList<>();
+        if (datesValues == null) {
+            return null;
+        }
+        for (Object dateValue : datesValues) {
+            if (dateValue != null) {
+                results.add(convertDateToISO(dateValue));
+            }
+        }
+        return results;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/53fb16ea/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 18bc4c1..376cf21 100644
--- a/pom.xml
+++ b/pom.xml
@@ -69,7 +69,7 @@
         <version.jackson.jaxb>2.6.6</version.jackson.jaxb> <!-- version used by CXF -->
         <version.karaf>3.0.8</version.karaf>
         <version.karaf.cellar>3.0.3</version.karaf.cellar>
-        <version.pax.exam>4.9.1</version.pax.exam>
+        <version.pax.exam>4.11.0</version.pax.exam>
         <elasticsearch.version>5.2.2</elasticsearch.version>
 
         <maven.compiler.source>1.7</maven.compiler.source>
@@ -904,12 +904,14 @@
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-surefire-plugin</artifactId>
-                    <version>2.19.1</version>
+                    <!-- Version more recent than 2.18.1 don't seem to work ! -->
+                    <version>2.18.1</version>
                 </plugin>
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-failsafe-plugin</artifactId>
-                    <version>2.19.1</version>
+                    <!-- Version more recent than 2.18.1 don't seem to work ! -->
+                    <version>2.18.1</version>
                 </plugin>
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/53fb16ea/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java
index 4055080..b7f1594 100644
--- a/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/services/ClusterServiceImpl.java
@@ -38,6 +38,7 @@ import java.io.IOException;
 import java.lang.management.ManagementFactory;
 import java.lang.management.OperatingSystemMXBean;
 import java.lang.management.RuntimeMXBean;
+import java.net.ConnectException;
 import java.net.MalformedURLException;
 import java.util.*;
 
@@ -232,8 +233,8 @@ public class ClusterServiceImpl implements ClusterService {
                 clusterNode.setInternalHostAddress(internalEndpointParts[0]);
                 clusterNode.setInternalPort(Integer.parseInt(internalEndpointParts[1]));
             }
+            String serviceUrl = "service:jmx:rmi:///jndi/rmi://"+karafCellarNode.getHost() + ":"+karafJMXPort+"/karaf-root";
             try {
-                String serviceUrl = "service:jmx:rmi:///jndi/rmi://"+karafCellarNode.getHost() + ":"+karafJMXPort+"/karaf-root";
                 JMXConnector jmxConnector = getJMXConnector(serviceUrl);
                 MBeanServerConnection mbsc = jmxConnector.getMBeanServerConnection();
                 final RuntimeMXBean remoteRuntime = ManagementFactory.newPlatformMXBeanProxy(mbsc, ManagementFactory.RUNTIME_MXBEAN_NAME, RuntimeMXBean.class);
@@ -255,6 +256,20 @@ public class ClusterServiceImpl implements ClusterService {
 
             } catch (MalformedURLException e) {
                 logger.error("Error connecting to remote JMX server", e);
+            } catch (ConnectException ce) {
+                if (ce.getMessage() != null && ce.getMessage().contains("timed out")) {
+                    logger.warn("RMI Connection timed out, will reconnect on next request.");
+                    JMXConnector jmxConnector = jmxConnectors.remove(serviceUrl);
+                    try {
+                        if (jmxConnector != null) {
+                            jmxConnector.close();
+                        }
+                    } catch (Throwable t) {
+                        // ignore any exception when closing a timed out connection.
+                    }
+                } else {
+                    logger.error("Error retrieving remote JMX data", ce);
+                }
             } catch (IOException e) {
                 logger.error("Error retrieving remote JMX data", e);
             } catch (MalformedObjectNameException e) {


[29/50] [abbrv] incubator-unomi git commit: UNOMI-98 Provide an example of integrating with an externally triggered login Add missing license header

Posted by sh...@apache.org.
UNOMI-98 Provide an example of integrating with an externally triggered login
Add missing license header

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/1a9f9cdc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/1a9f9cdc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/1a9f9cdc

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 1a9f9cdcb2203fd8c740a4700b9a9bbe92c144fd
Parents: 21a9b34
Author: Serge Huber <sh...@apache.org>
Authored: Mon May 29 16:05:42 2017 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Mon May 29 16:05:42 2017 +0200

----------------------------------------------------------------------
 samples/README.md | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/1a9f9cdc/samples/README.md
----------------------------------------------------------------------
diff --git a/samples/README.md b/samples/README.md
index 73811d2..6b60dfc 100644
--- a/samples/README.md
+++ b/samples/README.md
@@ -1 +1,18 @@
+<!--
+  ~ 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.
+  -->
+
 In this directory you can find different samples of how to integrate Unomi. 


[19/50] [abbrv] incubator-unomi git commit: UNOMI-94 New action : add a profile to a list

Posted by sh...@apache.org.
UNOMI-94 New action : add a profile to a list

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/97581032
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/97581032
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/97581032

Branch: refs/heads/feature-UNOMI-5-KARAF4
Commit: 97581032c38efc4aa384a01a0266f84cd013f863
Parents: 7e81374
Author: Serge Huber <sh...@apache.org>
Authored: Sat May 6 23:18:11 2017 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Sat May 6 23:18:11 2017 +0200

----------------------------------------------------------------------
 extensions/lists-extension/actions/pom.xml      | 68 ++++++++++++++++++++
 .../unomi/lists/actions/AddToListsAction.java   | 58 +++++++++++++++++
 .../META-INF/cxs/actions/addToLists.json        | 19 ++++++
 .../resources/OSGI-INF/blueprint/blueprint.xml  | 37 +++++++++++
 extensions/lists-extension/pom.xml              |  1 +
 kar/pom.xml                                     |  5 ++
 6 files changed, 188 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/97581032/extensions/lists-extension/actions/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/lists-extension/actions/pom.xml b/extensions/lists-extension/actions/pom.xml
new file mode 100644
index 0000000..91c0e8e
--- /dev/null
+++ b/extensions/lists-extension/actions/pom.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>cxs-lists-extension</artifactId>
+        <groupId>org.apache.unomi</groupId>
+        <version>1.2.0-incubating-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>cxs-lists-extension-actions</artifactId>
+    <name>Apache Unomi :: Extensions :: Lists :: Actions</name>
+    <description>List extension rule actions for the Apache Unomi Context Server</description>
+
+    <version>1.2.0-incubating-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+            <artifactId>unomi-api</artifactId>
+            <version>1.2.0-incubating-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+            <artifactId>cxs-lists-extension-services</artifactId>
+            <version>1.2.0-incubating-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
+                        <Import-Package>
+                            sun.misc;resolution:=optional,
+                            *
+                        </Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/97581032/extensions/lists-extension/actions/src/main/java/org/apache/unomi/lists/actions/AddToListsAction.java
----------------------------------------------------------------------
diff --git a/extensions/lists-extension/actions/src/main/java/org/apache/unomi/lists/actions/AddToListsAction.java b/extensions/lists-extension/actions/src/main/java/org/apache/unomi/lists/actions/AddToListsAction.java
new file mode 100644
index 0000000..3ec1407
--- /dev/null
+++ b/extensions/lists-extension/actions/src/main/java/org/apache/unomi/lists/actions/AddToListsAction.java
@@ -0,0 +1,58 @@
+/*
+ * 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.unomi.lists.actions;
+
+import org.apache.unomi.api.Event;
+import org.apache.unomi.api.Profile;
+import org.apache.unomi.api.actions.Action;
+import org.apache.unomi.api.actions.ActionExecutor;
+import org.apache.unomi.api.services.EventService;
+import org.apache.unomi.api.services.ProfileService;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * A rule action that can add a profile to a list
+ */
+public class AddToListsAction implements ActionExecutor {
+
+    ProfileService profileService;
+    EventService eventService;
+
+    public void setProfileService(ProfileService profileService) {
+        this.profileService = profileService;
+    }
+
+    public void setEventService(EventService eventService) {
+        this.eventService = eventService;
+    }
+
+    @Override
+    public int execute(Action action, Event event) {
+        List<String> listIdentifiers = (List<String>) action.getParameterValues().get("listIdentifiers");
+        Profile profile = event.getProfile();
+
+        profile.getSystemProperties().put("lists", listIdentifiers);
+        Event profileUpdated = new Event("profileUpdated", null, profile, null, null, profile, new Date());
+        profileUpdated.setPersistent(false);
+        eventService.send(profileUpdated);
+        profileService.save(profile);
+
+        return EventService.PROFILE_UPDATED;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/97581032/extensions/lists-extension/actions/src/main/resources/META-INF/cxs/actions/addToLists.json
----------------------------------------------------------------------
diff --git a/extensions/lists-extension/actions/src/main/resources/META-INF/cxs/actions/addToLists.json b/extensions/lists-extension/actions/src/main/resources/META-INF/cxs/actions/addToLists.json
new file mode 100644
index 0000000..8875fa9
--- /dev/null
+++ b/extensions/lists-extension/actions/src/main/resources/META-INF/cxs/actions/addToLists.json
@@ -0,0 +1,19 @@
+{
+  "metadata": {
+    "id": "addToListsAction",
+    "name": "addToListsAction",
+    "description": "",
+    "tags": [
+      "demographic"
+    ],
+    "readOnly": true
+  },
+  "actionExecutor": "addToLists",
+  "parameters": [
+    {
+      "id": "listIdentifiers",
+      "type": "string",
+      "multivalued": true
+    }
+  ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/97581032/extensions/lists-extension/actions/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/extensions/lists-extension/actions/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/extensions/lists-extension/actions/src/main/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100644
index 0000000..386fbe0
--- /dev/null
+++ b/extensions/lists-extension/actions/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+    <reference id="profileService" interface="org.apache.unomi.api.services.ProfileService"/>
+    <reference id="eventService" interface="org.apache.unomi.api.services.EventService"/>
+
+    <!-- Action executors -->
+
+    <service auto-export="interfaces">
+        <service-properties>
+            <entry key="actionExecutorId" value="addToLists"/>
+        </service-properties>
+        <bean class="org.apache.unomi.lists.actions.AddToListsAction">
+            <property name="profileService" ref="profileService"/>
+            <property name="eventService" ref="eventService"/>
+        </bean>
+    </service>
+
+</blueprint>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/97581032/extensions/lists-extension/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/lists-extension/pom.xml b/extensions/lists-extension/pom.xml
index d348ad9..6542575 100644
--- a/extensions/lists-extension/pom.xml
+++ b/extensions/lists-extension/pom.xml
@@ -22,6 +22,7 @@
     <modules>
         <module>services</module>
         <module>rest</module>
+        <module>actions</module>
     </modules>
 
     <parent>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/97581032/kar/pom.xml
----------------------------------------------------------------------
diff --git a/kar/pom.xml b/kar/pom.xml
index 623d362..20d4257 100644
--- a/kar/pom.xml
+++ b/kar/pom.xml
@@ -83,6 +83,11 @@
         </dependency>
         <dependency>
             <groupId>org.apache.unomi</groupId>
+            <artifactId>cxs-lists-extension-actions</artifactId>
+            <version>1.2.0-incubating-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
             <artifactId>cxs-geonames-services</artifactId>
             <version>1.2.0-incubating-SNAPSHOT</version>
         </dependency>