Revision 45676
Added by Michele Artini about 7 years ago
ExistDatabase.java | ||
---|---|---|
9 | 9 |
import java.util.ArrayList; |
10 | 10 |
import java.util.Arrays; |
11 | 11 |
import java.util.Date; |
12 |
import java.util.HashSet; |
|
12 | 13 |
import java.util.Iterator; |
13 | 14 |
import java.util.List; |
15 |
import java.util.Set; |
|
14 | 16 |
import java.util.concurrent.locks.Lock; |
15 | 17 |
import java.util.concurrent.locks.ReentrantReadWriteLock; |
18 |
import java.util.stream.Collectors; |
|
16 | 19 |
import java.util.zip.ZipEntry; |
17 | 20 |
import java.util.zip.ZipOutputStream; |
18 | 21 |
|
... | ... | |
36 | 39 |
import org.xmldb.api.modules.CollectionManagementService; |
37 | 40 |
import org.xmldb.api.modules.XPathQueryService; |
38 | 41 |
|
39 |
import eu.dnetlib.enabling.is.DnetInformationServiceException; |
|
40 | 42 |
import eu.dnetlib.enabling.is.DnetInformationServiceProperties; |
41 |
import eu.dnetlib.enabling.is.tools.BulkResourceImporter; |
|
43 |
import eu.dnetlib.enabling.is.tools.ISBulkResourceImporter; |
|
44 |
import eu.dnetlib.exceptions.DnetGenericException; |
|
42 | 45 |
import eu.dnetlib.exceptions.DnetGenericRuntimeException; |
43 | 46 |
import eu.dnetlib.miscutils.datetime.DateUtils; |
44 | 47 |
|
... | ... | |
70 | 73 |
private CollectionManagementService colman; |
71 | 74 |
|
72 | 75 |
@Autowired |
73 |
private BulkResourceImporter bulkImporter; |
|
76 |
private ISBulkResourceImporter bulkImporter;
|
|
74 | 77 |
|
75 | 78 |
@Autowired |
76 | 79 |
private DnetInformationServiceProperties props; |
... | ... | |
109 | 112 |
setColman((CollectionManagementService) getRoot().getService("CollectionManagementService", "1.0")); |
110 | 113 |
|
111 | 114 |
if (!bulkImporter.isInitialized()) { |
112 |
bulkImporter.startImport();
|
|
115 |
bulkImporter.bulkImport();
|
|
113 | 116 |
} |
114 | 117 |
|
115 |
} catch (final XMLDBException | DnetInformationServiceException e) {
|
|
116 |
throw new DnetGenericRuntimeException("cannot open eXist database", e);
|
|
118 |
} catch (final XMLDBException | DnetGenericException e) {
|
|
119 |
throw new DnetGenericRuntimeException("cannot initialize eXist database", e);
|
|
117 | 120 |
} |
118 | 121 |
|
119 | 122 |
running = true; |
... | ... | |
429 | 432 |
* @see eu.dnetlib.enabling.is.store.database.XMLDatabase#list(java.lang.String) |
430 | 433 |
*/ |
431 | 434 |
@Override |
432 |
public List<String> list(final String collection) throws XMLDBException {
|
|
435 |
public Set<String> list(final String collection) throws XMLDBException {
|
|
433 | 436 |
readLock.lock(); |
434 | 437 |
try { |
435 | 438 |
final Collection col = getCollection(collection); |
436 |
if (col == null) { return new ArrayList<>(); }
|
|
437 |
return Arrays.asList(col.listResources());
|
|
439 |
if (col == null) { return new HashSet<>(); }
|
|
440 |
return Arrays.stream(col.listResources()).collect(Collectors.toSet());
|
|
438 | 441 |
} finally { |
439 | 442 |
readLock.unlock(); |
440 | 443 |
} |
Also available in: Unified diff