Package org.apache.cassandra.auth
Class DataResource
- java.lang.Object
-
- org.apache.cassandra.auth.DataResource
-
- All Implemented Interfaces:
IResource
public class DataResource extends java.lang.Object implements IResource
The primary type of resource in Cassandra. Used to represent a table or a keyspace or the root level "data" resource. "data" - the root level data resource. "data/keyspace_name" - keyspace-level data resource. "data/keyspace_name/*" - all tables-level data resource. "data/keyspace_name/table_name" - table-level data resource.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DataResource
allTables(java.lang.String keyspace)
Creates a DataResource representing all tables of a keyspace.java.util.Set<Permission>
applicablePermissions()
Returns the set of Permissions that may be applied to this resource Certain permissions are not applicable to particular types of resources.boolean
equals(java.lang.Object o)
boolean
exists()
static DataResource
fromName(java.lang.String name)
Parses a data resource name into a DataResource instance.java.lang.String
getKeyspace()
java.lang.String
getName()
IResource
getParent()
Gets next resource in the hierarchy.java.lang.String
getTable()
int
hashCode()
boolean
hasParent()
Indicates whether or not this resource has a parent in the hierarchy.boolean
isAllTablesLevel()
boolean
isKeyspaceLevel()
boolean
isRootLevel()
boolean
isTableLevel()
static DataResource
keyspace(java.lang.String keyspace)
Creates a DataResource representing a keyspace.static DataResource
root()
static DataResource
table(java.lang.String keyspace, java.lang.String table)
Creates a DataResource instance representing a table.java.lang.String
toString()
-
-
-
Method Detail
-
root
public static DataResource root()
- Returns:
- the root-level resource.
-
keyspace
public static DataResource keyspace(java.lang.String keyspace)
Creates a DataResource representing a keyspace.- Parameters:
keyspace
- Name of the keyspace.- Returns:
- DataResource instance representing the keyspace.
-
allTables
public static DataResource allTables(java.lang.String keyspace)
Creates a DataResource representing all tables of a keyspace.- Parameters:
keyspace
- Name of the keyspace.- Returns:
- DataResource instance representing the keyspace.
-
table
public static DataResource table(java.lang.String keyspace, java.lang.String table)
Creates a DataResource instance representing a table.- Parameters:
keyspace
- Name of the keyspace.table
- Name of the table.- Returns:
- DataResource instance representing the column family.
-
fromName
public static DataResource fromName(java.lang.String name)
Parses a data resource name into a DataResource instance.- Parameters:
name
- Name of the data resource.- Returns:
- DataResource instance matching the name.
-
getName
public java.lang.String getName()
-
getParent
public IResource getParent()
Description copied from interface:IResource
Gets next resource in the hierarchy. Call hasParent first to make sure there is one.
-
isRootLevel
public boolean isRootLevel()
-
isKeyspaceLevel
public boolean isKeyspaceLevel()
-
isAllTablesLevel
public boolean isAllTablesLevel()
-
isTableLevel
public boolean isTableLevel()
-
getKeyspace
public java.lang.String getKeyspace()
- Returns:
- keyspace of the resource. Throws IllegalStateException if it's the root-level resource.
-
getTable
public java.lang.String getTable()
- Returns:
- column family of the resource. Throws IllegalStateException if it's not a table-level resource.
-
hasParent
public boolean hasParent()
Description copied from interface:IResource
Indicates whether or not this resource has a parent in the hierarchy. Please perform this check before calling getParent() method.
-
exists
public boolean exists()
-
applicablePermissions
public java.util.Set<Permission> applicablePermissions()
Description copied from interface:IResource
Returns the set of Permissions that may be applied to this resource Certain permissions are not applicable to particular types of resources. For instance, it makes no sense to talk about CREATE permission on table, or SELECT on a Role. Here we filter a set of permissions depending on the specific resource they're being applied to. This is necessary because the CQL syntax supports ALL as wildcard, but the set of permissions that should resolve to varies by IResource.- Specified by:
applicablePermissions
in interfaceIResource
- Returns:
- the permissions that may be granted on the specific resource
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-