class SwiftDirectoryFeature implements Directory<StorageObject> {

    @Override
    public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException {
        try {
            if(containerService.isContainer(folder)) {
                // Create container at top level
                session.getClient().createContainer(regionService.lookup(
                    new SwiftLocationFeature.SwiftRegion(region)), folder.getName());
                return new Path(folder.getParent(), folder.getName(), folder.getType(),
                    new SwiftAttributesFinderFeature(session, regionService).find(folder));
            }
            else {
                status.setMime("application/directory");
                status.setLength(0L);
                final StatusOutputStream<StorageObject> out = writer.write(folder, status, new DisabledConnectionCallback());
                new DefaultStreamCloser().close(out);
                final StorageObject metadata = out.getStatus();
                return new Path(folder.getParent(), folder.getName(), folder.getType(),
                    new SwiftAttributesFinderFeature(session, regionService).toAttributes(metadata));
            }
        }
        catch(GenericException e) {
            throw new SwiftExceptionMappingService().map("Cannot create folder {0}", e, folder);
        }
        catch(IOException e) {
            throw new DefaultIOExceptionMappingService().map("Cannot create folder {0}", e, folder);
        }
    }

    public  SwiftDirectoryFeature(final SwiftSession session);
    public  SwiftDirectoryFeature(final SwiftSession session, final SwiftRegionService regionService);
    public  SwiftDirectoryFeature(final SwiftSession session, final SwiftRegionService regionService, final Write<StorageObject> writer);

}