public List<ArchiveDepositInfo> listDepositInfo(String object_id, Status status) throws ArchiveServiceException { return archive_service.listDepositInfo(object_id, status); }
/** * This method polls for a collection and waits for it to transition from a * PENDING state. It then returns the new state. If the collection * remains in a PENDING state after a configured amount of time, it returns * PENDING. * * @param depositId the deposit id of the collection to poll for. * @return the status of the collection after either waiting a specified * time or the collection leaves a PENDING state. * @throws ArchiveServiceException */ private Status pollAndWaitForCollection(String depositId) throws ArchiveServiceException { Status collectionStatus = Status.PENDING; long sleepInterval; int count = 0; while (collectionStatus == Status.PENDING && count < POLL_COUNT) { sleepInterval = count * POLL_DELAY_FACTOR_MS; try{ Thread.sleep(sleepInterval); } catch (InterruptedException e) { // ignore } archiveService.pollArchiveByDepositId(depositId); collectionStatus = archiveService.getDepositStatus(depositId); ++count; } return collectionStatus; }
public String deposit(String deposit_id, DataItem ds) throws ArchiveServiceException { return archive_service.deposit(deposit_id, ds); }
public void bootstrapFormats() { Iterator<RegistryEntry<DcsMetadataFormat>> iter = memoryRegistry.iterator(); while(iter.hasNext()) { try { archiveService.deposit(iter.next()); } catch (ArchiveServiceException e) { throw new RuntimeException(e); } } try { archiveService.pollArchive(); } catch (ArchiveServiceException e) { throw new RuntimeException(e); } } }
@Override public Collection getCollection(String id) throws BizInternalException { Collection collection = new Collection(); Collection c = null; //attempt to get the collection object from the archive service try { List<ArchiveDepositInfo> archiveDepositInfo = archiveService.listDepositInfo(id, ArchiveDepositInfo.Status.DEPOSITED); if (archiveDepositInfo != null && !archiveDepositInfo.isEmpty()) { ArchiveSearchResult<Collection> results = archiveService.retrieveCollection(archiveDepositInfo.get(0).getDepositId()); Iterator<Collection> resultIter = results.getResults().iterator(); if (resultIter.hasNext()) { c = resultIter.next(); } } } catch (ArchiveServiceException e) { throw new BizInternalException("Error retrieving collection with id " + id + " from the archive service", e); } if (c != null) { collection = c; return collection; } else { return null; } }
@Override public DataItem getDataItem(String businessId) throws ArchiveServiceException, BizPolicyException { List<DataItem> result = new ArrayList<DataItem>(); for (ArchiveDepositInfo info : archiveService.listDepositInfo(businessId, Status.DEPOSITED)) { ArchiveSearchResult<DataItem> sr = archiveService.retrieveDataSet(info.getDepositId()); for (DataItem ds : sr.getResults()) { result.add(ds); } } if (result.size() == 0) { return null; } else { // returning the first version of the DataItem. return result.get(0); } }
private ArchiveDepositInfo.Status retrieveDepositStatus(DataItem dataItem) throws ArchiveServiceException { if (dataItem == null) { return null; } archiveService.pollArchiveByBusinessId(dataItem.getId()); List<ArchiveDepositInfo> infoList = archiveService.listDepositInfo(dataItem.getId(), null); if (infoList == null || infoList.isEmpty()) { return null; } return infoList.get(0).getDepositStatus(); }
adi = archiveService.listDepositInfo(parent.getId(), ArchiveDepositInfo.Status.DEPOSITED); } catch (ArchiveServiceException e) { log.warn("Failed to get archive deposit info for metadata file parent " + parent.getId()); dataItemAdi = archiveService.listDepositInfo(containingDataItem.getId(), ArchiveDepositInfo.Status.DEPOSITED); } catch (ArchiveServiceException e) { log.warn("Failed to get deposit info for Data Item " + containingDataItem.getId()); archiveService.deposit(parentDepositId, file); relationshipService.addMetadataFileToBusinessObject(file.getId(), parent.getId()); } catch(ArchiveServiceException ase) {
private DataItem retrieveDataSet(String id) throws ArchiveServiceException { DataItem di = null; archiveService.pollArchiveByBusinessId(id); List<ArchiveDepositInfo> info = archiveService.listDepositInfo(id, Status.DEPOSITED); if (!info.isEmpty()) { ArchiveSearchResult<DataItem> sr = null; sr = archiveService .retrieveDataSet(info.get(0).getDepositId()); if (sr != null && sr.getResults().iterator().hasNext()) { di = sr.getResults().iterator().next(); } } return di; }
private Collection retrieveCollection(String id) throws ArchiveServiceException { Collection col = null; archiveService.pollArchiveByBusinessId(id); List<ArchiveDepositInfo> info = archiveService.listDepositInfo(id, Status.DEPOSITED); if (!info.isEmpty()) { ArchiveSearchResult<Collection> sr = null; sr = archiveService .retrieveCollection(info.get(0).getDepositId()); if (sr != null && sr.getResults().iterator().hasNext()) { col = sr.getResults().iterator().next(); } } return col; }
public MetadataFile retrieveMetadataFile(String id) throws ArchiveServiceException { MetadataFile mf = null; try { archiveService.pollArchiveByBusinessId(id); } catch (ArchiveMissingRecordException e) { //File couldn't be found when trying to poll archive so return null sicne it's seemingly doesn't exist. return mf; } List<ArchiveDepositInfo> info = archiveService.listDepositInfo(id, Status.DEPOSITED); if (!info.isEmpty()) { ArchiveSearchResult<MetadataFile> sr = null; final ArchiveDepositInfo mdfAdi = info.get(0); if (mdfAdi.getObjectType() != ArchiveDepositInfo.Type.METADATA_FILE) { // the id didn't specify a metadata file. return mf; } sr = archiveService .retrieveMetadataFile(mdfAdi.getDepositId()); if (sr != null && sr.getResults().iterator().hasNext()) { mf = sr.getResults().iterator().next(); } } return mf; }
String depositID = archiveService.deposit(newFormatRegistryEntry); archiveService.pollArchiveByDepositId(depositID); Status entryStatus = archiveService.getDepositStatus(depositID); int count = 0; archiveService.pollArchiveByDepositId(depositID); entryStatus = archiveService.getDepositStatus(depositID); ++count;
MetadataFile mf = unwrap(archive_service.retrieveMetadataFile(deposit_id)); result.getChildren().add(generateMap(mf, alternate_id_map, waitForPendingObjects)); } else { if (deposit_id != null) { Collection sub_col = unwrap(archive_service .retrieveCollection(deposit_id)); result.getChildren().add(generateMap(sub_col, alternate_id_map, waitForPendingObjects)); } else { .retrieveDataSetsForCollection(deposit_id, -1, 0);
archiveCollections = archiveService.listCollections(Status.DEPOSITED); } catch (ArchiveServiceException e) { log.warn("Error listing collections"); for (String collectionID : archiveCollections) { try { ArchiveSearchResult<Collection> result = archiveService.retrieveCollection(collectionID);
@Override public DataItemTransport retrieveDataItemTransport(String dataItemId) throws ArchiveServiceException, BizPolicyException { DataItemTransport dataItemTransport = null; this.archiveService.pollArchiveByBusinessId(dataItemId); ArchiveSearchResult<DataItem> dataItemSearchResult = this.archiveService.retrieveDataSet(this.getDepositId(dataItemId)); if (dataItemSearchResult != null && !dataItemSearchResult.getResults().isEmpty()) { DataItem dataItem = (DataItem) dataItemSearchResult.getResults().toArray()[0]; dataItemTransport = this.createDataItemTransport(dataItem); } return dataItemTransport; }
public ArchiveSearchResult<DataItem> retrieveDataSetsForCollection(String collection_id, int numberOfResults, int offset) throws ArchiveServiceException { return archive_service.retrieveDataSetsForCollection(collection_id, numberOfResults, offset); }
public Status getDepositStatus(String deposit_id) { return archive_service.getDepositStatus(deposit_id); }
public void pollArchiveByBusinessId(String businessId) throws ArchiveServiceException { archive_service.pollArchiveByBusinessId(businessId); }
public ArchiveSearchResult<DataItem> retrieveDataSet(String deposit_id) throws ArchiveServiceException { return archive_service.retrieveDataSet(deposit_id); }
public ArchiveSearchResult<Collection> retrieveCollection(String deposit_id) throws ArchiveServiceException { return archive_service.retrieveCollection(deposit_id); }