}
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) {