You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by sh...@apache.org on 2018/05/09 12:11:51 UTC

[1/5] incubator-unomi git commit: UNOMI-179 Event Persistence Non-transient [Forced Update!]

Repository: incubator-unomi
Updated Branches:
  refs/heads/UNOMI-180-CXS-GRAPHQLAPI cbe9086b3 -> 569533dec (forced update)


UNOMI-179 Event Persistence Non-transient

Changed the persistence field to be non-transient in the Event class.
Used ESEventMixIn to prevent that value from being saved in ES.  Updated
the Event constructor to accept persistent.

This feature allows the user to pass "persistent": false with their
events if the intent is only to trigger a rule / action downstream.

If "persistent" is not set it defaults to true.


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

Branch: refs/heads/UNOMI-180-CXS-GRAPHQLAPI
Commit: a61a29317ce628f98ce2ee1d34ff25329bd844cc
Parents: 9fcfd42
Author: Donald Hinshaw <do...@kortx.io>
Authored: Thu May 3 13:44:39 2018 -0400
Committer: Donald Hinshaw <do...@kortx.io>
Committed: Thu May 3 13:52:47 2018 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/unomi/api/Event.java   |  6 ++--
 .../elasticsearch/ESCustomObjectMapper.java     |  2 ++
 .../persistence/elasticsearch/ESEventMixIn.java | 29 ++++++++++++++++++++
 .../org/apache/unomi/web/ContextServlet.java    |  3 +-
 .../unomi/web/EventsCollectorServlet.java       |  3 +-
 5 files changed, 38 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/a61a2931/api/src/main/java/org/apache/unomi/api/Event.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/Event.java b/api/src/main/java/org/apache/unomi/api/Event.java
