geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [14/19] geode git commit: GEODE-3436: revert recent refactoring of GFSH commands
Date Sun, 13 Aug 2017 22:46:06 GMT
http://git-wip-us.apache.org/repos/asf/geode/blob/645a32d0/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeDiskStoreCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeDiskStoreCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeDiskStoreCommand.java
deleted file mode 100644
index a3fe19c..0000000
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeDiskStoreCommand.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.geode.management.internal.cli.commands;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.shell.core.annotation.CliOption;
-
-import org.apache.geode.SystemFailure;
-import org.apache.geode.cache.execute.FunctionInvocationTargetException;
-import org.apache.geode.cache.execute.ResultCollector;
-import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.internal.lang.ClassUtils;
-import org.apache.geode.management.cli.CliMetaData;
-import org.apache.geode.management.cli.ConverterHint;
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.domain.DiskStoreDetails;
-import org.apache.geode.management.internal.cli.functions.DescribeDiskStoreFunction;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.result.CompositeResultData;
-import org.apache.geode.management.internal.cli.result.ResultBuilder;
-import org.apache.geode.management.internal.cli.result.TabularResultData;
-import org.apache.geode.management.internal.cli.util.DiskStoreNotFoundException;
-import org.apache.geode.management.internal.cli.util.MemberNotFoundException;
-import org.apache.geode.management.internal.security.ResourceOperation;
-import org.apache.geode.security.ResourcePermission;
-
-public class DescribeDiskStoreCommand implements GfshCommand {
-  @CliCommand(value = CliStrings.DESCRIBE_DISK_STORE, help = CliStrings.DESCRIBE_DISK_STORE__HELP)
-  @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_DISKSTORE})
-  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
-      operation = ResourcePermission.Operation.READ)
-  public Result describeDiskStore(
-      @CliOption(key = CliStrings.MEMBER, mandatory = true,
-          optionContext = ConverterHint.MEMBERIDNAME,
-          help = CliStrings.DESCRIBE_DISK_STORE__MEMBER__HELP) final String memberName,
-      @CliOption(key = CliStrings.DESCRIBE_DISK_STORE__NAME, mandatory = true,
-          optionContext = ConverterHint.DISKSTORE,
-          help = CliStrings.DESCRIBE_DISK_STORE__NAME__HELP) final String diskStoreName) {
-    try {
-      return toCompositeResult(getDiskStoreDescription(memberName, diskStoreName));
-    } catch (DiskStoreNotFoundException | MemberNotFoundException e) {
-      return ResultBuilder.createShellClientErrorResult(e.getMessage());
-    } catch (FunctionInvocationTargetException ignore) {
-      return ResultBuilder.createGemFireErrorResult(CliStrings
-          .format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN, CliStrings.DESCRIBE_DISK_STORE));
-    } catch (VirtualMachineError e) {
-      SystemFailure.initiateFailure(e);
-      throw e;
-    } catch (Throwable t) {
-      SystemFailure.checkFailure();
-      return ResultBuilder
-          .createGemFireErrorResult(String.format(CliStrings.DESCRIBE_DISK_STORE__ERROR_MESSAGE,
-              memberName, diskStoreName, toString(t, isDebugging())));
-    }
-  }
-
-  private Result toCompositeResult(final DiskStoreDetails diskStoreDetails) {
-    final CompositeResultData diskStoreData = ResultBuilder.createCompositeResultData();
-
-    final CompositeResultData.SectionResultData diskStoreSection = diskStoreData.addSection();
-
-    diskStoreSection.addData("Disk Store ID", diskStoreDetails.getId());
-    diskStoreSection.addData("Disk Store Name", diskStoreDetails.getName());
-    diskStoreSection.addData("Member ID", diskStoreDetails.getMemberId());
-    diskStoreSection.addData("Member Name", diskStoreDetails.getMemberName());
-    diskStoreSection.addData("Allow Force Compaction",
-        toString(diskStoreDetails.isAllowForceCompaction(), "Yes", "No"));
-    diskStoreSection.addData("Auto Compaction",
-        toString(diskStoreDetails.isAutoCompact(), "Yes", "No"));
-    diskStoreSection.addData("Compaction Threshold", diskStoreDetails.getCompactionThreshold());
-    diskStoreSection.addData("Max Oplog Size", diskStoreDetails.getMaxOplogSize());
-    diskStoreSection.addData("Queue Size", diskStoreDetails.getQueueSize());
-    diskStoreSection.addData("Time Interval", diskStoreDetails.getTimeInterval());
-    diskStoreSection.addData("Write Buffer Size", diskStoreDetails.getWriteBufferSize());
-    diskStoreSection.addData("Disk Usage Warning Percentage",
-        diskStoreDetails.getDiskUsageWarningPercentage());
-    diskStoreSection.addData("Disk Usage Critical Percentage",
-        diskStoreDetails.getDiskUsageCriticalPercentage());
-    diskStoreSection.addData("PDX Serialization Meta-Data Stored",
-        toString(diskStoreDetails.isPdxSerializationMetaDataStored(), "Yes", "No"));
-
-    final TabularResultData diskDirTable = diskStoreData.addSection().addTable();
-
-    for (DiskStoreDetails.DiskDirDetails diskDirDetails : diskStoreDetails) {
-      diskDirTable.accumulate("Disk Directory", diskDirDetails.getAbsolutePath());
-      diskDirTable.accumulate("Size", diskDirDetails.getSize());
-    }
-
-    final TabularResultData regionTable = diskStoreData.addSection().addTable();
-
-    for (DiskStoreDetails.RegionDetails regionDetails : diskStoreDetails.iterateRegions()) {
-      regionTable.accumulate("Region Path", regionDetails.getFullPath());
-      regionTable.accumulate("Region Name", regionDetails.getName());
-      regionTable.accumulate("Persistent", toString(regionDetails.isPersistent(), "Yes", "No"));
-      regionTable.accumulate("Overflow To Disk",
-          toString(regionDetails.isOverflowToDisk(), "Yes", "No"));
-    }
-
-    final TabularResultData cacheServerTable = diskStoreData.addSection().addTable();
-
-    for (DiskStoreDetails.CacheServerDetails cacheServerDetails : diskStoreDetails
-        .iterateCacheServers()) {
-      cacheServerTable.accumulate("Bind Address", cacheServerDetails.getBindAddress());
-      cacheServerTable.accumulate("Hostname for Clients", cacheServerDetails.getHostName());
-      cacheServerTable.accumulate("Port", cacheServerDetails.getPort());
-    }
-
-    final TabularResultData gatewayTable = diskStoreData.addSection().addTable();
-
-    for (DiskStoreDetails.GatewayDetails gatewayDetails : diskStoreDetails.iterateGateways()) {
-      gatewayTable.accumulate("Gateway ID", gatewayDetails.getId());
-      gatewayTable.accumulate("Persistent", toString(gatewayDetails.isPersistent(), "Yes", "No"));
-    }
-
-    final TabularResultData asyncEventQueueTable = diskStoreData.addSection().addTable();
-
-    for (DiskStoreDetails.AsyncEventQueueDetails asyncEventQueueDetails : diskStoreDetails
-        .iterateAsyncEventQueues()) {
-      asyncEventQueueTable.accumulate("Async Event Queue ID", asyncEventQueueDetails.getId());
-    }
-
-    return ResultBuilder.buildResult(diskStoreData);
-  }
-
-  public DiskStoreDetails getDiskStoreDescription(final String memberName,
-      final String diskStoreName) {
-    final DistributedMember member = getMember(getCache(), memberName); // may throw a
-    // MemberNotFoundException
-
-    final ResultCollector<?, ?> resultCollector =
-        getMembersFunctionExecutor(Collections.singleton(member)).setArguments(diskStoreName)
-            .execute(new DescribeDiskStoreFunction());
-
-    final Object result = ((List<?>) resultCollector.getResult()).get(0);
-
-    if (result instanceof DiskStoreDetails) { // disk store details in hand...
-      return (DiskStoreDetails) result;
-    } else if (result instanceof DiskStoreNotFoundException) { // bad disk store name...
-      throw (DiskStoreNotFoundException) result;
-    } else { // unknown and unexpected return type...
-      final Throwable cause = (result instanceof Throwable ? (Throwable) result : null);
-
-      if (isLogging()) {
-        if (cause != null) {
-          getGfsh().logSevere(String.format(
-              "Exception (%1$s) occurred while executing '%2$s' on member (%3$s) with disk store (%4$s).",
-              ClassUtils.getClassName(cause), CliStrings.DESCRIBE_DISK_STORE, memberName,
-              diskStoreName), cause);
-        } else {
-          getGfsh().logSevere(String.format(
-              "Received an unexpected result of type (%1$s) while executing '%2$s' on member (%3$s) with disk store (%4$s).",
-              ClassUtils.getClassName(result), CliStrings.DESCRIBE_DISK_STORE, memberName,
-              diskStoreName), null);
-        }
-      }
-
-      throw new RuntimeException(
-          CliStrings.format(CliStrings.UNEXPECTED_RETURN_TYPE_EXECUTING_COMMAND_ERROR_MESSAGE,
-              ClassUtils.getClassName(result), CliStrings.DESCRIBE_DISK_STORE),
-          cause);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/645a32d0/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeMemberCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeMemberCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeMemberCommand.java
deleted file mode 100644
index 236dd23e..0000000
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeMemberCommand.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.geode.management.internal.cli.commands;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.shell.core.annotation.CliOption;
-
-import org.apache.geode.cache.CacheClosedException;
-import org.apache.geode.cache.execute.ResultCollector;
-import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.management.cli.CliMetaData;
-import org.apache.geode.management.cli.ConverterHint;
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.CliUtil;
-import org.apache.geode.management.internal.cli.domain.CacheServerInfo;
-import org.apache.geode.management.internal.cli.domain.MemberInformation;
-import org.apache.geode.management.internal.cli.functions.GetMemberInformationFunction;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.result.CompositeResultData;
-import org.apache.geode.management.internal.cli.result.ResultBuilder;
-import org.apache.geode.management.internal.security.ResourceOperation;
-import org.apache.geode.security.ResourcePermission;
-
-public class DescribeMemberCommand implements GfshCommand {
-  private static final GetMemberInformationFunction getMemberInformation =
-      new GetMemberInformationFunction();
-
-  @CliCommand(value = {CliStrings.DESCRIBE_MEMBER}, help = CliStrings.DESCRIBE_MEMBER__HELP)
-  @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_SERVER)
-  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
-      operation = ResourcePermission.Operation.READ)
-  public Result describeMember(@CliOption(key = CliStrings.DESCRIBE_MEMBER__IDENTIFIER,
-      optionContext = ConverterHint.ALL_MEMBER_IDNAME,
-      help = CliStrings.DESCRIBE_MEMBER__IDENTIFIER__HELP,
-      mandatory = true) String memberNameOrId) {
-    Result result = null;
-
-    try {
-      DistributedMember memberToBeDescribed =
-          CliUtil.getDistributedMemberByNameOrId(memberNameOrId);
-
-      if (memberToBeDescribed != null) {
-        ResultCollector<?, ?> rc =
-            CliUtil.executeFunction(getMemberInformation, null, memberToBeDescribed);
-
-        ArrayList<?> output = (ArrayList<?>) rc.getResult();
-        Object obj = output.get(0);
-
-        if (obj != null && (obj instanceof MemberInformation)) {
-
-          CompositeResultData crd = ResultBuilder.createCompositeResultData();
-
-          MemberInformation memberInformation = (MemberInformation) obj;
-          memberInformation.setName(memberToBeDescribed.getName());
-          memberInformation.setId(memberToBeDescribed.getId());
-          memberInformation.setHost(memberToBeDescribed.getHost());
-          memberInformation.setProcessId("" + memberToBeDescribed.getProcessId());
-
-          CompositeResultData.SectionResultData section = crd.addSection();
-          section.addData("Name", memberInformation.getName());
-          section.addData("Id", memberInformation.getId());
-          section.addData("Host", memberInformation.getHost());
-          section.addData("Regions",
-              CliUtil.convertStringSetToString(memberInformation.getHostedRegions(), '\n'));
-          section.addData("PID", memberInformation.getProcessId());
-          section.addData("Groups", memberInformation.getGroups());
-          section.addData("Used Heap", memberInformation.getHeapUsage() + "M");
-          section.addData("Max Heap", memberInformation.getMaxHeapSize() + "M");
-
-          String offHeapMemorySize = memberInformation.getOffHeapMemorySize();
-          if (offHeapMemorySize != null && !offHeapMemorySize.isEmpty()) {
-            section.addData("Off Heap Size", offHeapMemorySize);
-          }
-
-          section.addData("Working Dir", memberInformation.getWorkingDirPath());
-          section.addData("Log file", memberInformation.getLogFilePath());
-
-          section.addData("Locators", memberInformation.getLocators());
-
-          if (memberInformation.isServer()) {
-            CompositeResultData.SectionResultData clientServiceSection = crd.addSection();
-            List<CacheServerInfo> csList = memberInformation.getCacheServeInfo();
-
-            if (csList != null) {
-              Iterator<CacheServerInfo> iters = csList.iterator();
-              clientServiceSection.setHeader("Cache Server Information");
-
-              while (iters.hasNext()) {
-                CacheServerInfo cacheServerInfo = iters.next();
-                clientServiceSection.addData("Server Bind", cacheServerInfo.getBindAddress());
-                clientServiceSection.addData("Server Port", cacheServerInfo.getPort());
-                clientServiceSection.addData("Running", cacheServerInfo.isRunning());
-              }
-
-              clientServiceSection.addData("Client Connections",
-                  memberInformation.getClientCount());
-            }
-          }
-          result = ResultBuilder.buildResult(crd);
-
-        } else {
-          result = ResultBuilder.createInfoResult(CliStrings.format(
-              CliStrings.DESCRIBE_MEMBER__MSG__INFO_FOR__0__COULD_NOT_BE_RETRIEVED,
-              new Object[] {memberNameOrId}));
-        }
-      } else {
-        result = ResultBuilder.createInfoResult(CliStrings
-            .format(CliStrings.DESCRIBE_MEMBER__MSG__NOT_FOUND, new Object[] {memberNameOrId}));
-      }
-    } catch (CacheClosedException ignored) {
-    } catch (Exception e) {
-      result = ResultBuilder.createGemFireErrorResult(e.getMessage());
-    }
-    return result;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/645a32d0/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeOfflineDiskStoreCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeOfflineDiskStoreCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeOfflineDiskStoreCommand.java
deleted file mode 100644
index 904a677..0000000
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeOfflineDiskStoreCommand.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.geode.management.internal.cli.commands;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.PrintStream;
-
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.shell.core.annotation.CliOption;
-
-import org.apache.geode.SystemFailure;
-import org.apache.geode.cache.Region;
-import org.apache.geode.internal.cache.DiskStoreImpl;
-import org.apache.geode.management.cli.CliMetaData;
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.result.ResultBuilder;
-
-public class DescribeOfflineDiskStoreCommand implements GfshCommand {
-  @CliCommand(value = CliStrings.DESCRIBE_OFFLINE_DISK_STORE,
-      help = CliStrings.DESCRIBE_OFFLINE_DISK_STORE__HELP)
-  @CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GEODE_DISKSTORE})
-  public Result describeOfflineDiskStore(
-      @CliOption(key = CliStrings.DESCRIBE_OFFLINE_DISK_STORE__DISKSTORENAME, mandatory = true,
-          help = CliStrings.DESCRIBE_OFFLINE_DISK_STORE__DISKSTORENAME__HELP) String diskStoreName,
-      @CliOption(key = CliStrings.DESCRIBE_OFFLINE_DISK_STORE__DISKDIRS, mandatory = true,
-          help = CliStrings.DESCRIBE_OFFLINE_DISK_STORE__DISKDIRS__HELP) String[] diskDirs,
-      @CliOption(key = CliStrings.DESCRIBE_OFFLINE_DISK_STORE__PDX_TYPES,
-          help = CliStrings.DESCRIBE_OFFLINE_DISK_STORE__PDX_TYPES__HELP) Boolean listPdxTypes,
-      @CliOption(key = CliStrings.DESCRIBE_OFFLINE_DISK_STORE__REGIONNAME,
-          help = CliStrings.DESCRIBE_OFFLINE_DISK_STORE__REGIONNAME__HELP) String regionName) {
-
-    try {
-      final File[] dirs = new File[diskDirs.length];
-      for (int i = 0; i < diskDirs.length; i++) {
-        dirs[i] = new File((diskDirs[i]));
-      }
-
-      if (Region.SEPARATOR.equals(regionName)) {
-        return ResultBuilder.createUserErrorResult(CliStrings.INVALID_REGION_NAME);
-      }
-
-      ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
-      PrintStream printStream = new PrintStream(outputStream);
-
-      DiskStoreImpl.dumpInfo(printStream, diskStoreName, dirs, regionName, listPdxTypes);
-      return ResultBuilder.createInfoResult(outputStream.toString());
-    } catch (VirtualMachineError e) {
-      SystemFailure.initiateFailure(e);
-      throw e;
-    } catch (Throwable th) {
-      SystemFailure.checkFailure();
-      if (th.getMessage() == null) {
-        return ResultBuilder.createGemFireErrorResult(
-            "An error occurred while describing offline disk stores: " + th);
-      }
-      return ResultBuilder.createGemFireErrorResult(
-          "An error occurred while describing offline disk stores: " + th.getMessage());
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/645a32d0/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeRegionCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeRegionCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeRegionCommand.java
deleted file mode 100644
index 65a6153..0000000
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeRegionCommand.java
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.geode.management.internal.cli.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.shell.core.annotation.CliOption;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.execute.FunctionInvocationTargetException;
-import org.apache.geode.cache.execute.ResultCollector;
-import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.management.cli.CliMetaData;
-import org.apache.geode.management.cli.ConverterHint;
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.CliUtil;
-import org.apache.geode.management.internal.cli.LogWrapper;
-import org.apache.geode.management.internal.cli.domain.FixedPartitionAttributesInfo;
-import org.apache.geode.management.internal.cli.domain.RegionDescription;
-import org.apache.geode.management.internal.cli.domain.RegionDescriptionPerMember;
-import org.apache.geode.management.internal.cli.functions.GetRegionDescriptionFunction;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.result.CompositeResultData;
-import org.apache.geode.management.internal.cli.result.ResultBuilder;
-import org.apache.geode.management.internal.cli.result.TabularResultData;
-import org.apache.geode.management.internal.cli.util.RegionAttributesNames;
-import org.apache.geode.management.internal.security.ResourceOperation;
-import org.apache.geode.security.ResourcePermission;
-
-public class DescribeRegionCommand implements GfshCommand {
-  private static final GetRegionDescriptionFunction getRegionDescription =
-      new GetRegionDescriptionFunction();
-
-  @CliCommand(value = {CliStrings.DESCRIBE_REGION}, help = CliStrings.DESCRIBE_REGION__HELP)
-  @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_CONFIG})
-  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
-      operation = ResourcePermission.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;
-    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<>();
-
-      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();
-
-      for (RegionDescription regionDescription : regionDescriptionList) {
-        // 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);
-          }
-        }
-        CompositeResultData.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();
-
-        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;
-            memberNameAdded = writeAttributesToTable(table,
-                CliStrings.DESCRIBE_REGION__ATTRIBUTE__TYPE__REGION, ndRa, member, false);
-            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);
-          }
-        }
-
-        if (setHeader) {
-          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;
-  }
-
-  private void writeCommonAttributesToTable(TabularResultData table, String attributeType,
-      Map<String, String> attributesMap) {
-    if (!attributesMap.isEmpty()) {
-      Set<String> attributes = attributesMap.keySet();
-      boolean isTypeAdded = false;
-      final String blank = "";
-
-      for (String attributeName : attributes) {
-        String attributeValue = attributesMap.get(attributeName);
-        String type;
-
-        if (!isTypeAdded) {
-          type = attributeType;
-          isTypeAdded = true;
-        } else {
-          type = blank;
-        }
-        writeCommonAttributeToTable(table, type, attributeName, attributeValue);
-      }
-    }
-  }
-
-  private void writeFixedPartitionAttributesToTable(TabularResultData table,
-      List<FixedPartitionAttributesInfo> fpaList, String member, boolean isMemberNameAdded) {
-    if (fpaList == null) {
-      return;
-    }
-
-    boolean isTypeAdded = false;
-    final String blank = "";
-    String memName;
-
-    for (FixedPartitionAttributesInfo fpa : fpaList) {
-      StringBuilder fpaBuilder = new StringBuilder();
-      fpaBuilder.append(fpa.getPartitionName());
-      fpaBuilder.append(',');
-
-      if (fpa.isPrimary()) {
-        fpaBuilder.append("Primary");
-      } else {
-        fpaBuilder.append("Secondary");
-      }
-      fpaBuilder.append(',');
-      fpaBuilder.append(fpa.getNumBuckets());
-
-      if (!isTypeAdded) {
-        isTypeAdded = true;
-      }
-
-      if (!isMemberNameAdded) {
-        memName = member;
-        isMemberNameAdded = true;
-      } else {
-        memName = blank;
-      }
-      writeAttributeToTable(table, memName, "", "Fixed Partition", fpaBuilder.toString());
-    }
-  }
-
-  private boolean writeAttributesToTable(TabularResultData table, String attributeType,
-      Map<String, String> attributesMap, String member, boolean isMemberNameAdded) {
-    if (!attributesMap.isEmpty()) {
-      Set<String> attributes = attributesMap.keySet();
-      boolean isTypeAdded = false;
-      final String blank = "";
-
-      for (String attributeName : attributes) {
-        String attributeValue = attributesMap.get(attributeName);
-        String type, memName;
-
-        if (!isTypeAdded) {
-          type = attributeType;
-          isTypeAdded = true;
-        } else {
-          type = blank;
-        }
-
-        if (!isMemberNameAdded) {
-          memName = member;
-          isMemberNameAdded = true;
-        } else {
-          memName = blank;
-        }
-
-        writeAttributeToTable(table, memName, type, attributeName, attributeValue);
-      }
-    }
-
-    return isMemberNameAdded;
-  }
-
-  private void writeAttributeToTable(TabularResultData table, String member, String attributeType,
-      String attributeName, String attributeValue) {
-
-    final String blank = "";
-    if (attributeValue != null) {
-      // Tokenize the attributeValue
-      String[] attributeValues = attributeValue.split(",");
-      boolean isFirstValue = true;
-
-      for (String value : attributeValues) {
-        if (isFirstValue) {
-          table.accumulate(CliStrings.DESCRIBE_REGION__MEMBER, member);
-          table.accumulate(CliStrings.DESCRIBE_REGION__ATTRIBUTE__TYPE, attributeType);
-          table.accumulate(CliStrings.DESCRIBE_REGION__ATTRIBUTE__NAME, attributeName);
-          table.accumulate(CliStrings.DESCRIBE_REGION__ATTRIBUTE__VALUE, value);
-          isFirstValue = false;
-        } else {
-          table.accumulate(CliStrings.DESCRIBE_REGION__MEMBER, blank);
-          table.accumulate(CliStrings.DESCRIBE_REGION__ATTRIBUTE__TYPE, blank);
-          table.accumulate(CliStrings.DESCRIBE_REGION__ATTRIBUTE__NAME, blank);
-          table.accumulate(CliStrings.DESCRIBE_REGION__ATTRIBUTE__VALUE, value);
-        }
-      }
-    }
-  }
-
-  private void writeCommonAttributeToTable(TabularResultData table, String attributeType,
-      String attributeName, String attributeValue) {
-    final String blank = "";
-    if (attributeValue != null) {
-      String[] attributeValues = attributeValue.split(",");
-      boolean isFirstValue = true;
-      for (String value : attributeValues) {
-        if (isFirstValue) {
-          isFirstValue = false;
-          table.accumulate(CliStrings.DESCRIBE_REGION__ATTRIBUTE__TYPE, attributeType);
-          table.accumulate(CliStrings.DESCRIBE_REGION__ATTRIBUTE__NAME, attributeName);
-          table.accumulate(CliStrings.DESCRIBE_REGION__ATTRIBUTE__VALUE, value);
-        } else {
-          table.accumulate(CliStrings.DESCRIBE_REGION__ATTRIBUTE__TYPE, blank);
-          table.accumulate(CliStrings.DESCRIBE_REGION__ATTRIBUTE__NAME, blank);
-          table.accumulate(CliStrings.DESCRIBE_REGION__ATTRIBUTE__VALUE, value);
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/645a32d0/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyDiskStoreCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyDiskStoreCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyDiskStoreCommand.java
deleted file mode 100644
index 2f24736..0000000
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyDiskStoreCommand.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.geode.management.internal.cli.commands;
-
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.shell.core.annotation.CliOption;
-
-import org.apache.geode.SystemFailure;
-import org.apache.geode.cache.execute.ResultCollector;
-import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.management.cli.CliMetaData;
-import org.apache.geode.management.cli.ConverterHint;
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.CliUtil;
-import org.apache.geode.management.internal.cli.functions.CliFunctionResult;
-import org.apache.geode.management.internal.cli.functions.DestroyDiskStoreFunction;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.result.ResultBuilder;
-import org.apache.geode.management.internal.cli.result.TabularResultData;
-import org.apache.geode.management.internal.configuration.domain.XmlEntity;
-import org.apache.geode.management.internal.security.ResourceOperation;
-import org.apache.geode.security.ResourcePermission;
-
-public class DestroyDiskStoreCommand implements GfshCommand {
-  @CliCommand(value = CliStrings.DESTROY_DISK_STORE, help = CliStrings.DESTROY_DISK_STORE__HELP)
-  @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_DISKSTORE})
-  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
-      operation = ResourcePermission.Operation.MANAGE, target = ResourcePermission.Target.DISK)
-  public Result destroyDiskStore(
-      @CliOption(key = CliStrings.DESTROY_DISK_STORE__NAME, mandatory = true,
-          help = CliStrings.DESTROY_DISK_STORE__NAME__HELP) String name,
-      @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
-          help = CliStrings.DESTROY_DISK_STORE__GROUP__HELP,
-          optionContext = ConverterHint.MEMBERGROUP) String[] groups) {
-    try {
-      TabularResultData tabularData = ResultBuilder.createTabularResultData();
-      boolean accumulatedData = false;
-
-      Set<DistributedMember> targetMembers = CliUtil.findMembers(groups, null);
-
-      if (targetMembers.isEmpty()) {
-        return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
-      }
-
-      ResultCollector<?, ?> rc = CliUtil.executeFunction(new DestroyDiskStoreFunction(),
-          new Object[] {name}, targetMembers);
-      List<CliFunctionResult> results = CliFunctionResult.cleanResults((List<?>) rc.getResult());
-
-      AtomicReference<XmlEntity> xmlEntity = new AtomicReference<>();
-      for (CliFunctionResult result : results) {
-        if (result.getThrowable() != null) {
-          tabularData.accumulate("Member", result.getMemberIdOrName());
-          tabularData.accumulate("Result", "ERROR: " + result.getThrowable().getClass().getName()
-              + ": " + result.getThrowable().getMessage());
-          accumulatedData = true;
-          tabularData.setStatus(Result.Status.ERROR);
-        } else if (result.getMessage() != null) {
-          tabularData.accumulate("Member", result.getMemberIdOrName());
-          tabularData.accumulate("Result", result.getMessage());
-          accumulatedData = true;
-
-          if (xmlEntity.get() == null) {
-            xmlEntity.set(result.getXmlEntity());
-          }
-        }
-      }
-
-      if (!accumulatedData) {
-        return ResultBuilder.createInfoResult("No matching disk stores found.");
-      }
-
-      Result result = ResultBuilder.buildResult(tabularData);
-      if (xmlEntity.get() != null) {
-        persistClusterConfiguration(result,
-            () -> getSharedConfiguration().deleteXmlEntity(xmlEntity.get(), groups));
-      }
-
-      return result;
-    } catch (VirtualMachineError e) {
-      SystemFailure.initiateFailure(e);
-      throw e;
-    } catch (Throwable th) {
-      SystemFailure.checkFailure();
-      return ResultBuilder.createGemFireErrorResult(
-          CliStrings.format(CliStrings.DESTROY_DISK_STORE__ERROR_WHILE_DESTROYING_REASON_0,
-              new Object[] {th.getMessage()}));
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/645a32d0/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyFunctionCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyFunctionCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyFunctionCommand.java
deleted file mode 100644
index 37beb97..0000000
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyFunctionCommand.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.geode.management.internal.cli.commands;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.shell.core.annotation.CliOption;
-
-import org.apache.geode.cache.execute.Execution;
-import org.apache.geode.cache.execute.Function;
-import org.apache.geode.cache.execute.FunctionException;
-import org.apache.geode.cache.execute.FunctionService;
-import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.management.cli.CliMetaData;
-import org.apache.geode.management.cli.ConverterHint;
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.AbstractCliAroundInterceptor;
-import org.apache.geode.management.internal.cli.GfshParseResult;
-import org.apache.geode.management.internal.cli.functions.UnregisterFunction;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.result.ErrorResultData;
-import org.apache.geode.management.internal.cli.result.ResultBuilder;
-import org.apache.geode.management.internal.security.ResourceOperation;
-import org.apache.geode.security.ResourcePermission;
-
-public class DestroyFunctionCommand implements GfshCommand {
-  @CliCommand(value = CliStrings.DESTROY_FUNCTION, help = CliStrings.DESTROY_FUNCTION__HELP)
-  @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_FUNCTION},
-      interceptor = "org.apache.geode.management.internal.cli.commands.DestroyFunctionCommand$Interceptor")
-  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
-      operation = ResourcePermission.Operation.MANAGE, target = ResourcePermission.Target.JAR)
-  // TODO: Add optioncontext for functionId
-  public Result destroyFunction(
-      @CliOption(key = CliStrings.DESTROY_FUNCTION__ID, mandatory = true,
-          help = CliStrings.DESTROY_FUNCTION__HELP) String functionId,
-      @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
-          optionContext = ConverterHint.MEMBERGROUP,
-          help = CliStrings.DESTROY_FUNCTION__ONGROUPS__HELP) String[] groups,
-      @CliOption(key = CliStrings.MEMBER, optionContext = ConverterHint.MEMBERIDNAME,
-          help = CliStrings.DESTROY_FUNCTION__ONMEMBER__HELP) String memberId) {
-    try {
-      InternalCache cache = getCache();
-      Set<DistributedMember> dsMembers = new HashSet<>();
-      if (groups != null && memberId != null) {
-        return ResultBuilder
-            .createUserErrorResult(CliStrings.DESTROY_FUNCTION__MSG__PROVIDE_OPTION);
-      } else if (groups != null && groups.length > 0) {
-        // execute on group members
-        for (String grp : groups) {
-          dsMembers.addAll(cache.getDistributedSystem().getGroupMembers(grp));
-        }
-        @SuppressWarnings("unchecked")
-        Result results = executeFunction(cache, dsMembers, functionId);
-        return results;
-      } else if (memberId != null) {
-        // execute on member
-        dsMembers.add(getMember(cache, memberId));
-        @SuppressWarnings("unchecked")
-        Result results = executeFunction(cache, dsMembers, functionId);
-        return results;
-      } else {
-        // no option provided.
-        @SuppressWarnings("unchecked")
-        Result results = executeFunction(cache, cache.getMembers(), functionId);
-        return results;
-      }
-    } catch (Exception e) {
-      ErrorResultData errorResultData = ResultBuilder.createErrorResultData()
-          .setErrorCode(ResultBuilder.ERRORCODE_DEFAULT).addLine(e.getMessage());
-      return ResultBuilder.buildResult(errorResultData);
-    }
-  }
-
-  private Result executeFunction(InternalCache cache, Set<DistributedMember> DsMembers,
-      String functionId) {
-    // unregister on a set of of members
-    Function unregisterFunction = new UnregisterFunction();
-    FunctionService.registerFunction(unregisterFunction);
-    List resultList;
-
-    if (DsMembers.isEmpty()) {
-      return ResultBuilder.createInfoResult("No members for execution");
-    }
-    Object[] obj = new Object[1];
-    obj[0] = functionId;
-
-    Execution execution = FunctionService.onMembers(DsMembers).setArguments(obj);
-
-    if (execution == null) {
-      cache.getLogger().error("executeUnregister execution is null");
-      ErrorResultData errorResultData =
-          ResultBuilder.createErrorResultData().setErrorCode(ResultBuilder.ERRORCODE_DEFAULT)
-              .addLine(CliStrings.DESTROY_FUNCTION__MSG__CANNOT_EXECUTE);
-      return (ResultBuilder.buildResult(errorResultData));
-    }
-    try {
-      resultList = (ArrayList) execution.execute(unregisterFunction).getResult();
-    } catch (FunctionException ex) {
-      ErrorResultData errorResultData = ResultBuilder.createErrorResultData()
-          .setErrorCode(ResultBuilder.ERRORCODE_DEFAULT).addLine(ex.getMessage());
-      return (ResultBuilder.buildResult(errorResultData));
-    }
-    String resultStr = ((String) resultList.get(0));
-    if (resultStr.equals("Succeeded in unregistering")) {
-      StringBuilder members = new StringBuilder();
-      for (DistributedMember member : DsMembers) {
-        members.append(member.getId());
-        members.append(",");
-      }
-      return ResultBuilder.createInfoResult("Destroyed " + functionId + " Successfully on "
-          + members.toString().substring(0, members.toString().length() - 1));
-    } else {
-      return ResultBuilder.createInfoResult("Failed in unregistering");
-    }
-  }
-
-  /**
-   * Interceptor used by gfsh to intercept execution of destroy.
-   */
-  public static class Interceptor extends AbstractCliAroundInterceptor {
-    @Override
-    public Result preExecution(GfshParseResult parseResult) {
-      Map<String, String> paramValueMap = parseResult.getParamValueStrings();
-      paramValueMap.entrySet();
-      String onGroup = paramValueMap.get(CliStrings.GROUP);
-      String onMember = paramValueMap.get(CliStrings.MEMBER);
-
-      if ((onGroup == null && onMember == null)) {
-        Response response = readYesNo("Do you really want to destroy "
-            + paramValueMap.get(CliStrings.DESTROY_FUNCTION__ID) + " on entire DS?", Response.NO);
-        if (response == Response.NO) {
-          return ResultBuilder.createShellClientAbortOperationResult(
-              "Aborted destroy of " + paramValueMap.get(CliStrings.DESTROY_FUNCTION__ID));
-        } else {
-          return ResultBuilder
-              .createInfoResult("Destroying " + paramValueMap.get(CliStrings.DESTROY_FUNCTION__ID));
-        }
-      } else {
-        return ResultBuilder
-            .createInfoResult("Destroying " + paramValueMap.get(CliStrings.DESTROY_FUNCTION__ID));
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/645a32d0/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyIndexCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyIndexCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyIndexCommand.java
deleted file mode 100644
index c9f2b64..0000000
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyIndexCommand.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.geode.management.internal.cli.commands;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.apache.commons.lang.ArrayUtils;
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.shell.core.annotation.CliOption;
-
-import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.execute.ResultCollector;
-import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.management.cli.CliMetaData;
-import org.apache.geode.management.cli.ConverterHint;
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.CliUtil;
-import org.apache.geode.management.internal.cli.domain.IndexInfo;
-import org.apache.geode.management.internal.cli.functions.CliFunctionResult;
-import org.apache.geode.management.internal.cli.functions.DestroyIndexFunction;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.result.ErrorResultData;
-import org.apache.geode.management.internal.cli.result.InfoResultData;
-import org.apache.geode.management.internal.cli.result.ResultBuilder;
-import org.apache.geode.management.internal.configuration.domain.XmlEntity;
-import org.apache.geode.management.internal.security.ResourceOperation;
-import org.apache.geode.security.ResourcePermission;
-
-public class DestroyIndexCommand implements GfshCommand {
-  private static final DestroyIndexFunction destroyIndexFunction = new DestroyIndexFunction();
-
-  @CliCommand(value = CliStrings.DESTROY_INDEX, help = CliStrings.DESTROY_INDEX__HELP)
-  @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
-  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
-      operation = ResourcePermission.Operation.MANAGE, target = ResourcePermission.Target.QUERY)
-  public Result destroyIndex(
-      @CliOption(key = CliStrings.DESTROY_INDEX__NAME, unspecifiedDefaultValue = "",
-          help = CliStrings.DESTROY_INDEX__NAME__HELP) final String indexName,
-
-      @CliOption(key = CliStrings.DESTROY_INDEX__REGION, optionContext = ConverterHint.REGION_PATH,
-          help = CliStrings.DESTROY_INDEX__REGION__HELP) final String regionPath,
-
-      @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
-          optionContext = ConverterHint.MEMBERIDNAME,
-          help = CliStrings.DESTROY_INDEX__MEMBER__HELP) final String[] memberNameOrID,
-
-      @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
-          optionContext = ConverterHint.MEMBERGROUP,
-          help = CliStrings.DESTROY_INDEX__GROUP__HELP) final String[] group) {
-
-    Result result;
-
-    if (StringUtils.isBlank(indexName) && StringUtils.isBlank(regionPath)
-        && ArrayUtils.isEmpty(group) && ArrayUtils.isEmpty(memberNameOrID)) {
-      return ResultBuilder.createUserErrorResult(
-          CliStrings.format(CliStrings.PROVIDE_ATLEAST_ONE_OPTION, CliStrings.DESTROY_INDEX));
-    }
-
-    final Cache cache = CacheFactory.getAnyInstance();
-    String regionName = null;
-    if (regionPath != null) {
-      regionName = regionPath.startsWith("/") ? regionPath.substring(1) : regionPath;
-    }
-    IndexInfo indexInfo = new IndexInfo(indexName, regionName);
-    Set<DistributedMember> targetMembers = CliUtil.findMembers(group, memberNameOrID);
-
-    if (targetMembers.isEmpty()) {
-      return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
-    }
-
-    ResultCollector rc = CliUtil.executeFunction(destroyIndexFunction, indexInfo, targetMembers);
-    List<Object> funcResults = (List<Object>) rc.getResult();
-
-    Set<String> successfulMembers = new TreeSet<>();
-    Map<String, Set<String>> indexOpFailMap = new HashMap<>();
-
-    AtomicReference<XmlEntity> xmlEntity = new AtomicReference<>();
-    for (Object funcResult : funcResults) {
-      if (!(funcResult instanceof CliFunctionResult)) {
-        continue;
-      }
-      CliFunctionResult cliFunctionResult = (CliFunctionResult) funcResult;
-
-      if (cliFunctionResult.isSuccessful()) {
-        successfulMembers.add(cliFunctionResult.getMemberIdOrName());
-        if (xmlEntity.get() == null) {
-          xmlEntity.set(cliFunctionResult.getXmlEntity());
-        }
-      } else {
-        String exceptionMessage = cliFunctionResult.getMessage();
-        Set<String> failedMembers = indexOpFailMap.get(exceptionMessage);
-
-        if (failedMembers == null) {
-          failedMembers = new TreeSet<>();
-        }
-        failedMembers.add(cliFunctionResult.getMemberIdOrName());
-        indexOpFailMap.put(exceptionMessage, failedMembers);
-      }
-    }
-    if (!successfulMembers.isEmpty()) {
-      InfoResultData infoResult = ResultBuilder.createInfoResultData();
-      if (StringUtils.isNotBlank(indexName)) {
-        if (StringUtils.isNotBlank(regionPath)) {
-          infoResult.addLine(CliStrings.format(CliStrings.DESTROY_INDEX__ON__REGION__SUCCESS__MSG,
-              indexName, regionPath));
-        } else {
-          infoResult.addLine(CliStrings.format(CliStrings.DESTROY_INDEX__SUCCESS__MSG, indexName));
-        }
-      } else {
-        if (StringUtils.isNotBlank(regionPath)) {
-          infoResult.addLine(CliStrings
-              .format(CliStrings.DESTROY_INDEX__ON__REGION__ONLY__SUCCESS__MSG, regionPath));
-        } else {
-          infoResult.addLine(CliStrings.DESTROY_INDEX__ON__MEMBERS__ONLY__SUCCESS__MSG);
-        }
-      }
-      int num = 0;
-      for (String memberId : successfulMembers) {
-        infoResult.addLine(CliStrings.format(
-            CliStrings.format(CliStrings.DESTROY_INDEX__NUMBER__AND__MEMBER, ++num, memberId)));
-      }
-      result = ResultBuilder.buildResult(infoResult);
-    } else {
-      ErrorResultData erd = ResultBuilder.createErrorResultData();
-      if (StringUtils.isNotBlank(indexName)) {
-        erd.addLine(CliStrings.format(CliStrings.DESTROY_INDEX__FAILURE__MSG, indexName));
-      } else {
-        erd.addLine("Indexes could not be destroyed for following reasons");
-      }
-
-      Set<String> exceptionMessages = indexOpFailMap.keySet();
-
-      for (String exceptionMessage : exceptionMessages) {
-        erd.addLine(CliStrings.format(CliStrings.DESTROY_INDEX__REASON_MESSAGE, exceptionMessage));
-        erd.addLine(CliStrings.DESTROY_INDEX__EXCEPTION__OCCURRED__ON);
-
-        Set<String> memberIds = indexOpFailMap.get(exceptionMessage);
-        int num = 0;
-
-        for (String memberId : memberIds) {
-          erd.addLine(CliStrings.format(
-              CliStrings.format(CliStrings.DESTROY_INDEX__NUMBER__AND__MEMBER, ++num, memberId)));
-        }
-        erd.addLine("");
-      }
-      result = ResultBuilder.buildResult(erd);
-    }
-    if (xmlEntity.get() != null) {
-      persistClusterConfiguration(result,
-          () -> getSharedConfiguration().deleteXmlEntity(xmlEntity.get(), group));
-    }
-    return result;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/645a32d0/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyRegionCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyRegionCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyRegionCommand.java
deleted file mode 100644
index 12b6dc1..0000000
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyRegionCommand.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.management.internal.cli.commands;
-
-import java.text.MessageFormat;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import org.apache.commons.lang.StringUtils;
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.shell.core.annotation.CliOption;
-
-import org.apache.geode.LogWriter;
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.Scope;
-import org.apache.geode.cache.execute.ResultCollector;
-import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.management.ManagementService;
-import org.apache.geode.management.RegionAttributesData;
-import org.apache.geode.management.RegionMXBean;
-import org.apache.geode.management.cli.CliMetaData;
-import org.apache.geode.management.cli.ConverterHint;
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.MBeanJMXAdapter;
-import org.apache.geode.management.internal.cli.CliUtil;
-import org.apache.geode.management.internal.cli.LogWrapper;
-import org.apache.geode.management.internal.cli.functions.CliFunctionResult;
-import org.apache.geode.management.internal.cli.functions.RegionDestroyFunction;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.result.ResultBuilder;
-import org.apache.geode.management.internal.configuration.domain.XmlEntity;
-import org.apache.geode.management.internal.security.ResourceOperation;
-import org.apache.geode.security.ResourcePermission;
-
-public class DestroyRegionCommand implements GfshCommand {
-  @CliCommand(value = {CliStrings.DESTROY_REGION}, help = CliStrings.DESTROY_REGION__HELP)
-  @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_REGION)
-  @ResourceOperation(resource = ResourcePermission.Resource.DATA,
-      operation = ResourcePermission.Operation.MANAGE)
-  public Result destroyRegion(
-      @CliOption(key = CliStrings.DESTROY_REGION__REGION, optionContext = ConverterHint.REGION_PATH,
-          mandatory = true, help = CliStrings.DESTROY_REGION__REGION__HELP) String regionPath) {
-
-    if (regionPath == null) {
-      return ResultBuilder
-          .createInfoResult(CliStrings.DESTROY_REGION__MSG__SPECIFY_REGIONPATH_TO_DESTROY);
-    }
-
-    if (StringUtils.isBlank(regionPath) || regionPath.equals(Region.SEPARATOR)) {
-      return ResultBuilder.createInfoResult(CliStrings.format(
-          CliStrings.DESTROY_REGION__MSG__REGIONPATH_0_NOT_VALID, new Object[] {regionPath}));
-    }
-
-    Result result;
-    AtomicReference<XmlEntity> xmlEntity = new AtomicReference<>();
-    try {
-      InternalCache cache = getCache();
-      ManagementService managementService = ManagementService.getExistingManagementService(cache);
-      String regionPathToUse = regionPath;
-
-      if (!regionPathToUse.startsWith(Region.SEPARATOR)) {
-        regionPathToUse = Region.SEPARATOR + regionPathToUse;
-      }
-
-      Set<DistributedMember> regionMembersList =
-          findMembersForRegion(cache, managementService, regionPathToUse);
-
-      if (regionMembersList.size() == 0) {
-        return ResultBuilder.createUserErrorResult(
-            CliStrings.format(CliStrings.DESTROY_REGION__MSG__COULD_NOT_FIND_REGIONPATH_0_IN_GEODE,
-                regionPath, "jmx-manager-update-rate milliseconds"));
-      }
-
-      CliFunctionResult destroyRegionResult;
-
-      ResultCollector<?, ?> resultCollector =
-          CliUtil.executeFunction(RegionDestroyFunction.INSTANCE, regionPath, regionMembersList);
-      List<CliFunctionResult> resultsList = (List<CliFunctionResult>) resultCollector.getResult();
-      String message =
-          CliStrings.format(CliStrings.DESTROY_REGION__MSG__REGION_0_1_DESTROYED, regionPath, "");
-
-      // Only if there is an error is this set to false
-      boolean isRegionDestroyed = true;
-      for (CliFunctionResult aResultsList : resultsList) {
-        destroyRegionResult = aResultsList;
-        if (destroyRegionResult.isSuccessful()) {
-          xmlEntity.set(destroyRegionResult.getXmlEntity());
-        } else if (destroyRegionResult.getThrowable() != null) {
-          Throwable t = destroyRegionResult.getThrowable();
-          LogWrapper.getInstance().info(t.getMessage(), t);
-          message = CliStrings.format(
-              CliStrings.DESTROY_REGION__MSG__ERROR_OCCURRED_WHILE_DESTROYING_0_REASON_1,
-              regionPath, t.getMessage());
-          isRegionDestroyed = false;
-        } else {
-          message = CliStrings.format(
-              CliStrings.DESTROY_REGION__MSG__UNKNOWN_RESULT_WHILE_DESTROYING_REGION_0_REASON_1,
-              regionPath, destroyRegionResult.getMessage());
-          isRegionDestroyed = false;
-        }
-      }
-      if (isRegionDestroyed) {
-        result = ResultBuilder.createInfoResult(message);
-      } else {
-        result = ResultBuilder.createUserErrorResult(message);
-      }
-    } catch (IllegalStateException e) {
-      result = ResultBuilder.createUserErrorResult(CliStrings.format(
-          CliStrings.DESTROY_REGION__MSG__ERROR_WHILE_DESTROYING_REGION_0_REASON_1, regionPath,
-          e.getMessage()));
-    } catch (Exception e) {
-      result = ResultBuilder.createGemFireErrorResult(CliStrings.format(
-          CliStrings.DESTROY_REGION__MSG__ERROR_WHILE_DESTROYING_REGION_0_REASON_1, regionPath,
-          e.getMessage()));
-    }
-
-    if (xmlEntity.get() != null) {
-      persistClusterConfiguration(result,
-          () -> getSharedConfiguration().deleteXmlEntity(xmlEntity.get(), null));
-    }
-
-    return result;
-  }
-
-  private Set<DistributedMember> findMembersForRegion(InternalCache cache,
-      ManagementService managementService, String regionPath) {
-    Set<DistributedMember> membersList = new HashSet<>();
-    Set<String> regionMemberIds = new HashSet<>();
-    MBeanServer mbeanServer = MBeanJMXAdapter.mbeanServer;
-
-    // needs to be escaped with quotes if it contains a hyphen
-    if (regionPath.contains("-")) {
-      regionPath = "\"" + regionPath + "\"";
-    }
-
-    String queryExp =
-        MessageFormat.format(MBeanJMXAdapter.OBJECTNAME__REGION_MXBEAN, regionPath, "*");
-
-    try {
-      ObjectName queryExpON = new ObjectName(queryExp);
-      Set<ObjectName> queryNames = mbeanServer.queryNames(null, queryExpON);
-      if (queryNames == null || queryNames.isEmpty()) {
-        return membersList; // protects against null pointer exception below
-      }
-
-      boolean addedOneRemote = false;
-      for (ObjectName regionMBeanObjectName : queryNames) {
-        try {
-          RegionMXBean regionMXBean =
-              managementService.getMBeanInstance(regionMBeanObjectName, RegionMXBean.class);
-          if (regionMXBean != null) {
-            RegionAttributesData regionAttributes = regionMXBean.listRegionAttributes();
-            String scope = regionAttributes.getScope();
-            // For Scope.LOCAL regions we need to identify each hosting member, but for
-            // other scopes we just need a single member as the region destroy will be
-            // propagated.
-            if (Scope.LOCAL.equals(Scope.fromString(scope))) {
-              regionMemberIds.add(regionMXBean.getMember());
-            } else {
-              if (!addedOneRemote) {
-                regionMemberIds.add(regionMXBean.getMember());
-                addedOneRemote = true;
-              }
-            }
-          }
-        } catch (ClassCastException e) {
-          LogWriter logger = cache.getLogger();
-          if (logger.finerEnabled()) {
-            logger.finer(regionMBeanObjectName + " is not a " + RegionMXBean.class.getSimpleName(),
-                e);
-          }
-        }
-      }
-
-      if (!regionMemberIds.isEmpty()) {
-        membersList = getMembersByIds(cache, regionMemberIds);
-      }
-    } catch (MalformedObjectNameException | NullPointerException e) {
-      LogWrapper.getInstance().info(e.getMessage(), e);
-    }
-
-    return membersList;
-  }
-
-  private Set<DistributedMember> getMembersByIds(InternalCache cache, Set<String> memberIds) {
-    Set<DistributedMember> foundMembers = Collections.emptySet();
-    if (memberIds != null && !memberIds.isEmpty()) {
-      foundMembers = new HashSet<>();
-      Set<DistributedMember> allNormalMembers = CliUtil.getAllNormalMembers(cache);
-
-      for (String memberId : memberIds) {
-        for (DistributedMember distributedMember : allNormalMembers) {
-          if (memberId.equals(distributedMember.getId())
-              || memberId.equals(distributedMember.getName())) {
-            foundMembers.add(distributedMember);
-          }
-        }
-      }
-    }
-    return foundMembers;
-  }
-}


Mime
View raw message