summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cms/servlet/admin/PublisherAdminServlet.java
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/common/src/com/netscape/cms/servlet/admin/PublisherAdminServlet.java')
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/admin/PublisherAdminServlet.java1331
1 files changed, 664 insertions, 667 deletions
diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/PublisherAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/PublisherAdminServlet.java
index 2842542e..22aa306e 100644
--- a/pki/base/common/src/com/netscape/cms/servlet/admin/PublisherAdminServlet.java
+++ b/pki/base/common/src/com/netscape/cms/servlet/admin/PublisherAdminServlet.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.servlet.admin;
-
import java.io.IOException;
import java.util.Enumeration;
import java.util.Locale;
@@ -68,12 +67,11 @@ import com.netscape.certsrv.publish.RulePlugin;
import com.netscape.certsrv.security.ICryptoSubsystem;
import com.netscape.cmsutil.password.IPasswordStore;
-
/**
* A class representing an publishing servlet for the
- * Publishing subsystem. This servlet is responsible
+ * Publishing subsystem. This servlet is responsible
* to serve configuration requests for the Publishing subsystem.
- *
+ *
* @version $Revision$, $Date$
*/
public class PublisherAdminServlet extends AdminServlet {
@@ -85,8 +83,8 @@ public class PublisherAdminServlet extends AdminServlet {
public final static String PROP_AUTHORITY = "authority";
private final static String INFO = "PublisherAdminServlet";
- private final static String PW_TAG_CA_LDAP_PUBLISHING =
- "CA LDAP Publishing";
+ private final static String PW_TAG_CA_LDAP_PUBLISHING =
+ "CA LDAP Publishing";
public final static String NOMAPPER = "<NONE>";
private IPublisherProcessor mProcessor = null;
private IAuthority mAuth = null;
@@ -110,22 +108,22 @@ public class PublisherAdminServlet extends AdminServlet {
if (mAuth != null)
if (mAuth instanceof ICertificateAuthority) {
mProcessor = ((ICertificateAuthority) mAuth).getPublisherProcessor();
- } else
- throw new ServletException(authority + " does not have publishing processor!");
+ } else
+ throw new ServletException(authority + " does not have publishing processor!");
}
/**
* Returns serlvet information.
*/
- public String getServletInfo() {
- return INFO;
+ public String getServletInfo() {
+ return INFO;
}
/**
* Serves HTTP admin request.
*/
public void service(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException {
+ throws ServletException, IOException {
super.service(req, resp);
CMS.debug("PublisherAdminServlet: in service");
@@ -134,9 +132,9 @@ public class PublisherAdminServlet extends AdminServlet {
if (op == null) {
//System.out.println("SRVLT_INVALID_PROTOCOL");
- sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_INVALID_PROTOCOL"),
- null, resp);
+ sendResponse(ERROR,
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_INVALID_PROTOCOL"),
+ null, resp);
return;
}
@@ -149,8 +147,8 @@ public class PublisherAdminServlet extends AdminServlet {
return;
}
} catch (IOException e) {
- sendResponse(ERROR, CMS.getUserMessage(getLocale(req),"CMS_ADMIN_SRVLT_AUTHS_FAILED"),
- null, resp);
+ sendResponse(ERROR, CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_AUTHS_FAILED"),
+ null, resp);
return;
}
try {
@@ -160,8 +158,8 @@ public class PublisherAdminServlet extends AdminServlet {
mOp = "read";
if ((mToken = super.authorize(req)) == null) {
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_AUTHZ_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_AUTHZ_FAILED"),
+ null, resp);
return;
}
if (scope.equals(ScopeDef.SC_LDAP)) {
@@ -188,13 +186,13 @@ public class PublisherAdminServlet extends AdminServlet {
} else if (scope.equals(ScopeDef.SC_RULE_RULES)) {
getRuleInstConfig(req, resp);
return;
- }
+ }
} else if (op.equals(OpDef.OP_MODIFY)) {
mOp = "modify";
if ((mToken = super.authorize(req)) == null) {
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_AUTHZ_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_AUTHZ_FAILED"),
+ null, resp);
return;
}
if (scope.equals(ScopeDef.SC_LDAP)) {
@@ -214,20 +212,20 @@ public class PublisherAdminServlet extends AdminServlet {
mOp = "modify";
if ((mToken = super.authorize(req)) == null) {
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_AUTHZ_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_AUTHZ_FAILED"),
+ null, resp);
return;
}
if (scope.equals(ScopeDef.SC_LDAP)) {
testSetLDAPDest(req, resp);
return;
- }
+ }
} else if (op.equals(OpDef.OP_SEARCH)) {
mOp = "read";
if ((mToken = super.authorize(req)) == null) {
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_AUTHZ_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_AUTHZ_FAILED"),
+ null, resp);
return;
}
if (scope.equals(ScopeDef.SC_PUBLISHER_IMPLS)) {
@@ -242,7 +240,7 @@ public class PublisherAdminServlet extends AdminServlet {
} else if (scope.equals(ScopeDef.SC_MAPPER_RULES)) {
listMapperInsts(req, resp);
return;
- } else if (scope.equals(ScopeDef.SC_RULE_IMPLS)) {
+ } else if (scope.equals(ScopeDef.SC_RULE_IMPLS)) {
listRulePlugins(req, resp);
return;
} else if (scope.equals(ScopeDef.SC_RULE_RULES)) {
@@ -253,8 +251,8 @@ public class PublisherAdminServlet extends AdminServlet {
mOp = "modify";
if ((mToken = super.authorize(req)) == null) {
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_AUTHZ_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_AUTHZ_FAILED"),
+ null, resp);
return;
}
if (scope.equals(ScopeDef.SC_PUBLISHER_IMPLS)) {
@@ -275,13 +273,13 @@ public class PublisherAdminServlet extends AdminServlet {
} else if (scope.equals(ScopeDef.SC_RULE_RULES)) {
addRuleInst(req, resp, scope);
return;
- }
+ }
} else if (op.equals(OpDef.OP_DELETE)) {
mOp = "modify";
if ((mToken = super.authorize(req)) == null) {
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_AUTHZ_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_AUTHZ_FAILED"),
+ null, resp);
return;
}
if (scope.equals(ScopeDef.SC_PUBLISHER_IMPLS)) {
@@ -304,31 +302,31 @@ public class PublisherAdminServlet extends AdminServlet {
return;
}
} else {
- sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_INVALID_OP_TYPE", op),
- null, resp);
+ sendResponse(ERROR,
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_INVALID_OP_TYPE", op),
+ null, resp);
return;
}
} else {
//System.out.println("SRVLT_INVALID_OP_SCOPE");
- sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_INVALID_OP_SCOPE"),
- null, resp);
+ sendResponse(ERROR,
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_INVALID_OP_SCOPE"),
+ null, resp);
return;
}
} catch (EBaseException e) {
sendResponse(ERROR, e.toString(getLocale(req)), null, resp);
return;
- }
+ }
//System.out.println("SRVLT_FAIL_PERFORM 2");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_PERFORM_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_PERFORM_FAILED"),
+ null, resp);
return;
}
private IExtendedPluginInfo getExtendedPluginInfo(IPublisherProcessor
- p) {
+ p) {
Enumeration mappers = p.getMapperInsts().keys();
Enumeration publishers = p.getPublisherInsts().keys();
@@ -337,11 +335,11 @@ public class PublisherAdminServlet extends AdminServlet {
for (; mappers.hasMoreElements();) {
String name = (String) mappers.nextElement();
- if (map.length()== 0) {
- map.append(name);
+ if (map.length() == 0) {
+ map.append(name);
} else {
- map.append(",");
- map.append(name);
+ map.append(",");
+ map.append(name);
}
}
StringBuffer publish = new StringBuffer();
@@ -379,12 +377,11 @@ public class PublisherAdminServlet extends AdminServlet {
} else if (implType.equals(Constants.PR_EXT_PLUGIN_IMPLTYPE_MAPPER)) {
IPublisherProcessor p_processor = mProcessor;
Plugin plugin = (Plugin) p_processor.getMapperPlugins().get(implName
- );
+ );
impl = getClassByNameAsExtendedPluginInfo(plugin.getClassPath());
- } else if (implType.equals(Constants.PR_EXT_PLUGIN_IMPLTYPE_PUBLISHER)
- ) {
+ } else if (implType.equals(Constants.PR_EXT_PLUGIN_IMPLTYPE_PUBLISHER)) {
IPublisherProcessor p_processor = mProcessor;
Plugin plugin = (Plugin) p_processor.getPublisherPlugins().get(implName);
@@ -408,13 +405,13 @@ public class PublisherAdminServlet extends AdminServlet {
}
- /**
+ /**
* retrieve extended plugin info such as brief description, type info
- * from policy, authentication,
- * need to add: listener, mapper and publishing plugins
+ * from policy, authentication,
+ * need to add: listener, mapper and publishing plugins
*/
private void getExtendedPluginInfo(HttpServletRequest req,
- HttpServletResponse resp) throws ServletException,
+ HttpServletResponse resp) throws ServletException,
IOException, EBaseException {
String id = req.getParameter(Constants.RS_ID);
@@ -423,14 +420,14 @@ public class PublisherAdminServlet extends AdminServlet {
String implType = id.substring(0, colon);
String implName = id.substring(colon + 1);
- NameValuePairs params =
- getExtendedPluginInfo(getLocale(req), implType, implName);
+ NameValuePairs params =
+ getExtendedPluginInfo(getLocale(req), implType, implName);
sendResponse(SUCCESS, null, params, resp);
}
-
+
private void getLDAPDest(HttpServletRequest req,
- HttpServletResponse resp) throws ServletException,
+ HttpServletResponse resp) throws ServletException,
IOException, EBaseException {
NameValuePairs params = new NameValuePairs();
IConfigStore config = mAuth.getConfigStore();
@@ -482,25 +479,25 @@ public class PublisherAdminServlet extends AdminServlet {
params.add(name, value);
}
}
- params.add(Constants.PR_PUBLISHING_ENABLE,
- publishcfg.getString(IPublisherProcessor.PROP_ENABLE, Constants.FALSE));
+ params.add(Constants.PR_PUBLISHING_ENABLE,
+ publishcfg.getString(IPublisherProcessor.PROP_ENABLE, Constants.FALSE));
params.add(Constants.PR_PUBLISHING_QUEUE_ENABLE,
- publishcfg.getString(Constants.PR_PUBLISHING_QUEUE_ENABLE, Constants.TRUE));
+ publishcfg.getString(Constants.PR_PUBLISHING_QUEUE_ENABLE, Constants.TRUE));
params.add(Constants.PR_PUBLISHING_QUEUE_THREADS,
- publishcfg.getString(Constants.PR_PUBLISHING_QUEUE_THREADS, "3"));
+ publishcfg.getString(Constants.PR_PUBLISHING_QUEUE_THREADS, "3"));
params.add(Constants.PR_PUBLISHING_QUEUE_PAGE_SIZE,
- publishcfg.getString(Constants.PR_PUBLISHING_QUEUE_PAGE_SIZE, "40"));
+ publishcfg.getString(Constants.PR_PUBLISHING_QUEUE_PAGE_SIZE, "40"));
params.add(Constants.PR_PUBLISHING_QUEUE_PRIORITY,
- publishcfg.getString(Constants.PR_PUBLISHING_QUEUE_PRIORITY, "0"));
+ publishcfg.getString(Constants.PR_PUBLISHING_QUEUE_PRIORITY, "0"));
params.add(Constants.PR_PUBLISHING_QUEUE_STATUS,
- publishcfg.getString(Constants.PR_PUBLISHING_QUEUE_STATUS, "200"));
- params.add(Constants.PR_ENABLE,
- ldapcfg.getString(IPublisherProcessor.PROP_ENABLE, Constants.FALSE));
+ publishcfg.getString(Constants.PR_PUBLISHING_QUEUE_STATUS, "200"));
+ params.add(Constants.PR_ENABLE,
+ ldapcfg.getString(IPublisherProcessor.PROP_ENABLE, Constants.FALSE));
sendResponse(SUCCESS, null, params, resp);
}
private void setLDAPDest(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException, EBaseException {
+ throws ServletException, IOException, EBaseException {
NameValuePairs params = new NameValuePairs();
//Save New Settings to the config file
@@ -518,7 +515,7 @@ public class PublisherAdminServlet extends AdminServlet {
// need to disable the ldap module here
mProcessor.setLdapConnModule(null);
}
-
+
//set reset of the parameters
Enumeration e = req.getParameterNames();
String pwd = null;
@@ -536,9 +533,9 @@ public class PublisherAdminServlet extends AdminServlet {
continue;
if (name.equals(Constants.PR_PUBLISHING_ENABLE))
continue;
- // don't store password in the config file.
- if (name.equals(Constants.PR_BIND_PASSWD))
- continue; // old style password read from config.
+ // don't store password in the config file.
+ if (name.equals(Constants.PR_BIND_PASSWD))
+ continue; // old style password read from config.
if (name.equals(Constants.PR_DIRECTORY_MANAGER_PWD)) {
pwd = req.getParameter(name);
continue;
@@ -567,7 +564,7 @@ public class PublisherAdminServlet extends AdminServlet {
/* Don't enter the publishing pw into the config store */
ldap.putString(name, req.getParameter(name));
}
-
+
commit(true);
/* Do a "PUT" of the new pw to the watchdog"
@@ -580,27 +577,27 @@ public class PublisherAdminServlet extends AdminServlet {
// update passwordFile
String prompt = ldap.getString(Constants.PR_BINDPWD_PROMPT);
IPasswordStore pwdStore = CMS.getPasswordStore();
- CMS.debug("PublisherAdminServlet: setLDAPDest(): saving password for "+ prompt + " to password file");
+ CMS.debug("PublisherAdminServlet: setLDAPDest(): saving password for " + prompt + " to password file");
pwdStore.putPassword(prompt, pwd);
pwdStore.commit();
CMS.debug("PublisherAdminServlet: setLDAPDest(): password saved");
-/* we'll shut down and restart the PublisherProcessor instead
- // what a hack to do this without require restart server
-// ILdapAuthInfo authInfo = CMS.getLdapAuthInfo();
- ILdapConnModule connModule = mProcessor.getLdapConnModule();
- ILdapAuthInfo authInfo = null;
- if (connModule != null) {
- authInfo = connModule.getLdapAuthInfo();
- }
+ /* we'll shut down and restart the PublisherProcessor instead
+ // what a hack to do this without require restart server
+ // ILdapAuthInfo authInfo = CMS.getLdapAuthInfo();
+ ILdapConnModule connModule = mProcessor.getLdapConnModule();
+ ILdapAuthInfo authInfo = null;
+ if (connModule != null) {
+ authInfo = connModule.getLdapAuthInfo();
+ }
-// authInfo.addPassword(PW_TAG_CA_LDAP_PUBLISHING, pwd);
- if (authInfo != null) {
- CMS.debug("PublisherAdminServlet: setLDAPDest(): adding password to memory cache");
- authInfo.addPassword(prompt, pwd);
- } else
- CMS.debug("PublisherAdminServlet: setLDAPDest(): authInfo null");
-*/
+ // authInfo.addPassword(PW_TAG_CA_LDAP_PUBLISHING, pwd);
+ if (authInfo != null) {
+ CMS.debug("PublisherAdminServlet: setLDAPDest(): adding password to memory cache");
+ authInfo.addPassword(prompt, pwd);
+ } else
+ CMS.debug("PublisherAdminServlet: setLDAPDest(): authInfo null");
+ */
try {
CMS.debug("PublisherAdminServlet: setLDAPDest(): restarting publishing processor");
@@ -618,7 +615,7 @@ public class PublisherAdminServlet extends AdminServlet {
}
private void testSetLDAPDest(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException, EBaseException {
+ throws ServletException, IOException, EBaseException {
NameValuePairs params = new NameValuePairs();
CMS.debug("PublisherAdmineServlet: in testSetLDAPDest");
@@ -629,8 +626,8 @@ public class PublisherAdminServlet extends AdminServlet {
IConfigStore ldap = ldapcfg.getSubStore(IPublisherProcessor.PROP_LDAP);
//set enable flag
- publishcfg.putString(IPublisherProcessor.PROP_ENABLE,
- req.getParameter(Constants.PR_PUBLISHING_ENABLE));
+ publishcfg.putString(IPublisherProcessor.PROP_ENABLE,
+ req.getParameter(Constants.PR_PUBLISHING_ENABLE));
String ldapPublish = req.getParameter(Constants.PR_ENABLE);
ldapcfg.putString(IPublisherProcessor.PROP_ENABLE, ldapPublish);
@@ -656,9 +653,9 @@ public class PublisherAdminServlet extends AdminServlet {
continue;
if (name.equals(Constants.PR_PUBLISHING_ENABLE))
continue;
- // don't store password in the config file.
- if (name.equals(Constants.PR_BIND_PASSWD))
- continue; // old style password read from config.
+ // don't store password in the config file.
+ if (name.equals(Constants.PR_BIND_PASSWD))
+ continue; // old style password read from config.
if (name.equals(Constants.PR_DIRECTORY_MANAGER_PWD)) {
pwd = req.getParameter(name);
continue;
@@ -687,22 +684,22 @@ public class PublisherAdminServlet extends AdminServlet {
/* Don't enter the publishing pw into the config store */
ldap.putString(name, req.getParameter(name));
}
-
+
// test before commit
if (publishcfg.getBoolean(IPublisherProcessor.PROP_ENABLE) &&
- ldapcfg.getBoolean(IPublisherProcessor.PROP_ENABLE)) {
- params.add("title",
- "You've attempted to configure CMS to connect" +
- " to a LDAP directory. The connection status is" +
- " as follows:\n \n");
+ ldapcfg.getBoolean(IPublisherProcessor.PROP_ENABLE)) {
+ params.add("title",
+ "You've attempted to configure CMS to connect" +
+ " to a LDAP directory. The connection status is" +
+ " as follows:\n \n");
LDAPConnection conn = null;
ILdapConnInfo connInfo =
- CMS.getLdapConnInfo(ldap.getSubStore(
- ILdapBoundConnFactory.PROP_LDAPCONNINFO));
+ CMS.getLdapConnInfo(ldap.getSubStore(
+ ILdapBoundConnFactory.PROP_LDAPCONNINFO));
//LdapAuthInfo authInfo =
//new LdapAuthInfo(ldap.getSubStore(
// ILdapBoundConnFactory.PROP_LDAPAUTHINFO));
- String host = connInfo.getHost();
+ String host = connInfo.getHost();
int port = connInfo.getPort();
boolean secure = connInfo.getSecure();
//int authType = authInfo.getAuthType();
@@ -720,51 +717,51 @@ public class PublisherAdminServlet extends AdminServlet {
conn = new LDAPConnection(CMS.getLdapJssSSLSocketFactory(
certNickName));
CMS.debug("Publishing Test certNickName=" + certNickName);
- params.add(Constants.PR_CONN_INITED,
- "Create ssl LDAPConnection with certificate: " +
- certNickName + dashes(70 - 44 - certNickName.length()) + " Success");
+ params.add(Constants.PR_CONN_INITED,
+ "Create ssl LDAPConnection with certificate: " +
+ certNickName + dashes(70 - 44 - certNickName.length()) + " Success");
} catch (Exception ex) {
- params.add(Constants.PR_CONN_INIT_FAIL,
- "Create ssl LDAPConnection with certificate: " +
- certNickName + dashes(70 - 44 - certNickName.length()) + " failure\n" + " exception: " + ex);
- params.add(Constants.PR_SAVE_NOT,
- "\n \nIf the problem is not fixed then LDAP publishing will fail.\n" +
- "Do you want to save the configuration anyway?");
+ params.add(Constants.PR_CONN_INIT_FAIL,
+ "Create ssl LDAPConnection with certificate: " +
+ certNickName + dashes(70 - 44 - certNickName.length()) + " failure\n" + " exception: " + ex);
+ params.add(Constants.PR_SAVE_NOT,
+ "\n \nIf the problem is not fixed then LDAP publishing will fail.\n" +
+ "Do you want to save the configuration anyway?");
sendResponse(SUCCESS, null, params, resp);
return;
}
try {
conn.connect(host, port);
- params.add(Constants.PR_CONN_OK,
- "Connect to directory server " +
- host + " at port " + port +
- dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Success");
- params.add(Constants.PR_AUTH_OK,
- "Authentication: SSL client authentication" +
- dashes(70 - 41) + " Success" +
- "\nBind to the directory as: " + certNickName +
- dashes(70 - 26 - certNickName.length()) + " Success");
+ params.add(Constants.PR_CONN_OK,
+ "Connect to directory server " +
+ host + " at port " + port +
+ dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Success");
+ params.add(Constants.PR_AUTH_OK,
+ "Authentication: SSL client authentication" +
+ dashes(70 - 41) + " Success" +
+ "\nBind to the directory as: " + certNickName +
+ dashes(70 - 26 - certNickName.length()) + " Success");
} catch (LDAPException ex) {
if (ex.getLDAPResultCode() == LDAPException.UNAVAILABLE) {
// need to intercept this because message from LDAP is
// "DSA is unavailable" which confuses with DSA PKI.
- params.add(Constants.PR_CONN_FAIL,
- "Connect to directory server " +
- host + " at port " + port +
- dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) +
- " Failure\n" +
- " error: server unavailable");
+ params.add(Constants.PR_CONN_FAIL,
+ "Connect to directory server " +
+ host + " at port " + port +
+ dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) +
+ " Failure\n" +
+ " error: server unavailable");
} else {
- params.add(Constants.PR_CONN_FAIL,
- "Connect to directory server " +
- host + " at port " + port +
- dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) +
- " Failure");
+ params.add(Constants.PR_CONN_FAIL,
+ "Connect to directory server " +
+ host + " at port " + port +
+ dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) +
+ " Failure");
}
- params.add(Constants.PR_SAVE_NOT,
- "\n \nIf the problem is not fixed then " +
- "LDAP publishing will fail.\n" +
- "Do you want to save the configuration anyway?");
+ params.add(Constants.PR_SAVE_NOT,
+ "\n \nIf the problem is not fixed then " +
+ "LDAP publishing will fail.\n" +
+ "Do you want to save the configuration anyway?");
sendResponse(SUCCESS, null, params, resp);
return;
}
@@ -773,53 +770,53 @@ public class PublisherAdminServlet extends AdminServlet {
if (secure) {
conn = new LDAPConnection(
CMS.getLdapJssSSLSocketFactory());
- params.add(Constants.PR_CONN_INITED,
- "Create ssl LDAPConnection" +
- dashes(70 - 25) + " Success");
+ params.add(Constants.PR_CONN_INITED,
+ "Create ssl LDAPConnection" +
+ dashes(70 - 25) + " Success");
} else {
conn = new LDAPConnection();
- params.add(Constants.PR_CONN_INITED,
- "Create LDAPConnection" +
- dashes(70 - 21) + " Success");
+ params.add(Constants.PR_CONN_INITED,
+ "Create LDAPConnection" +
+ dashes(70 - 21) + " Success");
}
} catch (Exception ex) {
- params.add(Constants.PR_CONN_INIT_FAIL,
- "Create LDAPConnection" +
- dashes(70 - 21) + " Failure\n" +
- "exception: " + ex);
- params.add(Constants.PR_SAVE_NOT,
- "\n \nIf the problem is not fixed then " +
- "LDAP publishing will fail.\n" +
- "Do you want to save the configuration anyway?");
+ params.add(Constants.PR_CONN_INIT_FAIL,
+ "Create LDAPConnection" +
+ dashes(70 - 21) + " Failure\n" +
+ "exception: " + ex);
+ params.add(Constants.PR_SAVE_NOT,
+ "\n \nIf the problem is not fixed then " +
+ "LDAP publishing will fail.\n" +
+ "Do you want to save the configuration anyway?");
sendResponse(SUCCESS, null, params, resp);
return;
}
try {
conn.connect(host, port);
- params.add(Constants.PR_CONN_OK,
- "Connect to directory server " +
- host + " at port " + port +
- dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Success");
+ params.add(Constants.PR_CONN_OK,
+ "Connect to directory server " +
+ host + " at port " + port +
+ dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Success");
} catch (LDAPException ex) {
if (ex.getLDAPResultCode() == LDAPException.UNAVAILABLE) {
// need to intercept this because message from LDAP is
// "DSA is unavailable" which confuses with DSA PKI.
- params.add(Constants.PR_CONN_FAIL,
- "Connect to directory server " +
- host + " at port " + port +
- dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Failure" +
- "\nerror: server unavailable");
+ params.add(Constants.PR_CONN_FAIL,
+ "Connect to directory server " +
+ host + " at port " + port +
+ dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Failure" +
+ "\nerror: server unavailable");
} else {
- params.add(Constants.PR_CONN_FAIL,
- "Connect to directory server " +
- host + " at port " + port +
- dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Failure" +
- "\nexception: " + ex);
+ params.add(Constants.PR_CONN_FAIL,
+ "Connect to directory server " +
+ host + " at port " + port +
+ dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Failure" +
+ "\nexception: " + ex);
}
- params.add(Constants.PR_SAVE_NOT,
- "\n \nIf the problem is not fixed then " +
- "LDAP publishing will fail.\n" +
- "Do you want to save the configuration anyway?");
+ params.add(Constants.PR_SAVE_NOT,
+ "\n \nIf the problem is not fixed then " +
+ "LDAP publishing will fail.\n" +
+ "Do you want to save the configuration anyway?");
sendResponse(SUCCESS, null, params, resp);
return;
}
@@ -828,44 +825,42 @@ public class PublisherAdminServlet extends AdminServlet {
bindAs = ldap.getSubStore(
ILdapBoundConnFactory.PROP_LDAPAUTHINFO).getString(ILdapAuthInfo.PROP_BINDDN);
conn.authenticate(version, bindAs, pwd);
- params.add(Constants.PR_AUTH_OK,
- "Authentication: Basic authentication" +
- dashes(70 - 36) + " Success" +
- "\nBind to the directory as: " + bindAs +
- dashes(70 - 26 - bindAs.length()) + " Success");
+ params.add(Constants.PR_AUTH_OK,
+ "Authentication: Basic authentication" +
+ dashes(70 - 36) + " Success" +
+ "\nBind to the directory as: " + bindAs +
+ dashes(70 - 26 - bindAs.length()) + " Success");
} catch (LDAPException ex) {
- if (ex.getLDAPResultCode() ==
- LDAPException.NO_SUCH_OBJECT) {
- params.add(Constants.PR_AUTH_FAIL,
- "Authentication: Basic authentication" +
- dashes(70 - 36) + "Failure" +
- "\nBind to the directory as: " + bindAs +
- dashes(70 - 26 - bindAs.length()) +
- "Failure" + "\nThe object doesn't exist. " +
- "Please correct the value assigned in the" +
- " \"Directory manager DN\" field.");
- } else if (ex.getLDAPResultCode() ==
- LDAPException.INVALID_CREDENTIALS) {
- params.add(Constants.PR_AUTH_FAIL,
- "Authentication: Basic authentication" +
- dashes(70 - 36) + " Failure" +
- "\nBind to the directory as: " + bindAs +
- dashes(70 - 26 - bindAs.length()) +
- " Failure" + "\nInvalid password. " +
- "Please correct the value assigned in the" +
- " \"Password\" field.");
+ if (ex.getLDAPResultCode() == LDAPException.NO_SUCH_OBJECT) {
+ params.add(Constants.PR_AUTH_FAIL,
+ "Authentication: Basic authentication" +
+ dashes(70 - 36) + "Failure" +
+ "\nBind to the directory as: " + bindAs +
+ dashes(70 - 26 - bindAs.length()) +
+ "Failure" + "\nThe object doesn't exist. " +
+ "Please correct the value assigned in the" +
+ " \"Directory manager DN\" field.");
+ } else if (ex.getLDAPResultCode() == LDAPException.INVALID_CREDENTIALS) {
+ params.add(Constants.PR_AUTH_FAIL,
+ "Authentication: Basic authentication" +
+ dashes(70 - 36) + " Failure" +
+ "\nBind to the directory as: " + bindAs +
+ dashes(70 - 26 - bindAs.length()) +
+ " Failure" + "\nInvalid password. " +
+ "Please correct the value assigned in the" +
+ " \"Password\" field.");
} else {
- params.add(Constants.PR_AUTH_FAIL,
- "Authentication: Basic authentication" +
- dashes(70 - 36) + " Failure" +
- "\nBind to the directory as: " + bindAs +
- dashes(70 - 26 - bindAs.length()) +
- " Failure");
+ params.add(Constants.PR_AUTH_FAIL,
+ "Authentication: Basic authentication" +
+ dashes(70 - 36) + " Failure" +
+ "\nBind to the directory as: " + bindAs +
+ dashes(70 - 26 - bindAs.length()) +
+ " Failure");
}
- params.add(Constants.PR_SAVE_NOT,
- "\n \nIf the problem is not fixed then " +
- "LDAP publishing will fail.\n" +
- "Do you want to save the configuration anyway?");
+ params.add(Constants.PR_SAVE_NOT,
+ "\n \nIf the problem is not fixed then " +
+ "LDAP publishing will fail.\n" +
+ "Do you want to save the configuration anyway?");
sendResponse(SUCCESS, null, params, resp);
return;
}
@@ -875,7 +870,7 @@ public class PublisherAdminServlet extends AdminServlet {
//commit(true);
if (ldapcfg.getBoolean(IPublisherProcessor.PROP_ENABLE) &&
- pwd != null) {
+ pwd != null) {
/* Do a "PUT" of the new pw to the watchdog"
** do not remove - cfu
@@ -886,28 +881,28 @@ public class PublisherAdminServlet extends AdminServlet {
// update passwordFile
String prompt = ldap.getString(Constants.PR_BINDPWD_PROMPT);
IPasswordStore pwdStore = CMS.getPasswordStore();
- CMS.debug("PublisherAdminServlet: testSetLDAPDest(): saving password for "+
- prompt + " to password file");
+ CMS.debug("PublisherAdminServlet: testSetLDAPDest(): saving password for " +
+ prompt + " to password file");
pwdStore.putPassword(prompt, pwd);
pwdStore.commit();
CMS.debug("PublisherAdminServlet: testSetLDAPDest(): password saved");
-/* we'll shut down and restart the PublisherProcessor instead
- // what a hack to do this without require restart server
-// ILdapAuthInfo authInfo = CMS.getLdapAuthInfo();
- ILdapConnModule connModule = mProcessor.getLdapConnModule();
- ILdapAuthInfo authInfo = null;
- if (connModule != null) {
- authInfo = connModule.getLdapAuthInfo();
- } else
- CMS.debug("PublisherAdminServlet: testSetLDAPDest(): connModule null");
-
-// authInfo.addPassword(PW_TAG_CA_LDAP_PUBLISHING, pwd);
- if (authInfo != null) {
- CMS.debug("PublisherAdminServlet: testSetLDAPDest(): adding password to memory cache");
- authInfo.addPassword(prompt, pwd);
- } else
- CMS.debug("PublisherAdminServlet: testSetLDAPDest(): authInfo null");
-*/
+ /* we'll shut down and restart the PublisherProcessor instead
+ // what a hack to do this without require restart server
+ // ILdapAuthInfo authInfo = CMS.getLdapAuthInfo();
+ ILdapConnModule connModule = mProcessor.getLdapConnModule();
+ ILdapAuthInfo authInfo = null;
+ if (connModule != null) {
+ authInfo = connModule.getLdapAuthInfo();
+ } else
+ CMS.debug("PublisherAdminServlet: testSetLDAPDest(): connModule null");
+
+ // authInfo.addPassword(PW_TAG_CA_LDAP_PUBLISHING, pwd);
+ if (authInfo != null) {
+ CMS.debug("PublisherAdminServlet: testSetLDAPDest(): adding password to memory cache");
+ authInfo.addPassword(prompt, pwd);
+ } else
+ CMS.debug("PublisherAdminServlet: testSetLDAPDest(): authInfo null");
+ */
}
//params.add(Constants.PR_SAVE_OK,
// "\n \nConfiguration changes are now committed.");
@@ -921,7 +916,7 @@ public class PublisherAdminServlet extends AdminServlet {
if (ldapcfg.getBoolean(IPublisherProcessor.PROP_ENABLE)) {
ICertAuthority authority = (ICertAuthority) mProcessor.getAuthority();
- if (!(authority instanceof ICertificateAuthority))
+ if (!(authority instanceof ICertificateAuthority))
return;
ICertificateAuthority ca = (ICertificateAuthority) authority;
@@ -929,26 +924,26 @@ public class PublisherAdminServlet extends AdminServlet {
try {
mProcessor.publishCACert(ca.getCACert());
CMS.debug("PublisherAdminServlet: " + CMS.getLogMessage("ADMIN_SRVLT_PUB_CA_CERT"));
- params.add("publishCA",
- "CA certificate is published.");
+ params.add("publishCA",
+ "CA certificate is published.");
} catch (Exception ex) {
// exception not thrown - not seen as a fatal error.
- log(ILogger.LL_FAILURE,
- CMS.getLogMessage("ADMIN_SRVLT_NO_PUB_CA_CERT", ex.toString()));
- params.add("publishCA",
- "Failed to publish CA certificate.");
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("ADMIN_SRVLT_NO_PUB_CA_CERT", ex.toString()));
+ params.add("publishCA",
+ "Failed to publish CA certificate.");
int index = ex.toString().indexOf("Failed to create CA");
if (index > -1) {
params.add("createError",
- ex.toString().substring(index));
+ ex.toString().substring(index));
}
mProcessor.shutdown();
// Do you want to enable LDAP publishing anyway
- params.add(Constants.PR_SAVE_NOT,
- "\n \nIf the problem is not fixed then " +
- "the CA certificate won't be published.\n" +
- "Do you want to enable LDAP publishing anyway?");
+ params.add(Constants.PR_SAVE_NOT,
+ "\n \nIf the problem is not fixed then " +
+ "the CA certificate won't be published.\n" +
+ "Do you want to enable LDAP publishing anyway?");
sendResponse(SUCCESS, null, params, resp);
return;
@@ -958,65 +953,65 @@ public class PublisherAdminServlet extends AdminServlet {
CMS.debug("PublisherAdminServlet: about to update CRL");
ca.publishCRLNow();
CMS.debug(CMS.getLogMessage("ADMIN_SRVLT_PUB_CRL"));
- params.add("publishCRL",
- "CRL is published.");
+ params.add("publishCRL",
+ "CRL is published.");
} catch (Exception ex) {
// exception not thrown - not seen as a fatal error.
- log(ILogger.LL_FAILURE,
- "Could not publish crl " + ex.toString());
- params.add("publishCRL",
- "Failed to publish CRL.");
+ log(ILogger.LL_FAILURE,
+ "Could not publish crl " + ex.toString());
+ params.add("publishCRL",
+ "Failed to publish CRL.");
mProcessor.shutdown();
// Do you want to enable LDAP publishing anyway
- params.add(Constants.PR_SAVE_NOT,
- "\n \nIf the problem is not fixed then " +
- "the CRL won't be published.\n" +
- "Do you want to enable LDAP publishing anyway?");
+ params.add(Constants.PR_SAVE_NOT,
+ "\n \nIf the problem is not fixed then " +
+ "the CRL won't be published.\n" +
+ "Do you want to enable LDAP publishing anyway?");
sendResponse(SUCCESS, null, params, resp);
return;
}
}
commit(true);
- params.add(Constants.PR_SAVE_OK,
- "\n \nConfiguration changes are now committed.");
+ params.add(Constants.PR_SAVE_OK,
+ "\n \nConfiguration changes are now committed.");
params.add("restarted", "Publishing is restarted.");
} else {
commit(true);
- params.add(Constants.PR_SAVE_OK,
- "\n \nConfiguration changes are now committed.");
- params.add("stopped",
- "Publishing is stopped.");
+ params.add(Constants.PR_SAVE_OK,
+ "\n \nConfiguration changes are now committed.");
+ params.add("stopped",
+ "Publishing is stopped.");
}
//XXX See if we can dynamically in B2
sendResponse(SUCCESS, null, params, resp);
}
- private synchronized void addMapperPlugin(HttpServletRequest req,
- HttpServletResponse resp, String scope)
- throws ServletException, IOException, EBaseException {
+ private synchronized void addMapperPlugin(HttpServletRequest req,
+ HttpServletResponse resp, String scope)
+ throws ServletException, IOException, EBaseException {
String id = req.getParameter(Constants.RS_ID);
if (id == null) {
//System.out.println("SRVLT_NULL_RS_ID");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
+ null, resp);
return;
}
// is the manager id unique?
if (mProcessor.getMapperPlugins().containsKey((Object) id)) {
sendResponse(ERROR,
- new ELdapException(CMS.getUserMessage(getLocale(req),"CMS_LDAP_SRVLT_ILL_PLUGIN_ID", id)).toString(),
- null, resp);
+ new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_SRVLT_ILL_PLUGIN_ID", id)).toString(),
+ null, resp);
return;
}
String classPath = req.getParameter(Constants.PR_MAPPER_CLASS);
if (classPath == null) {
- sendResponse(ERROR, CMS.getUserMessage(getLocale(req),"CMS_LDAP_SRVLT_NULL_CLASS"), null, resp);
+ sendResponse(ERROR, CMS.getUserMessage(getLocale(req), "CMS_LDAP_SRVLT_NULL_CLASS"), null, resp);
return;
}
@@ -1059,8 +1054,8 @@ public class PublisherAdminServlet extends AdminServlet {
} catch (EBaseException e) {
//System.out.println("SRVLT_FAIL_COMMIT");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
+ null, resp);
return;
}
@@ -1068,8 +1063,8 @@ public class PublisherAdminServlet extends AdminServlet {
MapperPlugin plugin = new MapperPlugin(id, classPath);
mProcessor.getMapperPlugins().put(id, plugin);
- mProcessor.log(ILogger.LL_INFO,
- CMS.getLogMessage("ADMIN_SRVLT_MAPPER_ADDED", ""));
+ mProcessor.log(ILogger.LL_INFO,
+ CMS.getLogMessage("ADMIN_SRVLT_MAPPER_ADDED", ""));
NameValuePairs params = new NameValuePairs();
@@ -1087,27 +1082,27 @@ public class PublisherAdminServlet extends AdminServlet {
return true;
}
- private synchronized void addMapperInst(HttpServletRequest req,
- HttpServletResponse resp, String scope)
- throws ServletException, IOException, EBaseException {
+ private synchronized void addMapperInst(HttpServletRequest req,
+ HttpServletResponse resp, String scope)
+ throws ServletException, IOException, EBaseException {
String id = req.getParameter(Constants.RS_ID);
if (id == null) {
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
+ null, resp);
return;
}
if (!isValidID(id)) {
- sendResponse(ERROR, "Invalid ID '" + id + "'",
- null, resp);
+ sendResponse(ERROR, "Invalid ID '" + id + "'",
+ null, resp);
return;
}
if (mProcessor.getMapperInsts().containsKey((Object) id)) {
sendResponse(ERROR, CMS.getUserMessage(getLocale(req), "CMS_LDAP_SRVLT_ILL_INST_ID", id),
- null, resp);
+ null, resp);
return;
}
@@ -1122,13 +1117,13 @@ public class PublisherAdminServlet extends AdminServlet {
// check if implementation exists.
MapperPlugin plugin =
- (MapperPlugin) mProcessor.getMapperPlugins().get(
- implname);
+ (MapperPlugin) mProcessor.getMapperPlugins().get(
+ implname);
if (plugin == null) {
sendResponse(ERROR,
- new EMapperPluginNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_MAPPER_PLUGIN_NOT_FOUND", implname)).toString(),
- null, resp);
+ new EMapperPluginNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_MAPPER_PLUGIN_NOT_FOUND", implname)).toString(),
+ null, resp);
return;
}
@@ -1145,11 +1140,11 @@ public class PublisherAdminServlet extends AdminServlet {
String val = req.getParameter(kv.substring(0, index));
if (val == null) {
- substore.put(kv.substring(0, index),
- kv.substring(index + 1));
+ substore.put(kv.substring(0, index),
+ kv.substring(index + 1));
} else {
- substore.put(kv.substring(0, index),
- val);
+ substore.put(kv.substring(0, index),
+ val);
}
}
}
@@ -1165,20 +1160,20 @@ public class PublisherAdminServlet extends AdminServlet {
// cleanup
instancesConfig.removeSubStore(id);
sendResponse(ERROR,
- new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
- null, resp);
+ new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
+ null, resp);
return;
} catch (InstantiationException e) {
instancesConfig.removeSubStore(id);
sendResponse(ERROR,
- new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
- null, resp);
+ new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
+ null, resp);
return;
} catch (IllegalAccessException e) {
instancesConfig.removeSubStore(id);
sendResponse(ERROR,
- new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
- null, resp);
+ new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
+ null, resp);
return;
}
@@ -1203,46 +1198,46 @@ public class PublisherAdminServlet extends AdminServlet {
// clean up.
instancesConfig.removeSubStore(id);
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
+ null, resp);
return;
}
// inited and commited ok. now add mapper instance to list.
mProcessor.getMapperInsts().put(id, new MapperProxy(true, mapperInst));
- mProcessor.log(ILogger.LL_INFO,
- CMS.getLogMessage("ADMIN_SRVLT_MAPPER_INST_ADDED", id));
+ mProcessor.log(ILogger.LL_INFO,
+ CMS.getLogMessage("ADMIN_SRVLT_MAPPER_INST_ADDED", id));
NameValuePairs params = new NameValuePairs();
params.add(Constants.PR_MAPPER_IMPL_NAME, implname);
sendResponse(SUCCESS, null, params, resp);
return;
- }
+ }
- private synchronized void listMapperPlugins(HttpServletRequest req,
- HttpServletResponse resp) throws ServletException,
+ private synchronized void listMapperPlugins(HttpServletRequest req,
+ HttpServletResponse resp) throws ServletException,
IOException, EBaseException {
NameValuePairs params = new NameValuePairs();
Enumeration e = mProcessor.getMapperPlugins().keys();
while (e.hasMoreElements()) {
String name = (String) e.nextElement();
- MapperPlugin value = (MapperPlugin)
- mProcessor.getMapperPlugins().get(name);
+ MapperPlugin value = (MapperPlugin)
+ mProcessor.getMapperPlugins().get(name);
// get Description
- String c = value.getClassPath();
+ String c = value.getClassPath();
String desc = "unknown";
try {
ILdapMapper lp = (ILdapMapper)
- Class.forName(c).newInstance();
+ Class.forName(c).newInstance();
desc = lp.getDescription();
} catch (Exception exp) {
- sendResponse(ERROR, exp.toString(), null,
- resp);
+ sendResponse(ERROR, exp.toString(), null,
+ resp);
return;
}
params.add(name, value.getClassPath() + "," + desc);
@@ -1261,8 +1256,8 @@ public class PublisherAdminServlet extends AdminServlet {
}
}
- private synchronized void listMapperInsts(HttpServletRequest req,
- HttpServletResponse resp) throws ServletException,
+ private synchronized void listMapperInsts(HttpServletRequest req,
+ HttpServletResponse resp) throws ServletException,
IOException, EBaseException {
NameValuePairs params = new NameValuePairs();
@@ -1278,25 +1273,25 @@ public class PublisherAdminServlet extends AdminServlet {
return;
}
- private synchronized void delMapperInst(HttpServletRequest req,
- HttpServletResponse resp, String scope)
- throws ServletException, IOException, EBaseException {
+ private synchronized void delMapperInst(HttpServletRequest req,
+ HttpServletResponse resp, String scope)
+ throws ServletException, IOException, EBaseException {
NameValuePairs params = new NameValuePairs();
String id = req.getParameter(Constants.RS_ID);
if (id == null) {
//System.out.println("SRVLT_NULL_RS_ID");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
+ null, resp);
return;
}
// does a`mapper instance exist?
if (mProcessor.getMapperInsts().containsKey(id) == false) {
sendResponse(ERROR,
- new EMapperNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_MAPPER_NOT_FOUND", id)).toString(),
- null, resp);
+ new EMapperNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_MAPPER_NOT_FOUND", id)).toString(),
+ null, resp);
return;
}
@@ -1304,14 +1299,14 @@ public class PublisherAdminServlet extends AdminServlet {
// cannot shutdown because we don't keep track of whether it's
// being used.
ILdapMapper mapperInst = (ILdapMapper)
- mProcessor.getMapperInstance(id);
+ mProcessor.getMapperInstance(id);
mProcessor.getMapperInsts().remove((Object) id);
// remove the configuration.
IConfigStore destStore =
- mConfig.getSubStore(
- mAuth.getId() + ".publish.mapper");
+ mConfig.getSubStore(
+ mAuth.getId() + ".publish.mapper");
IConfigStore instancesConfig = destStore.getSubStore("instance");
instancesConfig.removeSubStore(id);
@@ -1321,39 +1316,38 @@ public class PublisherAdminServlet extends AdminServlet {
} catch (EBaseException e) {
//System.out.println("SRVLT_FAIL_COMMIT");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
+ null, resp);
return;
}
sendResponse(SUCCESS, null, params, resp);
return;
- }
+ }
- private synchronized void delMapperPlugin(HttpServletRequest req,
- HttpServletResponse resp, String scope)
- throws ServletException, IOException, EBaseException {
+ private synchronized void delMapperPlugin(HttpServletRequest req,
+ HttpServletResponse resp, String scope)
+ throws ServletException, IOException, EBaseException {
NameValuePairs params = new NameValuePairs();
String id = req.getParameter(Constants.RS_ID);
if (id == null) {
//System.out.println("SRVLT_NULL_RS_ID");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
+ null, resp);
return;
}
if (mProcessor.getMapperPlugins().containsKey(id) == false) {
sendResponse(ERROR,
- new EMapperPluginNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_MAPPER_PLUGIN_NOT_FOUND", id)).toString(),
- null, resp);
+ new EMapperPluginNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_MAPPER_PLUGIN_NOT_FOUND", id)).toString(),
+ null, resp);
return;
}
// first check if any instances from this mapper
// DON'T remove mapper if any instance
- for (Enumeration e = mProcessor.getMapperInsts().keys();
- e.hasMoreElements();) {
+ for (Enumeration e = mProcessor.getMapperInsts().keys(); e.hasMoreElements();) {
String name = (String) e.nextElement();
ILdapMapper mapper = mProcessor.getMapperInstance(name);
@@ -1362,15 +1356,15 @@ public class PublisherAdminServlet extends AdminServlet {
return;
}
}
-
+
// then delete this mapper
mProcessor.getMapperPlugins().remove((Object) id);
IConfigStore destStore =
- mConfig.getSubStore(
- mAuth.getId() + ".publish.mapper");
+ mConfig.getSubStore(
+ mAuth.getId() + ".publish.mapper");
IConfigStore instancesConfig =
- destStore.getSubStore("impl");
+ destStore.getSubStore("impl");
instancesConfig.removeSubStore(id);
// commiting
@@ -1378,26 +1372,26 @@ public class PublisherAdminServlet extends AdminServlet {
mConfig.commit(true);
} catch (EBaseException e) {
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
+ null, resp);
return;
}
sendResponse(SUCCESS, null, params, resp);
return;
- }
+ }
- private synchronized void getMapperConfig(HttpServletRequest req,
- HttpServletResponse resp)
- throws ServletException, IOException, EBaseException {
+ private synchronized void getMapperConfig(HttpServletRequest req,
+ HttpServletResponse resp)
+ throws ServletException, IOException, EBaseException {
String implname = req.getParameter(Constants.RS_ID);
if (implname == null) {
//System.out.println("SRVLT_NULL_RS_ID");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
+ null, resp);
return;
}
@@ -1411,50 +1405,50 @@ public class PublisherAdminServlet extends AdminServlet {
String kv = (String) configParams.elementAt(i);
int index = kv.indexOf('=');
- params.add(kv.substring(0, index),
- kv.substring(index + 1));
+ params.add(kv.substring(0, index),
+ kv.substring(index + 1));
}
}
sendResponse(0, null, params, resp);
return;
}
- private synchronized void getMapperInstConfig(HttpServletRequest req,
- HttpServletResponse resp) throws ServletException,
+ private synchronized void getMapperInstConfig(HttpServletRequest req,
+ HttpServletResponse resp) throws ServletException,
IOException, EBaseException {
String id = req.getParameter(Constants.RS_ID);
if (id == null) {
//System.out.println("SRVLT_NULL_RS_ID");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
+ null, resp);
return;
}
// does mapper instance exist?
if (mProcessor.getMapperInsts().containsKey(id) == false) {
sendResponse(ERROR,
- new EMapperNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_MAPPER_NOT_FOUND", id)).toString(),
- null, resp);
+ new EMapperNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_MAPPER_NOT_FOUND", id)).toString(),
+ null, resp);
return;
}
ILdapMapper mapperInst = (ILdapMapper)
- mProcessor.getMapperInstance(id);
+ mProcessor.getMapperInstance(id);
Vector configParams = mapperInst.getInstanceParams();
NameValuePairs params = new NameValuePairs();
- params.add(Constants.PR_MAPPER_IMPL_NAME,
- getMapperPluginName(mapperInst));
+ params.add(Constants.PR_MAPPER_IMPL_NAME,
+ getMapperPluginName(mapperInst));
// implName is always required so always send it.
if (configParams != null) {
for (int i = 0; i < configParams.size(); i++) {
String kv = (String) configParams.elementAt(i);
int index = kv.indexOf('=');
- params.add(kv.substring(0, index),
- kv.substring(index + 1));
+ params.add(kv.substring(0, index),
+ kv.substring(index + 1));
}
}
@@ -1462,24 +1456,24 @@ public class PublisherAdminServlet extends AdminServlet {
return;
}
- private synchronized void modMapperInst(HttpServletRequest req,
- HttpServletResponse resp, String scope)
- throws ServletException, IOException, EBaseException {
+ private synchronized void modMapperInst(HttpServletRequest req,
+ HttpServletResponse resp, String scope)
+ throws ServletException, IOException, EBaseException {
String id = req.getParameter(Constants.RS_ID);
if (id == null) {
//System.out.println("SRVLT_NULL_RS_ID");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
+ null, resp);
return;
}
// Does the manager instance exist?
if (!mProcessor.getMapperInsts().containsKey((Object) id)) {
sendResponse(ERROR, CMS.getUserMessage(getLocale(req), "CMS_LDAP_SRVLT_ILL_INST_ID", id),
- null, resp);
+ null, resp);
return;
}
@@ -1492,19 +1486,19 @@ public class PublisherAdminServlet extends AdminServlet {
}
// get plugin for implementation
MapperPlugin plugin =
- (MapperPlugin) mProcessor.getMapperPlugins().get(implname);
+ (MapperPlugin) mProcessor.getMapperPlugins().get(implname);
if (plugin == null) {
sendResponse(ERROR,
- new EMapperPluginNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_MAPPER_PLUGIN_NOT_FOUND", implname)).toString(),
- null, resp);
+ new EMapperPluginNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_MAPPER_PLUGIN_NOT_FOUND", implname)).toString(),
+ null, resp);
return;
}
// save old instance substore params in case new one fails.
ILdapMapper oldinst =
- (ILdapMapper) mProcessor.getMapperInstance(id);
+ (ILdapMapper) mProcessor.getMapperInstance(id);
Vector oldConfigParms = oldinst.getInstanceParams();
NameValuePairs saveParams = new NameValuePairs();
@@ -1516,7 +1510,7 @@ public class PublisherAdminServlet extends AdminServlet {
int index = kv.indexOf('=');
saveParams.add(kv.substring(0, index),
- kv.substring(index + 1));
+ kv.substring(index + 1));
}
}
@@ -1525,8 +1519,8 @@ public class PublisherAdminServlet extends AdminServlet {
// remove old substore.
IConfigStore destStore =
- mConfig.getSubStore(mAuth.getId() +
- ".publish.mapper");
+ mConfig.getSubStore(mAuth.getId() +
+ ".publish.mapper");
IConfigStore instancesConfig = destStore.getSubStore("instance");
// create new substore.
@@ -1557,26 +1551,26 @@ public class PublisherAdminServlet extends AdminServlet {
ILdapMapper newMgrInst = null;
try {
- newMgrInst = (ILdapMapper)
+ newMgrInst = (ILdapMapper)
Class.forName(className).newInstance();
} catch (ClassNotFoundException e) {
// cleanup
restore(instancesConfig, id, saveParams);
sendResponse(ERROR,
- new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
- null, resp);
+ new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
+ null, resp);
return;
} catch (InstantiationException e) {
restore(instancesConfig, id, saveParams);
sendResponse(ERROR,
- new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
- null, resp);
+ new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
+ null, resp);
return;
} catch (IllegalAccessException e) {
restore(instancesConfig, id, saveParams);
sendResponse(ERROR,
- new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
- null, resp);
+ new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
+ null, resp);
return;
}
// initialize the mapper
@@ -1586,13 +1580,13 @@ public class PublisherAdminServlet extends AdminServlet {
} catch (EBaseException e) {
// don't commit in this case and cleanup the new substore.
restore(instancesConfig, id, saveParams);
- sendResponse(ERROR, e.toString(getLocale(req)), null,
- resp);
+ sendResponse(ERROR, e.toString(getLocale(req)), null,
+ resp);
return;
} catch (Throwable e) {
restore(instancesConfig, id, saveParams);
- sendResponse(ERROR, e.toString(), null,
- resp);
+ sendResponse(ERROR, e.toString(), null,
+ resp);
return;
}
@@ -1604,8 +1598,8 @@ public class PublisherAdminServlet extends AdminServlet {
restore(instancesConfig, id, saveParams);
//System.out.println("SRVLT_FAIL_COMMIT");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
+ null, resp);
return;
}
@@ -1614,31 +1608,31 @@ public class PublisherAdminServlet extends AdminServlet {
mProcessor.getMapperInsts().put(id, new MapperProxy(true, newMgrInst));
mProcessor.log(ILogger.LL_INFO,
- CMS.getLogMessage("ADMIN_SRVLT_MAPPER_REPLACED", id));
+ CMS.getLogMessage("ADMIN_SRVLT_MAPPER_REPLACED", id));
NameValuePairs params = new NameValuePairs();
sendResponse(SUCCESS, null, params, resp);
return;
}
- private synchronized void addRulePlugin(HttpServletRequest req,
- HttpServletResponse resp, String scope)
- throws ServletException, IOException, EBaseException {
+ private synchronized void addRulePlugin(HttpServletRequest req,
+ HttpServletResponse resp, String scope)
+ throws ServletException, IOException, EBaseException {
String id = req.getParameter(Constants.RS_ID);
if (id == null) {
//System.out.println("SRVLT_NULL_RS_ID");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
+ null, resp);
return;
}
// is the rule id unique?
if (mProcessor.getRulePlugins().containsKey((Object) id)) {
sendResponse(ERROR,
- new ELdapException(CMS.getUserMessage("CMS_LDAP_SRVLT_ILL_PLUGIN_ID", id)).toString(getLocale(req)),
- null, resp);
+ new ELdapException(CMS.getUserMessage("CMS_LDAP_SRVLT_ILL_PLUGIN_ID", id)).toString(getLocale(req)),
+ null, resp);
return;
}
@@ -1689,8 +1683,8 @@ public class PublisherAdminServlet extends AdminServlet {
} catch (EBaseException e) {
//System.out.println("SRVLT_FAIL_COMMIT");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
+ null, resp);
return;
}
@@ -1698,8 +1692,8 @@ public class PublisherAdminServlet extends AdminServlet {
RulePlugin plugin = new RulePlugin(id, classPath);
mProcessor.getRulePlugins().put(id, plugin);
- mProcessor.log(ILogger.LL_INFO,
- CMS.getLogMessage("ADMIN_SRVLT_RULE_PLUG_ADDED", id));
+ mProcessor.log(ILogger.LL_INFO,
+ CMS.getLogMessage("ADMIN_SRVLT_RULE_PLUG_ADDED", id));
NameValuePairs params = new NameValuePairs();
@@ -1707,26 +1701,26 @@ public class PublisherAdminServlet extends AdminServlet {
return;
}
- private synchronized void addRuleInst(HttpServletRequest req,
- HttpServletResponse resp, String scope)
- throws ServletException, IOException, EBaseException {
+ private synchronized void addRuleInst(HttpServletRequest req,
+ HttpServletResponse resp, String scope)
+ throws ServletException, IOException, EBaseException {
String id = req.getParameter(Constants.RS_ID);
if (id == null) {
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
+ null, resp);
return;
}
if (!isValidID(id)) {
- sendResponse(ERROR, "Invalid ID '" + id + "'",
- null, resp);
+ sendResponse(ERROR, "Invalid ID '" + id + "'",
+ null, resp);
return;
}
if (mProcessor.getRuleInsts().containsKey((Object) id)) {
sendResponse(ERROR, CMS.getUserMessage(getLocale(req), "CMS_LDAP_SRVLT_ILL_INST_ID", id),
- null, resp);
+ null, resp);
return;
}
@@ -1741,23 +1735,23 @@ public class PublisherAdminServlet extends AdminServlet {
// check if implementation exists.
RulePlugin plugin =
- (RulePlugin) mProcessor.getRulePlugins().get(
- implname);
+ (RulePlugin) mProcessor.getRulePlugins().get(
+ implname);
if (plugin == null) {
sendResponse(ERROR,
- new EPublisherPluginNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_PUBLISHER_PLUGIN_NOT_FOUND", implname)).toString(),
- null, resp);
+ new EPublisherPluginNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_PUBLISHER_PLUGIN_NOT_FOUND", implname)).toString(),
+ null, resp);
return;
}
Vector configParams = mProcessor.getRuleDefaultParams(implname);
IConfigStore destStore =
- mConfig.getSubStore(mAuth.getId()
- + ".publish.rule");
+ mConfig.getSubStore(mAuth.getId()
+ + ".publish.rule");
IConfigStore instancesConfig =
- destStore.getSubStore("instance");
+ destStore.getSubStore("instance");
IConfigStore substore = instancesConfig.makeSubStore(id);
if (configParams != null) {
@@ -1767,13 +1761,13 @@ public class PublisherAdminServlet extends AdminServlet {
String val = req.getParameter(kv.substring(0, index));
if (val == null) {
- substore.put(kv.substring(0, index),
- kv.substring(index + 1));
+ substore.put(kv.substring(0, index),
+ kv.substring(index + 1));
} else {
if (val.equals(NOMAPPER))
val = "";
- substore.put(kv.substring(0, index),
- val);
+ substore.put(kv.substring(0, index),
+ val);
}
}
}
@@ -1789,20 +1783,20 @@ public class PublisherAdminServlet extends AdminServlet {
// cleanup
instancesConfig.removeSubStore(id);
sendResponse(ERROR,
- new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
- null, resp);
+ new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
+ null, resp);
return;
} catch (InstantiationException e) {
instancesConfig.removeSubStore(id);
sendResponse(ERROR,
- new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
- null, resp);
+ new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
+ null, resp);
return;
} catch (IllegalAccessException e) {
instancesConfig.removeSubStore(id);
sendResponse(ERROR,
- new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
- null, resp);
+ new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
+ null, resp);
return;
}
@@ -1828,40 +1822,40 @@ public class PublisherAdminServlet extends AdminServlet {
// clean up.
instancesConfig.removeSubStore(id);
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
+ null, resp);
return;
}
// inited and commited ok. now add manager instance to list.
mProcessor.getRuleInsts().put(id, ruleInst);
- mProcessor.log(ILogger.LL_INFO,
- CMS.getLogMessage("ADMIN_SRVLT_RULE_INST_ADDED", id));
+ mProcessor.log(ILogger.LL_INFO,
+ CMS.getLogMessage("ADMIN_SRVLT_RULE_INST_ADDED", id));
NameValuePairs params = new NameValuePairs();
params.add(Constants.PR_RULE_IMPL_NAME, implname);
sendResponse(SUCCESS, null, params, resp);
return;
- }
+ }
- private synchronized void listRulePlugins(HttpServletRequest req,
- HttpServletResponse resp) throws ServletException,
+ private synchronized void listRulePlugins(HttpServletRequest req,
+ HttpServletResponse resp) throws ServletException,
IOException, EBaseException {
NameValuePairs params = new NameValuePairs();
Enumeration e = mProcessor.getRulePlugins().keys();
while (e.hasMoreElements()) {
String name = (String) e.nextElement();
- RulePlugin value = (RulePlugin)
- mProcessor.getRulePlugins().get(name);
+ RulePlugin value = (RulePlugin)
+ mProcessor.getRulePlugins().get(name);
// get Description
- String c = value.getClassPath();
+ String c = value.getClassPath();
String desc = "unknown";
try {
ILdapRule lp = (ILdapRule)
- Class.forName(c).newInstance();
+ Class.forName(c).newInstance();
desc = lp.getDescription();
} catch (Exception exp) {
@@ -1872,8 +1866,8 @@ public class PublisherAdminServlet extends AdminServlet {
return;
}
- private synchronized void listRuleInsts(HttpServletRequest req,
- HttpServletResponse resp) throws ServletException,
+ private synchronized void listRuleInsts(HttpServletRequest req,
+ HttpServletResponse resp) throws ServletException,
IOException, EBaseException {
NameValuePairs params = new NameValuePairs();
String insts = null;
@@ -1881,8 +1875,8 @@ public class PublisherAdminServlet extends AdminServlet {
for (; e.hasMoreElements();) {
String name = (String) e.nextElement();
- ILdapRule value = (ILdapRule)
- mProcessor.getRuleInsts().get((Object) name);
+ ILdapRule value = (ILdapRule)
+ mProcessor.getRuleInsts().get((Object) name);
String enabled = value.enabled() ? "enabled" : "disabled";
params.add(name, value.getInstanceName() + ";visible;" + enabled);
@@ -1901,47 +1895,46 @@ public class PublisherAdminServlet extends AdminServlet {
}
}
- private synchronized void delRulePlugin(HttpServletRequest req,
- HttpServletResponse resp, String scope)
- throws ServletException, IOException, EBaseException {
+ private synchronized void delRulePlugin(HttpServletRequest req,
+ HttpServletResponse resp, String scope)
+ throws ServletException, IOException, EBaseException {
NameValuePairs params = new NameValuePairs();
String id = req.getParameter(Constants.RS_ID);
if (id == null) {
//System.out.println("SRVLT_NULL_RS_ID");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
+ null, resp);
return;
}
// does rule exist?
if (mProcessor.getRulePlugins().containsKey(id) == false) {
sendResponse(ERROR,
- new ERulePluginNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_RULE_PLUGIN_NOT_FOUND", id)).toString(),
- null, resp);
+ new ERulePluginNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_RULE_PLUGIN_NOT_FOUND", id)).toString(),
+ null, resp);
return;
}
// first check if any instances from this rule
// DON'T remove rule if any instance
- for (Enumeration e = mProcessor.getRuleInsts().elements();
- e.hasMoreElements();) {
- ILdapRule rule = (ILdapRule)
- e.nextElement();
+ for (Enumeration e = mProcessor.getRuleInsts().elements(); e.hasMoreElements();) {
+ ILdapRule rule = (ILdapRule)
+ e.nextElement();
if (id.equals(getRulePluginName(rule))) {
sendResponse(ERROR, CMS.getUserMessage(getLocale(req), "CMS_LDAP_SRVLT_IN_USE"), null, resp);
return;
}
}
-
+
// then delete this rule
mProcessor.getRulePlugins().remove((Object) id);
IConfigStore destStore =
- mConfig.getSubStore(
- mAuth.getId() + ".rule");
+ mConfig.getSubStore(
+ mAuth.getId() + ".rule");
IConfigStore instancesConfig = destStore.getSubStore("impl");
instancesConfig.removeSubStore(id);
@@ -1950,26 +1943,26 @@ public class PublisherAdminServlet extends AdminServlet {
mConfig.commit(true);
} catch (EBaseException e) {
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
+ null, resp);
return;
}
sendResponse(SUCCESS, null, params, resp);
return;
- }
+ }
- private synchronized void delRuleInst(HttpServletRequest req,
- HttpServletResponse resp, String scope)
- throws ServletException, IOException, EBaseException {
+ private synchronized void delRuleInst(HttpServletRequest req,
+ HttpServletResponse resp, String scope)
+ throws ServletException, IOException, EBaseException {
NameValuePairs params = new NameValuePairs();
String id = req.getParameter(Constants.RS_ID);
if (id == null) {
//System.out.println("SRVLT_NULL_RS_ID");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
+ null, resp);
return;
}
@@ -1978,8 +1971,8 @@ public class PublisherAdminServlet extends AdminServlet {
// does rule instance exist?
if (mProcessor.getRuleInsts().containsKey(id) == false) {
sendResponse(ERROR,
- new ERuleNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_RULE_NOT_FOUND", id)).toString(),
- null, resp);
+ new ERuleNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_RULE_NOT_FOUND", id)).toString(),
+ null, resp);
return;
}
@@ -1987,14 +1980,14 @@ public class PublisherAdminServlet extends AdminServlet {
// cannot shutdown because we don't keep track of whether it's
// being used.
ILdapRule ruleInst = (ILdapRule)
- mProcessor.getRuleInsts().get(id);
+ mProcessor.getRuleInsts().get(id);
mProcessor.getRuleInsts().remove((Object) id);
// remove the configuration.
IConfigStore destStore =
- mConfig.getSubStore(
- mAuth.getId() + ".publish.rule");
+ mConfig.getSubStore(
+ mAuth.getId() + ".publish.rule");
IConfigStore instancesConfig = destStore.getSubStore("instance");
instancesConfig.removeSubStore(id);
@@ -2004,24 +1997,24 @@ public class PublisherAdminServlet extends AdminServlet {
} catch (EBaseException e) {
//System.out.println("SRVLT_FAIL_COMMIT");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
+ null, resp);
return;
}
sendResponse(SUCCESS, null, params, resp);
return;
- }
+ }
- private synchronized void getRuleConfig(HttpServletRequest req,
- HttpServletResponse resp)
- throws ServletException, IOException, EBaseException {
+ private synchronized void getRuleConfig(HttpServletRequest req,
+ HttpServletResponse resp)
+ throws ServletException, IOException, EBaseException {
String implname = req.getParameter(Constants.RS_ID);
if (implname == null) {
//System.out.println("SRVLT_NULL_RS_ID");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
+ null, resp);
return;
}
@@ -2035,50 +2028,50 @@ public class PublisherAdminServlet extends AdminServlet {
String kv = (String) configParams.elementAt(i);
int index = kv.indexOf('=');
- params.add(kv.substring(0, index),
- kv.substring(index + 1));
+ params.add(kv.substring(0, index),
+ kv.substring(index + 1));
}
}
sendResponse(0, null, params, resp);
return;
}
- private synchronized void getRuleInstConfig(HttpServletRequest req,
- HttpServletResponse resp) throws ServletException,
+ private synchronized void getRuleInstConfig(HttpServletRequest req,
+ HttpServletResponse resp) throws ServletException,
IOException, EBaseException {
String id = req.getParameter(Constants.RS_ID);
if (id == null) {
//System.out.println("SRVLT_NULL_RS_ID");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
+ null, resp);
return;
}
// does rule instance exist?
if (mProcessor.getRuleInsts().containsKey(id) == false) {
sendResponse(ERROR,
- new ERuleNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_RULE_NOT_FOUND", id)).toString(),
- null, resp);
+ new ERuleNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_RULE_NOT_FOUND", id)).toString(),
+ null, resp);
return;
}
ILdapRule ruleInst = (ILdapRule)
- mProcessor.getRuleInsts().get(id);
+ mProcessor.getRuleInsts().get(id);
Vector configParams = ruleInst.getInstanceParams();
NameValuePairs params = new NameValuePairs();
- params.add(Constants.PR_RULE_IMPL_NAME,
- getRulePluginName(ruleInst));
+ params.add(Constants.PR_RULE_IMPL_NAME,
+ getRulePluginName(ruleInst));
// implName is always required so always send it.
if (configParams != null) {
for (int i = 0; i < configParams.size(); i++) {
String kv = (String) configParams.elementAt(i);
int index = kv.indexOf('=');
- params.add(kv.substring(0, index),
- kv.substring(index + 1));
+ params.add(kv.substring(0, index),
+ kv.substring(index + 1));
}
}
@@ -2086,23 +2079,23 @@ public class PublisherAdminServlet extends AdminServlet {
return;
}
- private synchronized void modRuleInst(HttpServletRequest req,
- HttpServletResponse resp, String scope)
- throws ServletException, IOException, EBaseException {
+ private synchronized void modRuleInst(HttpServletRequest req,
+ HttpServletResponse resp, String scope)
+ throws ServletException, IOException, EBaseException {
String id = req.getParameter(Constants.RS_ID);
if (id == null) {
//System.out.println("SRVLT_NULL_RS_ID");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
+ null, resp);
return;
}
// Does the manager instance exist?
if (!mProcessor.getRuleInsts().containsKey((Object) id)) {
sendResponse(ERROR, CMS.getUserMessage(getLocale(req), "CMS_LDAP_SRVLT_ILL_INST_ID", id),
- null, resp);
+ null, resp);
return;
}
@@ -2116,20 +2109,20 @@ public class PublisherAdminServlet extends AdminServlet {
// get plugin for implementation
RulePlugin plugin =
- (RulePlugin) mProcessor.getRulePlugins().get(implname);
+ (RulePlugin) mProcessor.getRulePlugins().get(implname);
if (plugin == null) {
sendResponse(ERROR,
- //new ERulePluginNotFound(implname).toString(getLocale(req)),
- "",
- null, resp);
+ //new ERulePluginNotFound(implname).toString(getLocale(req)),
+ "",
+ null, resp);
return;
}
// save old instance substore params in case new one fails.
- ILdapRule oldinst =
- (ILdapRule) mProcessor.getRuleInsts().get((Object) id);
+ ILdapRule oldinst =
+ (ILdapRule) mProcessor.getRuleInsts().get((Object) id);
Vector oldConfigParms = oldinst.getInstanceParams();
NameValuePairs saveParams = new NameValuePairs();
@@ -2141,7 +2134,7 @@ public class PublisherAdminServlet extends AdminServlet {
int index = kv.indexOf('=');
saveParams.add(kv.substring(0, index),
- kv.substring(index + 1));
+ kv.substring(index + 1));
}
}
@@ -2150,8 +2143,8 @@ public class PublisherAdminServlet extends AdminServlet {
// remove old substore.
IConfigStore destStore =
- mConfig.getSubStore(
- mAuth.getId() + ".publish.rule");
+ mConfig.getSubStore(
+ mAuth.getId() + ".publish.rule");
IConfigStore instancesConfig = destStore.getSubStore("instance");
// create new substore.
@@ -2171,8 +2164,8 @@ public class PublisherAdminServlet extends AdminServlet {
String val = req.getParameter(key);
if (val == null) {
- substore.put(key,
- kv.substring(index + 1));
+ substore.put(key,
+ kv.substring(index + 1));
} else {
if (val.equals(NOMAPPER))
val = "";
@@ -2192,20 +2185,20 @@ public class PublisherAdminServlet extends AdminServlet {
// cleanup
restore(instancesConfig, id, saveParams);
sendResponse(ERROR,
- new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
- null, resp);
+ new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
+ null, resp);
return;
} catch (InstantiationException e) {
restore(instancesConfig, id, saveParams);
sendResponse(ERROR,
- new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
- null, resp);
+ new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
+ null, resp);
return;
} catch (IllegalAccessException e) {
restore(instancesConfig, id, saveParams);
sendResponse(ERROR,
- new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
- null, resp);
+ new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
+ null, resp);
return;
}
@@ -2232,8 +2225,8 @@ public class PublisherAdminServlet extends AdminServlet {
restore(instancesConfig, id, saveParams);
//System.out.println("SRVLT_FAIL_COMMIT");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
+ null, resp);
return;
}
@@ -2241,40 +2234,40 @@ public class PublisherAdminServlet extends AdminServlet {
mProcessor.getRuleInsts().put(id, newRuleInst);
- mProcessor.log(ILogger.LL_INFO,
- CMS.getLogMessage("ADMIN_SRVLT_RULE_INST_REP", id));
+ mProcessor.log(ILogger.LL_INFO,
+ CMS.getLogMessage("ADMIN_SRVLT_RULE_INST_REP", id));
NameValuePairs params = new NameValuePairs();
sendResponse(SUCCESS, null, params, resp);
return;
}
- private synchronized void addPublisherPlugin(HttpServletRequest req,
- HttpServletResponse resp, String scope)
- throws ServletException, IOException, EBaseException {
+ private synchronized void addPublisherPlugin(HttpServletRequest req,
+ HttpServletResponse resp, String scope)
+ throws ServletException, IOException, EBaseException {
String id = req.getParameter(Constants.RS_ID);
if (id == null) {
//System.out.println("SRVLT_NULL_RS_ID");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
+ null, resp);
return;
}
// is the manager id unique?
if (mProcessor.getPublisherPlugins().containsKey((Object) id)) {
sendResponse(ERROR,
- new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_SRVLT_ILL_PLUGIN_ID", id)).toString(),
- null, resp);
+ new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_SRVLT_ILL_PLUGIN_ID", id)).toString(),
+ null, resp);
return;
}
String classPath = req.getParameter(Constants.PR_PUBLISHER_CLASS);
if (classPath == null) {
- sendResponse(ERROR, CMS.getUserMessage(getLocale(req),"CMS_LDAP_SRVLT_NULL_CLASS"), null, resp);
+ sendResponse(ERROR, CMS.getUserMessage(getLocale(req), "CMS_LDAP_SRVLT_NULL_CLASS"), null, resp);
return;
}
@@ -2318,8 +2311,8 @@ public class PublisherAdminServlet extends AdminServlet {
} catch (EBaseException e) {
//System.out.println("SRVLT_FAIL_COMMIT");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
+ null, resp);
return;
}
@@ -2327,8 +2320,8 @@ public class PublisherAdminServlet extends AdminServlet {
PublisherPlugin plugin = new PublisherPlugin(id, classPath);
mProcessor.getPublisherPlugins().put(id, plugin);
- mProcessor.log(ILogger.LL_INFO,
- CMS.getLogMessage("ADMIN_SRVLT_PUB_PLUG_ADDED", id));
+ mProcessor.log(ILogger.LL_INFO,
+ CMS.getLogMessage("ADMIN_SRVLT_PUB_PLUG_ADDED", id));
NameValuePairs params = new NameValuePairs();
@@ -2336,28 +2329,28 @@ public class PublisherAdminServlet extends AdminServlet {
return;
}
- private synchronized void addPublisherInst(HttpServletRequest req,
- HttpServletResponse resp, String scope)
- throws ServletException, IOException, EBaseException {
+ private synchronized void addPublisherInst(HttpServletRequest req,
+ HttpServletResponse resp, String scope)
+ throws ServletException, IOException, EBaseException {
String id = req.getParameter(Constants.RS_ID);
if (id == null) {
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
+ null, resp);
return;
}
if (!isValidID(id)) {
- sendResponse(ERROR, "Invalid ID '" + id + "'",
- null, resp);
+ sendResponse(ERROR, "Invalid ID '" + id + "'",
+ null, resp);
return;
}
if (mProcessor.getPublisherInsts().containsKey((Object) id)) {
sendResponse(ERROR, CMS.getUserMessage(getLocale(req), "CMS_LDAP_SRVLT_ILL_INST_ID", id),
- null, resp);
+ null, resp);
return;
}
@@ -2372,20 +2365,20 @@ public class PublisherAdminServlet extends AdminServlet {
// check if implementation exists.
PublisherPlugin plugin =
- (PublisherPlugin) mProcessor.getPublisherPlugins().get(
- implname);
+ (PublisherPlugin) mProcessor.getPublisherPlugins().get(
+ implname);
if (plugin == null) {
sendResponse(ERROR,
- new EPublisherPluginNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_PUBLISHER_PLUGIN_NOT_FOUND", implname)).toString(),
- null, resp);
+ new EPublisherPluginNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_PUBLISHER_PLUGIN_NOT_FOUND", implname)).toString(),
+ null, resp);
return;
}
Vector configParams = mProcessor.getPublisherDefaultParams(implname);
IConfigStore destStore =
- mConfig.getSubStore(mAuth.getId() + ".publish.publisher");
+ mConfig.getSubStore(mAuth.getId() + ".publish.publisher");
IConfigStore instancesConfig = destStore.getSubStore("instance");
IConfigStore substore = instancesConfig.makeSubStore(id);
@@ -2404,15 +2397,15 @@ public class PublisherAdminServlet extends AdminServlet {
if (index == -1) {
substore.put(kv, "");
} else {
- substore.put(kv.substring(0, index),
- kv.substring(index + 1));
+ substore.put(kv.substring(0, index),
+ kv.substring(index + 1));
}
} else {
if (index == -1) {
substore.put(kv, val);
} else {
- substore.put(kv.substring(0, index),
- val);
+ substore.put(kv.substring(0, index),
+ val);
}
}
}
@@ -2429,20 +2422,20 @@ public class PublisherAdminServlet extends AdminServlet {
// cleanup
instancesConfig.removeSubStore(id);
sendResponse(ERROR,
- new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
- null, resp);
+ new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
+ null, resp);
return;
} catch (InstantiationException e) {
instancesConfig.removeSubStore(id);
sendResponse(ERROR,
- new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
- null, resp);
+ new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
+ null, resp);
return;
} catch (IllegalAccessException e) {
instancesConfig.removeSubStore(id);
sendResponse(ERROR,
- new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
- null, resp);
+ new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
+ null, resp);
return;
}
@@ -2467,16 +2460,16 @@ public class PublisherAdminServlet extends AdminServlet {
// clean up.
instancesConfig.removeSubStore(id);
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
+ null, resp);
return;
}
// inited and commited ok. now add manager instance to list.
mProcessor.getPublisherInsts().put(id, new PublisherProxy(true, publisherInst));
- mProcessor.log(ILogger.LL_INFO,
- CMS.getLogMessage("ADMIN_SRVLT_PUB_INST_ADDED", id));
+ mProcessor.log(ILogger.LL_INFO,
+ CMS.getLogMessage("ADMIN_SRVLT_PUB_INST_ADDED", id));
NameValuePairs params = new NameValuePairs();
@@ -2485,8 +2478,8 @@ public class PublisherAdminServlet extends AdminServlet {
return;
}
- private synchronized void listPublisherPlugins(HttpServletRequest req,
- HttpServletResponse resp) throws ServletException,
+ private synchronized void listPublisherPlugins(HttpServletRequest req,
+ HttpServletResponse resp) throws ServletException,
IOException, EBaseException {
NameValuePairs params = new NameValuePairs();
@@ -2494,15 +2487,15 @@ public class PublisherAdminServlet extends AdminServlet {
while (e.hasMoreElements()) {
String name = (String) e.nextElement();
- PublisherPlugin value = (PublisherPlugin)
- mProcessor.getPublisherPlugins().get(name);
+ PublisherPlugin value = (PublisherPlugin)
+ mProcessor.getPublisherPlugins().get(name);
// get Description
- String c = value.getClassPath();
+ String c = value.getClassPath();
String desc = "unknown";
try {
ILdapPublisher lp = (ILdapPublisher)
- Class.forName(c).newInstance();
+ Class.forName(c).newInstance();
desc = lp.getDescription();
} catch (Exception exp) {
@@ -2523,8 +2516,8 @@ public class PublisherAdminServlet extends AdminServlet {
}
}
- private synchronized void listPublisherInsts(HttpServletRequest req,
- HttpServletResponse resp) throws ServletException,
+ private synchronized void listPublisherInsts(HttpServletRequest req,
+ HttpServletResponse resp) throws ServletException,
IOException, EBaseException {
NameValuePairs params = new NameValuePairs();
@@ -2543,8 +2536,8 @@ public class PublisherAdminServlet extends AdminServlet {
return;
}
- private synchronized void delPublisherPlugin(HttpServletRequest req,
- HttpServletResponse resp, String scope) throws ServletException,
+ private synchronized void delPublisherPlugin(HttpServletRequest req,
+ HttpServletResponse resp, String scope) throws ServletException,
IOException, EBaseException {
NameValuePairs params = new NameValuePairs();
@@ -2553,38 +2546,37 @@ public class PublisherAdminServlet extends AdminServlet {
if (id == null) {
//System.out.println("SRVLT_NULL_RS_ID");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
+ null, resp);
return;
}
// does publisher exist?
if (mProcessor.getPublisherPlugins().containsKey(id) == false) {
sendResponse(ERROR,
- new EPublisherPluginNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_PUBLISHER_PLUGIN_NOT_FOUND", id)).toString(),
- null, resp);
+ new EPublisherPluginNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_PUBLISHER_PLUGIN_NOT_FOUND", id)).toString(),
+ null, resp);
return;
}
// first check if any instances from this publisher
// DON'T remove publisher if any instance
- for (Enumeration e = mProcessor.getPublisherInsts().keys();
- e.hasMoreElements();) {
+ for (Enumeration e = mProcessor.getPublisherInsts().keys(); e.hasMoreElements();) {
String name = (String) e.nextElement();
- ILdapPublisher publisher =
- mProcessor.getPublisherInstance(name);
+ ILdapPublisher publisher =
+ mProcessor.getPublisherInstance(name);
if (id.equals(getPublisherPluginName(publisher))) {
sendResponse(ERROR, CMS.getUserMessage(getLocale(req), "CMS_LDAP_SRVLT_IN_USE"), null, resp);
return;
}
}
-
+
// then delete this publisher
mProcessor.getPublisherPlugins().remove((Object) id);
IConfigStore destStore =
- mConfig.getSubStore(mAuth.getId() + ".publish.publisher");
+ mConfig.getSubStore(mAuth.getId() + ".publish.publisher");
IConfigStore instancesConfig = destStore.getSubStore("impl");
instancesConfig.removeSubStore(id);
@@ -2593,8 +2585,8 @@ public class PublisherAdminServlet extends AdminServlet {
mConfig.commit(true);
} catch (EBaseException e) {
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
+ null, resp);
return;
}
@@ -2602,8 +2594,8 @@ public class PublisherAdminServlet extends AdminServlet {
return;
}
- private synchronized void delPublisherInst(HttpServletRequest req,
- HttpServletResponse resp, String scope) throws ServletException,
+ private synchronized void delPublisherInst(HttpServletRequest req,
+ HttpServletResponse resp, String scope) throws ServletException,
IOException, EBaseException {
NameValuePairs params = new NameValuePairs();
@@ -2612,8 +2604,8 @@ public class PublisherAdminServlet extends AdminServlet {
if (id == null) {
//System.out.println("SRVLT_NULL_RS_ID");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
+ null, resp);
return;
}
@@ -2622,8 +2614,8 @@ public class PublisherAdminServlet extends AdminServlet {
// does publisher instance exist?
if (mProcessor.getPublisherInsts().containsKey(id) == false) {
sendResponse(ERROR,
- new EPublisherNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_PUBLISHER_NOT_FOUND", id)).toString(),
- null, resp);
+ new EPublisherNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_PUBLISHER_NOT_FOUND", id)).toString(),
+ null, resp);
return;
}
@@ -2636,7 +2628,7 @@ public class PublisherAdminServlet extends AdminServlet {
// remove the configuration.
IConfigStore destStore =
- mConfig.getSubStore(mAuth.getId() + ".publish.publisher");
+ mConfig.getSubStore(mAuth.getId() + ".publish.publisher");
IConfigStore instancesConfig = destStore.getSubStore("instance");
instancesConfig.removeSubStore(id);
@@ -2646,8 +2638,8 @@ public class PublisherAdminServlet extends AdminServlet {
} catch (EBaseException e) {
//System.out.println("SRVLT_FAIL_COMMIT");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
+ null, resp);
return;
}
sendResponse(SUCCESS, null, params, resp);
@@ -2656,24 +2648,24 @@ public class PublisherAdminServlet extends AdminServlet {
/**
* used for getting the required configuration parameters (with
- * possible default values) for a particular plugin
- * implementation name specified in the RS_ID. Actually, there is
- * no logic in here to set any default value here...there's no
- * default value for any parameter in this publishing subsystem
- * at this point. Later, if we do have one (or some), it can be
- * added. The interface remains the same.
+ * possible default values) for a particular plugin
+ * implementation name specified in the RS_ID. Actually, there is
+ * no logic in here to set any default value here...there's no
+ * default value for any parameter in this publishing subsystem
+ * at this point. Later, if we do have one (or some), it can be
+ * added. The interface remains the same.
*/
- private synchronized void getConfig(HttpServletRequest req,
- HttpServletResponse resp)
- throws ServletException, IOException, EBaseException {
+ private synchronized void getConfig(HttpServletRequest req,
+ HttpServletResponse resp)
+ throws ServletException, IOException, EBaseException {
String implname = req.getParameter(Constants.RS_ID);
if (implname == null) {
//System.out.println("SRVLT_NULL_RS_ID");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
+ null, resp);
return;
}
@@ -2690,8 +2682,8 @@ public class PublisherAdminServlet extends AdminServlet {
if (index == -1) {
params.add(kv, "");
} else {
- params.add(kv.substring(0, index),
- kv.substring(index + 1));
+ params.add(kv.substring(0, index),
+ kv.substring(index + 1));
}
}
}
@@ -2699,8 +2691,8 @@ public class PublisherAdminServlet extends AdminServlet {
return;
}
- private synchronized void getInstConfig(HttpServletRequest req,
- HttpServletResponse resp) throws ServletException,
+ private synchronized void getInstConfig(HttpServletRequest req,
+ HttpServletResponse resp) throws ServletException,
IOException, EBaseException {
String id = req.getParameter(Constants.RS_ID);
@@ -2708,34 +2700,34 @@ public class PublisherAdminServlet extends AdminServlet {
if (id == null) {
//System.out.println("SRVLT_NULL_RS_ID");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
+ null, resp);
return;
}
// does publisher instance exist?
if (mProcessor.getPublisherInsts().containsKey(id) == false) {
sendResponse(ERROR,
- new EPublisherNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_PUBLISHER_NOT_FOUND", id)).toString(),
- null, resp);
+ new EPublisherNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_PUBLISHER_NOT_FOUND", id)).toString(),
+ null, resp);
return;
}
ILdapPublisher publisherInst = (ILdapPublisher)
- mProcessor.getPublisherInstance(id);
+ mProcessor.getPublisherInstance(id);
Vector configParams = publisherInst.getInstanceParams();
NameValuePairs params = new NameValuePairs();
- params.add(Constants.PR_PUBLISHER_IMPL_NAME,
- getPublisherPluginName(publisherInst));
+ params.add(Constants.PR_PUBLISHER_IMPL_NAME,
+ getPublisherPluginName(publisherInst));
// implName is always required so always send it.
if (configParams != null) {
for (int i = 0; i < configParams.size(); i++) {
String kv = (String) configParams.elementAt(i);
int index = kv.indexOf('=');
- params.add(kv.substring(0, index),
- kv.substring(index + 1));
+ params.add(kv.substring(0, index),
+ kv.substring(index + 1));
}
}
@@ -2745,15 +2737,15 @@ public class PublisherAdminServlet extends AdminServlet {
/**
* Modify publisher instance.
- * This will actually create a new instance with new configuration
- * parameters and replace the old instance, if the new instance
+ * This will actually create a new instance with new configuration
+ * parameters and replace the old instance, if the new instance
* created and initialized successfully.
* The old instance is left running. so this is very expensive.
* Restart of server recommended.
*/
- private synchronized void modPublisherInst(HttpServletRequest req,
- HttpServletResponse resp, String scope)
- throws ServletException, IOException, EBaseException {
+ private synchronized void modPublisherInst(HttpServletRequest req,
+ HttpServletResponse resp, String scope)
+ throws ServletException, IOException, EBaseException {
// expensive operation.
@@ -2762,15 +2754,15 @@ public class PublisherAdminServlet extends AdminServlet {
if (id == null) {
//System.out.println("SRVLT_NULL_RS_ID");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_NULL_RS_ID"),
+ null, resp);
return;
}
// Does the manager instance exist?
if (!mProcessor.getPublisherInsts().containsKey((Object) id)) {
sendResponse(ERROR, CMS.getUserMessage(getLocale(req), "CMS_LDAP_SRVLT_ILL_INST_ID", id),
- null, resp);
+ null, resp);
return;
}
@@ -2784,12 +2776,12 @@ public class PublisherAdminServlet extends AdminServlet {
// get plugin for implementation
PublisherPlugin plugin =
- (PublisherPlugin) mProcessor.getPublisherPlugins().get(implname);
+ (PublisherPlugin) mProcessor.getPublisherPlugins().get(implname);
if (plugin == null) {
sendResponse(ERROR,
- new EPublisherPluginNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_PUBLISHER_PLUGIN_NOT_FOUND", implname)).toString(),
- null, resp);
+ new EPublisherPluginNotFound(CMS.getUserMessage(getLocale(req), "CMS_LDAP_PUBLISHER_PLUGIN_NOT_FOUND", implname)).toString(),
+ null, resp);
return;
}
@@ -2813,8 +2805,8 @@ public class PublisherAdminServlet extends AdminServlet {
pubType = "crl";
}
- saveParams.add(kv.substring(0, index),
- kv.substring(index + 1));
+ saveParams.add(kv.substring(0, index),
+ kv.substring(index + 1));
}
}
}
@@ -2824,7 +2816,7 @@ public class PublisherAdminServlet extends AdminServlet {
// remove old substore.
IConfigStore destStore =
- mConfig.getSubStore(mAuth.getId() + ".publish.publisher");
+ mConfig.getSubStore(mAuth.getId() + ".publish.publisher");
IConfigStore instancesConfig = destStore.getSubStore("instance");
// get objects added and deleted
@@ -2859,9 +2851,9 @@ public class PublisherAdminServlet extends AdminServlet {
}
// process any changes to the ldap object class definitions
- if (pubType.equals("cacert")) {
+ if (pubType.equals("cacert")) {
processChangedOC(saveParams, substore, "caObjectClass");
- substore.put("pubtype", "cacert");
+ substore.put("pubtype", "cacert");
}
if (pubType.equals("crl")) {
@@ -2880,20 +2872,20 @@ public class PublisherAdminServlet extends AdminServlet {
// cleanup
restore(instancesConfig, id, saveParams);
sendResponse(ERROR,
- new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
- null, resp);
+ new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
+ null, resp);
return;
} catch (InstantiationException e) {
restore(instancesConfig, id, saveParams);
sendResponse(ERROR,
- new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
- null, resp);
+ new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
+ null, resp);
return;
} catch (IllegalAccessException e) {
restore(instancesConfig, id, saveParams);
sendResponse(ERROR,
- new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
- null, resp);
+ new ELdapException(CMS.getUserMessage(getLocale(req), "CMS_LDAP_FAIL_LOAD_CLASS", className)).toString(),
+ null, resp);
return;
}
@@ -2920,8 +2912,8 @@ public class PublisherAdminServlet extends AdminServlet {
restore(instancesConfig, id, saveParams);
//System.out.println("SRVLT_FAIL_COMMIT");
sendResponse(ERROR,
- CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
- null, resp);
+ CMS.getUserMessage(getLocale(req), "CMS_ADMIN_SRVLT_COMMIT_FAILED"),
+ null, resp);
return;
}
@@ -2929,8 +2921,8 @@ public class PublisherAdminServlet extends AdminServlet {
mProcessor.getPublisherInsts().put(id, new PublisherProxy(true, newMgrInst));
- mProcessor.log(ILogger.LL_INFO,
- CMS.getLogMessage("ADMIN_SRVLT_PUB_INST_REP", id));
+ mProcessor.log(ILogger.LL_INFO,
+ CMS.getLogMessage("ADMIN_SRVLT_PUB_INST_REP", id));
NameValuePairs params = new NameValuePairs();
@@ -2941,51 +2933,54 @@ public class PublisherAdminServlet extends AdminServlet {
// convenience function - takes list1, list2. Returns what is in list1
// but not in list2
private String[] getExtras(String[] list1, String[] list2) {
- Vector <String> extras = new Vector<String>();
- for (int i=0; i< list1.length; i++) {
- boolean match=false;
- for (int j=0; j < list2.length; j++) {
- if ((list1[i].trim()).equalsIgnoreCase(list2[j].trim())) {
- match = true;
- break;
- }
- }
- if (!match) extras.add(list1[i].trim());
- }
-
- return (String[])extras.toArray(new String[extras.size()]);
+ Vector<String> extras = new Vector<String>();
+ for (int i = 0; i < list1.length; i++) {
+ boolean match = false;
+ for (int j = 0; j < list2.length; j++) {
+ if ((list1[i].trim()).equalsIgnoreCase(list2[j].trim())) {
+ match = true;
+ break;
+ }
+ }
+ if (!match)
+ extras.add(list1[i].trim());
+ }
+
+ return (String[]) extras.toArray(new String[extras.size()]);
}
// convenience function - takes list1, list2. Concatenates the two
// lists removing duplicates
private String[] joinLists(String[] list1, String[] list2) {
- Vector <String> sum = new Vector<String>();
- for (int i=0; i< list1.length; i++) {
- sum.add(list1[i]);
- }
-
- for (int i=0; i < list2.length; i++) {
- boolean match=false;
- for (int j=0; j < list1.length; j++) {
- if ((list2[i].trim()).equalsIgnoreCase(list1[j].trim())) {
- match = true;
- break;
- }
- }
- if (!match) sum.add(list2[i].trim());
- }
-
- return (String[])sum.toArray(new String[sum.size()]);
+ Vector<String> sum = new Vector<String>();
+ for (int i = 0; i < list1.length; i++) {
+ sum.add(list1[i]);
+ }
+
+ for (int i = 0; i < list2.length; i++) {
+ boolean match = false;
+ for (int j = 0; j < list1.length; j++) {
+ if ((list2[i].trim()).equalsIgnoreCase(list1[j].trim())) {
+ match = true;
+ break;
+ }
+ }
+ if (!match)
+ sum.add(list2[i].trim());
+ }
+
+ return (String[]) sum.toArray(new String[sum.size()]);
}
// convenience funtion. Takes a string array and delimiter
// and returns a String with the concatenation
private static String join(String[] s, String delimiter) {
- if (s.length == 0) return "";
+ if (s.length == 0)
+ return "";
StringBuffer buffer = new StringBuffer(s[0]);
if (s.length > 1) {
- for (int i=1; i< s.length; i++) {
+ for (int i = 1; i < s.length; i++) {
buffer.append(delimiter).append(s[i].trim());
}
}
@@ -3005,29 +3000,31 @@ public class PublisherAdminServlet extends AdminServlet {
oldAdded = saveParams.getValue(objName + "Added");
oldDeleted = saveParams.getValue(objName + "Deleted");
- if ((oldOC == null) || (newOC == null)) return;
- if (oldOC.equalsIgnoreCase(newOC)) return;
+ if ((oldOC == null) || (newOC == null))
+ return;
+ if (oldOC.equalsIgnoreCase(newOC))
+ return;
- String [] oldList = oldOC.split(",");
- String [] newList = newOC.split(",");
- String [] deletedList = getExtras(oldList, newList);
- String [] addedList = getExtras(newList, oldList);
+ String[] oldList = oldOC.split(",");
+ String[] newList = newOC.split(",");
+ String[] deletedList = getExtras(oldList, newList);
+ String[] addedList = getExtras(newList, oldList);
// CMS.debug("addedList = " + join(addedList, ","));
// CMS.debug("deletedList = " + join(deletedList, ","));
- if ((addedList.length ==0) && (deletedList.length == 0))
- return; // no changes
+ if ((addedList.length == 0) && (deletedList.length == 0))
+ return; // no changes
if (oldAdded != null) {
// CMS.debug("oldAdded is " + oldAdded);
- String [] oldAddedList = oldAdded.split(",");
+ String[] oldAddedList = oldAdded.split(",");
addedList = joinLists(addedList, oldAddedList);
}
if (oldDeleted != null) {
// CMS.debug("oldDeleted is " + oldDeleted);
- String [] oldDeletedList = oldDeleted.split(",");
+ String[] oldDeletedList = oldDeleted.split(",");
deletedList = joinLists(deletedList, oldDeletedList);
}
@@ -3046,8 +3043,8 @@ public class PublisherAdminServlet extends AdminServlet {
}
// convenience routine.
- private static void restore(IConfigStore store,
- String id, NameValuePairs saveParams) {
+ private static void restore(IConfigStore store,
+ String id, NameValuePairs saveParams) {
store.removeSubStore(id);
IConfigStore rstore = store.makeSubStore(id);
@@ -3057,7 +3054,7 @@ public class PublisherAdminServlet extends AdminServlet {
String key = (String) keys.nextElement();
String value = saveParams.getValue(key);
- if (value != null)
+ if (value != null)
rstore.put(key, value);
}
}
@@ -3078,7 +3075,7 @@ public class PublisherAdminServlet extends AdminServlet {
public void log(int level, String msg) {
if (mLogger == null)
return;
- mLogger.log(ILogger.EV_SYSTEM,
- ILogger.S_LDAP, level, "PublishingAdminServlet: " + msg);
+ mLogger.log(ILogger.EV_SYSTEM,
+ ILogger.S_LDAP, level, "PublishingAdminServlet: " + msg);
}
}