index b20662b..845a02a 100644
--- a/api/src/main/java/org/apache/unomi/api/Event.java
+++ b/api/src/main/java/org/apache/unomi/api/Event.java
@@ -61,7 +61,7 @@ public class Event extends Item implements TimestampedItem {
     private Item source;
     private Item target;
 
-    private transient boolean persistent = true;
+    private boolean persistent = true;
 
     private transient Map<String, Object> attributes = new LinkedHashMap<>();
 
@@ -114,8 +114,9 @@ public class Event extends Item implements TimestampedItem {
      * @param timestamp  the timestamp associated with the event if provided
      * @param properties the properties for this event if any
      */
-    public Event(String eventType, Session session, Profile profile, String scope, Item source, Item target, Map<String, Object> properties, Date timestamp) {
+    public Event(String eventType, Session session, Profile profile, String scope, Item source, Item target, Map<String, Object> properties, Date timestamp, boolean persistent) {
         this(eventType, session, profile, scope, source, target, timestamp);
+        this.persistent = persistent;
         if (properties != null) {
             this.properties = properties;
         }
@@ -205,7 +206,6 @@ public class Event extends Item implements TimestampedItem {
      *
      * @return {@code true} if this Event needs to be persisted, {@code false} otherwise
      */
-    @XmlTransient
     public boolean isPersistent() {
         return persistent;
     }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/a61a2931/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ESCustomObjectMapper.java
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ESCustomObjectMapper.java b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ESCustomObjectMapper.java
index 66e0e89..0048398 100644
--- a/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ESCustomObjectMapper.java
+++ b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ESCustomObjectMapper.java
@@ -17,6 +17,7 @@
 package org.apache.unomi.persistence.elasticsearch;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.unomi.api.Event;
 import org.apache.unomi.api.Item;
 import org.apache.unomi.persistence.spi.CustomObjectMapper;
 
@@ -31,6 +32,7 @@ public class ESCustomObjectMapper extends CustomObjectMapper {
     public ESCustomObjectMapper() {
         super();
         this.addMixIn(Item.class, ESItemMixIn.class);
+        this.addMixIn(Event.class, ESEventMixIn.class);
     }
 
     public static ObjectMapper getObjectMapper() {

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/a61a2931/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ESEventMixIn.java
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ESEventMixIn.java b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ESEventMixIn.java
new file mode 100644
index 0000000..76fb939
--- /dev/null
+++ b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ESEventMixIn.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.persistence.elasticsearch;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+/**
+ * This mixin is used in ESCustomObjectMapper to prevent the persistent parameter from being registered in ES
+ */
+public abstract class ESEventMixIn {
+
+    public ESEventMixIn() { }
+
+    @JsonIgnore abstract boolean isPersistent();
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/a61a2931/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 d978d70..a3ed622 100644
--- a/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
+++ b/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
@@ -323,7 +323,8 @@ public class ContextServlet extends HttpServlet {
             for (Event event : contextRequest.getEvents()){
                 if(event.getEventType() != null) {
                     Profile sessionProfile = session.getProfile();
-                    Event eventToSend = new Event(event.getEventType(), session, sessionProfile, contextRequest.getSource().getScope(), event.getSource(), event.getTarget(), event.getProperties(), timestamp);
+                    Event eventToSend = new Event(event.getEventType(), session, sessionProfile, contextRequest.getSource().getScope(),
+                            event.getSource(), event.getTarget(), event.getProperties(), timestamp, event.isPersistent());
                     if (!eventService.isEventAllowed(event, thirdPartyId)) {
                         logger.debug("Event is not allowed : {}", event.getEventType());
                         continue;

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/a61a2931/wab/src/main/java/org/apache/unomi/web/EventsCollectorServlet.java
----------------------------------------------------------------------
diff --git a/wab/src/main/java/org/apache/unomi/web/EventsCollectorServlet.java b/wab/src/main/java/org/apache/unomi/web/EventsCollectorServlet.java
index 713e1e4..2f21354 100644
--- a/wab/src/main/java/org/apache/unomi/web/EventsCollectorServlet.java
+++ b/wab/src/main/java/org/apache/unomi/web/EventsCollectorServlet.java
@@ -184,7 +184,8 @@ public class EventsCollectorServlet extends HttpServlet {
 
         for (Event event : events.getEvents()){
             if(event.getEventType() != null){
-                Event eventToSend = new Event(event.getEventType(), session, profile, event.getScope(), event.getSource(), event.getTarget(), event.getProperties(), timestamp);
+                Event eventToSend = new Event(event.getEventType(), session, profile, event.getScope(), event.getSource(),
+                        event.getTarget(), event.getProperties(), timestamp, event.isPersistent());
                 if (sessionProfile.isAnonymousProfile()) {
                     // Do not keep track of profile in event
                     eventToSend.setProfileId(null);


[5/5] incubator-unomi git commit: UNOMI-180 Implement CXS GraphQL API - Initial framework for CXS GraphQL API. Lots of stuff is just testing, please don't consider it as finalized in any way.

Posted by sh...@apache.org.
UNOMI-180 Implement CXS GraphQL API
- Initial framework for CXS GraphQL API. Lots of stuff is just testing, please don't consider it as finalized in any way.

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/569533de
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/569533de
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/569533de

Branch: refs/heads/UNOMI-180-CXS-GRAPHQLAPI
Commit: 569533dec97a31857ab741012948d8170372f103
Parents: ef24a79
Author: Serge Huber <sh...@apache.org>
Authored: Thu May 3 12:42:32 2018 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Wed May 9 14:10:53 2018 +0200

----------------------------------------------------------------------
 graphql/cxs-impl/pom.xml                        |  76 ++++++++
 .../java/org/apache/unomi/graphql/CXSEvent.java |  59 ++++++
 .../org/apache/unomi/graphql/CXSEventType.java  |  26 +++
 .../org/apache/unomi/graphql/CXSGeoPoint.java   |  29 +++
 .../unomi/graphql/CXSGraphQLProvider.java       |  21 +++
 .../org/apache/unomi/graphql/CXSProperties.java |  28 +++
 .../apache/unomi/graphql/CXSPropertyType.java   |  32 ++++
 .../unomi/graphql/CXSProviderManager.java       |  70 +++++++
 .../internal/CXSGraphQLProviderImpl.java        | 188 +++++++++++++++++++
 graphql/karaf-feature/pom.xml                   | 126 +++++++++++++
 graphql/pom.xml                                 |  44 +++++
 pom.xml                                         |   1 +
 12 files changed, 700 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/569533de/graphql/cxs-impl/pom.xml
----------------------------------------------------------------------
diff --git a/graphql/cxs-impl/pom.xml b/graphql/cxs-impl/pom.xml
new file mode 100644
index 0000000..ac3123d
--- /dev/null
+++ b/graphql/cxs-impl/pom.xml
@@ -0,0 +1,76 @@
+<?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>
+        <groupId>org.apache.unomi</groupId>
+        <artifactId>unomi-graphql</artifactId>
+        <version>1.3.0-incubating-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>cxs-graphql-api-impl</artifactId>
+    <packaging>bundle</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.graphql-java</groupId>
+            <artifactId>graphql-java-servlet</artifactId>
+            <version>${graphql.java.servlet.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.graphql-java</groupId>
+            <artifactId>graphql-java</artifactId>
+            <version>${graphql.java.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.github.graphql-java</groupId>
+            <artifactId>graphql-java-annotations</artifactId>
+            <version>${graphql.java.annotations.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>osgi.enterprise</artifactId>
+            <version>6.0.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>osgi.core</artifactId>
+            <version>6.0.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.ds-annotations</artifactId>
+            <version>1.2.4</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>1.7.21</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/569533de/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEvent.java
----------------------------------------------------------------------
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEvent.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEvent.java
new file mode 100644
index 0000000..c278678
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEvent.java
@@ -0,0 +1,59 @@
+/*
+ * 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.graphql;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+public class CXSEvent {
+
+    private String id;
+    private String eventType;
+    private long timeStamp;
+    private String subject;
+    private String object;
+    private Map<Object,Object> properties = new LinkedHashMap<>();
+    private CXSGeoPoint location;
+
+    public String getId() {
+        return id;
+    }
+
+    public String getEventType() {
+        return eventType;
+    }
+
+    public long getTimeStamp() {
+        return timeStamp;
+    }
+
+    public String getSubject() {
+        return subject;
+    }
+
+    public String getObject() {
+        return object;
+    }
+
+    public Map<Object, Object> getProperties() {
+        return properties;
+    }
+
+    public CXSGeoPoint getLocation() {
+        return location;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/569533de/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventType.java
----------------------------------------------------------------------
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventType.java
new file mode 100644
index 0000000..43f04fb
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSEventType.java
@@ -0,0 +1,26 @@
+/*
+ * 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.graphql;
+
+import graphql.annotations.annotationTypes.GraphQLField;
+
+public class CXSEventType {
+
+    @GraphQLField
+    public String id;
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/569533de/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPoint.java
----------------------------------------------------------------------
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPoint.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPoint.java
new file mode 100644
index 0000000..bfa7c24
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGeoPoint.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.graphql;
+
+import graphql.annotations.annotationTypes.GraphQLField;
+
+public class CXSGeoPoint {
+
+    @GraphQLField
+    public double latitude;
+
+    @GraphQLField
+    public double longitude;
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/569533de/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGraphQLProvider.java
----------------------------------------------------------------------
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGraphQLProvider.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGraphQLProvider.java
new file mode 100644
index 0000000..01f2636
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSGraphQLProvider.java
@@ -0,0 +1,21 @@
+/*
+ * 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.graphql;
+
+public interface CXSGraphQLProvider {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/569533de/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProperties.java
----------------------------------------------------------------------
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProperties.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProperties.java
new file mode 100644
index 0000000..55a1b3e
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProperties.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.unomi.graphql;
+
+import graphql.annotations.annotationTypes.GraphQLField;
+
+public class CXSProperties {
+
+    @GraphQLField
+    public String key;
+
+    @GraphQLField
+    public String value;
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/569533de/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyType.java
----------------------------------------------------------------------
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyType.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyType.java
new file mode 100644
index 0000000..a55a04b
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSPropertyType.java
@@ -0,0 +1,32 @@
+/*
+ * 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.graphql;
+
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+public class CXSPropertyType {
+
+    private String id;
+    private String name;
+    private int minOccurrences = 0;
+    private int maxOccurrences = 1;
+    private Set<String> tags = new LinkedHashSet<>();
+    private Set<String> systemTags = new LinkedHashSet<>();
+    private boolean personalData = false;
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/569533de/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProviderManager.java
----------------------------------------------------------------------
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProviderManager.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProviderManager.java
new file mode 100644
index 0000000..a341a9f
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/CXSProviderManager.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.graphql;
+
+import graphql.servlet.GraphQLMutationProvider;
+import graphql.servlet.GraphQLQueryProvider;
+import graphql.servlet.GraphQLTypesProvider;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
+
+import java.util.Map;
+
+@Component(
+        name="CXSProviderManager",
+        immediate = true
+)
+public class CXSProviderManager {
+
+    @Reference(name = "CXSGraphQLProvider")
+    private CXSGraphQLProvider cxsGraphQLProvider;
+    private ServiceRegistration<?> providerSR;
+    private BundleContext bundleContext;
+
+    @Activate
+    void activate(
+            ComponentContext componentContext,
+            BundleContext bundleContext,
+            Map<String,Object> config) {
+        this.bundleContext = bundleContext;
+    }
+
+    @Deactivate
+    void deactivate(
+            ComponentContext componentContext,
+            BundleContext bundleContext,
+            Map<String,Object> config) {
+    }
+
+    void refreshProviders() {
+        if (providerSR != null) {
+            providerSR.unregister();
+            providerSR = null;
+            providerSR = bundleContext.registerService(new String[] {
+                    GraphQLQueryProvider.class.getName(),
+                    GraphQLTypesProvider.class.getName(),
+                    GraphQLMutationProvider.class.getName()
+            }, cxsGraphQLProvider, null);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/569533de/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSGraphQLProviderImpl.java
----------------------------------------------------------------------
diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSGraphQLProviderImpl.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSGraphQLProviderImpl.java
new file mode 100644
index 0000000..e451dde
--- /dev/null
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/internal/CXSGraphQLProviderImpl.java
@@ -0,0 +1,188 @@
+/*
+ * 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.graphql.internal;
+
+import graphql.annotations.processor.GraphQLAnnotations;
+import graphql.schema.*;
+import graphql.servlet.GraphQLMutationProvider;
+import graphql.servlet.GraphQLQueryProvider;
+import graphql.servlet.GraphQLTypesProvider;
+import org.apache.unomi.graphql.*;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+
+import java.util.*;
+
+import static graphql.Scalars.*;
+import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
+import static graphql.schema.GraphQLObjectType.newObject;
+
+@Component(
+        name = "CXSGraphQLProvider",
+        immediate = true
+)
+public class CXSGraphQLProviderImpl implements CXSGraphQLProvider, GraphQLQueryProvider, GraphQLTypesProvider, GraphQLMutationProvider {
+
+    private Map<String,GraphQLOutputType> registeredOutputTypes = new TreeMap<>();
+
+    @Activate
+    void activate(
+            ComponentContext cc,
+            BundleContext bc,
+            Map<String,Object> config) {
+
+        registeredOutputTypes.put(CXSGeoPoint.class.getName(), GraphQLAnnotations.object(CXSGeoPoint.class));
+        registeredOutputTypes.put(CXSProperties.class.getName(), GraphQLAnnotations.object(CXSProperties.class));
+        registeredOutputTypes.put(CXSEventType.class.getName(), GraphQLAnnotations.object(CXSEventType.class));
+
+        registeredOutputTypes.put("CXS_Event", buildCXSEventOutputType());
+        registeredOutputTypes.put("CXS_Query", buildCXSQueryOutputType());
+    }
+
+    @Deactivate
+    void deactivate(
+            ComponentContext cc,
+            BundleContext bc,
+            Map<String,Object> config) {
+
+        registeredOutputTypes.clear();
+    }
+
+    @Override
+    public Collection<GraphQLFieldDefinition> getQueries() {
+        List<GraphQLFieldDefinition> fieldDefinitions = new ArrayList<GraphQLFieldDefinition>();
+        fieldDefinitions.add(newFieldDefinition()
+                .type(registeredOutputTypes.get("CXS_Query"))
+                .name("cxs")
+                .description("Root field for all CXS queries")
+                .dataFetcher(new DataFetcher() {
+                    public Object get(DataFetchingEnvironment environment) {
+                        Map<String,Object> map = environment.getContext();
+                        return map.keySet();
+                    }
+                }).build());
+        return fieldDefinitions;
+    }
+
+    @Override
+    public Collection<GraphQLType> getTypes() {
+        return new ArrayList<>();
+    }
+
+    @Override
+    public Collection<GraphQLFieldDefinition> getMutations() {
+        return new ArrayList<>();
+    }
+
+    private GraphQLOutputType buildCXSQueryOutputType() {
+        return newObject()
+                .name("CXS_Query")
+                .description("Root CXS query type")
+                .field(newFieldDefinition()
+                        .type(new GraphQLList(registeredOutputTypes.get(CXSEventType.class.getName())))
+                        .name("getEventTypes")
+                        .description("Retrieves the list of all the declared CXS event types in the Apache Unomi server")
+                )
+                .build();
+    }
+
+
+    private GraphQLOutputType buildCXSEventOutputType() {
+        return newObject()
+                .name("CXS_Event")
+                .description("An event is generated by user interacting with the Context Server")
+                .field(newFieldDefinition()
+                        .type(GraphQLID)
+                        .name("id")
+                        .description("A unique identifier for the event")
+                        .dataFetcher(new DataFetcher() {
+                            public Object get(DataFetchingEnvironment environment) {
+                                CXSEvent CXSEvent = environment.getSource();
+                                return CXSEvent.getId();
+                            }
+                        })
+                )
+                .field(newFieldDefinition()
+                        .type(GraphQLString)
+                        .name("eventType")
+                        .description("An identifier for the event type")
+                        .dataFetcher(new DataFetcher() {
+                            public Object get(DataFetchingEnvironment environment) {
+                                CXSEvent CXSEvent = environment.getSource();
+                                return CXSEvent.getEventType();
+                            }
+                        })
+                )
+                .field(newFieldDefinition()
+                        .type(GraphQLLong)
+                        .name("timestamp")
+                        .description("The difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.")
+                        .dataFetcher(new DataFetcher() {
+                            public Object get(DataFetchingEnvironment environment) {
+                                CXSEvent CXSEvent = environment.getSource();
+                                return CXSEvent.getTimeStamp();
+                            }
+                        }))
+                .field(newFieldDefinition()
+                        .type(GraphQLString)
+                        .name("subject")
+                        .description("The entity that has fired the event (using the profile)")
+                        .dataFetcher(new DataFetcher() {
+                            public Object get(DataFetchingEnvironment environment) {
+                                CXSEvent CXSEvent = environment.getSource();
+                                return CXSEvent.getSubject();
+                            }
+                        }))
+                .field(newFieldDefinition()
+                        .type(GraphQLString)
+                        .name("object")
+                        .description("The object on which the event was fired.")
+                        .dataFetcher(new DataFetcher() {
+                            public Object get(DataFetchingEnvironment environment) {
+                                CXSEvent CXSEvent = environment.getSource();
+                                return CXSEvent.getObject();
+                            }
+                        })
+                )
+                .field(newFieldDefinition()
+                        .type(registeredOutputTypes.get(CXSGeoPoint.class.getName()))
+                        .name("location")
+                        .description("The geo-point location where the event was fired.")
+                        .dataFetcher(new DataFetcher() {
+                            public Object get(DataFetchingEnvironment environment) {
+                                CXSEvent CXSEvent = environment.getSource();
+                                return CXSEvent.getLocation();
+                            }
+                        })
+                )
+                .field(newFieldDefinition()
+                        .type(new GraphQLList(registeredOutputTypes.get(CXSProperties.class.getName())))
+                        .name("properties")
+                        .description("Generic properties for the event")
+                        .dataFetcher(new DataFetcher() {
+                            public Object get(DataFetchingEnvironment environment) {
+                                CXSEvent CXSEvent = environment.getSource();
+                                return new ArrayList<Map.Entry<Object,Object>>(CXSEvent.getProperties().entrySet());
+                            }
+                        })
+                )
+                .build();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/569533de/graphql/karaf-feature/pom.xml
----------------------------------------------------------------------
diff --git a/graphql/karaf-feature/pom.xml b/graphql/karaf-feature/pom.xml
new file mode 100644
index 0000000..011e1eb
--- /dev/null
+++ b/graphql/karaf-feature/pom.xml
@@ -0,0 +1,126 @@
+<?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>
+        <groupId>org.apache.unomi</groupId>
+        <artifactId>unomi-graphql</artifactId>
+        <version>1.3.0-incubating-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>feature</packaging>
+
+    <artifactId>cxs-graphql-feature</artifactId>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-core</artifactId>
+            <version>2.8.4</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-annotations</artifactId>
+            <version>2.8.4</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+            <version>2.8.4</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.datatype</groupId>
+            <artifactId>jackson-datatype-jdk8</artifactId>
+            <version>2.8.4</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+            <version>20.0</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-fileupload</groupId>
+            <artifactId>commons-fileupload</artifactId>
+            <version>1.3.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.antlr</groupId>
+            <artifactId>antlr4-runtime</artifactId>
+            <version>4.5.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.graphql-java</groupId>
+            <artifactId>graphql-java-servlet</artifactId>
+            <version>${graphql.java.servlet.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>javax.servlet</groupId>
+                    <artifactId>javax.servlet-api</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>com.graphql-java</groupId>
+            <artifactId>graphql-java</artifactId>
+            <version>${graphql.java.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-api</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>io.github.graphql-java</groupId>
+            <artifactId>graphql-java-annotations</artifactId>
+            <version>${graphql.java.annotations.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+                <artifactId>cxs-graphql-api-impl</artifactId>
+            <version>1.3.0-incubating-SNAPSHOT</version>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.karaf.tooling</groupId>
+                <artifactId>karaf-maven-plugin</artifactId>
+                <version>${version.karaf}</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <startLevel>80</startLevel>
+                    <addTransitiveFeatures>true</addTransitiveFeatures>
+                    <includeTransitiveDependency>true</includeTransitiveDependency>
+                </configuration>
+            </plugin>
+        </plugins>
+
+    </build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/569533de/graphql/pom.xml
----------------------------------------------------------------------
diff --git a/graphql/pom.xml b/graphql/pom.xml
new file mode 100644
index 0000000..bc03766
--- /dev/null
+++ b/graphql/pom.xml
@@ -0,0 +1,44 @@
+<?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>
+        <groupId>org.apache.unomi</groupId>
+        <artifactId>unomi-root</artifactId>
+        <version>1.3.0-incubating-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>unomi-graphql</artifactId>
+    <name>Apache Unomi :: GraphQL API</name>
+    <description>Apache Unomi Context GraphQL API</description>
+    <packaging>pom</packaging>
+
+    <properties>
+        <graphql.java.servlet.version>4.7.0</graphql.java.servlet.version>
+        <graphql.java.version>6.0</graphql.java.version>
+        <graphql.java.annotations.version>5.1</graphql.java.annotations.version>
+    </properties>
+
+    <modules>
+        <module>cxs-impl</module>
+        <module>karaf-feature</module>
+    </modules>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/569533de/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 4e43a20..9b94362 100644
--- a/pom.xml
+++ b/pom.xml
@@ -898,6 +898,7 @@
         <module>persistence-elasticsearch</module>
         <module>services</module>
         <module>rest</module>
+        <module>graphql</module>
         <module>wab</module>
         <module>plugins</module>
         <module>extensions</module>


[2/5] incubator-unomi git commit: UNOMI-125 Fix various build generation issues - Fix incomplete / erros in Javadocs - Fix RAT plugin problem when compiling packaged sources

Posted by sh...@apache.org.
UNOMI-125 Fix various build generation issues
- Fix incomplete / erros in Javadocs
- Fix RAT plugin problem when compiling packaged sources

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/e0ffc081
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/e0ffc081
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/e0ffc081

Branch: refs/heads/UNOMI-180-CXS-GRAPHQLAPI
Commit: e0ffc0814f4ff4288b591407afdb0679358249bc
Parents: 9fcfd42
Author: Serge Huber <sh...@apache.org>
Authored: Sun May 6 21:29:56 2018 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Sun May 6 21:29:56 2018 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/unomi/api/Consent.java |  3 +-
 .../main/java/org/apache/unomi/api/Profile.java |  1 +
 .../unomi/api/services/ClusterService.java      |  2 +-
 .../unomi/api/services/DefinitionsService.java  | 12 ++++----
 .../api/services/PersonalizationService.java    |  5 ++-
 .../unomi/api/services/PrivacyService.java      | 32 +++++++++++++-------
 .../unomi/api/services/ProfileService.java      |  4 ++-
 metrics/pom.xml                                 |  6 ++++
 .../unomi/metrics/commands/ActivateCommand.java |  2 --
 .../metrics/commands/DeactivateCommand.java     |  2 --
 pom.xml                                         |  1 +
 11 files changed, 45 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e0ffc081/api/src/main/java/org/apache/unomi/api/Consent.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/Consent.java b/api/src/main/java/org/apache/unomi/api/Consent.java
index f0da669..2cb20ab 100644
--- a/api/src/main/java/org/apache/unomi/api/Consent.java
+++ b/api/src/main/java/org/apache/unomi/api/Consent.java
@@ -65,6 +65,7 @@ public class Consent implements Serializable {
      * @param consentMap a Map that contains the following key-value pairs : typeIdentifier:String, status:String (must
      *                   be one of GRANTED, DENIED or REVOKED), statusDate:String (ISO8601 date format !), revokeDate:String (ISO8601 date format !)
      * @param dateFormat a DateFormat instance to convert the date string to date objects
+     * @throws ParseException in case one of the dates failed to parse properly
      */
     public Consent(Map<String,Object> consentMap, DateFormat dateFormat) throws ParseException {
         if (consentMap.containsKey("scope")) {
@@ -178,7 +179,7 @@ public class Consent implements Serializable {
     /**
      * Test if the consent is GRANTED right now.
      * @return true if the consent is granted using the current date (internally a new Date() is created and the
-     * @Consent#isConsentGivenAtDate is called.
+     * {@link Consent#isConsentGrantedAtDate} is called.
      */
     @XmlTransient
     public boolean isConsentGrantedNow() {

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e0ffc081/api/src/main/java/org/apache/unomi/api/Profile.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/Profile.java b/api/src/main/java/org/apache/unomi/api/Profile.java
index 5bc3b72..69c6c21 100644
--- a/api/src/main/java/org/apache/unomi/api/Profile.java
+++ b/api/src/main/java/org/apache/unomi/api/Profile.java
@@ -205,6 +205,7 @@ public class Profile extends Item {
 
     /**
      * Returns true if this profile is an anonymous profile.
+     * @return true of the profile has been marked as an anonymous profile, false otherwise.
      */
     @XmlTransient
     public boolean isAnonymousProfile() {

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e0ffc081/api/src/main/java/org/apache/unomi/api/services/ClusterService.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/services/ClusterService.java b/api/src/main/java/org/apache/unomi/api/services/ClusterService.java
index 9a0fdfa..4c89ba9 100644
--- a/api/src/main/java/org/apache/unomi/api/services/ClusterService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/ClusterService.java
@@ -54,7 +54,7 @@ public interface ClusterService {
      * This function will send an event to the nodes of the cluster
      * The function takes a Serializable to avoid dependency on any clustering framework
      *
-     * @param event this object will be cast to {@link org.apache.karaf.cellar.core.event.Event}
+     * @param event this object will be cast to a org.apache.karaf.cellar.core.event.Event object
      */
     void sendEvent(Serializable event);
 }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e0ffc081/api/src/main/java/org/apache/unomi/api/services/DefinitionsService.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/services/DefinitionsService.java b/api/src/main/java/org/apache/unomi/api/services/DefinitionsService.java
index 6618741..4b1a141 100644
--- a/api/src/main/java/org/apache/unomi/api/services/DefinitionsService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/DefinitionsService.java
@@ -178,9 +178,9 @@ public interface DefinitionsService {
      * TODO: remove from API and move to a different class?
      * TODO: purpose and behavior not clear
      *
-     * @param rootCondition
-     * @param tag
-     * @return Condition
+     * @param rootCondition the root condition where to start the extraction by class
+     * @param tag the tag to use to extract the condition
+     * @return Condition the condition that has been found matching the tag, or null if none matched
      */
     @Deprecated
     Condition extractConditionByTag(Condition rootCondition, String tag);
@@ -188,9 +188,9 @@ public interface DefinitionsService {
     /**
      * Retrieves a condition matching the specified system tag identifier from the specified root condition.
      *
-     * @param rootCondition
-     * @param systemTag
-     * @return Condition
+     * @param rootCondition the root condition where to start the extraction by class
+     * @param systemTag the tag to use to extract the condition
+     * @return Condition the condition that has been found matching the tag, or null if none matched
      */
     Condition extractConditionBySystemTag(Condition rootCondition, String systemTag);
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e0ffc081/api/src/main/java/org/apache/unomi/api/services/PersonalizationService.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/services/PersonalizationService.java b/api/src/main/java/org/apache/unomi/api/services/PersonalizationService.java
index 36588a4..5cff730 100644
--- a/api/src/main/java/org/apache/unomi/api/services/PersonalizationService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/PersonalizationService.java
@@ -128,7 +128,10 @@ public interface PersonalizationService {
         }
 
         /**
-         * @deprecated
+         * Sets the filter identifier associated with this content filtering definition.
+         *
+         * @param filterid the filter identifier associated with this content filtering definition
+         * @deprecated this method is deprecated use the setId method instead
          */
         public void setFilterid(String filterid) {
             this.id = filterid;

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e0ffc081/api/src/main/java/org/apache/unomi/api/services/PrivacyService.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/services/PrivacyService.java b/api/src/main/java/org/apache/unomi/api/services/PrivacyService.java
index 2046642..4dc7def 100644
--- a/api/src/main/java/org/apache/unomi/api/services/PrivacyService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/PrivacyService.java
@@ -30,7 +30,7 @@ public interface PrivacyService {
     /**
      * Retrieves the server information, including the name and version of the server, the event types
      * if recognizes as well as the capabilities supported by the system.
-     * @return
+     * @return a ServerInfo object with all the server information
      */
     ServerInfo getServerInfo();
 
@@ -135,26 +135,36 @@ public interface PrivacyService {
     Boolean setFilteredEventTypes(String profileId, List<String> eventTypes);
 
     /**
-     * Gets the list of denied
-     * @param profileId
-     * @return
+     * Gets the list of denied properties. These are properties marked with a personal identifier tag.
+     * @param profileId the identified of the profile
+     * @return a list of profile properties identifiers that are marked as personally identifying
      */
     List<String> getDeniedProperties(String profileId);
 
+    /**
+     * Sets the list of denied properties.
+     * @param profileId the profile for which to see the denied properties
+     * @param propertyNames the property names to be denied
+     * @return null all the time, this method is not used and is marked as deprecated
+     * @deprecated don't use this method, instead mark properties with the personal identifier tag which will mark them
+     * as denied by the getDeniedProperties method
+     */
     Boolean setDeniedProperties(String profileId, List<String> propertyNames);
 
     /**
-     * @deprecated
-     * @param profileId
-     * @return
+     * This method doesn't do anything anymore please don't use it
+     * @deprecated do not use
+     * @param profileId the identifier of the profile
+     * @return do not use
      */
     List<String> getDeniedPropertyDistribution(String profileId);
 
     /**
-     * @deprecated
-     * @param profileId
-     * @param propertyNames
-     * @return
+     * This method doesn't do anything anymore please don't use it
+     * @deprecated do not use
+     * @param profileId the identifier of the profile
+     * @param propertyNames do not use
+     * @return do not use
      */
     Boolean setDeniedPropertyDistribution(String profileId, List<String> propertyNames);
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e0ffc081/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 4c81974..028cc89 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
@@ -333,12 +333,14 @@ public interface ProfileService {
     Set<PropertyType> getExistingProperties(String tag, String itemType);
 
     /**
-     * Retrieves the existing property types for the specified type as defined by the Item subclass public field {@code ITEM_TYPE} and with the specified tag.
+     * Retrieves the existing property types for the specified type as defined by the Item subclass public
+     * field {@code ITEM_TYPE} and with the specified tag (system or regular)
      *
      * TODO: move to a different class
      *
      * @param tag      the tag we're interested in
      * @param itemType the String representation of the item type we want to retrieve the count of, as defined by its class' {@code ITEM_TYPE} field
+     * @param systemTag whether the specified is a system tag or a regular one
      * @return all property types defined for the specified item type and with the specified tag
      */
     Set<PropertyType> getExistingProperties(String tag, String itemType, boolean systemTag);

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e0ffc081/metrics/pom.xml
----------------------------------------------------------------------
diff --git a/metrics/pom.xml b/metrics/pom.xml
index a6423c0..7eaca74 100644
--- a/metrics/pom.xml
+++ b/metrics/pom.xml
@@ -70,6 +70,12 @@
             <scope>provided</scope>
         </dependency>
 
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
         <!-- Unit tests -->
         <dependency>
             <groupId>junit</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e0ffc081/metrics/src/main/java/org/apache/unomi/metrics/commands/ActivateCommand.java
----------------------------------------------------------------------
diff --git a/metrics/src/main/java/org/apache/unomi/metrics/commands/ActivateCommand.java b/metrics/src/main/java/org/apache/unomi/metrics/commands/ActivateCommand.java
index ad17c24..8ed8243 100644
--- a/metrics/src/main/java/org/apache/unomi/metrics/commands/ActivateCommand.java
+++ b/metrics/src/main/java/org/apache/unomi/metrics/commands/ActivateCommand.java
@@ -17,8 +17,6 @@
 package org.apache.unomi.metrics.commands;
 
 import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
-import org.apache.unomi.metrics.MetricsService;
 
 @Command(scope = "metrics", name = "activate", description = "This will activate the metrics system.")
 public class ActivateCommand extends MetricsCommandSupport {

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e0ffc081/metrics/src/main/java/org/apache/unomi/metrics/commands/DeactivateCommand.java
----------------------------------------------------------------------
diff --git a/metrics/src/main/java/org/apache/unomi/metrics/commands/DeactivateCommand.java b/metrics/src/main/java/org/apache/unomi/metrics/commands/DeactivateCommand.java
index d16eac0..ef0eefb 100644
--- a/metrics/src/main/java/org/apache/unomi/metrics/commands/DeactivateCommand.java
+++ b/metrics/src/main/java/org/apache/unomi/metrics/commands/DeactivateCommand.java
@@ -17,8 +17,6 @@
 package org.apache.unomi.metrics.commands;
 
 import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
-import org.apache.unomi.metrics.MetricsService;
 
 @Command(scope = "metrics", name = "deactivate", description = "This will de-activate the metrics system.")
 public class DeactivateCommand extends MetricsCommandSupport {

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e0ffc081/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 67b9f25..4e43a20 100644
--- a/pom.xml
+++ b/pom.xml
@@ -430,6 +430,7 @@
                             <excludes>
                                 <exclude>**/NOTICE.template</exclude>
                                 <exclude>**/NOTICE-generated</exclude>
+                                <exclude>**/DEPENDENCIES</exclude>
                                 <exclude>**/target/**/*</exclude>
                                 <!-- GIT files -->
                                 <exclude>**/.git/**/*</exclude>


[3/5] incubator-unomi git commit: Added param description to Event constructor

Posted by sh...@apache.org.
Added param description to Event constructor


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

Branch: refs/heads/UNOMI-180-CXS-GRAPHQLAPI
Commit: 00b95192c4e2e183e3be927f9096fcd3b867cadf
Parents: a61a293
Author: Donald Hinshaw <do...@kortx.io>
Authored: Mon May 7 09:45:52 2018 -0400
Committer: Donald Hinshaw <do...@kortx.io>
Committed: Mon May 7 09:45:52 2018 -0400

----------------------------------------------------------------------
 api/src/main/java/org/apache/unomi/api/Event.java | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/00b95192/api/src/main/java/org/apache/unomi/api/Event.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/Event.java b/api/src/main/java/org/apache/unomi/api/Event.java
index 845a02a..52b61ce 100644
--- a/api/src/main/java/org/apache/unomi/api/Event.java
+++ b/api/src/main/java/org/apache/unomi/api/Event.java
@@ -113,6 +113,7 @@ public class Event extends Item implements TimestampedItem {
      * @param target     the target of the event if any
      * @param timestamp  the timestamp associated with the event if provided
      * @param properties the properties for this event if any
+     * @param persistent specifies if the event needs to be persisted
      */
     public Event(String eventType, Session session, Profile profile, String scope, Item source, Item target, Map<String, Object> properties, Date timestamp, boolean persistent) {
         this(eventType, session, profile, scope, source, target, timestamp);


[4/5] incubator-unomi git commit: This closes pull request number #61

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


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

Branch: refs/heads/UNOMI-180-CXS-GRAPHQLAPI
Commit: ef24a79ff463975b309cbad94951b45464cf09dd
Parents: e0ffc08 00b9519
Author: Serge Huber <sh...@apache.org>
Authored: Tue May 8 15:34:56 2018 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Tue May 8 15:34:56 2018 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/unomi/api/Event.java   |  7 +++--
 .../elasticsearch/ESCustomObjectMapper.java     |  2 ++
 .../persistence/elasticsearch/ESEventMixIn.java | 29 ++++++++++++++++++++
 .../org/apache/unomi/web/ContextServlet.java    |  3 +-
 .../unomi/web/EventsCollectorServlet.java       |  3 +-
 5 files changed, 39 insertions(+), 5 deletions(-)
----------------------------------------------------------------------