class SwiftAttributesFinderFeature implements AttributesFinder {

    @Override
    public PathAttributes find(final Path file) throws BackgroundException {
        if(file.isRoot()) {
            return PathAttributes.EMPTY;
        }
        final Region region = regionService.lookup(file);
        try {
            if(containerService.isContainer(file)) {
                final ContainerInfo info = session.getClient().getContainerInfo(region,
                    containerService.getContainer(file).getName());
                final PathAttributes attributes = new PathAttributes();
                attributes.setSize(info.getTotalSize());
                attributes.setRegion(info.getRegion().getRegionId());
                return attributes;
            }
            final ObjectMetadata metadata = session.getClient().getObjectMetaData(region,
                containerService.getContainer(file).getName(), containerService.getKey(file));
            if(file.isDirectory()) {
                if(!StringUtils.equals("application/directory", metadata.getMimeType())) {
                    throw new NotfoundException(String.format("Path %s is file", file.getAbsolute()));
                }
            }
            if(file.isFile()) {
                if(StringUtils.equals("application/directory", metadata.getMimeType())) {
                    throw new NotfoundException(String.format("Path %s is directory", file.getAbsolute()));
                }
            }
            return this.toAttributes(metadata);
        }
        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);
        }
    }

    public  SwiftAttributesFinderFeature(SwiftSession session);
    public  SwiftAttributesFinderFeature(final SwiftSession session, final SwiftRegionService regionService);

}