FatArchiveContainerIdentifier extends ArchiveContentIdentifier { public void identify(final URI uri, final IdentificationRequest request) throws CommandExecutionException { final String newPath = makeContainerURI("fat", request.getFileName()); setSlash1(""); if (request.getClass().isAssignableFrom(FileSystemIdentificationRequest.class)) { FileSystemIdentificationRequest req = (FileSystemIdentificationRequest) request; try { FileDisk fileDisk = new FileDisk(req.getFile().toFile(), true); FileSystem fatSystem = FileSystemFactory.create(fileDisk, true); FsDirectory root = fatSystem.getRoot(); for (FsDirectoryEntry entry : root) { processEntry(entry, uri, newPath); } } catch (IOException e) { throw new CommandExecutionException("IO error in FatFileSystem", e); } } else { log.info("Identification request for Fat image ignored due to limited support."); } } FatArchiveContainerIdentifier(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 identifyFatFile() 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); FatArchiveContainerIdentifier fatArchiveContainerIdentifier = new FatArchiveContainerIdentifier(testHelper.getBinarySignatureIdentifier(), testHelper.getContainerSignatureDefinitions(), "", "/", "/", new ArchiveConfiguration(true, null, true, null)); fatArchiveContainerIdentifier.identify(filePath.toUri(), request); }