@Test public void testList() throws Exception { final Path container = new Path("/test.cyberduck.ch", EnumSet.of(Path.Type.volume, Path.Type.directory)); container.attributes().setRegion("IAD"); assertTrue(new SwiftSegmentService(session).list(new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file))).isEmpty()); }
public List<Path> list(final Path file) throws BackgroundException { try { final Path container = containerService.getContainer(file); final Map<String, List<StorageObject>> segments = session.getClient().listObjectSegments(regionService.lookup(container), container.getName(), containerService.getKey(file)); if(null == segments) { return Collections.emptyList(); } final List<Path> objects = new ArrayList<Path>(); for(final String containerName : segments.keySet()) { final Path containerPath = new Path(containerName, container.getType(), container.attributes()); for(StorageObject s : segments.get(containerName)) { final Path segment = new Path(containerPath, s.getName(), EnumSet.of(Path.Type.file)); segment.attributes().setSize(s.getSize()); try { segment.attributes().setModificationDate(dateParser.parse(s.getLastModified()).getTime()); } catch(InvalidDateException e) { log.warn(String.format("%s is not ISO 8601 format %s", s.getLastModified(), e.getMessage())); } if(StringUtils.isNotBlank(s.getMd5sum())) { segment.attributes().setChecksum(Checksum.parse(s.getMd5sum())); } objects.add(segment); } } return objects; } catch(GenericException e) { throw new SwiftExceptionMappingService().map("Failure to read attributes of {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Failure to read attributes of {0}", e, file); } }
SwiftSegmentService { public List<Path> list(final Path file) throws BackgroundException { try { final Path container = containerService.getContainer(file); final Map<String, List<StorageObject>> segments = session.getClient().listObjectSegments(regionService.lookup(container), container.getName(), containerService.getKey(file)); if(null == segments) { return Collections.emptyList(); } final List<Path> objects = new ArrayList<Path>(); for(final String containerName : segments.keySet()) { final Path containerPath = new Path(containerName, container.getType(), container.attributes()); for(StorageObject s : segments.get(containerName)) { final Path segment = new Path(containerPath, s.getName(), EnumSet.of(Path.Type.file)); segment.attributes().setSize(s.getSize()); try { segment.attributes().setModificationDate(dateParser.parse(s.getLastModified()).getTime()); } catch(InvalidDateException e) { log.warn(String.format("%s is not ISO 8601 format %s", s.getLastModified(), e.getMessage())); } if(StringUtils.isNotBlank(s.getMd5sum())) { segment.attributes().setChecksum(Checksum.parse(s.getMd5sum())); } objects.add(segment); } } return objects; } catch(GenericException e) { throw new SwiftExceptionMappingService().map("Failure to read attributes of {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Failure to read attributes of {0}", e, file); } } }
SwiftSegmentService { public List<Path> list(final Path file) throws BackgroundException { try { final Path container = containerService.getContainer(file); final Map<String, List<StorageObject>> segments = session.getClient().listObjectSegments(regionService.lookup(container), container.getName(), containerService.getKey(file)); if(null == segments) { return Collections.emptyList(); } final List<Path> objects = new ArrayList<Path>(); for(final String containerName : segments.keySet()) { final Path containerPath = new Path(containerName, container.getType(), container.attributes()); for(StorageObject s : segments.get(containerName)) { final Path segment = new Path(containerPath, s.getName(), EnumSet.of(Path.Type.file)); segment.attributes().setSize(s.getSize()); try { segment.attributes().setModificationDate(dateParser.parse(s.getLastModified()).getTime()); } catch(InvalidDateException e) { log.warn(String.format("%s is not ISO 8601 format %s", s.getLastModified(), e.getMessage())); } if(StringUtils.isNotBlank(s.getMd5sum())) { segment.attributes().setChecksum(Checksum.parse(s.getMd5sum())); } objects.add(segment); } } return objects; } catch(GenericException e) { throw new SwiftExceptionMappingService().map("Failure to read attributes of {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Failure to read attributes of {0}", e, file); } } SwiftSegmentService(final SwiftSession session);  SwiftSegmentService(final SwiftSession session, final String prefix);  SwiftSegmentService(final SwiftSession session, final SwiftRegionService regionService);  SwiftSegmentService(final SwiftSession session, final SwiftRegionService regionService, final String prefix); }
SwiftSegmentService { public List<Path> list(final Path file) throws BackgroundException { try { final Path container = containerService.getContainer(file); final Map<String, List<StorageObject>> segments = session.getClient().listObjectSegments(regionService.lookup(container), container.getName(), containerService.getKey(file)); if(null == segments) { return Collections.emptyList(); } final List<Path> objects = new ArrayList<Path>(); for(final String containerName : segments.keySet()) { final Path containerPath = new Path(containerName, container.getType(), container.attributes()); for(StorageObject s : segments.get(containerName)) { final Path segment = new Path(containerPath, s.getName(), EnumSet.of(Path.Type.file)); segment.attributes().setSize(s.getSize()); try { segment.attributes().setModificationDate(dateParser.parse(s.getLastModified()).getTime()); } catch(InvalidDateException e) { log.warn(String.format("%s is not ISO 8601 format %s", s.getLastModified(), e.getMessage())); } if(StringUtils.isNotBlank(s.getMd5sum())) { segment.attributes().setChecksum(Checksum.parse(s.getMd5sum())); } objects.add(segment); } } return objects; } catch(GenericException e) { throw new SwiftExceptionMappingService().map("Failure to read attributes of {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Failure to read attributes of {0}", e, file); } } SwiftSegmentService(final SwiftSession session);  SwiftSegmentService(final SwiftSession session, final String prefix);  SwiftSegmentService(final SwiftSession session, final SwiftRegionService regionService);  SwiftSegmentService(final SwiftSession session, final SwiftRegionService regionService, final String prefix); List<Path> list(final Path file); Path getSegmentsDirectory(final Path file, final Long size); Path getSegment(final Path file, final Long size, int segmentNumber); String manifest(final String container, final List<StorageObject> objects); Checksum checksum(final ChecksumCompute checksum, final List<StorageObject> objects); }
SwiftSegmentService { public List<Path> list(final Path file) throws BackgroundException { try { final Path container = containerService.getContainer(file); final Map<String, List<StorageObject>> segments = session.getClient().listObjectSegments(regionService.lookup(container), container.getName(), containerService.getKey(file)); if(null == segments) { return Collections.emptyList(); } final List<Path> objects = new ArrayList<Path>(); for(final String containerName : segments.keySet()) { final Path containerPath = new Path(containerName, container.getType(), container.attributes()); for(StorageObject s : segments.get(containerName)) { final Path segment = new Path(containerPath, s.getName(), EnumSet.of(Path.Type.file)); segment.attributes().setSize(s.getSize()); try { segment.attributes().setModificationDate(dateParser.parse(s.getLastModified()).getTime()); } catch(InvalidDateException e) { log.warn(String.format("%s is not ISO 8601 format %s", s.getLastModified(), e.getMessage())); } if(StringUtils.isNotBlank(s.getMd5sum())) { segment.attributes().setChecksum(Checksum.parse(s.getMd5sum())); } objects.add(segment); } } return objects; } catch(GenericException e) { throw new SwiftExceptionMappingService().map("Failure to read attributes of {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Failure to read attributes of {0}", e, file); } } SwiftSegmentService(final SwiftSession session);  SwiftSegmentService(final SwiftSession session, final String prefix);  SwiftSegmentService(final SwiftSession session, final SwiftRegionService regionService);  SwiftSegmentService(final SwiftSession session, final SwiftRegionService regionService, final String prefix); List<Path> list(final Path file); Path getSegmentsDirectory(final Path file, final Long size); Path getSegment(final Path file, final Long size, int segmentNumber); String manifest(final String container, final List<StorageObject> objects); Checksum checksum(final ChecksumCompute checksum, final List<StorageObject> objects);  }