Package com.datastax.driver.core
Class KeyspaceMetadata
- java.lang.Object
-
- com.datastax.driver.core.KeyspaceMetadata
-
public class KeyspaceMetadata extends Object
Describes a keyspace defined in this cluster.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringasCQLQuery()Returns a CQL query representing this keyspace.booleanequals(Object o)StringexportAsString()Returns aStringcontaining CQL queries representing this keyspace and the user types and tables it contains.AggregateMetadatagetAggregate(String name, DataType... argumentTypes)Returns the definition of an aggregate in this keyspace.AggregateMetadatagetAggregate(String name, Collection<DataType> argumentTypes)Returns the definition of an aggregate in this keyspace.Collection<AggregateMetadata>getAggregates()Returns the aggregates defined in this keyspace.FunctionMetadatagetFunction(String name, DataType... argumentTypes)Returns the definition of a function in this keyspace.FunctionMetadatagetFunction(String name, Collection<DataType> argumentTypes)Returns the definition of a function in this keyspace.Collection<FunctionMetadata>getFunctions()Returns the functions defined in this keyspace.MaterializedViewMetadatagetMaterializedView(String name)Returns the metadata for a materialized view contained in this keyspace.Collection<MaterializedViewMetadata>getMaterializedViews()Returns the materialized views defined in this keyspace.StringgetName()Returns the name of this keyspace.Map<String,String>getReplication()Returns the replication options for this keyspace.TableMetadatagetTable(String name)Returns the metadata for a table contained in this keyspace.Collection<TableMetadata>getTables()Returns the tables defined in this keyspace.UserTypegetUserType(String name)Returns the definition for a user defined type (UDT) in this keyspace.Collection<UserType>getUserTypes()Returns the user types defined in this keyspace.inthashCode()booleanisDurableWrites()Returns whether durable writes are set on this keyspace.booleanisVirtual()Returns whether or not this keyspace is a virtual keyspaceStringtoString()booleanusesTablets()
-
-
-
Field Detail
-
KS_NAME
public static final String KS_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
public String getName()
Returns the name of this keyspace.- Returns:
- the name of this CQL keyspace.
-
isDurableWrites
public boolean isDurableWrites()
Returns whether durable writes are set on this keyspace.- Returns:
trueif durable writes are set on this keyspace (the default),falseotherwise.
-
isVirtual
public boolean isVirtual()
Returns whether or not this keyspace is a virtual keyspace- Returns:
trueif virtual keyspace default),falseotherwise.
-
getReplication
public Map<String,String> getReplication()
Returns the replication options for this keyspace.- Returns:
- a map containing the replication options for this keyspace.
-
getTable
public TableMetadata getTable(String name)
Returns the metadata for a table contained in this keyspace.- Parameters:
name- the name of table to retrieve- Returns:
- the metadata for table
nameif it exists in this keyspace,nullotherwise.
-
getTables
public Collection<TableMetadata> getTables()
Returns the tables defined in this keyspace.- Returns:
- a collection of the metadata for the tables defined in this keyspace.
-
getMaterializedView
public MaterializedViewMetadata getMaterializedView(String name)
Returns the metadata for a materialized view contained in this keyspace.- Parameters:
name- the name of materialized view to retrieve- Returns:
- the metadata for materialized view
nameif it exists in this keyspace,nullotherwise.
-
getMaterializedViews
public Collection<MaterializedViewMetadata> getMaterializedViews()
Returns the materialized views defined in this keyspace.- Returns:
- a collection of the metadata for the materialized views defined in this keyspace.
-
getUserType
public UserType getUserType(String name)
Returns the definition for a user defined type (UDT) in this keyspace.- Parameters:
name- the name of UDT definition to retrieve- Returns:
- the definition for
nameif it exists in this keyspace,nullotherwise.
-
getUserTypes
public Collection<UserType> getUserTypes()
Returns the user types defined in this keyspace.- Returns:
- a collection of the definition for the user types defined in this keyspace.
-
getFunction
public FunctionMetadata getFunction(String name, Collection<DataType> argumentTypes)
Returns the definition of a function in this keyspace.- Parameters:
name- the name of the function.argumentTypes- the types of the function's arguments.- Returns:
- the function definition if it exists in this keyspace,
nullotherwise.
-
getFunction
public FunctionMetadata getFunction(String name, DataType... argumentTypes)
Returns the definition of a function in this keyspace.- Parameters:
name- the name of the function.argumentTypes- the types of the function's arguments.- Returns:
- the function definition if it exists in this keyspace,
nullotherwise.
-
getFunctions
public Collection<FunctionMetadata> getFunctions()
Returns the functions defined in this keyspace.- Returns:
- a collection of the definition for the functions defined in this keyspace.
-
getAggregate
public AggregateMetadata getAggregate(String name, Collection<DataType> argumentTypes)
Returns the definition of an aggregate in this keyspace.- Parameters:
name- the name of the aggregate.argumentTypes- the types of the aggregate's arguments.- Returns:
- the aggregate definition if it exists in this keyspace,
nullotherwise.
-
getAggregate
public AggregateMetadata getAggregate(String name, DataType... argumentTypes)
Returns the definition of an aggregate in this keyspace.- Parameters:
name- the name of the aggregate.argumentTypes- the types of the aggregate's arguments.- Returns:
- the aggregate definition if it exists in this keyspace,
nullotherwise.
-
getAggregates
public Collection<AggregateMetadata> getAggregates()
Returns the aggregates defined in this keyspace.- Returns:
- a collection of the definition for the aggregates defined in this keyspace.
-
exportAsString
public String exportAsString()
Returns aStringcontaining CQL queries representing this keyspace and the user types and tables it contains.In other words, this method returns the queries that would allow to recreate the schema of this keyspace, along with all its user types/tables.
Note that the returned String is formatted to be human readable (for some definition of human readable at least).
- Returns:
- the CQL queries representing this keyspace schema as a {code String}.
-
asCQLQuery
public String asCQLQuery()
Returns a CQL query representing this keyspace.This method returns a single 'CREATE KEYSPACE' query with the options corresponding to this keyspace definition.
- Returns:
- the 'CREATE KEYSPACE' query corresponding to this keyspace.
- See Also:
exportAsString()
-
usesTablets
public boolean usesTablets()
-
-