forked from searchisko/elasticsearch-river-remote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IRemoteSystemClient.java
67 lines (58 loc) · 2.58 KB
/
IRemoteSystemClient.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package org.jboss.elasticsearch.river.remote;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.elasticsearch.common.settings.SettingsException;
/**
* Interface for Remote system calls Client implementation. Only one instance is created by river, so implementation
* must be thread safe.
*
* @author Vlastimil Elias (velias at redhat dot com)
*/
public interface IRemoteSystemClient {
/**
* Initialize client. Called from river in init time.
*
* @param config configuration structure (taken from <code>remote</code> element in river configuration)
* @param spaceListLoadingEnabled if <code>true</code> then {@link #getAllSpaces()} will be called by river to load
* list of spaces from remote system. So client must be initialized to be able to use this method.
* @param pwdLoader used to load password if not defined in <code>config</code>
* @throws SettingsException
*/
public abstract void init(Map<String, Object> config, boolean spaceListLoadingEnabled, IPwdLoader pwdLoader)
throws SettingsException;
/**
* Set index structure builder so remote system client can use it (for example it can request from remote system only
* fields necessary for indexing etc.). Called after <code>init</code method.
*
* @param indexStructureBuilder
* @see IDocumentIndexStructureBuilder#getRequiredRemoteCallFields()
*/
public void setIndexStructureBuilder(IDocumentIndexStructureBuilder indexStructureBuilder);
/**
* Get keys of all Spaces in configured remote system.
*
* @return list of remote system Space keys
* @throws Exception
*/
public abstract List<String> getAllSpaces() throws Exception;
/**
* Get list of documents from remote system and parse them into <code>Map of Maps</code> structure. Documents MUST BE
* ascending ordered by date of last update. List is limited to only some number of documents (given by both remote
* system and this client configuration).
*
* @param spaceKey mandatory key of Space to get documents for
* @param startAt the index of the first issue to return (0-based)
* @param updatedAfter optional parameter to return documents updated only after given date.
* @return List of document informations parsed from remote system reply into <code>Map of Maps</code> structure.
* @throws Exception
*/
public abstract ChangedDocumentsResults getChangedDocuments(String spaceKey, int startAt, Date updatedAfter)
throws Exception;
/**
* Get actual index structure builder.
*
* @return actual index structure builder
*/
public IDocumentIndexStructureBuilder getIndexStructureBuilder();
}