class AttachmentStreamConnector {

    public <T> InputStream getAttachmentStream(AttachmentContent attachment, User user, T context) throws TException {
        assertNotNull(attachment);
        assertNotNull(context);

        if(!PermissionUtils.makePermission(context, user)
                .isAllowedToDownload(attachment)){
            String msg =
                    "The user=["+user.getEmail()+"] tried to download attachment=["+ attachment.getId()+
                    "] without attachment permissions";
            log.warn(msg);
            throw new SW360Exception(msg);
        }

        return unsafeGetAttachmentStream(attachment);
    }

    public  AttachmentStreamConnector(Duration downloadTimeout);
    public  AttachmentStreamConnector(DatabaseConnector connector, Duration downloadTimeout);
    public  AttachmentStreamConnector(DatabaseConnector connector, AttachmentContentDownloader attachmentContentDownloader, Duration downloadTimeout);

}