org.apache.cassandra.auth
Class DataResource

java.lang.Object
  extended by 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 column family 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/column_family_name" - cf-level data resource.


Method Summary
static DataResource columnFamily(java.lang.String keyspace, java.lang.String columnFamily)
          Creates a DataResource instance representing a column family.
 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 getColumnFamily()
           
 java.lang.String getKeyspace()
           
 java.lang.String getName()
           
 IResource getParent()
          Gets next resource in the hierarchy.
 int hashCode()
           
 boolean hasParent()
          Indicates whether or not this resource has a parent in the hierarchy.
 boolean isColumnFamilyLevel()
           
 boolean isKeyspaceLevel()
           
 boolean isRootLevel()
           
static DataResource keyspace(java.lang.String keyspace)
          Creates a DataResource representing a keyspace.
static DataResource root()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

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.

columnFamily

public static DataResource columnFamily(java.lang.String keyspace,
                                        java.lang.String columnFamily)
Creates a DataResource instance representing a column family.

Parameters:
keyspace - Name of the keyspace.
columnFamily - Name of the column family.
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()
Specified by:
getName in interface IResource
Returns:
Printable name of the resource.

getParent

public IResource getParent()
Description copied from interface: IResource
Gets next resource in the hierarchy. Call hasParent first to make sure there is one.

Specified by:
getParent in interface IResource
Returns:
Parent of the resource, if any. Throws IllegalStateException if it's the root-level resource.

isRootLevel

public boolean isRootLevel()

isKeyspaceLevel

public boolean isKeyspaceLevel()

isColumnFamilyLevel

public boolean isColumnFamilyLevel()

getKeyspace

public java.lang.String getKeyspace()
Returns:
keyspace of the resource. Throws IllegalStateException if it's the root-level resource.

getColumnFamily

public java.lang.String getColumnFamily()
Returns:
column family of the resource. Throws IllegalStateException if it's not a cf-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.

Specified by:
hasParent in interface IResource
Returns:
Whether or not the resource has a parent in the hierarchy.

exists

public boolean exists()
Specified by:
exists in interface IResource
Returns:
Whether or not the resource exists in Cassandra.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2012 The Apache Software Foundation