1
|
package eu.dnetlib.data.objectstore.modular.connector;
|
2
|
|
3
|
import java.io.InputStream;
|
4
|
import java.util.List;
|
5
|
|
6
|
import eu.dnetlib.data.objectstore.modular.ObjectStoreRecord;
|
7
|
import eu.dnetlib.data.objectstore.rmi.MetadataObjectRecord;
|
8
|
import eu.dnetlib.data.objectstore.rmi.ObjectStoreFile;
|
9
|
import eu.dnetlib.data.objectstore.rmi.ObjectStoreServiceException;
|
10
|
import eu.dnetlib.enabling.resultset.ResultSetListener;
|
11
|
import eu.dnetlib.miscutils.collections.Pair;
|
12
|
|
13
|
/**
|
14
|
* The Interface ObjectStore.
|
15
|
*/
|
16
|
public interface ObjectStore {
|
17
|
|
18
|
/**
|
19
|
* Gets the id of the objectStore.
|
20
|
*
|
21
|
* @return the id
|
22
|
*/
|
23
|
String getId();
|
24
|
|
25
|
/**
|
26
|
* Gets the interpretation the objectStore.
|
27
|
*
|
28
|
* @return the interpretation
|
29
|
*/
|
30
|
String getInterpretation();
|
31
|
|
32
|
/**
|
33
|
* Feed record into the objectstore.
|
34
|
*
|
35
|
* @param records
|
36
|
* the records
|
37
|
* @param incremental
|
38
|
* the incremental
|
39
|
* @return the int
|
40
|
* @throws ObjectStoreServiceException
|
41
|
* the object store service exception
|
42
|
*/
|
43
|
int feed(Iterable<ObjectStoreRecord> records, boolean incremental) throws ObjectStoreServiceException;
|
44
|
|
45
|
/**
|
46
|
* Feed metadata record into the objectStore.
|
47
|
*
|
48
|
* @param records
|
49
|
* the records
|
50
|
* @param incremental
|
51
|
* the incremental
|
52
|
* @return the int
|
53
|
* @throws ObjectStoreServiceException
|
54
|
* the object store service exception
|
55
|
*/
|
56
|
int feedMetadataRecord(Iterable<MetadataObjectRecord> records, boolean incremental) throws ObjectStoreServiceException;
|
57
|
|
58
|
/**
|
59
|
* Feed a single object record into the objectStore.
|
60
|
*
|
61
|
* @param record
|
62
|
* the record
|
63
|
* @return the string
|
64
|
* @throws ObjectStoreServiceException
|
65
|
* the object store service exception
|
66
|
*/
|
67
|
String feedObjectRecord(ObjectStoreRecord record) throws ObjectStoreServiceException;
|
68
|
|
69
|
/**
|
70
|
* Deliver Object from the objectStore.
|
71
|
*
|
72
|
* @param from
|
73
|
* : start date which you want to filter
|
74
|
* @param until
|
75
|
* : end date which you want to filter
|
76
|
* @return the result set listener
|
77
|
* @throws ObjectStoreServiceException
|
78
|
* the object store service exception
|
79
|
*/
|
80
|
ResultSetListener deliver(Long from, Long until) throws ObjectStoreServiceException;
|
81
|
|
82
|
/**
|
83
|
* Deliver ids.
|
84
|
*
|
85
|
* @param ids
|
86
|
* the ids
|
87
|
* @return the result set listener
|
88
|
* @throws ObjectStoreServiceException
|
89
|
* the object store service exception
|
90
|
*/
|
91
|
ResultSetListener deliverIds(Iterable<String> ids) throws ObjectStoreServiceException;
|
92
|
|
93
|
/**
|
94
|
* Deliver object.
|
95
|
*
|
96
|
* @param objectId
|
97
|
* the object id
|
98
|
* @return the object store file
|
99
|
* @throws ObjectStoreServiceException
|
100
|
* the object store service exception
|
101
|
*/
|
102
|
ObjectStoreFile deliverObject(String objectId) throws ObjectStoreServiceException;
|
103
|
|
104
|
/**
|
105
|
* Deliver stream.
|
106
|
*
|
107
|
* @param objectId
|
108
|
* the object id
|
109
|
* @return the input stream
|
110
|
* @throws ObjectStoreServiceException
|
111
|
* the object store service exception
|
112
|
*/
|
113
|
InputStream deliverStream(String objectId) throws ObjectStoreServiceException;
|
114
|
|
115
|
/**
|
116
|
* Gets the size.
|
117
|
*
|
118
|
* @return the size
|
119
|
* @throws ObjectStoreServiceException
|
120
|
* the object store service exception
|
121
|
*/
|
122
|
int getSize() throws ObjectStoreServiceException;
|
123
|
|
124
|
/**
|
125
|
* Delete object.
|
126
|
*
|
127
|
* @param objectId
|
128
|
* the object id
|
129
|
* @throws ObjectStoreServiceException
|
130
|
* the object store service exception
|
131
|
*/
|
132
|
void deleteObject(String objectId) throws ObjectStoreServiceException;
|
133
|
|
134
|
/**
|
135
|
* Find if exist an ID starting with the string startId.
|
136
|
*
|
137
|
* @param startId
|
138
|
* the start id
|
139
|
* @return if exist or less an id
|
140
|
* @throws ObjectStoreServiceException
|
141
|
* the object store service exception
|
142
|
*/
|
143
|
boolean existIDStartsWith(String startId) throws ObjectStoreServiceException;
|
144
|
|
145
|
/**
|
146
|
* Tag a set of identifiers with a particular set of tags.
|
147
|
*
|
148
|
* @param ids
|
149
|
* The set of identifiers
|
150
|
* @param tag
|
151
|
* the tag
|
152
|
* @return the number of item tagged
|
153
|
*/
|
154
|
int tagIds(Iterable<String> ids, String tag);
|
155
|
|
156
|
/**
|
157
|
* Remove tha tag from a set of tags to a set of identifiers.
|
158
|
*
|
159
|
* @param ids
|
160
|
* The set of identifiers
|
161
|
* @param tag
|
162
|
* the tag
|
163
|
* @return the number of item untagged
|
164
|
*/
|
165
|
int untagIds(Iterable<String> ids, String tag);
|
166
|
|
167
|
/**
|
168
|
* Tag objectstore.
|
169
|
*
|
170
|
* @param tag
|
171
|
* the tag
|
172
|
* @return the int
|
173
|
*/
|
174
|
int tagObjectstore(final String tag);
|
175
|
|
176
|
/**
|
177
|
* Untag objectstore.
|
178
|
*
|
179
|
* @param tag
|
180
|
* the tag
|
181
|
* @return the int
|
182
|
*/
|
183
|
int untagObjectstore(final String tag);
|
184
|
|
185
|
/**
|
186
|
* Deliver records by tag.
|
187
|
*
|
188
|
* @param tags
|
189
|
* the tags
|
190
|
* @return the string
|
191
|
*/
|
192
|
ResultSetListener deliverRecordsByTag(Iterable<String> tags);
|
193
|
|
194
|
/**
|
195
|
* Lists the tag in the objectStore
|
196
|
*
|
197
|
* @return the list
|
198
|
*/
|
199
|
List<Pair<String, Integer>> listTags();
|
200
|
|
201
|
}
|