Project

General

Profile

1
package eu.dnetlib.data.oai.store;
2

    
3
import java.util.List;
4

    
5
import eu.dnetlib.data.information.oai.publisher.OaiPublisherException;
6

    
7
public interface PublisherStoreDAO<X extends PublisherStore<T>, T extends Cursor> {
8

    
9
	/**
10
	 * Lists all PublisherStore.
11
	 * 
12
	 * @param dbName
13
	 *            name of the target database
14
	 * 
15
	 * @return a List of PublisherStore instances.
16
	 */
17
	List<X> listPublisherStores(final String dbName);
18

    
19
	/**
20
	 * Gets the store with the given identifier.
21
	 * 
22
	 * @param dbName
23
	 *            name of the target database
24
	 * 
25
	 * @param storeId
26
	 *            identifier of the store to retrieve
27
	 * @return a PublisherStore instance or null if there is no store with the given id.
28
	 */
29
	X getStore(final String storeId, final String dbName);
30

    
31
	/**
32
	 * Gets the store with the given properties.
33
	 * 
34
	 * @param mdfName
35
	 *            name of the metadata format
36
	 * @param mdfInterpretation
37
	 *            name of the metadata interpretation
38
	 * @param mdfLayout
39
	 *            name of the metadata layout
40
	 * @param dbName
41
	 *            name of the target database
42
	 * @return a PublisherStore instance or null if there is no store with the given properties.
43
	 */
44
	X getStore(final String mdfName, final String mdfInterpretation, final String mdfLayout, final String dbName);
45

    
46
	/**
47
	 * Gets the store to be used as source to deliver records with the given metadata prefix.
48
	 * 
49
	 * @param targetMetadataPrefix
50
	 *            prefix of the metadata format deliverable through this store
51
	 * @param dbName
52
	 *            name of the target database
53
	 * @return a PublisherStore instance or null if there is no store serving the given metadata prefix.
54
	 */
55
	X getStoreFor(final String targetMetadataPrefix, final String dbName);
56

    
57
	/**
58
	 * Create a PublisherStore with the given properties.
59
	 * 
60
	 * @param mdfName
61
	 *            name of the metadata format
62
	 * @param mdfInterpretation
63
	 *            name of the metadata interpretation
64
	 * @param mdfLayout
65
	 *            name of the metadata layout
66
	 * @param dbName
67
	 *            name of the target database
68
	 * @return a PublisherStore instance whose identifier is automatically generated.
69
	 * @throws OaiPublisherException
70
	 *             if there is already another PublisherStore with the given metadata format name, layout and interpretation.
71
	 */
72
	X createStore(final String mdfName, final String mdfInterpretation, final String mdfLayout, final String dbName) throws OaiPublisherException;
73

    
74
	/**
75
	 * Deletes the store with the given identifier.
76
	 * 
77
	 * @param storeId
78
	 *            id of the store to delete
79
	 * @param dbName
80
	 *            name of the target database
81
	 * @return true if the store was deleted successfully, false otherwise (e.g., a store with the given id does not exist).
82
	 */
83
	boolean deleteStore(final String storeId, final String dbName);
84

    
85
	/**
86
	 * Deletes from the store with the given identifier the records belonging to the given set.
87
	 * 
88
	 * @param storeId
89
	 *            id of the store to delete
90
	 * @param dbName
91
	 *            name of the target database
92
	 * @param set
93
	 *            name of the set
94
	 * @return true if the records were deleted successfully, false otherwise (e.g., a store with the given id does not exist).
95
	 */
96
	boolean deleteFromStore(final String storeId, final String dbName, final String set);
97

    
98
	/**
99
	 * Deletes from the store with the given identifier the records belonging to the given set.
100
	 * 
101
	 * @param mdfName
102
	 *            name of the metadata format
103
	 * @param mdfInterpretation
104
	 *            name of the metadata interpretation
105
	 * @param mdfLayout
106
	 *            name of the metadata layout
107
	 * @param dbName
108
	 *            name of the target database
109
	 * @param set
110
	 *            name of the set
111
	 * @return true if the records were deleted successfully, false otherwise (e.g., a store with the given id does not exist).
112
	 */
113
	boolean deleteFromStore(final String mdfName, final String mdfInterpretation, final String mdfLayout, final String dbName, final String set);
114

    
115
	/**
116
	 * Deletes the store with the given properties.
117
	 * 
118
	 * @param mdfName
119
	 *            name of the metadata format
120
	 * @param mdfInterpretation
121
	 *            name of the metadata interpretation
122
	 * @param mdfLayout
123
	 *            name of the metadata layout
124
	 * @param dbName
125
	 *            name of the target database
126
	 * @return true if the store was deleted successfully, false otherwise (e.g., a store with the given properties does not exist).
127
	 */
128
	boolean deleteStore(final String mdfName, final String mdfInterpretation, final String mdfLayout, final String dbName);
129

    
130
}
(5-5/6)