Project

General

Profile

1
package eu.dnetlib.oai;
2

    
3
import java.util.List;
4

    
5
import eu.dnetlib.rmi.provision.OaiPublisherException;
6

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

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

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

    
26
	/**
27
	 * Gets the store with the given properties.
28
	 *
29
	 * @param mdfName           name of the metadata format
30
	 * @param mdfInterpretation name of the metadata interpretation
31
	 * @param mdfLayout         name of the metadata layout
32
	 * @param dbName            name of the target database
33
	 * @return a PublisherStore instance or null if there is no store with the given properties.
34
	 */
35
	X getStore(final String mdfName, final String mdfInterpretation, final String mdfLayout, final String dbName);
36

    
37
	/**
38
	 * Gets the store to be used as source to deliver records with the given metadata prefix.
39
	 *
40
	 * @param targetMetadataPrefix prefix of the metadata format deliverable through this store
41
	 * @param dbName               name of the target database
42
	 * @return a PublisherStore instance or null if there is no store serving the given metadata prefix.
43
	 */
44
	X getStoreFor(final String targetMetadataPrefix, final String dbName);
45

    
46
	/**
47
	 * Create a PublisherStore with the given properties.
48
	 *
49
	 * @param mdfName           name of the metadata format
50
	 * @param mdfInterpretation name of the metadata interpretation
51
	 * @param mdfLayout         name of the metadata layout
52
	 * @param dbName            name of the target database
53
	 * @return a PublisherStore instance whose identifier is automatically generated.
54
	 * @throws OaiPublisherException if there is already another PublisherStore with the given metadata format name, layout and interpretation.
55
	 */
56
	X createStore(final String mdfName, final String mdfInterpretation, final String mdfLayout, final String dbName) throws OaiPublisherException;
57

    
58
	/**
59
	 * Deletes the store with the given identifier.
60
	 *
61
	 * @param storeId id of the store to delete
62
	 * @param dbName  name of the target database
63
	 * @return true if the store was deleted successfully, false otherwise (e.g., a store with the given id does not exist).
64
	 */
65
	boolean deleteStore(final String storeId, final String dbName);
66

    
67
	/**
68
	 * Deletes from the store with the given identifier the records belonging to the given set.
69
	 *
70
	 * @param storeId id of the store to delete
71
	 * @param dbName  name of the target database
72
	 * @param set     name of the set
73
	 * @return true if the records were deleted successfully, false otherwise (e.g., a store with the given id does not exist).
74
	 */
75
	boolean deleteFromStore(final String storeId, final String dbName, final String set);
76

    
77
	/**
78
	 * Deletes from the store with the given identifier the records belonging to the given set.
79
	 *
80
	 * @param mdfName           name of the metadata format
81
	 * @param mdfInterpretation name of the metadata interpretation
82
	 * @param mdfLayout         name of the metadata layout
83
	 * @param dbName            name of the target database
84
	 * @param set               name of the set
85
	 * @return true if the records were deleted successfully, false otherwise (e.g., a store with the given id does not exist).
86
	 */
87
	boolean deleteFromStore(final String mdfName, final String mdfInterpretation, final String mdfLayout, final String dbName, final String set);
88

    
89
	/**
90
	 * Deletes the store with the given properties.
91
	 *
92
	 * @param mdfName           name of the metadata format
93
	 * @param mdfInterpretation name of the metadata interpretation
94
	 * @param mdfLayout         name of the metadata layout
95
	 * @param dbName            name of the target database
96
	 * @return true if the store was deleted successfully, false otherwise (e.g., a store with the given properties does not exist).
97
	 */
98
	boolean deleteStore(final String mdfName, final String mdfInterpretation, final String mdfLayout, final String dbName);
99

    
100
}
(12-12/13)