IsoArchiveContainerIdentifier extends ArchiveContentIdentifier { public void identify(final URI uri, final IdentificationRequest request) throws CommandExecutionException { final String newPath = makeContainerURI("iso", request.getFileName()); setSlash1(""); if (request.getClass().isAssignableFrom(FileSystemIdentificationRequest.class)) { FileSystemIdentificationRequest req = (FileSystemIdentificationRequest) request; try { try (Iso9660FileSystem fileSystem = new Iso9660FileSystem(req.getFile().toFile(), true)) { for (Iso9660FileEntry entry : fileSystem) { processEntry(entry, uri, fileSystem, newPath); } } } catch (IOException | RuntimeException e) { System.err.println(e + START_PARENTHESIS + newPath + END_PARENTHESIS); } } else { log.info("Identification request for ISO image ignored due to limited support."); } } IsoArchiveContainerIdentifier(final BinarySignatureIdentifier binarySignatureIdentifier,
                                         final ContainerSignatureDefinitions containerSignatureDefinitions,
                                         final String path, final String slash, final String slash1, ArchiveConfiguration archiveConfiguration); void identify(final URI uri, final IdentificationRequest request);  }
@Test public void identifyIsoFile()throws CommandExecutionException, IOException { RequestIdentifier identifier = new RequestIdentifier(filePath.toUri()); identifier.setParentId(1L); RequestMetaData metaData = new RequestMetaData(Files.size(filePath), Files.getLastModifiedTime(filePath).toMillis(), filePath.toAbsolutePath().toString()); FileSystemIdentificationRequest request = new FileSystemIdentificationRequest(metaData, identifier); request.open(filePath); IsoArchiveContainerIdentifier isoArchiveContainerIdentifier = new IsoArchiveContainerIdentifier(testHelper.getBinarySignatureIdentifier(), testHelper.getContainerSignatureDefinitions(), "", "/", "/", new ArchiveConfiguration(true, null, true, null)); isoArchiveContainerIdentifier.identify(filePath.toUri(), request); }