1
|
package eu.dnetlib.msro.openaireplus.workflows.nodes.objectStore;
|
2
|
|
3
|
import java.io.File;
|
4
|
|
5
|
import eu.dnetlib.data.objectstore.rmi.ObjectStoreFile;
|
6
|
import eu.dnetlib.data.objectstore.rmi.Protocols;
|
7
|
|
8
|
public class PUMAIteratorRepository extends IteratorRepository {
|
9
|
|
10
|
public PUMAIteratorRepository(final Iterable<File> input, final String repositoryPrefix, final String oaiPrefix) {
|
11
|
super(input, repositoryPrefix, oaiPrefix);
|
12
|
// TODO Auto-generated constructor stub
|
13
|
}
|
14
|
|
15
|
@Override
|
16
|
String generateNextElement() {
|
17
|
try {
|
18
|
String inputname = input.next().getCanonicalPath();
|
19
|
String[] values = inputname.split("/");
|
20
|
if (values.length > 1) {
|
21
|
ObjectStoreFile info = new ObjectStoreFile();
|
22
|
String fileName = values[values.length - 1].replace(".pdf", "");
|
23
|
info.setAccessProtocol(Protocols.None);
|
24
|
info.setObjectID(fileName);
|
25
|
info.setDownloadedURL(" ");
|
26
|
info.setMimeType("pdf");
|
27
|
info.setURI(inputname);
|
28
|
return info.toJSON();
|
29
|
}
|
30
|
} catch (Exception e) {
|
31
|
return null;
|
32
|
}
|
33
|
return null;
|
34
|
}
|
35
|
|
36
|
}
|