Search in sources :

Example 6 with CliMetaData

use of org.apache.geode.management.cli.CliMetaData in project geode by apache.

the class DataCommands method importData.

@CliCommand(value = CliStrings.IMPORT_DATA, help = CliStrings.IMPORT_DATA__HELP)
@CliMetaData(relatedTopic = { CliStrings.TOPIC_GEODE_DATA, CliStrings.TOPIC_GEODE_REGION })
public Result importData(@CliOption(key = CliStrings.IMPORT_DATA__REGION, optionContext = ConverterHint.REGION_PATH, mandatory = true, help = CliStrings.IMPORT_DATA__REGION__HELP) String regionName, @CliOption(key = CliStrings.IMPORT_DATA__FILE, mandatory = true, unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, help = CliStrings.IMPORT_DATA__FILE__HELP) String filePath, @CliOption(key = CliStrings.IMPORT_DATA__MEMBER, mandatory = true, unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, optionContext = ConverterHint.MEMBERIDNAME, help = CliStrings.IMPORT_DATA__MEMBER__HELP) String memberNameOrId, @CliOption(key = CliStrings.IMPORT_DATA__INVOKE_CALLBACKS, unspecifiedDefaultValue = "false", help = CliStrings.IMPORT_DATA__INVOKE_CALLBACKS__HELP) boolean invokeCallbacks) {
    this.securityService.authorizeRegionWrite(regionName);
    Result result;
    try {
        final DistributedMember targetMember = CliUtil.getDistributedMemberByNameOrId(memberNameOrId);
        if (!filePath.endsWith(CliStrings.GEODE_DATA_FILE_EXTENSION)) {
            return ResultBuilder.createUserErrorResult(CliStrings.format(CliStrings.INVALID_FILE_EXTENSION, CliStrings.GEODE_DATA_FILE_EXTENSION));
        }
        if (targetMember != null) {
            final Object[] args = { regionName, filePath, invokeCallbacks };
            ResultCollector<?, ?> rc = CliUtil.executeFunction(importDataFunction, args, targetMember);
            List<Object> results = (List<Object>) rc.getResult();
            if (results != null) {
                Object resultObj = results.get(0);
                if (resultObj instanceof String) {
                    result = ResultBuilder.createInfoResult((String) resultObj);
                } else if (resultObj instanceof Exception) {
                    result = ResultBuilder.createGemFireErrorResult(((Exception) resultObj).getMessage());
                } else {
                    result = ResultBuilder.createGemFireErrorResult(CliStrings.format(CliStrings.COMMAND_FAILURE_MESSAGE, CliStrings.IMPORT_DATA));
                }
            } else {
                result = ResultBuilder.createGemFireErrorResult(CliStrings.format(CliStrings.COMMAND_FAILURE_MESSAGE, CliStrings.IMPORT_DATA));
            }
        } else {
            result = ResultBuilder.createUserErrorResult(CliStrings.format(CliStrings.IMPORT_DATA__MEMBER__NOT__FOUND, memberNameOrId));
        }
    } catch (CacheClosedException e) {
        result = ResultBuilder.createGemFireErrorResult(e.getMessage());
    } catch (FunctionInvocationTargetException e) {
        result = ResultBuilder.createGemFireErrorResult(CliStrings.format(CliStrings.COMMAND_FAILURE_MESSAGE, CliStrings.IMPORT_DATA));
    }
    return result;
}
Also used : DistributedMember(org.apache.geode.distributed.DistributedMember) FunctionInvocationTargetException(org.apache.geode.cache.execute.FunctionInvocationTargetException) List(java.util.List) ArrayList(java.util.ArrayList) CacheClosedException(org.apache.geode.cache.CacheClosedException) TimeoutException(java.util.concurrent.TimeoutException) FunctionInvocationTargetException(org.apache.geode.cache.execute.FunctionInvocationTargetException) CacheClosedException(org.apache.geode.cache.CacheClosedException) Result(org.apache.geode.management.cli.Result) DataCommandResult(org.apache.geode.management.internal.cli.domain.DataCommandResult) CliCommand(org.springframework.shell.core.annotation.CliCommand) CliMetaData(org.apache.geode.management.cli.CliMetaData)

