the request type
13 | * @param the pipeline type
14 | */
15 | public interface PipelineExecutor> {
16 |
17 | /**
18 | * Set the concurrency of this pipeline setExecutor
19 | *
20 | * @param concurrency the concurrency, must be a positive integer
21 | * @return this setExecutor
22 | */
23 | PipelineExecutor setConcurrency(int concurrency);
24 |
25 | /**
26 | * Set the provider of this pipeline setExecutor
27 | *
28 | * @param provider the pipeline provider
29 | * @return this setExecutor
30 | */
31 | PipelineExecutor setPipelineProvider(PipelineProvider provider);
32 |
33 | /**
34 | * Set pipeline sink
35 | *
36 | * @param sink the pipeline sink
37 | * @return this setExecutor
38 | */
39 | PipelineExecutor setSink(PipelineSink sink);
40 |
41 | /**
42 | * Prepare the pipeline execution.
43 | *
44 | * @return this setExecutor
45 | */
46 | PipelineExecutor prepare();
47 |
48 | /**
49 | * Execute the pipelines.
50 | *
51 | * @return this setExecutor
52 | */
53 | PipelineExecutor execute();
54 |
55 | /**
56 | * Execute the pipelines.
57 | *
58 | * @return this setExecutor
59 | * @throws InterruptedException
60 | * @throws java.util.concurrent.ExecutionException
61 | * @throws java.io.IOException
62 | */
63 | PipelineExecutor waitFor() throws InterruptedException, ExecutionException, IOException;
64 |
65 | /**
66 | * Shut down this pipeline executor.
67 | *
68 | * @throws InterruptedException
69 | * @throws java.util.concurrent.ExecutionException
70 | * @throws java.io.IOException
71 | */
72 | void shutdown() throws InterruptedException, ExecutionException, IOException;
73 |
74 | /**
75 | * Return pipelines
76 | *
77 | * @return the pipelines
78 | */
79 | Collection getPipelines();
80 | }
81 |
--------------------------------------------------------------------------------
/elasticsearch-jdbc/src/main/java/org/xbib/pipeline/PipelineProvider.java:
--------------------------------------------------------------------------------
1 | package org.xbib.pipeline;
2 |
3 | public interface PipelineProvider
{
4 |
5 | /**
6 | * Get a new instance of a pipeline
7 | *
8 | * @return a new pipeline instance
9 | */
10 | P get();
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/elasticsearch-jdbc/src/main/java/org/xbib/pipeline/PipelineRequest.java:
--------------------------------------------------------------------------------
1 | package org.xbib.pipeline;
2 |
3 | public interface PipelineRequest {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/elasticsearch-jdbc/src/main/java/org/xbib/pipeline/PipelineRequestListener.java:
--------------------------------------------------------------------------------
1 | package org.xbib.pipeline;
2 |
3 | public interface PipelineRequestListener {
4 |
5 | /**
6 | * Receive a new request in this pipeline.
7 | *
8 | * @param pipeline the pipeline
9 | * @param request the pipeline request
10 | */
11 | void newRequest(Pipeline pipeline, R request) throws PipelineException;
12 | }
13 |
--------------------------------------------------------------------------------
/elasticsearch-jdbc/src/main/java/org/xbib/pipeline/PipelineSink.java:
--------------------------------------------------------------------------------
1 | package org.xbib.pipeline;
2 |
3 | import java.io.IOException;
4 |
5 | public interface PipelineSink {
6 |
7 | void write(T t) throws IOException;
8 | }
9 |
--------------------------------------------------------------------------------
/elasticsearch-jdbc/src/main/java/org/xbib/pipeline/element/LongPipelineElement.java:
--------------------------------------------------------------------------------
1 | package org.xbib.pipeline.element;
2 |
3 | import org.xbib.pipeline.PipelineRequest;
4 |
5 | import java.util.concurrent.atomic.AtomicLong;
6 |
7 | public class LongPipelineElement implements PipelineElement, PipelineRequest {
8 |
9 | private AtomicLong n;
10 |
11 | @Override
12 | public AtomicLong get() {
13 | return n;
14 | }
15 |
16 | @Override
17 | public LongPipelineElement set(AtomicLong n) {
18 | this.n = n;
19 | return this;
20 | }
21 |
22 | @Override
23 | public String toString() {
24 | return n.toString();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/elasticsearch-jdbc/src/main/java/org/xbib/pipeline/element/MapPipelineElement.java:
--------------------------------------------------------------------------------
1 | package org.xbib.pipeline.element;
2 |
3 | import org.xbib.pipeline.PipelineRequest;
4 |
5 | import java.util.Map;
6 |
7 | public class MapPipelineElement implements PipelineElement