Search in sources :

Example 26 with CompositeResultData

use of org.apache.geode.management.internal.cli.result.CompositeResultData in project geode by apache.

the class CLIMultiStepHelper method createStepSeqResult.

public static Result createStepSeqResult(CLIStep[] steps) {
    CompositeResultData result = ResultBuilder.createCompositeResultData();
    SectionResultData section = result.addSection(STEP_SECTION);
    section.addData(NEXT_STEP_NAME, steps[0].getName());
    String[] array = new String[steps.length];
    for (int i = 0; i < steps.length; i++) {
        array[i] = steps[i++].getName();
    }
    section.addData(NEXT_STEP_NAMES, array);
    return ResultBuilder.buildResult(result);
}
Also used : CompositeResultData(org.apache.geode.management.internal.cli.result.CompositeResultData) SectionResultData(org.apache.geode.management.internal.cli.result.CompositeResultData.SectionResultData)

Example 27 with CompositeResultData

use of org.apache.geode.management.internal.cli.result.CompositeResultData in project geode by apache.

the class CLIMultiStepHelper method createEmptyResult.

public static Result createEmptyResult(String step) {
    CompositeResultData result = ResultBuilder.createCompositeResultData();
    SectionResultData section = result.addSection(STEP_SECTION);
    section.addData(NEXT_STEP_NAME, step);
    return ResultBuilder.buildResult(result);
}
Also used : CompositeResultData(org.apache.geode.management.internal.cli.result.CompositeResultData) SectionResultData(org.apache.geode.management.internal.cli.result.CompositeResultData.SectionResultData)

Example 28 with CompositeResultData

use of org.apache.geode.management.internal.cli.result.CompositeResultData in project geode by apache.

the class CLIMultiStepHelper method createPageResult.

public static Result createPageResult(String[] fields, Object[] values, String step, String[] header, Object[][] table) {
    CompositeResultData result = ResultBuilder.createCompositeResultData();
    SectionResultData section = result.addSection(STEP_SECTION);
    section.addData(NEXT_STEP_NAME, step);
    SectionResultData page = result.addSection(ARG_SECTION);
    if (fields.length != values.length)
        throw new RuntimeException("Fields array and its value arraylength dont match");
    for (int i = 0; i < fields.length; i++) {
        page.addData(fields[i], values[i]);
    }
    createPageTableAndBanner(page, header, table);
    return ResultBuilder.buildResult(result);
}
Also used : CompositeResultData(org.apache.geode.management.internal.cli.result.CompositeResultData) SectionResultData(org.apache.geode.management.internal.cli.result.CompositeResultData.SectionResultData)

Example 29 with CompositeResultData

use of org.apache.geode.management.internal.cli.result.CompositeResultData in project geode by apache.

the class CLIMultiStepHelper method getDisplayResultFromArgs.

public static CommandResult getDisplayResultFromArgs(GfJsonObject args) {
    SectionResultData sectionData = new SectionResultData(args);
    CompositeResultData data = ResultBuilder.createCompositeResultData();
    data.addSection(sectionData);
    return (CommandResult) ResultBuilder.buildResult(data);
}
Also used : CompositeResultData(org.apache.geode.management.internal.cli.result.CompositeResultData) SectionResultData(org.apache.geode.management.internal.cli.result.CompositeResultData.SectionResultData) CommandResult(org.apache.geode.management.internal.cli.result.CommandResult)

Example 30 with CompositeResultData

use of org.apache.geode.management.internal.cli.result.CompositeResultData in project geode by apache.

the class CLIMultiStepHelper method createPageResult.

public static Result createPageResult(List<String> fields, @SuppressWarnings("rawtypes") List values, String step, String[] header, Object[][] table) {
    CompositeResultData result = ResultBuilder.createCompositeResultData();
    SectionResultData section = result.addSection(STEP_SECTION);
    section.addData(NEXT_STEP_NAME, step);
    SectionResultData page = result.addSection(ARG_SECTION);
    if (fields.size() != values.size())
        throw new RuntimeException("Fields array and its value arraylength dont match");
    for (int i = 0; i < fields.size(); i++) {
        page.addData(fields.get(i), values.get(i));
    }
    createPageTableAndBanner(page, header, table);
    return ResultBuilder.buildResult(result);
}
Also used : CompositeResultData(org.apache.geode.management.internal.cli.result.CompositeResultData) SectionResultData(org.apache.geode.management.internal.cli.result.CompositeResultData.SectionResultData)

Aggregations

CompositeResultData (org.apache.geode.management.internal.cli.result.CompositeResultData)49 SectionResultData (org.apache.geode.management.internal.cli.result.CompositeResultData.SectionResultData)39 TabularResultData (org.apache.geode.management.internal.cli.result.TabularResultData)30 DistributedMember (org.apache.geode.distributed.DistributedMember)15 InternalCache (org.apache.geode.internal.cache.InternalCache)14 Result (org.apache.geode.management.cli.Result)14 CliMetaData (org.apache.geode.management.cli.CliMetaData)13 ResourceOperation (org.apache.geode.management.internal.security.ResourceOperation)13 CliCommand (org.springframework.shell.core.annotation.CliCommand)13 CommandResult (org.apache.geode.management.internal.cli.result.CommandResult)12 HashSet (java.util.HashSet)10 ArrayList (java.util.ArrayList)9 ObjectName (javax.management.ObjectName)9 SystemManagementService (org.apache.geode.management.internal.SystemManagementService)9 CommandResultException (org.apache.geode.management.internal.cli.result.CommandResultException)8 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)8 FlakyTest (org.apache.geode.test.junit.categories.FlakyTest)8 Test (org.junit.Test)8 List (java.util.List)6 CliFunctionResult (org.apache.geode.management.internal.cli.functions.CliFunctionResult)6