From 9891f9a6b30bc567115c9642cdebfbe792c1499e Mon Sep 17 00:00:00 2001
From: Endi Sukma Dewata <edewata@redhat.com>
Date: Sat, 11 Aug 2012 05:34:59 -0500
Subject: [PATCH] Reorganized REST client classes.

The REST client classes have been moved into the
com.netscape.cms.client.<component> packages.

Ticket #215
---
 base/ca/functional/src/com/netscape/cms/servlet/test/CATest.java    | 3 ++-
 .../src/com/netscape/cms/servlet/test/ConfigurationTest.java        | 6 +++---
 base/common/src/com/netscape/cms/client/{cli => }/ClientConfig.java | 2 +-
 .../src/com/netscape/cms/{servlet/csadmin => client}/PKIClient.java | 3 +--
 .../cms/{servlet/csadmin => client}/PKIErrorInterceptor.java        | 2 +-
 .../test => common/src/com/netscape/cms/client/ca}/CAClient.java    | 6 +++---
 base/common/src/com/netscape/cms/client/cert/CertClient.java        | 4 ++--
 base/common/src/com/netscape/cms/client/cli/MainCLI.java            | 1 +
 base/common/src/com/netscape/cms/client/group/GroupClient.java      | 4 ++--
 .../test => common/src/com/netscape/cms/client/kra}/DRMClient.java  | 6 +++---
 .../cms/{servlet/csadmin => client/system}/SystemConfigClient.java  | 6 ++++--
 base/common/src/com/netscape/cms/client/user/UserClient.java        | 4 ++--
 .../src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java    | 3 ++-
 base/deploy/src/scriptlets/configuration.jy                         | 2 +-
 base/deploy/src/scriptlets/pkijython.py                             | 2 +-
 base/kra/functional/src/com/netscape/cms/servlet/test/DRMTest.java  | 3 ++-
 16 files changed, 31 insertions(+), 26 deletions(-)
 rename base/common/src/com/netscape/cms/client/{cli => }/ClientConfig.java (99%)
 rename base/common/src/com/netscape/cms/{servlet/csadmin => client}/PKIClient.java (99%)
 rename base/common/src/com/netscape/cms/{servlet/csadmin => client}/PKIErrorInterceptor.java (98%)
 rename base/{ca/functional/src/com/netscape/cms/servlet/test => common/src/com/netscape/cms/client/ca}/CAClient.java (96%)
 rename base/{kra/functional/src/com/netscape/cms/servlet/test => common/src/com/netscape/cms/client/kra}/DRMClient.java (97%)
 rename base/common/src/com/netscape/cms/{servlet/csadmin => client/system}/SystemConfigClient.java (89%)

diff --git a/base/ca/functional/src/com/netscape/cms/servlet/test/CATest.java b/base/ca/functional/src/com/netscape/cms/servlet/test/CATest.java
index 8e67f5d5f74827bb27c2debd61d11082b87d9c1b..a230b468a92a671da4a4481c4ddb328af883d382 100644
--- a/base/ca/functional/src/com/netscape/cms/servlet/test/CATest.java
+++ b/base/ca/functional/src/com/netscape/cms/servlet/test/CATest.java
@@ -35,7 +35,8 @@ import org.mozilla.jss.util.Password;
 
 import com.netscape.certsrv.dbs.certdb.CertId;
 import com.netscape.certsrv.request.RequestId;
-import com.netscape.cms.client.cli.ClientConfig;
+import com.netscape.cms.client.ClientConfig;
+import com.netscape.cms.client.ca.CAClient;
 import com.netscape.cms.servlet.cert.CertNotFoundException;
 import com.netscape.cms.servlet.cert.model.CertDataInfo;
 import com.netscape.cms.servlet.cert.model.CertDataInfos;
diff --git a/base/common/functional/src/com/netscape/cms/servlet/test/ConfigurationTest.java b/base/common/functional/src/com/netscape/cms/servlet/test/ConfigurationTest.java
index fd951d9f8f17c4dac818c1952c6628da722036c2..f9fa62d0a6b6df1d86d4dfea5d544b6ca0e7b9bd 100644
--- a/base/common/functional/src/com/netscape/cms/servlet/test/ConfigurationTest.java
+++ b/base/common/functional/src/com/netscape/cms/servlet/test/ConfigurationTest.java
@@ -56,11 +56,11 @@ import org.mozilla.jss.pkix.primitive.Name;
 import org.mozilla.jss.pkix.primitive.SubjectPublicKeyInfo;
 import org.mozilla.jss.util.Password;
 
