class GoogleStorageLifecycleFeature implements Lifecycle {

    @Override
    public LifecycleConfiguration getConfiguration(final Path file) throws BackgroundException {
        final Path container = containerService.getContainer(file);
        if(container.isRoot()) {
            return LifecycleConfiguration.empty();
        }
        if(file.getType().contains(Path.Type.upload)) {
            return LifecycleConfiguration.empty();
        }
        try {
            final Bucket.Lifecycle status = session.getClient().buckets().get(container.getName()).execute().getLifecycle();
            if(null != status) {
                Integer transition = null;
                Integer expiration = null;
                String storageClass = null;
                for(Bucket.Lifecycle.Rule rule : status.getRule()) {
                    if(!rule.getCondition().getIsLive()) {
                        continue;
                    }
                    if("SetStorageClass".equals(rule.getAction().getType())) {
                        transition = rule.getCondition().getAge();
                        storageClass = rule.getAction().getStorageClass();
                    }
                    if("Delete".equals(rule.getAction().getType())) {
                        expiration = rule.getCondition().getAge();
                    }
                }
                return new LifecycleConfiguration(transition, storageClass, expiration);
            }
            return LifecycleConfiguration.empty();
        }
        catch(IOException e) {
            try {
                throw new GoogleStorageExceptionMappingService().map("Failure to read attributes of {0}", e, container);
            }
            catch(AccessDeniedException | InteroperabilityException l) {
                log.warn(String.format("Missing permission to read lifecycle configuration for %s %s", container, e.getMessage()));
                return LifecycleConfiguration.empty();
            }
        }
    }

    public  GoogleStorageLifecycleFeature(final GoogleStorageSession session);

}