public void execute()

in src/java/org/apache/cassandra/tools/nodetool/InvalidatePermissionsCache.java [105:177]


    public void execute(NodeProbe probe)
    {
        if (args.isEmpty())
        {
            checkArgument(!allKeyspaces && StringUtils.isEmpty(keyspace) && StringUtils.isEmpty(table)
                    && !allRoles && StringUtils.isEmpty(role)
                    && !allFunctions && StringUtils.isEmpty(functionsInKeyspace) && StringUtils.isEmpty(function)
                    && !allMBeans && StringUtils.isEmpty(mBean),
                    "No resource options allowed without a <role> being specified");

            probe.invalidatePermissionsCache();
        }
        else
        {
            checkArgument(args.size() == 1,
                    "A single <role> is only supported / you have a typo in the resource options spelling");
            List<String> resourceNames = new ArrayList<>();

            // Data Resources
            if (allKeyspaces)
                resourceNames.add(DataResource.root().getName());

            if (allTables)
                if (StringUtils.isNotEmpty(keyspace))
                    resourceNames.add(DataResource.allTables(keyspace).getName());
                else
                    throw new IllegalArgumentException("--all-tables option should be passed along with --keyspace option");

            if (StringUtils.isNotEmpty(table))
                if (StringUtils.isNotEmpty(keyspace))
                    resourceNames.add(DataResource.table(keyspace, table).getName());
                else
                    throw new IllegalArgumentException("--table option should be passed along with --keyspace option");

            if (StringUtils.isNotEmpty(keyspace) && !allTables && StringUtils.isEmpty(table))
                resourceNames.add(DataResource.keyspace(keyspace).getName());

            // Roles Resources
            if (allRoles)
                resourceNames.add(RoleResource.root().getName());

            if (StringUtils.isNotEmpty(role))
                resourceNames.add(RoleResource.role(role).getName());

            // Function Resources
            if (allFunctions)
                resourceNames.add(FunctionResource.root().getName());

            if (StringUtils.isNotEmpty(function))
                if (StringUtils.isNotEmpty(functionsInKeyspace))
                    resourceNames.add(constructFunctionResource(functionsInKeyspace, function));
                else
                    throw new IllegalArgumentException("--function option should be passed along with --functions-in-keyspace option");
            else
                if (StringUtils.isNotEmpty(functionsInKeyspace))
                    resourceNames.add(FunctionResource.keyspace(functionsInKeyspace).getName());

            // MBeans Resources
            if (allMBeans)
                resourceNames.add(JMXResource.root().getName());

            if (StringUtils.isNotEmpty(mBean))
                resourceNames.add(JMXResource.mbean(mBean).getName());

            String roleName = args.get(0);

            if (resourceNames.isEmpty())
                throw new IllegalArgumentException("No resource options specified");

            for (String resourceName : resourceNames)
                probe.invalidatePermissionsCache(roleName, resourceName);
        }
    }