DATACASS-172 - Polish.
This commit is contained in:
@@ -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()));
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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(";");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -68,10 +68,10 @@ public class CassandraSessionFactoryBean extends CassandraCqlSessionFactoryBean
|
||||
/* (non-Javadoc) */
|
||||
protected void performSchemaAction() {
|
||||
|
||||
boolean create = false;
|
||||
boolean drop = DEFAULT_DROP_TABLES;
|
||||
boolean dropUnused = DEFAULT_DROP_UNUSED_TABLES;
|
||||
boolean ifNotExists = DEFAULT_CREATE_IF_NOT_EXISTS;
|
||||
boolean create = false;
|
||||
|
||||
switch (schemaAction) {
|
||||
case RECREATE_DROP_UNUSED:
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -35,13 +35,14 @@ import org.springframework.data.cassandra.mapping.EntityMapping;
|
||||
import org.springframework.data.cassandra.mapping.Mapping;
|
||||
import org.springframework.data.cassandra.mapping.PropertyMapping;
|
||||
import org.springframework.data.cassandra.mapping.SimpleUserTypeResolver;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.util.xml.DomUtils;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Spring Data Cassandra XML namespace parser for the <mapping> element.
|
||||
*
|
||||
*
|
||||
* @author Matthew T. Adams
|
||||
*/
|
||||
public class CassandraMappingContextParser extends AbstractSingleBeanDefinitionParser {
|
||||
@@ -56,7 +57,8 @@ public class CassandraMappingContextParser extends AbstractSingleBeanDefinitionP
|
||||
throws BeanDefinitionStoreException {
|
||||
|
||||
String id = super.resolveId(element, definition, parserContext);
|
||||
return StringUtils.hasText(id) ? id : DefaultBeanNames.CONTEXT;
|
||||
|
||||
return (StringUtils.hasText(id) ? id : DefaultBeanNames.CONTEXT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,14 +72,17 @@ public class CassandraMappingContextParser extends AbstractSingleBeanDefinitionP
|
||||
protected void parseMapping(Element element, BeanDefinitionBuilder builder) {
|
||||
|
||||
String packages = element.getAttribute("entity-base-packages");
|
||||
|
||||
if (StringUtils.hasText(packages)) {
|
||||
try {
|
||||
Set<Class<?>> entityClasses = CassandraEntityClassScanner
|
||||
.scan(StringUtils.commaDelimitedListToStringArray(packages));
|
||||
Set<Class<?>> entityClasses = CassandraEntityClassScanner.scan(
|
||||
StringUtils.commaDelimitedListToStringArray(packages));
|
||||
|
||||
builder.addPropertyValue("initialEntitySet", entityClasses);
|
||||
} catch (Exception x) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("encountered exception while scanning for entity classes in package(s) [%s]", packages), x);
|
||||
String.format("encountered exception while scanning for entity classes in package(s) [%s]",
|
||||
packages), x);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,15 +99,13 @@ public class CassandraMappingContextParser extends AbstractSingleBeanDefinitionP
|
||||
|
||||
List<Element> userTypeResolvers = DomUtils.getChildElementsByTagName(element, "user-type-resolver");
|
||||
String userTypeResolverRef = element.getAttribute("user-type-resolver-ref");
|
||||
|
||||
if (StringUtils.hasText(userTypeResolverRef)) {
|
||||
if (!userTypeResolvers.isEmpty()) {
|
||||
throw new IllegalArgumentException("Must not define user-type-resolver and user-type-resolver-ref");
|
||||
}
|
||||
Assert.isTrue(userTypeResolvers.isEmpty(), "Must not define user-type-resolver and user-type-resolver-ref");
|
||||
builder.addPropertyReference("userTypeResolver", userTypeResolverRef);
|
||||
}
|
||||
|
||||
if(!userTypeResolvers.isEmpty()){
|
||||
|
||||
if (!userTypeResolvers.isEmpty()){
|
||||
BeanDefinition userTypeResolver = parseUserTypeResolver(userTypeResolvers.get(0));
|
||||
builder.addPropertyValue("userTypeResolver", userTypeResolver);
|
||||
}
|
||||
@@ -116,23 +119,18 @@ public class CassandraMappingContextParser extends AbstractSingleBeanDefinitionP
|
||||
protected EntityMapping parseEntity(Element entity) {
|
||||
|
||||
String className = entity.getAttribute("class");
|
||||
if (!StringUtils.hasText(className)) {
|
||||
throw new IllegalStateException("class attribute must not be empty");
|
||||
}
|
||||
|
||||
Assert.state(StringUtils.hasText(className), "class attribute must not be empty");
|
||||
|
||||
Element table = DomUtils.getChildElementByTagName(entity, "table");
|
||||
|
||||
String tableName = "";
|
||||
String forceQuote = "";
|
||||
Element table = DomUtils.getChildElementByTagName(entity, "table");
|
||||
|
||||
if (table != null) {
|
||||
tableName = table.getAttribute("name");
|
||||
if (!StringUtils.hasText(tableName)) {
|
||||
tableName = "";
|
||||
}
|
||||
|
||||
forceQuote = table.getAttribute("force-quote");
|
||||
if (!StringUtils.hasText(forceQuote)) {
|
||||
forceQuote = Boolean.FALSE.toString();
|
||||
}
|
||||
tableName = (StringUtils.hasText(tableName) ? tableName : "");
|
||||
forceQuote = String.valueOf(Boolean.parseBoolean(table.getAttribute("force-quote")));
|
||||
}
|
||||
|
||||
// TODO: parse future entity mappings here, like table options
|
||||
@@ -148,9 +146,8 @@ public class CassandraMappingContextParser extends AbstractSingleBeanDefinitionP
|
||||
protected BeanDefinition parseUserTypeResolver(Element entity) {
|
||||
|
||||
String keyspaceName = entity.getAttribute("keyspace-name");
|
||||
if (!StringUtils.hasText(keyspaceName)) {
|
||||
throw new IllegalStateException("keyspace-name attribute must not be null or empty");
|
||||
}
|
||||
|
||||
Assert.state(StringUtils.hasText(keyspaceName), "keyspace-name attribute must not be null or empty");
|
||||
|
||||
String clusterRef = entity.getAttribute("cluster-ref");
|
||||
|
||||
@@ -163,29 +160,31 @@ public class CassandraMappingContextParser extends AbstractSingleBeanDefinitionP
|
||||
|
||||
protected Map<String, PropertyMapping> parsePropertyMappings(Element entity) {
|
||||
|
||||
Map<String, PropertyMapping> pms = new HashMap<String, PropertyMapping>();
|
||||
Map<String, PropertyMapping> propertyMappings = new HashMap<String, PropertyMapping>();
|
||||
|
||||
for (Element property : DomUtils.getChildElementsByTagName(entity, "property")) {
|
||||
|
||||
String value = property.getAttribute("name");
|
||||
if (!StringUtils.hasText(value)) {
|
||||
throw new IllegalStateException("name attribute must not be empty");
|
||||
}
|
||||
PropertyMapping pm = new PropertyMapping(value);
|
||||
|
||||
Assert.state(StringUtils.hasText(value), "name attribute must not be empty");
|
||||
|
||||
PropertyMapping propertyMapping = new PropertyMapping(value);
|
||||
|
||||
value = property.getAttribute("column-name");
|
||||
|
||||
if (StringUtils.hasText(value)) {
|
||||
pm.setColumnName(value);
|
||||
propertyMapping.setColumnName(value);
|
||||
}
|
||||
|
||||
value = property.getAttribute("force-quote");
|
||||
|
||||
if (StringUtils.hasText(value)) {
|
||||
pm.setForceQuote(value);
|
||||
propertyMapping.setForceQuote(value);
|
||||
}
|
||||
|
||||
pms.put(pm.getPropertyName(), pm);
|
||||
propertyMappings.put(propertyMapping.getPropertyName(), propertyMapping);
|
||||
}
|
||||
|
||||
return pms;
|
||||
return propertyMappings;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ package org.springframework.data.cassandra.convert;
|
||||
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentProperty;
|
||||
import org.springframework.data.mapping.model.DefaultSpELExpressionEvaluator;
|
||||
import org.springframework.data.mapping.model.PropertyValueProvider;
|
||||
import org.springframework.data.mapping.model.SpELExpressionEvaluator;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -27,7 +26,7 @@ import com.datastax.driver.core.UDTValue;
|
||||
|
||||
/**
|
||||
* {@link CassandraValueProvider} to read property values from a {@link UDTValue}.
|
||||
*
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @since 1.5
|
||||
*/
|
||||
@@ -40,7 +39,7 @@ public class CassandraUDTValueProvider implements CassandraValueProvider {
|
||||
/**
|
||||
* Creates a new {@link CassandraUDTValueProvider} with the given {@link UDTValue} and
|
||||
* {@link DefaultSpELExpressionEvaluator}.
|
||||
*
|
||||
*
|
||||
* @param udtValue must not be {@literal null}.
|
||||
* @param codecRegistry must not be {@literal null}.
|
||||
* @param evaluator must not be {@literal null}.
|
||||
@@ -64,6 +63,7 @@ public class CassandraUDTValueProvider implements CassandraValueProvider {
|
||||
public Object getPropertyValue(CassandraPersistentProperty property) {
|
||||
|
||||
String expression = property.getSpelExpression();
|
||||
|
||||
if (expression != null) {
|
||||
return evaluator.evaluate(expression);
|
||||
}
|
||||
|
||||
@@ -137,11 +137,7 @@ public class CustomConversions {
|
||||
public boolean isSimpleType(Class<?> type) {
|
||||
|
||||
// Enums have no native Cassandra support
|
||||
if (type.isEnum()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return simpleTypeHolder.isSimpleType(type);
|
||||
return (!type.isEnum() && simpleTypeHolder.isSimpleType(type));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.convert;
|
||||
|
||||
import static org.springframework.data.cassandra.repository.support.BasicMapId.*;
|
||||
import static org.springframework.data.cassandra.repository.support.BasicMapId.Entry;
|
||||
import static org.springframework.data.cassandra.repository.support.BasicMapId.id;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
@@ -133,11 +134,11 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
return conversionService.convert(row, type);
|
||||
}
|
||||
|
||||
CassandraPersistentEntity<R> persistentEntity = (CassandraPersistentEntity<R>) mappingContext
|
||||
.getPersistentEntity(typeInfo);
|
||||
CassandraPersistentEntity<R> persistentEntity = (CassandraPersistentEntity<R>)
|
||||
mappingContext.getPersistentEntity(typeInfo);
|
||||
|
||||
if (persistentEntity == null) {
|
||||
throw new MappingException("No mapping metadata found for " + rawType.getName());
|
||||
throw new MappingException(String.format("No mapping metadata found for %s", rawType.getName()));
|
||||
}
|
||||
|
||||
return readEntityFromRow(persistentEntity, row);
|
||||
@@ -157,8 +158,8 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
DefaultSpELExpressionEvaluator expressionEvaluator = new DefaultSpELExpressionEvaluator(row, spELContext);
|
||||
BasicCassandraRowValueProvider rowValueProvider = new BasicCassandraRowValueProvider(row, expressionEvaluator);
|
||||
|
||||
CassandraPersistentEntityParameterValueProvider parameterProvider = new CassandraPersistentEntityParameterValueProvider(
|
||||
entity, rowValueProvider, null);
|
||||
CassandraPersistentEntityParameterValueProvider parameterProvider =
|
||||
new CassandraPersistentEntityParameterValueProvider(entity, rowValueProvider, null);
|
||||
|
||||
EntityInstantiator instantiator = instantiators.getInstantiatorFor(entity);
|
||||
S instance = instantiator.createInstance(entity, parameterProvider);
|
||||
@@ -171,11 +172,12 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
protected <S> S readEntityFromUdt(CassandraPersistentEntity<S> entity, UDTValue udtValue) {
|
||||
|
||||
DefaultSpELExpressionEvaluator expressionEvaluator = new DefaultSpELExpressionEvaluator(udtValue, spELContext);
|
||||
CassandraUDTValueProvider valueProvider = new CassandraUDTValueProvider(udtValue, CodecRegistry.DEFAULT_INSTANCE,
|
||||
expressionEvaluator);
|
||||
|
||||
CassandraPersistentEntityParameterValueProvider parameterProvider = new CassandraPersistentEntityParameterValueProvider(
|
||||
entity, valueProvider, null);
|
||||
CassandraUDTValueProvider valueProvider = new CassandraUDTValueProvider(
|
||||
udtValue, CodecRegistry.DEFAULT_INSTANCE, expressionEvaluator);
|
||||
|
||||
CassandraPersistentEntityParameterValueProvider parameterProvider =
|
||||
new CassandraPersistentEntityParameterValueProvider(entity, valueProvider, null);
|
||||
|
||||
EntityInstantiator instantiator = instantiators.getInstantiatorFor(entity);
|
||||
S instance = instantiator.createInstance(entity, parameterProvider);
|
||||
@@ -185,8 +187,9 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
return instance;
|
||||
}
|
||||
|
||||
protected void readPropertiesFromRow(final CassandraPersistentEntity<?> entity, final CassandraRowValueProvider row,
|
||||
final PersistentPropertyAccessor propertyAccessor) {
|
||||
protected void readPropertiesFromRow(CassandraPersistentEntity<?> entity, CassandraRowValueProvider row,
|
||||
PersistentPropertyAccessor propertyAccessor) {
|
||||
|
||||
readProperties(entity, row, propertyAccessor);
|
||||
}
|
||||
|
||||
@@ -203,16 +206,13 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entity
|
||||
* @param property
|
||||
* @param valueProvider
|
||||
* @param propertyAccessor
|
||||
* @deprecated Use
|
||||
* {@link #readProperty(CassandraPersistentEntity, CassandraPersistentProperty, CassandraValueProvider, PersistentPropertyAccessor)}
|
||||
*/
|
||||
@Deprecated
|
||||
protected void readPropertyFromRow(CassandraPersistentEntity<?> entity, CassandraPersistentProperty property,
|
||||
CassandraRowValueProvider valueProvider, PersistentPropertyAccessor propertyAccessor) {
|
||||
|
||||
readProperty(entity, property, valueProvider, propertyAccessor);
|
||||
}
|
||||
|
||||
@@ -225,7 +225,6 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
}
|
||||
|
||||
if (property.isCompositePrimaryKey()) {
|
||||
|
||||
CassandraPersistentProperty keyProperty = entity.getIdProperty();
|
||||
CassandraPersistentEntity<?> keyEntity = keyProperty.getCompositePrimaryKeyEntity();
|
||||
|
||||
@@ -326,7 +325,8 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
Object value = getWriteValue(property, accessor);
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("doWithProperties Property.type {}, Property.value {}", property.getType().getName(), value);
|
||||
log.debug("doWithProperties Property.type {}, Property.value {}",
|
||||
property.getType().getName(), value);
|
||||
}
|
||||
|
||||
if (property.isCompositePrimaryKey()) {
|
||||
@@ -334,8 +334,8 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
log.debug("Property is a compositeKey");
|
||||
}
|
||||
|
||||
writeInsertFromWrapper(getConvertingAccessor(value, property.getCompositePrimaryKeyEntity()), insert,
|
||||
property.getCompositePrimaryKeyEntity());
|
||||
writeInsertFromWrapper(getConvertingAccessor(value, property.getCompositePrimaryKeyEntity()),
|
||||
insert, property.getCompositePrimaryKeyEntity());
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -432,10 +432,7 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
|
||||
Object id = extractId(source, entity);
|
||||
|
||||
if (id == null) {
|
||||
String message = String.format("No Id value found in object %s", source);
|
||||
throw new IllegalArgumentException(message);
|
||||
}
|
||||
Assert.notNull(id, String.format("No Id value found in object %s", source));
|
||||
|
||||
if (id instanceof MapId) {
|
||||
return getWhereClauses((MapId) id, idProperty != null && idProperty.isCompositePrimaryKey()
|
||||
@@ -459,9 +456,10 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
}
|
||||
|
||||
Class<?> targetType = getTargetType(idProperty);
|
||||
|
||||
if (conversionService.canConvert(id.getClass(), targetType)) {
|
||||
return Collections
|
||||
.singleton(QueryBuilder.eq(idProperty.getColumnName().toCql(), conversionService.convert(id, targetType)));
|
||||
return Collections.singleton(QueryBuilder.eq(idProperty.getColumnName().toCql(),
|
||||
conversionService.convert(id, targetType)));
|
||||
}
|
||||
|
||||
return Collections.singleton(QueryBuilder.eq(idProperty.getColumnName().toCql(), id));
|
||||
@@ -477,6 +475,7 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
} else if (source instanceof MapIdentifiable) {
|
||||
return ((MapIdentifiable) source).getMapId();
|
||||
}
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
@@ -487,10 +486,11 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
String.format("Entity [%s] is not a composite primary key", entity.getName()));
|
||||
|
||||
final Collection<Clause> clauses = new ArrayList<Clause>();
|
||||
|
||||
entity.doWithProperties(new PropertyHandler<CassandraPersistentProperty>() {
|
||||
|
||||
@Override
|
||||
public void doWithPersistentProperty(CassandraPersistentProperty property) {
|
||||
|
||||
TypeCodec<Object> codec = getCodec(property);
|
||||
Object value = accessor.getProperty(property, codec.getJavaType().getRawType());
|
||||
clauses.add(QueryBuilder.eq(property.getColumnName().toCql(), value));
|
||||
@@ -508,10 +508,10 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
|
||||
for (Entry<String, Serializable> entry : id.entrySet()) {
|
||||
CassandraPersistentProperty persistentProperty = entity.getPersistentProperty(entry.getKey());
|
||||
if (persistentProperty == null) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"MapId contains references [%s] that is an unknown property of [%s]", entry.getKey(), entity.getName()));
|
||||
}
|
||||
|
||||
Assert.notNull(persistentProperty,
|
||||
String.format("MapId contains references [%s] that is an unknown property of [%s]",
|
||||
entry.getKey(), entity.getName()));
|
||||
|
||||
clauses.add(QueryBuilder.eq(persistentProperty.getColumnName().toCql(),
|
||||
getWriteValue(persistentProperty, entry.getValue())));
|
||||
@@ -529,11 +529,9 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
|
||||
final ConvertingPropertyAccessor accessor = getConvertingAccessor(object, entity);
|
||||
|
||||
if (!entity.getType().isAssignableFrom(object.getClass())) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Given instance of type [%s] is not of compatible expected type [%s]",
|
||||
object.getClass().getName(), entity.getType().getName()));
|
||||
}
|
||||
Assert.isTrue(entity.getType().isAssignableFrom(object.getClass()),
|
||||
String.format("Given instance of type [%s] is not of compatible expected type [%s]",
|
||||
object.getClass().getName(), entity.getType().getName()));
|
||||
|
||||
if (object instanceof MapIdentifiable) {
|
||||
return ((MapIdentifiable) object).getMapId();
|
||||
@@ -628,11 +626,13 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
}
|
||||
|
||||
DataType dataType = mappingContext.getDataType(property);
|
||||
|
||||
if (dataType instanceof UserType) {
|
||||
return property.getType();
|
||||
}
|
||||
|
||||
TypeCodec<Object> codec = CodecRegistry.DEFAULT_INSTANCE.codecFor(mappingContext.getDataType(property));
|
||||
|
||||
return codec.getJavaType().getRawType();
|
||||
}
|
||||
|
||||
@@ -679,6 +679,7 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
}
|
||||
|
||||
CassandraPersistentEntity<?> persistentEntity = getMappingContext().getPersistentEntity(property.getActualType());
|
||||
|
||||
if (persistentEntity != null && persistentEntity.isUserDefinedType()) {
|
||||
|
||||
if (property.isCollectionLike() && value instanceof Collection) {
|
||||
@@ -740,6 +741,7 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
}
|
||||
|
||||
CassandraPersistentEntity<?> persistentEntity = getMappingContext().getPersistentEntity(property.getActualType());
|
||||
|
||||
if (persistentEntity != null && persistentEntity.isUserDefinedType()) {
|
||||
|
||||
if (property.isCollectionLike() && obj instanceof Collection) {
|
||||
@@ -752,6 +754,7 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
converted.add(readEntityFromUdt(persistentEntity, (UDTValue) element));
|
||||
}
|
||||
}
|
||||
|
||||
return converted;
|
||||
} else if (obj instanceof UDTValue) {
|
||||
return readEntityFromUdt(persistentEntity, (UDTValue) obj);
|
||||
|
||||
@@ -57,7 +57,7 @@ public class CassandraAdminTemplate extends CassandraTemplate implements Cassand
|
||||
super(session, converter);
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.cassandra.core.CassandraAdminOperations#createTable(boolean, org.springframework.cassandra.core.cql.CqlIdentifier, java.lang.Class, java.util.Map)
|
||||
*/
|
||||
@@ -82,7 +82,7 @@ public class CassandraAdminTemplate extends CassandraTemplate implements Cassand
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.cassandra.core.CassandraAdminOperations#alterTable(org.springframework.cassandra.core.cql.CqlIdentifier, java.lang.Class, boolean)
|
||||
*/
|
||||
@@ -91,7 +91,7 @@ public class CassandraAdminTemplate extends CassandraTemplate implements Cassand
|
||||
throw new UnsupportedOperationException("not yet implemented");
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.cassandra.core.CassandraAdminOperations#replaceTable(org.springframework.cassandra.core.cql.CqlIdentifier, java.lang.Class, java.util.Map)
|
||||
*/
|
||||
@@ -143,7 +143,7 @@ public class CassandraAdminTemplate extends CassandraTemplate implements Cassand
|
||||
@Override
|
||||
public void dropTable(CqlIdentifier tableName) {
|
||||
|
||||
Assert.notNull(tableName, "Type name must not be null");
|
||||
Assert.notNull(tableName, "Table name must not be null");
|
||||
|
||||
log.info("Dropping table => " + tableName);
|
||||
|
||||
@@ -164,7 +164,7 @@ public class CassandraAdminTemplate extends CassandraTemplate implements Cassand
|
||||
execute(DropUserTypeCqlGenerator.toCql(DropUserTypeSpecification.dropType(typeName)));
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.cassandra.core.CassandraAdminOperations#getTableMetadata(java.lang.String, org.springframework.cassandra.core.cql.CqlIdentifier)
|
||||
*/
|
||||
@@ -190,6 +190,7 @@ public class CassandraAdminTemplate extends CassandraTemplate implements Cassand
|
||||
public KeyspaceMetadata getKeyspaceMetadata() {
|
||||
|
||||
return execute(new SessionCallback<KeyspaceMetadata>() {
|
||||
|
||||
@Override
|
||||
public KeyspaceMetadata doInSession(Session s) throws DataAccessException {
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ import com.datastax.driver.core.UserType;
|
||||
/**
|
||||
* Schema creation support for Cassandra based on {@link CassandraMappingContext} and {@link CassandraPersistentEntity}.
|
||||
* This class generates CQL to drop, recreate and create user types (UDT) and tables.
|
||||
*
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @since 1.5
|
||||
* @see org.springframework.data.cassandra.mapping.Table
|
||||
@@ -58,7 +58,7 @@ public class CassandraPersistentEntitySchemaCreator {
|
||||
/**
|
||||
* Creates a new {@link CassandraPersistentEntitySchemaCreator} for the given {@link CassandraMappingContext} and
|
||||
* {@link CassandraAdminOperations}.
|
||||
*
|
||||
*
|
||||
* @param mappingContext must not be {@literal null}.
|
||||
* @param cassandraAdminOperations must not be {@literal null}.
|
||||
*/
|
||||
@@ -74,7 +74,7 @@ public class CassandraPersistentEntitySchemaCreator {
|
||||
|
||||
/**
|
||||
* Create user types. Can drop types and drop unused types.
|
||||
*
|
||||
*
|
||||
* @param dropUserTypes {@literal true} to drop types before creation.
|
||||
* @param dropUnused {@literal true} to drop unused types before creation. Type usage is determined from existing
|
||||
* mapped {@link org.springframework.data.cassandra.mapping.UserDefinedType}s and UDT names on field
|
||||
@@ -129,6 +129,7 @@ public class CassandraPersistentEntitySchemaCreator {
|
||||
List<CreateUserTypeSpecification> specifications = new ArrayList<CreateUserTypeSpecification>();
|
||||
|
||||
Set<CqlIdentifier> created = new HashSet<CqlIdentifier>();
|
||||
|
||||
for (CassandraPersistentEntity<?> entity : entities) {
|
||||
|
||||
Set<CqlIdentifier> seen = new LinkedHashSet<CqlIdentifier>();
|
||||
@@ -141,8 +142,8 @@ public class CassandraPersistentEntitySchemaCreator {
|
||||
for (CqlIdentifier identifier : ordered) {
|
||||
|
||||
if (created.add(identifier)) {
|
||||
specifications
|
||||
.add(mappingContext.getCreateUserTypeSpecificationFor(byName.get(identifier)).ifNotExists(ifNotExists));
|
||||
specifications.add(mappingContext.getCreateUserTypeSpecificationFor(
|
||||
byName.get(identifier)).ifNotExists(ifNotExists));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,12 +159,14 @@ public class CassandraPersistentEntitySchemaCreator {
|
||||
for (CassandraPersistentEntity<?> entity : entities) {
|
||||
specifications.add(mappingContext.getCreateTableSpecificationFor(entity).ifNotExists(ifNotExists));
|
||||
}
|
||||
|
||||
return specifications;
|
||||
}
|
||||
|
||||
private void visitUserTypes(CassandraPersistentEntity<?> entity, final Set<CqlIdentifier> seen) {
|
||||
|
||||
entity.doWithProperties(new PropertyHandler<CassandraPersistentProperty>() {
|
||||
|
||||
@Override
|
||||
public void doWithPersistentProperty(CassandraPersistentProperty persistentProperty) {
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
|
||||
import static org.springframework.cassandra.core.cql.CqlIdentifier.*;
|
||||
import static org.springframework.cassandra.core.keyspace.CreateTableSpecification.*;
|
||||
import static org.springframework.data.cassandra.mapping.CassandraSimpleTypeHolder.*;
|
||||
import static org.springframework.cassandra.core.cql.CqlIdentifier.cqlId;
|
||||
import static org.springframework.cassandra.core.keyspace.CreateTableSpecification.createTable;
|
||||
import static org.springframework.data.cassandra.mapping.CassandraSimpleTypeHolder.getDataTypeFor;
|
||||
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.lang.reflect.Field;
|
||||
@@ -84,6 +84,7 @@ public class BasicCassandraMappingContext
|
||||
protected Set<CassandraPersistentEntity<?>> userDefinedTypes = new HashSet<CassandraPersistentEntity<?>>();
|
||||
|
||||
private CustomConversions customConversions;
|
||||
|
||||
private UserTypeResolver userTypeResolver;
|
||||
|
||||
/**
|
||||
@@ -109,7 +110,7 @@ public class BasicCassandraMappingContext
|
||||
|
||||
/**
|
||||
* Sets the {@link UserTypeResolver}.
|
||||
*
|
||||
*
|
||||
* @param userTypeResolver must not be {@literal null}.
|
||||
* @since 1.5
|
||||
*/
|
||||
@@ -146,7 +147,7 @@ public class BasicCassandraMappingContext
|
||||
return Collections.unmodifiableSet(userDefinedTypes);
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.cassandra.mapping.CassandraMappingContext#getPersistentEntities(boolean)
|
||||
*/
|
||||
@@ -242,7 +243,7 @@ public class BasicCassandraMappingContext
|
||||
|
||||
CqlIdentifier identifier = CqlIdentifier.cqlId(userType.getTypeName());
|
||||
|
||||
return hasMappedUserType(identifier) || hasReferencedUserType(identifier);
|
||||
return (hasMappedUserType(identifier) || hasReferencedUserType(identifier));
|
||||
}
|
||||
|
||||
private boolean hasReferencedUserType(final CqlIdentifier identifier) {
|
||||
@@ -257,6 +258,7 @@ public class BasicCassandraMappingContext
|
||||
public void doWithPersistentProperty(CassandraPersistentProperty persistentProperty) {
|
||||
|
||||
CassandraType cassandraType = persistentProperty.findAnnotation(CassandraType.class);
|
||||
|
||||
if (cassandraType == null) {
|
||||
return;
|
||||
}
|
||||
@@ -429,8 +431,8 @@ public class BasicCassandraMappingContext
|
||||
*/
|
||||
@Override
|
||||
public DataType getDataType(Class<?> type) {
|
||||
return customConversions.hasCustomWriteTarget(type)
|
||||
? getDataTypeFor(customConversions.getCustomWriteTarget(type)) : getDataTypeFor(type);
|
||||
return (customConversions.hasCustomWriteTarget(type)
|
||||
? getDataTypeFor(customConversions.getCustomWriteTarget(type)) : getDataTypeFor(type));
|
||||
}
|
||||
|
||||
public void setMapping(Mapping mapping) {
|
||||
@@ -451,15 +453,16 @@ public class BasicCassandraMappingContext
|
||||
if (entityMapping == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String entityClassName = entityMapping.getEntityClassName();
|
||||
|
||||
try {
|
||||
|
||||
Class<?> entityClass = ClassUtils.forName(entityClassName, beanClassLoader);
|
||||
|
||||
CassandraPersistentEntity<?> entity = getPersistentEntity(entityClass);
|
||||
|
||||
Assert.state(entity != null, String.format("Unknown persistent entity class name [%s]", entityClassName));
|
||||
Assert.state(entity != null,
|
||||
String.format("Unknown persistent entity class name [%s]", entityClassName));
|
||||
|
||||
String tableName = entityMapping.getTableName();
|
||||
|
||||
@@ -470,7 +473,8 @@ public class BasicCassandraMappingContext
|
||||
processMappingOverrides(entity, entityMapping);
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new IllegalStateException(String.format("Unknown persistent entity name [%s]", entityClassName), e);
|
||||
throw new IllegalStateException(
|
||||
String.format("Unknown persistent entity name [%s]", entityClassName), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -485,10 +489,8 @@ public class BasicCassandraMappingContext
|
||||
|
||||
CassandraPersistentProperty property = entity.getPersistentProperty(mapping.getPropertyName());
|
||||
|
||||
if (property == null) {
|
||||
throw new IllegalArgumentException(String.format("Entity class [%s] has no persistent property named [%s]",
|
||||
entity.getType().getName(), mapping.getPropertyName()));
|
||||
}
|
||||
Assert.notNull(property, String.format("Entity class [%s] has no persistent property named [%s]",
|
||||
entity.getType().getName(), mapping.getPropertyName()));
|
||||
|
||||
boolean forceQuote = false;
|
||||
|
||||
@@ -514,11 +516,9 @@ public class BasicCassandraMappingContext
|
||||
|
||||
CassandraPersistentEntity<?> entity = entitiesByType.get(type);
|
||||
|
||||
if (entity != null) {
|
||||
return entity;
|
||||
}
|
||||
Assert.notNull(entity, String.format("Unknown persistent type [%s]", type.getName()));
|
||||
|
||||
throw new IllegalArgumentException(String.format("Unknown persistent type [%s]", type.getName()));
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
|
||||
import static org.springframework.cassandra.core.cql.CqlIdentifier.*;
|
||||
import static org.springframework.cassandra.core.cql.CqlIdentifier.cqlId;
|
||||
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.lang.reflect.Field;
|
||||
@@ -62,8 +62,6 @@ import com.datastax.driver.core.UserType;
|
||||
public class BasicCassandraPersistentProperty extends AnnotationBasedPersistentProperty<CassandraPersistentProperty>
|
||||
implements CassandraPersistentProperty, ApplicationContextAware {
|
||||
|
||||
private final UserTypeResolver userTypeResolver;
|
||||
|
||||
protected ApplicationContext context;
|
||||
|
||||
/**
|
||||
@@ -83,6 +81,8 @@ public class BasicCassandraPersistentProperty extends AnnotationBasedPersistentP
|
||||
|
||||
protected StandardEvaluationContext spelContext;
|
||||
|
||||
private final UserTypeResolver userTypeResolver;
|
||||
|
||||
/**
|
||||
* Creates a new {@link BasicCassandraPersistentProperty}.
|
||||
*
|
||||
@@ -111,6 +111,7 @@ public class BasicCassandraPersistentProperty extends AnnotationBasedPersistentP
|
||||
UserTypeResolver userTypeResolver) {
|
||||
|
||||
super(field, propertyDescriptor, owner, simpleTypeHolder);
|
||||
|
||||
this.userTypeResolver = userTypeResolver;
|
||||
|
||||
if (owner.getApplicationContext() != null) {
|
||||
@@ -154,9 +155,7 @@ public class BasicCassandraPersistentProperty extends AnnotationBasedPersistentP
|
||||
|
||||
List<CqlIdentifier> columnNames = getColumnNames();
|
||||
|
||||
if (columnNames.size() != 1) {
|
||||
throw new IllegalStateException(String.format("Property [%s] has no single column mapping", getName()));
|
||||
}
|
||||
Assert.state(columnNames.size() == 1, String.format("Property [%s] has no single column mapping", getName()));
|
||||
|
||||
return columnNames.get(0);
|
||||
}
|
||||
@@ -298,7 +297,7 @@ public class BasicCassandraPersistentProperty extends AnnotationBasedPersistentP
|
||||
if (dataType == null) {
|
||||
throw new InvalidDataAccessApiUsageException(String.format(
|
||||
"Only primitive types are allowed inside Collections for property [%1$s] of type [%2$s] in entity [%3$s]",
|
||||
getName(), getType(), getOwner().getName()));
|
||||
getName(), getType(), getOwner().getName()));
|
||||
}
|
||||
|
||||
return dataType;
|
||||
@@ -307,6 +306,7 @@ public class BasicCassandraPersistentProperty extends AnnotationBasedPersistentP
|
||||
protected DataType getDataTypeFor(Class<?> javaType) {
|
||||
|
||||
CassandraPersistentEntity<?> persistentEntity = getOwner().getMappingContext().getPersistentEntity(javaType);
|
||||
|
||||
if (persistentEntity != null && persistentEntity.isUserDefinedType()) {
|
||||
return persistentEntity.getUserType();
|
||||
}
|
||||
@@ -316,7 +316,7 @@ public class BasicCassandraPersistentProperty extends AnnotationBasedPersistentP
|
||||
if (dataType == null) {
|
||||
throw new InvalidDataAccessApiUsageException(String.format(
|
||||
"Only primitive types are allowed inside Collections for property [%1$s] of type ['%2$s'] in entity [%3$s]",
|
||||
getName(), getType(), getOwner().getName()));
|
||||
getName(), getType(), getOwner().getName()));
|
||||
}
|
||||
|
||||
return dataType;
|
||||
@@ -387,6 +387,7 @@ public class BasicCassandraPersistentProperty extends AnnotationBasedPersistentP
|
||||
final List<CqlIdentifier> columnNames) {
|
||||
|
||||
compositePrimaryKeyEntity.doWithProperties(new PropertyHandler<CassandraPersistentProperty>() {
|
||||
|
||||
@Override
|
||||
public void doWithPersistentProperty(CassandraPersistentProperty property) {
|
||||
if (property.isCompositePrimaryKey()) {
|
||||
@@ -402,6 +403,7 @@ public class BasicCassandraPersistentProperty extends AnnotationBasedPersistentP
|
||||
public void setColumnName(CqlIdentifier columnName) {
|
||||
|
||||
Assert.notNull(columnName, "columnName must not be null");
|
||||
|
||||
setColumnNames(Collections.singletonList(columnName));
|
||||
}
|
||||
|
||||
@@ -413,15 +415,13 @@ public class BasicCassandraPersistentProperty extends AnnotationBasedPersistentP
|
||||
// force calculation of columnNames if not known yet
|
||||
getColumnNames();
|
||||
|
||||
if (this.columnNames.size() != columnNames.size()) {
|
||||
throw new IllegalStateException(String.format(
|
||||
"Property [%s] of entity [%s] is mapped to [%s] column%s, but given column name list has size [%s]",
|
||||
Assert.state(this.columnNames.size() == columnNames.size(), String.format(
|
||||
"Property [%s] of entity [%s] is mapped to [%s] column%s, but given column name list has size [%s]",
|
||||
getName(), getOwner().getType().getName(), this.columnNames.size(), this.columnNames.size() == 1 ? "" : "s",
|
||||
columnNames.size()));
|
||||
}
|
||||
columnNames.size()));
|
||||
|
||||
this.columnNames = this.explicitColumnNames = Collections
|
||||
.unmodifiableList(new ArrayList<CqlIdentifier>(columnNames));
|
||||
this.columnNames = this.explicitColumnNames =
|
||||
Collections.unmodifiableList(new ArrayList<CqlIdentifier>(columnNames));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -446,10 +446,8 @@ public class BasicCassandraPersistentProperty extends AnnotationBasedPersistentP
|
||||
@Override
|
||||
public List<CassandraPersistentProperty> getCompositePrimaryKeyProperties() {
|
||||
|
||||
if (!isCompositePrimaryKey()) {
|
||||
throw new IllegalStateException(
|
||||
String.format("[%s] does not represent a composite primary key property", getName()));
|
||||
}
|
||||
Assert.state(isCompositePrimaryKey(),
|
||||
String.format("[%s] does not represent a composite primary key property", getName()));
|
||||
|
||||
return getCompositePrimaryKeyEntity().getCompositePrimaryKeyProperties();
|
||||
}
|
||||
@@ -459,9 +457,7 @@ public class BasicCassandraPersistentProperty extends AnnotationBasedPersistentP
|
||||
|
||||
CassandraMappingContext mappingContext = getOwner().getMappingContext();
|
||||
|
||||
if (mappingContext == null) {
|
||||
throw new IllegalStateException("CassandraMappingContext needed");
|
||||
}
|
||||
Assert.state(mappingContext != null, "CassandraMappingContext needed");
|
||||
|
||||
return mappingContext.getPersistentEntity(getCompositePrimaryKeyTypeInformation());
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.datastax.driver.core.UserType;
|
||||
/**
|
||||
* Default implementation of {@link UserTypeResolver} that resolves {@link UserType} by their name from
|
||||
* {@link Cluster#getMetadata()}.
|
||||
*
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @since 1.5
|
||||
*/
|
||||
@@ -56,6 +56,7 @@ public class SimpleUserTypeResolver implements UserTypeResolver {
|
||||
public UserType resolveType(CqlIdentifier typeName) {
|
||||
|
||||
KeyspaceMetadata keyspace = cluster.getMetadata().getKeyspace(keyspaceName);
|
||||
|
||||
return keyspace.getUserType(typeName.toCql());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,6 +155,7 @@ class ConvertingParameterAccessor implements CassandraParameterAccessor {
|
||||
|
||||
// TODO: Polishing necessary
|
||||
DataType parameterType = getDataType(index, property);
|
||||
|
||||
if (parameterType != null) {
|
||||
|
||||
if (property != null && getCustomConversions().hasCustomWriteTarget(property.getActualType())
|
||||
@@ -176,23 +177,26 @@ class ConvertingParameterAccessor implements CassandraParameterAccessor {
|
||||
}
|
||||
|
||||
if (property != null) {
|
||||
CassandraPersistentEntity<?> persistentEntity = converter.getMappingContext()
|
||||
.getPersistentEntity(property.getActualType());
|
||||
CassandraPersistentEntity<?> persistentEntity =
|
||||
converter.getMappingContext().getPersistentEntity(property.getActualType());
|
||||
|
||||
if (persistentEntity != null && persistentEntity.isUserDefinedType()) {
|
||||
return toUDTValue(bindableValue, persistentEntity);
|
||||
}
|
||||
}
|
||||
|
||||
TypeCodec<?> cassandraType = CodecRegistry.DEFAULT_INSTANCE.codecFor(parameterType);
|
||||
|
||||
if (cassandraType.getJavaType().getRawType().isAssignableFrom(bindableValue.getClass())) {
|
||||
return bindableValue;
|
||||
}
|
||||
|
||||
return converter.getConversionService().convert(bindableValue, cassandraType.getJavaType().getRawType());
|
||||
}
|
||||
return converter.getConversionService().convert(bindableValue, cassandraType.getJavaType().getRawType());
|
||||
}
|
||||
|
||||
CassandraPersistentEntity<?> persistentEntity =
|
||||
converter.getMappingContext().getPersistentEntity(bindableValue.getClass());
|
||||
|
||||
CassandraPersistentEntity<?> persistentEntity = converter.getMappingContext()
|
||||
.getPersistentEntity(bindableValue.getClass());
|
||||
if (persistentEntity != null && persistentEntity.isUserDefinedType()) {
|
||||
return toUDTValue(bindableValue, persistentEntity);
|
||||
}
|
||||
@@ -207,6 +211,7 @@ class ConvertingParameterAccessor implements CassandraParameterAccessor {
|
||||
}
|
||||
|
||||
UDTValue udtValue = persistentEntity.getUserType().newValue();
|
||||
|
||||
converter.write(bindableValue, udtValue, persistentEntity);
|
||||
|
||||
return udtValue;
|
||||
|
||||
@@ -117,7 +117,7 @@ public class StringBasedCassandraQuery extends AbstractCassandraQuery {
|
||||
}
|
||||
|
||||
return boundQuery;
|
||||
} catch (RuntimeException e) { e.printStackTrace();
|
||||
} catch (RuntimeException e) {
|
||||
throw QueryCreationException.create(getQueryMethod(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsd:schema xmlns="http://www.springframework.org/schema/data/cassandra"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:repository="http://www.springframework.org/schema/data/repository"
|
||||
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/data/cassandra"
|
||||
elementFormDefault="qualified" attributeFormDefault="unqualified">
|
||||
|
||||
<xsd:import namespace="http://www.springframework.org/schema/beans"
|
||||
schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd" />
|
||||
schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd" />
|
||||
<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:import namespace="http://www.springframework.org/schema/context"
|
||||
schemaLocation="http://www.springframework.org/schema/context/spring-context.xsd" />
|
||||
schemaLocation="http://www.springframework.org/schema/context/spring-context.xsd" />
|
||||
<xsd:import namespace="http://www.springframework.org/schema/data/repository"
|
||||
schemaLocation="http://www.springframework.org/schema/data/repository/spring-repository.xsd" />
|
||||
schemaLocation="http://www.springframework.org/schema/data/repository/spring-repository.xsd" />
|
||||
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
@@ -24,17 +21,6 @@ Defines the configuration elements in the XML namespace for Spring Data Cassandr
|
||||
]]></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
|
||||
@@ -49,6 +35,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>
|
||||
@@ -60,6 +75,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">
|
||||
@@ -308,7 +345,7 @@ Sets the maximum time to wait for schema agreement before returning from a DDL q
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="metrics-enabled" type="xsd:string"
|
||||
default="true">
|
||||
default="true">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Determine whether or not to collect metrics. Defaults to true.
|
||||
@@ -442,126 +479,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="cassandra-converter-ref" type="cassandraConverterRef" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The reference to a CassandraConverter; default is "cassandraConverter".
|
||||
]]></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:attribute name="schema-action" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The schema action to perform; default is NONE.
|
||||
]]></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="cassandra-converter-ref" type="cassandraConverterRef" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The reference to a CassandraConverter; default is "cassandraConverter".
|
||||
]]></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[
|
||||
@@ -653,6 +570,93 @@ If the utilisation of opened connections drops below by this configured threshol
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="replicationType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Provides the ability to configure the keyspace's replication settings.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="data-center" type="datacenterType" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Provides the ability to specify replication factors by data center.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="class" type="xsd:string" use="optional" default="SimpleStrategy">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The name of the replication class; default is "SIMPLE_STRATEGY".
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="replication-factor" type="xsd:string" use="optional" default="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The replication factor; default is 1.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</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="cassandra-converter-ref" type="cassandraConverterRef" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The reference to a CassandraConverter; default is "cassandraConverter".
|
||||
]]></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:attribute name="schema-action" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The schema action to perform; default is NONE.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="socketOptionsType">
|
||||
<xsd:attribute name="connect-timeout-millis" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
@@ -712,37 +716,40 @@ Sets the SO_TCPNODELAY socket option.
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="replicationType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Provides the ability to configure the keyspace's replication settings.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="data-center" type="datacenterType" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Provides the ability to specify replication factors by data center.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="class" type="xsd:string" use="optional" default="SimpleStrategy">
|
||||
<xsd:complexType name="templateType">
|
||||
<xsd:attribute name="id" type="xsd:ID" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The name of the replication class; default is "SIMPLE_STRATEGY".
|
||||
The name of the template; default is "cassandraTemplate".
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="replication-factor" type="xsd:string" use="optional" default="1">
|
||||
<xsd:attribute name="cassandra-converter-ref" type="cassandraConverterRef" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The replication factor; default is 1.
|
||||
The reference to a CassandraConverter; default is "cassandraConverter".
|
||||
]]></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:attributeGroup name="cassandra-repository-attributes">
|
||||
<xsd:attribute name="cassandra-template-ref" type="cassandraTemplateRef">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The reference to a cassandraTemplate. Will default to 'cassandraTemplate'.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:attributeGroup>
|
||||
|
||||
<xsd:element name="repositories">
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
@@ -754,16 +761,6 @@ The replication factor; default is 1.
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:attributeGroup name="cassandra-repository-attributes">
|
||||
<xsd:attribute name="cassandra-template-ref" type="cassandraTemplateRef">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The reference to a cassandraTemplate. Will default to 'cassandraTemplate'.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:attributeGroup>
|
||||
|
||||
<xsd:simpleType name="cassandraTemplateRef" final="union">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
@@ -776,6 +773,28 @@ The reference to a cassandraTemplate. Will default to 'cassandraTemplate'.
|
||||
<xsd:union memberTypes="xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:element name="converter">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Defines a CassandraConverter for getting rich mapping functionality.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:exports
|
||||
type="org.springframework.data.cassandra.convert.CassandraConverter" />
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="mapping-ref" type="mappingContextRef" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation
|
||||
source="org.springframework.data.cassandra.mapping.CassandraMappingContext"><![CDATA[
|
||||
The reference to a CassandraMappingContext. Will default to 'cassandraMapping'.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="mapping">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
@@ -812,6 +831,17 @@ The reference to a UserTypeResolver. UserTypeResolver is required when working w
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:simpleType name="cassandraConverterRef" final="union">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:assignable-to type="org.springframework.data.cassandra.convert.CassandraConverter"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:union memberTypes="xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:simpleType name="mappingContextRef">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
@@ -823,23 +853,6 @@ The reference to a UserTypeResolver. UserTypeResolver is required when working w
|
||||
<xsd:union memberTypes="xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:complexType name="userTypeResolverType">
|
||||
<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: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:complexType>
|
||||
|
||||
<xsd:complexType name="entityType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="table" type="tableType" minOccurs="0" maxOccurs="1" />
|
||||
@@ -896,37 +909,21 @@ Table name override.
|
||||
<!-- TODO: allow specification of C* table options here -->
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:element name="converter">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Defines a CassandraConverter for getting rich mapping functionality.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:exports
|
||||
type="org.springframework.data.cassandra.convert.CassandraConverter" />
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="mapping-ref" type="mappingContextRef" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation
|
||||
source="org.springframework.data.cassandra.mapping.CassandraMappingContext"><![CDATA[
|
||||
The reference to a CassandraMappingContext. Will default to 'cassandraMapping'.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:simpleType name="cassandraConverterRef" final="union">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:assignable-to type="org.springframework.data.cassandra.convert.CassandraConverter"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:union memberTypes="xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
<xsd:complexType name="userTypeResolverType">
|
||||
<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: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:complexType>
|
||||
|
||||
</xsd:schema>
|
||||
|
||||
@@ -36,17 +36,6 @@ Defines the configuration elements in the XML namespace for Spring Data Cassandr
|
||||
]]></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
|
||||
@@ -61,6 +50,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>
|
||||
@@ -72,6 +90,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">
|
||||
@@ -320,7 +360,7 @@ Sets the maximum time to wait for schema agreement before returning from a DDL q
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="metrics-enabled" type="xsd:string"
|
||||
default="true">
|
||||
default="true">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Determine whether or not to collect metrics. Defaults to true.
|
||||
@@ -454,126 +494,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="cassandra-converter-ref" type="cassandraConverterRef" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The reference to a CassandraConverter; default is "cassandraConverter".
|
||||
]]></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:attribute name="schema-action" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The schema action to perform; default is NONE.
|
||||
]]></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="cassandra-converter-ref" type="cassandraConverterRef" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The reference to a CassandraConverter; default is "cassandraConverter".
|
||||
]]></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[
|
||||
@@ -665,6 +585,93 @@ If the utilisation of opened connections drops below by this configured threshol
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="replicationType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Provides the ability to configure the keyspace's replication settings.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="data-center" type="datacenterType" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Provides the ability to specify replication factors by data center.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="class" type="xsd:string" use="optional" default="SimpleStrategy">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The name of the replication class; default is "SIMPLE_STRATEGY".
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="replication-factor" type="xsd:string" use="optional" default="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The replication factor; default is 1.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</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="cassandra-converter-ref" type="cassandraConverterRef" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The reference to a CassandraConverter; default is "cassandraConverter".
|
||||
]]></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:attribute name="schema-action" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The schema action to perform; default is NONE.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="socketOptionsType">
|
||||
<xsd:attribute name="connect-timeout-millis" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
@@ -724,37 +731,40 @@ Sets the SO_TCPNODELAY socket option.
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="replicationType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Provides the ability to configure the keyspace's replication settings.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="data-center" type="datacenterType" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Provides the ability to specify replication factors by data center.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="class" type="xsd:string" use="optional" default="SimpleStrategy">
|
||||
<xsd:complexType name="templateType">
|
||||
<xsd:attribute name="id" type="xsd:ID" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The name of the replication class; default is "SIMPLE_STRATEGY".
|
||||
The name of the template; default is "cassandraTemplate".
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="replication-factor" type="xsd:string" use="optional" default="1">
|
||||
<xsd:attribute name="cassandra-converter-ref" type="cassandraConverterRef" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The replication factor; default is 1.
|
||||
The reference to a CassandraConverter; default is "cassandraConverter".
|
||||
]]></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:attributeGroup name="cassandra-repository-attributes">
|
||||
<xsd:attribute name="cassandra-template-ref" type="cassandraTemplateRef">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The reference to a cassandraTemplate. Will default to 'cassandraTemplate'.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:attributeGroup>
|
||||
|
||||
<xsd:element name="repositories">
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
@@ -766,16 +776,6 @@ The replication factor; default is 1.
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:attributeGroup name="cassandra-repository-attributes">
|
||||
<xsd:attribute name="cassandra-template-ref" type="cassandraTemplateRef">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The reference to a cassandraTemplate. Will default to 'cassandraTemplate'.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:attributeGroup>
|
||||
|
||||
<xsd:simpleType name="cassandraTemplateRef" final="union">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
@@ -788,6 +788,28 @@ The reference to a cassandraTemplate. Will default to 'cassandraTemplate'.
|
||||
<xsd:union memberTypes="xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:element name="converter">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Defines a CassandraConverter for getting rich mapping functionality.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:exports
|
||||
type="org.springframework.data.cassandra.convert.CassandraConverter" />
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="mapping-ref" type="mappingContextRef" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation
|
||||
source="org.springframework.data.cassandra.mapping.CassandraMappingContext"><![CDATA[
|
||||
The reference to a CassandraMappingContext. Will default to 'cassandraMapping'.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="mapping">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
@@ -824,6 +846,17 @@ The reference to a UserTypeResolver. UserTypeResolver is required when working w
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:simpleType name="cassandraConverterRef" final="union">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:assignable-to type="org.springframework.data.cassandra.convert.CassandraConverter"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:union memberTypes="xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:simpleType name="mappingContextRef">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
@@ -835,23 +868,6 @@ The reference to a UserTypeResolver. UserTypeResolver is required when working w
|
||||
<xsd:union memberTypes="xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:complexType name="userTypeResolverType">
|
||||
<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: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:complexType>
|
||||
|
||||
<xsd:complexType name="entityType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="table" type="tableType" minOccurs="0" maxOccurs="1" />
|
||||
@@ -908,37 +924,21 @@ Table name override.
|
||||
<!-- TODO: allow specification of C* table options here -->
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:element name="converter">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Defines a CassandraConverter for getting rich mapping functionality.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:exports
|
||||
type="org.springframework.data.cassandra.convert.CassandraConverter" />
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="mapping-ref" type="mappingContextRef" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation
|
||||
source="org.springframework.data.cassandra.mapping.CassandraMappingContext"><![CDATA[
|
||||
The reference to a CassandraMappingContext. Will default to 'cassandraMapping'.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:simpleType name="cassandraConverterRef" final="union">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:assignable-to type="org.springframework.data.cassandra.convert.CassandraConverter"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:union memberTypes="xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
<xsd:complexType name="userTypeResolverType">
|
||||
<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: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:complexType>
|
||||
|
||||
</xsd:schema>
|
||||
|
||||
Reference in New Issue
Block a user