Skip to content

Commit 4c8ae3c

Browse files
committed
fixing client connection settings, simplifying ingest handling
1 parent 224ddc3 commit 4c8ae3c

File tree

12 files changed

+306
-552
lines changed

12 files changed

+306
-552
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ about what happened.
4040

4141
| Release date | JDBC Importer version | Elasticsearch version |
4242
| -------------| ----------------------| ----------------------|
43-
| Dec 23 2015 | 2.1.1.1 | 2.1.1 |
44-
| Dec 22 2015 | 2.1.1.0 | 2.1.1 |
43+
| Dec 23 2015 | 2.1.1.2 | 2.1.1 |
4544
| Nov 29 2015 | 2.1.0.0 | 2.1.0 |
4645
| Oct 29 2015 | 2.0.0.1 | 2.0.0 |
4746
| Oct 28 2015 | 2.0.0.0 | 2.0.0 |
@@ -54,9 +53,9 @@ about what happened.
5453

5554
## Quick links
5655

57-
JDBC importer 2.1.1.1
56+
JDBC importer 2.1.1.2
5857

59-
`http://xbib.org/repository/org/xbib/elasticsearch/importer/elasticsearch-jdbc/2.1.1.1/elasticsearch-jdbc-2.1.1.1-dist.zip`
58+
`http://xbib.org/repository/org/xbib/elasticsearch/importer/elasticsearch-jdbc/2.1.1.2/elasticsearch-jdbc-2.1.1.2-dist.zip`
6059

6160
## Installation
6261

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<groupId>org.xbib.elasticsearch.importer</groupId>
99
<artifactId>elasticsearch-jdbc</artifactId>
10-
<version>2.1.1.1</version>
10+
<version>2.1.1.2</version>
1111

1212
<packaging>jar</packaging>
1313

src/main/java/org/xbib/elasticsearch/jdbc/strategy/Sink.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,6 @@ public interface Sink<C extends Context> {
5151
*/
5252
Sink<C> setContext(C context);
5353

54-
Sink setIngestFactory(IngestFactory ingestFactory);
55-
56-
IngestFactory getIngestFactory();
57-
58-
/**
59-
* Set index settings
60-
*
61-
* @param indexSettings the index settings
62-
* @return this sink
63-
*/
64-
Sink setIndexSettings(Settings indexSettings);
65-
66-
/**
67-
* Set index type mappings
68-
*
69-
* @param typeMapping the index type mappings
70-
* @return this sink
71-
*/
72-
Sink setTypeMapping(Map<String, String> typeMapping);
73-
7454
/**
7555
* Executed before source fetch
7656
*

src/main/java/org/xbib/elasticsearch/jdbc/strategy/standard/StandardContext.java

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import java.io.FileWriter;
3737
import java.io.IOException;
3838
import java.io.Writer;
39-
import java.util.Collections;
4039
import java.util.LinkedList;
4140
import java.util.List;
4241
import java.util.Locale;
@@ -170,6 +169,7 @@ public void execute() throws Exception {
170169
}
171170

172171
@Override
172+
@SuppressWarnings("unchecked")
173173
public void beforeFetch() throws Exception {
174174
logger.debug("before fetch");
175175
Sink sink = createSink();
@@ -188,7 +188,7 @@ public void fetch() throws Exception {
188188
getSource().fetch();
189189
} catch (Throwable e) {
190190
setThrowable(e);
191-
logger.error(e.getMessage(), e);
191+
logger.error("at fetch: " + e.getMessage(), e);
192192
}
193193
}
194194

@@ -200,13 +200,13 @@ public void afterFetch() throws Exception {
200200
getSource().afterFetch();
201201
} catch (Throwable e) {
202202
setThrowable(e);
203-
logger.error(e.getMessage(), e);
203+
logger.error("after fetch: " + e.getMessage(), e);
204204
}
205205
try {
206206
getSink().afterFetch();
207207
} catch (Throwable e) {
208208
setThrowable(e);
209-
logger.error(e.getMessage(), e);
209+
logger.error("after fetch: " + e.getMessage(), e);
210210
}
211211
}
212212

@@ -220,14 +220,14 @@ public void shutdown() {
220220
try {
221221
source.shutdown();
222222
} catch (Exception e) {
223-
logger.error(e.getMessage(), e);
223+
logger.error("source shutdown: " + e.getMessage(), e);
224224
}
225225
}
226226
if (sink != null) {
227227
try {
228228
sink.shutdown();
229229
} catch (Exception e) {
230-
logger.error(e.getMessage(), e);
230+
logger.error("sink shutdown: " + e.getMessage(), e);
231231
}
232232
}
233233
logger.info("shutdown completed");
@@ -293,22 +293,10 @@ protected S createSource() {
293293
protected Sink createSink() throws IOException {
294294
Sink sink = StrategyLoader.newSink(strategy());
295295
logger.info("found sink class {}", sink);
296-
String index = settings.get("index", "jdbc");
297-
String type = settings.get("type", "jdbc");
298-
sink.setIndex(index).setType(type);
299-
Map<String,Object> map = settings.getAsStructuredMap();
300-
if (map.containsKey("index_settings")) {
301-
Settings loadedSettings = settings.getAsSettings("index_settings");
302-
sink.setIndexSettings(loadedSettings);
303-
}
304-
if (map.containsKey("type_mapping")) {
305-
XContentBuilder builder = jsonBuilder()
306-
.map(settings.getAsSettings("type_mapping").getAsStructuredMap());
307-
sink.setTypeMapping(Collections.singletonMap(type, builder.string()));
308-
}
309296
return sink;
310297
}
311298

299+
@SuppressWarnings("unchecked")
312300
protected void prepareContext(S source, Sink sink) throws IOException {
313301
Map<String, Object> params = settings.getAsStructuredMap();
314302
List<SQLCommand> sql = SQLCommand.parse(params);

0 commit comments

Comments
 (0)