Search in sources :

Example 1 with IdleVerifyCommandArg

use of org.apache.ignite.internal.commandline.cache.argument.IdleVerifyCommandArg in project ignite by apache.

the class IdleVerify method parseArguments.

/**
 * {@inheritDoc}
 */
@Override
public void parseArguments(CommandArgIterator argIter) {
    Set<String> cacheNames = null;
    boolean dump = false;
    boolean skipZeros = false;
    boolean idleCheckCrc = false;
    CacheFilterEnum cacheFilterEnum = CacheFilterEnum.DEFAULT;
    Set<String> excludeCaches = null;
    int idleVerifyArgsCnt = 5;
    while (argIter.hasNextSubArg() && idleVerifyArgsCnt-- > 0) {
        String nextArg = argIter.nextArg("");
        IdleVerifyCommandArg arg = CommandArgUtils.of(nextArg, IdleVerifyCommandArg.class);
        if (arg == null) {
            cacheNames = argIter.parseStringSet(nextArg);
            validateRegexes(cacheNames);
        } else {
            switch(arg) {
                case DUMP:
                    dump = true;
                    break;
                case SKIP_ZEROS:
                    skipZeros = true;
                    break;
                case CHECK_CRC:
                    idleCheckCrc = true;
                    break;
                case CACHE_FILTER:
                    String filter = argIter.nextArg("The cache filter should be specified. The following " + "values can be used: " + Arrays.toString(CacheFilterEnum.values()) + '.');
                    cacheFilterEnum = CacheFilterEnum.valueOf(filter.toUpperCase());
                    break;
                case EXCLUDE_CACHES:
                    excludeCaches = argIter.nextStringSet("caches, which will be excluded.");
                    validateRegexes(excludeCaches);
                    break;
            }
        }
    }
    args = new Arguments(cacheNames, excludeCaches, dump, skipZeros, idleCheckCrc, cacheFilterEnum);
}
Also used : CacheFilterEnum(org.apache.ignite.internal.visor.verify.CacheFilterEnum) IdleVerifyCommandArg(org.apache.ignite.internal.commandline.cache.argument.IdleVerifyCommandArg)

Aggregations

IdleVerifyCommandArg (org.apache.ignite.internal.commandline.cache.argument.IdleVerifyCommandArg)1 CacheFilterEnum (org.apache.ignite.internal.visor.verify.CacheFilterEnum)1