changeset 1778:e0322f28f9c5

Add hostIdArg and vmIdArg to Arguments This is a patch that adds HOST_ID_ARGUMENT and VM_ID_ARGUMENT to Arguments. Reviewed-by: omajid Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2015-June/014277.html
author James Aziz <jaziz@redhat.com>
date Mon, 29 Jun 2015 16:35:17 -0400
parents 4f3f8e95473f
children 49b183a11b59
files common/core/src/main/java/com/redhat/thermostat/common/cli/Arguments.java killvm/command/src/main/java/com/redhat/thermostat/killvm/command/KillVMCommand.java vm-heap-analysis/command/src/main/java/com/redhat/thermostat/vm/heap/analysis/command/internal/ListHeapDumpsCommand.java
diffstat 3 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/common/core/src/main/java/com/redhat/thermostat/common/cli/Arguments.java	Mon Jun 29 14:58:01 2015 -0400
+++ b/common/core/src/main/java/com/redhat/thermostat/common/cli/Arguments.java	Mon Jun 29 16:35:17 2015 -0400
@@ -39,6 +39,9 @@
 import java.util.List;
 
 public interface Arguments {
+    static public final String HOST_ID_ARGUMENT = "hostId";
+    static public final String VM_ID_ARGUMENT = "vmId";
+
     List<String> getNonOptionArguments();
     boolean hasArgument(String name);
     String getArgument(String name);
--- a/killvm/command/src/main/java/com/redhat/thermostat/killvm/command/KillVMCommand.java	Mon Jun 29 14:58:01 2015 -0400
+++ b/killvm/command/src/main/java/com/redhat/thermostat/killvm/command/KillVMCommand.java	Mon Jun 29 16:35:17 2015 -0400
@@ -37,6 +37,7 @@
 package com.redhat.thermostat.killvm.command;
 
 import com.redhat.thermostat.common.cli.AbstractCommand;
+import com.redhat.thermostat.common.cli.Arguments;
 import com.redhat.thermostat.common.cli.CommandContext;
 import com.redhat.thermostat.common.cli.CommandException;
 import com.redhat.thermostat.killvm.command.internal.ShellVMKilledListener;
@@ -51,8 +52,6 @@
 
 public class KillVMCommand extends AbstractCommand {
 
-    static final String VM_ID_ARGUMENT = "vmId";
-
     private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
 
     private final ShellVMKilledListener listener;
@@ -74,7 +73,7 @@
         listener.setOut(ctx.getConsole().getOutput());
         listener.setErr(ctx.getConsole().getError());
 
-        String vmId = ctx.getArguments().getArgument(VM_ID_ARGUMENT);
+        String vmId = ctx.getArguments().getArgument(Arguments.VM_ID_ARGUMENT);
         if (vmId == null)
             throw new CommandException(translator.localize(LocaleResources.VMID_REQUIRED));
 
--- a/vm-heap-analysis/command/src/main/java/com/redhat/thermostat/vm/heap/analysis/command/internal/ListHeapDumpsCommand.java	Mon Jun 29 14:58:01 2015 -0400
+++ b/vm-heap-analysis/command/src/main/java/com/redhat/thermostat/vm/heap/analysis/command/internal/ListHeapDumpsCommand.java	Mon Jun 29 16:35:17 2015 -0400
@@ -45,6 +45,7 @@
 import org.osgi.framework.ServiceReference;
 
 import com.redhat.thermostat.common.cli.AbstractCommand;
+import com.redhat.thermostat.common.cli.Arguments;
 import com.redhat.thermostat.common.cli.CommandContext;
 import com.redhat.thermostat.common.cli.CommandException;
 import com.redhat.thermostat.common.cli.TableRenderer;
@@ -60,9 +61,6 @@
 
 public class ListHeapDumpsCommand extends AbstractCommand {
 
-    static final String HOST_ID_ARGUMENT = "hostId";
-    static final String VM_ID_ARGUMENT = "vmId";
-
     private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
 
     private static final String[] COLUMN_NAMES = {
@@ -101,7 +99,7 @@
         requireNonNull(heapDAORef, translator.localize(LocaleResources.HEAP_SERVICE_UNAVAILABLE));
         HeapDAO heapDAO = (HeapDAO) context.getService(heapDAORef);
 
-        String stringVmId = ctx.getArguments().getArgument(VM_ID_ARGUMENT);
+        String stringVmId = ctx.getArguments().getArgument(Arguments.VM_ID_ARGUMENT);
         String stringAgentId = null;
 
         VmId vmId = null;
@@ -113,7 +111,7 @@
 
             stringAgentId = vmInfo.getAgentId();
         } else {
-            stringAgentId = ctx.getArguments().getArgument(HOST_ID_ARGUMENT);
+            stringAgentId = ctx.getArguments().getArgument(Arguments.HOST_ID_ARGUMENT);
         }
 
         if (stringAgentId != null)