class GoogleStorageDirectoryFeature implements Directory<VersionId> {

    @Override
    public Path mkdir(final Path folder, final String location, final TransferStatus status) throws BackgroundException {
        try {
            if(containerService.isContainer(folder)) {
                final Bucket bucket = session.getClient().buckets().insert(session.getHost().getCredentials().getUsername(),
                    new Bucket()
                        .setLocation(location)
                        .setStorageClass(status.getStorageClass())
                        .setName(new GoogleStoragePathContainerService().getContainer(folder).getName())).execute();
                final EnumSet<Path.Type> type = EnumSet.copyOf(folder.getType());
                type.add(Path.Type.volume);
                return new Path(folder.getParent(), folder.getName(), type,
                    new GoogleStorageAttributesFinderFeature(session).toAttributes(bucket));
            }
            else {
                // Add placeholder object
                status.setMime(MIMETYPE);
                final EnumSet<Path.Type> type = EnumSet.copyOf(folder.getType());
                type.add(Path.Type.placeholder);
                final StatusOutputStream<VersionId> out = writer.write(new Path(folder.getParent(), folder.getName(), type,
                    new PathAttributes(folder.attributes())), status, new DisabledConnectionCallback());
                new DefaultStreamCloser().close(out);
                return new Path(folder.getParent(), folder.getName(), type,
                    folder.attributes().withVersionId(out.getStatus().id));
            }
        }
        catch(IOException e) {
            throw new GoogleStorageExceptionMappingService().map("Cannot create folder {0}", e, folder);
        }
    }

    public  GoogleStorageDirectoryFeature(final GoogleStorageSession session);

}