-import com.netscape.cms.client.cli.ClientConfig;
-import com.netscape.cms.servlet.csadmin.SystemConfigClient;
-import com.netscape.cms.servlet.csadmin.model.SystemCertData;
+import com.netscape.cms.client.ClientConfig;
+import com.netscape.cms.client.system.SystemConfigClient;
 import com.netscape.cms.servlet.csadmin.model.ConfigurationRequest;
 import com.netscape.cms.servlet.csadmin.model.ConfigurationResponse;
+import com.netscape.cms.servlet.csadmin.model.SystemCertData;
 import com.netscape.cmsutil.util.Utils;
 
 /**
diff --git a/base/common/src/com/netscape/cms/client/cli/ClientConfig.java b/base/common/src/com/netscape/cms/client/ClientConfig.java
similarity index 99%
rename from base/common/src/com/netscape/cms/client/cli/ClientConfig.java
rename to base/common/src/com/netscape/cms/client/ClientConfig.java
index 8b53808055b4a08da49af9884aa1d98c4583b98e..7299d4d22e7392199f89fdb81b10f53768120e0a 100644
--- a/base/common/src/com/netscape/cms/client/cli/ClientConfig.java
+++ b/base/common/src/com/netscape/cms/client/ClientConfig.java
@@ -16,7 +16,7 @@
 // All rights reserved.
 // --- END COPYRIGHT BLOCK ---
 
-package com.netscape.cms.client.cli;
+package com.netscape.cms.client;
 
 import java.io.StringReader;
 import java.io.StringWriter;
diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/PKIClient.java b/base/common/src/com/netscape/cms/client/PKIClient.java
similarity index 99%
rename from base/common/src/com/netscape/cms/servlet/csadmin/PKIClient.java
rename to base/common/src/com/netscape/cms/client/PKIClient.java
index 647056bd141b3e0961bcc81fa05ce2ebbadc9bc4..ddd47dab624c7ca6e064a3644a573b95d216de69 100644
--- a/base/common/src/com/netscape/cms/servlet/csadmin/PKIClient.java
+++ b/base/common/src/com/netscape/cms/client/PKIClient.java
@@ -1,4 +1,4 @@
-package com.netscape.cms.servlet.csadmin;
+package com.netscape.cms.client;
 
 import java.io.File;
 import java.io.IOException;
@@ -50,7 +50,6 @@ import org.mozilla.jss.crypto.AlreadyInitializedException;
 import org.mozilla.jss.ssl.SSLCertificateApprovalCallback;
 import org.mozilla.jss.ssl.SSLSocket;
 
-import com.netscape.cms.client.cli.ClientConfig;
 
 public abstract class PKIClient {
 
diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/PKIErrorInterceptor.java b/base/common/src/com/netscape/cms/client/PKIErrorInterceptor.java
similarity index 98%
rename from base/common/src/com/netscape/cms/servlet/csadmin/PKIErrorInterceptor.java
rename to base/common/src/com/netscape/cms/client/PKIErrorInterceptor.java
index 795c0fda3350e357ab73aa4447e85e31e4fa7865..2c1936a6f4c8bf1aedf134b3bec556ac27327628 100644
--- a/base/common/src/com/netscape/cms/servlet/csadmin/PKIErrorInterceptor.java
+++ b/base/common/src/com/netscape/cms/client/PKIErrorInterceptor.java
@@ -15,7 +15,7 @@
 // (C) 2007 Red Hat, Inc.
 // All rights reserved.
 // --- END COPYRIGHT BLOCK ---
-package com.netscape.cms.servlet.csadmin;
+package com.netscape.cms.client;
 
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
diff --git a/base/ca/functional/src/com/netscape/cms/servlet/test/CAClient.java b/base/common/src/com/netscape/cms/client/ca/CAClient.java
similarity index 96%
rename from base/ca/functional/src/com/netscape/cms/servlet/test/CAClient.java
rename to base/common/src/com/netscape/cms/client/ca/CAClient.java
index 24c53b13726f4cc3503af7dfc7d307c7a84a425d..17d017cce91ff3c03095df387d1280e872a9251b 100644
--- a/base/ca/functional/src/com/netscape/cms/servlet/test/CAClient.java
+++ b/base/common/src/com/netscape/cms/client/ca/CAClient.java
@@ -15,19 +15,19 @@
 //(C) 2012 Red Hat, Inc.
 //All rights reserved.
 //--- END COPYRIGHT BLOCK ---
-package com.netscape.cms.servlet.test;
+package com.netscape.cms.client.ca;
 
 import java.net.URISyntaxException;
 import java.util.Collection;
 
 import com.netscape.certsrv.dbs.certdb.CertId;
 import com.netscape.certsrv.request.RequestId;
-import com.netscape.cms.client.cli.ClientConfig;
+import com.netscape.cms.client.ClientConfig;
+import com.netscape.cms.client.PKIClient;
 import com.netscape.cms.servlet.cert.CertResource;
 import com.netscape.cms.servlet.cert.model.CertDataInfos;
 import com.netscape.cms.servlet.cert.model.CertSearchRequest;
 import com.netscape.cms.servlet.cert.model.CertData;
-import com.netscape.cms.servlet.csadmin.PKIClient;
 import com.netscape.cms.servlet.profile.ProfileResource;
 import com.netscape.cms.servlet.profile.model.ProfileData;
 import com.netscape.cms.servlet.profile.model.ProfileDataInfos;
diff --git a/base/common/src/com/netscape/cms/client/cert/CertClient.java b/base/common/src/com/netscape/cms/client/cert/CertClient.java
index fb2f61c751926770f79e69299c442f213c485da6..254e8a143d9a4eb5fa28fd5d63f4d6e0825d99e3 100644
--- a/base/common/src/com/netscape/cms/client/cert/CertClient.java
+++ b/base/common/src/com/netscape/cms/client/cert/CertClient.java
@@ -21,14 +21,14 @@ import java.net.URISyntaxException;
 
 import com.netscape.certsrv.dbs.certdb.CertId;
 import com.netscape.certsrv.request.RequestId;
-import com.netscape.cms.client.cli.ClientConfig;
+import com.netscape.cms.client.ClientConfig;
+import com.netscape.cms.client.PKIClient;
 import com.netscape.cms.servlet.cert.CertResource;
 import com.netscape.cms.servlet.cert.model.CertDataInfos;
 import com.netscape.cms.servlet.cert.model.CertRevokeRequest;
 import com.netscape.cms.servlet.cert.model.CertSearchRequest;
 import com.netscape.cms.servlet.cert.model.CertUnrevokeRequest;
 import com.netscape.cms.servlet.cert.model.CertData;
-import com.netscape.cms.servlet.csadmin.PKIClient;
 import com.netscape.cms.servlet.request.CertRequestResource;
 import com.netscape.cms.servlet.request.model.CertReviewResponse;
 import com.netscape.cms.servlet.request.model.CertRequestInfo;
diff --git a/base/common/src/com/netscape/cms/client/cli/MainCLI.java b/base/common/src/com/netscape/cms/client/cli/MainCLI.java
index 50c90d8928c3bb95fb45389e286ad1427a8ca955..2398a38377b966ef7b12a1b3118d24b4e6868d2b 100644
--- a/base/common/src/com/netscape/cms/client/cli/MainCLI.java
+++ b/base/common/src/com/netscape/cms/client/cli/MainCLI.java
@@ -30,6 +30,7 @@ import org.mozilla.jss.crypto.CryptoToken;
 import org.mozilla.jss.util.IncorrectPasswordException;
 import org.mozilla.jss.util.Password;
 
+import com.netscape.cms.client.ClientConfig;
 import com.netscape.cms.client.cert.CertCLI;
 import com.netscape.cms.client.group.GroupCLI;
 import com.netscape.cms.client.user.UserCLI;
diff --git a/base/common/src/com/netscape/cms/client/group/GroupClient.java b/base/common/src/com/netscape/cms/client/group/GroupClient.java
index 410c1ad3db7bebdab937a89613b0e2cd74097d86..b3784ef46e087fdec548a4efad2e5da5d7ee3f86 100644
--- a/base/common/src/com/netscape/cms/client/group/GroupClient.java
+++ b/base/common/src/com/netscape/cms/client/group/GroupClient.java
@@ -27,8 +27,8 @@ import com.netscape.certsrv.group.GroupMemberCollection;
 import com.netscape.certsrv.group.GroupMemberData;
 import com.netscape.certsrv.group.GroupMemberResource;
 import com.netscape.certsrv.group.GroupResource;
-import com.netscape.cms.client.cli.ClientConfig;
-import com.netscape.cms.servlet.csadmin.PKIClient;
+import com.netscape.cms.client.ClientConfig;
+import com.netscape.cms.client.PKIClient;
 
 /**
  * @author Endi S. Dewata
diff --git a/base/kra/functional/src/com/netscape/cms/servlet/test/DRMClient.java b/base/common/src/com/netscape/cms/client/kra/DRMClient.java
similarity index 97%
rename from base/kra/functional/src/com/netscape/cms/servlet/test/DRMClient.java
rename to base/common/src/com/netscape/cms/client/kra/DRMClient.java
index dfb34ed137b9946ca5e8c00c3e9aa32d8f33c886..2332eacb2cd6bfd5e6ed8896c185cb14c0f8f158 100644
--- a/base/kra/functional/src/com/netscape/cms/servlet/test/DRMClient.java
+++ b/base/common/src/com/netscape/cms/client/kra/DRMClient.java
@@ -1,4 +1,4 @@
-package com.netscape.cms.servlet.test;
+package com.netscape.cms.client.kra;
 
 import java.net.URISyntaxException;
 import java.util.Collection;
@@ -8,10 +8,10 @@ import org.jboss.resteasy.client.ClientResponse;
 
 import com.netscape.certsrv.dbs.keydb.KeyId;
 import com.netscape.certsrv.request.RequestId;
-import com.netscape.cms.client.cli.ClientConfig;
+import com.netscape.cms.client.ClientConfig;
+import com.netscape.cms.client.PKIClient;
 import com.netscape.cms.servlet.admin.SystemCertificateResource;
 import com.netscape.cms.servlet.cert.model.CertData;
-import com.netscape.cms.servlet.csadmin.PKIClient;
 import com.netscape.cms.servlet.key.KeyResource;
 import com.netscape.cms.servlet.key.model.KeyData;
 import com.netscape.cms.servlet.key.model.KeyDataInfo;
diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigClient.java b/base/common/src/com/netscape/cms/client/system/SystemConfigClient.java
similarity index 89%
rename from base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigClient.java
rename to base/common/src/com/netscape/cms/client/system/SystemConfigClient.java
index 11815a65bbccbfbe6e8f4e38d4d82b16b0c5f297..c01558ed3720077fe5144f7a7b47e467168390e0 100644
--- a/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigClient.java
+++ b/base/common/src/com/netscape/cms/client/system/SystemConfigClient.java
@@ -15,11 +15,13 @@
 // (C) 2012 Red Hat, Inc.
 // All rights reserved.
 // --- END COPYRIGHT BLOCK ---
-package com.netscape.cms.servlet.csadmin;
+package com.netscape.cms.client.system;
 
 import java.net.URISyntaxException;
 
-import com.netscape.cms.client.cli.ClientConfig;
+import com.netscape.cms.client.ClientConfig;
+import com.netscape.cms.client.PKIClient;
+import com.netscape.cms.servlet.csadmin.SystemConfigResource;
 import com.netscape.cms.servlet.csadmin.model.ConfigurationRequest;
 import com.netscape.cms.servlet.csadmin.model.ConfigurationResponse;
 import com.netscape.cms.servlet.csadmin.model.InstallToken;
diff --git a/base/common/src/com/netscape/cms/client/user/UserClient.java b/base/common/src/com/netscape/cms/client/user/UserClient.java
index ea2991ac85da519e7606c4d974c0370c5e255d65..010468e8ad781975392fec4912c4fd8f413e9a69 100644
--- a/base/common/src/com/netscape/cms/client/user/UserClient.java
+++ b/base/common/src/com/netscape/cms/client/user/UserClient.java
@@ -27,8 +27,8 @@ import com.netscape.certsrv.user.UserCertResource;
 import com.netscape.certsrv.user.UserCollection;
 import com.netscape.certsrv.user.UserData;
 import com.netscape.certsrv.user.UserResource;
-import com.netscape.cms.client.cli.ClientConfig;
-import com.netscape.cms.servlet.csadmin.PKIClient;
+import com.netscape.cms.client.ClientConfig;
+import com.netscape.cms.client.PKIClient;
 
 /**
  * @author Endi S. Dewata
diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java b/base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java
index be66f5cf7f7fde7ea6c13cfc14bd97457f199c8b..4c9caf5c10e7aa487c1272dbae6ee19d14727d44 100644
--- a/base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java
+++ b/base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java
@@ -143,7 +143,8 @@ import com.netscape.certsrv.ocsp.IOCSPAuthority;
 import com.netscape.certsrv.usrgrp.IGroup;
 import com.netscape.certsrv.usrgrp.IUGSubsystem;
 import com.netscape.certsrv.usrgrp.IUser;
-import com.netscape.cms.client.cli.ClientConfig;
+import com.netscape.cms.client.ClientConfig;
+import com.netscape.cms.client.system.SystemConfigClient;
 import com.netscape.cms.servlet.csadmin.model.InstallToken;
 import com.netscape.cms.servlet.csadmin.model.InstallTokenRequest;
 import com.netscape.cmsutil.crypto.CryptoUtil;
diff --git a/base/deploy/src/scriptlets/configuration.jy b/base/deploy/src/scriptlets/configuration.jy
index 290a2cc6513639371f5097466bff3deaee9f4619..7433ae4631577365ef73fbb4f6062c62efd2f66d 100644
--- a/base/deploy/src/scriptlets/configuration.jy
+++ b/base/deploy/src/scriptlets/configuration.jy
@@ -17,7 +17,7 @@ from java.lang import System as javasystem
 
 
 # PKI Java Imports
-from com.netscape.cms.client.cli import ClientConfig
+from com.netscape.cms.client import ClientConfig
 
 
 def main(argv):
diff --git a/base/deploy/src/scriptlets/pkijython.py b/base/deploy/src/scriptlets/pkijython.py
index 18fabf9be0bf2225808c9c789e7043e2c4cc18b5..d2e7889ff1d04aea162365bd6ff4c9b5c9e1420b 100644
--- a/base/deploy/src/scriptlets/pkijython.py
+++ b/base/deploy/src/scriptlets/pkijython.py
@@ -140,7 +140,7 @@ from org.mozilla.jss.util import Password
 
 
 # PKI Java Imports
-from com.netscape.cms.servlet.csadmin import SystemConfigClient
+from com.netscape.cms.client.system import SystemConfigClient
 from com.netscape.cms.servlet.csadmin.model import SystemCertData
 from com.netscape.cms.servlet.csadmin.model import ConfigurationRequest
 from com.netscape.cms.servlet.csadmin.model import ConfigurationResponse
diff --git a/base/kra/functional/src/com/netscape/cms/servlet/test/DRMTest.java b/base/kra/functional/src/com/netscape/cms/servlet/test/DRMTest.java
index 3ccde1cd2816198df63f23bdbdf391f091486286..5a2013a6081cf196762a72d49ea35e833fd0c62e 100644
--- a/base/kra/functional/src/com/netscape/cms/servlet/test/DRMTest.java
+++ b/base/kra/functional/src/com/netscape/cms/servlet/test/DRMTest.java
@@ -39,7 +39,8 @@ import org.mozilla.jss.util.Password;
 
 import com.netscape.certsrv.dbs.keydb.KeyId;
 import com.netscape.certsrv.request.RequestId;
-import com.netscape.cms.client.cli.ClientConfig;
+import com.netscape.cms.client.ClientConfig;
+import com.netscape.cms.client.kra.DRMClient;
 import com.netscape.cms.servlet.base.PKIService;
 import com.netscape.cms.servlet.key.model.KeyData;
 import com.netscape.cms.servlet.key.model.KeyDataInfo;
-- 
1.7.11.2

