@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 {
                return new SwiftAttributesFinderFeature(session).find(file).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);
        }
    }
@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());
    }