geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [8/8] geode git commit: GEODE-3271: Separating WanCommands into multiple command classes
Date Wed, 26 Jul 2017 22:40:00 GMT
GEODE-3271: Separating WanCommands into multiple command classes


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/e1befef4
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/e1befef4
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/e1befef4

Branch: refs/heads/develop
Commit: e1befef474c81391ff73319de9c675ec238f8b93
Parents: 06b44db
Author: YehEmily <emilyyeh1997@gmail.com>
Authored: Wed Jul 19 13:16:03 2017 -0700
Committer: Kirk Lund <klund@apache.org>
Committed: Wed Jul 26 15:39:46 2017 -0700

----------------------------------------------------------------------
 .../commands/CreateGatewayReceiverCommand.java  |  125 ++
 .../commands/CreateGatewaySenderCommand.java    |  159 +++
 .../commands/DestroyGatewaySenderCommand.java   |   90 ++
 .../cli/commands/GatewayCommandsUtils.java      |   46 +
 .../cli/commands/ListGatewayCommand.java        |  165 +++
 .../LoadBalanceGatewaySenderCommand.java        |  104 ++
 .../cli/commands/PauseGatewaySenderCommand.java |  119 ++
 .../commands/ResumeGatewaySenderCommand.java    |  119 ++
 .../commands/StartGatewayReceiverCommand.java   |  115 ++
 .../cli/commands/StartGatewaySenderCommand.java |  167 +++
 .../commands/StatusGatewayReceiverCommand.java  |  112 ++
 .../commands/StatusGatewaySenderCommand.java    |  131 ++
 .../commands/StopGatewayReceiverCommand.java    |  114 ++
 .../cli/commands/StopGatewaySenderCommand.java  |  113 ++
 .../internal/cli/commands/WanCommands.java      | 1137 ------------------
 .../web/controllers/WanCommandsController.java  |   24 +-
 ...ndDestroyGatewaySenderCommandsDUnitTest.java |  532 ++++++++
 .../CreateGatewayReceiverCommandDUnitTest.java  |  506 ++++++++
 .../CreateGatewaySenderCommandDUnitTest.java    |  148 +++
 .../DestroyGatewaySenderCommandDUnitTest.java   |   75 ++
 .../PauseGatewaySenderCommandDUnitTest.java     |  233 ++++
 .../ResumeGatewaySenderCommandDUnitTest.java    |  263 ++++
 .../StartGatewayReceiverCommandDUnitTest.java   |  224 ++++
 .../StartGatewaySenderCommandDUnitTest.java     |  275 +++++
 .../StatusGatewayReceiverCommandDUnitTest.java  |  206 ++++
 .../StatusGatewaySenderCommandDUnitTest.java    |  251 ++++
 .../StopGatewayReceiverCommandDUnitTest.java    |  221 ++++
 .../StopGatewaySenderCommandDUnitTest.java      |  236 ++++
 .../wan/wancommand/WANCommandTestBase.java      |   55 +-
 ...mandCreateDestroyGatewaySenderDUnitTest.java |  794 ------------
 ...anCommandCreateGatewayReceiverDUnitTest.java |  584 ---------
 ...WanCommandGatewayReceiverStartDUnitTest.java |  266 ----
 .../WanCommandGatewayReceiverStopDUnitTest.java |  266 ----
 .../WanCommandGatewaySenderStartDUnitTest.java  |  327 -----
 .../WanCommandGatewaySenderStopDUnitTest.java   |  287 -----
 .../WanCommandPauseResumeDUnitTest.java         |  553 ---------
 .../wancommand/WanCommandStatusDUnitTest.java   |  535 --------
 37 files changed, 4904 insertions(+), 4773 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/e1befef4/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateGatewayReceiverCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateGatewayReceiverCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateGatewayReceiverCommand.java
