/** * Calls the three argument version with a null credentials map. * {@link #getOrCreateCluster(String, me.prettyprint.cassandra.service.CassandraHostConfigurator, java.util.Map)} * for details. */ public static Cluster getOrCreateCluster(String clusterName, CassandraHostConfigurator cassandraHostConfigurator) { return createCluster(clusterName, cassandraHostConfigurator, null); }
/** * @deprecated use getOrCreateCluster instead * */ public static Cluster createCluster(String clusterName, CassandraHostConfigurator cassandraHostConfigurator) { return createCluster(clusterName, cassandraHostConfigurator, null); }
/** * Method tries to create a Cluster instance for an existing Cassandra * cluster. If another class already called getOrCreateCluster, the factory * returns the cached instance. If the instance doesn't exist in memory, a new * ThriftCluster is created and cached. * * Example usage for a default installation of Cassandra. * * String clusterName = "Test Cluster"; String host = "localhost:9160"; * Cluster cluster = HFactory.getOrCreateCluster(clusterName, new * CassandraHostConfigurator(host)); * * @param clusterName * The cluster name. This is an identifying string for the cluster, * e.g. "production" or "test" etc. Clusters will be created on * demand per each unique clusterName key. * @param cassandraHostConfigurator * @param credentials The credentials map for authenticating a Keyspace */ public static Cluster getOrCreateCluster(String clusterName, CassandraHostConfigurator cassandraHostConfigurator, Map<String, String> credentials) { return createCluster(clusterName, cassandraHostConfigurator, credentials); }
/** * @deprecated use getOrCreateCluster instead * */ public static Cluster createCluster(String clusterName, CassandraHostConfigurator cassandraHostConfigurator) { return createCluster(clusterName, cassandraHostConfigurator, null); }
/** * @deprecated use getOrCreateCluster instead * */ public static Cluster createCluster(String clusterName, CassandraHostConfigurator cassandraHostConfigurator) { return createCluster(clusterName, cassandraHostConfigurator, null); }
/** * Calls the three argument version with a null credentials map. * {@link #getOrCreateCluster(String, me.prettyprint.cassandra.service.CassandraHostConfigurator, java.util.Map)} * for details. */ public static Cluster getOrCreateCluster(String clusterName, CassandraHostConfigurator cassandraHostConfigurator) { return createCluster(clusterName, cassandraHostConfigurator, null); }
/** * Calls the three argument version with a null credentials map. * {@link #getOrCreateCluster(String, me.prettyprint.cassandra.service.CassandraHostConfigurator, java.util.Map)} * for details. */ public static Cluster getOrCreateCluster(String clusterName, CassandraHostConfigurator cassandraHostConfigurator) { return createCluster(clusterName, cassandraHostConfigurator, null); }
/** * Method tries to create a Cluster instance for an existing Cassandra * cluster. If another class already called getOrCreateCluster, the factory * returns the cached instance. If the instance doesn't exist in memory, a new * ThriftCluster is created and cached. * * Example usage for a default installation of Cassandra. * * String clusterName = "Test Cluster"; String host = "localhost:9160"; * Cluster cluster = HFactory.getOrCreateCluster(clusterName, new * CassandraHostConfigurator(host)); * * @param clusterName * The cluster name. This is an identifying string for the cluster, * e.g. "production" or "test" etc. Clusters will be created on * demand per each unique clusterName key. * @param cassandraHostConfigurator * @param credentials The credentials map for authenticating a Keyspace */ public static Cluster getOrCreateCluster(String clusterName, CassandraHostConfigurator cassandraHostConfigurator, Map<String, String> credentials) { return createCluster(clusterName, cassandraHostConfigurator, credentials); }
/** * Method tries to create a Cluster instance for an existing Cassandra * cluster. If another class already called getOrCreateCluster, the factory * returns the cached instance. If the instance doesn't exist in memory, a new * ThriftCluster is created and cached. * * Example usage for a default installation of Cassandra. * * String clusterName = "Test Cluster"; String host = "localhost:9160"; * Cluster cluster = HFactory.getOrCreateCluster(clusterName, new * CassandraHostConfigurator(host)); * * @param clusterName * The cluster name. This is an identifying string for the cluster, * e.g. "production" or "test" etc. Clusters will be created on * demand per each unique clusterName key. * @param cassandraHostConfigurator * @param credentials The credentials map for authenticating a Keyspace */ public static Cluster getOrCreateCluster(String clusterName, CassandraHostConfigurator cassandraHostConfigurator, Map<String, String> credentials) { return createCluster(clusterName, cassandraHostConfigurator, credentials); }
public static Cluster createCluster(ClusterInformation clusterInformation) { String username = clusterInformation.getUsername(); String clusterName = clusterInformation.getClusterName(); Map<String, String> credentials = new HashMap<String, String>(); credentials.put(USERNAME_KEY, username); credentials.put(PASSWORD_KEY, clusterInformation.getPassword()); CassandraHostConfigurator configurator = clusterInformation.getCassandraHostConfigurator(); if (configurator == null) { configurator = createCassandraHostConfigurator(); } return HFactory.createCluster(clusterName, configurator, credentials); }
Cluster cluster = HFactory.createCluster("StressCluster", cassandraHostConfigurator);