You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streams.apache.org by sb...@apache.org on 2014/09/04 19:12:11 UTC
[23/41] git commit: STREAMS-152 | Added flag that allows us to force
the use of whatever configuration attributes have been set
STREAMS-152 | Added flag that allows us to force the use of whatever configuration attributes have been set
Project: http://git-wip-us.apache.org/repos/asf/incubator-streams/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-streams/commit/ed695354
Tree: http://git-wip-us.apache.org/repos/asf/incubator-streams/tree/ed695354
Diff: http://git-wip-us.apache.org/repos/asf/incubator-streams/diff/ed695354
Branch: refs/heads/pp
Commit: ed695354bd59b30b8d92f98c2a60d0726925be71
Parents: ee6b4d5
Author: Robert Douglas <rd...@w2odigital.com>
Authored: Wed Aug 20 18:28:08 2014 -0500
Committer: Robert Douglas <rd...@w2odigital.com>
Committed: Wed Aug 20 18:28:08 2014 -0500
----------------------------------------------------------------------
.../elasticsearch/ElasticsearchPersistWriter.java | 12 ++++++++----
.../elasticsearch/ElasticsearchConfiguration.json | 4 ++++
2 files changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/ed695354/streams-contrib/streams-persist-elasticsearch/src/main/java/org/apache/streams/elasticsearch/ElasticsearchPersistWriter.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-persist-elasticsearch/src/main/java/org/apache/streams/elasticsearch/ElasticsearchPersistWriter.java b/streams-contrib/streams-persist-elasticsearch/src/main/java/org/apache/streams/elasticsearch/ElasticsearchPersistWriter.java
index 8a14181..10bb3b0 100644
--- a/streams-contrib/streams-persist-elasticsearch/src/main/java/org/apache/streams/elasticsearch/ElasticsearchPersistWriter.java
+++ b/streams-contrib/streams-persist-elasticsearch/src/main/java/org/apache/streams/elasticsearch/ElasticsearchPersistWriter.java
@@ -146,14 +146,18 @@ public class ElasticsearchPersistWriter implements StreamsPersistWriter, DatumSt
String index = Optional.fromNullable(
(String) streamsDatum.getMetadata().get("index"))
- .or(config.getIndex());
+ .or("");
String type = Optional.fromNullable(
(String) streamsDatum.getMetadata().get("type"))
.or(config.getType());
- String id = (String) streamsDatum.getMetadata().get("id");
+ String id = Optional.fromNullable(
+ (String) streamsDatum.getMetadata().get("id"))
+ .or(streamsDatum.getId());
- if(id == null)
- id = streamsDatum.getId();
+ if(config.getForceUseConfig()) {
+ index = config.getIndex();
+ type = config.getType();
+ }
try {
add(index, type, id,
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/ed695354/streams-contrib/streams-persist-elasticsearch/src/main/jsonschema/org/apache/streams/elasticsearch/ElasticsearchConfiguration.json
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-persist-elasticsearch/src/main/jsonschema/org/apache/streams/elasticsearch/ElasticsearchConfiguration.json b/streams-contrib/streams-persist-elasticsearch/src/main/jsonschema/org/apache/streams/elasticsearch/ElasticsearchConfiguration.json
index 6524dcc..855b6d2 100644
--- a/streams-contrib/streams-persist-elasticsearch/src/main/jsonschema/org/apache/streams/elasticsearch/ElasticsearchConfiguration.json
+++ b/streams-contrib/streams-persist-elasticsearch/src/main/jsonschema/org/apache/streams/elasticsearch/ElasticsearchConfiguration.json
@@ -19,6 +19,10 @@
"clusterName": {
"type": "string",
"description": "Cluster Name"
+ },
+ "forceUseConfig": {
+ "type": "boolean",
+ "description": "Whether or not we force the values that are set in the configuration"
}
}
}
\ No newline at end of file