From 171aaece4f23709d33d180cf36eb3af5e454b0c9 Mon Sep 17 00:00:00 2001 From: Ade Lee Date: Thu, 8 Dec 2011 21:15:59 -0500 Subject: Revert "Formatting" This reverts commit 32150d3ee32f8ac27118af7c792794b538c78a2f. --- .../com/netscape/cms/jobs/RequestInQueueJob.java | 122 ++++++++++++--------- 1 file changed, 70 insertions(+), 52 deletions(-) (limited to 'pki/base/common/src/com/netscape/cms/jobs/RequestInQueueJob.java') diff --git a/pki/base/common/src/com/netscape/cms/jobs/RequestInQueueJob.java b/pki/base/common/src/com/netscape/cms/jobs/RequestInQueueJob.java index f68d554b9..07a35a9d7 100644 --- a/pki/base/common/src/com/netscape/cms/jobs/RequestInQueueJob.java +++ b/pki/base/common/src/com/netscape/cms/jobs/RequestInQueueJob.java @@ -17,6 +17,7 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cms.jobs; + import java.text.DateFormat; import java.util.Date; import java.util.Locale; @@ -36,75 +37,85 @@ import com.netscape.certsrv.request.IRequestQueue; import com.netscape.certsrv.request.RequestId; import com.netscape.certsrv.request.RequestStatus; + /** - * A job for the Jobs Scheduler. This job checks in the internal ldap db for - * requests currently in the request queue and send a summary report to the - * administrator + * A job for the Jobs Scheduler. This job checks in the internal ldap + * db for requests currently in the request queue and send a summary + * report to the administrator *

* the $TOKENS that are available for the this jobs's summary outer form are:
*

- * + * * @version $Revision$, $Date$ * @see com.netscape.certsrv.jobs.IJob * @see com.netscape.cms.jobs.AJobBase */ -public class RequestInQueueJob extends AJobBase implements IJob, Runnable, - IExtendedPluginInfo { +public class RequestInQueueJob extends AJobBase + implements IJob, Runnable, IExtendedPluginInfo { protected static final String PROP_SUBSYSTEM_ID = "subsystemId"; IAuthority mSub = null; IRequestQueue mReqQ = null; private boolean mSummary = false; - /* - * Holds configuration parameters accepted by this implementation. This list - * is passed to the configuration console so configuration for instances of - * this implementation can be configured through the console. + /* Holds configuration parameters accepted by this implementation. + * This list is passed to the configuration console so configuration + * for instances of this implementation can be configured through the + * console. */ - protected static String[] mConfigParams = new String[] { "enabled", "cron", - "subsystemId", "summary.enabled", "summary.emailSubject", - "summary.emailTemplate", "summary.senderEmail", - "summary.recipientEmail" }; + protected static String[] mConfigParams = + new String[] { + "enabled", + "cron", + "subsystemId", + "summary.enabled", + "summary.emailSubject", + "summary.emailTemplate", + "summary.senderEmail", + "summary.recipientEmail" + }; /** * holds help text for this plugin */ public String[] getExtendedPluginInfo(Locale locale) { String s[] = { - IExtendedPluginInfo.HELP_TEXT - + "; A job that checks for enrollment requests in the " - + "queue, and reports to recipientEmail", - "cron;string;Format: minute hour dayOfMonth month " - + "dayOfWeek. Use '*' for 'every'. For dayOfWeek, 0 is Sunday", - "summary.senderEmail;string;Specify the address to be used " - + "as the email's 'sender'. Bounces go to this address.", + IExtendedPluginInfo.HELP_TEXT + + "; A job that checks for enrollment requests in the " + + "queue, and reports to recipientEmail", + "cron;string;Format: minute hour dayOfMonth month " + + "dayOfWeek. Use '*' for 'every'. For dayOfWeek, 0 is Sunday", + "summary.senderEmail;string;Specify the address to be used " + + "as the email's 'sender'. Bounces go to this address.", "summary.recipientEmail;string;Who should receive summaries", "enabled;boolean;Enable this plugin", - "summary.enabled;boolean;Enable the summary. You must enabled " - + "this for the job to work.", + "summary.enabled;boolean;Enable the summary. You must enabled " + + "this for the job to work.", "summary.emailSubject;string;Subject of summary email", - "summary.emailTemplate;string;Fully qualified pathname of " - + "template file of email to be sent", - "subsystemId;choice(ca,ra);The type of subsystem this job is " - + "for", - IExtendedPluginInfo.HELP_TOKEN - + ";configuration-jobrules-requestinqueuejob", }; + "summary.emailTemplate;string;Fully qualified pathname of " + + "template file of email to be sent", + "subsystemId;choice(ca,ra);The type of subsystem this job is " + + "for", + IExtendedPluginInfo.HELP_TOKEN + + ";configuration-jobrules-requestinqueuejob", + }; return s; } - + /** * initialize from the configuration file - * * @param id String name of this instance * @param implName string name of this implementation * @param config configuration store for this instance * @exception EBaseException */ - public void init(ISubsystem owner, String id, String implName, - IConfigStore config) throws EBaseException { + public void init(ISubsystem owner, String id, String implName, IConfigStore config) throws + EBaseException { mConfig = config; mId = id; mImplName = implName; @@ -112,7 +123,8 @@ public class RequestInQueueJob extends AJobBase implements IJob, Runnable, // read from the configuration file String sub = mConfig.getString(PROP_SUBSYSTEM_ID); - mSub = (IAuthority) CMS.getSubsystem(sub); + mSub = (IAuthority) + CMS.getSubsystem(sub); if (mSub == null) { // take this as disable mSummary = false; @@ -125,7 +137,7 @@ public class RequestInQueueJob extends AJobBase implements IJob, Runnable, if (mCron == null) { return; } - + // parse cron string into a JobCron class IJobsScheduler scheduler = (IJobsScheduler) owner; @@ -138,7 +150,7 @@ public class RequestInQueueJob extends AJobBase implements IJob, Runnable, mSummary = true; mSummaryMailSubject = sc.getString(PROP_EMAIL_SUBJECT); mMailForm = sc.getString(PROP_EMAIL_TEMPLATE); - // mItemForm = sc.getString(PROP_ITEM_TEMPLATE); + // mItemForm = sc.getString(PROP_ITEM_TEMPLATE); mSummarySenderEmail = sc.getString(PROP_SENDER_EMAIL); mSummaryReceiverEmail = sc.getString(PROP_RECEIVER_EMAIL); } else { @@ -150,8 +162,7 @@ public class RequestInQueueJob extends AJobBase implements IJob, Runnable, * summarize the queue status and mail it */ public void run() { - if (mSummary == false) - return; + if (mSummary == false) return; Date date = CMS.getCurrentDate(); long now = date.getTime(); @@ -159,20 +170,25 @@ public class RequestInQueueJob extends AJobBase implements IJob, Runnable, String nowString = dateFormat.format(date); int count = 0; - IRequestList list = mReqQ.listRequestsByStatus(RequestStatus.PENDING); + IRequestList list = + mReqQ.listRequestsByStatus(RequestStatus.PENDING); while (list != null && list.hasMoreElements()) { RequestId rid = list.nextRequestId(); - /* - * This is way too slow // get request from request id IRequest req - * = null; try { req = mReqQ.findRequest(rid); } catch - * (EBaseException e) { System.out.println(e.toString()); } + /* This is way too slow + // get request from request id + IRequest req = null; + try { + req = mReqQ.findRequest(rid); + } catch (EBaseException e) { + System.out.println(e.toString()); + } */ count++; } - // if (count == 0) return; + // if (count == 0) return; String contentForm = null; @@ -180,21 +196,23 @@ public class RequestInQueueJob extends AJobBase implements IJob, Runnable, buildContentParams(IEmailFormProcessor.TOKEN_ID, mId); buildContentParams(IEmailFormProcessor.TOKEN_SUMMARY_TOTAL_NUM, - String.valueOf(count)); - buildContentParams(IEmailFormProcessor.TOKEN_EXECUTION_TIME, nowString); + String.valueOf(count)); + buildContentParams(IEmailFormProcessor.TOKEN_EXECUTION_TIME, + nowString); IEmailFormProcessor emailFormProcessor = CMS.getEmailFormProcessor(); - String mailContent = emailFormProcessor.getEmailContent(contentForm, + String mailContent = + emailFormProcessor.getEmailContent(contentForm, mContentParams); mailSummary(mailContent); } /** - * Returns a list of configuration parameter names. The list is passed to - * the configuration console so instances of this implementation can be - * configured through the console. - * + * Returns a list of configuration parameter names. + * The list is passed to the configuration console so instances of + * this implementation can be configured through the console. + * * @return String array of configuration parameter names. */ public String[] getConfigParams() { -- cgit