Example 7 with CliMetaData

use of org.apache.geode.management.cli.CliMetaData in project geode by apache.

the class ConfigCommands method exportConfig.

/**
   * Export the cache configuration in XML format.
   *
   * @param member Member for which to write the configuration
   * @param group Group or groups for which to write the configuration
   * @return Results of the attempt to write the configuration
   */
@CliCommand(value = { CliStrings.EXPORT_CONFIG }, help = CliStrings.EXPORT_CONFIG__HELP)
@CliMetaData(interceptor = "org.apache.geode.management.internal.cli.commands.ConfigCommands$Interceptor", relatedTopic = { CliStrings.TOPIC_GEODE_CONFIG })
@ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
public Result exportConfig(@CliOption(key = { CliStrings.EXPORT_CONFIG__MEMBER }, optionContext = ConverterHint.ALL_MEMBER_IDNAME, help = CliStrings.EXPORT_CONFIG__MEMBER__HELP) String[] member, @CliOption(key = { CliStrings.EXPORT_CONFIG__GROUP }, optionContext = ConverterHint.MEMBERGROUP, help = CliStrings.EXPORT_CONFIG__GROUP__HELP) String[] group, @CliOption(key = { CliStrings.EXPORT_CONFIG__DIR }, help = CliStrings.EXPORT_CONFIG__DIR__HELP) String dir) {
    InfoResultData infoData = ResultBuilder.createInfoResultData();
    Set<DistributedMember> targetMembers = CliUtil.findMembers(group, member);
    if (targetMembers.isEmpty()) {
        return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
    }
    try {
        ResultCollector<?, ?> rc = CliUtil.executeFunction(this.exportConfigFunction, null, targetMembers);
        List<CliFunctionResult> results = CliFunctionResult.cleanResults((List<?>) rc.getResult());
        for (CliFunctionResult result : results) {
            if (result.getThrowable() != null) {
                infoData.addLine(CliStrings.format(CliStrings.EXPORT_CONFIG__MSG__EXCEPTION, result.getMemberIdOrName(), result.getThrowable()));
            } else if (result.isSuccessful()) {
                String cacheFileName = result.getMemberIdOrName() + "-cache.xml";
                String propsFileName = result.getMemberIdOrName() + "-gf.properties";
                String[] fileContent = (String[]) result.getSerializables();
                infoData.addAsFile(cacheFileName, fileContent[0], "Downloading Cache XML file: {0}", false);
                infoData.addAsFile(propsFileName, fileContent[1], "Downloading properties file: {0}", false);
            }
        }
        return ResultBuilder.buildResult(infoData);
    } catch (VirtualMachineError e) {
        SystemFailure.initiateFailure(e);
        throw e;
    } catch (Throwable th) {
        SystemFailure.checkFailure();
        th.printStackTrace(System.err);
        return ResultBuilder.createGemFireErrorResult(CliStrings.format(CliStrings.EXPORT_CONFIG__MSG__EXCEPTION, th.getClass().getName() + ": " + th.getMessage()));
    }
}
Also used : CliFunctionResult(org.apache.geode.management.internal.cli.functions.CliFunctionResult) InfoResultData(org.apache.geode.management.internal.cli.result.InfoResultData) DistributedMember(org.apache.geode.distributed.DistributedMember) CliCommand(org.springframework.shell.core.annotation.CliCommand) CliMetaData(org.apache.geode.management.cli.CliMetaData) ResourceOperation(org.apache.geode.management.internal.security.ResourceOperation)

Example 8 with CliMetaData

use of org.apache.geode.management.cli.CliMetaData in project geode by apache.

