Example usage for com.mongodb ConnectionString getCredentialList

List of usage examples for com.mongodb ConnectionString getCredentialList

Introduction

In this page you can find the example usage for com.mongodb ConnectionString getCredentialList.

Prototype

@Deprecated
public List<MongoCredential> getCredentialList() 

Source Link

Document

Gets the credentials in an immutable list.

Usage

From source file:org.openo.commontosca.inventory.core.mongo.MongoInventoryProvider.java

License:Apache License

public static MongoClient create(final String url) {
    ConnectionString connectionString = new ConnectionString(url);
    Builder builder = MongoClientSettings.builder();
    builder.clusterSettings(ClusterSettings.builder().applyConnectionString(connectionString).build());
    builder.connectionPoolSettings(/*from  w w  w . j av a  2s  .c o m*/
            ConnectionPoolSettings.builder().applyConnectionString(connectionString).build());
    builder.serverSettings(ServerSettings.builder().build());
    builder.credentialList(connectionString.getCredentialList());
    builder.sslSettings(SslSettings.builder().applyConnectionString(connectionString).build());
    builder.socketSettings(SocketSettings.builder().applyConnectionString(connectionString).build());
    builder.codecRegistry(
            CodecRegistries.fromRegistries(MongoClients.getDefaultCodecRegistry(), new ObjectCodecRegistry()));
    // builder.streamFactoryFactory(new NettyStreamFactoryFactory());
    return MongoClients.create(builder.build());
}