http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/PropertyConditionEvaluator.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/PropertyConditionEvaluator.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/PropertyConditionEvaluator.java
deleted file mode 100644
index 2ce5397..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/PropertyConditionEvaluator.java
+++ /dev/null
@@ -1,299 +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.oasis_open.contextserver.plugins.baseplugin.conditions;
-
-import ognl.Node;
-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.elasticsearch.ElasticsearchParseException;
-import org.elasticsearch.common.joda.DateMathParser;
-import org.elasticsearch.index.mapper.core.DateFieldMapper;
-import org.oasis_open.contextserver.api.Event;
-import org.oasis_open.contextserver.api.Item;
-import org.oasis_open.contextserver.api.conditions.Condition;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionContextHelper;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionEvaluator;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionEvaluatorDispatcher;
-import org.oasis_open.contextserver.persistence.spi.PropertyHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.concurrent.Callable;
-import java.util.concurrent.TimeUnit;
-import java.util.regex.Pattern;
-
-/**
- * Evaluator for property comparison conditions
- */
-public class PropertyConditionEvaluator implements ConditionEvaluator {
-
-    private static final Logger logger = 
LoggerFactory.getLogger(PropertyConditionEvaluator.class.getName());
-
-    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) {
-        if (expectedValue == null && expectedValueDate == null && 
expectedValueInteger == null && getDate(expectedValueDateExpr) == null) {
-            return actualValue == null ? 0 : 1;
-        } else if (actualValue == null) {
-            return -1;
-        }
-
-        if (expectedValueInteger != null) {
-            return 
PropertyHelper.getInteger(actualValue).compareTo(PropertyHelper.getInteger(expectedValueInteger));
-        } else if (expectedValueDate != null) {
-            return getDate(actualValue).compareTo(getDate(expectedValueDate));
-        } else if (expectedValueDateExpr != null) {
-            return 
getDate(actualValue).compareTo(getDate(expectedValueDateExpr));
-        } else {
-            return actualValue.toString().compareTo(expectedValue);
-        }
-    }
-
-    private boolean compareMultivalue(Object actualValue, List<?> 
expectedValues, List<?> expectedValuesDate, List<?> expectedValuesNumber, 
List<?> expectedValuesDateExpr, String op) {
-        @SuppressWarnings("unchecked")
-        List<?> expected = ObjectUtils.firstNonNull(expectedValues, 
expectedValuesDate, expectedValuesNumber);
-        if (actualValue == null) {
-            return expected == null;
-        } else if (expected == null) {
-            return false;
-        }
-        
-        List<Object> actual = 
ConditionContextHelper.foldToASCII(getValueSet(actualValue));
-
-        boolean result = true;
-        
-        switch (op) {
-            case "in":
-                result = false;
-                for (Object a : actual) {
-                    if (expected.contains(a)) {
-                        result = true;
-                        break;
-                    }
-                }
-                break;
-            case "notIn":
-                for (Object a : actual) {
-                    if (expected.contains(a)) {
-                        result = false;
-                        break;
-                    }
-                }
-                break;
-            case "all":
-                for (Object e : expected) {
-                    if (!actual.contains(e)) {
-                        result = false;
-                        break;
-                    }
-                }
-                break;
-                
-            default:
-                throw new IllegalArgumentException("Unknown comparison 
operator " + op);
-        }
-        
-        return result;
-    }
-
-    @Override
-    public boolean eval(Condition condition, Item item, Map<String, Object> 
context, ConditionEvaluatorDispatcher dispatcher) {
-        String op = (String) condition.getParameter("comparisonOperator");
-        String name = (String) condition.getParameter("propertyName");
-
-        String expectedValue = ConditionContextHelper.foldToASCII((String) 
condition.getParameter("propertyValue"));
-        Object expectedValueInteger = 
condition.getParameter("propertyValueInteger");
-        Object expectedValueDate = condition.getParameter("propertyValueDate");
-        Object expectedValueDateExpr = 
condition.getParameter("propertyValueDateExpr");
-
-        Object actualValue;
-        if (item instanceof Event && "eventType".equals(name)) {
-            actualValue = ((Event)item).getEventType();
-        } else {
-            try {
-                long time = System.nanoTime();
-                //actualValue = 
beanUtilsBean.getPropertyUtils().getProperty(item, name);
-                actualValue = getPropertyValue(item, name);
-                time = System.nanoTime() - time;
-                if (time > 5000000L) {
-                    logger.info("eval took {} ms for {} {}", time / 1000000L, 
item.getClass().getName(), name);
-                }
-            } catch (NullPointerException e) {
-                // property not found
-                actualValue = null;
-            } catch (Exception e) {
-                if (!(e instanceof OgnlException)
-                        || (!StringUtils.startsWith(((OgnlException) 
e).getMessage(),
-                                "source is null for getProperty(null"))) {
-                    logger.warn("Error evaluating value for " + 
item.getClass().getName() + " " + name, e);
-                }
-                actualValue = null;
-            }
-        }
-        if (actualValue instanceof String) {
-            actualValue = ConditionContextHelper.foldToASCII((String) 
actualValue);
-        }
-
-        if(op == null) {
-            return false;
-        } else if(actualValue == null){
-            return op.equals("missing");
-        } else if (op.equals("exists")) {
-            return true;
-        } else if (op.equals("equals")) {
-            if (actualValue instanceof Collection) {
-                for (Object o : ((Collection<?>)actualValue)) {
-                    if (o instanceof String) {
-                        o = ConditionContextHelper.foldToASCII((String) o);
-                    }
-                    if (compare(o, expectedValue, expectedValueDate, 
expectedValueInteger, expectedValueDateExpr) == 0) {
-                        return true;
-                    }
-                }
-                return false;
-            }
-            return compare(actualValue, expectedValue, expectedValueDate, 
expectedValueInteger, expectedValueDateExpr) == 0;
-        } else if (op.equals("notEquals")) {
-            return compare(actualValue, expectedValue, expectedValueDate, 
expectedValueInteger, expectedValueDateExpr) != 0;
-        } else if (op.equals("greaterThan")) {
-            return compare(actualValue, expectedValue, expectedValueDate, 
expectedValueInteger, expectedValueDateExpr) > 0;
-        } else if (op.equals("greaterThanOrEqualTo")) {
-            return compare(actualValue, expectedValue, expectedValueDate, 
expectedValueInteger, expectedValueDateExpr) >= 0;
-        } else if (op.equals("lessThan")) {
-            return compare(actualValue, expectedValue, expectedValueDate, 
expectedValueInteger, expectedValueDateExpr) < 0;
-        } else if (op.equals("lessThanOrEqualTo")) {
-            return compare(actualValue, expectedValue, expectedValueDate, 
expectedValueInteger, expectedValueDateExpr) <= 0;
-        } else if (op.equals("between")) {
-            List<?> expectedValuesInteger = (List<?>) 
condition.getParameter("propertyValuesInteger");
-            List<?> expectedValuesDate = (List<?>) 
condition.getParameter("propertyValuesDate");
-            List<?> expectedValuesDateExpr = (List<?>) 
condition.getParameter("propertyValuesDateExpr");
-            return compare(actualValue, null,
-                    (expectedValuesDate != null && expectedValuesDate.size() 
>= 1) ? getDate(expectedValuesDate.get(0)) : null,
-                    (expectedValuesInteger != null && 
expectedValuesInteger.size() >= 1) ? (Integer) expectedValuesInteger.get(0) : 
null,
-                    (expectedValuesDateExpr != null && 
expectedValuesDateExpr.size() >= 1) ? (String) expectedValuesDateExpr.get(0) : 
null) >= 0
-                    &&
-                    compare(actualValue, null,
-                            (expectedValuesDate != null && 
expectedValuesDate.size() >= 2) ? getDate(expectedValuesDate.get(1)) : null,
-                            (expectedValuesInteger != null && 
expectedValuesInteger.size() >= 2) ? (Integer) expectedValuesInteger.get(1) : 
null,
-                            (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("startsWith")) {
-            return actualValue.toString().startsWith(expectedValue);
-        } else if (op.equals("endsWith")) {
-            return actualValue.toString().endsWith(expectedValue);
-        } else if (op.equals("matchesRegex")) {
-            return expectedValue != null && 
Pattern.compile(expectedValue).matcher(actualValue.toString()).matches();
-        } else if (op.equals("in") || op.equals("notIn") || op.equals("all")) {
-            List<?> expectedValues = 
ConditionContextHelper.foldToASCII((List<?>) 
condition.getParameter("propertyValues"));
-            List<?> expectedValuesInteger = (List<?>) 
condition.getParameter("propertyValuesInteger");
-            List<?> expectedValuesDate = (List<?>) 
condition.getParameter("propertyValuesDate");
-            List<?> expectedValuesDateExpr = (List<?>) 
condition.getParameter("propertyValuesDateExpr");
-
-            return compareMultivalue(actualValue, expectedValues, 
expectedValuesDate, expectedValuesInteger, expectedValuesDateExpr, op);
-        } else if(op.equals("isDay") && expectedValueDate != null) {
-            return 
yearMonthDayDateFormat.format(getDate(actualValue)).equals(yearMonthDayDateFormat.format(getDate(expectedValueDate)));
-        } else if(op.equals("isNotDay") && expectedValueDate != null) {
-            return 
!yearMonthDayDateFormat.format(getDate(actualValue)).equals(yearMonthDayDateFormat.format(getDate(expectedValueDate)));
-        }
-        
-        return false;
-    }
-
-    private Object getPropertyValue(Item item, String expression) throws 
Exception {
-        ExpressionAccessor accessor = getPropertyAccessor(item, expression);
-        return accessor != null ? accessor.get((OgnlContext) 
Ognl.createDefaultContext(null), item) : null;
-    }
-
-    private ExpressionAccessor getPropertyAccessor(Item item, String 
expression) throws Exception {
-        ExpressionAccessor accessor = null;
-        String clazz = item.getClass().getName();
-        Map<String, ExpressionAccessor> expressions = 
expressionCache.get(clazz);
-        if (expressions == null) {
-            expressions = new HashMap<>();
-            expressionCache.put(clazz, expressions);
-        } else {
-            accessor = expressions.get(expression);
-        }
-        if (accessor == null) {
-            long time = System.nanoTime();
-            Thread current = Thread.currentThread();
-            ClassLoader contextCL = current.getContextClassLoader();
-            try {
-                
current.setContextClassLoader(PropertyConditionEvaluator.class.getClassLoader());
-                Node node = (Node) Ognl.compileExpression((OgnlContext) 
Ognl.createDefaultContext(null), item, expression);
-                accessor = node.getAccessor();
-            } finally {
-                current.setContextClassLoader(contextCL);
-            }
-            if (accessor != null) {
-                expressions.put(expression, accessor);
-            } else {
-                logger.warn("Unable to compile expression for {} and {}", 
clazz, expression);
-            }
-            time = System.nanoTime() - time;
-            logger.info("Expression compilation for {} took {}", expression, 
time / 1000000L);
-        }
-
-        return accessor;
-    }
-    
-    private Date getDate(Object value) {
-        if (value == null) {
-            return null;
-        }
-        if (value instanceof Date) {
-            return ((Date) value);
-        } else {
-            DateMathParser parser = new 
DateMathParser(DateFieldMapper.Defaults.DATE_TIME_FORMATTER, 
TimeUnit.MILLISECONDS);
-            try {
-                return new Date(parser.parse(value.toString(), new 
Callable<Long>() {
-                    @Override
-                    public Long call() throws Exception {
-                        return System.currentTimeMillis();
-                    }
-                }));
-            } catch (ElasticsearchParseException e) {
-                logger.warn("unable to parse date " + value.toString(), e);
-            }
-        }
-        return null;
-    }
-
-    @SuppressWarnings("unchecked")
-    private List<Object> getValueSet(Object expectedValue) {
-        if (expectedValue instanceof List) {
-            return (List<Object>) expectedValue;
-        } else if (expectedValue instanceof Collection) {
-            return new ArrayList<Object>((Collection<?>) expectedValue);
-        } else {
-            return Collections.singletonList(expectedValue);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/SourceEventPropertyConditionESQueryBuilder.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/SourceEventPropertyConditionESQueryBuilder.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/SourceEventPropertyConditionESQueryBuilder.java
deleted file mode 100644
index d178b89..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/SourceEventPropertyConditionESQueryBuilder.java
+++ /dev/null
@@ -1,55 +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.oasis_open.contextserver.plugins.baseplugin.conditions;
-
-import org.elasticsearch.index.query.FilterBuilder;
-import org.elasticsearch.index.query.FilterBuilders;
-import org.oasis_open.contextserver.api.conditions.Condition;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilder;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilderDispatcher;
-
-import java.lang.Object;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-public class SourceEventPropertyConditionESQueryBuilder implements 
ConditionESQueryBuilder {
-
-    public SourceEventPropertyConditionESQueryBuilder() {
-    }
-
-    private void appendFilderIfPropExist(List<FilterBuilder> filterBuilders, 
Condition condition, String prop){
-        final Object parameter = condition.getParameter(prop);
-        if (parameter != null && !"".equals(parameter)) {
-            filterBuilders.add(FilterBuilders.termFilter("source." + prop, 
(String) parameter));
-        }
-    }
-
-    public FilterBuilder buildFilter(Condition condition, Map<String, Object> 
context, ConditionESQueryBuilderDispatcher dispatcher) {
-        List<FilterBuilder> l = new ArrayList<FilterBuilder>();
-        for (String prop : new String[]{"id", "path", "scope", "type"}){
-            appendFilderIfPropExist(l, condition, prop);
-        }
-
-        if (l.size() >= 1) {
-            return l.size() == 1 ? l.get(0) : 
FilterBuilders.andFilter(l.toArray(new FilterBuilder[l.size()]));
-        } else {
-            return null;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/SourceEventPropertyConditionEvaluator.java
----------------------------------------------------------------------
diff --git 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/SourceEventPropertyConditionEvaluator.java
 
b/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/SourceEventPropertyConditionEvaluator.java
deleted file mode 100644
index 9b97877..0000000
--- 
a/plugins/baseplugin/src/main/java/org/oasis_open/contextserver/plugins/baseplugin/conditions/SourceEventPropertyConditionEvaluator.java
+++ /dev/null
@@ -1,81 +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.oasis_open.contextserver.plugins.baseplugin.conditions;
-
-import org.oasis_open.contextserver.api.Item;
-import org.oasis_open.contextserver.api.conditions.Condition;
-import org.oasis_open.contextserver.api.conditions.ConditionType;
-import org.oasis_open.contextserver.api.services.DefinitionsService;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionEvaluator;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionEvaluatorDispatcher;
-
-import java.lang.Object;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class SourceEventPropertyConditionEvaluator implements 
ConditionEvaluator {
-    private static final Map<String,String> MAPPED_PROPERTIES;
-    static {
-        MAPPED_PROPERTIES = new HashMap<>(4);
-        MAPPED_PROPERTIES.put("id", "itemId");
-        MAPPED_PROPERTIES.put("path", "properties.pageInfo.pagePath");
-        MAPPED_PROPERTIES.put("type", "itemType");
-        MAPPED_PROPERTIES.put("scope", "scope");
-    }
-
-    private DefinitionsService definitionsService;
-
-    private void appendConditionIfPropExist(List<Condition> conditions, 
Condition condition, String prop, ConditionType propConditionType) {
-        final Object parameter = condition.getParameter(prop);
-        if (parameter != null && !"".equals(parameter)) {
-            Condition propCondition = new Condition(propConditionType);
-            propCondition.setParameter("comparisonOperator", "equals");
-            
propCondition.setParameter("propertyName",MAPPED_PROPERTIES.get(prop));
-            propCondition.setParameter("propertyValue", parameter);
-            conditions.add(propCondition);
-        }
-    }
-
-    @Override
-    public boolean eval(Condition condition, Item item, Map<String, Object> 
context, ConditionEvaluatorDispatcher dispatcher) {
-        Condition andCondition = new 
Condition(definitionsService.getConditionType("booleanCondition"));
-        andCondition.setParameter("operator", "and");
-        ArrayList<Condition> conditions = new ArrayList<Condition>();
-
-        for (String prop : MAPPED_PROPERTIES.keySet()){
-            appendConditionIfPropExist(conditions, condition, prop, 
definitionsService.getConditionType("eventPropertyCondition"));
-        }
-
-        if(conditions.size() > 0){
-            andCondition.setParameter("subConditions", conditions);
-            return dispatcher.eval(andCondition, item);
-        } else {
-            return true;
-        }
-    }
-
-    public DefinitionsService getDefinitionsService() {
-        return definitionsService;
-    }
-
-    public void setDefinitionsService(DefinitionsService definitionsService) {
-        this.definitionsService = definitionsService;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/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 2bbe84c..44e4c4e 100644
--- a/plugins/baseplugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/plugins/baseplugin/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -16,69 +16,69 @@
   ~ limitations under the License.
   -->
 
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+<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="definitionsService" 
interface="org.oasis_open.contextserver.api.services.DefinitionsService"/>
-    <reference id="persistenceService" 
interface="org.oasis_open.contextserver.persistence.spi.PersistenceService"/>
-    <reference id="profileService" 
interface="org.oasis_open.contextserver.api.services.ProfileService"/>
-    <reference id="segmentService" 
interface="org.oasis_open.contextserver.api.services.SegmentService"/>
-    <reference id="eventService" 
interface="org.oasis_open.contextserver.api.services.EventService"/>
+    <reference id="definitionsService" 
interface="org.apache.unomi.api.services.DefinitionsService"/>
+    <reference id="persistenceService" 
interface="org.apache.unomi.persistence.spi.PersistenceService"/>
+    <reference id="profileService" 
interface="org.apache.unomi.api.services.ProfileService"/>
+    <reference id="segmentService" 
interface="org.apache.unomi.api.services.SegmentService"/>
+    <reference id="eventService" 
interface="org.apache.unomi.api.services.EventService"/>
 
     <service
-            
interface="org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilder">
+            
interface="org.apache.unomi.persistence.elasticsearch.conditions.ConditionESQueryBuilder">
         <service-properties>
             <entry key="queryBuilderId" 
value="booleanConditionESQueryBuilder"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.conditions.BooleanConditionESQueryBuilder"/>
+        <bean 
class="org.apache.unomi.plugins.baseplugin.conditions.BooleanConditionESQueryBuilder"/>
     </service>
 
     <service
-            
interface="org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilder">
+            
interface="org.apache.unomi.persistence.elasticsearch.conditions.ConditionESQueryBuilder">
         <service-properties>
             <entry key="queryBuilderId" value="notConditionESQueryBuilder"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.conditions.NotConditionESQueryBuilder"/>
+        <bean 
class="org.apache.unomi.plugins.baseplugin.conditions.NotConditionESQueryBuilder"/>
     </service>
 
     <service
-            
interface="org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilder">
+            
interface="org.apache.unomi.persistence.elasticsearch.conditions.ConditionESQueryBuilder">
         <service-properties>
             <entry key="queryBuilderId" 
value="matchAllConditionESQueryBuilder"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.conditions.MatchAllConditionESQueryBuilder"/>
+        <bean 
class="org.apache.unomi.plugins.baseplugin.conditions.MatchAllConditionESQueryBuilder"/>
     </service>
 
     <service
-            
interface="org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilder">
+            
interface="org.apache.unomi.persistence.elasticsearch.conditions.ConditionESQueryBuilder">
         <service-properties>
             <entry key="queryBuilderId" 
value="propertyConditionESQueryBuilder"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.conditions.PropertyConditionESQueryBuilder"/>
+        <bean 
class="org.apache.unomi.plugins.baseplugin.conditions.PropertyConditionESQueryBuilder"/>
     </service>
 
     <service
-            
interface="org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilder">
+            
interface="org.apache.unomi.persistence.elasticsearch.conditions.ConditionESQueryBuilder">
         <service-properties>
             <entry key="queryBuilderId" 
value="geoLocationByPointSessionConditionESQueryBuilder"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.conditions.GeoLocationByPointSessionConditionESQueryBuilder"/>
+        <bean 
class="org.apache.unomi.plugins.baseplugin.conditions.GeoLocationByPointSessionConditionESQueryBuilder"/>
     </service>
 
     <service
-            
interface="org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilder">
+            
interface="org.apache.unomi.persistence.elasticsearch.conditions.ConditionESQueryBuilder">
         <service-properties>
             <entry key="queryBuilderId" 
value="sourceEventPropertyConditionESQueryBuilder"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.conditions.SourceEventPropertyConditionESQueryBuilder"/>
+        <bean 
class="org.apache.unomi.plugins.baseplugin.conditions.SourceEventPropertyConditionESQueryBuilder"/>
     </service>
 
     <service
-            
interface="org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilder">
+            
interface="org.apache.unomi.persistence.elasticsearch.conditions.ConditionESQueryBuilder">
         <service-properties>
             <entry key="queryBuilderId" 
value="pastEventConditionESQueryBuilder"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.conditions.PastEventConditionESQueryBuilder">
+        <bean 
class="org.apache.unomi.plugins.baseplugin.conditions.PastEventConditionESQueryBuilder">
             <property name="definitionsService" ref="definitionsService"/>
             <property name="persistenceService" ref="persistenceService"/>
         </bean>
@@ -86,56 +86,56 @@
 
 
     <!-- Condition evaluators -->
-    <service 
interface="org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionEvaluator">
+    <service 
interface="org.apache.unomi.persistence.elasticsearch.conditions.ConditionEvaluator">
         <service-properties>
             <entry key="conditionEvaluatorId" 
value="booleanConditionEvaluator"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.conditions.BooleanConditionEvaluator"/>
+        <bean 
class="org.apache.unomi.plugins.baseplugin.conditions.BooleanConditionEvaluator"/>
     </service>
 
-    <service 
interface="org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionEvaluator">
+    <service 
interface="org.apache.unomi.persistence.elasticsearch.conditions.ConditionEvaluator">
         <service-properties>
             <entry key="conditionEvaluatorId" value="notConditionEvaluator"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.conditions.NotConditionEvaluator"/>
+        <bean 
class="org.apache.unomi.plugins.baseplugin.conditions.NotConditionEvaluator"/>
     </service>
 
-    <service 
interface="org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionEvaluator">
+    <service 
interface="org.apache.unomi.persistence.elasticsearch.conditions.ConditionEvaluator">
         <service-properties>
             <entry key="conditionEvaluatorId" 
value="propertyConditionEvaluator"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.conditions.PropertyConditionEvaluator"/>
+        <bean 
class="org.apache.unomi.plugins.baseplugin.conditions.PropertyConditionEvaluator"/>
     </service>
 
-    <service 
interface="org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionEvaluator">
+    <service 
interface="org.apache.unomi.persistence.elasticsearch.conditions.ConditionEvaluator">
         <service-properties>
             <entry key="conditionEvaluatorId" 
value="matchAllConditionEvaluator"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.conditions.MatchAllConditionEvaluator"/>
+        <bean 
class="org.apache.unomi.plugins.baseplugin.conditions.MatchAllConditionEvaluator"/>
     </service>
 
-    <service 
interface="org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionEvaluator">
+    <service 
interface="org.apache.unomi.persistence.elasticsearch.conditions.ConditionEvaluator">
         <service-properties>
             <entry key="conditionEvaluatorId" 
value="geoLocationByPointSessionConditionEvaluator"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.conditions.GeoLocationByPointSessionConditionEvaluator"/>
+        <bean 
class="org.apache.unomi.plugins.baseplugin.conditions.GeoLocationByPointSessionConditionEvaluator"/>
     </service>
 
-    <service 
interface="org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionEvaluator">
+    <service 
interface="org.apache.unomi.persistence.elasticsearch.conditions.ConditionEvaluator">
         <service-properties>
             <entry key="conditionEvaluatorId" 
value="sourceEventPropertyConditionEvaluator"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.conditions.SourceEventPropertyConditionEvaluator">
+        <bean 
class="org.apache.unomi.plugins.baseplugin.conditions.SourceEventPropertyConditionEvaluator">
             <property name="definitionsService" ref="definitionsService"/>
         </bean>
     </service>
 
     <service
-            
interface="org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionEvaluator">
+            
interface="org.apache.unomi.persistence.elasticsearch.conditions.ConditionEvaluator">
         <service-properties>
             <entry key="conditionEvaluatorId" 
value="pastEventConditionEvaluator"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.conditions.PastEventConditionEvaluator">
+        <bean 
class="org.apache.unomi.plugins.baseplugin.conditions.PastEventConditionEvaluator">
             <property name="definitionsService" ref="definitionsService"/>
             <property name="persistenceService" ref="persistenceService"/>
         </bean>
@@ -147,7 +147,7 @@
         <service-properties>
             <entry key="actionExecutorId" value="allEventToProfileProperties"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.actions.AllEventToProfilePropertiesAction">
+        <bean 
class="org.apache.unomi.plugins.baseplugin.actions.AllEventToProfilePropertiesAction">
             <property name="profileService" ref="profileService"/>
         </bean>
     </service>
@@ -156,21 +156,21 @@
         <service-properties>
             <entry key="actionExecutorId" value="eventToProfileProperty"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.actions.EventToProfilePropertyAction"/>
+        <bean 
class="org.apache.unomi.plugins.baseplugin.actions.EventToProfilePropertyAction"/>
     </service>
 
     <service auto-export="interfaces">
         <service-properties>
             <entry key="actionExecutorId" value="setProperty"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.actions.SetPropertyAction"/>
+        <bean 
class="org.apache.unomi.plugins.baseplugin.actions.SetPropertyAction"/>
     </service>
 
     <service auto-export="interfaces">
         <service-properties>
             <entry key="actionExecutorId" value="evaluateProfileSegments"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.actions.EvaluateProfileSegmentsAction">
+        <bean 
class="org.apache.unomi.plugins.baseplugin.actions.EvaluateProfileSegmentsAction">
             <property name="segmentService" ref="segmentService"/>
         </bean>
     </service>
@@ -179,21 +179,21 @@
         <service-properties>
             <entry key="actionExecutorId" value="evaluateProfileAge"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.actions.EvaluateProfileAgeAction"/>
+        <bean 
class="org.apache.unomi.plugins.baseplugin.actions.EvaluateProfileAgeAction"/>
     </service>
 
     <service auto-export="interfaces">
         <service-properties>
             <entry key="actionExecutorId" value="incrementInterestsValues"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.actions.IncrementInterestsValuesAction"/>
+        <bean 
class="org.apache.unomi.plugins.baseplugin.actions.IncrementInterestsValuesAction"/>
     </service>
 
     <service auto-export="interfaces">
         <service-properties>
             <entry key="actionExecutorId" value="setEventOccurenceCount"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.actions.SetEventOccurenceCountAction">
+        <bean 
class="org.apache.unomi.plugins.baseplugin.actions.SetEventOccurenceCountAction">
             <property name="definitionsService" ref="definitionsService"/>
             <property name="persistenceService" ref="persistenceService"/>
         </bean>
@@ -203,7 +203,7 @@
         <service-properties>
             <entry key="actionExecutorId" value="sendEvent"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.actions.SendEventAction">
+        <bean 
class="org.apache.unomi.plugins.baseplugin.actions.SendEventAction">
             <property name="eventService" ref="eventService"/>
         </bean>
     </service>
@@ -212,7 +212,7 @@
         <service-properties>
             <entry key="actionExecutorId" value="mergeProfilesOnProperty"/>
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.baseplugin.actions.MergeProfilesOnPropertyAction">
+        <bean 
class="org.apache.unomi.plugins.baseplugin.actions.MergeProfilesOnPropertyAction">
             <property name="profileService" ref="profileService"/>
             <property name="eventService" ref="eventService"/>
             <property name="persistenceService" ref="persistenceService"/>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/hover-event/src/main/java/org/apache/unomi/plugins/events/hover/querybuilders/HoverEventConditionESQueryBuilder.java
----------------------------------------------------------------------
diff --git 
a/plugins/hover-event/src/main/java/org/apache/unomi/plugins/events/hover/querybuilders/HoverEventConditionESQueryBuilder.java
 
b/plugins/hover-event/src/main/java/org/apache/unomi/plugins/events/hover/querybuilders/HoverEventConditionESQueryBuilder.java
new file mode 100644
index 0000000..201b834
--- /dev/null
+++ 
b/plugins/hover-event/src/main/java/org/apache/unomi/plugins/events/hover/querybuilders/HoverEventConditionESQueryBuilder.java
@@ -0,0 +1,53 @@
+/*
+ * 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.plugins.events.hover.querybuilders;
+
+import org.apache.unomi.api.conditions.Condition;
+import 
org.apache.unomi.persistence.elasticsearch.conditions.ConditionESQueryBuilder;
+import 
org.apache.unomi.persistence.elasticsearch.conditions.ConditionESQueryBuilderDispatcher;
+import org.elasticsearch.index.query.FilterBuilder;
+import org.elasticsearch.index.query.FilterBuilders;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Condition builder for hover event types
+ */
+public class HoverEventConditionESQueryBuilder implements 
ConditionESQueryBuilder {
+
+    public HoverEventConditionESQueryBuilder() {
+    }
+
+    public FilterBuilder buildFilter(Condition condition, Map<String, Object> 
context, ConditionESQueryBuilderDispatcher dispatcher) {
+        List<FilterBuilder> filters = new ArrayList<FilterBuilder>();
+        filters.add(FilterBuilders.termFilter("eventType", "hover"));
+        String targetId = (String) condition.getParameter("targetId");
+        String targetPath = (String) condition.getParameter("targetPath");
+
+        if (targetId != null && targetId.trim().length() > 0) {
+            filters.add(FilterBuilders.termFilter("target.itemId", targetId));
+        } else if (targetPath != null && targetPath.trim().length() > 0) {
+            
filters.add(FilterBuilders.termFilter("target.properties.pageInfo.pagePath", 
targetPath));
+        } else {
+            filters.add(FilterBuilders.termFilter("target.itemId", ""));
+        }
+        return FilterBuilders.andFilter(filters.toArray(new 
FilterBuilder[filters.size()]));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/hover-event/src/main/java/org/oasis_open/contextserver/plugins/events/hover/querybuilders/HoverEventConditionESQueryBuilder.java
----------------------------------------------------------------------
diff --git 
a/plugins/hover-event/src/main/java/org/oasis_open/contextserver/plugins/events/hover/querybuilders/HoverEventConditionESQueryBuilder.java
 
b/plugins/hover-event/src/main/java/org/oasis_open/contextserver/plugins/events/hover/querybuilders/HoverEventConditionESQueryBuilder.java
deleted file mode 100644
index e5bad2b..0000000
--- 
a/plugins/hover-event/src/main/java/org/oasis_open/contextserver/plugins/events/hover/querybuilders/HoverEventConditionESQueryBuilder.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.oasis_open.contextserver.plugins.events.hover.querybuilders;
-
-/*
- * #%L
- * Context Server Plugin - Hover event support
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2014 - 2015 Jahia Solutions
- * %%
- * Licensed 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.
- * #L%
- */
-
-import org.elasticsearch.index.query.FilterBuilder;
-import org.elasticsearch.index.query.FilterBuilders;
-import org.oasis_open.contextserver.api.conditions.Condition;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilder;
-import 
org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilderDispatcher;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-public class HoverEventConditionESQueryBuilder implements 
ConditionESQueryBuilder {
-
-    public HoverEventConditionESQueryBuilder() {
-    }
-
-    public FilterBuilder buildFilter(Condition condition, Map<String, Object> 
context, ConditionESQueryBuilderDispatcher dispatcher) {
-        List<FilterBuilder> filters = new ArrayList<FilterBuilder>();
-        filters.add(FilterBuilders.termFilter("eventType", "hover"));
-        String targetId = (String) condition.getParameter("targetId");
-        String targetPath = (String) condition.getParameter("targetPath");
-
-        if (targetId != null && targetId.trim().length() > 0) {
-            filters.add(FilterBuilders.termFilter("target.itemId", targetId));
-        } else if (targetPath != null && targetPath.trim().length() > 0) {
-            
filters.add(FilterBuilders.termFilter("target.properties.pageInfo.pagePath", 
targetPath));
-        } else {
-            filters.add(FilterBuilders.termFilter("target.itemId", ""));
-        }
-        return FilterBuilders.andFilter(filters.toArray(new 
FilterBuilder[filters.size()]));
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/hover-event/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git 
a/plugins/hover-event/src/main/resources/OSGI-INF/blueprint/blueprint.xml 
b/plugins/hover-event/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 1ba87f6..69e03ac 100644
--- a/plugins/hover-event/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/plugins/hover-event/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -16,14 +16,14 @@
   ~ limitations under the License.
   -->
 
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+<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";>
 
-    <service 
interface="org.oasis_open.contextserver.persistence.elasticsearch.conditions.ConditionESQueryBuilder">
+    <service interface="ConditionESQueryBuilder">
         <service-properties>
             <entry key="queryBuilderId" 
value="hoverEventConditionESQueryBuilder" />
         </service-properties>
-        <bean 
class="org.oasis_open.contextserver.plugins.events.hover.querybuilders.HoverEventConditionESQueryBuilder"
 />
+        <bean 
class="org.apache.unomi.plugins.events.hover.querybuilders.HoverEventConditionESQueryBuilder"/>
     </service>
 
 </blueprint>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/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
new file mode 100644
index 0000000..af22211
--- /dev/null
+++ 
b/plugins/mail/src/main/java/org/apache/unomi/plugins/mail/actions/SendMailAction.java
@@ -0,0 +1,117 @@
+/*
+ * 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.plugins.mail.actions;
+
+import org.apache.commons.mail.DefaultAuthenticator;
+import org.apache.commons.mail.EmailException;
+import org.apache.commons.mail.HtmlEmail;
+import org.apache.commons.mail.ImageHtmlEmail;
+import org.apache.unomi.api.Event;
+import org.apache.unomi.api.actions.Action;
+import org.apache.unomi.api.actions.ActionExecutor;
+import org.apache.unomi.api.services.EventService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.stringtemplate.v4.ST;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+public class SendMailAction implements ActionExecutor {
+    private static final Logger logger = 
LoggerFactory.getLogger(SendMailAction.class.getName());
+
+    private String mailServerHostName;
+    private int mailServerPort;
+    private String mailServerUsername;
+    private String mailServerPassword;
+    private boolean mailServerSSLOnConnect = true;
+
+    public void setMailServerHostName(String mailServerHostName) {
+        this.mailServerHostName = mailServerHostName;
+    }
+
+    public void setMailServerPort(int mailServerPort) {
+        this.mailServerPort = mailServerPort;
+    }
+
+    public void setMailServerUsername(String mailServerUsername) {
+        this.mailServerUsername = mailServerUsername;
+    }
+
+    public void setMailServerPassword(String mailServerPassword) {
+        this.mailServerPassword = mailServerPassword;
+    }
+
+    public void setMailServerSSLOnConnect(boolean mailServerSSLOnConnect) {
+        this.mailServerSSLOnConnect = mailServerSSLOnConnect;
+    }
+
+    public int execute(Action action, Event event) {
+        String from = (String) action.getParameterValues().get("from");
+        String to = (String) action.getParameterValues().get("to");
+        String cc = (String) action.getParameterValues().get("cc");
+        String bcc = (String) action.getParameterValues().get("bcc");
+        String subject = (String) action.getParameterValues().get("subject");
+        String template = (String) action.getParameterValues().get("template");
+
+        ST stringTemplate = new ST(template);
+        stringTemplate.add("profile", event.getProfile());
+        stringTemplate.add("event", event);
+        // load your HTML email template
+        String htmlEmailTemplate = stringTemplate.render();
+
+        // define you base URL to resolve relative resource locations
+        try {
+            new URL("http://www.apache.org";);
+        } catch (MalformedURLException e) {
+            //
+        }
+
+        // create the email message
+        HtmlEmail email = new ImageHtmlEmail();
+        // email.setDataSourceResolver(new DataSourceResolverImpl(url));
+        email.setHostName(mailServerHostName);
+        email.setSmtpPort(mailServerPort);
+        email.setAuthenticator(new DefaultAuthenticator(mailServerUsername, 
mailServerPassword));
+        email.setSSLOnConnect(mailServerSSLOnConnect);
+        try {
+            email.addTo(to);
+            email.setFrom(from);
+            if (cc != null && cc.length() > 0) {
+                email.addCc(cc);
+            }
+            if (bcc != null && bcc.length() > 0) {
+                email.addBcc(bcc);
+            }
+            email.setSubject(subject);
+
+            // set the html message
+            email.setHtmlMsg(htmlEmailTemplate);
+
+            // set the alternative message
+            email.setTextMsg("Your email client does not support HTML 
messages");
+
+            // send the email
+            email.send();
+        } catch (EmailException e) {
+            logger.error("Cannot send mail",e);
+        }
+
+        return EventService.NO_CHANGE;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/mail/src/main/java/org/oasis_open/contextserver/plugins/mail/actions/SendMailAction.java
----------------------------------------------------------------------
diff --git 
a/plugins/mail/src/main/java/org/oasis_open/contextserver/plugins/mail/actions/SendMailAction.java
 
b/plugins/mail/src/main/java/org/oasis_open/contextserver/plugins/mail/actions/SendMailAction.java
deleted file mode 100644
index 042eb11..0000000
--- 
a/plugins/mail/src/main/java/org/oasis_open/contextserver/plugins/mail/actions/SendMailAction.java
+++ /dev/null
@@ -1,117 +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.oasis_open.contextserver.plugins.mail.actions;
-
-import org.apache.commons.mail.DefaultAuthenticator;
-import org.apache.commons.mail.EmailException;
-import org.apache.commons.mail.HtmlEmail;
-import org.apache.commons.mail.ImageHtmlEmail;
-import org.oasis_open.contextserver.api.Event;
-import org.oasis_open.contextserver.api.actions.Action;
-import org.oasis_open.contextserver.api.actions.ActionExecutor;
-import org.oasis_open.contextserver.api.services.EventService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.stringtemplate.v4.ST;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-public class SendMailAction implements ActionExecutor {
-    private static final Logger logger = 
LoggerFactory.getLogger(SendMailAction.class.getName());
-
-    private String mailServerHostName;
-    private int mailServerPort;
-    private String mailServerUsername;
-    private String mailServerPassword;
-    private boolean mailServerSSLOnConnect = true;
-
-    public void setMailServerHostName(String mailServerHostName) {
-        this.mailServerHostName = mailServerHostName;
-    }
-
-    public void setMailServerPort(int mailServerPort) {
-        this.mailServerPort = mailServerPort;
-    }
-
-    public void setMailServerUsername(String mailServerUsername) {
-        this.mailServerUsername = mailServerUsername;
-    }
-
-    public void setMailServerPassword(String mailServerPassword) {
-        this.mailServerPassword = mailServerPassword;
-    }
-
-    public void setMailServerSSLOnConnect(boolean mailServerSSLOnConnect) {
-        this.mailServerSSLOnConnect = mailServerSSLOnConnect;
-    }
-
-    public int execute(Action action, Event event) {
-        String from = (String) action.getParameterValues().get("from");
-        String to = (String) action.getParameterValues().get("to");
-        String cc = (String) action.getParameterValues().get("cc");
-        String bcc = (String) action.getParameterValues().get("bcc");
-        String subject = (String) action.getParameterValues().get("subject");
-        String template = (String) action.getParameterValues().get("template");
-
-        ST stringTemplate = new ST(template);
-        stringTemplate.add("profile", event.getProfile());
-        stringTemplate.add("event", event);
-        // load your HTML email template
-        String htmlEmailTemplate = stringTemplate.render();
-
-        // define you base URL to resolve relative resource locations
-        try {
-            new URL("http://www.apache.org";);
-        } catch (MalformedURLException e) {
-            //
-        }
-
-        // create the email message
-        HtmlEmail email = new ImageHtmlEmail();
-        // email.setDataSourceResolver(new DataSourceResolverImpl(url));
-        email.setHostName(mailServerHostName);
-        email.setSmtpPort(mailServerPort);
-        email.setAuthenticator(new DefaultAuthenticator(mailServerUsername, 
mailServerPassword));
-        email.setSSLOnConnect(mailServerSSLOnConnect);
-        try {
-            email.addTo(to);
-            email.setFrom(from);
-            if (cc != null && cc.length() > 0) {
-                email.addCc(cc);
-            }
-            if (bcc != null && bcc.length() > 0) {
-                email.addBcc(bcc);
-            }
-            email.setSubject(subject);
-
-            // set the html message
-            email.setHtmlMsg(htmlEmailTemplate);
-
-            // set the alternative message
-            email.setTextMsg("Your email client does not support HTML 
messages");
-
-            // send the email
-            email.send();
-        } catch (EmailException e) {
-            logger.error("Cannot send mail",e);
-        }
-
-        return EventService.NO_CHANGE;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/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 ee6a685..0cbde8d 100644
--- a/plugins/mail/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/plugins/mail/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -21,7 +21,7 @@
            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";>
 
-    <cm:property-placeholder 
persistent-id="org.oasis_open.contextserver.plugins.mail"
+    <cm:property-placeholder persistent-id="org.apache.unomi.plugins.mail"
                              update-strategy="reload">
         <cm:default-properties>
             <cm:property name="mail.server.hostname" value="smtp.gmail.com"/>
@@ -34,7 +34,7 @@
 
     <!-- Action executors -->
 
-    <bean id="sendMailActionImpl" 
class="org.oasis_open.contextserver.plugins.mail.actions.SendMailAction">
+    <bean id="sendMailActionImpl" 
class="org.apache.unomi.plugins.mail.actions.SendMailAction">
         <property name="mailServerHostName" value="${mail.server.hostname}"/>
         <property name="mailServerPort" value="${mail.server.port}"/>
         <property name="mailServerUsername" value="${mail.server.username}"/>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/mail/src/main/resources/OSGI-INF/metatype/metatype.xml
----------------------------------------------------------------------
diff --git a/plugins/mail/src/main/resources/OSGI-INF/metatype/metatype.xml 
b/plugins/mail/src/main/resources/OSGI-INF/metatype/metatype.xml
index 65f55eb..5544c8a 100644
--- a/plugins/mail/src/main/resources/OSGI-INF/metatype/metatype.xml
+++ b/plugins/mail/src/main/resources/OSGI-INF/metatype/metatype.xml
@@ -18,7 +18,7 @@
 
 <metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0"; 
localization="OSGI-INF/metatype/metatype">
 
-    <OCD description="FileInstaller" 
name="org.oasis_open.contextserver.plugins.mail" 
id="org.oasis_open.contextserver.plugins.mail">
+    <OCD description="FileInstaller" name="org.apache.unomi.plugins.mail" 
id="org.apache.unomi.plugins.mail">
 
         <AD name="%mail.server.hostname.name" 
description="%mail.server.hostname.description" id="mail.server.hostname" 
required="true" type="String" default="smtp.gmail.com"/>
         <AD name="%mail.server.port.name" 
description="%mail.server.port.description" id="mail.server.port" 
required="true" type="Integer" default="425"/>
@@ -28,8 +28,8 @@
 
     </OCD>
 
-    <Designate pid="org.oasis_open.contextserver.plugins.mail">
-        <Object ocdref="org.oasis_open.contextserver.plugins.mail"/>
+    <Designate pid="org.apache.unomi.plugins.mail">
+        <Object ocdref="org.apache.unomi.plugins.mail"/>
     </Designate>
 
 </metatype:MetaData>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/past-event/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git 
a/plugins/past-event/src/main/resources/OSGI-INF/blueprint/blueprint.xml 
b/plugins/past-event/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 5d3f3cd..1475ab0 100644
--- a/plugins/past-event/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/plugins/past-event/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -16,11 +16,11 @@
   ~ limitations under the License.
   -->
 
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+<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="definitionsService" 
interface="org.oasis_open.contextserver.api.services.DefinitionsService"/>
-    <reference id="persistenceService" 
interface="org.oasis_open.contextserver.persistence.spi.PersistenceService"/>
+  <reference id="definitionsService" 
interface="org.apache.unomi.api.services.DefinitionsService"/>
+  <reference id="persistenceService" interface="PersistenceService"/>
 
 
 </blueprint>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/pom.xml b/plugins/pom.xml
index 663618f..469d739 100644
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -15,7 +15,8 @@
   ~ 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:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns="http://maven.apache.org/POM/4.0.0";
+         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>
@@ -34,6 +35,9 @@
         <module>request</module>
         <module>mail</module>
         <module>optimization-test</module>
+        <module>hover-event</module>
+        <module>past-event</module>
+        <module>tracked-event</module>
     </modules>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/request/src/main/java/org/apache/unomi/plugins/request/actions/RequestHeaderToProfilePropertyAction.java
----------------------------------------------------------------------
diff --git 
a/plugins/request/src/main/java/org/apache/unomi/plugins/request/actions/RequestHeaderToProfilePropertyAction.java
 
b/plugins/request/src/main/java/org/apache/unomi/plugins/request/actions/RequestHeaderToProfilePropertyAction.java
new file mode 100644
index 0000000..ec6c5e9
--- /dev/null
+++ 
b/plugins/request/src/main/java/org/apache/unomi/plugins/request/actions/RequestHeaderToProfilePropertyAction.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.plugins.request.actions;
+
+import org.apache.unomi.api.Event;
+import org.apache.unomi.api.actions.Action;
+import org.apache.unomi.api.actions.ActionExecutor;
+import org.apache.unomi.api.services.EventService;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * Copies a request header value to a profile property
+ *
+ * @todo add support for multi-valued parameters or storing values as a list
+ */
+public class RequestHeaderToProfilePropertyAction implements ActionExecutor {
+    public int execute(Action action, Event event) {
+        boolean changed = false;
+        HttpServletRequest httpServletRequest = (HttpServletRequest) 
event.getAttributes().get(Event.HTTP_REQUEST_ATTRIBUTE);
+        if (httpServletRequest == null) {
+            return EventService.NO_CHANGE;
+        }
+        String requestHeaderName = (String) 
action.getParameterValues().get("requestHeaderName");
+        String profilePropertyName = (String) 
action.getParameterValues().get("profilePropertyName");
+        String sessionPropertyName = (String) 
action.getParameterValues().get("sessionPropertyName");
+        String requestHeaderValue = 
httpServletRequest.getHeader(requestHeaderName);
+        if (requestHeaderValue != null) {
+            if (profilePropertyName != null) {
+                if (event.getProfile().getProperty(profilePropertyName) == 
null || 
!event.getProfile().getProperty(profilePropertyName).equals(requestHeaderValue))
 {
+                    event.getProfile().setProperty(profilePropertyName, 
requestHeaderValue);
+                    return EventService.PROFILE_UPDATED;
+                }
+            } else if (sessionPropertyName != null) {
+                if (event.getSession().getProperty(sessionPropertyName) == 
null || 
!event.getSession().getProperty(sessionPropertyName).equals(requestHeaderValue))
 {
+                    event.getSession().setProperty(sessionPropertyName, 
requestHeaderValue);
+                    return EventService.SESSION_UPDATED;
+                }
+            }
+        }
+        return EventService.NO_CHANGE;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/request/src/main/java/org/apache/unomi/plugins/request/actions/RequestParameterToProfilePropertyAction.java
----------------------------------------------------------------------
diff --git 
a/plugins/request/src/main/java/org/apache/unomi/plugins/request/actions/RequestParameterToProfilePropertyAction.java
 
b/plugins/request/src/main/java/org/apache/unomi/plugins/request/actions/RequestParameterToProfilePropertyAction.java
new file mode 100644
index 0000000..74f72d4
--- /dev/null
+++ 
b/plugins/request/src/main/java/org/apache/unomi/plugins/request/actions/RequestParameterToProfilePropertyAction.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.plugins.request.actions;
+
+import org.apache.unomi.api.Event;
+import org.apache.unomi.api.actions.Action;
+import org.apache.unomi.api.actions.ActionExecutor;
+import org.apache.unomi.api.services.EventService;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * Copies a request parameter to a profile property
+ *
+ * @todo add support for multi-valued parameters or storing values as a list
+ */
+public class RequestParameterToProfilePropertyAction implements ActionExecutor 
{
+    public int execute(Action action, Event event) {
+        boolean changed = false;
+        HttpServletRequest httpServletRequest = (HttpServletRequest) 
event.getAttributes().get(Event.HTTP_REQUEST_ATTRIBUTE);
+        if (httpServletRequest == null) {
+            return EventService.NO_CHANGE;
+        }
+        String requestParameterName = (String) 
action.getParameterValues().get("requestParameterName");
+        String profilePropertyName = (String) 
action.getParameterValues().get("profilePropertyName");
+        String sessionPropertyName = (String) 
action.getParameterValues().get("sessionPropertyName");
+        String requestParameterValue = 
httpServletRequest.getParameter(requestParameterName);
+        if (requestParameterValue != null) {
+            if (profilePropertyName != null) {
+                if (event.getProfile().getProperty(profilePropertyName) == 
null || 
!event.getProfile().getProperty(profilePropertyName).equals(requestParameterValue))
 {
+                    event.getProfile().setProperty(profilePropertyName, 
requestParameterValue);
+                    return EventService.PROFILE_UPDATED;
+                }
+            } else if (sessionPropertyName != null) {
+                if (event.getSession().getProperty(sessionPropertyName) == 
null || 
!event.getSession().getProperty(sessionPropertyName).equals(requestParameterValue))
 {
+                    event.getSession().setProperty(sessionPropertyName, 
requestParameterValue);
+                    return EventService.SESSION_UPDATED;
+                }
+            }
+        }
+        return EventService.NO_CHANGE;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/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
new file mode 100644
index 0000000..90e7702
--- /dev/null
+++ 
b/plugins/request/src/main/java/org/apache/unomi/plugins/request/actions/SetRemoteHostInfoAction.java
@@ -0,0 +1,181 @@
+/*
+ * 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.plugins.request.actions;
+
+import com.maxmind.geoip2.DatabaseReader;
+import com.maxmind.geoip2.exception.GeoIp2Exception;
+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.unomi.api.Event;
+import org.apache.unomi.api.Session;
+import org.apache.unomi.api.actions.Action;
+import org.apache.unomi.api.actions.ActionExecutor;
+import org.apache.unomi.api.services.EventService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.annotation.PostConstruct;
+import javax.servlet.http.HttpServletRequest;
+import java.io.File;
+import java.io.IOException;
+import java.net.InetAddress;
+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;
+
+    public void setPathToGeoLocationDatabase(String pathToGeoLocationDatabase) 
{
+        this.pathToGeoLocationDatabase = pathToGeoLocationDatabase;
+    }
+
+    @Override
+    public int execute(Action action, Event event) {
+        HttpServletRequest httpServletRequest = (HttpServletRequest) 
event.getAttributes().get(Event.HTTP_REQUEST_ATTRIBUTE);
+        if (httpServletRequest == null) {
+            return EventService.NO_CHANGE;
+        }
+        Session session = event.getSession();
+        if (session == null) {
+            return EventService.NO_CHANGE;
+        }
+
+        String remoteAddr = httpServletRequest.getRemoteAddr();
+        String remoteAddrParameter = 
httpServletRequest.getParameter("remoteAddr");
+        String xff = httpServletRequest.getHeader("X-Forwarded-For");
+        if (remoteAddrParameter != null && remoteAddrParameter.length() > 0) {
+            remoteAddr = remoteAddrParameter;
+        } else if (xff != null && !xff.equals("")) {
+            if (xff.indexOf(',') > -1) {
+                xff = xff.substring(0, xff.indexOf(','));
+            }
+            remoteAddr = xff;
+        }
+
+        session.setProperty("remoteAddr", remoteAddr);
+        session.setProperty("remoteHost", httpServletRequest.getRemoteHost());
+        try {
+            if (!remoteAddr.equals("127.0.0.1") && 
IPV4.matcher(remoteAddr).matches()) {
+                ipLookup(remoteAddr, session);
+            } else {
+                session.setProperty("sessionCountryCode", "CH");
+                session.setProperty("sessionCountryName", "Switzerland");
+                session.setProperty("sessionCity", "Geneva");
+                session.setProperty("sessionAdminSubDiv1", "GE");
+                session.setProperty("sessionAdminSubDiv2", "2500");
+                session.setProperty("sessionIsp", "Cablecom");
+                Map<String, Double> location = new HashMap<String, Double>();
+                location.put("lat", 46.1884341);
+                location.put("lon", 6.1282508);
+                session.setProperty("location", location);
+            }
+            session.setProperty("countryAndCity", 
session.getProperty("sessionCountryName") + "@@" + 
session.getProperty("sessionCity"));
+        } catch (Exception e) {
+            logger.error("Cannot lookup IP", e);
+        }
+
+        UserAgentStringParser parser = 
UADetectorServiceFactory.getResourceModuleParser();
+        ReadableUserAgent agent = 
parser.parse(httpServletRequest.getHeader("User-Agent"));
+        session.setProperty("operatingSystemFamily", 
agent.getOperatingSystem().getFamilyName());
+        session.setProperty("operatingSystemName", 
agent.getOperatingSystem().getName());
+        session.setProperty("userAgentName", agent.getName());
+        session.setProperty("userAgentVersion", 
agent.getVersionNumber().toVersionString());
+        session.setProperty("userAgentNameAndVersion", 
session.getProperty("userAgentName") + "@@" + 
session.getProperty("userAgentVersion"));
+        session.setProperty("deviceCategory", 
agent.getDeviceCategory().getName());
+
+        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
+        if (pathToGeoLocationDatabase == null) {
+            return;
+        }
+        File database = new File(pathToGeoLocationDatabase);
+        if (!database.exists()) {
+            return;
+        }
+
+        // This creates the DatabaseReader object, which should be reused 
across
+        // lookups.
+        try {
+            this.databaseReader = new DatabaseReader.Builder(database).build();
+        } catch (IOException e) {
+            logger.error("Cannot read IP database", e);
+        }
+
+    }
+
+    public 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));
+
+            if (cityResponse.getCountry().getName() != null) {
+                session.setProperty("sessionCountryCode", 
cityResponse.getCountry().getIsoCode());
+                session.setProperty("sessionCountryName", 
cityResponse.getCountry().getName());
+            }
+            if (cityResponse.getCity().getName() != null) {
+                session.setProperty("sessionCity", 
cityResponse.getCity().getName());
+                session.setProperty("sessionCityId", 
cityResponse.getCity().getGeoNameId());
+            }
+
+            if (cityResponse.getSubdivisions().size() > 0) {
+                session.setProperty("sessionAdminSubDiv1", 
cityResponse.getSubdivisions().get(0).getGeoNameId());
+            }
+            if (cityResponse.getSubdivisions().size() > 1) {
+                session.setProperty("sessionAdminSubDiv2", 
cityResponse.getSubdivisions().get(1).getGeoNameId());
+            }
+            String isp = 
databaseReader.isp(InetAddress.getByName(remoteAddr)).getIsp();
+            if (isp != null) {
+                session.setProperty("sessionIsp", isp);
+            }
+
+            Map<String, Double> locationMap = new HashMap<String, Double>();
+            if (cityResponse.getLocation().getLatitude() != null && 
cityResponse.getLocation().getLongitude() != null) {
+                locationMap.put("lat", 
cityResponse.getLocation().getLatitude());
+                locationMap.put("lon", 
cityResponse.getLocation().getLongitude());
+                session.setProperty("location", locationMap);
+            }
+            return true;
+        } catch (IOException | GeoIp2Exception e) {
+            logger.debug("Cannot resolve IP", e);
+        }
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/request/src/main/java/org/oasis_open/contextserver/plugins/request/actions/RequestHeaderToProfilePropertyAction.java
----------------------------------------------------------------------
diff --git 
a/plugins/request/src/main/java/org/oasis_open/contextserver/plugins/request/actions/RequestHeaderToProfilePropertyAction.java
 
b/plugins/request/src/main/java/org/oasis_open/contextserver/plugins/request/actions/RequestHeaderToProfilePropertyAction.java
deleted file mode 100644
index 7babb5a..0000000
--- 
a/plugins/request/src/main/java/org/oasis_open/contextserver/plugins/request/actions/RequestHeaderToProfilePropertyAction.java
+++ /dev/null
@@ -1,58 +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.oasis_open.contextserver.plugins.request.actions;
-
-import org.oasis_open.contextserver.api.Event;
-import org.oasis_open.contextserver.api.actions.Action;
-import org.oasis_open.contextserver.api.actions.ActionExecutor;
-import org.oasis_open.contextserver.api.services.EventService;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * Copies a request header value to a profile property
- *
- * @todo add support for multi-valued parameters or storing values as a list
- */
-public class RequestHeaderToProfilePropertyAction implements ActionExecutor {
-    public int execute(Action action, Event event) {
-        boolean changed = false;
-        HttpServletRequest httpServletRequest = (HttpServletRequest) 
event.getAttributes().get(Event.HTTP_REQUEST_ATTRIBUTE);
-        if (httpServletRequest == null) {
-            return EventService.NO_CHANGE;
-        }
-        String requestHeaderName = (String) 
action.getParameterValues().get("requestHeaderName");
-        String profilePropertyName = (String) 
action.getParameterValues().get("profilePropertyName");
-        String sessionPropertyName = (String) 
action.getParameterValues().get("sessionPropertyName");
-        String requestHeaderValue = 
httpServletRequest.getHeader(requestHeaderName);
-        if (requestHeaderValue != null) {
-            if (profilePropertyName != null) {
-                if (event.getProfile().getProperty(profilePropertyName) == 
null || 
!event.getProfile().getProperty(profilePropertyName).equals(requestHeaderValue))
 {
-                    event.getProfile().setProperty(profilePropertyName, 
requestHeaderValue);
-                    return EventService.PROFILE_UPDATED;
-                }
-            } else if (sessionPropertyName != null) {
-                if (event.getSession().getProperty(sessionPropertyName) == 
null || 
!event.getSession().getProperty(sessionPropertyName).equals(requestHeaderValue))
 {
-                    event.getSession().setProperty(sessionPropertyName, 
requestHeaderValue);
-                    return EventService.SESSION_UPDATED;
-                }
-            }
-        }
-        return EventService.NO_CHANGE;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dc1d1520/plugins/request/src/main/java/org/oasis_open/contextserver/plugins/request/actions/RequestParameterToProfilePropertyAction.java
----------------------------------------------------------------------
diff --git 
a/plugins/request/src/main/java/org/oasis_open/contextserver/plugins/request/actions/RequestParameterToProfilePropertyAction.java
 
b/plugins/request/src/main/java/org/oasis_open/contextserver/plugins/request/actions/RequestParameterToProfilePropertyAction.java
deleted file mode 100644
index c60143c..0000000
--- 
a/plugins/request/src/main/java/org/oasis_open/contextserver/plugins/request/actions/RequestParameterToProfilePropertyAction.java
+++ /dev/null
@@ -1,58 +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.oasis_open.contextserver.plugins.request.actions;
-
-import org.oasis_open.contextserver.api.Event;
-import org.oasis_open.contextserver.api.actions.Action;
-import org.oasis_open.contextserver.api.actions.ActionExecutor;
-import org.oasis_open.contextserver.api.services.EventService;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * Copies a request parameter to a profile property
- *
- * @todo add support for multi-valued parameters or storing values as a list
- */
-public class RequestParameterToProfilePropertyAction implements ActionExecutor 
{
-    public int execute(Action action, Event event) {
-        boolean changed = false;
-        HttpServletRequest httpServletRequest = (HttpServletRequest) 
event.getAttributes().get(Event.HTTP_REQUEST_ATTRIBUTE);
-        if (httpServletRequest == null) {
-            return EventService.NO_CHANGE;
-        }
-        String requestParameterName = (String) 
action.getParameterValues().get("requestParameterName");
-        String profilePropertyName = (String) 
action.getParameterValues().get("profilePropertyName");
-        String sessionPropertyName = (String) 
action.getParameterValues().get("sessionPropertyName");
-        String requestParameterValue = 
httpServletRequest.getParameter(requestParameterName);
-        if (requestParameterValue != null) {
-            if (profilePropertyName != null) {
-                if (event.getProfile().getProperty(profilePropertyName) == 
null || 
!event.getProfile().getProperty(profilePropertyName).equals(requestParameterValue))
 {
-                    event.getProfile().setProperty(profilePropertyName, 
requestParameterValue);
-                    return EventService.PROFILE_UPDATED;
-                }
-            } else if (sessionPropertyName != null) {
-                if (event.getSession().getProperty(sessionPropertyName) == 
null || 
!event.getSession().getProperty(sessionPropertyName).equals(requestParameterValue))
 {
-                    event.getSession().setProperty(sessionPropertyName, 
requestParameterValue);
-                    return EventService.SESSION_UPDATED;
-                }
-            }
-        }
-        return EventService.NO_CHANGE;
-    }
-}

Reply via email to