DATACASS-172 - Polish.

This commit is contained in:
John Blum
2016-11-11 02:50:52 -08:00
parent cfa8a6177f
commit dcc34a284a
26 changed files with 854 additions and 858 deletions

View File

@@ -15,7 +15,7 @@
*/
package org.springframework.cassandra.core.cql.generator;
import static org.springframework.cassandra.core.cql.CqlStringUtils.*;
import static org.springframework.cassandra.core.cql.CqlStringUtils.noNull;
import org.springframework.cassandra.core.keyspace.AddColumnSpecification;
import org.springframework.cassandra.core.keyspace.AlterColumnSpecification;
@@ -43,14 +43,14 @@ public class AlterUserTypeCqlGenerator extends UserTypeNameCqlGenerator<AlterUse
/**
* Creates a new {@link AlterUserTypeCqlGenerator} for a {@link AlterUserTypeSpecification}.
*
*
* @param specification must not be {@literal null}.
*/
public AlterUserTypeCqlGenerator(AlterUserTypeSpecification specification) {
super(specification);
}
/*
/*
* (non-Javadoc)
* @see org.springframework.cassandra.core.cql.generator.UserTypeNameCqlGenerator#toCql(java.lang.StringBuilder)
*/
@@ -58,17 +58,11 @@ public class AlterUserTypeCqlGenerator extends UserTypeNameCqlGenerator<AlterUse
public StringBuilder toCql(StringBuilder cql) {
Assert.notNull(getSpecification().getName(), "User type name must not be null");
Assert.isTrue(!getSpecification().getChanges().isEmpty(),
String.format("User type [%s] does not contain fields", getSpecification().getName()));
cql = noNull(cql);
preambleCql(cql);
changesCql(cql);
cql.append(";");
return cql;
return changesCql(preambleCql(cql)).append(";");
}
private StringBuilder preambleCql(StringBuilder cql) {
@@ -82,14 +76,13 @@ public class AlterUserTypeCqlGenerator extends UserTypeNameCqlGenerator<AlterUse
boolean lastChangeWasRename = false;
for (ColumnChangeSpecification change : spec().getChanges()) {
if (first) {
first = false;
} else {
if (!first) {
cql.append(' ');
}
getCqlGeneratorFor(change, lastChangeWasRename).toCql(cql);
getCqlGeneratorFor(change, lastChangeWasRename).toCql(cql);
lastChangeWasRename = change instanceof RenameColumnSpecification;
first = false;
}
return cql;
@@ -102,14 +95,14 @@ public class AlterUserTypeCqlGenerator extends UserTypeNameCqlGenerator<AlterUse
return new AddColumnCqlGenerator((AddColumnSpecification) change);
}
if (change instanceof RenameColumnSpecification) {
return new RenameColumnCqlGenerator(lastChangeWasRename ? "AND" : RenameColumnCqlGenerator.RENAME, change);
}
if (change instanceof AlterColumnSpecification) {
return new AlterColumnCqlGenerator((AlterColumnSpecification) change);
}
if (change instanceof RenameColumnSpecification) {
return new RenameColumnCqlGenerator(lastChangeWasRename ? "AND" : RenameColumnCqlGenerator.RENAME, change);
}
throw new IllegalArgumentException(
String.format("Unknown ColumnChangeSpecification type: %s", change.getClass().getName()));
}

View File

