Project

General

Profile

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

    
3
import java.io.InputStream;
4
import java.util.List;
5

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

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

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

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

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

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

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

    
57
	/**
58
	 * Deliver Object from the objectStore.
59
	 *
60
	 * @param from  : start date which you want to filter
61
	 * @param until : end date which you want to filter
62
	 * @return the result set listener
63
	 */
64
	ResultSetListener<ObjectStoreFile> deliver(Long from, Long until) throws ObjectStoreServiceException;
65

    
66
	List<ObjectStoreFile> retrieveObjects(final int page, final int pageSize);
67

    
68
	/**
69
	 * Deliver ids.
70
	 *
71
	 * @param ids the ids
72
	 * @return the result set listener
73
	 */
74
	ResultSetListener<ObjectStoreFile> deliverIds(Iterable<String> ids) throws ObjectStoreServiceException;
75

    
76
	/**
77
	 * Deliver object.
78
	 *
79
	 * @param objectId the object id
80
	 * @return the object store file
81
	 * @throws ObjectStoreServiceException
82
	 */
83
	ObjectStoreFile deliverObject(String objectId) throws ObjectStoreServiceException;
84

    
85
	/**
86
	 * Deliver stream.
87
	 *
88
	 * @param objectId the object id
89
	 * @return the input stream
90
	 */
91
	InputStream deliverStream(String objectId) throws ObjectStoreServiceException;
92

    
93
	/**
94
	 * Gets the size.
95
	 *
96
	 * @return the size
97
	 */
98
	int getSize() throws ObjectStoreServiceException;
99

    
100
	/**
101
	 * Delete object.
102
	 *
103
	 * @param objectId the object id
104
	 */
105
	void deleteObject(String objectId) throws ObjectStoreServiceException;
106

    
107
	/**
108
	 * Gets the object.
109
	 *
110
	 * @param recordId the record id
111
	 * @return the object
112
	 */
113
	ObjectStoreFile getObject(String recordId) throws ObjectStoreServiceException;
114

    
115
	/**
116
	 * Find if exist an ID startingwith the string startId.
117
	 *
118
	 * @param startId the start id
119
	 * @return if exist or less an id
120
	 */
121
	boolean existIDStartsWith(String startId) throws ObjectStoreServiceException;
122

    
123
	/**
124
	 * drop the content of the ObjectStore
125
	 * THIS METHOD DELETE ALL THE CONTENT INSIDE THE OBJECTSTORE PAY ATTENTION WHEN YOU CALL IT
126
	 *
127
	 * @return if the content has been refreshed
128
	 * @throws ObjectStoreServiceException
129
	 */
130
	boolean dropContent() throws ObjectStoreServiceException;
131

    
132
}
(1-1/2)