@Override public String getSource() { return fileDelegate.getSource(); }
public T fromDcp(Dcp dcp) throws DcpMappingException { DcsDeliverableUnit statedu = getCurrentStateDu(dcp); if (statedu == null) { throw new DcpMappingException( "Could not find state DcsDeliverableUnit"); } DcsManifestation man = getFirstManifestationOf(dcp, statedu, STATE_MANIFESTATION_TYPE); if (man == null) { throw new DcpMappingException( "Could not find state DcsManifestation"); } DcsFile file = getFirstFileOf(dcp, man); if (file == null) { throw new DcpMappingException("Could not find needed state DcsFile"); } try { InputStream is = new URL(file.getSource()).openStream(); T result = deserializeObjectState(is); is.close(); return result; } catch (Exception e) { throw new DcpMappingException("Error mapping content from " + file.getSource(), e); } }
@Override public DataFile fromDcp(Dcp dcp) throws DcpMappingException { DataFile df = super.fromDcp(dcp); if (df == null) { throw new DcpMappingException("Unable to map DataFile from DCP: " + dcp); } DcsFile source = boSearcher.findDataFile(df.getId()); if (source != null) { df.setSource(source.getSource()); df.setSize(source.getSizeBytes()); df.setPath(source.getSource()); } return df; }
final String source = file.getSource(); Resource r = ResourceResolverUtil.resolveFileSource(source); InputStream is = r.getInputStream(); } catch (Exception e) { log.error("Exception reading registry entry source {}: {}", new Object[] { (file.getSource() == null) ? null : file.getSource(), e }); return null;
Resource r = ResourceResolverUtil.resolveFileSource(file.getSource());
Resource r = ResourceResolverUtil.resolveFileSource(file.getSource());
Resource fileSource = ResourceResolverUtil.resolveFileSource(file.getSource()); InputStream is = fileSource.getInputStream(); DcsMetadataFormat format = (DcsMetadataFormat) xstream.fromXML(is);
Resource fileSource = ResourceResolverUtil.resolveFileSource(file.getSource()); InputStream is = fileSource.getInputStream(); DcsMetadataFormat format = (DcsMetadataFormat) xstream.fromXML(is);
eStore.put(file.getId(), new ByteArrayInputStream(out.toByteArray())); mStore.add(file.getId(), FILE.toString(), file.getSource());
eStore.put(file.getId(), new ByteArrayInputStream(out.toByteArray())); mStore.add(file.getId(), FILE.toString(), file.getSource());
InputStream is = new URL(file.getSource()).openStream(); String upload_id = connector.uploadFile(is, -1); is.close();
/** * Copy constructor for a DcsFile. The state of <code>toCopy</code> is copied * to this. * * @param toCopy the dcs file to copy */ public DcsFile(DcsFile toCopy) { super(toCopy); this.name = toCopy.getName(); this.extant = toCopy.isExtant(); this.sizeBytes = toCopy.getSizeBytes(); this.fixity = toCopy.getFixity(); this.formats = toCopy.getFormats(); this.source = toCopy.getSource(); this.valid = toCopy.getValid(); this.metadata = toCopy.getMetadata(); this.metadataRef = toCopy.getMetadataRef(); }
metadataFile.setSource(file.getSource());
private static SolrInputDocument toSolr(DcsFile file, ArchiveStore store) throws IOException { SolrInputDocument doc = new SolrInputDocument(); add(doc, EntityField.ID, file.getId()); add(doc, EntityField.TYPE, EntityTypeValue.FILE.solrValue()); add(doc, FileField.NAME, file.getName()); add(doc, FileField.SOURCE, file.getSource()); add(doc, FileField.SIZE, file.getSizeBytes()); if (file.getValid() != null) { doc.addField(FileField.VALID.solrName(), file.getValid()); } doc.addField(FileField.EXTANT.solrName(), file.isExtant()); addFixitySet(doc, file.getFixity()); addFormatSet(doc, file.getFormats()); addResourceIdentifierSet(doc, file.getAlternateIds()); addMetadataSet(doc, file.getMetadata()); addMetadataRefSet(doc, file.getMetadataRef(), EntityField.METADATA_REF, store); return doc; }