Examples of CqlTemplate


Examples of org.springframework.cassandra.core.CqlTemplate

    if (session == null) {
      throw new IllegalStateException("session is required");
    }

    this.template = new CqlTemplate(session);
  }
View Full Code Here

Examples of org.springframework.cassandra.core.CqlTemplate

      // CassandraCQLUnit cassandraCQLUnit = new CassandraCQLUnit(new ClassPathCQLDataSet(
      // "cassandraOperationsTest-cql-dataload.cql", keyspace), CASSANDRA_CONFIG, CASSANDRA_HOST,
      // CASSANDRA_NATIVE_PORT);

      cqlTemplate = new CqlTemplate(SESSION);
    }
  }
View Full Code Here

Examples of org.springframework.cassandra.core.CqlTemplate

  }

  protected void executeSpecsAndScripts(@SuppressWarnings("rawtypes") List specs, List<String> scripts) {

    Session system = null;
    CqlTemplate template = null;

    try {
      if (specs != null) {
        system = specs.size() == 0 ? null : cluster.connect();
        template = system == null ? null : new CqlTemplate(system);

        Iterator<?> i = specs.iterator();
        while (i.hasNext()) {
          KeyspaceActionSpecification<?> spec = (KeyspaceActionSpecification<?>) i.next();
          String cql = (spec instanceof CreateKeyspaceSpecification) ? new CreateKeyspaceCqlGenerator(
              (CreateKeyspaceSpecification) spec).toCql() : new DropKeyspaceCqlGenerator(
              (DropKeyspaceSpecification) spec).toCql();

          template.execute(cql);
        }
      }

      if (scripts != null) {

        if (system == null) {
          system = scripts.size() == 0 ? null : cluster.connect();
        }

        if (template == null) {
          template = system == null ? null : new CqlTemplate(system);
        }

        for (String script : scripts) {

          if (log.isDebugEnabled()) {
            log.debug("executing raw CQL [{}]", script);
          }

          template.execute(script);
        }
      }
    } finally {

      if (system != null) {
View Full Code Here

Examples of org.springframework.cassandra.core.CqlTemplate

public abstract class AbstractCqlTemplateConfiguration extends AbstractSessionConfiguration {

  @Bean
  public CqlTemplate cqlTemplate() throws Exception {
    return new CqlTemplate(session().getObject());
  }
View Full Code Here

Examples of org.springframework.cassandra.core.CqlTemplate

    if (scripts == null || scripts.size() == 0) {
      return;
    }

    CqlTemplate template = new CqlTemplate(session);

    for (String script : scripts) {

      if (log.isInfoEnabled()) {
        log.info("executing raw CQL [{}]", script);
      }

      template.execute(script);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.