From 8caf9aa55286312707c96be529dee36b34c5984e Mon Sep 17 00:00:00 2001 From: David T Webb Date: Tue, 11 Feb 2014 17:29:34 -0500 Subject: [PATCH] DATACASS-85 - Premerge --- .../keyspace/AlterKeyspaceSpecification.java | 24 +-- .../keyspace/CreateKeyspaceSpecification.java | 176 +++++++++--------- 2 files changed, 100 insertions(+), 100 deletions(-) diff --git a/spring-cassandra/src/main/java/org/springframework/cassandra/core/keyspace/AlterKeyspaceSpecification.java b/spring-cassandra/src/main/java/org/springframework/cassandra/core/keyspace/AlterKeyspaceSpecification.java index e62d660b6..c9ba36e7b 100644 --- a/spring-cassandra/src/main/java/org/springframework/cassandra/core/keyspace/AlterKeyspaceSpecification.java +++ b/spring-cassandra/src/main/java/org/springframework/cassandra/core/keyspace/AlterKeyspaceSpecification.java @@ -1,12 +1,12 @@ -package org.springframework.cassandra.core.keyspace; - -public class AlterKeyspaceSpecification extends KeyspaceOptionsSpecification { - - /** - * Entry point into the {@link AlterKeyspaceSpecification}'s fluent API to alter a keyspace. Convenient if imported - * statically. - */ - public static AlterKeyspaceSpecification alterKeyspace() { - return new AlterKeyspaceSpecification(); - } -} +package org.springframework.cassandra.core.keyspace; + +public class AlterKeyspaceSpecification extends KeyspaceOptionsSpecification { + + /** + * Entry point into the {@link AlterKeyspaceSpecification}'s fluent API to alter a keyspace. Convenient if imported + * statically. + */ + public static AlterKeyspaceSpecification alterKeyspace() { + return new AlterKeyspaceSpecification(); + } +} diff --git a/spring-cassandra/src/main/java/org/springframework/cassandra/core/keyspace/CreateKeyspaceSpecification.java b/spring-cassandra/src/main/java/org/springframework/cassandra/core/keyspace/CreateKeyspaceSpecification.java index 9800c27d5..0a9f63881 100644 --- a/spring-cassandra/src/main/java/org/springframework/cassandra/core/keyspace/CreateKeyspaceSpecification.java +++ b/spring-cassandra/src/main/java/org/springframework/cassandra/core/keyspace/CreateKeyspaceSpecification.java @@ -1,88 +1,88 @@ -package org.springframework.cassandra.core.keyspace; - -import org.springframework.cassandra.config.DataCenterReplication; -import org.springframework.cassandra.core.keyspace.KeyspaceOption.ReplicationStrategy; -import org.springframework.cassandra.core.util.MapBuilder; - -public class CreateKeyspaceSpecification extends KeyspaceSpecification { - - private boolean ifNotExists = false; - - /** - * Causes the inclusion of an IF NOT EXISTS clause. - * - * @return this - */ - public CreateKeyspaceSpecification ifNotExists() { - return ifNotExists(true); - } - - /** - * Toggles the inclusion of an IF NOT EXISTS clause. - * - * @return this - */ - public CreateKeyspaceSpecification ifNotExists(boolean ifNotExists) { - this.ifNotExists = ifNotExists; - return this; - } - - public boolean getIfNotExists() { - return ifNotExists; - } - - /** - * Entry point into the {@link CreateKeyspaceSpecification}'s fluent API to create a keyspace. Convenient if imported - * statically. - */ - public static CreateKeyspaceSpecification createKeyspace() { - return new CreateKeyspaceSpecification(); - } - - public CreateKeyspaceSpecification withSimpleReplication() { - return withSimpleReplication(1); - } - - public CreateKeyspaceSpecification withSimpleReplication(long replicationFactor) { - return with( - KeyspaceOption.REPLICATION, - MapBuilder - .map(Option.class, Object.class) - .entry(new DefaultOption("class", String.class, true, false, true), - ReplicationStrategy.SIMPLE_STRATEGY.getValue()) - .entry(new DefaultOption("replication_factor", Long.class, true, false, false), replicationFactor).build()); - } - - public CreateKeyspaceSpecification withNetworkReplication(DataCenterReplication... dcrs) { - - MapBuilder builder = MapBuilder.map(Option.class, Object.class).entry( - new DefaultOption("class", String.class, true, false, true), - ReplicationStrategy.NETWORK_TOPOLOGY_STRATEGY.getValue()); - - for (DataCenterReplication dcr : dcrs) { - builder.entry(new DefaultOption(dcr.dataCenter, Long.class, true, false, false), dcr.replicationFactor); - } - - return with(KeyspaceOption.REPLICATION, builder.build()); - } - - @Override - public CreateKeyspaceSpecification name(String name) { - return (CreateKeyspaceSpecification) super.name(name); - } - - @Override - public CreateKeyspaceSpecification with(KeyspaceOption option) { - return (CreateKeyspaceSpecification) super.with(option); - } - - @Override - public CreateKeyspaceSpecification with(KeyspaceOption option, Object value) { - return (CreateKeyspaceSpecification) super.with(option, value); - } - - @Override - public CreateKeyspaceSpecification with(String name, Object value, boolean escape, boolean quote) { - return (CreateKeyspaceSpecification) super.with(name, value, escape, quote); - } -} +package org.springframework.cassandra.core.keyspace; + +import org.springframework.cassandra.config.DataCenterReplication; +import org.springframework.cassandra.core.keyspace.KeyspaceOption.ReplicationStrategy; +import org.springframework.cassandra.core.util.MapBuilder; + +public class CreateKeyspaceSpecification extends KeyspaceSpecification { + + private boolean ifNotExists = false; + + /** + * Causes the inclusion of an IF NOT EXISTS clause. + * + * @return this + */ + public CreateKeyspaceSpecification ifNotExists() { + return ifNotExists(true); + } + + /** + * Toggles the inclusion of an IF NOT EXISTS clause. + * + * @return this + */ + public CreateKeyspaceSpecification ifNotExists(boolean ifNotExists) { + this.ifNotExists = ifNotExists; + return this; + } + + public boolean getIfNotExists() { + return ifNotExists; + } + + /** + * Entry point into the {@link CreateKeyspaceSpecification}'s fluent API to create a keyspace. Convenient if imported + * statically. + */ + public static CreateKeyspaceSpecification createKeyspace() { + return new CreateKeyspaceSpecification(); + } + + public CreateKeyspaceSpecification withSimpleReplication() { + return withSimpleReplication(1); + } + + public CreateKeyspaceSpecification withSimpleReplication(long replicationFactor) { + return with( + KeyspaceOption.REPLICATION, + MapBuilder + .map(Option.class, Object.class) + .entry(new DefaultOption("class", String.class, true, false, true), + ReplicationStrategy.SIMPLE_STRATEGY.getValue()) + .entry(new DefaultOption("replication_factor", Long.class, true, false, false), replicationFactor).build()); + } + + public CreateKeyspaceSpecification withNetworkReplication(DataCenterReplication... dcrs) { + + MapBuilder builder = MapBuilder.map(Option.class, Object.class).entry( + new DefaultOption("class", String.class, true, false, true), + ReplicationStrategy.NETWORK_TOPOLOGY_STRATEGY.getValue()); + + for (DataCenterReplication dcr : dcrs) { + builder.entry(new DefaultOption(dcr.dataCenter, Long.class, true, false, false), dcr.replicationFactor); + } + + return with(KeyspaceOption.REPLICATION, builder.build()); + } + + @Override + public CreateKeyspaceSpecification name(String name) { + return (CreateKeyspaceSpecification) super.name(name); + } + + @Override + public CreateKeyspaceSpecification with(KeyspaceOption option) { + return (CreateKeyspaceSpecification) super.with(option); + } + + @Override + public CreateKeyspaceSpecification with(KeyspaceOption option, Object value) { + return (CreateKeyspaceSpecification) super.with(option, value); + } + + @Override + public CreateKeyspaceSpecification with(String name, Object value, boolean escape, boolean quote) { + return (CreateKeyspaceSpecification) super.with(name, value, escape, quote); + } +}