You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by sh...@apache.org on 2016/12/21 20:32:10 UTC
[1/7] incubator-unomi git commit: Update install instructions for
deployment using features
Repository: incubator-unomi
Updated Branches:
refs/heads/feature-UNOMI-70-ES5X 294239313 -> 35b939793
Update install instructions for deployment using features
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/ffe25912
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/ffe25912
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/ffe25912
Branch: refs/heads/feature-UNOMI-70-ES5X
Commit: ffe259125865aa15eaee8638951d9a1a7d8d0459
Parents: 2942393
Author: Serge Huber <sh...@apache.org>
Authored: Wed Dec 21 20:15:00 2016 +0100
Committer: Serge Huber <sh...@apache.org>
Committed: Wed Dec 21 20:15:00 2016 +0100
----------------------------------------------------------------------
README.md | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ffe25912/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 7c807a7..b73efa4 100644
--- a/README.md
+++ b/README.md
@@ -75,9 +75,10 @@ on your disk and copy all the files from the lib/sigar directory into Karaf's li
3. Install the WAR support, CXF and CDI (OpenWebBeans) into Karaf by doing the following in the Karaf command line:
```
- feature:install -v war
- feature:repo-add cxf 2.7.11
- feature:install -v cxf/2.7.11
+ feature:repo-add cxf 3.0.2
+ feature:repo-add cellar 3.0.3
+ feature:repo-add mvn:org.apache.unomi/unomi-kar/VERSION/xml/features
+ feature:install unomi-kar
```
4. Create a new $MY_KARAF_HOME/etc/org.apache.cxf.osgi.cfg file and put the following property inside :
@@ -85,14 +86,8 @@ on your disk and copy all the files from the lib/sigar directory into Karaf's li
```
org.apache.cxf.servlet.context=/cxs
```
-
-5. Copy the following KAR to the Karaf deploy directory, as in this example line:
-
- ```
- cp kar/target/unomi-kar-1.0.0-SNAPSHOT.kar ~/java/deployments/unomi/apache-karaf-3.0.1/deploy/
- ```
-6. If all went smoothly, you should be able to access the context script here : http://localhost:8181/cxs/cluster .
+5. If all went smoothly, you should be able to access the context script here : http://localhost:8181/cxs/cluster .
You should be able to login with karaf / karaf and see basic server information. If not something went wrong during the install.
Configuration
[7/7] incubator-unomi git commit: - Fix waiting for green status
message - Add code to register mappings and condition builders that were
started before the ElasticSearch persistence service implementation - Change
counting code to use queries instead of
Posted by sh...@apache.org.
- Fix waiting for green status message
- Add code to register mappings and condition builders that were started before the ElasticSearch persistence service implementation
- Change counting code to use queries instead of aggregations
Signed-off-by: Serge Huber <sh...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/35b93979
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/35b93979
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/35b93979
Branch: refs/heads/feature-UNOMI-70-ES5X
Commit: 35b9397931cd89dd6d021e65079c658d6fdf29e0
Parents: 952da61
Author: Serge Huber <sh...@apache.org>
Authored: Wed Dec 21 21:29:13 2016 +0100
Committer: Serge Huber <sh...@apache.org>
Committed: Wed Dec 21 21:29:13 2016 +0100
----------------------------------------------------------------------
.../ElasticSearchPersistenceServiceImpl.java | 39 ++++++++++++++------
1 file changed, 27 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/35b93979/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
index 6c1d8e0..dc909b9 100644
--- a/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
+++ b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
@@ -24,7 +24,10 @@ import org.apache.karaf.cellar.core.*;
import org.apache.karaf.cellar.core.control.SwitchStatus;
import org.apache.karaf.cellar.core.event.EventProducer;
import org.apache.karaf.cellar.core.event.EventType;
-import org.apache.unomi.api.*;
+import org.apache.unomi.api.ClusterNode;
+import org.apache.unomi.api.Item;
+import org.apache.unomi.api.PartialList;
+import org.apache.unomi.api.TimestampedItem;
import org.apache.unomi.api.conditions.Condition;
import org.apache.unomi.api.query.DateRange;
import org.apache.unomi.api.query.IpRange;
@@ -79,10 +82,7 @@ import org.elasticsearch.search.sort.GeoDistanceSortBuilder;
import org.elasticsearch.search.sort.SortBuilders;
import org.elasticsearch.search.sort.SortOrder;
import org.elasticsearch.transport.client.PreBuiltTransportClient;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.SynchronousBundleListener;
+import org.osgi.framework.*;
import org.osgi.service.cm.ConfigurationAdmin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -415,7 +415,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
refreshExistingIndexNames();
- logger.info("Waiting for index creation to complete...");
+ logger.info("Waiting for GREEN cluster status...");
client.admin().cluster().prepareHealth()
.setWaitForGreenStatus()
@@ -458,6 +458,24 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
}
}, 10000L, 24L * 60L * 60L * 1000L);
+ // load predefined mappings and condition dispatchers of any bundles that were started before this one.
+ for (Bundle existingBundle : bundleContext.getBundles()) {
+ if (existingBundle.getBundleContext() != null) {
+ loadPredefinedMappings(existingBundle.getBundleContext(), true);
+ }
+ if (existingBundle.getRegisteredServices() != null) {
+ for (ServiceReference<?> reference : existingBundle.getRegisteredServices()) {
+ Object service = bundleContext.getService(reference);
+ if (service instanceof ConditionEvaluator) {
+ conditionEvaluatorDispatcher.addEvaluator(reference.getProperty("conditionEvaluatorId").toString(), existingBundle.getBundleId(), (ConditionEvaluator) service);
+ }
+ if (service instanceof ConditionESQueryBuilder) {
+ conditionESQueryBuilderDispatcher.addQueryBuilder(reference.getProperty("queryBuilderId").toString(), existingBundle.getBundleId(), (ConditionESQueryBuilder) service);
+ }
+ }
+ }
+ }
+
logger.info(this.getClass().getName() + " service started successfully.");
}
@@ -649,7 +667,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
}
while (predefinedMappings.hasMoreElements()) {
URL predefinedMappingURL = predefinedMappings.nextElement();
- logger.debug("Found mapping at " + predefinedMappingURL + ", loading... ");
+ logger.info("Found mapping at " + predefinedMappingURL + ", loading... ");
try {
final String path = predefinedMappingURL.getPath();
String name = path.substring(path.lastIndexOf('/') + 1, path.lastIndexOf('.'));
@@ -1218,13 +1236,10 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
SearchResponse response = client.prepareSearch(getIndexNameForQuery(itemType))
.setTypes(itemType)
.setSize(0)
- .setQuery(QueryBuilders.matchAllQuery())
- .addAggregation(AggregationBuilders.filter("filter", filter))
+ .setQuery(filter)
.execute()
.actionGet();
- Aggregations searchHits = response.getAggregations();
- Filter filter = searchHits.get("filter");
- return filter.getDocCount();
+ return response.getHits().getTotalHits();
}
}.executeInClassLoader();
}
[3/7] incubator-unomi git commit: Update feature to add dependency to
cellar
Posted by sh...@apache.org.
Update feature to add dependency to cellar
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/207c2cc4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/207c2cc4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/207c2cc4
Branch: refs/heads/feature-UNOMI-70-ES5X
Commit: 207c2cc429ce989e6a8939e1ceccf89fcf02dfce
Parents: 31677cb
Author: Serge Huber <sh...@apache.org>
Authored: Wed Dec 21 20:15:50 2016 +0100
Committer: Serge Huber <sh...@apache.org>
Committed: Wed Dec 21 20:15:50 2016 +0100
----------------------------------------------------------------------
kar/src/main/feature/feature.xml | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/207c2cc4/kar/src/main/feature/feature.xml
----------------------------------------------------------------------
diff --git a/kar/src/main/feature/feature.xml b/kar/src/main/feature/feature.xml
index 39413fb..674e6bc 100644
--- a/kar/src/main/feature/feature.xml
+++ b/kar/src/main/feature/feature.xml
@@ -23,6 +23,7 @@
<feature>cxf</feature>
<feature>openwebbeans</feature>
<feature>pax-cdi-web-openwebbeans</feature>
+ <feature>cellar</feature>
<configfile finalname="/etc/org.apache.unomi.web.cfg">mvn:org.apache.unomi/unomi-wab/${project.version}/cfg/unomicfg</configfile>
<configfile finalname="/etc/org.apache.unomi.persistence.elasticsearch.cfg">mvn:org.apache.unomi/unomi-persistence-elasticsearch-core/${project.version}/cfg/elasticsearchcfg</configfile>
<configfile finalname="/etc/org.apache.unomi.plugins.request.cfg">mvn:org.apache.unomi/unomi-plugins-request/${project.version}/cfg/requestcfg</configfile>
[6/7] incubator-unomi git commit: - Add logging to help diagnose
problems in the condition builders registration
Posted by sh...@apache.org.
- Add logging to help diagnose problems in the condition builders registration
Signed-off-by: Serge Huber <sh...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/952da614
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/952da614
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/952da614
Branch: refs/heads/feature-UNOMI-70-ES5X
Commit: 952da6144726173d85827fbc5f838521033c061f
Parents: 8d54f8d
Author: Serge Huber <sh...@apache.org>
Authored: Wed Dec 21 21:27:40 2016 +0100
Committer: Serge Huber <sh...@apache.org>
Committed: Wed Dec 21 21:27:40 2016 +0100
----------------------------------------------------------------------
.../elasticsearch/conditions/ConditionESQueryBuilderDispatcher.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/952da614/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/conditions/ConditionESQueryBuilderDispatcher.java
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/conditions/ConditionESQueryBuilderDispatcher.java b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/conditions/ConditionESQueryBuilderDispatcher.java
index 5289f69..3ab0d5e 100644
--- a/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/conditions/ConditionESQueryBuilderDispatcher.java
+++ b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/conditions/ConditionESQueryBuilderDispatcher.java
@@ -97,6 +97,7 @@ public class ConditionESQueryBuilderDispatcher {
}
// if no matching
+ logger.warn("No matching query builder for condition {} and context {}", condition, context);
return QueryBuilders.matchAllQuery();
}
[2/7] incubator-unomi git commit: Add toString method to help
debugging
Posted by sh...@apache.org.
Add toString method to help debugging
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/31677cbd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/31677cbd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/31677cbd
Branch: refs/heads/feature-UNOMI-70-ES5X
Commit: 31677cbd351cb0ca34249c0ad75adeace98461e6
Parents: ffe2591
Author: Serge Huber <sh...@apache.org>
Authored: Wed Dec 21 20:15:23 2016 +0100
Committer: Serge Huber <sh...@apache.org>
Committed: Wed Dec 21 20:15:23 2016 +0100
----------------------------------------------------------------------
.../java/org/apache/unomi/api/conditions/Condition.java | 10 ++++++++++
1 file changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/31677cbd/api/src/main/java/org/apache/unomi/api/conditions/Condition.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/conditions/Condition.java b/api/src/main/java/org/apache/unomi/api/conditions/Condition.java
index 2165f0f..334c1ae 100644
--- a/api/src/main/java/org/apache/unomi/api/conditions/Condition.java
+++ b/api/src/main/java/org/apache/unomi/api/conditions/Condition.java
@@ -154,4 +154,14 @@ public class Condition {
result = 31 * result + parameterValues.hashCode();
return result;
}
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("Condition{");
+ sb.append("conditionType=").append(conditionType);
+ sb.append(", conditionTypeId='").append(conditionTypeId).append('\'');
+ sb.append(", parameterValues=").append(parameterValues);
+ sb.append('}');
+ return sb.toString();
+ }
}
[4/7] incubator-unomi git commit: Update feature to add dependency to
cellar
Posted by sh...@apache.org.
Update feature to add dependency to cellar
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/69bb3cc9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/69bb3cc9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/69bb3cc9
Branch: refs/heads/feature-UNOMI-70-ES5X
Commit: 69bb3cc9bb8af844c7e1922e1bd8eaeefdf0ce31
Parents: 207c2cc
Author: Serge Huber <sh...@apache.org>
Authored: Wed Dec 21 20:19:55 2016 +0100
Committer: Serge Huber <sh...@apache.org>
Committed: Wed Dec 21 20:19:55 2016 +0100
----------------------------------------------------------------------
kar/pom.xml | 31 +++++++------------------------
1 file changed, 7 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/69bb3cc9/kar/pom.xml
----------------------------------------------------------------------
diff --git a/kar/pom.xml b/kar/pom.xml
index cee6add..8a1c1c4 100644
--- a/kar/pom.xml
+++ b/kar/pom.xml
@@ -108,6 +108,13 @@
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.joda-time</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.karaf.cellar</groupId>
+ <artifactId>apache-karaf-cellar</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
</dependencies>
<build>
@@ -132,30 +139,6 @@
<startLevel>85</startLevel>
</configuration>
</plugin>
- <!--
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-artifacts</id>
- <phase>package</phase>
- <goals>
- <goal>attach-artifact</goal>
- </goals>
- <configuration>
- <artifacts>
- <artifact>
- <file>target/feature/feature.xml</file>
- <classifier>features</classifier>
- <type>xml</type>
- </artifact>
- </artifacts>
- </configuration>
- </execution>
- </executions>
- </plugin>
- -->
</plugins>
</build>
[5/7] incubator-unomi git commit: - Use linked hash map in
GeonameEntry to make sure that we conserve the order of the properties - Fix
type mapping detection algorithm
Posted by sh...@apache.org.
- Use linked hash map in GeonameEntry to make sure that we conserve the order of the properties
- Fix type mapping detection algorithm
Signed-off-by: Serge Huber <sh...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/8d54f8d9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/8d54f8d9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/8d54f8d9
Branch: refs/heads/feature-UNOMI-70-ES5X
Commit: 8d54f8d93c45187aaf9307932f461ecd9b6e9da9
Parents: 69bb3cc
Author: Serge Huber <sh...@apache.org>
Authored: Wed Dec 21 21:27:08 2016 +0100
Committer: Serge Huber <sh...@apache.org>
Committed: Wed Dec 21 21:27:08 2016 +0100
----------------------------------------------------------------------
.../java/org/apache/unomi/geonames/services/GeonameEntry.java | 4 ++--
.../org/apache/unomi/geonames/services/GeonamesServiceImpl.java | 4 +++-
2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/8d54f8d9/extensions/geonames/services/src/main/java/org/apache/unomi/geonames/services/GeonameEntry.java
----------------------------------------------------------------------
diff --git a/extensions/geonames/services/src/main/java/org/apache/unomi/geonames/services/GeonameEntry.java b/extensions/geonames/services/src/main/java/org/apache/unomi/geonames/services/GeonameEntry.java
index 014a699..ac41a6e 100644
--- a/extensions/geonames/services/src/main/java/org/apache/unomi/geonames/services/GeonameEntry.java
+++ b/extensions/geonames/services/src/main/java/org/apache/unomi/geonames/services/GeonameEntry.java
@@ -20,7 +20,7 @@ package org.apache.unomi.geonames.services;
import org.apache.unomi.api.Item;
import java.util.Date;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -56,7 +56,7 @@ public class GeonameEntry extends Item {
this.name = name;
this.asciiname = asciiname;
// this.alternatenames = alternatenames;
- this.location = new HashMap<>();
+ this.location = new LinkedHashMap<>();
this.location.put("lat",lat);
this.location.put("lon",lon);
this.featureClass = featureClass;
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/8d54f8d9/extensions/geonames/services/src/main/java/org/apache/unomi/geonames/services/GeonamesServiceImpl.java
----------------------------------------------------------------------
diff --git a/extensions/geonames/services/src/main/java/org/apache/unomi/geonames/services/GeonamesServiceImpl.java b/extensions/geonames/services/src/main/java/org/apache/unomi/geonames/services/GeonamesServiceImpl.java
index 2b0a0dc..9bce9b2 100644
--- a/extensions/geonames/services/src/main/java/org/apache/unomi/geonames/services/GeonamesServiceImpl.java
+++ b/extensions/geonames/services/src/main/java/org/apache/unomi/geonames/services/GeonamesServiceImpl.java
@@ -98,7 +98,7 @@ public class GeonamesServiceImpl implements GeonamesService {
private void importGeoNameDatabase(final File f, final Timer t) {
Map<String,Map<String,Object>> typeMappings = persistenceService.getPropertiesMapping(GeonameEntry.ITEM_TYPE);
- if (typeMappings == null) {
+ if (typeMappings == null || typeMappings.size() == 0) {
logger.warn("Type mappings for type {} are not yet installed, delaying import until they are ready!", GeonameEntry.ITEM_TYPE);
t.schedule(new TimerTask() {
@Override
@@ -107,6 +107,8 @@ public class GeonamesServiceImpl implements GeonamesService {
}
}, 5000);
return;
+ } else {
+ // let's check that the mappings are correct
}
try {