summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/cms/servlet/csadmin
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2012-08-11 08:37:52 -0500
committerEndi Sukma Dewata <edewata@redhat.com>2012-08-15 12:07:26 -0500
commitf554dc2aa0478aa23f7e986b6779091f7d520bf5 (patch)
tree415cbb56096e0f5d1b0383acfbf30917317f9680 /base/common/src/com/netscape/cms/servlet/csadmin
parentd41848a5881db3d12f65e078b945829f1fe296a5 (diff)
downloadpki-f554dc2aa0478aa23f7e986b6779091f7d520bf5.tar.gz
pki-f554dc2aa0478aa23f7e986b6779091f7d520bf5.tar.xz
pki-f554dc2aa0478aa23f7e986b6779091f7d520bf5.zip
Cleaned up REST common class names.
The REST common classes have been renamed for better clarity and consistency. Ticket #259
Diffstat (limited to 'base/common/src/com/netscape/cms/servlet/csadmin')
-rw-r--r--base/common/src/com/netscape/cms/servlet/csadmin/PKIErrorInterceptor.java8
-rw-r--r--base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigClient.java10
-rw-r--r--base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigResource.java (renamed from base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigurationResource.java)10
-rw-r--r--base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigService.java186
-rw-r--r--base/common/src/com/netscape/cms/servlet/csadmin/model/ConfigurationRequest.java (renamed from base/common/src/com/netscape/cms/servlet/csadmin/model/ConfigurationData.java)14
-rw-r--r--base/common/src/com/netscape/cms/servlet/csadmin/model/ConfigurationResponse.java (renamed from base/common/src/com/netscape/cms/servlet/csadmin/model/ConfigurationResponseData.java)39
-rw-r--r--base/common/src/com/netscape/cms/servlet/csadmin/model/SystemCertData.java (renamed from base/common/src/com/netscape/cms/servlet/csadmin/model/CertData.java)44
7 files changed, 156 insertions, 155 deletions
diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/PKIErrorInterceptor.java b/base/common/src/com/netscape/cms/servlet/csadmin/PKIErrorInterceptor.java
index 166c02eb9..795c0fda3 100644
--- a/base/common/src/com/netscape/cms/servlet/csadmin/PKIErrorInterceptor.java
+++ b/base/common/src/com/netscape/cms/servlet/csadmin/PKIErrorInterceptor.java
@@ -23,7 +23,7 @@ import javax.ws.rs.core.MultivaluedMap;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.client.core.ClientErrorInterceptor;
-import com.netscape.cms.servlet.base.CMSException;
+import com.netscape.cms.servlet.base.PKIException;
public class PKIErrorInterceptor implements ClientErrorInterceptor {
@@ -41,15 +41,15 @@ public class PKIErrorInterceptor implements ClientErrorInterceptor {
if (contentType == null || !contentType.startsWith(MediaType.APPLICATION_XML))
return;
- CMSException exception;
+ PKIException exception;
try {
// Requires RESTEasy 2.3.2
// https://issues.jboss.org/browse/RESTEASY-652
- CMSException.Data data = response.getEntity(CMSException.Data.class);
+ PKIException.Data data = response.getEntity(PKIException.Data.class);
Class<?> clazz = Class.forName(data.className);
- exception = (CMSException) clazz.getConstructor(CMSException.Data.class).newInstance(data);
+ exception = (PKIException) clazz.getConstructor(PKIException.Data.class).newInstance(data);
} catch (Exception e) {
e.printStackTrace();
diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigClient.java b/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigClient.java
index 6167b0521..11815a65b 100644
--- a/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigClient.java
+++ b/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigClient.java
@@ -20,8 +20,8 @@ package com.netscape.cms.servlet.csadmin;
import java.net.URISyntaxException;
import com.netscape.cms.client.cli.ClientConfig;
-import com.netscape.cms.servlet.csadmin.model.ConfigurationData;
-import com.netscape.cms.servlet.csadmin.model.ConfigurationResponseData;
+import com.netscape.cms.servlet.csadmin.model.ConfigurationRequest;
+import com.netscape.cms.servlet.csadmin.model.ConfigurationResponse;
import com.netscape.cms.servlet.csadmin.model.InstallToken;
import com.netscape.cms.servlet.csadmin.model.InstallTokenRequest;
@@ -32,15 +32,15 @@ import com.netscape.cms.servlet.csadmin.model.InstallTokenRequest;
*/
public class SystemConfigClient extends PKIClient {
- private SystemConfigurationResource configClient;
+ private SystemConfigResource configClient;
public SystemConfigClient(ClientConfig config) throws URISyntaxException {
super(config);
- configClient = createProxy(SystemConfigurationResource.class);
+ configClient = createProxy(SystemConfigResource.class);
}
- public ConfigurationResponseData configure(ConfigurationData data) {
+ public ConfigurationResponse configure(ConfigurationRequest data) {
return configClient.configure(data);
}
diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigurationResource.java b/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigResource.java
index 2918842c9..9cb6791e3 100644
--- a/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigurationResource.java
+++ b/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigResource.java
@@ -25,8 +25,8 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
-import com.netscape.cms.servlet.csadmin.model.ConfigurationData;
-import com.netscape.cms.servlet.csadmin.model.ConfigurationResponseData;
+import com.netscape.cms.servlet.csadmin.model.ConfigurationRequest;
+import com.netscape.cms.servlet.csadmin.model.ConfigurationResponse;
import com.netscape.cms.servlet.csadmin.model.DomainInfo;
import com.netscape.cms.servlet.csadmin.model.InstallToken;
import com.netscape.cms.servlet.csadmin.model.InstallTokenRequest;
@@ -35,19 +35,19 @@ import com.netscape.cms.servlet.csadmin.model.InstallTokenRequest;
* @author alee
*/
@Path("installer")
-public interface SystemConfigurationResource {
+public interface SystemConfigResource {
@POST
@Path("configure")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
- public ConfigurationResponseData configure(MultivaluedMap<String, String> form);
+ public ConfigurationResponse configure(MultivaluedMap<String, String> form);
@POST
@Path("configure")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public ConfigurationResponseData configure(ConfigurationData data);
+ public ConfigurationResponse configure(ConfigurationRequest data);
@POST
@Path("installToken")
diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigService.java b/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigService.java
index cee8e86e3..b17cf1752 100644
--- a/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigService.java
+++ b/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigService.java
@@ -52,14 +52,14 @@ import com.netscape.certsrv.dbs.certdb.ICertificateRepository;
import com.netscape.certsrv.ocsp.IOCSPAuthority;
import com.netscape.certsrv.usrgrp.IUGSubsystem;
import com.netscape.certsrv.usrgrp.IUser;
-import com.netscape.cms.servlet.base.CMSException;
+import com.netscape.cms.servlet.base.PKIException;
import com.netscape.cms.servlet.base.PKIService;
-import com.netscape.cms.servlet.csadmin.model.CertData;
-import com.netscape.cms.servlet.csadmin.model.ConfigurationData;
-import com.netscape.cms.servlet.csadmin.model.ConfigurationResponseData;
+import com.netscape.cms.servlet.csadmin.model.ConfigurationResponse;
import com.netscape.cms.servlet.csadmin.model.DomainInfo;
import com.netscape.cms.servlet.csadmin.model.InstallToken;
import com.netscape.cms.servlet.csadmin.model.InstallTokenRequest;
+import com.netscape.cms.servlet.csadmin.model.SystemCertData;
+import com.netscape.cms.servlet.csadmin.model.ConfigurationRequest;
import com.netscape.cmsutil.crypto.CryptoUtil;
import com.netscape.cmsutil.util.Utils;
@@ -67,7 +67,7 @@ import com.netscape.cmsutil.util.Utils;
* @author alee
*
*/
-public class SystemConfigService extends PKIService implements SystemConfigurationResource {
+public class SystemConfigService extends PKIService implements SystemConfigResource {
IConfigStore cs;
String csType;
String csState;
@@ -95,8 +95,8 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
* @see com.netscape.cms.servlet.csadmin.SystemConfigurationResource#configure(javax.ws.rs.core.MultivaluedMap)
*/
@Override
- public ConfigurationResponseData configure(MultivaluedMap<String, String> form) {
- ConfigurationData data = new ConfigurationData(form);
+ public ConfigurationResponse configure(MultivaluedMap<String, String> form) {
+ ConfigurationRequest data = new ConfigurationRequest(form);
return configure(data);
}
@@ -104,9 +104,9 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
* @see com.netscape.cms.servlet.csadmin.SystemConfigurationResource#configure(com.netscape.cms.servlet.csadmin.data.ConfigurationData)
*/
@Override
- public ConfigurationResponseData configure(ConfigurationData data){
+ public ConfigurationResponse configure(ConfigurationRequest data){
if (csState.equals("1")) {
- throw new CMSException(Response.Status.BAD_REQUEST, "System is already configured");
+ throw new PKIException(Response.Status.BAD_REQUEST, "System is already configured");
}
String certList;
@@ -114,34 +114,34 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
certList = cs.getString("preop.cert.list");
} catch (Exception e) {
e.printStackTrace();
- throw new CMSException("Unable to get certList from config file");
+ throw new PKIException("Unable to get certList from config file");
}
validateData(data);
- ConfigurationResponseData response = new ConfigurationResponseData();
+ ConfigurationResponse response = new ConfigurationResponse();
// specify module and log into token
String token = data.getToken();
if (token == null) {
- token = ConfigurationData.TOKEN_DEFAULT;
+ token = ConfigurationRequest.TOKEN_DEFAULT;
}
cs.putString("preop.module.token", token);
- if (! token.equals(ConfigurationData.TOKEN_DEFAULT)) {
+ if (! token.equals(ConfigurationRequest.TOKEN_DEFAULT)) {
try {
CryptoManager cryptoManager = CryptoManager.getInstance();
CryptoToken ctoken = cryptoManager.getTokenByName(token);
String tokenpwd = data.getTokenPassword();
ConfigurationUtils.loginToken(ctoken, tokenpwd);
} catch (NotInitializedException e) {
- throw new CMSException("Token is not initialized");
+ throw new PKIException("Token is not initialized");
} catch (NoSuchTokenException e) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Invalid Token provided. No such token.");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Invalid Token provided. No such token.");
} catch (TokenException e) {
e.printStackTrace();
- throw new CMSException("Token Exception" + e);
+ throw new PKIException("Token Exception" + e);
} catch (IncorrectPasswordException e) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Incorrect Password provided for token.");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Incorrect Password provided for token.");
}
}
@@ -150,7 +150,7 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
String securityDomainName = data.getSecurityDomainName();
String securityDomainURL = data.getSecurityDomainUri();
String domainXML = null;
- if (securityDomainType.equals(ConfigurationData.NEW_DOMAIN)) {
+ if (securityDomainType.equals(ConfigurationRequest.NEW_DOMAIN)) {
cs.putString("preop.securitydomain.select", "new");
cs.putString("securitydomain.select", "new");
cs.putString("preop.securitydomain.name", securityDomainName);
@@ -181,7 +181,7 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
ConfigurationUtils.importCertChain(host, port, "/ca/admin/ca/getCertChain", "securitydomain");
} catch (Exception e) {
e.printStackTrace();
- throw new CMSException("Failed to import certificate chain from security domain master: " + e);
+ throw new PKIException("Failed to import certificate chain from security domain master: " + e);
}
// log onto security domain and get token
@@ -192,11 +192,11 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
installToken = ConfigurationUtils.getInstallToken(host, port, user, pass);
} catch (Exception e) {
e.printStackTrace();
- throw new CMSException("Failed to obtain installation token from security domain: " + e);
+ throw new PKIException("Failed to obtain installation token from security domain: " + e);
}
if (installToken == null) {
- throw new CMSException("Failed to obtain installation token from security domain");
+ throw new PKIException("Failed to obtain installation token from security domain");
}
CMS.setConfigSDSessionId(installToken);
@@ -205,7 +205,7 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
ConfigurationUtils.getSecurityDomainPorts(domainXML, host, port);
} catch (Exception e) {
e.printStackTrace();
- throw new CMSException("Failed to obtain security domain decriptor from security domain master: " + e);
+ throw new PKIException("Failed to obtain security domain decriptor from security domain master: " + e);
}
}
@@ -245,11 +245,11 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
validCloneUri = ConfigurationUtils.isValidCloneURI(domainXML, masterHost, masterPort);
} catch (Exception e) {
e.printStackTrace();
- throw new CMSException("Error in determining whether clone URI is valid");
+ throw new PKIException("Error in determining whether clone URI is valid");
}
if (!validCloneUri) {
- throw new CMSException(Response.Status.BAD_REQUEST,
+ throw new PKIException(Response.Status.BAD_REQUEST,
"Invalid clone URI provided. Does not match the available subsystems in the security domain");
}
@@ -258,7 +258,7 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
ConfigurationUtils.importCertChain(masterHost, masterPort, "/ca/ee/ca/getCertChain", "clone");
} catch (Exception e) {
e.printStackTrace();
- throw new CMSException("Failed to import certificate chain from master" + e);
+ throw new PKIException("Failed to import certificate chain from master" + e);
}
}
@@ -266,25 +266,25 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
ConfigurationUtils.getConfigEntriesFromMaster();
} catch (Exception e) {
e.printStackTrace();
- throw new CMSException("Failed to obtain configuration entries from the master for cloning " + e);
+ throw new PKIException("Failed to obtain configuration entries from the master for cloning " + e);
}
// restore certs from P12 file
- if (token.equals(ConfigurationData.TOKEN_DEFAULT)) {
+ if (token.equals(ConfigurationRequest.TOKEN_DEFAULT)) {
String p12File = data.getP12File();
String p12Pass = data.getP12Password();
try {
ConfigurationUtils.restoreCertsFromP12(p12File, p12Pass);
} catch (Exception e) {
e.printStackTrace();
- throw new CMSException("Failed to restore certificates from p12 file" + e);
+ throw new PKIException("Failed to restore certificates from p12 file" + e);
}
}
boolean cloneReady = ConfigurationUtils.isCertdbCloned();
if (!cloneReady) {
CMS.debug("clone does not have all the certificates.");
- throw new CMSException("Clone does not have all the required certificates");
+ throw new PKIException("Clone does not have all the required certificates");
}
}
@@ -299,7 +299,7 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
cs.putString("preop.hierarchy.select", "join");
cs.putString("hierarchy.select", "Subordinate");
} else {
- throw new CMSException(Response.Status.BAD_REQUEST, "Invalid hierarchy provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Invalid hierarchy provided");
}
}
@@ -316,7 +316,7 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
cs.commit(false);
} catch (EBaseException e2) {
e2.printStackTrace();
- throw new CMSException("Unable to commit config parameters to file");
+ throw new PKIException("Unable to commit config parameters to file");
}
if (data.getIsClone().equals("true")) {
@@ -333,12 +333,12 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
}
if (masterhost.equals(realhostname) && masterport.equals(data.getDsPort())) {
- throw new CMSException(Response.Status.BAD_REQUEST,
+ throw new PKIException(Response.Status.BAD_REQUEST,
"Master and clone must not share the same internal database");
}
if (!masterbasedn.equals(data.getBaseDN())) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Master and clone should have the same base DN");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Master and clone should have the same base DN");
}
String masterReplicationPort = data.getMasterReplicationPort();
@@ -390,7 +390,7 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
ConfigurationUtils.reInitSubsystem(csType);
}
} catch (Exception e) {
- throw new CMSException("Error in populating database" + e);
+ throw new PKIException("Error in populating database" + e);
}
// SizePanel, NamePanel, CertRequestPanel
@@ -433,7 +433,7 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
}
}
} catch (Exception e) {
- throw new CMSException("Error in obtaining certificate chain from issuing CA: " + e);
+ throw new PKIException("Error in obtaining certificate chain from issuing CA: " + e);
}
boolean hasSigningCert = false;
@@ -445,9 +445,9 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
boolean enable = cs.getBoolean("preop.cert." + ct + ".enable", true);
if (!enable) continue;
- Collection<CertData> certData = data.getSystemCerts();
- Iterator<CertData> iterator = certData.iterator();
- CertData cdata = null;
+ Collection<SystemCertData> certData = data.getSystemCerts();
+ Iterator<SystemCertData> iterator = certData.iterator();
+ SystemCertData cdata = null;
while (iterator.hasNext()) {
cdata = iterator.next();
if (cdata.getTag().equals(ct)) break;
@@ -521,7 +521,7 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
if (cdata.getCertChain() != null) {
certObj.setCertChain(cdata.getCertChain());
} else {
- throw new CMSException(Response.Status.BAD_REQUEST, "CertChain not provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "CertChain not provided");
}
}
}
@@ -533,13 +533,13 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
} catch (NumberFormatException e) {
// move these validations to validate()?
- throw new CMSException(Response.Status.BAD_REQUEST, "Non-integer value for key size");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Non-integer value for key size");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
- throw new CMSException(Response.Status.BAD_REQUEST, "Invalid algorithm " + e);
+ throw new PKIException(Response.Status.BAD_REQUEST, "Invalid algorithm " + e);
} catch (Exception e) {
e.printStackTrace();
- throw new CMSException("Error in setting certificate names and key sizes: " + e);
+ throw new PKIException("Error in setting certificate names and key sizes: " + e);
}
// submitting to external ca
@@ -557,10 +557,10 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
ConfigurationUtils.setCertPermissions(cert.getCertTag());
} catch (Exception e) {
e.printStackTrace();
- throw new CMSException("Error in confguring system certificates" + e);
+ throw new PKIException("Error in confguring system certificates" + e);
}
if (ret != 0) {
- throw new CMSException("Error in confguring system certificates");
+ throw new PKIException("Error in confguring system certificates");
}
}
response.setSystemCerts(certs);
@@ -571,7 +571,7 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
ConfigurationUtils.backupKeys(data.getBackupPassword(), data.getBackupFile());
} catch (Exception e) {
e.printStackTrace();
- throw new CMSException("Error in creating pkcs12 to backup keys and certs: " + e);
+ throw new PKIException("Error in creating pkcs12 to backup keys and certs: " + e);
}
}
@@ -617,14 +617,14 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
} catch (Exception e) {
e.printStackTrace();
- throw new CMSException("Error in creating admin user: " + e);
+ throw new PKIException("Error in creating admin user: " + e);
}
}
// Done Panel
// Create or update security domain
try {
- if (securityDomainType.equals(ConfigurationData.NEW_DOMAIN)) {
+ if (securityDomainType.equals(ConfigurationRequest.NEW_DOMAIN)) {
ConfigurationUtils.createSecurityDomain();
} else {
ConfigurationUtils.updateSecurityDomain();
@@ -634,7 +634,7 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
cs.commit(false);
} catch (Exception e) {
e.printStackTrace();
- throw new CMSException("Error while updating security domain: " + e);
+ throw new PKIException("Error while updating security domain: " + e);
}
// need to push connector information to the CA
@@ -653,7 +653,7 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
}
} catch (Exception e) {
e.printStackTrace();
- throw new CMSException("Errors in pushing KRA connector information to the CA: " + e);
+ throw new PKIException("Errors in pushing KRA connector information to the CA: " + e);
}
// import the CA certificate into the OCSP
@@ -667,7 +667,7 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
}
} catch (Exception e) {
e.printStackTrace();
- throw new CMSException("Errors in configuring CA publishing to OCSP: " + e);
+ throw new PKIException("Errors in configuring CA publishing to OCSP: " + e);
}
if (!data.getIsClone().equals("true")) {
@@ -677,7 +677,7 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
}
} catch (Exception e) {
e.printStackTrace();
- throw new CMSException("Errors in updating next serial number ranges in DB: " + e);
+ throw new PKIException("Errors in updating next serial number ranges in DB: " + e);
}
}
@@ -695,12 +695,12 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
}
} catch (Exception e1) {
e1.printStackTrace();
- throw new CMSException("Errors in determining if security domain host is a master CA");
+ throw new PKIException("Errors in determining if security domain host is a master CA");
}
try {
String dbuser = csType + "-" + CMS.getEEHost() + "-" + CMS.getEESSLPort();
- if (! securityDomainType.equals(ConfigurationData.NEW_DOMAIN)) {
+ if (! securityDomainType.equals(ConfigurationRequest.NEW_DOMAIN)) {
ConfigurationUtils.setupDBUser(dbuser);
}
IUGSubsystem system = (IUGSubsystem) (CMS.getSubsystem(IUGSubsystem.ID));
@@ -708,7 +708,7 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
system.addCertSubjectDN(user);
} catch (Exception e) {
e.printStackTrace();
- throw new CMSException("Errors in creating or updating dbuser: " + e);
+ throw new PKIException("Errors in creating or updating dbuser: " + e);
}
cs.putInteger("cs.state", 1);
@@ -720,7 +720,7 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
ConfigurationUtils.removePreopConfigEntries();
} catch (EBaseException e) {
e.printStackTrace();
- throw new CMSException("Errors when removing preop config entries: " + e);
+ throw new PKIException("Errors when removing preop config entries: " + e);
}
// Create an empty file that designates the fact that although
@@ -734,7 +734,7 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
return response;
}
- private void validateData(ConfigurationData data) {
+ private void validateData(ConfigurationRequest data) {
// get required info from CS.cfg
String preopPin;
try {
@@ -742,35 +742,35 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
} catch (Exception e) {
CMS.debug("validateData: Failed to get required config form CS.cfg");
e.printStackTrace();
- throw new CMSException("Unable to retrieve required configuration from configuration files");
+ throw new PKIException("Unable to retrieve required configuration from configuration files");
}
// get the preop pin and validate it
String pin = data.getPin();
if (pin == null) {
- throw new CMSException(Response.Status.BAD_REQUEST, "No preop pin provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "No preop pin provided");
}
if (!preopPin.equals(pin)) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Incorrect pin provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Incorrect pin provided");
}
// validate security domain settings
String domainType = data.getSecurityDomainType();
if (domainType == null) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Security Domain Type not provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Security Domain Type not provided");
}
- if (domainType.equals(ConfigurationData.NEW_DOMAIN)) {
+ if (domainType.equals(ConfigurationRequest.NEW_DOMAIN)) {
if (!csType.equals("CA")) {
- throw new CMSException(Response.Status.BAD_REQUEST, "New Domain is only valid for CA subsytems");
+ throw new PKIException(Response.Status.BAD_REQUEST, "New Domain is only valid for CA subsytems");
}
if (data.getSecurityDomainName() == null) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Security Domain Name is not provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Security Domain Name is not provided");
}
- } else if (domainType.equals(ConfigurationData.EXISTING_DOMAIN)) {
+ } else if (domainType.equals(ConfigurationRequest.EXISTING_DOMAIN)) {
String domainURI = data.getSecurityDomainUri();
if (domainURI == null) {
- throw new CMSException(Response.Status.BAD_REQUEST,
+ throw new PKIException(Response.Status.BAD_REQUEST,
"Existing security domain requested, but no security domain URI provided");
}
@@ -778,40 +778,40 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
@SuppressWarnings("unused")
URL admin_u = new URL(domainURI); // check for invalid URL
} catch (MalformedURLException e) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Invalid security domain URI");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Invalid security domain URI");
}
if ((data.getSecurityDomainUser() == null) || (data.getSecurityDomainPassword() == null)) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Security domain user or password not provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Security domain user or password not provided");
}
} else {
- throw new CMSException(Response.Status.BAD_REQUEST, "Invalid security domain URI provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Invalid security domain URI provided");
}
if ((data.getSubsystemName() == null) || (data.getSubsystemName().length() ==0)) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Invalid or no subsystem name provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Invalid or no subsystem name provided");
}
if ((data.getIsClone() != null) && (data.getIsClone().equals("true"))) {
String cloneUri = data.getCloneUri();
if (cloneUri == null) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Clone selected, but no clone URI provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Clone selected, but no clone URI provided");
}
try {
@SuppressWarnings("unused")
URL url = new URL(cloneUri); // check for invalid URL
// confirm protocol is https
} catch (MalformedURLException e) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Invalid clone URI");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Invalid clone URI");
}
- if (data.getToken().equals(ConfigurationData.TOKEN_DEFAULT)) {
+ if (data.getToken().equals(ConfigurationRequest.TOKEN_DEFAULT)) {
if (data.getP12File() == null) {
- throw new CMSException(Response.Status.BAD_REQUEST, "P12 filename not provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "P12 filename not provided");
}
if (data.getP12Password() == null) {
- throw new CMSException(Response.Status.BAD_REQUEST, "P12 password not provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "P12 password not provided");
}
}
} else {
@@ -820,33 +820,33 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
String dsHost = data.getDsHost();
if (dsHost == null || dsHost.length() == 0) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Internal database host not provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Internal database host not provided");
}
try {
Integer.parseInt(data.getDsPort()); // check for errors
} catch (NumberFormatException e) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Internal database port is invalid");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Internal database port is invalid");
}
String basedn = data.getBaseDN();
if (basedn == null || basedn.length() == 0) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Internal database basedn not provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Internal database basedn not provided");
}
String binddn = data.getBindDN();
if (binddn == null || binddn.length() == 0) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Internal database basedn not provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Internal database basedn not provided");
}
String database = data.getDatabase();
if (database == null || database.length() == 0) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Internal database database name not provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Internal database database name not provided");
}
String bindpwd = data.getBindpwd();
if (bindpwd == null || bindpwd.length() == 0) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Internal database database name not provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Internal database database name not provided");
}
String masterReplicationPort = data.getMasterReplicationPort();
@@ -854,7 +854,7 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
try {
Integer.parseInt(masterReplicationPort); // check for errors
} catch (NumberFormatException e) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Master replication port is invalid");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Master replication port is invalid");
}
}
@@ -863,48 +863,48 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
try {
Integer.parseInt(cloneReplicationPort); // check for errors
} catch (Exception e) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Clone replication port is invalid");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Clone replication port is invalid");
}
}
if ((data.getBackupKeys() != null) && data.getBackupKeys().equals("true")) {
if ((data.getBackupFile() == null) || (data.getBackupFile().length()<=0)) {
//TODO: also check for valid path, perhaps by touching file there
- throw new CMSException(Response.Status.BAD_REQUEST, "Invalid key backup file name");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Invalid key backup file name");
}
if ((data.getBackupPassword() == null) || (data.getBackupPassword().length()<8)) {
- throw new CMSException(Response.Status.BAD_REQUEST, "key backup password must be at least 8 characters");
+ throw new PKIException(Response.Status.BAD_REQUEST, "key backup password must be at least 8 characters");
}
} else {
data.setBackupKeys("false");
}
if (csType.equals("CA") && (data.getHierarchy() == null)) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Hierarchy is requred for CA, not provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Hierarchy is requred for CA, not provided");
}
if (data.getIsClone().equals("false")) {
if ((data.getAdminUID() == null) || (data.getAdminUID().length()==0)) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Admin UID not provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Admin UID not provided");
}
if ((data.getAdminPassword() == null) || (data.getAdminPassword().length()==0)) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Admin Password not provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Admin Password not provided");
}
if ((data.getAdminEmail() == null) || (data.getAdminEmail().length()==0)) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Admin UID not provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Admin UID not provided");
}
if ((data.getAdminName() == null) || (data.getAdminName().length()==0)) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Admin name not provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Admin name not provided");
}
if ((data.getAdminCertRequest() == null) || (data.getAdminCertRequest().length()==0)) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Admin cert request not provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Admin cert request not provided");
}
if ((data.getAdminCertRequestType() == null) || (data.getAdminCertRequestType().length()==0)) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Admin cert request type not provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Admin cert request type not provided");
}
if ((data.getAdminSubjectDN() == null) || (data.getAdminSubjectDN().length()==0)) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Admin subjectDN not provided");
+ throw new PKIException(Response.Status.BAD_REQUEST, "Admin subjectDN not provided");
}
}
@@ -928,7 +928,7 @@ public class SystemConfigService extends PKIService implements SystemConfigurati
try {
ip = InetAddress.getByName(host).toString();
} catch (UnknownHostException e) {
- throw new CMSException(Response.Status.BAD_REQUEST, "Unable to resolve host " + host +
+ throw new PKIException(Response.Status.BAD_REQUEST, "Unable to resolve host " + host +
"to an IP address: " + e);
}
int index = ip.indexOf("/");
diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/model/ConfigurationData.java b/base/common/src/com/netscape/cms/servlet/csadmin/model/ConfigurationRequest.java
index 3c1bea86b..b42403f4e 100644
--- a/base/common/src/com/netscape/cms/servlet/csadmin/model/ConfigurationData.java
+++ b/base/common/src/com/netscape/cms/servlet/csadmin/model/ConfigurationRequest.java
@@ -30,9 +30,9 @@ import javax.xml.bind.annotation.XmlRootElement;
* @author alee
*
*/
-@XmlRootElement(name="ConfigurationData")
+@XmlRootElement(name="ConfigurationRequest")
@XmlAccessorType(XmlAccessType.FIELD)
-public class ConfigurationData {
+public class ConfigurationRequest {
private static final String PIN = "pin";
private static final String TOKEN = "token";
private static final String TOKEN_PASSWORD = "tokenPassword";
@@ -152,7 +152,7 @@ public class ConfigurationData {
protected String replicationSecurity;
@XmlElementRef
- protected Collection<CertData> systemCerts;
+ protected Collection<SystemCertData> systemCerts;
@XmlElement
protected String issuingCA;
@@ -193,11 +193,11 @@ public class ConfigurationData {
@XmlElement
protected String stepTwo;
- public ConfigurationData() {
+ public ConfigurationRequest() {
// required for JAXB
}
- public ConfigurationData(MultivaluedMap<String, String> form) {
+ public ConfigurationRequest(MultivaluedMap<String, String> form) {
pin = form.getFirst(PIN);
token = form.getFirst(TOKEN);
tokenPassword = form.getFirst(TOKEN_PASSWORD);
@@ -533,7 +533,7 @@ public class ConfigurationData {
*
* @return systemCerts
*/
- public Collection<CertData> getSystemCerts() {
+ public Collection<SystemCertData> getSystemCerts() {
return systemCerts;
}
@@ -541,7 +541,7 @@ public class ConfigurationData {
*
* @param systemCerts
*/
- public void setSystemCerts(Collection<CertData> systemCerts) {
+ public void setSystemCerts(Collection<SystemCertData> systemCerts) {
this.systemCerts = systemCerts;
}
diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/model/ConfigurationResponseData.java b/base/common/src/com/netscape/cms/servlet/csadmin/model/ConfigurationResponse.java
index d1656fdda..2fcd37d9d 100644
--- a/base/common/src/com/netscape/cms/servlet/csadmin/model/ConfigurationResponseData.java
+++ b/base/common/src/com/netscape/cms/servlet/csadmin/model/ConfigurationResponse.java
@@ -14,7 +14,7 @@
//
// (C) 2012 Red Hat, Inc.
// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
+// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.servlet.csadmin.model;
import java.security.cert.CertificateEncodingException;
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Vector;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@@ -37,30 +38,30 @@ import com.netscape.cms.servlet.csadmin.Cert;
* @author alee
*
*/
-@XmlRootElement(name="ConfigurationResponseData")
+@XmlRootElement(name="ConfigurationResponse")
@XmlAccessorType(XmlAccessType.FIELD)
-public class ConfigurationResponseData {
-
+public class ConfigurationResponse {
+
@XmlElementRef
- protected Collection<CertData> systemCerts;
-
+ protected Collection<SystemCertData> systemCerts;
+
@XmlElement
- protected CertData adminCert;
-
+ protected SystemCertData adminCert;
+
@XmlElement
protected String status;
-
- public ConfigurationResponseData() {
- systemCerts = new ArrayList<CertData>();
- adminCert = new CertData();
+
+ public ConfigurationResponse() {
+ systemCerts = new ArrayList<SystemCertData>();
+ adminCert = new SystemCertData();
}
-
+
public void setSystemCerts(Vector<Cert> certs) {
systemCerts.clear();
Enumeration<Cert> e = certs.elements();
while (e.hasMoreElements()) {
Cert cert = e.nextElement();
- CertData cdata = new CertData();
+ SystemCertData cdata = new SystemCertData();
cdata.setCert(cert.getCert());
cdata.setRequest(cert.getRequest());
cdata.setTag(cert.getCertTag());
@@ -68,32 +69,32 @@ public class ConfigurationResponseData {
systemCerts.add(cdata);
}
}
-
+
/**
* @return the systemCerts
*/
- public Collection<CertData> getSystemCerts() {
+ public Collection<SystemCertData> getSystemCerts() {
return systemCerts;
}
/**
* @param systemCerts the systemCerts to set
*/
- public void setSystemCerts(Collection<CertData> systemCerts) {
+ public void setSystemCerts(Collection<SystemCertData> systemCerts) {
this.systemCerts = systemCerts;
}
/**
* @return the adminCert
*/
- public CertData getAdminCert() {
+ public SystemCertData getAdminCert() {
return adminCert;
}
/**
* @param adminCert the adminCert to set
*/
- public void setAdminCert(CertData adminCert) {
+ public void setAdminCert(SystemCertData adminCert) {
this.adminCert = adminCert;
}
diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/model/CertData.java b/base/common/src/com/netscape/cms/servlet/csadmin/model/SystemCertData.java
index d9e5e8005..bd98fe95c 100644
--- a/base/common/src/com/netscape/cms/servlet/csadmin/model/CertData.java
+++ b/base/common/src/com/netscape/cms/servlet/csadmin/model/SystemCertData.java
@@ -14,8 +14,8 @@
//
// (C) 2012 Red Hat, Inc.
// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
-
+// --- END COPYRIGHT BLOCK ---
+
package com.netscape.cms.servlet.csadmin.model;
import javax.ws.rs.core.MultivaluedMap;
@@ -28,63 +28,63 @@ import javax.xml.bind.annotation.XmlRootElement;
* @author alee
*
*/
-@XmlRootElement(name="CertData")
+@XmlRootElement(name="SystemCertData")
@XmlAccessorType(XmlAccessType.FIELD)
-public class CertData {
+public class SystemCertData {
public static final String TAG = "tag";
public static final String NICKNAME = "nickname";
public static final String TOKEN = "token";
public static final String KEY_TYPE = "keyType";
public static final String KEY_ALGORITHM = "keyAlgorithm";
- public static final String SIGNING_ALGORITHM = "signingAlgorithm";
+ public static final String SIGNING_ALGORITHM = "signingAlgorithm";
public static final String KEY_SIZE = "keySize";
public static final String KEY_CURVENAME = "keyCurveName";
public static final String REQUEST = "request";
public static final String SUBJECT_DN = "subjectDN";
public static final String CERT = "cert";
public static final String CERT_CHAIN = "certChain";
-
+
@XmlElement
protected String tag;
-
+
@XmlElement
protected String nickname;
-
+
@XmlElement
protected String token;
-
+
@XmlElement
protected String keyType;
-
+
@XmlElement
protected String keyAlgorithm;
-
+
@XmlElement
protected String signingAlgorithm;
-
+
@XmlElement
protected String keySize;
-
+
@XmlElement
protected String keyCurveName;
-
+
@XmlElement
protected String request;
-
+
@XmlElement
protected String subjectDN;
-
+
@XmlElement
protected String cert;
-
+
@XmlElement
protected String certChain;
-
- public CertData() {
+
+ public SystemCertData() {
// required for JAXB
}
-
- public CertData(MultivaluedMap<String, String> form) {
+
+ public SystemCertData(MultivaluedMap<String, String> form) {
tag = form.getFirst(TAG);
nickname = form.getFirst(NICKNAME);
token = form.getFirst(TOKEN);
@@ -266,5 +266,5 @@ public class CertData {
public void setCertChain(String certChain) {
this.certChain = certChain;
}
-
+
}