the class RegionCommands method describeRegion.

@CliCommand(value = { CliStrings.DESCRIBE_REGION }, help = CliStrings.DESCRIBE_REGION__HELP)
@CliMetaData(shellOnly = false, relatedTopic = { CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_CONFIG })
@ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
public Result describeRegion(@CliOption(key = CliStrings.DESCRIBE_REGION__NAME, optionContext = ConverterHint.REGION_PATH, help = CliStrings.DESCRIBE_REGION__NAME__HELP, mandatory = true) String regionName) {
    Result result = null;
    try {
        if (regionName == null || regionName.isEmpty()) {
            return ResultBuilder.createUserErrorResult("Please provide a region name");
        }
        if (regionName.equals(Region.SEPARATOR)) {
            return ResultBuilder.createUserErrorResult(CliStrings.INVALID_REGION_NAME);
        }
        InternalCache cache = getCache();
        ResultCollector<?, ?> rc = CliUtil.executeFunction(getRegionDescription, regionName, CliUtil.getAllMembers(cache));
        List<?> resultList = (List<?>) rc.getResult();
        // The returned result could be a region description with per member and /or single local
        // region
        Object[] results = resultList.toArray();
        List<RegionDescription> regionDescriptionList = new ArrayList<RegionDescription>();
        for (int i = 0; i < results.length; i++) {
            if (results[i] instanceof RegionDescriptionPerMember) {
                RegionDescriptionPerMember regionDescPerMember = (RegionDescriptionPerMember) results[i];
                if (regionDescPerMember != null) {
                    RegionDescription regionDescription = new RegionDescription();
                    regionDescription.add(regionDescPerMember);
                    for (int j = i + 1; j < results.length; j++) {
                        if (results[j] != null && results[j] instanceof RegionDescriptionPerMember) {
                            RegionDescriptionPerMember preyRegionDescPerMember = (RegionDescriptionPerMember) results[j];
                            if (regionDescription.add(preyRegionDescPerMember)) {
                                results[j] = null;
                            }
                        }
                    }
                    regionDescriptionList.add(regionDescription);
                }
            } else if (results[i] instanceof Throwable) {
                Throwable t = (Throwable) results[i];
                LogWrapper.getInstance().info(t.getMessage(), t);
            }
        }
        if (regionDescriptionList.isEmpty()) {
            return ResultBuilder.createUserErrorResult(CliStrings.format(CliStrings.REGION_NOT_FOUND, regionName));
        }
        CompositeResultData crd = ResultBuilder.createCompositeResultData();
        Iterator<RegionDescription> iters = regionDescriptionList.iterator();
        while (iters.hasNext()) {
            RegionDescription regionDescription = iters.next();
            // No point in displaying the scope for PR's
            if (regionDescription.isPartition()) {
                regionDescription.getCndRegionAttributes().remove(RegionAttributesNames.SCOPE);
            } else {
                String scope = regionDescription.getCndRegionAttributes().get(RegionAttributesNames.SCOPE);
                if (scope != null) {
                    scope = scope.toLowerCase().replace('_', '-');
                    regionDescription.getCndRegionAttributes().put(RegionAttributesNames.SCOPE, scope);
                }
            }
            SectionResultData regionSection = crd.addSection();
            regionSection.addSeparator('-');
            regionSection.addData("Name", regionDescription.getName());
            String dataPolicy = regionDescription.getDataPolicy().toString().toLowerCase().replace('_', ' ');
            regionSection.addData("Data Policy", dataPolicy);
            String memberType = "";
            if (regionDescription.isAccessor()) {
                memberType = CliStrings.DESCRIBE_REGION__ACCESSOR__MEMBER;
            } else {
                memberType = CliStrings.DESCRIBE_REGION__HOSTING__MEMBER;
            }
            regionSection.addData(memberType, CliUtil.convertStringSetToString(regionDescription.getHostingMembers(), '\n'));
            regionSection.addSeparator('.');
            TabularResultData commonNonDefaultAttrTable = regionSection.addSection().addTable();
            commonNonDefaultAttrTable.setHeader(CliStrings.format(CliStrings.DESCRIBE_REGION__NONDEFAULT__COMMONATTRIBUTES__HEADER, memberType));
            // Common Non Default Region Attributes
            Map<String, String> cndRegionAttrsMap = regionDescription.getCndRegionAttributes();
            // Common Non Default Eviction Attributes
            Map<String, String> cndEvictionAttrsMap = regionDescription.getCndEvictionAttributes();
            // Common Non Default Partition Attributes
            Map<String, String> cndPartitionAttrsMap = regionDescription.getCndPartitionAttributes();
            writeCommonAttributesToTable(commonNonDefaultAttrTable, CliStrings.DESCRIBE_REGION__ATTRIBUTE__TYPE__REGION, cndRegionAttrsMap);
            writeCommonAttributesToTable(commonNonDefaultAttrTable, CliStrings.DESCRIBE_REGION__ATTRIBUTE__TYPE__EVICTION, cndEvictionAttrsMap);
            writeCommonAttributesToTable(commonNonDefaultAttrTable, CliStrings.DESCRIBE_REGION__ATTRIBUTE__TYPE__PARTITION, cndPartitionAttrsMap);
            // Member-wise non default Attributes
            Map<String, RegionDescriptionPerMember> regDescPerMemberMap = regionDescription.getRegionDescriptionPerMemberMap();
            Set<String> members = regDescPerMemberMap.keySet();
            TabularResultData table = regionSection.addSection().addTable();
            // table.setHeader(CliStrings.format(CliStrings.DESCRIBE_REGION__NONDEFAULT__PERMEMBERATTRIBUTES__HEADER,
            // memberType));
            boolean setHeader = false;
            for (String member : members) {
                RegionDescriptionPerMember regDescPerMem = regDescPerMemberMap.get(member);
                Map<String, String> ndRa = regDescPerMem.getNonDefaultRegionAttributes();
                Map<String, String> ndEa = regDescPerMem.getNonDefaultEvictionAttributes();
                Map<String, String> ndPa = regDescPerMem.getNonDefaultPartitionAttributes();
                // Get all the member-specific non-default attributes by removing the common keys
                ndRa.keySet().removeAll(cndRegionAttrsMap.keySet());
                ndEa.keySet().removeAll(cndEvictionAttrsMap.keySet());
                ndPa.keySet().removeAll(cndPartitionAttrsMap.keySet());
                // Scope is not valid for PR's
                if (regionDescription.isPartition()) {
                    if (ndRa.get(RegionAttributesNames.SCOPE) != null) {
                        ndRa.remove(RegionAttributesNames.SCOPE);
                    }
                }
                List<FixedPartitionAttributesInfo> fpaList = regDescPerMem.getFixedPartitionAttributes();
                if (!(ndRa.isEmpty() && ndEa.isEmpty() && ndPa.isEmpty()) || fpaList != null) {
                    setHeader = true;
                    boolean memberNameAdded = false;
                    memberNameAdded = writeAttributesToTable(table, CliStrings.DESCRIBE_REGION__ATTRIBUTE__TYPE__REGION, ndRa, member, memberNameAdded);
                    memberNameAdded = writeAttributesToTable(table, CliStrings.DESCRIBE_REGION__ATTRIBUTE__TYPE__EVICTION, ndEa, member, memberNameAdded);
                    memberNameAdded = writeAttributesToTable(table, CliStrings.DESCRIBE_REGION__ATTRIBUTE__TYPE__PARTITION, ndPa, member, memberNameAdded);
                    writeFixedPartitionAttributesToTable(table, "", fpaList, member, memberNameAdded);
                // Fix for #46767
                // writeAttributeToTable(table, "", "", "", "");
                }
            }
            if (setHeader == true) {
                table.setHeader(CliStrings.format(CliStrings.DESCRIBE_REGION__NONDEFAULT__PERMEMBERATTRIBUTES__HEADER, memberType));
            }
        }
        result = ResultBuilder.buildResult(crd);
    } catch (FunctionInvocationTargetException e) {
        result = ResultBuilder.createGemFireErrorResult(CliStrings.format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN, CliStrings.DESCRIBE_REGION));
    } catch (Exception e) {
        String errorMessage = CliStrings.format(CliStrings.EXCEPTION_CLASS_AND_MESSAGE, e.getClass().getName(), e.getMessage());
        result = ResultBuilder.createGemFireErrorResult(errorMessage);
    }
    return result;
}
Also used : CompositeResultData(org.apache.geode.management.internal.cli.result.CompositeResultData) TabularResultData(org.apache.geode.management.internal.cli.result.TabularResultData) ArrayList(java.util.ArrayList) InternalCache(org.apache.geode.internal.cache.InternalCache) Result(org.apache.geode.management.cli.Result) FixedPartitionAttributesInfo(org.apache.geode.management.internal.cli.domain.FixedPartitionAttributesInfo) ArrayList(java.util.ArrayList) List(java.util.List) ConverterHint(org.apache.geode.management.cli.ConverterHint) FunctionInvocationTargetException(org.apache.geode.cache.execute.FunctionInvocationTargetException) CommandResultException(org.apache.geode.management.internal.cli.result.CommandResultException) RegionDescription(org.apache.geode.management.internal.cli.domain.RegionDescription) RegionDescriptionPerMember(org.apache.geode.management.internal.cli.domain.RegionDescriptionPerMember) FunctionInvocationTargetException(org.apache.geode.cache.execute.FunctionInvocationTargetException) SectionResultData(org.apache.geode.management.internal.cli.result.CompositeResultData.SectionResultData) CliCommand(org.springframework.shell.core.annotation.CliCommand) CliMetaData(org.apache.geode.management.cli.CliMetaData) ResourceOperation(org.apache.geode.management.internal.security.ResourceOperation)

