Project

General

Profile

1
package eu.dnetlib.data.objectstore.modular.connector;
2

    
3
import java.io.InputStream;
4

    
5
import eu.dnetlib.data.objectstore.modular.ObjectStoreRecord;
6
import eu.dnetlib.data.objectstore.rmi.MetadataObjectRecord;
7
import eu.dnetlib.data.objectstore.rmi.ObjectStoreFile;
8
import eu.dnetlib.data.objectstore.rmi.ObjectStoreServiceException;
9
import eu.dnetlib.enabling.resultset.ResultSetListener;
10

    
11
/**
12
 * The Interface ObjectStore.
13
 */
14
public interface ObjectStore {
15

    
16
	/**
17
	 * Gets the id of the objectStore.
18
	 *
19
	 * @return the id
20
	 */
21
	String getId();
22

    
23
	/**
24
	 * Gets the interpretation the objectStore.
25
	 *
26
	 * @return the interpretation
27
	 */
28
	String getInterpretation();
29

    
30
	/**
31
	 * Feed record into the objectstore.
32
	 *
33
	 * @param records
34
	 *            the records
35
	 * @param incremental
36
	 *            the incremental
37
	 * @return the int
38
	 */
39
	int feed(Iterable<ObjectStoreRecord> records, boolean incremental) throws ObjectStoreServiceException;
40

    
41
	/**
42
	 * Feed metadata record into the objectStore.
43
	 *
44
	 * @param records
45
	 *            the records
46
	 * @param incremental
47
	 *            the incremental
48
	 * @return the int
49
	 */
50
	int feedMetadataRecord(Iterable<MetadataObjectRecord> records, boolean incremental) throws ObjectStoreServiceException;
51

    
52
	/**
53
	 * Feed a single object record into the objectStore.
54
	 *
55
	 * @param record
56
	 *            the record
57
	 * @return the string
58
	 */
59
	String feedObjectRecord(ObjectStoreRecord record) throws ObjectStoreServiceException;
60

    
61
	/**
62
	 * Deliver Object from the objectStore.
63
	 *
64
	 * @param from
65
	 *            : start date which you want to filter
66
	 * @param until
67
	 *            : end date which you want to filter
68
	 * @return the result set listener
69
	 */
70
	ResultSetListener deliver(Long from, Long until) throws ObjectStoreServiceException;
71

    
72
	/**
73
	 * Deliver ids.
74
	 *
75
	 * @param ids
76
	 *            the ids
77
	 * @return the result set listener
78
	 */
79
	ResultSetListener deliverIds(Iterable<String> ids) throws ObjectStoreServiceException;
80

    
81
	/**
82
	 * Deliver object.
83
	 *
84
	 * @param objectId
85
	 *            the object id
86
	 * @return the object store file
87
	 * @throws ObjectStoreServiceException
88
	 */
89
	ObjectStoreFile deliverObject(String objectId) throws ObjectStoreServiceException;
90

    
91
	/**
92
	 * Deliver stream.
93
	 *
94
	 * @param objectId
95
	 *            the object id
96
	 * @return the input stream
97
	 */
98
	InputStream deliverStream(String objectId) throws ObjectStoreServiceException;
99

    
100
	/**
101
	 * Gets the size.
102
	 *
103
	 * @return the size
104
	 */
105
	int getSize() throws ObjectStoreServiceException;
106

    
107
	/**
108
	 * Delete object.
109
	 *
110
	 * @param objectId
111
	 *            the object id
112
	 */
113
	void deleteObject(String objectId) throws ObjectStoreServiceException;
114

    
115
	/**
116
	 * Gets the object.
117
	 *
118
	 * @param recordId
119
	 *            the record id
120
	 * @return the object
121
	 */
122
	String getObject(String recordId) throws ObjectStoreServiceException;
123

    
124
	/**
125
	 * Find if exist an ID startingwith the string startId.
126
	 *
127
	 * @param startId
128
	 *            the start id
129
	 * @return if exist or less an id
130
	 */
131
	boolean existIDStartsWith(String startId) throws ObjectStoreServiceException;
132

    
133
	/**
134
	 * drop the content of the ObjectStore
135
	 * THIS METHOD DELETE ALL THE CONTENT INSIDE THE OBJECTSTORE PAY ATTENTION WHEN YOU CALL IT
136
	 *
137
	 * @return if the content has been refreshed
138
	 * @throws ObjectStoreServiceException
139
	 */
140
	boolean dropContent() throws ObjectStoreServiceException;
141

    
142
}
(1-1/2)