Package org.apache.cassandra.auth
Class FunctionResource
- java.lang.Object
-
- org.apache.cassandra.auth.FunctionResource
-
- All Implemented Interfaces:
IResource
public class FunctionResource extends java.lang.Object implements IResource
IResource implementation representing functions. The root level "functions" resource represents the collection of all Functions. "functions" - root level resource representing all functions defined across every keyspace "functions/keyspace" - keyspace level resource to apply permissions to all functions within a keyspace "functions/keyspace/function" - a specific function, scoped to a given keyspace
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.int
compareTo(FunctionResource o)
boolean
equals(java.lang.Object o)
boolean
exists()
static FunctionResource
fromName(java.lang.String name)
Parses a resource name into a FunctionResource instance.static FunctionResource
function(java.lang.String keyspace, java.lang.String name, java.util.List<AbstractType<?>> argTypes)
Creates a FunctionResource representing a specific, keyspace-scoped function.static FunctionResource
function(UserFunction function)
static FunctionResource
functionFromCql(java.lang.String keyspace, java.lang.String name, java.util.List<CQL3Type.Raw> argTypes)
Creates a FunctionResource representing a specific, keyspace-scoped function.static FunctionResource
functionFromCql(FunctionName name, java.util.List<CQL3Type.Raw> argTypes)
FunctionName
getFunctionName()
java.lang.String
getKeyspace()
Get the name of the keyspace this resource relates to.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.static FunctionResource
keyspace(java.lang.String keyspace)
Creates a FunctionResource representing the collection of functions scoped to a specific keyspace.static FunctionResource
root()
java.lang.String
toString()
-
-
-
Method Detail
-
root
public static FunctionResource root()
- Returns:
- the root-level resource.
-
keyspace
public static FunctionResource keyspace(java.lang.String keyspace)
Creates a FunctionResource representing the collection of functions scoped to a specific keyspace.- Parameters:
keyspace
- name of the keyspace- Returns:
- FunctionResource instance representing all of the keyspace's functions
-
function
public static FunctionResource function(java.lang.String keyspace, java.lang.String name, java.util.List<AbstractType<?>> argTypes)
Creates a FunctionResource representing a specific, keyspace-scoped function.- Parameters:
keyspace
- the keyspace in which the function is scopedname
- name of the function.argTypes
- the types of the arguments to the function- Returns:
- FunctionResource instance reresenting the function.
-
function
public static FunctionResource function(UserFunction function)
-
functionFromCql
public static FunctionResource functionFromCql(java.lang.String keyspace, java.lang.String name, java.util.List<CQL3Type.Raw> argTypes)
Creates a FunctionResource representing a specific, keyspace-scoped function. This variant is used to create an instance during parsing of a CQL statement. It includes transposition of the arg types from CQL types to AbstractType implementations- Parameters:
keyspace
- the keyspace in which the function is scopedname
- name of the function.argTypes
- the types of the function arguments in raw CQL form- Returns:
- FunctionResource instance reresenting the function.
-
functionFromCql
public static FunctionResource functionFromCql(FunctionName name, java.util.List<CQL3Type.Raw> argTypes)
-
fromName
public static FunctionResource fromName(java.lang.String name)
Parses a resource name into a FunctionResource instance. A valid resource name for function should be in the follow format: functions/KEYSPACE/FUNCTION_NAME[FUNCTION_ARGS] Note that 1. FUNCTION_NAME could contain any character due to the use of quoted text in CQL. 2. FUNCTION_ARGS could be empty. If it is not empty, it is expressed in this format: FUNCTION_ARG1^FUNCTION_ARG2... where ^ is the delimiter for arguments- Parameters:
name
- Name of the function resource.- Returns:
- FunctionResource instance matching the name.
-
getName
public java.lang.String getName()
-
getKeyspace
public java.lang.String getKeyspace()
Get the name of the keyspace this resource relates to. In the case of the global root resource, return null- Returns:
- the keyspace name of this resource, or null for the root resource
-
getFunctionName
public FunctionName getFunctionName()
- Returns:
- a qualified FunctionName instance for a function-level resource. Throws IllegalStateException if called on the resource which doens't represent a single function.
-
getParent
public IResource getParent()
Description copied from interface:IResource
Gets next resource in the hierarchy. Call hasParent first to make sure there is one.
-
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
-
compareTo
public int compareTo(FunctionResource o)
-
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
-
-