Example 9 with CliMetaData

use of org.apache.geode.management.cli.CliMetaData in project geode by apache.

the class WanCommands method statusGatewaySender.

@CliCommand(value = CliStrings.STATUS_GATEWAYSENDER, help = CliStrings.STATUS_GATEWAYSENDER__HELP)
@CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_WAN)
@ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
public Result statusGatewaySender(@CliOption(key = CliStrings.STATUS_GATEWAYSENDER__ID, mandatory = true, optionContext = ConverterHint.GATEWAY_SENDER_ID, help = CliStrings.STATUS_GATEWAYSENDER__ID__HELP) String senderId, @CliOption(key = CliStrings.STATUS_GATEWAYSENDER__GROUP, optionContext = ConverterHint.MEMBERGROUP, help = CliStrings.STATUS_GATEWAYSENDER__GROUP__HELP) String[] onGroup, @CliOption(key = CliStrings.STATUS_GATEWAYSENDER__MEMBER, optionContext = ConverterHint.MEMBERIDNAME, help = CliStrings.STATUS_GATEWAYSENDER__MEMBER__HELP) String[] onMember) {
    Result result = null;
    if (senderId != null)
        senderId = senderId.trim();
    try {
        InternalCache cache = getCache();
        SystemManagementService service = (SystemManagementService) ManagementService.getExistingManagementService(cache);
        GatewaySenderMXBean bean = null;
        CompositeResultData crd = ResultBuilder.createCompositeResultData();
        TabularResultData availableSenderData = crd.addSection(CliStrings.SECTION_GATEWAY_SENDER_AVAILABLE).addTable(CliStrings.TABLE_GATEWAY_SENDER);
        TabularResultData notAvailableSenderData = crd.addSection(CliStrings.SECTION_GATEWAY_SENDER_NOT_AVAILABLE).addTable(CliStrings.TABLE_GATEWAY_SENDER);
        Set<DistributedMember> dsMembers = CliUtil.findMembers(onGroup, onMember);
        if (dsMembers.isEmpty()) {
            return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
        }
        for (DistributedMember member : dsMembers) {
            if (cache.getDistributedSystem().getDistributedMember().getId().equals(member.getId())) {
                bean = service.getLocalGatewaySenderMXBean(senderId);
            } else {
                ObjectName objectName = service.getGatewaySenderMBeanName(member, senderId);
                bean = service.getMBeanProxy(objectName, GatewaySenderMXBean.class);
            }
            if (bean != null) {
                buildSenderStatus(member.getId(), bean, availableSenderData);
            } else {
                buildSenderStatus(member.getId(), bean, notAvailableSenderData);
            }
        }
        result = ResultBuilder.buildResult(crd);
    } catch (Exception e) {
        LogWrapper.getInstance().warning(CliStrings.GATEWAY_ERROR + CliUtil.stackTraceAsString(e));
        result = ResultBuilder.createGemFireErrorResult(CliStrings.GATEWAY_ERROR + e.getMessage());
    }
    return result;
}
Also used : CompositeResultData(org.apache.geode.management.internal.cli.result.CompositeResultData) TabularResultData(org.apache.geode.management.internal.cli.result.TabularResultData) DistributedMember(org.apache.geode.distributed.DistributedMember) InternalCache(org.apache.geode.internal.cache.InternalCache) GatewaySenderMXBean(org.apache.geode.management.GatewaySenderMXBean) SystemManagementService(org.apache.geode.management.internal.SystemManagementService) CommandResultException(org.apache.geode.management.internal.cli.result.CommandResultException) ExecutionException(java.util.concurrent.ExecutionException) Result(org.apache.geode.management.cli.Result) CliFunctionResult(org.apache.geode.management.internal.cli.functions.CliFunctionResult) ObjectName(javax.management.ObjectName) CliCommand(org.springframework.shell.core.annotation.CliCommand) CliMetaData(org.apache.geode.management.cli.CliMetaData) ResourceOperation(org.apache.geode.management.internal.security.ResourceOperation)