new file mode 100644
index 0000000..a07aee1
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateGatewayReceiverCommand.java
@@ -0,0 +1,125 @@
+/*
+ * 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.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.LogWrapper;
+import org.apache.geode.management.internal.cli.functions.CliFunctionResult;
+import org.apache.geode.management.internal.cli.functions.GatewayReceiverCreateFunction;
+import org.apache.geode.management.internal.cli.functions.GatewayReceiverFunctionArgs;
+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 CreateGatewayReceiverCommand implements GfshCommand {
+
+  @CliCommand(value = CliStrings.CREATE_GATEWAYRECEIVER,
+      help = CliStrings.CREATE_GATEWAYRECEIVER__HELP)
+  @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_WAN)
+  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
+      operation = ResourcePermission.Operation.MANAGE, target = ResourcePermission.Target.GATEWAY)
+  public Result createGatewayReceiver(@CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
+      optionContext = ConverterHint.MEMBERGROUP,
+      help = CliStrings.CREATE_GATEWAYRECEIVER__GROUP__HELP) String[] onGroups,
+
+      @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
+          optionContext = ConverterHint.MEMBERIDNAME,
+          help = CliStrings.CREATE_GATEWAYRECEIVER__MEMBER__HELP) String[] onMember,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART,
+          help = CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART__HELP) Boolean manualStart,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT,
+          help = CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT__HELP) Integer startPort,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT,
+          help = CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT__HELP) Integer endPort,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS,
+          help = CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS__HELP) String bindAddress,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS,
+          help = CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS__HELP) Integer maximumTimeBetweenPings,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE,
+          help = CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE__HELP) Integer socketBufferSize,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYRECEIVER__GATEWAYTRANSPORTFILTER,
+          help = CliStrings.CREATE_GATEWAYRECEIVER__GATEWAYTRANSPORTFILTER__HELP) String[] gatewayTransportFilters) {
+
+    Result result;
+
+    AtomicReference<XmlEntity> xmlEntity = new AtomicReference<>();
+    try {
+      GatewayReceiverFunctionArgs gatewayReceiverFunctionArgs =
+          new GatewayReceiverFunctionArgs(manualStart, startPort, endPort, bindAddress,
+              socketBufferSize, maximumTimeBetweenPings, gatewayTransportFilters);
+
+      Set<DistributedMember> membersToCreateGatewayReceiverOn =
+          CliUtil.findMembers(onGroups, onMember);
+
+      if (membersToCreateGatewayReceiverOn.isEmpty()) {
+        return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
+      }
+
+      ResultCollector<?, ?> resultCollector =
+          CliUtil.executeFunction(GatewayReceiverCreateFunction.INSTANCE,
+              gatewayReceiverFunctionArgs, membersToCreateGatewayReceiverOn);
+      @SuppressWarnings("unchecked")
+      List<CliFunctionResult> gatewayReceiverCreateResults =
+          (List<CliFunctionResult>) resultCollector.getResult();
+
+      TabularResultData tabularResultData = ResultBuilder.createTabularResultData();
+      final String errorPrefix = "ERROR: ";
+
+      for (CliFunctionResult gatewayReceiverCreateResult : gatewayReceiverCreateResults) {
+        boolean success = gatewayReceiverCreateResult.isSuccessful();
+        tabularResultData.accumulate("Member", gatewayReceiverCreateResult.getMemberIdOrName());
+        tabularResultData.accumulate("Status",
+            (success ? "" : errorPrefix) + gatewayReceiverCreateResult.getMessage());
+
+        if (success && xmlEntity.get() == null) {
+          xmlEntity.set(gatewayReceiverCreateResult.getXmlEntity());
+        }
+      }
+      result = ResultBuilder.buildResult(tabularResultData);
+    } catch (IllegalArgumentException e) {
+      LogWrapper.getInstance().info(e.getMessage());
+      result = ResultBuilder.createUserErrorResult(e.getMessage());
+    }
+
+    if (xmlEntity.get() != null) {
+      persistClusterConfiguration(result,
+          () -> getSharedConfiguration().addXmlEntity(xmlEntity.get(), onGroups));
+    }
+    return result;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/e1befef4/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateGatewaySenderCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateGatewaySenderCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateGatewaySenderCommand.java
new file mode 100644
index 0000000..5b4073d
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateGatewaySenderCommand.java
@@ -0,0 +1,159 @@
+/*
+ * 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.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.LogWrapper;
+import org.apache.geode.management.internal.cli.functions.CliFunctionResult;
+import org.apache.geode.management.internal.cli.functions.GatewaySenderCreateFunction;
+import org.apache.geode.management.internal.cli.functions.GatewaySenderFunctionArgs;
+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 CreateGatewaySenderCommand implements GfshCommand {
+  public CreateGatewaySenderCommand() {}
+
+  @CliCommand(value = CliStrings.CREATE_GATEWAYSENDER, help = CliStrings.CREATE_GATEWAYSENDER__HELP)
+  @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_WAN)
+  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
+      operation = ResourcePermission.Operation.MANAGE, target = ResourcePermission.Target.GATEWAY)
+  public Result createGatewaySender(@CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
+      optionContext = ConverterHint.MEMBERGROUP,
+      help = CliStrings.CREATE_GATEWAYSENDER__GROUP__HELP) String[] onGroups,
+
+      @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
+          optionContext = ConverterHint.MEMBERIDNAME,
+          help = CliStrings.CREATE_GATEWAYSENDER__MEMBER__HELP) String[] onMember,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYSENDER__ID, mandatory = true,
+          help = CliStrings.CREATE_GATEWAYSENDER__ID__HELP) String id,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID, mandatory = true,
+          help = CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID__HELP) Integer remoteDistributedSystemId,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYSENDER__PARALLEL,
+          help = CliStrings.CREATE_GATEWAYSENDER__PARALLEL__HELP) Boolean parallel,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYSENDER__MANUALSTART,
+          help = CliStrings.CREATE_GATEWAYSENDER__MANUALSTART__HELP) Boolean manualStart,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE,
+          help = CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE__HELP) Integer socketBufferSize,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT,
+          help = CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT__HELP) Integer socketReadTimeout,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION,
+          help = CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION__HELP) Boolean enableBatchConflation,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE,
+          help = CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE__HELP) Integer batchSize,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL,
+          help = CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL__HELP) Integer batchTimeInterval,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE,
+          help = CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE__HELP) Boolean enablePersistence,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYSENDER__DISKSTORENAME,
+          help = CliStrings.CREATE_GATEWAYSENDER__DISKSTORENAME__HELP) String diskStoreName,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS,
+          help = CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS__HELP) Boolean diskSynchronous,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY,
+          help = CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY__HELP) Integer maxQueueMemory,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD,
+          help = CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD__HELP) Integer alertThreshold,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS,
+          help = CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS__HELP) Integer dispatcherThreads,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYSENDER__ORDERPOLICY,
+          help = CliStrings.CREATE_GATEWAYSENDER__ORDERPOLICY__HELP) String orderPolicy,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYSENDER__GATEWAYEVENTFILTER,
+          help = CliStrings.CREATE_GATEWAYSENDER__GATEWAYEVENTFILTER__HELP) String[] gatewayEventFilters,
+
+      @CliOption(key = CliStrings.CREATE_GATEWAYSENDER__GATEWAYTRANSPORTFILTER,
+          help = CliStrings.CREATE_GATEWAYSENDER__GATEWAYTRANSPORTFILTER__HELP) String[] gatewayTransportFilter) {
+
+    Result result;
+
+    AtomicReference<XmlEntity> xmlEntity = new AtomicReference<XmlEntity>();
+    try {
+      GatewaySenderFunctionArgs gatewaySenderFunctionArgs = new GatewaySenderFunctionArgs(id,
+          remoteDistributedSystemId, parallel, manualStart, socketBufferSize, socketReadTimeout,
+          enableBatchConflation, batchSize, batchTimeInterval, enablePersistence, diskStoreName,
+          diskSynchronous, maxQueueMemory, alertThreshold, dispatcherThreads, orderPolicy,
+          gatewayEventFilters, gatewayTransportFilter);
+
+      Set<DistributedMember> membersToCreateGatewaySenderOn =
+          CliUtil.findMembers(onGroups, onMember);
+
+      if (membersToCreateGatewaySenderOn.isEmpty()) {
+        return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
+      }
+
+      ResultCollector<?, ?> resultCollector =
+          CliUtil.executeFunction(GatewaySenderCreateFunction.INSTANCE, gatewaySenderFunctionArgs,
+              membersToCreateGatewaySenderOn);
+      @SuppressWarnings("unchecked")
+      List<CliFunctionResult> gatewaySenderCreateResults =
+          (List<CliFunctionResult>) resultCollector.getResult();
+
+      TabularResultData tabularResultData = ResultBuilder.createTabularResultData();
+      final String errorPrefix = "ERROR: ";
+      for (CliFunctionResult gatewaySenderCreateResult : gatewaySenderCreateResults) {
+        boolean success = gatewaySenderCreateResult.isSuccessful();
+        tabularResultData.accumulate("Member", gatewaySenderCreateResult.getMemberIdOrName());
+        tabularResultData.accumulate("Status",
+            (success ? "" : errorPrefix) + gatewaySenderCreateResult.getMessage());
+
+        if (success && xmlEntity.get() == null) {
+          xmlEntity.set(gatewaySenderCreateResult.getXmlEntity());
+        }
+      }
+      result = ResultBuilder.buildResult(tabularResultData);
+    } catch (IllegalArgumentException e) {
+      LogWrapper.getInstance().info(e.getMessage());
+      result = ResultBuilder.createUserErrorResult(e.getMessage());
+    }
+
+    if (xmlEntity.get() != null) {
+      persistClusterConfiguration(result,
+          () -> getSharedConfiguration().addXmlEntity(xmlEntity.get(), onGroups));
+    }
+    return result;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/e1befef4/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyGatewaySenderCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyGatewaySenderCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyGatewaySenderCommand.java
new file mode 100644
index 0000000..97b4a95
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyGatewaySenderCommand.java
@@ -0,0 +1,90 @@
+/*
+ * 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 org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+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.LogWrapper;
+import org.apache.geode.management.internal.cli.functions.CliFunctionResult;
+import org.apache.geode.management.internal.cli.functions.GatewaySenderDestroyFunction;
+import org.apache.geode.management.internal.cli.functions.GatewaySenderDestroyFunctionArgs;
+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.security.ResourceOperation;
+import org.apache.geode.security.ResourcePermission;
+
+public class DestroyGatewaySenderCommand implements GfshCommand {
+  @CliCommand(value = CliStrings.DESTROY_GATEWAYSENDER,
+      help = CliStrings.DESTROY_GATEWAYSENDER__HELP)
+  @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_WAN)
+  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
+      operation = ResourcePermission.Operation.MANAGE, target = ResourcePermission.Target.GATEWAY)
+  public Result destroyGatewaySender(
+      @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
+          optionContext = ConverterHint.MEMBERGROUP,
+          help = CliStrings.DESTROY_GATEWAYSENDER__GROUP__HELP) String[] onGroups,
+      @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
+          optionContext = ConverterHint.MEMBERIDNAME,
+          help = CliStrings.DESTROY_GATEWAYSENDER__MEMBER__HELP) String[] onMember,
+      @CliOption(key = CliStrings.DESTROY_GATEWAYSENDER__ID, mandatory = true,
+          optionContext = ConverterHint.GATEWAY_SENDER_ID,
+          help = CliStrings.DESTROY_GATEWAYSENDER__ID__HELP) String id) {
+    Result result;
+    try {
+      GatewaySenderDestroyFunctionArgs gatewaySenderDestroyFunctionArgs =
+          new GatewaySenderDestroyFunctionArgs(id);
+
+      Set<DistributedMember> membersToDestroyGatewaySenderOn =
+          CliUtil.findMembers(onGroups, onMember);
+
+      if (membersToDestroyGatewaySenderOn.isEmpty()) {
+        return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
+      }
+
+      ResultCollector<?, ?> resultCollector =
+          CliUtil.executeFunction(GatewaySenderDestroyFunction.INSTANCE,
+              gatewaySenderDestroyFunctionArgs, membersToDestroyGatewaySenderOn);
+      @SuppressWarnings("unchecked")
+      List<CliFunctionResult> gatewaySenderDestroyResults =
+          (List<CliFunctionResult>) resultCollector.getResult();
+
+      TabularResultData tabularResultData = ResultBuilder.createTabularResultData();
+      final String errorPrefix = "ERROR: ";
+      for (CliFunctionResult gatewaySenderDestroyResult : gatewaySenderDestroyResults) {
+        boolean success = gatewaySenderDestroyResult.isSuccessful();
+        tabularResultData.accumulate("Member", gatewaySenderDestroyResult.getMemberIdOrName());
+        tabularResultData.accumulate("Status",
+            (success ? "" : errorPrefix) + gatewaySenderDestroyResult.getMessage());
+      }
+      result = ResultBuilder.buildResult(tabularResultData);
+    } catch (IllegalArgumentException e) {
+      LogWrapper.getInstance().info(e.getMessage());
+      result = ResultBuilder.createUserErrorResult(e.getMessage());
+    }
+    return result;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/e1befef4/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/GatewayCommandsUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/GatewayCommandsUtils.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/GatewayCommandsUtils.java
new file mode 100644
index 0000000..d6e03c1
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/GatewayCommandsUtils.java
@@ -0,0 +1,46 @@
+/*
+ * 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 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.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.CommandResultException;
+import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.cli.result.TabularResultData;
+
+public class GatewayCommandsUtils {
+  public static void accumulateStartResult(TabularResultData resultData, String member,
+      String Status, String message) {
+    if (member != null) {
+      resultData.accumulate("Member", member);
+    }
+    resultData.accumulate("Result", Status);
+    resultData.accumulate("Message", message);
+  }
+
+  static Result handleCommandResultException(CommandResultException crex) {
+    Result result;
+    if (crex.getResult() != null) {
+      result = crex.getResult();
+    } else {
+      LogWrapper.getInstance().warning(CliStrings.GATEWAY_ERROR + CliUtil.stackTraceAsString(crex));
+      result = ResultBuilder.createGemFireErrorResult(CliStrings.GATEWAY_ERROR + crex.getMessage());
+    }
+    return result;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/e1befef4/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListGatewayCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListGatewayCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListGatewayCommand.java
new file mode 100644
index 0000000..81fa027
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListGatewayCommand.java
@@ -0,0 +1,165 @@
+/*
+ * 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.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import javax.management.ObjectName;
+
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.management.DistributedSystemMXBean;
+import org.apache.geode.management.GatewayReceiverMXBean;
+import org.apache.geode.management.GatewaySenderMXBean;
+import org.apache.geode.management.ManagementService;
+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.SystemManagementService;
+import org.apache.geode.management.internal.cli.CliUtil;
+import org.apache.geode.management.internal.cli.LogWrapper;
+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.security.ResourceOperation;
+import org.apache.geode.security.ResourcePermission;
+
+public class ListGatewayCommand implements GfshCommand {
+  @CliCommand(value = CliStrings.LIST_GATEWAY, help = CliStrings.LIST_GATEWAY__HELP)
+  @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_WAN)
+  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
+      operation = ResourcePermission.Operation.READ)
+  public Result listGateway(
+      @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
+          optionContext = ConverterHint.MEMBERIDNAME,
+          help = CliStrings.LIST_GATEWAY__MEMBER__HELP) String[] onMember,
+      @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
+          optionContext = ConverterHint.MEMBERGROUP,
+          help = CliStrings.LIST_GATEWAY__GROUP__HELP) String[] onGroup) {
+
+    Result result;
+    InternalCache cache = getCache();
+    try {
+      SystemManagementService service =
+          (SystemManagementService) ManagementService.getExistingManagementService(cache);
+
+      Set<DistributedMember> dsMembers = CliUtil.findMembers(onGroup, onMember);
+
+      if (dsMembers.isEmpty()) {
+        return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
+      }
+
+      Map<String, Map<String, GatewaySenderMXBean>> gatewaySenderBeans = new TreeMap<>();
+      Map<String, GatewayReceiverMXBean> gatewayReceiverBeans = new TreeMap<>();
+
+      DistributedSystemMXBean dsMXBean = service.getDistributedSystemMXBean();
+      for (DistributedMember member : dsMembers) {
+        String memberName = member.getName();
+        String memberNameOrId =
+            (memberName != null && !memberName.isEmpty()) ? memberName : member.getId();
+        ObjectName gatewaySenderObjectNames[] =
+            dsMXBean.listGatewaySenderObjectNames(memberNameOrId);
+        // gateway senders : a member can have multiple gateway senders defined
+        // on it
+        if (gatewaySenderObjectNames != null) {
+          for (ObjectName name : gatewaySenderObjectNames) {
+            GatewaySenderMXBean senderBean = service.getMBeanProxy(name, GatewaySenderMXBean.class);
+            if (senderBean != null) {
+              if (gatewaySenderBeans.containsKey(senderBean.getSenderId())) {
+                Map<String, GatewaySenderMXBean> memberToBeanMap =
+                    gatewaySenderBeans.get(senderBean.getSenderId());
+                memberToBeanMap.put(member.getId(), senderBean);
+              } else {
+                Map<String, GatewaySenderMXBean> memberToBeanMap = new TreeMap<>();
+                memberToBeanMap.put(member.getId(), senderBean);
+                gatewaySenderBeans.put(senderBean.getSenderId(), memberToBeanMap);
+              }
+            }
+          }
+        }
+        // gateway receivers : a member can have only one gateway receiver
+        ObjectName gatewayReceiverObjectName = MBeanJMXAdapter.getGatewayReceiverMBeanName(member);
+        if (gatewayReceiverObjectName != null) {
+          GatewayReceiverMXBean receiverBean;
+          receiverBean =
+              service.getMBeanProxy(gatewayReceiverObjectName, GatewayReceiverMXBean.class);
+          if (receiverBean != null) {
+            gatewayReceiverBeans.put(member.getId(), receiverBean);
+          }
+        }
+      }
+      if (gatewaySenderBeans.isEmpty() && gatewayReceiverBeans.isEmpty()) {
+        return ResultBuilder
+            .createUserErrorResult(CliStrings.GATEWAYS_ARE_NOT_AVAILABLE_IN_CLUSTER);
+      }
+      CompositeResultData crd = ResultBuilder.createCompositeResultData();
+      crd.setHeader(CliStrings.HEADER_GATEWAYS);
+      accumulateListGatewayResult(crd, gatewaySenderBeans, gatewayReceiverBeans);
+      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;
+  }
+
+  private void accumulateListGatewayResult(CompositeResultData crd,
+      Map<String, Map<String, GatewaySenderMXBean>> gatewaySenderBeans,
+      Map<String, GatewayReceiverMXBean> gatewayReceiverBeans) {
+    if (!gatewaySenderBeans.isEmpty()) {
+      TabularResultData gatewaySenderData = crd.addSection(CliStrings.SECTION_GATEWAY_SENDER)
+          .addTable(CliStrings.TABLE_GATEWAY_SENDER).setHeader(CliStrings.HEADER_GATEWAY_SENDER);
+      for (Map.Entry<String, Map<String, GatewaySenderMXBean>> entry : gatewaySenderBeans
+          .entrySet()) {
+        for (Map.Entry<String, GatewaySenderMXBean> memberToBean : entry.getValue().entrySet()) {
+          gatewaySenderData.accumulate(CliStrings.RESULT_GATEWAY_SENDER_ID, entry.getKey());
+          gatewaySenderData.accumulate(CliStrings.RESULT_HOST_MEMBER, memberToBean.getKey());
+          gatewaySenderData.accumulate(CliStrings.RESULT_REMOTE_CLUSTER,
+              memberToBean.getValue().getRemoteDSId());
+          gatewaySenderData.accumulate(CliStrings.RESULT_TYPE, memberToBean.getValue().isParallel()
+              ? CliStrings.SENDER_PARALLEL : CliStrings.SENDER_SERIAL);
+          gatewaySenderData.accumulate(CliStrings.RESULT_STATUS, memberToBean.getValue().isRunning()
+              ? CliStrings.GATEWAY_RUNNING : CliStrings.GATEWAY_NOT_RUNNING);
+          gatewaySenderData.accumulate(CliStrings.RESULT_QUEUED_EVENTS,
+              memberToBean.getValue().getEventQueueSize());
+          gatewaySenderData.accumulate(CliStrings.RESULT_RECEIVER,
+              memberToBean.getValue().getGatewayReceiver());
+        }
+      }
+    }
+
+    if (!gatewayReceiverBeans.isEmpty()) {
+      TabularResultData gatewayReceiverData = crd.addSection(CliStrings.SECTION_GATEWAY_RECEIVER)
+          .addTable(CliStrings.TABLE_GATEWAY_RECEIVER)
+          .setHeader(CliStrings.HEADER_GATEWAY_RECEIVER);
+      for (Map.Entry<String, GatewayReceiverMXBean> entry : gatewayReceiverBeans.entrySet()) {
+        gatewayReceiverData.accumulate(CliStrings.RESULT_HOST_MEMBER, entry.getKey());
+        gatewayReceiverData.accumulate(CliStrings.RESULT_PORT, entry.getValue().getPort());
+        gatewayReceiverData.accumulate(CliStrings.RESULT_SENDERS_COUNT,
+            entry.getValue().getClientConnectionCount());
+        gatewayReceiverData.accumulate(CliStrings.RESULT_SENDER_CONNECTED,
+            entry.getValue().getConnectedGatewaySenders());
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/e1befef4/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LoadBalanceGatewaySenderCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LoadBalanceGatewaySenderCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LoadBalanceGatewaySenderCommand.java
new file mode 100644
index 0000000..c076ba2
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LoadBalanceGatewaySenderCommand.java
@@ -0,0 +1,104 @@
+/*
+ * 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.Set;
+
+import javax.management.ObjectName;
+
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.management.GatewaySenderMXBean;
+import org.apache.geode.management.ManagementService;
+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.SystemManagementService;
+import org.apache.geode.management.internal.cli.CliUtil;
+import org.apache.geode.management.internal.cli.LogWrapper;
+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.security.ResourceOperation;
+import org.apache.geode.security.ResourcePermission;
+
+public class LoadBalanceGatewaySenderCommand implements GfshCommand {
+
+  @CliCommand(value = CliStrings.LOAD_BALANCE_GATEWAYSENDER,
+      help = CliStrings.LOAD_BALANCE_GATEWAYSENDER__HELP)
+  @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_WAN)
+  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
+      operation = ResourcePermission.Operation.MANAGE, target = ResourcePermission.Target.GATEWAY)
+  public Result loadBalanceGatewaySender(@CliOption(key = CliStrings.LOAD_BALANCE_GATEWAYSENDER__ID,
+      mandatory = true, optionContext = ConverterHint.GATEWAY_SENDER_ID,
+      help = CliStrings.LOAD_BALANCE_GATEWAYSENDER__ID__HELP) String senderId) {
+
+    Result result;
+    if (senderId != null) {
+      senderId = senderId.trim();
+    }
+
+    try {
+      InternalCache cache = getCache();
+      SystemManagementService service =
+          (SystemManagementService) ManagementService.getExistingManagementService(cache);
+      TabularResultData resultData = ResultBuilder.createTabularResultData();
+      Set<DistributedMember> dsMembers = CliUtil.getAllNormalMembers(cache);
+
+      if (dsMembers.isEmpty()) {
+        result = ResultBuilder.createInfoResult(CliStrings.GATEWAY_MSG_MEMBERS_NOT_FOUND);
+      } else {
+        boolean gatewaySenderExists = false;
+        for (DistributedMember member : dsMembers) {
+          GatewaySenderMXBean bean;
+          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) {
+            gatewaySenderExists = true;
+            bean.rebalance();
+            GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+                CliStrings.GATEWAY_OK,
+                CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_REBALANCED_ON_MEMBER_1, senderId,
+                    member.getId()));
+          } else {
+            GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+                CliStrings.GATEWAY_ERROR,
+                CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_AVAILABLE_ON_MEMBER_1,
+                    senderId, member.getId()));
+          }
+        }
+        if (gatewaySenderExists) {
+          result = ResultBuilder.buildResult(resultData);
+        } else {
+          result = ResultBuilder.createInfoResult(CliStrings.format(
+              CliStrings.GATEWAY_SENDER_0_IS_NOT_FOUND_ON_ANY_MEMBER, new Object[] {senderId}));
+        }
+      }
+    } catch (Exception e) {
+      LogWrapper.getInstance().warning(CliStrings.GATEWAY_ERROR + CliUtil.stackTraceAsString(e));
+      result = ResultBuilder.createGemFireErrorResult(CliStrings.GATEWAY_ERROR + e.getMessage());
+    }
+
+    return result;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/e1befef4/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/PauseGatewaySenderCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/PauseGatewaySenderCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/PauseGatewaySenderCommand.java
new file mode 100644
index 0000000..60124eb
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/PauseGatewaySenderCommand.java
@@ -0,0 +1,119 @@
+/*
+ * 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.Set;
+
+import javax.management.ObjectName;
+
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.management.GatewaySenderMXBean;
+import org.apache.geode.management.ManagementService;
+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.SystemManagementService;
+import org.apache.geode.management.internal.cli.CliUtil;
+import org.apache.geode.management.internal.cli.LogWrapper;
+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.security.ResourceOperation;
+import org.apache.geode.security.ResourcePermission;
+
+public class PauseGatewaySenderCommand implements GfshCommand {
+
+  @CliCommand(value = CliStrings.PAUSE_GATEWAYSENDER, help = CliStrings.PAUSE_GATEWAYSENDER__HELP)
+  @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_WAN)
+  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
+      operation = ResourcePermission.Operation.MANAGE, target = ResourcePermission.Target.GATEWAY)
+  public Result pauseGatewaySender(@CliOption(key = CliStrings.PAUSE_GATEWAYSENDER__ID,
+      mandatory = true, optionContext = ConverterHint.GATEWAY_SENDER_ID,
+      help = CliStrings.PAUSE_GATEWAYSENDER__ID__HELP) String senderId,
+
+      @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
+          optionContext = ConverterHint.MEMBERGROUP,
+          help = CliStrings.PAUSE_GATEWAYSENDER__GROUP__HELP) String[] onGroup,
+
+      @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
+          optionContext = ConverterHint.MEMBERIDNAME,
+          help = CliStrings.PAUSE_GATEWAYSENDER__MEMBER__HELP) String[] onMember) {
+
+    Result result;
+    if (senderId != null) {
+      senderId = senderId.trim();
+    }
+
+    try {
+      InternalCache cache = getCache();
+      SystemManagementService service =
+          (SystemManagementService) ManagementService.getExistingManagementService(cache);
+
+      GatewaySenderMXBean bean;
+
+      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) {
+        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) {
+          if (bean.isRunning()) {
+            if (bean.isPaused()) {
+              GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+                  CliStrings.GATEWAY_ERROR,
+                  CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_ALREADY_PAUSED_ON_MEMBER_1,
+                      senderId, member.getId()));
+            } else {
+              bean.pause();
+              GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+                  CliStrings.GATEWAY_OK, CliStrings.format(
+                      CliStrings.GATEWAY_SENDER_0_IS_PAUSED_ON_MEMBER_1, senderId, member.getId()));
+            }
+          } else {
+            GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+                CliStrings.GATEWAY_ERROR,
+                CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_RUNNING_ON_MEMBER_1, senderId,
+                    member.getId()));
+          }
+        } else {
+          GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+              CliStrings.GATEWAY_ERROR,
+              CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_AVAILABLE_ON_MEMBER_1, senderId,
+                  member.getId()));
+        }
+      }
+      result = ResultBuilder.buildResult(resultData);
+    } catch (Exception e) {
+      LogWrapper.getInstance().warning(CliStrings.GATEWAY_ERROR + CliUtil.stackTraceAsString(e));
+      result = ResultBuilder.createGemFireErrorResult(CliStrings.GATEWAY_ERROR + e.getMessage());
+    }
+    return result;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/e1befef4/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ResumeGatewaySenderCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ResumeGatewaySenderCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ResumeGatewaySenderCommand.java
new file mode 100644
index 0000000..b6a49c9
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ResumeGatewaySenderCommand.java
@@ -0,0 +1,119 @@
+/*
+ * 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.Set;
+
+import javax.management.ObjectName;
+
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.management.GatewaySenderMXBean;
+import org.apache.geode.management.ManagementService;
+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.SystemManagementService;
+import org.apache.geode.management.internal.cli.CliUtil;
+import org.apache.geode.management.internal.cli.LogWrapper;
+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.security.ResourceOperation;
+import org.apache.geode.security.ResourcePermission;
+
+public class ResumeGatewaySenderCommand implements GfshCommand {
+
+  @CliCommand(value = CliStrings.RESUME_GATEWAYSENDER, help = CliStrings.RESUME_GATEWAYSENDER__HELP)
+  @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_WAN)
+  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
+      operation = ResourcePermission.Operation.MANAGE, target = ResourcePermission.Target.GATEWAY)
+  public Result resumeGatewaySender(@CliOption(key = CliStrings.RESUME_GATEWAYSENDER__ID,
+      mandatory = true, optionContext = ConverterHint.GATEWAY_SENDER_ID,
+      help = CliStrings.RESUME_GATEWAYSENDER__ID__HELP) String senderId,
+
+      @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
+          optionContext = ConverterHint.MEMBERGROUP,
+          help = CliStrings.RESUME_GATEWAYSENDER__GROUP__HELP) String[] onGroup,
+      @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
+          optionContext = ConverterHint.MEMBERIDNAME,
+          help = CliStrings.RESUME_GATEWAYSENDER__MEMBER__HELP) String[] onMember) {
+
+    Result result;
+    if (senderId != null) {
+      senderId = senderId.trim();
+    }
+
+    try {
+      InternalCache cache = getCache();
+      SystemManagementService service =
+          (SystemManagementService) ManagementService.getExistingManagementService(cache);
+
+      GatewaySenderMXBean bean;
+
+      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) {
+        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) {
+          if (bean.isRunning()) {
+            if (bean.isPaused()) {
+              bean.resume();
+              GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+                  CliStrings.GATEWAY_OK,
+                  CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_RESUMED_ON_MEMBER_1, senderId,
+                      member.getId()));
+            } else {
+              GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+                  CliStrings.GATEWAY_ERROR,
+                  CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_PAUSED_ON_MEMBER_1, senderId,
+                      member.getId()));
+            }
+          } else {
+            GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+                CliStrings.GATEWAY_ERROR,
+                CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_RUNNING_ON_MEMBER_1, senderId,
+                    member.getId()));
+          }
+        } else {
+          GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+              CliStrings.GATEWAY_ERROR,
+              CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_AVAILABLE_ON_MEMBER_1, senderId,
+                  member.getId()));
+        }
+      }
+      result = ResultBuilder.buildResult(resultData);
+    } catch (Exception e) {
+      LogWrapper.getInstance().warning(CliStrings.GATEWAY_ERROR + CliUtil.stackTraceAsString(e));
+      result = ResultBuilder.createGemFireErrorResult(CliStrings.GATEWAY_ERROR + e.getMessage());
+    }
+    return result;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/e1befef4/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartGatewayReceiverCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartGatewayReceiverCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartGatewayReceiverCommand.java
new file mode 100644
index 0000000..b3402f5
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartGatewayReceiverCommand.java
@@ -0,0 +1,115 @@
+/*
+ * 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.Set;
+
+import javax.management.ObjectName;
+
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.management.GatewayReceiverMXBean;
+import org.apache.geode.management.ManagementService;
+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.SystemManagementService;
+import org.apache.geode.management.internal.cli.CliUtil;
+import org.apache.geode.management.internal.cli.LogWrapper;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.CommandResultException;
+import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.cli.result.TabularResultData;
+import org.apache.geode.management.internal.security.ResourceOperation;
+import org.apache.geode.security.ResourcePermission;
+
+public class StartGatewayReceiverCommand implements GfshCommand {
+
+  @CliCommand(value = CliStrings.START_GATEWAYRECEIVER,
+      help = CliStrings.START_GATEWAYRECEIVER__HELP)
+  @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_WAN)
+  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
+      operation = ResourcePermission.Operation.MANAGE, target = ResourcePermission.Target.GATEWAY)
+  public Result startGatewayReceiver(@CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
+      optionContext = ConverterHint.MEMBERGROUP,
+      help = CliStrings.START_GATEWAYRECEIVER__GROUP__HELP) String[] onGroup,
+
+      @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
+          optionContext = ConverterHint.MEMBERIDNAME,
+          help = CliStrings.START_GATEWAYRECEIVER__MEMBER__HELP) String[] onMember) {
+    Result result;
+
+    try {
+      InternalCache cache = getCache();
+      SystemManagementService service =
+          (SystemManagementService) ManagementService.getExistingManagementService(cache);
+
+      GatewayReceiverMXBean receiverBean;
+
+      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) {
+          receiverBean =
+              service.getMBeanProxy(gatewayReceiverObjectName, GatewayReceiverMXBean.class);
+          if (receiverBean != null) {
+            if (receiverBean.isRunning()) {
+              GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+                  CliStrings.GATEWAY_ERROR,
+                  CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_ALREADY_STARTED_ON_MEMBER_0,
+                      new Object[] {member.getId()}));
+            } else {
+              receiverBean.start();
+              GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+                  CliStrings.GATEWAY_OK,
+                  CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_STARTED_ON_MEMBER_0,
+                      new Object[] {member.getId()}));
+            }
+          } else {
+            GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+                CliStrings.GATEWAY_ERROR,
+                CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_NOT_AVAILABLE_ON_MEMBER_0,
+                    new Object[] {member.getId()}));
+          }
+        } else {
+          GatewayCommandsUtils.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 = GatewayCommandsUtils.handleCommandResultException(crex);
+    } catch (Exception e) {
+      LogWrapper.getInstance().warning(CliStrings.GATEWAY_ERROR + CliUtil.stackTraceAsString(e));
+      result = ResultBuilder.createGemFireErrorResult(CliStrings.GATEWAY_ERROR + e.getMessage());
+    }
+    return result;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/e1befef4/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartGatewaySenderCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartGatewaySenderCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartGatewaySenderCommand.java
new file mode 100644
index 0000000..986260a
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartGatewaySenderCommand.java
@@ -0,0 +1,167 @@
+/*
+ * 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 java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.management.ObjectName;
+
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.management.GatewaySenderMXBean;
+import org.apache.geode.management.ManagementService;
+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.SystemManagementService;
+import org.apache.geode.management.internal.cli.CliUtil;
+import org.apache.geode.management.internal.cli.LogWrapper;
+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.security.ResourceOperation;
+import org.apache.geode.security.ResourcePermission;
+
+public class StartGatewaySenderCommand implements GfshCommand {
+
+  @CliCommand(value = CliStrings.START_GATEWAYSENDER, help = CliStrings.START_GATEWAYSENDER__HELP)
+  @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_WAN)
+  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
+      operation = ResourcePermission.Operation.MANAGE, target = ResourcePermission.Target.GATEWAY)
+  public Result startGatewaySender(@CliOption(key = CliStrings.START_GATEWAYSENDER__ID,
+      mandatory = true, optionContext = ConverterHint.GATEWAY_SENDER_ID,
+      help = CliStrings.START_GATEWAYSENDER__ID__HELP) String senderId,
+
+      @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
+          optionContext = ConverterHint.MEMBERGROUP,
+          help = CliStrings.START_GATEWAYSENDER__GROUP__HELP) String[] onGroup,
+
+      @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
+          optionContext = ConverterHint.MEMBERIDNAME,
+          help = CliStrings.START_GATEWAYSENDER__MEMBER__HELP) String[] onMember) {
+
+    Result result;
+    final String id = senderId.trim();
+
+    try {
+      final InternalCache cache = getCache();
+      final SystemManagementService service =
+          (SystemManagementService) ManagementService.getExistingManagementService(cache);
+
+      TabularResultData resultData = ResultBuilder.createTabularResultData();
+
+      Set<DistributedMember> dsMembers = CliUtil.findMembers(onGroup, onMember);
+
+      if (dsMembers.isEmpty()) {
+        return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
+      }
+
+      ExecutorService execService = Executors.newCachedThreadPool(new ThreadFactory() {
+        AtomicInteger threadNum = new AtomicInteger();
+
+        public Thread newThread(final Runnable r) {
+          Thread result =
+              new Thread(r, "Start Sender Command Thread " + threadNum.incrementAndGet());
+          result.setDaemon(true);
+          return result;
+        }
+      });
+
+      List<Callable<List>> callables = new ArrayList<>();
+
+      for (final DistributedMember member : dsMembers) {
+
+        callables.add(() -> {
+
+          GatewaySenderMXBean bean;
+          ArrayList<String> statusList = new ArrayList<>();
+          if (cache.getDistributedSystem().getDistributedMember().getId().equals(member.getId())) {
+            bean = service.getLocalGatewaySenderMXBean(id);
+          } else {
+            ObjectName objectName = service.getGatewaySenderMBeanName(member, id);
+            bean = service.getMBeanProxy(objectName, GatewaySenderMXBean.class);
+          }
+          if (bean != null) {
+            if (bean.isRunning()) {
+              statusList.add(member.getId());
+              statusList.add(CliStrings.GATEWAY_ERROR);
+              statusList.add(CliStrings.format(
+                  CliStrings.GATEWAY_SENDER_0_IS_ALREADY_STARTED_ON_MEMBER_1, id, member.getId()));
+            } else {
+              bean.start();
+              statusList.add(member.getId());
+              statusList.add(CliStrings.GATEWAY_OK);
+              statusList.add(CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_STARTED_ON_MEMBER_1,
+                  id, member.getId()));
+            }
+          } else {
+            statusList.add(member.getId());
+            statusList.add(CliStrings.GATEWAY_ERROR);
+            statusList.add(CliStrings.format(
+                CliStrings.GATEWAY_SENDER_0_IS_NOT_AVAILABLE_ON_MEMBER_1, id, member.getId()));
+          }
+          return statusList;
+
+        });
+      }
+
+      Iterator<DistributedMember> memberIterator = dsMembers.iterator();
+      List<Future<List>> futures = null;
+
+      try {
+        futures = execService.invokeAll(callables);
+      } catch (InterruptedException ite) {
+        GatewayCommandsUtils.accumulateStartResult(resultData, null, CliStrings.GATEWAY_ERROR,
+            CliStrings.format(CliStrings.GATEWAY_SENDER_0_COULD_NOT_BE_INVOKED_DUE_TO_1, id,
+                ite.getMessage()));
+      }
+
+      for (Future<List> future : futures) {
+        DistributedMember member = memberIterator.next();
+        List<String> memberStatus;
+        try {
+          memberStatus = future.get();
+          GatewayCommandsUtils.accumulateStartResult(resultData, memberStatus.get(0),
+              memberStatus.get(1), memberStatus.get(2));
+        } catch (InterruptedException | ExecutionException ite) {
+          GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+              CliStrings.GATEWAY_ERROR,
+              CliStrings.format(CliStrings.GATEWAY_SENDER_0_COULD_NOT_BE_STARTED_ON_MEMBER_DUE_TO_1,
+                  id, ite.getMessage()));
+        }
+      }
+      execService.shutdown();
+      result = ResultBuilder.buildResult(resultData);
+    } catch (Exception e) {
+      LogWrapper.getInstance().warning(CliStrings.GATEWAY_ERROR + CliUtil.stackTraceAsString(e));
+      result = ResultBuilder.createGemFireErrorResult(CliStrings.GATEWAY_ERROR + e.getMessage());
+    }
+    return result;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/e1befef4/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusGatewayReceiverCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusGatewayReceiverCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusGatewayReceiverCommand.java
new file mode 100644
index 0000000..c1fdaaf
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusGatewayReceiverCommand.java
@@ -0,0 +1,112 @@
+/*
+ * 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.Set;
+
+import javax.management.ObjectName;
+
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.management.GatewayReceiverMXBean;
+import org.apache.geode.management.ManagementService;
+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.SystemManagementService;
+import org.apache.geode.management.internal.cli.CliUtil;
+import org.apache.geode.management.internal.cli.LogWrapper;
+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.security.ResourceOperation;
+import org.apache.geode.security.ResourcePermission;
+
+public class StatusGatewayReceiverCommand implements GfshCommand {
+  @CliCommand(value = CliStrings.STATUS_GATEWAYRECEIVER,
+      help = CliStrings.STATUS_GATEWAYRECEIVER__HELP)
+  @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_WAN)
+  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
+      operation = ResourcePermission.Operation.READ)
+  public Result statusGatewayReceiver(@CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
+      optionContext = ConverterHint.MEMBERGROUP,
+      help = CliStrings.STATUS_GATEWAYRECEIVER__GROUP__HELP) String[] onGroup,
+
+      @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
+          optionContext = ConverterHint.MEMBERIDNAME,
+          help = CliStrings.STATUS_GATEWAYRECEIVER__MEMBER__HELP) String[] onMember) {
+
+    Result result;
+
+    try {
+      InternalCache cache = getCache();
+      SystemManagementService service =
+          (SystemManagementService) ManagementService.getExistingManagementService(cache);
+
+      CompositeResultData crd = ResultBuilder.createCompositeResultData();
+      TabularResultData availableReceiverData =
+          crd.addSection(CliStrings.SECTION_GATEWAY_RECEIVER_AVAILABLE)
+              .addTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+
+      TabularResultData notAvailableReceiverData =
+          crd.addSection(CliStrings.SECTION_GATEWAY_RECEIVER_NOT_AVAILABLE)
+              .addTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+
+      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) {
+          GatewayReceiverMXBean receiverBean =
+              service.getMBeanProxy(gatewayReceiverObjectName, GatewayReceiverMXBean.class);
+          if (receiverBean != null) {
+            buildReceiverStatus(member.getId(), receiverBean, availableReceiverData);
+            continue;
+          }
+        }
+        buildReceiverStatus(member.getId(), null, notAvailableReceiverData);
+      }
+      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;
+  }
+
+  private TabularResultData buildReceiverStatus(String memberId, GatewayReceiverMXBean bean,
+      TabularResultData resultData) {
+    resultData.accumulate(CliStrings.RESULT_HOST_MEMBER, memberId);
+    if (bean != null) {
+      resultData.accumulate(CliStrings.RESULT_PORT, bean.getPort());
+      resultData.accumulate(CliStrings.RESULT_STATUS,
+          bean.isRunning() ? CliStrings.GATEWAY_RUNNING : CliStrings.GATEWAY_NOT_RUNNING);
+    } else {
+      resultData.accumulate(CliStrings.GATEWAY_ERROR,
+          CliStrings.GATEWAY_RECEIVER_IS_NOT_AVAILABLE_OR_STOPPED);
+    }
+    return resultData;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/e1befef4/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusGatewaySenderCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusGatewaySenderCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusGatewaySenderCommand.java
new file mode 100644
index 0000000..f694705
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusGatewaySenderCommand.java
@@ -0,0 +1,131 @@
+/*
+ * 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.Set;
+
+import javax.management.ObjectName;
+
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.management.GatewaySenderMXBean;
+import org.apache.geode.management.ManagementService;
+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.SystemManagementService;
+import org.apache.geode.management.internal.cli.CliUtil;
+import org.apache.geode.management.internal.cli.LogWrapper;
+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.security.ResourceOperation;
+import org.apache.geode.security.ResourcePermission;
+
+public class StatusGatewaySenderCommand implements GfshCommand {
+  @CliCommand(value = CliStrings.STATUS_GATEWAYSENDER, help = CliStrings.STATUS_GATEWAYSENDER__HELP)
+  @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_WAN)
+  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
+      operation = ResourcePermission.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.GROUP, CliStrings.GROUPS},
+          optionContext = ConverterHint.MEMBERGROUP,
+          help = CliStrings.STATUS_GATEWAYSENDER__GROUP__HELP) String[] onGroup,
+
+      @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
+          optionContext = ConverterHint.MEMBERIDNAME,
+          help = CliStrings.STATUS_GATEWAYSENDER__MEMBER__HELP) String[] onMember) {
+
+    Result result;
+    if (senderId != null) {
+      senderId = senderId.trim();
+    }
+    try {
+      InternalCache cache = getCache();
+      SystemManagementService service =
+          (SystemManagementService) ManagementService.getExistingManagementService(cache);
+
+      GatewaySenderMXBean bean;
+
+      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;
+  }
+
+  private TabularResultData buildSenderStatus(String memberId, GatewaySenderMXBean bean,
+      TabularResultData resultData) {
+    resultData.accumulate(CliStrings.RESULT_HOST_MEMBER, memberId);
+    if (bean != null) {
+      resultData.accumulate(CliStrings.RESULT_TYPE,
+          bean.isParallel() ? CliStrings.SENDER_PARALLEL : CliStrings.SENDER_SERIAL);
+      if (!bean.isParallel()) {
+        resultData.accumulate(CliStrings.RESULT_POLICY,
+            bean.isPrimary() ? CliStrings.SENDER_PRIMARY : CliStrings.SENDER_SECONADRY);
+      }
+      if (bean.isRunning()) {
+        if (bean.isPaused()) {
+          resultData.accumulate(CliStrings.RESULT_STATUS, CliStrings.SENDER_PAUSED);
+        } else {
+          resultData.accumulate(CliStrings.RESULT_STATUS, CliStrings.GATEWAY_RUNNING);
+        }
+      } else {
+        resultData.accumulate(CliStrings.RESULT_STATUS, CliStrings.GATEWAY_NOT_RUNNING);
+      }
+    } else {
+      resultData.accumulate(CliStrings.GATEWAY_ERROR, CliStrings.GATEWAY_SENDER_IS_NOT_AVAILABLE);
+    }
+
+    return resultData;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/e1befef4/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StopGatewayReceiverCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StopGatewayReceiverCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StopGatewayReceiverCommand.java
new file mode 100644
index 0000000..49b2454
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StopGatewayReceiverCommand.java
@@ -0,0 +1,114 @@
+/*
+ * 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.Set;
+
+import javax.management.ObjectName;
+
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.management.GatewayReceiverMXBean;
+import org.apache.geode.management.ManagementService;
+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.SystemManagementService;
+import org.apache.geode.management.internal.cli.CliUtil;
+import org.apache.geode.management.internal.cli.LogWrapper;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.CommandResultException;
+import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.cli.result.TabularResultData;
+import org.apache.geode.management.internal.security.ResourceOperation;
+import org.apache.geode.security.ResourcePermission;
+
+public class StopGatewayReceiverCommand implements GfshCommand {
+  @CliCommand(value = CliStrings.STOP_GATEWAYRECEIVER, help = CliStrings.STOP_GATEWAYRECEIVER__HELP)
+  @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_WAN)
+  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
+      operation = ResourcePermission.Operation.MANAGE, target = ResourcePermission.Target.GATEWAY)
+  public Result stopGatewayReceiver(@CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
+      optionContext = ConverterHint.MEMBERGROUP,
+      help = CliStrings.STOP_GATEWAYRECEIVER__GROUP__HELP) String[] onGroup,
+
+      @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
+          optionContext = ConverterHint.MEMBERIDNAME,
+          help = CliStrings.STOP_GATEWAYRECEIVER__MEMBER__HELP) String[] onMember) {
+
+    Result result;
+
+    try {
+      InternalCache cache = getCache();
+      SystemManagementService service =
+          (SystemManagementService) ManagementService.getExistingManagementService(cache);
+
+      GatewayReceiverMXBean receiverBean;
+
+      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) {
+          receiverBean =
+              service.getMBeanProxy(gatewayReceiverObjectName, GatewayReceiverMXBean.class);
+          if (receiverBean != null) {
+            if (receiverBean.isRunning()) {
+              receiverBean.stop();
+              GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+                  CliStrings.GATEWAY_OK,
+                  CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_STOPPED_ON_MEMBER_0,
+                      new Object[] {member.getId()}));
+            } else {
+              GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+                  CliStrings.GATEWAY_ERROR,
+                  CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_NOT_RUNNING_ON_MEMBER_0,
+                      new Object[] {member.getId()}));
+            }
+          } else {
+            GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+                CliStrings.GATEWAY_ERROR,
+                CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_NOT_AVAILABLE_ON_MEMBER_0,
+                    new Object[] {member.getId()}));
+          }
+        } else {
+          GatewayCommandsUtils.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 = GatewayCommandsUtils.handleCommandResultException(crex);
+    } catch (Exception e) {
+      LogWrapper.getInstance().warning(CliStrings.GATEWAY_ERROR + CliUtil.stackTraceAsString(e));
+      result = ResultBuilder.createGemFireErrorResult(CliStrings.GATEWAY_ERROR + e.getMessage());
+    }
+    return result;
+  }
+}


Mime
View raw message