src/main/java/com/github/ddth/cql/DseUtils.java
public static DseCluster newDseCluster(String hostsAndPorts, String username, String password,
            String proxiedUser, Configuration configuration) {
        DseCluster.Builder builder = DseCluster.builder();
        if (!StringUtils.isBlank(username)) {
            AuthProvider authProvider;
            if (StringUtils.isBlank(proxiedUser)) {
                authProvider = new DsePlainTextAuthProvider(username, password);
            } else {
                authProvider = new DsePlainTextAuthProvider(username, password, proxiedUser);
            }
            builder = builder.withAuthProvider(authProvider);
        }
        Collection<InetSocketAddress> contactPointsWithPorts = new HashSet<InetSocketAddress>();
        String[] hostAndPortArr = StringUtils.split(hostsAndPorts, ";, ");
        for (String hostAndPort : hostAndPortArr) {
            String[] tokens = StringUtils.split(hostAndPort, ':');
            String host = tokens[0];
            int port = tokens.length > 1 ? Integer.parseInt(tokens[1]) : DEFAULT_CASSANDRA_PORT;
            contactPointsWithPorts.add(new InetSocketAddress(host, port));
        }
        builder = builder.addContactPointsWithPorts(contactPointsWithPorts);

        buildPolicies(configuration, builder);
        buildOptions(configuration, builder);

        DseCluster cluster = builder.build();
        return cluster;
    }
public static DseCluster newDseCluster(String hostsAndPorts, String username, String password,
            String proxiedUser, Configuration configuration) {
        DseCluster.Builder builder = DseCluster.builder();
        if (!StringUtils.isBlank(username)) {
            AuthProvider authProvider;
            if (StringUtils.isBlank(proxiedUser)) {
                authProvider = new DsePlainTextAuthProvider(username, password);
            } else {
                authProvider = new DsePlainTextAuthProvider(username, password, proxiedUser);
            }
            builder = builder.withAuthProvider(authProvider);
        }
        Collection<InetSocketAddress> contactPointsWithPorts = new HashSet<InetSocketAddress>();
        String[] hostAndPortArr = StringUtils.split(hostsAndPorts, ";, ");
        for (String hostAndPort : hostAndPortArr) {
            String[] tokens = StringUtils.split(hostAndPort, ':');
            String host = tokens[0];
            int port = tokens.length > 1 ? Integer.parseInt(tokens[1]) : DEFAULT_CASSANDRA_PORT;
            contactPointsWithPorts.add(new InetSocketAddress(host, port));
        }
        builder = builder.addContactPointsWithPorts(contactPointsWithPorts);

        buildPolicies(configuration, builder);
        buildOptions(configuration, builder);

        DseCluster cluster = builder.build();
        return cluster;
    }
public static DseCluster newDseCluster ( String hostsAndPorts , String username , String password , String proxiedUser , Configuration configuration ) { DseCluster . Builder builder = DseCluster . builder ( ) ; if ( ! StringUtils . isBlank ( username ) ) { AuthProvider authProvider ; if ( StringUtils . isBlank ( proxiedUser ) ) { authProvider = new DsePlainTextAuthProvider ( username , password ) ; } else { authProvider = new DsePlainTextAuthProvider ( username , password , proxiedUser ) ; } builder = builder . withAuthProvider ( authProvider ) ; } Collection < InetSocketAddress > contactPointsWithPorts = new HashSet < InetSocketAddress > ( ) ; String [ ] hostAndPortArr = StringUtils . split ( hostsAndPorts , ";, " ) ; for ( String hostAndPort : hostAndPortArr ) { String [ ] tokens = StringUtils . split ( hostAndPort , ' ' ) ; String host = tokens [ 0 ] ; int port = tokens . length > 1 ? Integer . parseInt ( tokens [ 1 ] ) : DEFAULT_CASSANDRA_PORT ; contactPointsWithPorts . add ( new InetSocketAddress ( host , port ) ) ; } builder = builder . addContactPointsWithPorts ( contactPointsWithPorts ) ; buildPolicies ( configuration , builder ) ; buildOptions ( configuration , builder ) ; DseCluster cluster = builder . build ( ) ; return cluster ; }
Build a new DSE cluster instance.

@param hostsAndPorts
format: "host1:port1,host2,host3:port3". If no port is
specified, the {@link #DEFAULT_CASSANDRA_PORT} is used.
@param username
@param password
@param proxiedUser
DSE allows a user to connect as another user or role, provide the name of the
user/role you want to connect as via this parameter
@param configuration
@return
Build a new DSE cluster instance .