org.apache.cassandra.service
Class ClientState

java.lang.Object
  extended by org.apache.cassandra.service.ClientState

public class ClientState
extends java.lang.Object

A container for per-client, thread-local state that Avro/Thrift threads must hold. TODO: Kill thrift exceptions


Field Summary
static SemanticVersion DEFAULT_CQL_VERSION
           
 
Constructor Summary
ClientState()
          Construct a new, empty ClientState: can be reused after logout() or reset().
 
Method Summary
 void createSession()
           
 java.util.Map<java.lang.Integer,CQLStatement> getCQL3Prepared()
           
static SemanticVersion[] getCQLSupportedVersion()
           
 SemanticVersion getCQLVersion()
           
 java.lang.String getKeyspace()
           
 java.util.Map<java.lang.Integer,CQLStatement> getPrepared()
           
 java.lang.String getRawKeyspace()
           
 java.lang.String getSchedulingValue()
           
 long getTimestamp()
          This clock guarantees that updates from a given client will be ordered in the sequence seen, even if multiple updates happen in the same millisecond.
 void grantPermission(Permission permission, java.lang.String to, CFName on, boolean grantOption)
           
 void hasColumnFamilyAccess(java.lang.String columnFamily, Permission perm)
          Confirms that the client thread has the given Permission in the context of the given ColumnFamily and the current keyspace.
 void hasColumnFamilyAccess(java.lang.String keyspace, java.lang.String columnFamily, Permission perm)
           
 void hasColumnFamilySchemaAccess(java.lang.String keyspace, Permission perm)
          Confirms that the client thread has the given Permission for the ColumnFamily list of the provided keyspace.
 void hasKeyspaceAccess(java.lang.String keyspace, Permission perm)
           
 boolean isLogged()
           
 ResultMessage listPermissions(java.lang.String username)
           
 void login(java.util.Map<? extends java.lang.CharSequence,? extends java.lang.CharSequence> credentials)
          Attempts to login this client with the given credentials map.
 void logout()
           
 void prepareTracingSession(java.util.UUID sessionId)
           
 void reset()
           
 void revokePermission(Permission permission, java.lang.String from, CFName resource)
           
 void setCQLVersion(java.lang.String str)
           
 void setKeyspace(java.lang.String ks)
           
 boolean traceNextQuery()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CQL_VERSION

public static final SemanticVersion DEFAULT_CQL_VERSION
Constructor Detail

ClientState

public ClientState()
Construct a new, empty ClientState: can be reused after logout() or reset().

Method Detail

getPrepared

public java.util.Map<java.lang.Integer,CQLStatement> getPrepared()

getCQL3Prepared

public java.util.Map<java.lang.Integer,CQLStatement> getCQL3Prepared()

getRawKeyspace

public java.lang.String getRawKeyspace()

getKeyspace

public java.lang.String getKeyspace()
                             throws InvalidRequestException
Throws:
InvalidRequestException

setKeyspace

public void setKeyspace(java.lang.String ks)
                 throws InvalidRequestException
Throws:
InvalidRequestException

traceNextQuery

public boolean traceNextQuery()

prepareTracingSession

public void prepareTracingSession(java.util.UUID sessionId)

createSession

public void createSession()

getSchedulingValue

public java.lang.String getSchedulingValue()

login

public void login(java.util.Map<? extends java.lang.CharSequence,? extends java.lang.CharSequence> credentials)
           throws org.apache.cassandra.thrift.AuthenticationException
Attempts to login this client with the given credentials map.

Throws:
org.apache.cassandra.thrift.AuthenticationException

logout

public void logout()

reset

public void reset()

hasKeyspaceAccess

public void hasKeyspaceAccess(java.lang.String keyspace,
                              Permission perm)
                       throws UnauthorizedException,
                              InvalidRequestException
Throws:
UnauthorizedException
InvalidRequestException

hasColumnFamilySchemaAccess

public void hasColumnFamilySchemaAccess(java.lang.String keyspace,
                                        Permission perm)
                                 throws UnauthorizedException,
                                        InvalidRequestException
Confirms that the client thread has the given Permission for the ColumnFamily list of the provided keyspace.

Throws:
UnauthorizedException
InvalidRequestException

hasColumnFamilyAccess

public void hasColumnFamilyAccess(java.lang.String columnFamily,
                                  Permission perm)
                           throws UnauthorizedException,
                                  InvalidRequestException
Confirms that the client thread has the given Permission in the context of the given ColumnFamily and the current keyspace.

Throws:
UnauthorizedException
InvalidRequestException

hasColumnFamilyAccess

public void hasColumnFamilyAccess(java.lang.String keyspace,
                                  java.lang.String columnFamily,
                                  Permission perm)
                           throws UnauthorizedException,
                                  InvalidRequestException
Throws:
UnauthorizedException
InvalidRequestException

isLogged

public boolean isLogged()

getTimestamp

public long getTimestamp()
This clock guarantees that updates from a given client will be ordered in the sequence seen, even if multiple updates happen in the same millisecond. This can be useful when a client wants to perform multiple updates to a single column.


setCQLVersion

public void setCQLVersion(java.lang.String str)
                   throws InvalidRequestException
Throws:
InvalidRequestException

getCQLVersion

public SemanticVersion getCQLVersion()

getCQLSupportedVersion

public static SemanticVersion[] getCQLSupportedVersion()

grantPermission

public void grantPermission(Permission permission,
                            java.lang.String to,
                            CFName on,
                            boolean grantOption)
                     throws UnauthorizedException,
                            InvalidRequestException
Throws:
UnauthorizedException
InvalidRequestException

revokePermission

public void revokePermission(Permission permission,
                             java.lang.String from,
                             CFName resource)
                      throws UnauthorizedException,
                             InvalidRequestException
Throws:
UnauthorizedException
InvalidRequestException

listPermissions

public ResultMessage listPermissions(java.lang.String username)
                              throws UnauthorizedException,
                                     InvalidRequestException
Throws:
UnauthorizedException
InvalidRequestException


Copyright © 2012 The Apache Software Foundation