Example 10 with CliMetaData

use of org.apache.geode.management.cli.CliMetaData in project geode by apache.

the class WanCommands method stopGatewayReceiver.

@CliCommand(value = CliStrings.STOP_GATEWAYRECEIVER, help = CliStrings.STOP_GATEWAYRECEIVER__HELP)
@CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_WAN)
@ResourceOperation(resource = Resource.DATA, operation = Operation.MANAGE)
public Result stopGatewayReceiver(@CliOption(key = CliStrings.STOP_GATEWAYRECEIVER__GROUP, optionContext = ConverterHint.MEMBERGROUP, help = CliStrings.STOP_GATEWAYRECEIVER__GROUP__HELP) String[] onGroup, @CliOption(key = CliStrings.STOP_GATEWAYRECEIVER__MEMBER, optionContext = ConverterHint.MEMBERIDNAME, help = CliStrings.STOP_GATEWAYRECEIVER__MEMBER__HELP) String[] onMember) {
    Result result = null;
    try {
        InternalCache cache = getCache();
        SystemManagementService service = (SystemManagementService) ManagementService.getExistingManagementService(cache);
        GatewayReceiverMXBean receieverBean = null;
        TabularResultData resultData = ResultBuilder.createTabularResultData();
        Set<DistributedMember> dsMembers = CliUtil.findMembers(onGroup, onMember);
        if (dsMembers.isEmpty()) {
            return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
        }
        for (DistributedMember member : dsMembers) {
            ObjectName gatewayReceiverObjectName = MBeanJMXAdapter.getGatewayReceiverMBeanName(member);
            if (gatewayReceiverObjectName != null) {
                receieverBean = service.getMBeanProxy(gatewayReceiverObjectName, GatewayReceiverMXBean.class);
                if (receieverBean != null) {
                    if (receieverBean.isRunning()) {
                        receieverBean.stop();
                        accumulateStartResult(resultData, member.getId(), CliStrings.GATEWAY_OK, CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_STOPPED_ON_MEMBER_0, new Object[] { member.getId() }));
                    } else {
                        accumulateStartResult(resultData, member.getId(), CliStrings.GATEWAY_ERROR, CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_NOT_RUNNING_ON_MEMBER_0, new Object[] { member.getId() }));
                    }
                } else {
                    accumulateStartResult(resultData, member.getId(), CliStrings.GATEWAY_ERROR, CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_NOT_AVAILABLE_ON_MEMBER_0, new Object[] { member.getId() }));
                }
            } else {
                accumulateStartResult(resultData, member.getId(), CliStrings.GATEWAY_ERROR, CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_NOT_AVAILABLE_ON_MEMBER_0, new Object[] { member.getId() }));
            }
        }
        result = ResultBuilder.buildResult(resultData);
    } catch (CommandResultException crex) {
        result = handleCommandResultException(crex);
    } catch (Exception e) {
        LogWrapper.getInstance().warning(CliStrings.GATEWAY_ERROR + CliUtil.stackTraceAsString(e));
        result = ResultBuilder.createGemFireErrorResult(CliStrings.GATEWAY_ERROR + e.getMessage());
    }
    return result;
}
Also used : GatewayReceiverMXBean(org.apache.geode.management.GatewayReceiverMXBean) TabularResultData(org.apache.geode.management.internal.cli.result.TabularResultData) DistributedMember(org.apache.geode.distributed.DistributedMember) InternalCache(org.apache.geode.internal.cache.InternalCache) CommandResultException(org.apache.geode.management.internal.cli.result.CommandResultException) SystemManagementService(org.apache.geode.management.internal.SystemManagementService) CommandResultException(org.apache.geode.management.internal.cli.result.CommandResultException) ExecutionException(java.util.concurrent.ExecutionException) Result(org.apache.geode.management.cli.Result) CliFunctionResult(org.apache.geode.management.internal.cli.functions.CliFunctionResult) ObjectName(javax.management.ObjectName) CliCommand(org.springframework.shell.core.annotation.CliCommand) CliMetaData(org.apache.geode.management.cli.CliMetaData) ResourceOperation(org.apache.geode.management.internal.security.ResourceOperation)

