class StoreContextBuilder {

    public static ContentAddressableStorage newStoreContext(StorageConfiguration configuration,
        MongoDatabase mongoDatabase)
        throws CertificateException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException {

        if (StorageProvider.SWIFT_AUTH_V1.getValue().equalsIgnoreCase(configuration.getProvider())) {
            // TODO: keep keystone V1 authent ? No openstack4j keystone V1 authentication implementation, so we have
            // to keep jcloud or anything else
            return new OpenstackSwift(configuration);
        } else if (StorageProvider.HASHFILESYSTEM.getValue().equalsIgnoreCase(configuration.getProvider())) {
            return new HashFileSystem(configuration);
        } else if (StorageProvider.SWIFT_AUTH_V2.getValue().equalsIgnoreCase(configuration.getProvider())) {
            SwiftKeystoneFactoryV2 swiftKeystoneFactoryV2 = new SwiftKeystoneFactoryV2(configuration);
            return new Swift(swiftKeystoneFactoryV2, configuration);
        } else if (StorageProvider.SWIFT_AUTH_V3.getValue().equalsIgnoreCase(configuration.getProvider())) {
            SwiftKeystoneFactoryV3 swiftKeystoneFactoryV3 = new SwiftKeystoneFactoryV3(configuration);
            return new Swift(swiftKeystoneFactoryV3, configuration);
        } else if (StorageProvider.AMAZON_S3_V1.getValue().equalsIgnoreCase(configuration.getProvider())) {
            return new AmazonS3V1(configuration);
        } else if (StorageProvider.TAPE_LIBRARY.getValue().equalsIgnoreCase(configuration.getProvider())) {
            TapeLibraryFactory tapeLibraryFactory = TapeLibraryFactory.getInstance();
            tapeLibraryFactory.initialize(configuration.getTapeLibraryConfiguration(), mongoDatabase);
            return tapeLibraryFactory.getTapeLibraryContentAddressableStorage();
        } else {
            // by default file system
            return new FileSystem(configuration);
        }

    }

}