@Test public void testGetContainerMetadata() throws Exception { final Path container = new Path("test.cyberduck.ch", EnumSet.of(Path.Type.directory, Path.Type.volume)); container.attributes().setRegion("IAD"); final Map<String, String> metadata = new SwiftMetadataFeature(session).getMetadata(container); assertFalse(metadata.isEmpty()); }
@Override public Map<String, String> getMetadata(final Path file) throws BackgroundException { try { if(containerService.isContainer(file)) { final ContainerMetadata meta = session.getClient().getContainerMetaData(regionService.lookup(file), containerService.getContainer(file).getName()); return meta.getMetaData(); } else { final ObjectMetadata meta = session.getClient().getObjectMetaData(regionService.lookup(file), containerService.getContainer(file).getName(), containerService.getKey(file)); return meta.getMetaData(); } } 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); } }
SwiftMetadataFeature implements Headers { @Override public Map<String, String> getMetadata(final Path file) throws BackgroundException { try { if(containerService.isContainer(file)) { final ContainerMetadata meta = session.getClient().getContainerMetaData(regionService.lookup(file), containerService.getContainer(file).getName()); return meta.getMetaData(); } else { final ObjectMetadata meta = session.getClient().getObjectMetaData(regionService.lookup(file), containerService.getContainer(file).getName(), containerService.getKey(file)); return meta.getMetaData(); } } 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); } } }
SwiftMetadataFeature implements Headers { @Override public Map<String, String> getMetadata(final Path file) throws BackgroundException { try { if(containerService.isContainer(file)) { final ContainerMetadata meta = session.getClient().getContainerMetaData(regionService.lookup(file), containerService.getContainer(file).getName()); return meta.getMetaData(); } else { final ObjectMetadata meta = session.getClient().getObjectMetaData(regionService.lookup(file), containerService.getContainer(file).getName(), containerService.getKey(file)); return meta.getMetaData(); } } 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); } } SwiftMetadataFeature(final SwiftSession session);  SwiftMetadataFeature(final SwiftSession session, final SwiftRegionService regionService); }
SwiftMetadataFeature implements Headers { @Override public Map<String, String> getMetadata(final Path file) throws BackgroundException { try { if(containerService.isContainer(file)) { final ContainerMetadata meta = session.getClient().getContainerMetaData(regionService.lookup(file), containerService.getContainer(file).getName()); return meta.getMetaData(); } else { final ObjectMetadata meta = session.getClient().getObjectMetaData(regionService.lookup(file), containerService.getContainer(file).getName(), containerService.getKey(file)); return meta.getMetaData(); } } 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); } } SwiftMetadataFeature(final SwiftSession session);  SwiftMetadataFeature(final SwiftSession session, final SwiftRegionService regionService); @Override Map<String, String> getDefault(final Local local); @Override Map<String, String> getMetadata(final Path file); @Override void setMetadata(final Path file, final TransferStatus status); }
SwiftMetadataFeature implements Headers { @Override public Map<String, String> getMetadata(final Path file) throws BackgroundException { try { if(containerService.isContainer(file)) { final ContainerMetadata meta = session.getClient().getContainerMetaData(regionService.lookup(file), containerService.getContainer(file).getName()); return meta.getMetaData(); } else { final ObjectMetadata meta = session.getClient().getObjectMetaData(regionService.lookup(file), containerService.getContainer(file).getName(), containerService.getKey(file)); return meta.getMetaData(); } } 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); } } SwiftMetadataFeature(final SwiftSession session);  SwiftMetadataFeature(final SwiftSession session, final SwiftRegionService regionService); @Override Map<String, String> getDefault(final Local local); @Override Map<String, String> getMetadata(final Path file); @Override void setMetadata(final Path file, final TransferStatus status);  }