Aggregations

CliMetaData (org.apache.geode.management.cli.CliMetaData)94 CliCommand (org.springframework.shell.core.annotation.CliCommand)93 Result (org.apache.geode.management.cli.Result)65 DistributedMember (org.apache.geode.distributed.DistributedMember)58 ResourceOperation (org.apache.geode.management.internal.security.ResourceOperation)56 CliFunctionResult (org.apache.geode.management.internal.cli.functions.CliFunctionResult)40 InternalCache (org.apache.geode.internal.cache.InternalCache)37 TabularResultData (org.apache.geode.management.internal.cli.result.TabularResultData)33 CommandResultException (org.apache.geode.management.internal.cli.result.CommandResultException)31 ArrayList (java.util.ArrayList)28 List (java.util.List)24 ConverterHint (org.apache.geode.management.cli.ConverterHint)22 IOException (java.io.IOException)20 InfoResultData (org.apache.geode.management.internal.cli.result.InfoResultData)17 FunctionInvocationTargetException (org.apache.geode.cache.execute.FunctionInvocationTargetException)16 ExecutionException (java.util.concurrent.ExecutionException)15 GfshParseResult (org.apache.geode.management.internal.cli.GfshParseResult)15 XmlEntity (org.apache.geode.management.internal.configuration.domain.XmlEntity)15 HashSet (java.util.HashSet)14 ObjectName (javax.management.ObjectName)14