Class 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 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 scoped
        name - name of the function.
        argTypes - the types of the arguments to the function
        Returns:
        FunctionResource instance reresenting the 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 scoped
        name - name of the function.
        argTypes - the types of the function arguments in raw CQL form
        Returns:
        FunctionResource instance reresenting the function.
      • 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()
        Specified by:
        getName in interface IResource
        Returns:
        Printable name of the resource.
      • 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.
        Specified by:
        getParent in interface IResource
        Returns:
        Parent of the resource, if any. Throws IllegalStateException if it's the root-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.
      • exists

        public boolean exists()
        Specified by:
        exists in interface IResource
        Returns:
        Whether or not this resource exists in Cassandra.
      • 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 interface IResource
        Returns:
        the permissions that may be granted on the specific resource
      • 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