From ae0988776345f12d9ba3db3687a341e4123e28d9 Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata@redhat.com>
Date: Fri, 11 Oct 2013 11:41:53 -0400
Subject: [PATCH] Renamed client commands.

The client-{action}-cert commands have been renamed into
client-cert-{action} for consistency.
---
 .../java-tools/src/com/netscape/cmstools/client/ClientCLI.java |  6 +++---
 .../client/{ClientFindCertCLI.java => ClientCertFindCLI.java}  | 10 +++++-----
 .../{ClientImportCertCLI.java => ClientCertImportCLI.java}     | 10 +++++-----
 .../{ClientRemoveCertCLI.java => ClientCertRemoveCLI.java}     |  8 ++++----
 4 files changed, 17 insertions(+), 17 deletions(-)
 rename base/java-tools/src/com/netscape/cmstools/client/{ClientFindCertCLI.java => ClientCertFindCLI.java} (92%)
 rename base/java-tools/src/com/netscape/cmstools/client/{ClientImportCertCLI.java => ClientCertImportCLI.java} (94%)
 rename base/java-tools/src/com/netscape/cmstools/client/{ClientRemoveCertCLI.java => ClientCertRemoveCLI.java} (89%)

diff --git a/base/java-tools/src/com/netscape/cmstools/client/ClientCLI.java b/base/java-tools/src/com/netscape/cmstools/client/ClientCLI.java
index c22786150316dc5b01e5c2a3a6a94a0984293fd0..fe0d001ac9bccd5e7e30ff967eec30b20af6acb0 100644
--- a/base/java-tools/src/com/netscape/cmstools/client/ClientCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/client/ClientCLI.java
@@ -32,9 +32,9 @@ public class ClientCLI extends CLI {
     public ClientCLI(CLI parent) {
         super("client", "Client management commands", parent);
 
-        addModule(new ClientFindCertCLI(this));
-        addModule(new ClientImportCertCLI(this));
-        addModule(new ClientRemoveCertCLI(this));
+        addModule(new ClientCertFindCLI(this));
+        addModule(new ClientCertImportCLI(this));
+        addModule(new ClientCertRemoveCLI(this));
     }
 
     public String getFullName() {
diff --git a/base/java-tools/src/com/netscape/cmstools/client/ClientFindCertCLI.java b/base/java-tools/src/com/netscape/cmstools/client/ClientCertFindCLI.java
similarity index 92%
rename from base/java-tools/src/com/netscape/cmstools/client/ClientFindCertCLI.java
rename to base/java-tools/src/com/netscape/cmstools/client/ClientCertFindCLI.java
index f4057c67a66c0d5c2266fb35223db3623d5e2a18..874a897a5e49739aa63eb251bec91e7c2a84dee3 100644
--- a/base/java-tools/src/com/netscape/cmstools/client/ClientFindCertCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/client/ClientCertFindCLI.java
@@ -27,12 +27,12 @@ import com.netscape.cmstools.cli.MainCLI;
 /**
  * @author Endi S. Dewata
  */
-public class ClientFindCertCLI extends CLI {
+public class ClientCertFindCLI extends CLI {
 
     public ClientCLI clientCLI;
 
-    public ClientFindCertCLI(ClientCLI clientCLI) {
-        super("find-cert", "Find certificates in client security database", clientCLI);
+    public ClientCertFindCLI(ClientCLI clientCLI) {
+        super("cert-find", "Find certificates in client security database", clientCLI);
         this.clientCLI = clientCLI;
     }
 
@@ -42,8 +42,6 @@ public class ClientFindCertCLI extends CLI {
 
     public void execute(String[] args) throws Exception {
 
-        client = clientCLI.getClient();
-
         options.addOption(null, "ca", false, "Find CA certificates only");
 
         CommandLine cmd = null;
@@ -56,6 +54,8 @@ public class ClientFindCertCLI extends CLI {
             System.exit(1);
         }
 
+        client = parent.getClient();
+
         X509Certificate[] certs;
         if (cmd.hasOption("ca")) {
             certs = client.getCACerts();
diff --git a/base/java-tools/src/com/netscape/cmstools/client/ClientImportCertCLI.java b/base/java-tools/src/com/netscape/cmstools/client/ClientCertImportCLI.java
similarity index 94%
rename from base/java-tools/src/com/netscape/cmstools/client/ClientImportCertCLI.java
rename to base/java-tools/src/com/netscape/cmstools/client/ClientCertImportCLI.java
index cbd55079a9b5fa194b7257f567be032976007d8b..1ced6727f5fc42b2cc3efd7d6a6c9798344ea9f2 100644
--- a/base/java-tools/src/com/netscape/cmstools/client/ClientImportCertCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/client/ClientCertImportCLI.java
@@ -32,12 +32,12 @@ import com.netscape.cmstools.cli.MainCLI;
 /**
  * @author Endi S. Dewata
  */
-public class ClientImportCertCLI extends CLI {
+public class ClientCertImportCLI extends CLI {
 
     public ClientCLI clientCLI;
 
-    public ClientImportCertCLI(ClientCLI clientCLI) {
-        super("import-cert", "Import certificate into client security database", clientCLI);
+    public ClientCertImportCLI(ClientCLI clientCLI) {
+        super("cert-import", "Import certificate into client security database", clientCLI);
         this.clientCLI = clientCLI;
     }
 
@@ -47,8 +47,6 @@ public class ClientImportCertCLI extends CLI {
 
     public void execute(String[] args) throws Exception {
 
-        client = clientCLI.getClient();
-
         Option option = new Option(null, "cert", true, "Import certificate file");
         option.setArgName("path");
         options.addOption(option);
@@ -70,6 +68,8 @@ public class ClientImportCertCLI extends CLI {
             System.exit(1);
         }
 
+        client = parent.getClient();
+
         byte[] bytes = null;
         X509Certificate cert = null;
 
diff --git a/base/java-tools/src/com/netscape/cmstools/client/ClientRemoveCertCLI.java b/base/java-tools/src/com/netscape/cmstools/client/ClientCertRemoveCLI.java
similarity index 89%
rename from base/java-tools/src/com/netscape/cmstools/client/ClientRemoveCertCLI.java
rename to base/java-tools/src/com/netscape/cmstools/client/ClientCertRemoveCLI.java
index be4456115f05df7947803893438132e81d1dcf94..7549647beaaebb2f924fb6b5c2be941b35d4e9b8 100644
--- a/base/java-tools/src/com/netscape/cmstools/client/ClientRemoveCertCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/client/ClientCertRemoveCLI.java
@@ -26,12 +26,12 @@ import com.netscape.cmstools.cli.MainCLI;
 /**
  * @author Endi S. Dewata
  */
-public class ClientRemoveCertCLI extends CLI {
+public class ClientCertRemoveCLI extends CLI {
 
     public ClientCLI clientCLI;
 
-    public ClientRemoveCertCLI(ClientCLI clientCLI) {
-        super("remove-cert", "Remove certificate from client security database", clientCLI);
+    public ClientCertRemoveCLI(ClientCLI clientCLI) {
+        super("cert-remove", "Remove certificate from client security database", clientCLI);
         this.clientCLI = clientCLI;
     }
 
@@ -58,7 +58,7 @@ public class ClientRemoveCertCLI extends CLI {
             System.exit(1);
         }
 
-        client = clientCLI.getClient();
+        client = parent.getClient();
 
         String nickname = cmdArgs[0];
         client.removeCert(nickname);
-- 
1.8.1.4