@@ -15,7 +15,7 @@
*/
package org.springframework.cassandra.core.cql.generator;
import static org.springframework.cassandra.core.cql.CqlStringUtils.*;
import static org.springframework.cassandra.core.cql.CqlStringUtils.noNull;
import org.springframework.cassandra.core.keyspace.CreateUserTypeSpecification;
import org.springframework.cassandra.core.keyspace.FieldSpecification;
@@ -37,14 +37,14 @@ public class CreateUserTypeCqlGenerator extends UserTypeNameCqlGenerator<CreateU
/**
* Creates a new {@link CreateUserTypeCqlGenerator} for a given {@link CreateUserTypeSpecification}.
*
*
* @param specification must not be {@literal null}.
*/
public CreateUserTypeCqlGenerator(CreateUserTypeSpecification specification) {
super(specification);
}
/*
/*
* (non-Javadoc)
* @see org.springframework.cassandra.core.cql.generator.UserTypeNameCqlGenerator#toCql(java.lang.StringBuilder)
*/
@@ -52,17 +52,11 @@ public class CreateUserTypeCqlGenerator extends UserTypeNameCqlGenerator<CreateU
public StringBuilder toCql(StringBuilder cql) {
Assert.notNull(getSpecification().getName(), "User type name must not be null");
Assert.isTrue(!getSpecification().getFields().isEmpty(),
String.format("User type [%s] does not contain fields", getSpecification().getName()));
cql = noNull(cql);
preambleCql(cql);
columns(cql);
cql.append(";");
return cql;
return columns(preambleCql(cql)).append(";");
}
private StringBuilder preambleCql(StringBuilder cql) {
@@ -78,13 +72,13 @@ public class CreateUserTypeCqlGenerator extends UserTypeNameCqlGenerator<CreateU
cql.append(" (");
boolean first = true;
for (FieldSpecification col : spec().getFields()) {
for (FieldSpecification column : spec().getFields()) {
if (!first) {
cql.append(", ");
}
col.toCql(cql);
column.toCql(cql);
first = false;
}

View File

@@ -15,7 +15,7 @@
*/
package org.springframework.cassandra.core.cql.generator;
import static org.springframework.cassandra.core.cql.CqlStringUtils.*;
import static org.springframework.cassandra.core.cql.CqlStringUtils.noNull;
import org.springframework.cassandra.core.keyspace.DropUserTypeSpecification;
@@ -35,20 +35,20 @@ public class DropUserTypeCqlGenerator extends UserTypeNameCqlGenerator<DropUserT
/**
* Creates a new {@link DropUserTypeCqlGenerator} for a given {@link DropUserTypeSpecification}.
*
*
* @param specification must not be {@literal null}.
*/
public DropUserTypeCqlGenerator(DropUserTypeSpecification specification) {
super(specification);
}
/*
/*
* (non-Javadoc)
* @see org.springframework.cassandra.core.cql.generator.UserTypeNameCqlGenerator#toCql(java.lang.StringBuilder)
*/
@Override
public StringBuilder toCql(StringBuilder cql) {
return noNull(cql).append("DROP TYPE ").append(spec().getIfExists() ? "IF EXISTS " : "").append(spec().getName())
.append(";");
return noNull(cql).append("DROP TYPE").append(spec().getIfExists() ? " IF EXISTS " : " ")
.append(spec().getName()).append(";");
}
}

View File

@@ -15,7 +15,7 @@
*/
package org.springframework.cassandra.core.cql.generator;
import static org.springframework.cassandra.core.cql.CqlStringUtils.*;
import static org.springframework.cassandra.core.cql.CqlStringUtils.noNull;
import org.springframework.cassandra.core.keyspace.ColumnChangeSpecification;
import org.springframework.cassandra.core.keyspace.RenameColumnSpecification;

View File

@@ -47,21 +47,21 @@ public class AlterUserTypeSpecification extends UserTypeNameSpecification<AlterU
* Entry point into the {@link AlterUserTypeSpecification}'s fluent API to alter a type. Convenient if imported
* statically.
*/
public static AlterUserTypeSpecification alterType(CqlIdentifier typeName) {
return alterType().name(typeName);
public static AlterUserTypeSpecification alterType(String typeName) {
return alterType(CqlIdentifier.cqlId(typeName));
}
/**
* Entry point into the {@link AlterUserTypeSpecification}'s fluent API to alter a type. Convenient if imported
* statically.
*/
public static AlterUserTypeSpecification alterType(String typeName) {
return alterType(CqlIdentifier.cqlId(typeName));
public static AlterUserTypeSpecification alterType(CqlIdentifier typeName) {
return alterType().name(typeName);
}
/**
* Adds an {@literal ADD} to the list of field changes.
*
*
* @param field must not be empty or {@literal null}.
* @param type must not be {@literal null}.
* @return {@code this} {@link AlterUserTypeSpecification}.
@@ -72,7 +72,7 @@ public class AlterUserTypeSpecification extends UserTypeNameSpecification<AlterU
/**
* Adds an {@literal ADD} to the list of field changes.
*
*
* @param field must not be {@literal null}.
* @param type must not be {@literal null}.
* @return {@code this} {@link AlterUserTypeSpecification}.
@@ -80,12 +80,13 @@ public class AlterUserTypeSpecification extends UserTypeNameSpecification<AlterU
public AlterUserTypeSpecification add(CqlIdentifier field, DataType type) {
changes.add(new AddColumnSpecification(field, type));
return this;
}
/**
* Adds an {@literal ALTER} to the list of field changes.
*
*
* @param field must not be empty or {@literal null}.
* @param type must not be {@literal null}.
* @return {@code this} {@link AlterUserTypeSpecification}.
@@ -96,7 +97,7 @@ public class AlterUserTypeSpecification extends UserTypeNameSpecification<AlterU
/**
* Adds an {@literal ALTER} to the list of field changes.
*
*
* @param field must not be {@literal null}.
* @param type must not be {@literal null}.
* @return {@code this} {@link AlterUserTypeSpecification}.
@@ -104,12 +105,13 @@ public class AlterUserTypeSpecification extends UserTypeNameSpecification<AlterU
public AlterUserTypeSpecification alter(CqlIdentifier field, DataType type) {
changes.add(new AlterColumnSpecification(field, type));
return this;
}
/**
* Adds an {@literal RENAME} to the list of field changes.
*
*
* @param from must not be empty or {@literal null}.
* @param to must not be empty or {@literal null}.
* @return {@code this} {@link AlterUserTypeSpecification}.
@@ -128,6 +130,7 @@ public class AlterUserTypeSpecification extends UserTypeNameSpecification<AlterU
public AlterUserTypeSpecification rename(CqlIdentifier from, CqlIdentifier to) {
changes.add(new RenameColumnSpecification(from, to));
return this;
}

View File

@@ -55,7 +55,7 @@ public class CreateUserTypeSpecification extends UserTypeSpecification<CreateUse
/**
* Enables the inclusion of an{@code IF NOT EXISTS} clause.
*
*
* @return this {@link CreateUserTypeSpecification}.
*/
public CreateUserTypeSpecification ifNotExists() {
@@ -72,6 +72,7 @@ public class CreateUserTypeSpecification extends UserTypeSpecification<CreateUse
public CreateUserTypeSpecification ifNotExists(boolean ifNotExists) {
this.ifNotExists = ifNotExists;
return this;
}

View File

@@ -40,21 +40,21 @@ public class DropUserTypeSpecification extends UserTypeNameSpecification<DropUse
/**
* Entry point into the {@link DropUserTypeSpecification}'s fluent API to drop a type. Convenient if imported
* statically.
*
*
* @param typeName The name of the type to drop.
*/
public static DropUserTypeSpecification dropType(CqlIdentifier typeName) {
return dropType().name(typeName);
public static DropUserTypeSpecification dropType(String typeName) {
return dropType(CqlIdentifier.cqlId(typeName));
}
/**
* Entry point into the {@link DropUserTypeSpecification}'s fluent API to drop a type. Convenient if imported
* statically.
*
*
* @param typeName The name of the type to drop.
*/
public static DropUserTypeSpecification dropType(String typeName) {
return dropType(CqlIdentifier.cqlId(typeName));
public static DropUserTypeSpecification dropType(CqlIdentifier typeName) {
return dropType().name(typeName);
}
/**
@@ -69,13 +69,14 @@ public class DropUserTypeSpecification extends UserTypeNameSpecification<DropUse
/**
* Sets the inclusion of an {@code IF EXISTS} clause.
*
* @param ifNotExists {@literal true} to include an {@code IF EXISTS} clause, {@literal false} to omit the
* {@code IF NOT EXISTS} clause.
* @param ifExists {@literal true} to include an {@code IF EXISTS} clause, {@literal false} to omit the
* {@code IF NOT EXISTS} clause.
* @return this {@link DropUserTypeSpecification}.
*/
public DropUserTypeSpecification ifExists(boolean ifExists) {
this.ifExists = ifExists;
return this;
}

View File

@@ -15,8 +15,8 @@
*/
package org.springframework.cassandra.core.keyspace;
import static org.springframework.cassandra.core.cql.CqlIdentifier.*;
import static org.springframework.cassandra.core.cql.CqlStringUtils.*;
import static org.springframework.cassandra.core.cql.CqlIdentifier.cqlId;
import static org.springframework.cassandra.core.cql.CqlStringUtils.noNull;
import org.springframework.cassandra.core.cql.CqlIdentifier;
import org.springframework.util.Assert;
@@ -27,7 +27,7 @@ import com.datastax.driver.core.DataType;
* Builder class to specify fields.
* <p/>
* A {@link FieldSpecification} consists of a name and a {@link DataType}.
*
*
* @author Mark Paluch
* @since 1.5
* @see CqlIdentifier
@@ -58,12 +58,13 @@ public class FieldSpecification {
Assert.notNull(name, "CqlIdentifier must not be null");
this.name = name;
return this;
}
/**
* Sets the column's type.
*
*
* @param type The data type of the field, must not be {@literal null}.
* @return {@code this} {@link FieldSpecification}.
*/
@@ -72,6 +73,7 @@ public class FieldSpecification {
Assert.notNull(type, "DataType must not be null");
this.type = type;
return this;
}
@@ -83,7 +85,7 @@ public class FieldSpecification {
return noNull(cql).append(name).append(" ").append(type);
}
/*
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/

View File

@@ -33,7 +33,7 @@ public abstract class UserTypeNameSpecification<T extends UserTypeNameSpecificat
/**
* Sets the type name.
*
*
* @param name must not be empty or {@literal null}.
* @return this
*/
@@ -43,7 +43,7 @@ public abstract class UserTypeNameSpecification<T extends UserTypeNameSpecificat
/**
* Sets the type name.
*
*
* @param name must not be {@literal null}.
* @return this
*/
@@ -53,6 +53,7 @@ public abstract class UserTypeNameSpecification<T extends UserTypeNameSpecificat
Assert.notNull(name, "Name must not be null");
this.name = name;
return (T) this;
}

View File

@@ -15,7 +15,7 @@
*/
package org.springframework.cassandra.core.keyspace;
import static org.springframework.cassandra.core.cql.CqlIdentifier.*;
import static org.springframework.cassandra.core.cql.CqlIdentifier.cqlId;
import java.util.ArrayList;
import java.util.Collections;
@@ -40,7 +40,7 @@ public class UserTypeSpecification<T extends UserTypeSpecification<T>> extends U
/**
* Adds the given field to the type.
*
*
* @param name must not be empty or {@literal null}.
* @param type The data type of the field.
* @return {@code this} specification.
@@ -60,6 +60,7 @@ public class UserTypeSpecification<T extends UserTypeSpecification<T>> extends U
public T field(CqlIdentifier name, DataType type) {
fields.add(new FieldSpecification().name(name).type(type));
return (T) this;
}

View File

@@ -2,12 +2,11 @@
<xsd:schema xmlns="http://www.springframework.org/schema/cql"
xmlns:tool="http://www.springframework.org/schema/tool"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
targetNamespace="http://www.springframework.org/schema/cql"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xsd:import namespace="http://www.springframework.org/schema/tool"
schemaLocation="http://www.springframework.org/schema/tool/spring-tool.xsd" />
schemaLocation="http://www.springframework.org/schema/tool/spring-tool.xsd" />
<xsd:annotation>
<xsd:documentation><![CDATA[
@@ -15,17 +14,6 @@ Defines the configuration elements in the XML namespace for Spring Cassandra.
]]></xsd:documentation>
</xsd:annotation>
<xsd:simpleType name="executorRef" final="union">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:assignable-to type="java.util.concurrent.Executor"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
<xsd:union memberTypes="xsd:string" />
</xsd:simpleType>
<xsd:element name="cluster" type="clusterType">
<xsd:annotation>
<xsd:documentation
@@ -40,6 +28,35 @@ Defines a Cassandra cluster.
</xsd:annotation>
</xsd:element>
<xsd:element name="session" type="sessionType">
<xsd:annotation>
<xsd:documentation
source="org.springframework.data.cassandra.config.xml.CassandraDataSessionFactoryBean"><![CDATA[
Defines a Cassandra session.
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:exports type="com.datastax.driver.core.Session" />
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="template" type="templateType">
<xsd:annotation>
<xsd:documentation
source="org.springframework.data.cassandra.config.xml.CassandraDataTemplateFactoryBean"><![CDATA[
Defines a CassandraTemplate.
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:exports
type="org.springframework.data.cassandra.CassandraTemplate" />
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:simpleType name="clusterRef" final="union">
<xsd:annotation>
<xsd:appinfo>
@@ -51,6 +68,28 @@ Defines a Cassandra cluster.
<xsd:union memberTypes="xsd:string" />
</xsd:simpleType>
<xsd:simpleType name="executorRef" final="union">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:assignable-to type="java.util.concurrent.Executor"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
<xsd:union memberTypes="xsd:string" />
</xsd:simpleType>
<xsd:simpleType name="sessionRef" final="union">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:assignable-to type="com.datastax.driver.core.Session" />
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
<xsd:union memberTypes="xsd:string" />
</xsd:simpleType>
<xsd:complexType name="clusterType">
<xsd:sequence>
<xsd:element name="local-pooling-options" type="poolingOptionsType" minOccurs="0" maxOccurs="1">
@@ -433,105 +472,6 @@ When Authentication is enabled, the username to use when connecting to the Clust
</xsd:attribute>
</xsd:complexType>
<xsd:element name="session" type="sessionType">
<xsd:annotation>
<xsd:documentation
source="org.springframework.data.cassandra.config.xml.CassandraDataSessionFactoryBean"><![CDATA[
Defines a Cassandra session.
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:exports type="com.datastax.driver.core.Session" />
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:simpleType name="sessionRef" final="union">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:assignable-to type="com.datastax.driver.core.Session" />
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
<xsd:union memberTypes="xsd:string" />
</xsd:simpleType>
<xsd:complexType name="sessionType">
<xsd:sequence>
<xsd:element name="startup-cql" type="xsd:string" minOccurs="0" maxOccurs="unbounded">
<!-- TODO: cql could come from a resource via a resource attribute... -->
<xsd:annotation>
<xsd:documentation><![CDATA[
Arbitrary CQL script to be executed against the session's keyspace during bean initialization. Multiple elements will be executed in document order.
]]></xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="shutdown-cql" type="xsd:string" minOccurs="0" maxOccurs="unbounded">
<!-- TODO: cql could come from a resource via a resource attribute... -->
<xsd:annotation>
<xsd:documentation><![CDATA[
Arbitrary CQL script to be executed against the session's keyspace during bean destruction. Multiple elements will be executed in document order.
]]></xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:ID" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
The name of the session definition; default is "cassandra-session".
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="cluster-ref" type="clusterRef" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
The reference to a Cassandra cluster; default is "cassandra-cluster".
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="keyspace-name" type="xsd:string" use="required">
<xsd:annotation>
<xsd:documentation><![CDATA[
The name of a Cassandra Keyspace. No default; for the system keyspace, use the empty string.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
<xsd:element name="template" type="templateType">
<xsd:annotation>
<xsd:documentation
source="org.springframework.data.cassandra.config.xml.CassandraDataTemplateFactoryBean"><![CDATA[
Defines a CassandraTemplate.
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:exports
type="org.springframework.data.cassandra.CassandraTemplate" />
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:complexType name="templateType">
<xsd:attribute name="id" type="xsd:ID" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
The name of the template; default is "cassandraTemplate".
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="session-ref" type="sessionRef" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
The reference to a Cassandra session; default is "cassandra-session".
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
<xsd:complexType name="datacenterType">
<xsd:annotation>
<xsd:documentation><![CDATA[
@@ -623,6 +563,48 @@ If the utilisation of opened connections drops below by this configured threshol
</xsd:attribute>
</xsd:complexType>
<xsd:complexType name="sessionType">
<xsd:sequence>
<xsd:element name="startup-cql" type="xsd:string" minOccurs="0" maxOccurs="unbounded">
<!-- TODO: cql could come from a resource via a resource attribute... -->
<xsd:annotation>
<xsd:documentation><![CDATA[
Arbitrary CQL script to be executed against the session's keyspace during bean initialization. Multiple elements will be executed in document order.
]]></xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="shutdown-cql" type="xsd:string" minOccurs="0" maxOccurs="unbounded">
<!-- TODO: cql could come from a resource via a resource attribute... -->
<xsd:annotation>
<xsd:documentation><![CDATA[
Arbitrary CQL script to be executed against the session's keyspace during bean destruction. Multiple elements will be executed in document order.
]]></xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:ID" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
The name of the session definition; default is "cassandra-session".
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="cluster-ref" type="clusterRef" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
The reference to a Cassandra cluster; default is "cassandra-cluster".
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="keyspace-name" type="xsd:string" use="required">
<xsd:annotation>
<xsd:documentation><![CDATA[
The name of a Cassandra Keyspace. No default; for the system keyspace, use the empty string.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
<xsd:complexType name="socketOptionsType">
<xsd:attribute name="connect-timeout-millis" type="xsd:string">
<xsd:annotation>
@@ -713,4 +695,21 @@ The replication factor; default is 1.
</xsd:attribute>
</xsd:complexType>
<xsd:complexType name="templateType">
<xsd:attribute name="id" type="xsd:ID" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
The name of the template; default is "cassandraTemplate".
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="session-ref" type="sessionRef" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
The reference to a Cassandra session; default is "cassandra-session".
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:schema>

View File

@@ -29,17 +29,6 @@ Defines the configuration elements in the XML namespace for Spring Cassandra.
]]></xsd:documentation>
</xsd:annotation>
<xsd:simpleType name="executorRef" final="union">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:assignable-to type="java.util.concurrent.Executor"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
<xsd:union memberTypes="xsd:string" />
</xsd:simpleType>
<xsd:element name="cluster" type="clusterType">
<xsd:annotation>
<xsd:documentation
@@ -54,6 +43,35 @@ Defines a Cassandra cluster.
</xsd:annotation>
</xsd:element>
<xsd:element name="session" type="sessionType">
<xsd:annotation>
<xsd:documentation
source="org.springframework.data.cassandra.config.xml.CassandraDataSessionFactoryBean"><![CDATA[
Defines a Cassandra session.
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:exports type="com.datastax.driver.core.Session" />
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="template" type="templateType">
<xsd:annotation>
<xsd:documentation
source="org.springframework.data.cassandra.config.xml.CassandraDataTemplateFactoryBean"><![CDATA[
Defines a CassandraTemplate.
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:exports
type="org.springframework.data.cassandra.CassandraTemplate" />
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:simpleType name="clusterRef" final="union">
<xsd:annotation>
<xsd:appinfo>
@@ -65,6 +83,28 @@ Defines a Cassandra cluster.
<xsd:union memberTypes="xsd:string" />
</xsd:simpleType>
<xsd:simpleType name="executorRef" final="union">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:assignable-to type="java.util.concurrent.Executor"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
<xsd:union memberTypes="xsd:string" />
</xsd:simpleType>
<xsd:simpleType name="sessionRef" final="union">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:assignable-to type="com.datastax.driver.core.Session" />
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
<xsd:union memberTypes="xsd:string" />
</xsd:simpleType>
<xsd:complexType name="clusterType">
<xsd:sequence>
<xsd:element name="local-pooling-options" type="poolingOptionsType" minOccurs="0" maxOccurs="1">
@@ -447,105 +487,6 @@ When Authentication is enabled, the username to use when connecting to the Clust
</xsd:attribute>
</xsd:complexType>
<xsd:element name="session" type="sessionType">
<xsd:annotation>
<xsd:documentation
source="org.springframework.data.cassandra.config.xml.CassandraDataSessionFactoryBean"><![CDATA[
Defines a Cassandra session.
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:exports type="com.datastax.driver.core.Session" />
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:simpleType name="sessionRef" final="union">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:assignable-to type="com.datastax.driver.core.Session" />
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
<xsd:union memberTypes="xsd:string" />
</xsd:simpleType>
<xsd:complexType name="sessionType">
<xsd:sequence>
<xsd:element name="startup-cql" type="xsd:string" minOccurs="0" maxOccurs="unbounded">
<!-- TODO: cql could come from a resource via a resource attribute... -->
<xsd:annotation>
<xsd:documentation><![CDATA[
Arbitrary CQL script to be executed against the session's keyspace during bean initialization. Multiple elements will be executed in document order.
]]></xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="shutdown-cql" type="xsd:string" minOccurs="0" maxOccurs="unbounded">
<!-- TODO: cql could come from a resource via a resource attribute... -->
<xsd:annotation>
<xsd:documentation><![CDATA[
Arbitrary CQL script to be executed against the session's keyspace during bean destruction. Multiple elements will be executed in document order.
]]></xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:ID" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
The name of the session definition; default is "cassandra-session".
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="cluster-ref" type="clusterRef" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
The reference to a Cassandra cluster; default is "cassandra-cluster".
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="keyspace-name" type="xsd:string" use="required">
<xsd:annotation>
<xsd:documentation><![CDATA[
The name of a Cassandra Keyspace. No default; for the system keyspace, use the empty string.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
<xsd:element name="template" type="templateType">
<xsd:annotation>
<xsd:documentation
source="org.springframework.data.cassandra.config.xml.CassandraDataTemplateFactoryBean"><![CDATA[
Defines a CassandraTemplate.
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:exports
type="org.springframework.data.cassandra.CassandraTemplate" />
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:complexType name="templateType">
<xsd:attribute name="id" type="xsd:ID" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
The name of the template; default is "cassandraTemplate".
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="session-ref" type="sessionRef" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
The reference to a Cassandra session; default is "cassandra-session".
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
<xsd:complexType name="datacenterType">
<xsd:annotation>
<xsd:documentation><![CDATA[
@@ -637,6 +578,48 @@ If the utilisation of opened connections drops below by this configured threshol
</xsd:attribute>
</xsd:complexType>
<xsd:complexType name="sessionType">
<xsd:sequence>
<xsd:element name="startup-cql" type="xsd:string" minOccurs="0" maxOccurs="unbounded">
<!-- TODO: cql could come from a resource via a resource attribute... -->
<xsd:annotation>
<xsd:documentation><![CDATA[
Arbitrary CQL script to be executed against the session's keyspace during bean initialization. Multiple elements will be executed in document order.
]]></xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="shutdown-cql" type="xsd:string" minOccurs="0" maxOccurs="unbounded">
<!-- TODO: cql could come from a resource via a resource attribute... -->
<xsd:annotation>
<xsd:documentation><![CDATA[
Arbitrary CQL script to be executed against the session's keyspace during bean destruction. Multiple elements will be executed in document order.
]]></xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:ID" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
The name of the session definition; default is "cassandra-session".
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="cluster-ref" type="clusterRef" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
The reference to a Cassandra cluster; default is "cassandra-cluster".
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="keyspace-name" type="xsd:string" use="required">
<xsd:annotation>
<xsd:documentation><![CDATA[
The name of a Cassandra Keyspace. No default; for the system keyspace, use the empty string.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
<xsd:complexType name="socketOptionsType">
<xsd:attribute name="connect-timeout-millis" type="xsd:string">
<xsd:annotation>
@@ -727,4 +710,21 @@ The replication factor; default is 1.
</xsd:attribute>
</xsd:complexType>
<xsd:complexType name="templateType">
<xsd:attribute name="id" type="xsd:ID" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
The name of the template; default is "cassandraTemplate".
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="session-ref" type="sessionRef" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
The reference to a Cassandra session; default is "cassandra-session".
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:schema>