class B2LifecycleFeature implements Lifecycle {

    @Override
    public void setConfiguration(final Path container, final LifecycleConfiguration configuration) throws BackgroundException {
        try {
            if(LifecycleConfiguration.empty().equals(configuration)) {
                session.getClient().updateBucket(
                    fileid.getFileid(containerService.getContainer(container), new DisabledListProgressListener()),
                    new B2BucketTypeFeature(session, fileid).convert(container.attributes().getAcl())
                );
            }
            else {
                session.getClient().updateBucket(
                    fileid.getFileid(containerService.getContainer(container), new DisabledListProgressListener()),
                    new B2BucketTypeFeature(session, fileid).convert(container.attributes().getAcl()),
                    new LifecycleRule(
                        null == configuration.getExpiration() ? null : configuration.getExpiration().longValue(),
                        null == configuration.getTransition() ? null : configuration.getTransition().longValue(),
                        StringUtils.EMPTY)
                );
            }
        }
        catch(B2ApiException e) {
            throw new B2ExceptionMappingService().map("Failure to write attributes of {0}", e, container);
        }
        catch(IOException e) {
            throw new DefaultIOExceptionMappingService().map("Failure to write attributes of {0}", e, container);
        }
    }

    public  B2LifecycleFeature(final B2Session session, final B2FileidProvider fileid);

}