http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/event.json ---------------------------------------------------------------------- diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/event.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/event.json index 6089499..939120d 100644 --- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/event.json +++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/event.json @@ -4,9 +4,9 @@ { "all": { "match": "*", - "match_mapping_type": "string", + "match_mapping_type": "text", "mapping": { - "type": "string", + "type": "text", "analyzer": "folding" } } @@ -14,34 +14,325 @@ ], "properties": { "eventType": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "itemId": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "itemType": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "profileId": { - "type": "string", - "analyzer": "folding" + "type": "keyword" + }, + "properties": { + "properties": { + "src_terms[0]": { + "properties": { + "term": { + "type": "keyword" + } + } + } + } }, "scope": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "sessionId": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "timeStamp": { "type": "date", "format": "strict_date_optional_time||epoch_millis" + }, + "source": { + "properties": { + "eventType": { + "type": "keyword" + }, + "itemId": { + "type": "keyword" + }, + "itemType": { + "type": "keyword" + }, + "profileId": { + "type": "keyword" + }, + "properties": { + "properties": { + "pageInfo": { + "properties": { + "destinationURL": { + "type": "keyword" + }, + "language": { + "type": "keyword" + }, + "pageName": { + "type": "keyword" + }, + "pagePath": { + "type": "keyword" + }, + "referringURL": { + "type": "keyword" + }, + "variant": { + "type": "keyword" + } + } + } + } + }, + "scope": { + "type": "keyword" + }, + "sessionId": { + "type": "keyword" + }, + "source": { + "properties": { + "itemId": { + "type": "keyword" + }, + "itemType": { + "type": "keyword" + }, + "scope": { + "type": "keyword" + } + } + }, + "target": { + "properties": { + "itemId": { + "type": "keyword" + }, + "itemType": { + "type": "keyword" + }, + "properties": { + "properties": { + "pageInfo": { + "properties": { + "destinationURL": { + "type": "keyword" + }, + "language": { + "type": "keyword" + }, + "pageName": { + "type": "keyword" + }, + "pagePath": { + "type": "keyword" + }, + "referringURL": { + "type": "keyword" + }, + "variant": { + "type": "keyword" + } + } + } + } + }, + "scope": { + "type": "keyword" + } + } + }, + "timeStamp": { + "type": "date" + } + } + }, + "target": { + "properties": { + "campaignId": { + "type": "keyword" + }, + "duration": { + "type": "long" + }, + "itemId": { + "type": "keyword" + }, + "itemType": { + "type": "keyword" + }, + "metadata": { + "properties": { + "enabled": { + "type": "boolean" + }, + "hidden": { + "type": "boolean" + }, + "id": { + "type": "keyword" + }, + "missingPlugins": { + "type": "boolean" + }, + "name": { + "type": "keyword" + }, + "readOnly": { + "type": "boolean" + }, + "scope": { + "type": "keyword" + }, + "tags": { + "type": "text", + "analyzer": "folding", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + } + } + }, + "profile": { + "properties": { + "itemId": { + "type": "keyword" + }, + "itemType": { + "type": "keyword" + }, + "properties": { + "properties": { + "firstVisit": { + "type": "date" + } + } + } + } + }, + "profileId": { + "type": "keyword" + }, + "properties": { + "properties": { + "birthDate": { + "type": "date" + }, + "email": { + "type": "keyword" + }, + "faceBookId": { + "type": "keyword" + }, + "firstName": { + "type": "keyword" + }, + "gender": { + "type": "keyword" + }, + "goalId": { + "type": "keyword" + }, + "lastName": { + "type": "keyword" + }, + "leadAssignedTo": { + "type": "keyword" + }, + "nationality": { + "type": "keyword" + }, + "origin": { + "type": "keyword" + }, + "pageInfo": { + "properties": { + "destinationURL": { + "type": "keyword" + }, + "language": { + "type": "keyword" + }, + "pageName": { + "type": "keyword" + }, + "pagePath": { + "type": "keyword" + }, + "referringURL": { + "type": "keyword" + }, + "variant": { + "type": "keyword" + } + } + }, + "path": { + "type": "keyword" + }, + "phoneNumber": { + "type": "keyword" + }, + "randomNumber": { + "type": "long" + }, + "twitterId": { + "type": "keyword" + }, + "variantId": { + "type": "keyword" + }, + "workspace": { + "type": "keyword" + } + } + }, + "scope": { + "type": "keyword" + }, + "size": { + "type": "long" + }, + "startEvent": { + "properties": { + "parameterValues": { + "properties": { + "pagePath": { + "type": "keyword" + } + } + }, + "type": { + "type": "keyword" + } + } + }, + "targetEvent": { + "properties": { + "parameterValues": { + "properties": { + "pagePath": { + "type": "keyword" + } + } + }, + "type": { + "type": "keyword" + } + } + }, + "timeStamp": { + "type": "date" + } + } } } } } +
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/goal.json ---------------------------------------------------------------------- diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/goal.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/goal.json index 0fb7bcf..7290220 100644 --- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/goal.json +++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/goal.json @@ -4,9 +4,9 @@ { "all": { "match": "*", - "match_mapping_type": "string", + "match_mapping_type": "text", "mapping": { - "type": "string", + "type": "text", "analyzer": "folding" } } @@ -14,22 +14,19 @@ ], "properties": { "campaignId": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "itemId": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "itemType": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "metadata": { "properties": { "description": { - "type": "string", - "analyzer": "folding" + "type": "text", + "analyzer" : "folding" }, "enabled": { "type": "boolean" @@ -38,25 +35,22 @@ "type": "boolean" }, "id": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "missingPlugins": { "type": "boolean" }, "name": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "readOnly": { "type": "boolean" }, "scope": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "tags": { - "type": "string", + "type": "text", "analyzer": "folding" } } http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/persona.json ---------------------------------------------------------------------- diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/persona.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/persona.json index d04715f..db9828b 100644 --- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/persona.json +++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/persona.json @@ -4,13 +4,29 @@ { "all": { "match": "*", - "match_mapping_type": "string", + "match_mapping_type": "text", "mapping": { - "type": "string", + "type": "text", "analyzer": "folding" } } } - ] + ], + "properties" : { + "properties" : { + "properties": { + "description": { + "type": "text", + "analyzer": "folding" + }, + "firstName": { + "type": "keyword" + }, + "lastName": { + "type": "keyword" + } + } + } + } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/personaSession.json ---------------------------------------------------------------------- diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/personaSession.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/personaSession.json index 6ba12aa..c54a860 100644 --- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/personaSession.json +++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/personaSession.json @@ -4,27 +4,96 @@ { "all": { "match": "*", - "match_mapping_type": "string", + "match_mapping_type": "text", "mapping": { - "type": "string", + "type": "text", "analyzer": "folding" } } } ], "properties": { + "duration" : { + "type" : "long" + }, + "itemId" : { + "type" : "keyword" + }, + "itemType" : { + "type" : "keyword" + }, "timeStamp": { "type": "date" }, "lastEventDate": { "type": "date" }, - "properties": { - "properties": { - "location": { - "type": "geo_point" + "profile" : { + "properties" : { + "itemId" : { + "type" : "keyword" + }, + "itemType" : { + "type" : "keyword" + }, + "properties" : { + "properties" : { + "description" : { + "type" : "text", + "analyzer" : "folding" + }, + "firstName" : { + "type" : "keyword" + }, + "lastName" : { + "type" : "keyword" + } + } + } + } + }, + "profileId" : { + "type" : "keyword" + }, + "properties" : { + "properties" : { + "deviceCategory" : { + "type" : "keyword" + }, + "location" : { + "type" : "geo_point" + }, + "operatingSystemFamily" : { + "type" : "keyword" + }, + "operatingSystemName" : { + "type" : "keyword" + }, + "remoteAddr" : { + "type" : "keyword" + }, + "remoteHost" : { + "type" : "keyword" + }, + "sessionCity" : { + "type" : "keyword" + }, + "sessionCountryCode" : { + "type" : "keyword" + }, + "sessionCountryName" : { + "type" : "keyword" + }, + "userAgentName" : { + "type" : "keyword" + }, + "userAgentVersion" : { + "type" : "keyword" } } + }, + "size" : { + "type" : "long" } } } http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/profile.json ---------------------------------------------------------------------- diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/profile.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/profile.json index 4a20426..9aba5d0 100644 --- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/profile.json +++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/profile.json @@ -1,37 +1,53 @@ { "profile": { - "_all": { - "enabled": true - }, "dynamic_templates": [ { "all": { "match": "*", - "match_mapping_type": "string", + "match_mapping_type": "text", "mapping": { - "type": "string", - "analyzer": "folding", - "include_in_all": true + "type": "text", + "analyzer": "folding" } } } ], "properties": { "itemId": { - "type": "string", - "analyzer": "folding", - "include_in_all": true + "type": "keyword" }, "itemType": { - "type": "string", - "analyzer": "folding", - "include_in_all": true + "type": "keyword" }, "properties": { "properties": { + "j:nodename": { + "type": "keyword" + }, + "preferredLanguage": { + "type": "keyword" + }, "firstVisit": { "type": "date", "format": "strict_date_optional_time||epoch_millis" + }, + "lastVisit": { + "type": "date", + "format": "strict_date_optional_time||epoch_millis" + }, + "previousVisit": { + "type": "date", + "format": "strict_date_optional_time||epoch_millis" + }, + "nbOfVisits": { + "type": "long" + } + } + }, + "systemProperties" : { + "properties" : { + "mergeIdentifier" : { + "type" : "keyword" } } } http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/propertyType.json ---------------------------------------------------------------------- diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/propertyType.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/propertyType.json index 88a958e..c03111c 100644 --- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/propertyType.json +++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/propertyType.json @@ -4,9 +4,9 @@ { "all": { "match": "*", - "match_mapping_type": "string", + "match_mapping_type": "text", "mapping": { - "type": "string", + "type": "text", "analyzer": "folding" } } @@ -14,40 +14,32 @@ ], "properties": { "automaticMappingsFrom": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "dateRanges": { "properties": { "from": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "key": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "to": { - "type": "string", - "analyzer": "folding" + "type": "keyword" } } }, "defaultValue": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "itemId": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "itemType": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "mergeStrategy": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "metadata": { "properties": { @@ -58,15 +50,13 @@ "type": "boolean" }, "id": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "missingPlugins": { "type": "boolean" }, "name": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "readOnly": { "type": "boolean" @@ -82,8 +72,7 @@ "type": "double" }, "key": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "to": { "type": "double" @@ -97,16 +86,14 @@ "type": "double" }, "tags": { - "type": "string", + "type": "text", "analyzer": "folding" }, "target": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "type": { - "type": "string", - "analyzer": "folding" + "type": "keyword" } } } http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/rule.json ---------------------------------------------------------------------- diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/rule.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/rule.json index 67263cf..842181a 100644 --- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/rule.json +++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/rule.json @@ -4,9 +4,9 @@ { "all": { "match": "*", - "match_mapping_type": "string", + "match_mapping_type": "text", "mapping": { - "type": "string", + "type": "text", "analyzer": "folding" } } @@ -14,17 +14,15 @@ ], "properties": { "itemId": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "itemType": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "metadata": { "properties": { "description": { - "type": "string", + "type": "text", "analyzer": "folding" }, "enabled": { @@ -34,22 +32,19 @@ "type": "boolean" }, "id": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "missingPlugins": { "type": "boolean" }, "name": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "readOnly": { "type": "boolean" }, "scope": { - "type": "string", - "analyzer": "folding" + "type": "keyword" } } }, http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/scoring.json ---------------------------------------------------------------------- diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/scoring.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/scoring.json index b62d0a6..70b2f8d 100644 --- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/scoring.json +++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/scoring.json @@ -4,9 +4,9 @@ { "all": { "match": "*", - "match_mapping_type": "string", + "match_mapping_type": "text", "mapping": { - "type": "string", + "type": "text", "analyzer": "folding" } } @@ -14,17 +14,15 @@ ], "properties": { "itemId": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "itemType": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "metadata": { "properties": { "description": { - "type": "string", + "type": "text", "analyzer": "folding" }, "enabled": { @@ -34,26 +32,23 @@ "type": "boolean" }, "id": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "missingPlugins": { "type": "boolean" }, "name": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "readOnly": { "type": "boolean" }, "scope": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "tags": { - "type": "string", - "analyzer": "folding" + "type": "text", + "analyzer" : "folding" } } } http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/segment.json ---------------------------------------------------------------------- diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/segment.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/segment.json index c4527a5..2d25939 100644 --- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/segment.json +++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/segment.json @@ -4,9 +4,9 @@ { "all": { "match": "*", - "match_mapping_type": "string", + "match_mapping_type": "text", "mapping": { - "type": "string", + "type": "text", "analyzer": "folding" } } @@ -14,17 +14,15 @@ ], "properties": { "itemId": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "itemType": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "metadata": { "properties": { "description": { - "type": "string", + "type": "text", "analyzer": "folding" }, "enabled": { @@ -34,22 +32,19 @@ "type": "boolean" }, "id": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "missingPlugins": { "type": "boolean" }, "name": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "readOnly": { "type": "boolean" }, "scope": { - "type": "string", - "analyzer": "folding" + "type": "keyword" } } } http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/session.json ---------------------------------------------------------------------- diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/session.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/session.json index 2047b4e..b0f6215 100644 --- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/session.json +++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/session.json @@ -4,9 +4,9 @@ { "all": { "match": "*", - "match_mapping_type": "string", + "match_mapping_type": "text", "mapping": { - "type": "string", + "type": "text", "analyzer": "folding" } } @@ -17,38 +17,47 @@ "type": "long" }, "itemId": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "itemType": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "lastEventDate": { "type": "date", "format": "strict_date_optional_time||epoch_millis" }, "profileId": { - "type": "string", - "analyzer": "folding" + "type": "keyword" + }, + "profile": { + "properties": { + "itemId": { + "type": "keyword" + }, + "itemType": { + "type": "keyword" + } + } }, "properties": { "properties": { "location": { "type": "geo_point" + }, + "pageReferringURL": { + "type": "keyword" + }, + "referringURL": { + "type": "keyword" } } }, "scope": { - "type": "string", - "analyzer": "folding" + "type": "keyword" }, "size": { "type": "long" }, - "systemProperties": { - "type": "object" - }, "timeStamp": { "type": "date", "format": "strict_date_optional_time||epoch_millis" http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/persistence-elasticsearch/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml ---------------------------------------------------------------------- diff --git a/persistence-elasticsearch/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/persistence-elasticsearch/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml index 75039d8..23963ac 100644 --- a/persistence-elasticsearch/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml +++ b/persistence-elasticsearch/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -35,10 +35,6 @@ <cm:property name="elasticSearchConfig" value="file:${karaf.etc}/elasticsearch.yml"/> <cm:property name="monthlyIndex.numberOfShards" value="3"/> <cm:property name="monthlyIndex.numberOfReplicas" value="0"/> - <cm:property name="numberOfShards" value="5"/> - <cm:property name="numberOfReplicas" value="0"/> - <cm:property name="discovery.zen.ping.multicast.enabled" value="false"/> - <cm:property name="node.data" value="true"/> <cm:property name="defaultQueryLimit" value="10"/> <cm:property name="bulkProcessor.name" value="unomi-bulk" /> @@ -47,6 +43,11 @@ <cm:property name="bulkProcessor.bulkSize" value="5MB" /> <cm:property name="bulkProcessor.flushInterval" value="5s" /> <cm:property name="bulkProcessor.backoffPolicy" value="exponential" /> + + <cm:property name="cluster.group" value="default" /> + <cm:property name="cluster.jmxUsername" value="karaf" /> + <cm:property name="cluster.jmxPassword" value="karaf" /> + <cm:property name="cluster.jmxPort" value="1099" /> </cm:default-properties> </cm:property-placeholder> @@ -60,6 +61,11 @@ </cm:default-properties> </cm:property-placeholder> + <reference id="karafCellarClusterManager" interface="org.apache.karaf.cellar.core.ClusterManager" /> + <reference id="karafCellarEventProducer" interface="org.apache.karaf.cellar.core.event.EventProducer" /> + <reference id="karafCellarGroupManager" interface="org.apache.karaf.cellar.core.GroupManager" /> + <reference id="osgiConfigurationAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"/> + <service id="elasticSearchPersistenceService" ref="elasticSearchPersistenceServiceImpl"> <interfaces> <value>org.apache.unomi.persistence.spi.PersistenceService</value> @@ -88,10 +94,6 @@ <property name="indexName" value="${es.index.name}"/> <property name="monthlyIndexNumberOfShards" value="${es.monthlyIndex.numberOfShards}"/> <property name="monthlyIndexNumberOfReplicas" value="${es.monthlyIndex.numberOfReplicas}"/> - <property name="numberOfShards" value="${es.numberOfShards}"/> - <property name="numberOfReplicas" value="${es.numberOfReplicas}"/> - <property name="nodeData" value="${es.node.data}"/> - <property name="discoveryEnabled" value="${es.discovery.zen.ping.multicast.enabled}"/> <property name="address" value="${web.contextserver.address}"/> <property name="port" value="${web.contextserver.port}"/> <property name="secureAddress" value="${web.contextserver.secureAddress}"/> @@ -119,6 +121,14 @@ <property name="bulkProcessorBulkSize" value="${es.bulkProcessor.bulkSize}" /> <property name="bulkProcessorFlushInterval" value="${es.bulkProcessor.flushInterval}" /> <property name="bulkProcessorBackoffPolicy" value="${es.bulkProcessor.backoffPolicy}" /> + <property name="karafCellarClusterManager" ref="karafCellarClusterManager" /> + <property name="karafCellarEventProducer" ref="karafCellarEventProducer" /> + <property name="karafCellarGroupManager" ref="karafCellarGroupManager" /> + <property name="karafCellarGroupName" value="${es.cluster.group}" /> + <property name="osgiConfigurationAdmin" ref="osgiConfigurationAdmin" /> + <property name="karafJMXUsername" value="${es.cluster.jmxUsername}" /> + <property name="karafJMXPassword" value="${es.cluster.jmxPassword}" /> + <property name="karafJMXPort" value="${es.cluster.jmxPort}" /> </bean> </blueprint> http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/persistence-elasticsearch/core/src/main/resources/log4j2.xml ---------------------------------------------------------------------- diff --git a/persistence-elasticsearch/core/src/main/resources/log4j2.xml b/persistence-elasticsearch/core/src/main/resources/log4j2.xml new file mode 100644 index 0000000..ccafeef --- /dev/null +++ b/persistence-elasticsearch/core/src/main/resources/log4j2.xml @@ -0,0 +1,29 @@ +<?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. + --> +<Configuration status="WARN"> + <Appenders> + <Console name="Console" target="SYSTEM_OUT"> + <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/> + </Console> + </Appenders> + <Loggers> + <Root level="info"> + <AppenderRef ref="Console"/> + </Root> + </Loggers> +</Configuration> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg ---------------------------------------------------------------------- diff --git a/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg b/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg index 2b193f6..ddcbed5 100644 --- a/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg +++ b/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg @@ -35,4 +35,9 @@ bulkProcessor.concurrentRequests=1 bulkProcessor.bulkActions=1000 bulkProcessor.bulkSize=5MB bulkProcessor.flushInterval=5s -bulkProcessor.backoffPolicy=exponential \ No newline at end of file +bulkProcessor.backoffPolicy=exponential + +cluster.group=default +cluster.jmxUsername=karaf +cluster.jmxPassword=karaf +cluster.jmxPort=1099 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/persistence-elasticsearch/plugins/security/src/main/java/org/apache/unomi/elasticsearch/plugin/security/SecurityPlugin.java ---------------------------------------------------------------------- diff --git a/persistence-elasticsearch/plugins/security/src/main/java/org/apache/unomi/elasticsearch/plugin/security/SecurityPlugin.java b/persistence-elasticsearch/plugins/security/src/main/java/org/apache/unomi/elasticsearch/plugin/security/SecurityPlugin.java index 79fc7d3..b293527 100644 --- a/persistence-elasticsearch/plugins/security/src/main/java/org/apache/unomi/elasticsearch/plugin/security/SecurityPlugin.java +++ b/persistence-elasticsearch/plugins/security/src/main/java/org/apache/unomi/elasticsearch/plugin/security/SecurityPlugin.java @@ -22,9 +22,9 @@ import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.plugins.Plugin; +import java.util.ArrayList; import java.util.Collection; - -import static com.google.common.collect.Lists.newArrayList; +import java.util.Collections; public class SecurityPlugin extends Plugin { @@ -32,30 +32,22 @@ public class SecurityPlugin extends Plugin { super(); } - public String name() { - return "contextserver-security"; - } - - public String description() { - return "A plugin that provides some basic security to the Context Server elasticsearch HTTP and Transport connectors"; - } - @Override - public Collection<Module> nodeModules() { - Collection<Module> modules = newArrayList(); - // if (settings.getAsBoolean("security.enabled", true)) { - modules.add(new SecurityPluginModule()); - // } - return modules; + public Collection<Module> createGuiceModules() { + return Collections.<Module>singletonList(new SecurityPluginModule()); } - @SuppressWarnings("rawtypes") @Override - public Collection<Class<? extends LifecycleComponent>> nodeServices() { - Collection<Class<? extends LifecycleComponent>> services = newArrayList(); - // if (settings.getAsBoolean("security.enabled", true)) { + @SuppressWarnings("rawtypes") // Plugin use a rawtype + public Collection<Class<? extends LifecycleComponent>> getGuiceServiceClasses() { + Collection<Class<? extends LifecycleComponent>> services = new ArrayList<>(); services.add(SecurityPluginService.class); - // } return services; } + + @Override + public Settings additionalSettings() { + return Settings.EMPTY; + } + } http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/persistence-elasticsearch/plugins/security/src/main/java/org/apache/unomi/elasticsearch/plugin/security/SecurityPluginService.java ---------------------------------------------------------------------- diff --git a/persistence-elasticsearch/plugins/security/src/main/java/org/apache/unomi/elasticsearch/plugin/security/SecurityPluginService.java b/persistence-elasticsearch/plugins/security/src/main/java/org/apache/unomi/elasticsearch/plugin/security/SecurityPluginService.java index 6bd73eb..7c99439 100644 --- a/persistence-elasticsearch/plugins/security/src/main/java/org/apache/unomi/elasticsearch/plugin/security/SecurityPluginService.java +++ b/persistence-elasticsearch/plugins/security/src/main/java/org/apache/unomi/elasticsearch/plugin/security/SecurityPluginService.java @@ -18,6 +18,7 @@ package org.apache.unomi.elasticsearch.plugin.security; import org.elasticsearch.ElasticsearchException; +import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.Inject; @@ -37,7 +38,7 @@ import java.util.List; /** * ElasticSearch plugin that simply rejects connection from non-authorized IP ranges */ -public class SecurityPluginService extends AbstractLifecycleComponent<SecurityPluginService> { +public class SecurityPluginService extends AbstractLifecycleComponent { private static final Logger logger = LoggerFactory.getLogger(SecurityPluginService.class.getName()); @@ -102,7 +103,7 @@ public class SecurityPluginService extends AbstractLifecycleComponent<SecurityPl protected void doStart() throws ElasticsearchException { restFilter = new RestFilter() { @Override - public void process(RestRequest request, RestChannel channel, RestFilterChain filterChain) throws Exception { + public void process(RestRequest request, RestChannel channel, NodeClient client, RestFilterChain filterChain) throws Exception { logger.info("Processing REST request=" + request + " channel=" + channel); if (request.getRemoteAddress() instanceof InetSocketAddress) { InetSocketAddress inetSocketAddress = (InetSocketAddress) request.getRemoteAddress(); @@ -113,7 +114,7 @@ public class SecurityPluginService extends AbstractLifecycleComponent<SecurityPl } else { logger.warn("Unexpected SocketAddress that is not an InetSocketAddress (but an instance of " + request.getRemoteAddress().getClass().getName() + "), IP range filtering is DISABLED !"); } - filterChain.continueProcessing(request, channel); + filterChain.continueProcessing(request, channel, client); } }; restController.registerFilter(restFilter); http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PersistenceService.java ---------------------------------------------------------------------- diff --git a/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PersistenceService.java b/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PersistenceService.java index 90b0efc..d81be03 100644 --- a/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PersistenceService.java +++ b/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PersistenceService.java @@ -178,14 +178,6 @@ public interface PersistenceService { void createMapping(String type, String source); /** - * TODO - * - * @param item - * @return - */ - List<String> getMatchingSavedQueries(Item item); - - /** * Checks whether the specified item satisfies the provided condition. * * TODO: rename to isMatching? http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/BooleanConditionESQueryBuilder.java ---------------------------------------------------------------------- diff --git a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/BooleanConditionESQueryBuilder.java b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/BooleanConditionESQueryBuilder.java index f5330ed..94e8519 100644 --- a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/BooleanConditionESQueryBuilder.java +++ b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/BooleanConditionESQueryBuilder.java @@ -23,6 +23,8 @@ import org.apache.unomi.persistence.elasticsearch.conditions.ConditionESQueryBui import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilders; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.List; import java.util.Map; @@ -32,6 +34,8 @@ import java.util.Map; */ public class BooleanConditionESQueryBuilder implements ConditionESQueryBuilder { + private static final Logger logger = LoggerFactory.getLogger(BooleanConditionESQueryBuilder.class.getName()); + @Override public QueryBuilder buildQuery(Condition condition, Map<String, Object> context, ConditionESQueryBuilderDispatcher dispatcher) { @@ -48,9 +52,19 @@ public class BooleanConditionESQueryBuilder implements ConditionESQueryBuilder { BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery(); for (int i = 0; i < conditionCount; i++) { if (isAndOperator) { - boolQueryBuilder.must(dispatcher.buildFilter(conditions.get(i))); + QueryBuilder andFilter = dispatcher.buildFilter(conditions.get(i)); + if (andFilter != null) { + boolQueryBuilder.must(andFilter); + } else { + logger.warn("Null filter for boolean AND sub condition " + conditions.get(i)); + } } else { - boolQueryBuilder.should(dispatcher.buildFilter(conditions.get(i))); + QueryBuilder orFilter = dispatcher.buildFilter(conditions.get(i)); + if (orFilter != null) { + boolQueryBuilder.should(orFilter); + } else { + logger.warn("Null filter for boolean OR sub condition " + conditions.get(i)); + } } } http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/GeoLocationByPointSessionConditionESQueryBuilder.java ---------------------------------------------------------------------- diff --git a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/GeoLocationByPointSessionConditionESQueryBuilder.java b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/GeoLocationByPointSessionConditionESQueryBuilder.java index 083cfe4..001bd3d 100644 --- a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/GeoLocationByPointSessionConditionESQueryBuilder.java +++ b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/GeoLocationByPointSessionConditionESQueryBuilder.java @@ -37,8 +37,7 @@ public class GeoLocationByPointSessionConditionESQueryBuilder implements Conditi if(circleLatitude != null && circleLongitude != null && distance != null) { return QueryBuilders.geoDistanceQuery("location") - .lat(circleLatitude) - .lon(circleLongitude) + .point(circleLatitude, circleLongitude) .distance(distance); } } else if("rectangle".equals(type)) { @@ -49,8 +48,7 @@ public class GeoLocationByPointSessionConditionESQueryBuilder implements Conditi if(rectLatitudeNE != null && rectLongitudeNE != null && rectLatitudeSW != null && rectLongitudeSW != null) { return QueryBuilders.geoBoundingBoxQuery("location") - .topLeft(rectLatitudeNE, rectLongitudeNE) - .bottomRight(rectLatitudeSW, rectLongitudeSW); + .setCorners(rectLatitudeNE, rectLongitudeNE,rectLatitudeSW, rectLongitudeSW); } } http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionEvaluator.java ---------------------------------------------------------------------- diff --git a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionEvaluator.java b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionEvaluator.java index 4db6e1a..67404a8 100644 --- a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionEvaluator.java +++ b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionEvaluator.java @@ -34,7 +34,7 @@ import org.apache.unomi.persistence.elasticsearch.conditions.ConditionEvaluatorD import org.apache.unomi.persistence.spi.PropertyHelper; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.joda.DateMathParser; -import org.elasticsearch.index.mapper.core.DateFieldMapper; +import org.elasticsearch.index.mapper.DateFieldMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -280,7 +280,7 @@ public class PropertyConditionEvaluator implements ConditionEvaluator { if (value instanceof Date) { return ((Date) value); } else { - DateMathParser parser = new DateMathParser(DateFieldMapper.Defaults.DATE_TIME_FORMATTER); + DateMathParser parser = new DateMathParser(DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER); try { return new Date(parser.parse(value.toString(), new Callable<Long>() { @Override http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index fd75b01..1d8b334 100644 --- a/pom.xml +++ b/pom.xml @@ -63,12 +63,13 @@ <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <cxf.version>2.7.11</cxf.version> + <cxf.version>3.0.2</cxf.version> <version.jackson.core>2.6.6</version.jackson.core> <!-- version used by CXF --> <version.jackson.jaxb>2.6.6</version.jackson.jaxb> <!-- version used by CXF --> - <version.karaf>3.0.2</version.karaf> + <version.karaf>3.0.8</version.karaf> + <version.karaf.cellar>3.0.3</version.karaf.cellar> <version.pax.exam>4.9.1</version.pax.exam> - <elasticsearch.version>2.4.1</elasticsearch.version> + <elasticsearch.version>5.0.1</elasticsearch.version> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> @@ -521,11 +522,6 @@ <!-- Apache CXF dependencies --> <dependency> <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-core</artifactId> - <version>${cxf.version}</version> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxws</artifactId> <version>${cxf.version}</version> </dependency> @@ -648,6 +644,25 @@ <type>xml</type> <scope>runtime</scope> </dependency> + <dependency> + <groupId>org.apache.karaf.cellar</groupId> + <artifactId>apache-karaf-cellar</artifactId> + <classifier>features</classifier> + <version>${version.karaf.cellar}</version> + <type>xml</type> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.apache.karaf.cellar</groupId> + <artifactId>org.apache.karaf.cellar.core</artifactId> + <version>${version.karaf.cellar}</version> + </dependency> + <dependency> + <groupId>org.apache.karaf.cellar</groupId> + <artifactId>org.apache.karaf.cellar.config</artifactId> + <version>${version.karaf.cellar}</version> + </dependency> + <!-- End of Apache Karaf dependencies --> <dependency> http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/rest/pom.xml ---------------------------------------------------------------------- diff --git a/rest/pom.xml b/rest/pom.xml index f795ff1..4d471a6 100644 --- a/rest/pom.xml +++ b/rest/pom.xml @@ -64,11 +64,6 @@ <dependency> <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-core</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxws</artifactId> <scope>provided</scope> </dependency> http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/96a018ec/services/pom.xml ---------------------------------------------------------------------- diff --git a/services/pom.xml b/services/pom.xml index c90ebba..7a58cd7 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -64,16 +64,6 @@ <dependency> <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-core</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-frontend-jaxws</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxrs</artifactId> <scope>provided</scope> </dependency>
