Package uk.gov.nationalarchives.droid.core.interfaces

Examples of uk.gov.nationalarchives.droid.core.interfaces.ResourceId


        IdentificationRequestFactory factory = mock(IdentificationRequestFactory.class);
       
        ZipArchiveInputStream zin = new ZipArchiveInputStream(new FileInputStream(file));
        int entryCount = 0;
        ZipArchiveEntry entry;
        ResourceId parentId = new ResourceId(20L, "X");
        ResourceId nodeId = new ResourceId(20L, "X");
        while ((entry = zin.getNextZipEntry()) != null) {
            URI expectedUri = ArchiveFileUtils.toZipUri(file.toURI(), entry.getName());
           
            RequestIdentifier identifer = new RequestIdentifier(expectedUri);
            identifer.setAncestorId(10L);
View Full Code Here


        // count the tar entries
        List<IdentificationRequest> mockRequests = new ArrayList<IdentificationRequest>();
        InputStream in = new FileInputStream(file);
        TarArchiveInputStream tarIn = new TarArchiveInputStream(in);
        ArchiveEntry entry;
        ResourceId expectedParentId = new ResourceId(99L, "");
        int count = 0;
        while ((entry = tarIn.getNextEntry()) != null) {
            URI expectedUri = ArchiveFileUtils.toTarUri(file.toURI(), entry.getName());
            IdentificationRequest mockRequest = mock(IdentificationRequest.class);
            when(mockRequest.toString()).thenReturn(expectedUri.toString());
View Full Code Here

                fileWalker.setFileHandler(new FileWalkerHandler() {

                    @Override
                    public ResourceId handle(File file, int depth, ProgressEntry parent) {
                        progressMonitor.startJob(file.toURI());
                        ResourceId parentId = parent == null ? null : parent.getResourceId();
                        fileEventHandler.onEvent(file, parentId, null);
                        return null;
                    }
                });
               
                fileWalker.setDirectoryHandler(new FileWalkerHandler() {
                    @Override
                    public ResourceId handle(File file, int depth, ProgressEntry parent) {
                        progressMonitor.startJob(file.toURI());
                        ResourceId parentId = parent == null ? null : parent.getResourceId();
                        return directoryEventHandler.onEvent(file, parentId, depth, false);
                    }
                });
               
                fileWalker.setRestrictedDirectoryHandler(new FileWalkerHandler() {
                    @Override
                    public ResourceId handle(File file, int depth, ProgressEntry parent) {
                        progressMonitor.startJob(file.toURI());
                        ResourceId parentId = parent == null ? null : parent.getResourceId();
                        return directoryEventHandler.onEvent(file, parentId, depth, true);
                    }
                });
               
                walkState.setWalkStatus(WalkStatus.IN_PROGRESS);
View Full Code Here

        metaData.setNodeStatus(NodeStatus.DONE);

        node.setMetaData(metaData);
        node.setExtensionMismatch(results.getExtensionMismatch());
        node.setFinished(new Date());
        ResourceId parentId = results.getCorrelationId();
        setNodeIds(node, parentId);
        if (results.getResults().isEmpty()) {
            node.addFormatIdentification(Format.NULL);
            node.setZeroIdentifications();
        } else {
            for (IdentificationResult result : results.getResults()) {
                node.getMetaData().setIdentificationMethod(result.getMethod());
                //log.debug(String.format("Handling ID puid[%s]; uri[%s]", result.getPuid(), results.getUri()));
                Format format = loadFormat(result.getPuid());
                node.addFormatIdentification(format);
            }
        }
        progressMonitor.stopJob(node);
        batchNode(node);
        return new ResourceId(node.getId(), node.getPrefix());
    }
View Full Code Here

        node.setFinished(new Date());
        node.addFormatIdentification(Format.NULL);

        progressMonitor.stopJob(node);
        batchNode(node);
        return new ResourceId(node.getId(), node.getPrefix());
    }
View Full Code Here

TOP

Related Classes of uk.gov.nationalarchives.droid.core.interfaces.ResourceId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.