/** * Constructs a new identification request. * @param metaData the metaData about the binary. * @param identifier the request's identifier */ public FileSystemIdentificationRequest(final RequestMetaData metaData, final RequestIdentifier identifier) { this.identifier = identifier; requestMetaData = metaData; size = metaData.getSize(); fileName = metaData.getName(); extension = ResourceUtils.getExtension(fileName); }
/** * @param metaData the request meta data * @param identifier the request identifier * @param tempDir the location to write temp files. */ public WebArchiveEntryIdentificationRequest(RequestMetaData metaData, RequestIdentifier identifier, File tempDir) { this.identifier = identifier; this.size = metaData.getSize(); this.fileName = metaData.getName(); this.extension = ResourceUtils.getExtension(fileName); this.tempDir = tempDir; this.requestMetaData = metaData; }
/** * Constructs a new identification request. * @param metaData the metaData about the binary. * @param identifier the request's identifier */ public FileSystemIdentificationRequest(final RequestMetaData metaData, final RequestIdentifier identifier) { this.identifier = identifier; requestMetaData = metaData; size = metaData.getSize(); fileName = metaData.getName(); extension = ResourceUtils.getExtension(fileName); }
/** * * @param metaData m * @param identifier i * @param tempDirLocation t */ public SevenZipEntryIdentificationRequest(RequestMetaData metaData, RequestIdentifier identifier, File tempDirLocation) { this.identifier = identifier; this.requestMetaData = metaData; this.size = requestMetaData.getSize(); this.tempDir = tempDirLocation; fileName = metaData.getName(); extension = ResourceUtils.getExtension(fileName); }
/** * @param metaData the request meta data * @param identifier the request identifier * @param tempDir the location to write temp files. */ public WebArchiveEntryIdentificationRequest(RequestMetaData metaData, RequestIdentifier identifier, Path tempDir) { this.identifier = identifier; this.size = metaData.getSize(); this.fileName = metaData.getName(); this.extension = ResourceUtils.getExtension(fileName); this.tempDir = tempDir; this.requestMetaData = metaData; }
/** * * @param metaData m * @param identifier i * @param tempDirLocation t */ public SevenZipEntryIdentificationRequest(final RequestMetaData metaData, final RequestIdentifier identifier, final Path tempDirLocation) { this.identifier = identifier; this.requestMetaData = metaData; this.size = requestMetaData.getSize(); this.tempDir = tempDirLocation; fileName = metaData.getName(); extension = ResourceUtils.getExtension(fileName); }
/** * @param requestMetaData requestMetaData. * @param identifier RequestIdentifier. * @param tempDir Fat files are read into buffer and written to temp file. */ public FatFileIdentificationRequest(RequestMetaData requestMetaData, RequestIdentifier identifier, final Path tempDir) { this.requestMetaData = requestMetaData; this.identifier = identifier; size = requestMetaData.getSize(); fileName = requestMetaData.getName(); this.tempDir = tempDir; extension = ResourceUtils.getExtension(fileName); }
/** * Constructs a new Tar file resource. * @param metaData the request meta data * @param identifier the request identifier * @param tempDir the location to write temp files. */ public TarEntryIdentificationRequest(final RequestMetaData metaData, final RequestIdentifier identifier, final Path tempDir) { this.identifier = identifier; size = metaData.getSize(); fileName = metaData.getName(); extension = ResourceUtils.getExtension(fileName); this.tempDir = tempDir; this.requestMetaData = metaData; }
/** * Constructs a new Tar file resource. * @param metaData the request meta data * @param identifier the request identifier * @param tempDir the location to write temp files. */ public TarEntryIdentificationRequest(RequestMetaData metaData, RequestIdentifier identifier, File tempDir) { this.identifier = identifier; size = metaData.getSize(); fileName = metaData.getName(); extension = ResourceUtils.getExtension(fileName); this.tempDir = tempDir; this.requestMetaData = metaData; }
/** * Constructs a new Zip file resource. * @param metaData meta data about the request * @param identifier request identifier * @param tempDir the location to write temp files. */ public ZipEntryIdentificationRequest(RequestMetaData metaData, RequestIdentifier identifier, File tempDir) { this.identifier = identifier; this.size = metaData.getSize(); this.fileName = metaData.getName(); this.extension = ResourceUtils.getExtension(fileName); this.tempDir = tempDir; this.requestMetaData = metaData; }
/** * Constructs a new Zip file resource. * @param metaData meta data about the request * @param identifier request identifier * @param tempDir the location to write temp files. */ public ZipEntryIdentificationRequest(final RequestMetaData metaData, final RequestIdentifier identifier, final Path tempDir) { this.identifier = identifier; this.size = metaData.getSize(); this.fileName = metaData.getName(); this.extension = ResourceUtils.getExtension(fileName); this.tempDir = tempDir; this.requestMetaData = metaData; }
/** * Create new identification request instance. * @param requestMetaData a * @param identifier a * @param tempDir a */ public ISOImageIdentificationRequest(RequestMetaData requestMetaData, RequestIdentifier identifier, File tempDir) { this.fileName = requestMetaData.getName(); this.extension = ResourceUtils.getExtension(fileName); this.requestMetaData = requestMetaData; this.identifier = identifier; this.requestMetaData.getSize(); this.tempDir = tempDir; this.size = requestMetaData.getSize(); if (size < 0) { throw new IllegalArgumentException("Size can't be bellow zero."); } }
public InputStreamIdentificationRequest(RequestMetaData metaData, RequestIdentifier identifier, InputStream in) { this.metaData = metaData; this.fileName = metaData.getName(); this.extension = ResourceUtils.getExtension(fileName); this.identifier = identifier; try { this.size = in.available(); } catch (IOException e) { e.printStackTrace(); } // Init the reader: this.isReader = new InputStreamByteReader(new CloseShieldInputStream(in)); }
/** * Create new identification request instance. * @param requestMetaData a * @param identifier a * @param tempDir a */ public RarIdentificationRequest(final RequestMetaData requestMetaData, final RequestIdentifier identifier, final Path tempDir) { this.fileName = requestMetaData.getName(); this.extension = ResourceUtils.getExtension(fileName); this.requestMetaData = requestMetaData; this.identifier = identifier; this.requestMetaData.getSize(); this.tempDir = tempDir; this.size = requestMetaData.getSize(); }
/** * Create new identification request instance. * @param requestMetaData a * @param identifier a * @param tempDir a */ public ISOImageIdentificationRequest(final RequestMetaData requestMetaData, final RequestIdentifier identifier, final Path tempDir) { this.fileName = requestMetaData.getName(); this.extension = ResourceUtils.getExtension(fileName); this.requestMetaData = requestMetaData; this.identifier = identifier; this.requestMetaData.getSize(); this.tempDir = tempDir; this.size = requestMetaData.getSize(); if (size < 0) { throw new IllegalArgumentException("Size can't be bellow zero."); } }
/** * Create new identification request instance. * @param requestMetaData a * @param identifier a * @param tempDir a */ public RarIdentificationRequest(RequestMetaData requestMetaData, RequestIdentifier identifier, File tempDir) { this.fileName = requestMetaData.getName(); this.extension = ResourceUtils.getExtension(fileName); this.requestMetaData = requestMetaData; this.identifier = identifier; this.requestMetaData.getSize(); this.tempDir = tempDir; this.size = requestMetaData.getSize(); }
/** * Submits a request for a single file to droid. * @param webArchiveType arc or warc * @param metaData file size, time and name * @param parentName the name of the parent file * @param payload the file input stream * @param correlationId the correlation Id for the request * @param originatorNodeId the Id of the originator node * @throws IOException if the input stream could not be read */ final void submit(String webArchiveType, RequestMetaData metaData, URI parentName, InputStream payload, ResourceId correlationId, long originatorNodeId) throws IOException { RequestIdentifier identifier = new RequestIdentifier(ArchiveFileUtils.toWebArchiveUri(webArchiveType, parentName, metaData.getName())); identifier.setAncestorId(originatorNodeId); identifier.setParentResourceId(correlationId); IdentificationRequest request = factory.newRequest(metaData, identifier); request.open(payload); // get the inputstream back from the record, and write it out to file droidCore.submit(request); }
/** * Submits a request for a single file to droid. * @param webArchiveType arc or warc * @param metaData file size, time and name * @param parentName the name of the parent file * @param payload the file input stream * @param correlationId the correlation Id for the request * @param originatorNodeId the Id of the originator node * @throws IOException if the input stream could not be read */ final void submit(String webArchiveType, RequestMetaData metaData, URI parentName, InputStream payload, ResourceId correlationId, long originatorNodeId) throws IOException { RequestIdentifier identifier = new RequestIdentifier(ArchiveFileUtils.toWebArchiveUri(webArchiveType, parentName, metaData.getName())); identifier.setAncestorId(originatorNodeId); identifier.setParentResourceId(correlationId); IdentificationRequest request = factory.newRequest(metaData, identifier); request.open(payload); // get the inputstream back from the record, and write it out to file droidCore.submit(request); }
/** * {@inheritDoc} */ @Override public ResourceId handleDirectory(IdentificationResult result, ResourceId parentId, boolean restricted) { final URI uri = result.getIdentifier().getUri(); //log.debug(String.format("handling directory [%s]", uri)); ProfileResourceNode node = new ProfileResourceNode(uri); RequestMetaData requestMetaData = result.getMetaData(); NodeMetaData metaData = new NodeMetaData(); metaData.setName(requestMetaData.getName()); metaData.setSize(null); metaData.setLastModified(requestMetaData.getTime()); metaData.setIdentificationMethod(IdentificationMethod.NULL); metaData.setNodeStatus(restricted ? NodeStatus.ACCESS_DENIED : NodeStatus.DONE); metaData.setResourceType(ResourceType.FOLDER); node.setMetaData(metaData); node.setFinished(new Date()); node.addFormatIdentification(Format.NULL); resultHandlerDao.save(node, parentId); progressMonitor.stopJob(node); return new ResourceId(node.getId(), node.getPrefix()); }
/** * {@inheritDoc} */ @Override public ResourceId handleDirectory(IdentificationResult result, ResourceId parentId, boolean restricted) { final URI uri = result.getIdentifier().getUri(); //log.debug(String.format("handling directory [%s]", uri)); ProfileResourceNode node = new ProfileResourceNode(uri); RequestMetaData requestMetaData = result.getMetaData(); NodeMetaData metaData = new NodeMetaData(); metaData.setName(requestMetaData.getName()); metaData.setSize(null); metaData.setLastModified(requestMetaData.getTime()); metaData.setIdentificationMethod(IdentificationMethod.NULL); metaData.setNodeStatus(restricted ? NodeStatus.ACCESS_DENIED : NodeStatus.DONE); metaData.setResourceType(ResourceType.FOLDER); node.setMetaData(metaData); node.setFinished(new Date()); node.addFormatIdentification(Format.NULL); resultHandlerDao.save(node, parentId); progressMonitor.stopJob(node); return new ResourceId(node.getId(), node.getPrefix()); }