geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aba...@apache.org
Subject [4/9] incubator-geode git commit: GEODE-1984: Started writing gfsh command for destroy gateway-sender
Date Fri, 25 Nov 2016 15:17:51 GMT
GEODE-1984: Started writing gfsh command for destroy gateway-sender


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

Branch: refs/heads/feature/GEODE-1984
Commit: 93d4c08e2923474b40b153f7cabfbda0dce20ef8
Parents: 6af49b5
Author: adongre <adongre@apache.org>
Authored: Sat Nov 19 20:56:25 2016 +0530
Committer: adongre <adongre@apache.org>
Committed: Sat Nov 19 20:56:25 2016 +0530

----------------------------------------------------------------------
 .../internal/cli/commands/WanCommands.java      | 66 +++++++++++++++++++-
 .../internal/cli/i18n/CliStrings.java           | 14 +++++
 2 files changed, 79 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/93d4c08e/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/WanCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/WanCommands.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/WanCommands.java
index db1087d..ab5dea2 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/WanCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/WanCommands.java
@@ -189,6 +189,70 @@ public class WanCommands implements CommandMarker {
     return result;
   }
 
+
+  @CliCommand(value = CliStrings.DESTROY_GATEWAYSENDER,
+      help = CliStrings.DESTROY_GATEWAYSENDER__HELP)
+  @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_WAN, writesToSharedConfiguration = true)
+  @ResourceOperation(resource = Resource.DATA, operation = Operation.MANAGE)
+  public Result destroyGatewaySender(
+      @CliOption(key = CliStrings.DESTROY_GATEWAYSENDER__GROUP,
+          optionContext = ConverterHint.MEMBERGROUP,
+          help = CliStrings.DESTROY_GATEWAYSENDER__GROUP__HELP) @CliMetaData(
+              valueSeparator = ",") String[] onGroups,
+      @CliOption(key = CliStrings.DESTROY_GATEWAYSENDER__MEMBER,
+          optionContext = ConverterHint.MEMBERIDNAME,
+          unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
+          help = CliStrings.DESTROY_GATEWAYSENDER__MEMBER__HELP) @CliMetaData(
+              valueSeparator = ",") String onMember,
+      @CliOption(key = CliStrings.DESTROY_GATEWAYSENDER__ID, mandatory = true,
+          help = CliStrings.DESTROY_GATEWAYSENDER__ID__HELP) String id) {
+    Result result = null;
+    // XmlEntity xmlEntity = null;
+    // 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.findAllMatchingMembers(onGroups, onMember == null ? null : onMember.split(","));
+    //
+    // 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 == null) {
+    // xmlEntity = gatewaySenderCreateResult.getXmlEntity();
+    // }
+    // }
+    // result = ResultBuilder.buildResult(tabularResultData);
+    // } catch (IllegalArgumentException e) {
+    // LogWrapper.getInstance().info(e.getMessage());
+    // result = ResultBuilder.createUserErrorResult(e.getMessage());
+    // } catch (CommandResultException crex) {
+    // result = handleCommandResultException(crex);
+    // }
+    //
+    // if (xmlEntity != null) {
+    // result
+    // .setCommandPersisted((new SharedConfigurationWriter()).addXmlEntity(xmlEntity, onGroups));
+    // }
+    return result;
+  }
+
+
   @CliCommand(value = CliStrings.START_GATEWAYSENDER, help = CliStrings.START_GATEWAYSENDER__HELP)
   @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_WAN)
   @ResourceOperation(resource = Resource.DATA, operation = Operation.MANAGE)
@@ -1179,7 +1243,7 @@ public class WanCommands implements CommandMarker {
       CliStrings.STOP_GATEWAYSENDER, CliStrings.CREATE_GATEWAYRECEIVER,
       CliStrings.START_GATEWAYRECEIVER, CliStrings.STOP_GATEWAYRECEIVER, CliStrings.LIST_GATEWAY,
       CliStrings.STATUS_GATEWAYSENDER, CliStrings.STATUS_GATEWAYRECEIVER,
-      CliStrings.LOAD_BALANCE_GATEWAYSENDER})
+      CliStrings.LOAD_BALANCE_GATEWAYSENDER, CliStrings.DESTROY_GATEWAYSENDER})
   public boolean isWanCommandsAvailable() {
     boolean isAvailable = true; // always available on server
     if (CliUtil.isGfshVM()) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/93d4c08e/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
index 9aaef4d..8321a7f 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
@@ -2229,6 +2229,20 @@ public class CliStrings {
   public static final String START_GATEWAYSENDER__MEMBER__HELP =
       "Name/Id of the member on which to start the Gateway Sender.";
 
+  /* destroy gateway-sender */
+  public static final String DESTROY_GATEWAYSENDER = "destroy gateway-sender";
+  public static final String DESTROY_GATEWAYSENDER__HELP =
+      "Destroy the Gateway Sender on a member or members.";
+  public static final String DESTROY_GATEWAYSENDER__GROUP = "group";
+  public static final String DESTROY_GATEWAYSENDER__GROUP__HELP =
+      "Group(s) of members on which to destroy the Gateway Sender.";
+  public static final String DESTROY_GATEWAYSENDER__MEMBER = "member";
+  public static final String DESTROY_GATEWAYSENDER__MEMBER__HELP =
+      "Name/Id of the member on which to destroy the Gateway Sender.";
+  public static final String DESTROY_GATEWAYSENDER__ID = "id";
+  public static final String DESTROY_GATEWAYSENDER__ID__HELP = "Id of the GatewaySender.";
+
+
   /* start gfmon command */
   public static final String START_PULSE = "start pulse";
   public static final String START_PULSE__ERROR =


Mime
View raw message