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 all the object in the object Store connected with a metadata Identifier
87
	 *
88
	 * @param metadataId
89
	 * @return
90
	 * @throws ObjectStoreServiceException
91
	 */
92

    
93

    
94
	ObjectStoreFile deliverObjectFromMetadataIdentifier(final String metadataId) throws ObjectStoreServiceException;
95

    
96

    
97

    
98
	/**
99
	 * Deliver stream.
100
	 *
101
	 * @param objectId the object id
102
	 * @return the input stream
103
	 */
104
	InputStream deliverStream(String objectId) throws ObjectStoreServiceException;
105

    
106
	boolean alreadyExist(final String objectId);
107

    
108
	/**
109
	 * Gets the size.
110
	 *
111
	 * @return the size
112
	 */
113
	int getSize() throws ObjectStoreServiceException;
114

    
115
	/**
116
	 * Delete object.
117
	 *
118
	 * @param objectId the object id
119
	 */
120
	void deleteObject(String objectId) throws ObjectStoreServiceException;
121

    
122
	/**
123
	 * Gets the object.
124
	 *
125
	 * @param recordId the record id
126
	 * @return the object
127
	 */
128
	ObjectStoreFile getObject(String recordId) throws ObjectStoreServiceException;
129

    
130
	/**
131
	 * Find if exist an ID startingwith the string startId.
132
	 *
133
	 * @param startId the start id
134
	 * @return if exist or less an id
135
	 */
136
	boolean existIDStartsWith(String startId) throws ObjectStoreServiceException;
137

    
138
	/**
139
	 * drop the content of the ObjectStore
140
	 * THIS METHOD DELETE ALL THE CONTENT INSIDE THE OBJECTSTORE PAY ATTENTION WHEN YOU CALL IT
141
	 *
142
	 * @return if the content has been refreshed
143
	 * @throws ObjectStoreServiceException
144
	 */
145
	boolean dropContent() throws ObjectStoreServiceException;
146

    
147
}
(1-1/2)