Package me.prettyprint.cassandra.service

Examples of me.prettyprint.cassandra.service.CassandraHostConfigurator


      cluster = HFactory.getCluster(clusterName);
      if (cluster == null) {
        if (hosts == null)
          throw new IllegalArgumentException("No hosts set");

        CassandraHostConfigurator cfg = new CassandraHostConfigurator();
        cfg.setHosts(hosts);
        cluster = HFactory.getOrCreateCluster(clusterName, cfg);
      }
    }

    if (keyspaceName == null)
View Full Code Here


    // Consistency Level Policy
    ConsistencyLevelPolicy clp = new QuorumConsistencyLevel();

    // Host config
    CassandraHostConfigurator conf = new CassandraHostConfigurator("127.0.0.1:9160");

    cluster = HFactory.getOrCreateCluster("TestCluster", conf);
    keyspace = HFactory.createKeyspace(KEYSPACE, cluster, clp);
   
    dao = new CassandraDAOFactory();
View Full Code Here

  {
    // Consistency Level Policy
    ConsistencyLevelPolicy clp = new QuorumConsistencyLevel();

    // Host config
    CassandraHostConfigurator conf = new CassandraHostConfigurator("127.0.0.1:9160");

    cluster = HFactory.getOrCreateCluster("TestCluster", conf);
    keyspace = HFactory.createKeyspace(KEYSPACE, cluster, clp);
   
    // clenaup from previous runs
View Full Code Here

    // get cassandra mapping with persistent class
    this.persistentClass = persistentClass;
    this.cassandraMapping = CassandraMappingManager.getManager().get(persistentClass);
    // LOG.info("persistentClass=" + persistentClass.getName() + " -> cassandraMapping=" + cassandraMapping);

    this.cluster = HFactory.getOrCreateCluster(this.cassandraMapping.getClusterName(), new CassandraHostConfigurator(this.cassandraMapping.getHostName()));
   
    // add keyspace to cluster
    checkKeyspace();
   
    // Just create a Keyspace object on the client side, corresponding to an already existing keyspace with already created column families.
View Full Code Here

                        .withCassandaConfigurationDirectoryPath(configurationPath)
                        .withCassandaYamlFile(cassandraYaml)
                        .build();
            }

            CassandraHostConfigurator configurator = new CassandraHostConfigurator(cassandraHostname + ":" + cassandraPort);
            Cluster cluster = HFactory.getOrCreateCluster(cassandraClusterName, configurator);
            me.prettyprint.hector.api.Keyspace keyspace = HFactory.createKeyspace(cassandraKeySpaceName, cluster);
            return keyspace;
        }
        catch (Exception e) {
View Full Code Here

        // skip initialisation if not cassandra
        if ( !StringUtils.equals( repositorySessionFactoryBean.getId(), "cassandra" ) )
        {
            return;
        }
        final CassandraHostConfigurator configurator =
            new CassandraHostConfigurator( cassandraHost + ":" + cassandraPort );
        configurator.setMaxActive( maxActive );
        //configurator.setCassandraThriftSocketTimeout(  );

        cluster = HFactory.getOrCreateCluster( clusterName, configurator );

        final ConfigurableConsistencyLevel consistencyLevelPolicy = new ConfigurableConsistencyLevel();
View Full Code Here

   * "production" or "test" etc. Clusters will be created on demand per each unique clusterName key.
   * @param hostIp host:ip format string
   * @return
   */
  public static Cluster getOrCreateCluster(String clusterName, String hostIp) {   
    return getOrCreateCluster(clusterName, new CassandraHostConfigurator(hostIp));
  }
View Full Code Here

    clusterName = getPropertyGently(properties, CLUSTER_NAME_PROP,true);
    keyspace = getPropertyGently(properties, KEYSPACE_PROP,true);
    if ( cassandraHostConfigurator == null ) {
      String hostList = getPropertyGently(properties, HOST_LIST_PROP, false);
      if ( StringUtils.isNotBlank(hostList) ) {
        cassandraHostConfigurator = new CassandraHostConfigurator(hostList);
      } else {
        cassandraHostConfigurator = new CassandraHostConfigurator();
      }
    }
    this.cassandraHostConfigurator = cassandraHostConfigurator;
  }
View Full Code Here

    embedded = null;
  }


  protected void setupClient() {
    cassandraHostConfigurator = new CassandraHostConfigurator("127.0.0.1:9170");
    connectionManager = new HConnectionManager(cassandraHostConfigurator,null);
  }
View Full Code Here

        out.close();
    }

    private Keyspace getKeyspace() {
        Cluster cassandraCluster = HFactory.createCluster(
                Constants.CLUSTER_NAME, new CassandraHostConfigurator(Constants.CLUSTER_HOST), credentials);

        if (cassandraCluster.describeKeyspace(Constants.KEYSPACE_NAME) == null) {
            BasicColumnFamilyDefinition columnFamilyDefinition = new BasicColumnFamilyDefinition();
            columnFamilyDefinition.setKeyspaceName(Constants.KEYSPACE_NAME);
            columnFamilyDefinition.setName(Constants.COL_FAMILY_NAME);
View Full Code Here

TOP

Related Classes of me.prettyprint.cassandra.service.CassandraHostConfigurator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.