summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAde Lee <alee@redhat.com>2013-01-24 14:16:11 -0500
committerAde Lee <alee@redhat.com>2013-02-11 11:17:26 -0500
commitc483f48647eb190dce94866871b6ea933634e62d (patch)
tree5d9ac88c816915ff61fb5d903c48e168120ff853
parent56a30f1a24860549508e7028da1519b5b0d2906a (diff)
downloadpki-c483f48647eb190dce94866871b6ea933634e62d.zip
pki-c483f48647eb190dce94866871b6ea933634e62d.tar.gz
pki-c483f48647eb190dce94866871b6ea933634e62d.tar.xz
move updateNumberRange to admin interface
-rw-r--r--base/ca/shared/webapps/ca/WEB-INF/web.xml4
-rw-r--r--base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java104
-rw-r--r--base/kra/shared/webapps/kra/WEB-INF/web.xml4
3 files changed, 61 insertions, 51 deletions
diff --git a/base/ca/shared/webapps/ca/WEB-INF/web.xml b/base/ca/shared/webapps/ca/WEB-INF/web.xml
index a875fee..b922b3d 100644
--- a/base/ca/shared/webapps/ca/WEB-INF/web.xml
+++ b/base/ca/shared/webapps/ca/WEB-INF/web.xml
@@ -201,7 +201,7 @@
<init-param><param-name> ID </param-name>
<param-value> caUpdateNumberRange </param-value> </init-param>
<init-param><param-name> interface </param-name>
- <param-value> ee </param-value> </init-param>
+ <param-value> admin </param-value> </init-param>
<init-param><param-name> AuthMgr </param-name>
<param-value> TokenAuth </param-value> </init-param>
<init-param><param-name> AuthzMgr </param-name>
@@ -1884,7 +1884,7 @@
<servlet-mapping>
<servlet-name> caUpdateNumberRange </servlet-name>
- <url-pattern> /ee/ca/updateNumberRange </url-pattern>
+ <url-pattern> /admin/ca/updateNumberRange </url-pattern>
</servlet-mapping>
<servlet-mapping>
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 f8869fc..8b97c9b 100644
--- a/base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java
+++ b/base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java
@@ -564,24 +564,21 @@ public class ConfigurationUtils {
cstype = cstype.toLowerCase();
String session_id = CMS.getConfigSDSessionId();
- String master_hostname = "";
- int master_port = -1;
- int master_ee_port = -1;
- master_hostname = config.getString("preop.master.hostname", "");
- master_port = config.getInteger("preop.master.httpsadminport", -1);
- master_ee_port = config.getInteger("preop.master.httpsport", -1);
+ String master_hostname = config.getString("preop.master.hostname", "");
+ int master_port = config.getInteger("preop.master.httpsadminport", -1);
+ int master_ee_port = config.getInteger("preop.master.httpsport", -1);
String content = "";
if (cstype.equals("ca") || cstype.equals("kra")) {
content = "type=request&xmlOutput=true&sessionID=" + session_id;
CMS.debug("http content=" + content);
- updateNumberRange(master_hostname, master_ee_port, true, content, "request");
+ updateNumberRange(master_hostname, master_ee_port, master_port, true, content, "request");
content = "type=serialNo&xmlOutput=true&sessionID=" + session_id;
- updateNumberRange(master_hostname, master_ee_port, true, content, "serialNo");
+ updateNumberRange(master_hostname, master_ee_port, master_port, true, content, "serialNo");
content = "type=replicaId&xmlOutput=true&sessionID=" + session_id;
- updateNumberRange(master_hostname, master_ee_port, true, content, "replicaId");
+ updateNumberRange(master_hostname, master_ee_port, master_port, true, content, "replicaId");
}
String list = "";
@@ -639,52 +636,65 @@ public class ConfigurationUtils {
}
- public static void updateNumberRange(String hostname, int port, boolean https, String content, String type)
- throws IOException, EBaseException, SAXException, ParserConfigurationException {
- CMS.debug("updateNumberRange start host=" + hostname + " port=" + port);
+ public static void updateNumberRange(String hostname, int eePort, int adminPort, boolean https, String content,
+ String type) throws IOException, EBaseException, SAXException, ParserConfigurationException {
+ CMS.debug("updateNumberRange start host=" + hostname + " adminPort=" + adminPort + " eePort=" + eePort);
IConfigStore cs = CMS.getConfigStore();
String cstype = "";
cstype = cs.getString("cs.type", "");
cstype = cstype.toLowerCase();
- String serverPath = "/" + cstype + "/ee/" + cstype + "/updateNumberRange";
- String c = getHttpResponse(hostname, port, https, serverPath, content, null, null);
- if (c == null || c.equals("")) {
- CMS.debug("updateNumberRange: content is null.");
- throw new IOException("The server you want to contact is not available");
- } else {
- CMS.debug("content=" + c);
- ByteArrayInputStream bis = new ByteArrayInputStream(c.getBytes());
- XMLObject parser = null;
- parser = new XMLObject(bis);
- String status = parser.getValue("Status");
-
- CMS.debug("updateNumberRange(): status=" + status);
- if (status.equals(SUCCESS)) {
- String beginNum = parser.getValue("beginNumber");
- String endNum = parser.getValue("endNumber");
- if (type.equals("request")) {
- cs.putString("dbs.beginRequestNumber", beginNum);
- cs.putString("dbs.endRequestNumber", endNum);
- } else if (type.equals("serialNo")) {
- cs.putString("dbs.beginSerialNumber", beginNum);
- cs.putString("dbs.endSerialNumber", endNum);
- } else if (type.equals("replicaId")) {
- cs.putString("dbs.beginReplicaNumber", beginNum);
- cs.putString("dbs.endReplicaNumber", endNum);
- }
- // enable serial number management in clone
- cs.putString("dbs.enableSerialManagement", "true");
- cs.commit(false);
- return;
- } else if (status.equals(AUTH_FAILURE)) {
- throw new EAuthException(AUTH_FAILURE);
- } else {
- String error = parser.getValue("Error");
- throw new IOException(error);
+ String serverPath = "/" + cstype + "/admin/" + cstype + "/updateNumberRange";
+ String c = null;
+ try {
+ c = getHttpResponse(hostname, adminPort, https, serverPath, content, null, null);
+ if (c == null || c.equals("")) {
+ CMS.debug("updateNumberRange: content is null.");
+ throw new IOException("The server you want to contact is not available");
+ }
+ } catch (Exception e) {
+ // for backward compatibility, try the old ee interface too
+ CMS.debug("updateNumberRange: Failed to contact master using admin port" + e);
+ CMS.debug("updateNumberRange: Attempting to contact master using EE port");
+ serverPath = "/" + cstype + "/ee/" + cstype + "/updateNumberRange";
+ c = getHttpResponse(hostname, eePort, https, serverPath, content, null, null);
+ if (c == null || c.equals("")) {
+ CMS.debug("updateNumberRange: content is null.");
+ throw new IOException("The server you want to contact is not available");
}
}
+
+ CMS.debug("content=" + c);
+ ByteArrayInputStream bis = new ByteArrayInputStream(c.getBytes());
+ XMLObject parser = null;
+ parser = new XMLObject(bis);
+ String status = parser.getValue("Status");
+
+ CMS.debug("updateNumberRange(): status=" + status);
+ if (status.equals(SUCCESS)) {
+ String beginNum = parser.getValue("beginNumber");
+ String endNum = parser.getValue("endNumber");
+ if (type.equals("request")) {
+ cs.putString("dbs.beginRequestNumber", beginNum);
+ cs.putString("dbs.endRequestNumber", endNum);
+ } else if (type.equals("serialNo")) {
+ cs.putString("dbs.beginSerialNumber", beginNum);
+ cs.putString("dbs.endSerialNumber", endNum);
+ } else if (type.equals("replicaId")) {
+ cs.putString("dbs.beginReplicaNumber", beginNum);
+ cs.putString("dbs.endReplicaNumber", endNum);
+ }
+ // enable serial number management in clone
+ cs.putString("dbs.enableSerialManagement", "true");
+ cs.commit(false);
+ return;
+ } else if (status.equals(AUTH_FAILURE)) {
+ throw new EAuthException(AUTH_FAILURE);
+ } else {
+ String error = parser.getValue("Error");
+ throw new IOException(error);
+ }
}
public static boolean updateConfigEntries(String hostname, int port, boolean https,
diff --git a/base/kra/shared/webapps/kra/WEB-INF/web.xml b/base/kra/shared/webapps/kra/WEB-INF/web.xml
index c278bcb..5ef28fc 100644
--- a/base/kra/shared/webapps/kra/WEB-INF/web.xml
+++ b/base/kra/shared/webapps/kra/WEB-INF/web.xml
@@ -652,7 +652,7 @@
<init-param><param-name> ID </param-name>
<param-value> kraUpdateNumberRange </param-value> </init-param>
<init-param><param-name> interface </param-name>
- <param-value> ee </param-value> </init-param>
+ <param-value> admin </param-value> </init-param>
<init-param><param-name> AuthMgr </param-name>
<param-value> TokenAuth </param-value> </init-param>
<init-param><param-name> AuthzMgr </param-name>
@@ -918,7 +918,7 @@
<servlet-mapping>
<servlet-name> kraUpdateNumberRange </servlet-name>
- <url-pattern> /ee/kra/updateNumberRange </url-pattern>
+ <url-pattern> /admin/kra/updateNumberRange </url-pattern>
</servlet-mapping>
<servlet-mapping>