diff options
author | Ade Lee <alee@redhat.com> | 2012-01-09 23:32:31 -0500 |
---|---|---|
committer | Ade Lee <alee@redhat.com> | 2012-01-09 23:32:31 -0500 |
commit | 466533710c179f62865e08b3031748072a0247a3 (patch) | |
tree | 4c04c20d50239be26ba8319076de90226526a542 /pki/base/common/src/com/netscape/certsrv/request | |
parent | c9e3c48de53fce6908f625f40ac2b2f75d66b5a1 (diff) | |
download | pki-466533710c179f62865e08b3031748072a0247a3.tar.gz pki-466533710c179f62865e08b3031748072a0247a3.tar.xz pki-466533710c179f62865e08b3031748072a0247a3.zip |
Formatting (no wrap)
Diffstat (limited to 'pki/base/common/src/com/netscape/certsrv/request')
21 files changed, 747 insertions, 780 deletions
diff --git a/pki/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java b/pki/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java index 65ddeac9..6fbbb8ba 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java +++ b/pki/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java @@ -17,7 +17,6 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.request; - import java.math.BigInteger; import java.util.Enumeration; import java.util.Hashtable; @@ -31,9 +30,9 @@ import com.netscape.certsrv.ldap.ILdapConnModule; import com.netscape.certsrv.publish.IPublisherProcessor; /** - * The ARequestNotifier class implements the IRequestNotifier interface, - * which notifies all registered request listeners. - * + * The ARequestNotifier class implements the IRequestNotifier interface, which + * notifies all registered request listeners. + * * @version $Revision$, $Date$ */ public class ARequestNotifier implements IRequestNotifier { @@ -52,31 +51,32 @@ public class ARequestNotifier implements IRequestNotifier { private int mSavePublishingStatus = 0; private int mSavePublishingCounter = 0; - public ARequestNotifier() { mPublishingQueuePriority = Thread.currentThread().getPriority(); } - public ARequestNotifier (ICertificateAuthority ca) { + public ARequestNotifier(ICertificateAuthority ca) { mCA = ca; - if (mCA != null) mRequestQueue = mCA.getRequestQueue(); + if (mCA != null) + mRequestQueue = mCA.getRequestQueue(); } - public void setPublishingQueue (boolean isPublishingQueueEnabled, + public void setPublishingQueue(boolean isPublishingQueueEnabled, int publishingQueuePriorityLevel, int maxNumberOfPublishingThreads, int publishingQueuePageSize, int savePublishingStatus) { - CMS.debug("setPublishingQueue: Publishing Queue Enabled: " + isPublishingQueueEnabled+ - " Priority Level: " + publishingQueuePriorityLevel+ - " Maximum Number of Threads: " + maxNumberOfPublishingThreads+ - " Page Size: "+ publishingQueuePageSize); + CMS.debug("setPublishingQueue: Publishing Queue Enabled: " + isPublishingQueueEnabled + + " Priority Level: " + publishingQueuePriorityLevel + + " Maximum Number of Threads: " + maxNumberOfPublishingThreads + + " Page Size: " + publishingQueuePageSize); mIsPublishingQueueEnabled = isPublishingQueueEnabled; mMaxThreads = maxNumberOfPublishingThreads; mMaxRequests = publishingQueuePageSize; mSavePublishingStatus = savePublishingStatus; - // Publishing Queue Priority Levels: 2 - maximum, 1 - higher, 0 - normal, -1 - lower, -2 - minimum + // Publishing Queue Priority Levels: 2 - maximum, 1 - higher, 0 - + // normal, -1 - lower, -2 - minimum if (publishingQueuePriorityLevel > 1) { mPublishingQueuePriority = Thread.MAX_PRIORITY; } else if (publishingQueuePriorityLevel > 0) { @@ -89,7 +89,8 @@ public class ARequestNotifier implements IRequestNotifier { mPublishingQueuePriority = Thread.currentThread().getPriority(); } - if (mCA != null && mRequestQueue == null) mRequestQueue = mCA.getRequestQueue(); + if (mCA != null && mRequestQueue == null) + mRequestQueue = mCA.getRequestQueue(); if (mIsPublishingQueueEnabled && mSavePublishingStatus > 0 && mRequestQueue != null) { mPublishingStatus = mRequestQueue.getPublishingStatus(); BigInteger status = new BigInteger("-2"); @@ -101,23 +102,23 @@ public class ARequestNotifier implements IRequestNotifier { } catch (Exception e) { } } - + } /** * Registers a request listener. - * + * * @param listener listener to be registered */ public void registerListener(IRequestListener listener) { // XXX should check for duplicates here or allow listeners - // to register twice and call twice ? + // to register twice and call twice ? mListeners.put(listener.getClass().getName(), listener); } /** * Registers a request listener. - * + * * @param name listener name * @param listener listener to be registered */ @@ -127,18 +128,18 @@ public class ARequestNotifier implements IRequestNotifier { /** * Removes listener from the list of registered listeners. - * + * * @param listener listener to be removed from the list */ public void removeListener(IRequestListener listener) { // XXX should check for duplicates here or allow listeners - // to register twice and call twice ? + // to register twice and call twice ? mListeners.remove(listener.getClass().getName()); } /** * Gets list of listener names. - * + * * @return enumeration of listener names */ public Enumeration<String> getListenerNames() { @@ -147,7 +148,7 @@ public class ARequestNotifier implements IRequestNotifier { /** * Removes listener from the list of registered listeners. - * + * * @param name listener name to be removed from the list */ public void removeListener(String name) { @@ -156,7 +157,7 @@ public class ARequestNotifier implements IRequestNotifier { /** * Gets listener from the list of registered listeners. - * + * * @param name listener name * @return listener */ @@ -166,26 +167,25 @@ public class ARequestNotifier implements IRequestNotifier { /** * Gets list of listeners. - * + * * @return enumeration of listeners */ public Enumeration<IRequestListener> getListeners() { return mListeners.elements(); } - private Object publishingCounterMonitor = new Object(); public void updatePublishingStatus(String id) { if (mRequestQueue != null) { synchronized (publishingCounterMonitor) { if (mSavePublishingCounter == 0) { - CMS.debug("updatePublishingStatus requestId: "+id); + CMS.debug("updatePublishingStatus requestId: " + id); mRequestQueue.setPublishingStatus(id); } mSavePublishingCounter++; - CMS.debug("updatePublishingStatus mSavePublishingCounter: "+mSavePublishingCounter+ - " mSavePublishingStatus: "+mSavePublishingStatus); + CMS.debug("updatePublishingStatus mSavePublishingCounter: " + mSavePublishingCounter + + " mSavePublishingStatus: " + mSavePublishingStatus); if (mSavePublishingCounter >= mSavePublishingStatus) { mSavePublishingCounter = 0; } @@ -197,24 +197,25 @@ public class ARequestNotifier implements IRequestNotifier { /** * Gets request from publishing queue. - * + * * @return request */ public synchronized IRequest getRequest() { - IRequest r = null; - String id = null; + IRequest r = null; + String id = null; CMS.debug("getRequest mRequests=" + mRequests.size() + " mSearchForRequests=" + mSearchForRequests); if (mSearchForRequests && mRequests.size() == 1) { - id = (String)mRequests.elementAt(0); - if (mCA != null && mRequestQueue == null) mRequestQueue = mCA.getRequestQueue(); + id = (String) mRequests.elementAt(0); + if (mCA != null && mRequestQueue == null) + mRequestQueue = mCA.getRequestQueue(); if (id != null && mRequestQueue != null) { CMS.debug("getRequest request id=" + id); IRequestVirtualList list = mRequestQueue.getPagedRequestsByFilter( new RequestId(id), "(requeststate=complete)", mMaxRequests, "requestId"); int s = list.getSize() - list.getCurrentIndex(); - CMS.debug("getRequest list size: "+s); + CMS.debug("getRequest list size: " + s); for (int i = 0; i < s; i++) { r = null; try { @@ -230,10 +231,9 @@ public class ARequestNotifier implements IRequestNotifier { continue; } if (!(requestType.equals(IRequest.ENROLLMENT_REQUEST) || - requestType.equals(IRequest.RENEWAL_REQUEST) || - requestType.equals(IRequest.REVOCATION_REQUEST) || - requestType.equals(IRequest.CMCREVOKE_REQUEST) || - requestType.equals(IRequest.UNREVOCATION_REQUEST))) { + requestType.equals(IRequest.RENEWAL_REQUEST) || + requestType.equals(IRequest.REVOCATION_REQUEST) || + requestType.equals(IRequest.CMCREVOKE_REQUEST) || requestType.equals(IRequest.UNREVOCATION_REQUEST))) { continue; } if (i == 0 && id.equals(r.getRequestId().toString())) { @@ -245,8 +245,8 @@ public class ARequestNotifier implements IRequestNotifier { } if (mRequests.size() < mMaxRequests) { mRequests.addElement(r.getRequestId().toString()); - CMS.debug("getRequest added "+r.getRequestType()+" request "+r.getRequestId().toString()+ - " to mRequests: " + mRequests.size()+" ("+mMaxRequests+")"); + CMS.debug("getRequest added " + r.getRequestType() + " request " + r.getRequestId().toString() + + " to mRequests: " + mRequests.size() + " (" + mMaxRequests + ")"); } else { break; } @@ -257,16 +257,17 @@ public class ARequestNotifier implements IRequestNotifier { } } if (mRequests.size() > 0) { - id = (String)mRequests.elementAt(0); + id = (String) mRequests.elementAt(0); if (id != null) { CMS.debug("getRequest getting request: " + id); - if (mCA != null && mRequestQueue == null) mRequestQueue = mCA.getRequestQueue(); + if (mCA != null && mRequestQueue == null) + mRequestQueue = mCA.getRequestQueue(); if (mRequestQueue != null) { try { r = mRequestQueue.findRequest(new RequestId(id)); mRequests.remove(0); - CMS.debug("getRequest request "+ id + ((r != null)?" found":" not found")); - //updatePublishingStatus(id); + CMS.debug("getRequest request " + id + ((r != null) ? " found" : " not found")); + // updatePublishingStatus(id); } catch (EBaseException e) { CMS.debug("getRequest EBaseException " + e.toString()); } @@ -285,7 +286,7 @@ public class ARequestNotifier implements IRequestNotifier { /** * Gets number of requests in publishing queue. - * + * * @return number of requests in publishing queue */ public int getNumberOfRequests() { @@ -294,7 +295,7 @@ public class ARequestNotifier implements IRequestNotifier { /** * Checks if publishing queue is enabled. - * + * * @return true if publishing queue is enabled, false otherwise */ public boolean isPublishingQueueEnabled() { @@ -303,7 +304,7 @@ public class ARequestNotifier implements IRequestNotifier { /** * Removes a notifier thread from the pool of publishing queue threads. - * + * * @param notifierThread Thread */ public void removeNotifierThread(Thread notifierThread) { @@ -318,12 +319,12 @@ public class ARequestNotifier implements IRequestNotifier { /** * Notifies all registered listeners about request. - * + * * @param r request */ public void notify(IRequest r) { - CMS.debug("ARequestNotifier notify mIsPublishingQueueEnabled="+mIsPublishingQueueEnabled+ - " mMaxThreads="+mMaxThreads); + CMS.debug("ARequestNotifier notify mIsPublishingQueueEnabled=" + mIsPublishingQueueEnabled + + " mMaxThreads=" + mMaxThreads); if (mIsPublishingQueueEnabled) { addToNotify(r); } else if (mMaxThreads == 0) { @@ -341,26 +342,27 @@ public class ARequestNotifier implements IRequestNotifier { new Thread(new RunListeners(r, mListeners.elements())).start(); } catch (Throwable e) { - /* - CMS.getLogger().log( - ILogger.EV_SYSTEM, ILogger.S_REQQUEUE, ILogger.LL_FAILURE, - "Could not run listeners for request " + r.getRequestId() + - ". Error " + e + ";" + e.getMessage()); - */ + /* + * CMS.getLogger().log( ILogger.EV_SYSTEM, ILogger.S_REQQUEUE, + * ILogger.LL_FAILURE, "Could not run listeners for request " + + * r.getRequestId() + ". Error " + e + ";" + e.getMessage()); + */ } } } /** * Checks for available publishing connections - * - * @return true if there are available publishing connections, false otherwise + * + * @return true if there are available publishing connections, false + * otherwise */ private boolean checkAvailablePublishingConnections() { boolean availableConnections = false; IPublisherProcessor pp = null; - if (mCA != null) pp = mCA.getPublisherProcessor(); + if (mCA != null) + pp = mCA.getPublisherProcessor(); if (pp != null && pp.enabled()) { ILdapConnModule ldapConnModule = pp.getLdapConnModule(); if (ldapConnModule != null) { @@ -378,8 +380,8 @@ public class ARequestNotifier implements IRequestNotifier { CMS.debug("checkAvailablePublishingConnections ldapConnModule is not accessible"); } } else { - CMS.debug("checkAvailablePublishingConnections PublisherProcessor is not " + - ((pp != null)?"enabled":"accessible")); + CMS.debug("checkAvailablePublishingConnections PublisherProcessor is not " + + ((pp != null) ? "enabled" : "accessible")); } return availableConnections; @@ -387,7 +389,7 @@ public class ARequestNotifier implements IRequestNotifier { /** * Checks if more publishing threads can be added. - * + * * @return true if more publishing threads can be added, false otherwise */ private boolean morePublishingThreads() { @@ -396,9 +398,9 @@ public class ARequestNotifier implements IRequestNotifier { if (mNotifierThreads.size() == 0) { moreThreads = true; } else if (mNotifierThreads.size() < mMaxThreads) { - CMS.debug("morePublishingThreads ("+mRequests.size()+">"+ - ((mMaxRequests * mNotifierThreads.size()) / mMaxThreads)+ - " "+"("+mMaxRequests+"*"+mNotifierThreads.size()+"):"+mMaxThreads); + CMS.debug("morePublishingThreads (" + mRequests.size() + ">" + + ((mMaxRequests * mNotifierThreads.size()) / mMaxThreads) + + " " + "(" + mMaxRequests + "*" + mNotifierThreads.size() + "):" + mMaxThreads); // gradually add new publishing threads if (mRequests.size() > ((mMaxRequests * mNotifierThreads.size()) / mMaxThreads)) { // check for available publishing connections @@ -412,21 +414,20 @@ public class ARequestNotifier implements IRequestNotifier { return moreThreads; } - /** * Notifies all registered listeners about request. - * + * * @param r request */ public synchronized void addToNotify(IRequest r) { if (!mSearchForRequests) { if (mRequests.size() < mMaxRequests) { mRequests.addElement(r.getRequestId().toString()); - CMS.debug("addToNotify extended buffer to "+mRequests.size()+"("+mMaxRequests+")"+ - " requests by adding request "+r.getRequestId().toString()); + CMS.debug("addToNotify extended buffer to " + mRequests.size() + "(" + mMaxRequests + ")" + + " requests by adding request " + r.getRequestId().toString()); if (morePublishingThreads()) { try { - Thread notifierThread = new Thread(new RunListeners((IRequestNotifier)this)); + Thread notifierThread = new Thread(new RunListeners((IRequestNotifier) this)); if (notifierThread != null) { mNotifierThreads.addElement(notifierThread); CMS.debug("Number of publishing threads: " + mNotifierThreads.size()); @@ -445,23 +446,22 @@ public class ARequestNotifier implements IRequestNotifier { } } - /** * Recovers publishing queue. - * + * * @param id request request */ public void recoverPublishingQueue(String id) { - CMS.debug("recoverPublishingQueue mRequests.size()="+mRequests.size()+"("+mMaxRequests+")"+ - " requests by adding request "+id); + CMS.debug("recoverPublishingQueue mRequests.size()=" + mRequests.size() + "(" + mMaxRequests + ")" + + " requests by adding request " + id); if (mRequests.size() == 0) { mRequests.addElement(id); - CMS.debug("recoverPublishingQueue extended buffer to "+mRequests.size()+"("+mMaxRequests+")"+ - " requests by adding request "+id); + CMS.debug("recoverPublishingQueue extended buffer to " + mRequests.size() + "(" + mMaxRequests + ")" + + " requests by adding request " + id); if (morePublishingThreads()) { mSearchForRequests = true; try { - Thread notifierThread = new Thread(new RunListeners((IRequestNotifier)this)); + Thread notifierThread = new Thread(new RunListeners((IRequestNotifier) this)); if (notifierThread != null) { mNotifierThreads.addElement(notifierThread); CMS.debug("Number of publishing threads: " + mNotifierThreads.size()); @@ -478,10 +478,9 @@ public class ARequestNotifier implements IRequestNotifier { } } - /** - * The RunListeners class implements Runnable interface. - * This class executes notification of registered listeners. + * The RunListeners class implements Runnable interface. This class executes + * notification of registered listeners. */ class RunListeners implements Runnable { IRequest mRequest = null; @@ -490,7 +489,7 @@ class RunListeners implements Runnable { /** * RunListeners class constructor. - * + * * @param r request * @param listeners list of listeners */ @@ -501,7 +500,7 @@ class RunListeners implements Runnable { /** * RunListeners class constructor. - * + * * @param r request * @param listeners list of listeners */ @@ -514,10 +513,11 @@ class RunListeners implements Runnable { * RunListeners thread implementation. */ public void run() { - CMS.debug("RunListeners::"+((mRequestNotifier != null && mRequestNotifier.getNumberOfRequests() > 0)?" Queue: "+mRequestNotifier.getNumberOfRequests():" noQueue")+ - " "+((mRequest != null)?" SingleRequest":" noSingleRequest")); + CMS.debug("RunListeners::" + ((mRequestNotifier != null && mRequestNotifier.getNumberOfRequests() > 0) ? " Queue: " + mRequestNotifier.getNumberOfRequests() : " noQueue") + + " " + ((mRequest != null) ? " SingleRequest" : " noSingleRequest")); do { - if (mRequestNotifier != null) mRequest = (IRequest)mRequestNotifier.getRequest(); + if (mRequestNotifier != null) + mRequest = (IRequest) mRequestNotifier.getRequest(); if (mListeners != null && mRequest != null) { while (mListeners.hasMoreElements()) { IRequestListener l = (IRequestListener) mListeners.nextElement(); @@ -529,11 +529,13 @@ class RunListeners implements Runnable { mRequestNotifier.updatePublishingStatus(mRequest.getRequestId().toString()); } } - CMS.debug("RunListeners: "+((mRequestNotifier != null && mRequestNotifier.getNumberOfRequests() > 0)?" Queue: "+mRequestNotifier.getNumberOfRequests():" noQueue")+ - " "+((mRequest != null)?" SingleRequest":" noSingleRequest")); - if (mRequestNotifier != null) mListeners = mRequestNotifier.getListeners(); + CMS.debug("RunListeners: " + ((mRequestNotifier != null && mRequestNotifier.getNumberOfRequests() > 0) ? " Queue: " + mRequestNotifier.getNumberOfRequests() : " noQueue") + + " " + ((mRequest != null) ? " SingleRequest" : " noSingleRequest")); + if (mRequestNotifier != null) + mListeners = mRequestNotifier.getListeners(); } while (mRequestNotifier != null && mRequestNotifier.getNumberOfRequests() > 0); - if (mRequestNotifier != null) mRequestNotifier.removeNotifierThread(Thread.currentThread()); + if (mRequestNotifier != null) + mRequestNotifier.removeNotifierThread(Thread.currentThread()); } } diff --git a/pki/base/common/src/com/netscape/certsrv/request/AgentApproval.java b/pki/base/common/src/com/netscape/certsrv/request/AgentApproval.java index c884ebbf..681263b4 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/AgentApproval.java +++ b/pki/base/common/src/com/netscape/certsrv/request/AgentApproval.java @@ -17,27 +17,25 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.request; - import java.io.Serializable; import java.util.Date; - /** - * The AgentApproval class contains the record of a - * single agent approval. - * + * The AgentApproval class contains the record of a single agent approval. + * * @version $Revision$, $Date$ */ public class AgentApproval - implements Serializable { + implements Serializable { /** * */ private static final long serialVersionUID = -3444654917454805225L; + /** * Returns the approving agent's user name. - * + * * @return an identifier for the agent */ public String getUserName() { @@ -46,7 +44,7 @@ public class AgentApproval /** * Returns the date of the approval - * + * * @return date and time of the approval */ public Date getDate() { @@ -55,7 +53,7 @@ public class AgentApproval /** * AgentApproval class constructor - * + * * @param userName user name of the approving agent */ AgentApproval(String userName) { diff --git a/pki/base/common/src/com/netscape/certsrv/request/AgentApprovals.java b/pki/base/common/src/com/netscape/certsrv/request/AgentApprovals.java index 410e3b2c..bc2e60ac 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/AgentApprovals.java +++ b/pki/base/common/src/com/netscape/certsrv/request/AgentApprovals.java @@ -17,21 +17,18 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.request; - import java.io.Serializable; import java.util.Date; import java.util.Enumeration; import java.util.Vector; - /** - * A collection of AgentApproval objects. - * <single-threaded> - * + * A collection of AgentApproval objects. <single-threaded> + * * @version $Revision$, $Date$ */ public class AgentApprovals - implements Serializable { + implements Serializable { /** * @@ -41,15 +38,14 @@ public class AgentApprovals /** * Adds an approval to approval's list. * <p> - * If an approval is already present for this user, - * it is updated with a new date. Otherwise a new - * value is inserted. - * + * If an approval is already present for this user, it is updated with a new + * date. Otherwise a new value is inserted. + * * @param userName user name of the approving agent */ public void addApproval(String userName) { AgentApproval a = findApproval(userName); - + // update existing approval if (a != null) { a.mDate = new Date(); /* CMS.getCurrentDate(); */ @@ -63,9 +59,8 @@ public class AgentApprovals /** * Removes an approval from approval's list. * <p> - * If there is no approval for this userName, this - * call does nothing. - * + * If there is no approval for this userName, this call does nothing. + * * @param userName user name of the approving agent */ public void removeApproval(String userName) { @@ -77,7 +72,7 @@ public class AgentApprovals /** * Finds an existing AgentApproval for the named user. - * + * * @param userName user name of the approving agent * @return an AgentApproval object */ @@ -88,7 +83,8 @@ public class AgentApprovals for (int i = 0; i < mVector.size(); i++) { a = (AgentApproval) mVector.elementAt(i); - if (a.mUserName.equals(userName)) break; + if (a.mUserName.equals(userName)) + break; } return a; @@ -96,7 +92,7 @@ public class AgentApprovals /** * Returns an enumeration of the agent approvals - * + * * @return an enumeration of the agent approvals */ public Enumeration elements() { @@ -104,12 +100,11 @@ public class AgentApprovals } /** - * Returns the AgentApprovals as a Vector of strings. - * Each entry in the vector is of the format: - * epoch;username - * where epoch is the date.getTime() + * Returns the AgentApprovals as a Vector of strings. Each entry in the + * vector is of the format: epoch;username where epoch is the date.getTime() * <p> * This is used for serialization in Request.setExtData(). + * * @return The string vector. */ public Vector toStringVector() { @@ -123,8 +118,9 @@ public class AgentApprovals } /** - * Recreates an AgentApprovals instance from a Vector of strings that - * was created by toStringVector(). + * Recreates an AgentApprovals instance from a Vector of strings that was + * created by toStringVector(). + * * @param stringVector The vector of strings to translate * @return the AgentApprovals instance or null if it can't be translated. */ @@ -135,7 +131,7 @@ public class AgentApprovals AgentApprovals approvals = new AgentApprovals(); for (int i = 0; i < stringVector.size(); i++) { try { - String approvalString = (String)stringVector.get(i); + String approvalString = (String) stringVector.get(i); String[] parts = approvalString.split(";", 2); if (parts.length != 2) { return null; diff --git a/pki/base/common/src/com/netscape/certsrv/request/IEnrollmentRequest.java b/pki/base/common/src/com/netscape/certsrv/request/IEnrollmentRequest.java index e7036d1e..01bc870f 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/IEnrollmentRequest.java +++ b/pki/base/common/src/com/netscape/certsrv/request/IEnrollmentRequest.java @@ -17,15 +17,13 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.request; - /** - * An example of a more specialized request interface. - * This version (currently) doesn't supply any additional - * data, but is implementated only for testing and + * An example of a more specialized request interface. This version (currently) + * doesn't supply any additional data, but is implementated only for testing and * demonstration purposes. - * + * * @version $Revision$, $Date$ */ public interface IEnrollmentRequest - extends IRequest { + extends IRequest { } diff --git a/pki/base/common/src/com/netscape/certsrv/request/INotify.java b/pki/base/common/src/com/netscape/certsrv/request/INotify.java index d4ff15b7..636eba7b 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/INotify.java +++ b/pki/base/common/src/com/netscape/certsrv/request/INotify.java @@ -17,24 +17,22 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.request; - /** - * The INotify interface defines operations that are invoked - * when a request is completely processed. A class implementing - * this interface may be registered with a IRequestQueue. - * The interface will be invoked when a request is completely - * serviced by the IService object. - * + * The INotify interface defines operations that are invoked when a request is + * completely processed. A class implementing this interface may be registered + * with a IRequestQueue. The interface will be invoked when a request is + * completely serviced by the IService object. + * * @version $Revision$ $Date$ */ public interface INotify { /** - * Provides notification that a request has been completed. - * The implementation may use values stored in the IRequest - * object, and may implement any type publishing (such as email - * or writing values into a directory) - * + * Provides notification that a request has been completed. The + * implementation may use values stored in the IRequest object, and may + * implement any type publishing (such as email or writing values into a + * directory) + * * @param request the request that is completed. */ public void notify(IRequest request); diff --git a/pki/base/common/src/com/netscape/certsrv/request/IPolicy.java b/pki/base/common/src/com/netscape/certsrv/request/IPolicy.java index d74a32a4..06262fee 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/IPolicy.java +++ b/pki/base/common/src/com/netscape/certsrv/request/IPolicy.java @@ -17,37 +17,32 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.request; - /** - * Interface to a policy. The policy evaluates the request for - * correctness and completeness. It may change or add to values - * stored in the request. The policy object also decides - * whether a request should be queue to await approval by - * an agent. - * FUTURE: In this case, the policy should set the - * 'agentGroup' entry in the request to indicate the group - * of agents allowed to perform further processing. If none - * is set, a default value ("defaultAgentGroup") will be - * set instead. - * + * Interface to a policy. The policy evaluates the request for correctness and + * completeness. It may change or add to values stored in the request. The + * policy object also decides whether a request should be queue to await + * approval by an agent. FUTURE: In this case, the policy should set the + * 'agentGroup' entry in the request to indicate the group of agents allowed to + * perform further processing. If none is set, a default value + * ("defaultAgentGroup") will be set instead. + * * @version $Revision$, $Date$ */ public interface IPolicy { /** - * Applies the policy check to the request. The policy should - * determine whether the request can be processed immediately, - * or should be held pending manual approval. + * Applies the policy check to the request. The policy should determine + * whether the request can be processed immediately, or should be held + * pending manual approval. * <p> - * The policy can update fields in the request, to add additional values - * or to restrict the values to pre-determined ranges. + * The policy can update fields in the request, to add additional values or + * to restrict the values to pre-determined ranges. * <p> - * @param request - * the request to check - * @return - * a result code indicating the result of the evaluation. The - * processor will determine the next request processing step based - * on this value + * + * @param request the request to check + * @return a result code indicating the result of the evaluation. The + * processor will determine the next request processing step based + * on this value */ PolicyResult apply(IRequest request); } diff --git a/pki/base/common/src/com/netscape/certsrv/request/IRequest.java b/pki/base/common/src/com/netscape/certsrv/request/IRequest.java index 1174778a..6a731444 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/IRequest.java +++ b/pki/base/common/src/com/netscape/certsrv/request/IRequest.java @@ -17,7 +17,6 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.request; - //import java.io.Serializable; import java.math.BigInteger; @@ -36,10 +35,9 @@ import netscape.security.x509.X509CertInfo; import com.netscape.certsrv.authentication.IAuthToken; import com.netscape.certsrv.base.IAttrSet; - /** * An interface that defines abilities of request objects, - * + * * @version $Revision$, $Date$ */ public interface IRequest { @@ -77,18 +75,19 @@ public interface IRequest { public static final String REQUESTOR_EMAIL = "csrRequestorEmail"; public static final String REQUESTOR_COMMENTS = "csrRequestorComments"; - // request attributes for all + // request attributes for all public static final String AUTH_TOKEN = "AUTH_TOKEN"; public static final String HTTP_PARAMS = "HTTP_PARAMS"; public static final String HTTP_HEADERS = "HTTP_HEADERS"; // Params added by agents on agent approval page public static final String AGENT_PARAMS = "AGENT_PARAMS"; // server attributes: attributes generated by server modules. - public static final String SERVER_ATTRS = "SERVER_ATTRS"; + public static final String SERVER_ATTRS = "SERVER_ATTRS"; - public static final String RESULT = "Result"; // service result. - public static final Integer RES_SUCCESS = Integer.valueOf(1); // result value - public static final Integer RES_ERROR = Integer.valueOf(2); // result value + public static final String RESULT = "Result"; // service result. + public static final Integer RES_SUCCESS = Integer.valueOf(1); // result + // value + public static final Integer RES_ERROR = Integer.valueOf(2); // result value public static final String REMOTE_SERVICE_AUTHORITY = "RemServiceAuthority"; public static final String SVCERRORS = "serviceErrors"; public static final String REMOTE_STATUS = "remoteStatus"; @@ -110,11 +109,10 @@ public interface IRequest { // also used for renewal public static final String CERT_INFO = "CERT_INFO"; public static final String ISSUED_CERTS = "issuedCerts"; - public static final String - REQUEST_TRUSTEDMGR_PRIVILEGE = "requestTrustedManagerPrivilege"; + public static final String REQUEST_TRUSTEDMGR_PRIVILEGE = "requestTrustedManagerPrivilege"; public static final String FINGERPRINTS = "fingerprints"; - - // enrollment request values + + // enrollment request values public static final String SERVER_CERT = "server"; public static final String CLIENT_CERT = "client"; public static final String CA_CERT = "ca"; @@ -124,7 +122,7 @@ public interface IRequest { public static final String OTHER_CERT = "other"; public static final String ROUTER_CERT = "router"; // deprecated public static final String CEP_CERT = "CEP-Request"; - + // renewal request attributes. (internally set) // also used for revocation public static final String OLD_CERTS = "OLD_CERTS"; @@ -143,13 +141,13 @@ public interface IRequest { public final static String CRL_PUBLISH_ERROR = "crlPublishError"; public static final String REQUESTOR_TYPE = "requestorType"; - // Netkey request attributes + // Netkey request attributes public final static String NETKEY_ATTR_CUID = "CUID"; public final static String NETKEY_ATTR_USERID = "USERID"; public final static String NETKEY_ATTR_DRMTRANS_DES_KEY = "drm_trans_desKey"; - public final static String NETKEY_ATTR_ARCHIVE_FLAG ="archive"; - public final static String NETKEY_ATTR_SERVERSIDE_MUSCLE_FLAG ="serverSideMuscle"; - public final static String NETKEY_ATTR_ENC_PRIVKEY_FLAG ="encryptPrivKey"; + public final static String NETKEY_ATTR_ARCHIVE_FLAG = "archive"; + public final static String NETKEY_ATTR_SERVERSIDE_MUSCLE_FLAG = "serverSideMuscle"; + public final static String NETKEY_ATTR_ENC_PRIVKEY_FLAG = "encryptPrivKey"; public final static String NETKEY_ATTR_USER_CERT = "cert"; public final static String NETKEY_ATTR_KEY_SIZE = "keysize"; @@ -160,7 +158,7 @@ public interface IRequest { public static final String REQUESTOR_KRA = "KRA"; public static final String REQUESTOR_AGENT = "Agent"; - // others (internally set) + // others (internally set) public final static String CACERTCHAIN = "CACertChain"; public final static String CRL = "CRL"; public final static String DOGETCACHAIN = "doGetCAChain"; @@ -174,90 +172,87 @@ public interface IRequest { /** * Gets the primary identifier for this request. - * + * * @return request id */ RequestId getRequestId(); /** * Gets the current state of this request. - * + * * @return request status */ RequestStatus getRequestStatus(); /** - * Gets the "sourceId" for the request. The sourceId is - * assigned by the originator of the request (for example, - * the EE servlet or the RA servlet. + * Gets the "sourceId" for the request. The sourceId is assigned by the + * originator of the request (for example, the EE servlet or the RA servlet. * <p> - * The sourceId should be unique so that it can be used - * to retrieve request later without knowing the locally - * assigned primary id (RequestID) + * The sourceId should be unique so that it can be used to retrieve request + * later without knowing the locally assigned primary id (RequestID) * <p> - * @return - * the sourceId value (or null if none has been set) + * + * @return the sourceId value (or null if none has been set) */ public String getSourceId(); /** - * Sets the "sourceId" for this request. The request must be updated - * in the database for this change to take effect. This can be done - * by calling IRequestQueue.update() or by performing one of the - * other operations like processRequest or approveRequest. - * + * Sets the "sourceId" for this request. The request must be updated in the + * database for this change to take effect. This can be done by calling + * IRequestQueue.update() or by performing one of the other operations like + * processRequest or approveRequest. + * * @param id source id for this request */ public void setSourceId(String id); /** * Gets the current owner of this request. - * + * * @return request owner */ public String getRequestOwner(); /** * Sets the current owner of this request. - * - * @param owner - * The new owner of this request. If this value is set to null - * there will be no current owner + * + * @param owner The new owner of this request. If this value is set to null + * there will be no current owner */ public void setRequestOwner(String owner); /** * Gets the type of this request. - * + * * @return request type */ public String getRequestType(); /** * Sets the type or this request. - * + * * @param type request type */ public void setRequestType(String type); /** * Gets the version of this request. - * + * * @return request version */ public String getRequestVersion(); /** * Gets the time this request was created. - * + * * @return request creation time */ Date getCreationTime(); /** - * Gets the time this request was last modified (defined - * as updated in the queue) (See IRequestQueue.update) - * + * Gets the time this request was last modified (defined as updated in the + * queue) (See IRequestQueue.update) + * * @return request last modification time */ Date getModificationTime(); @@ -278,83 +273,81 @@ public interface IRequest { public static final String ERROR = "Error"; /** - * Copies meta attributes (excluding request Id, etc.) of another request - * to this request. - * + * Copies meta attributes (excluding request Id, etc.) of another request to + * this request. + * * @param req another request */ public void copyContents(IRequest req); /** * Gets context of this request. - * + * * @return request context */ public String getContext(); /** * Sets context of this request. - * + * * @param ctx request context */ public void setContext(String ctx); /** * Sets status of this request. - * + * * @param s request status */ public void setRequestStatus(RequestStatus s); /** * Gets status of connector transfer. - * + * * @return status of connector transfer */ public boolean isSuccess(); /** * Gets localized error message from connector transfer. - * + * * @param locale request locale * @return error message from connector transfer */ public String getError(Locale locale); - /************************************************************** * ExtData data methods: - * - * These methods should be used in place of the mAttrData methods - * deprecated above. - * - * These methods all store Strings in LDAP. This means they can no longer - * be used as a garbage dump for all sorts of objects. A limited number - * of helper methods are provided for Vectors/Arrays/Hashtables but the - * keys and values for all of these should be Strings. - * - * The keys are used in the LDAP attribute names, and so much obey LDAP - * key syntax rules: A-Za-z0-9 and hyphen. - */ - - /** - * Sets an Extended Data string-key string-value pair. - * All keys are lower cased because LDAP does not preserve case. - * - * @param key The extended data key + * + * These methods should be used in place of the mAttrData methods deprecated + * above. + * + * These methods all store Strings in LDAP. This means they can no longer be + * used as a garbage dump for all sorts of objects. A limited number of + * helper methods are provided for Vectors/Arrays/Hashtables but the keys + * and values for all of these should be Strings. + * + * The keys are used in the LDAP attribute names, and so much obey LDAP key + * syntax rules: A-Za-z0-9 and hyphen. + */ + + /** + * Sets an Extended Data string-key string-value pair. All keys are lower + * cased because LDAP does not preserve case. + * + * @param key The extended data key * @param value The extended data value * @return false if key is invalid. */ public boolean setExtData(String key, String value); /** - * Sets an Extended Data string-key string-value pair. - * The key and hashtable keys are all lowercased because LDAP does not - * preserve case. - * - * @param key The extended data key - * @param value The extended data value - * the Hashtable contains an illegal key. + * Sets an Extended Data string-key string-value pair. The key and hashtable + * keys are all lowercased because LDAP does not preserve case. + * + * @param key The extended data key + * @param value The extended data value the Hashtable contains an illegal + * key. * @return false if the key or hashtable keys are invalid */ public boolean setExtData(String key, Hashtable<String, ?> value); @@ -362,65 +355,69 @@ public interface IRequest { /** * Checks whether the key is storing a simple String value, or a complex * (Vector/hashtable) structure. - * @param key The key to check for. - * @return True if the key maps to a string. False if it maps to a + * + * @param key The key to check for. + * @return True if the key maps to a string. False if it maps to a * hashtable. */ public boolean isSimpleExtDataValue(String key); /** - * Returns the String value stored for the String key. Returns null - * if not found. Throws exception if key stores a complex data structure + * Returns the String value stored for the String key. Returns null if not + * found. Throws exception if key stores a complex data structure * (Vector/Hashtable). - * @param key The key to lookup (case-insensitive) - * @return The value associated with the key. null if not found or if the - * key is associated with a non-string value. + * + * @param key The key to lookup (case-insensitive) + * @return The value associated with the key. null if not found or if the + * key is associated with a non-string value. */ public String getExtDataInString(String key); /** - * Returns the Hashtable value for the String key. Returns null if not - * found. Throws exception if the key stores a String value. - * + * Returns the Hashtable value for the String key. Returns null if not + * found. Throws exception if the key stores a String value. + * * The Hashtable returned is actually a subclass of Hashtable that - * lowercases all keys used to access the hashtable. Its purpose is to - * to make lookups seemless, but be aware it is not a normal hashtable and + * lowercases all keys used to access the hashtable. Its purpose is to to + * make lookups seemless, but be aware it is not a normal hashtable and * might behave strangely in some cases (e.g., iterating keys) - * - * @param key The key to lookup (case-insensitive) - * @return The hashtable value associated with the key. null if not found - * or if the key is associated with a string-value. + * + * @param key The key to lookup (case-insensitive) + * @return The hashtable value associated with the key. null if not found or + * if the key is associated with a string-value. */ public <V> Hashtable<String, V> getExtDataInHashtable(String key); - /** * Returns all the keys stored in ExtData + * * @return Enumeration of all the keys. */ public Enumeration<String> getExtDataKeys(); /** - * Stores an array of Strings in ExtData. - * The indices of the array are used as subkeys. - * @param key the ExtData key - * @param values the array of string values to store + * Stores an array of Strings in ExtData. The indices of the array are used + * as subkeys. + * + * @param key the ExtData key + * @param values the array of string values to store * @return False if the key is invalid */ public boolean setExtData(String key, String[] values); /** - * Retrieves an array of Strings stored with the key. - * This only works if the data was stored as an array. If the data - * is not correct, this method will return null. - * @param key The ExtData key - * @return The value. Null if not found or the data isn't an array. + * Retrieves an array of Strings stored with the key. This only works if the + * data was stored as an array. If the data is not correct, this method will + * return null. + * + * @param key The ExtData key + * @return The value. Null if not found or the data isn't an array. */ public String[] getExtDataInStringArray(String key); /** * Removes the value of an extdata attribute. - * + * * @param type key to delete */ void deleteExtData(String type); @@ -430,237 +427,252 @@ public interface IRequest { ****************************/ /** - * Helper method to add subkey/value pair to a ExtData hashtable. - * If the hashtable it exists, the subkey/value are added to it. Otherwise - * a new hashtable is created. - * + * Helper method to add subkey/value pair to a ExtData hashtable. If the + * hashtable it exists, the subkey/value are added to it. Otherwise a new + * hashtable is created. + * * The key and subkey are lowercased because LDAP does not preserve case. - * - * @param key The top level key + * + * @param key The top level key * @param subkey The hashtable data key - * @param value The hashtable value + * @param value The hashtable value * @return False if the key or subkey are invalid */ public boolean setExtData(String key, String subkey, String value); /** * Helper method to retrieve an individual value from a Hashtable value. - * @param key the ExtData key - * @param subkey the key in the Hashtable value (case insensitive) + * + * @param key the ExtData key + * @param subkey the key in the Hashtable value (case insensitive) * @return the value corresponding to the key/subkey */ public String getExtDataInString(String key, String subkey); /** - * Helper method to store an Integer value. It converts the integer value - * to a String and stores it. - * - * @param key the ExtData key - * @param value the Integer to store (as a String) + * Helper method to store an Integer value. It converts the integer value to + * a String and stores it. + * + * @param key the ExtData key + * @param value the Integer to store (as a String) * @return False if the key or value are invalid */ public boolean setExtData(String key, Integer value); /** - * Retrieves an integer value. Returns null if not found or - * the value can't be represented as an Integer. - * - * @param key The ExtData key to lookup - * @return The integer value or null if not possible. + * Retrieves an integer value. Returns null if not found or the value can't + * be represented as an Integer. + * + * @param key The ExtData key to lookup + * @return The integer value or null if not possible. */ public Integer getExtDataInInteger(String key); /** * Stores an array of Integers - * @param key The extdata key - * @param values The array of Integers to store - * @return false if the key is invalid + * + * @param key The extdata key + * @param values The array of Integers to store + * @return false if the key is invalid */ public boolean setExtData(String key, Integer[] values); /** * Retrieves an array of Integers - * @param key The extdata key + * + * @param key The extdata key * @return The array of Integers or null on error. */ public Integer[] getExtDataInIntegerArray(String key); /** - * Helper method to store a BigInteger value. It converts the integer value + * Helper method to store a BigInteger value. It converts the integer value * to a String and stores it. - * - * @param key the ExtData key - * @param value the BigInteger to store (as a String) + * + * @param key the ExtData key + * @param value the BigInteger to store (as a String) * @return False if the key or value are invalid */ public boolean setExtData(String key, BigInteger value); /** - * Retrieves a BigInteger value. Returns null if not found or - * the value can't be represented as a BigInteger. - * - * @param key The ExtData key to lookup - * @return The integer value or null if not possible. + * Retrieves a BigInteger value. Returns null if not found or the value + * can't be represented as a BigInteger. + * + * @param key The ExtData key to lookup + * @return The integer value or null if not possible. */ public BigInteger getExtDataInBigInteger(String key); /** * Stores an array of BigIntegers - * @param key The extdata key - * @param values The array of BigIntegers to store - * @return false if the key is invalid + * + * @param key The extdata key + * @param values The array of BigIntegers to store + * @return false if the key is invalid */ public boolean setExtData(String key, BigInteger[] values); /** * Retrieves an array of BigIntegers - * @param key The extdata key + * + * @param key The extdata key * @return The array of BigIntegers or null on error. */ public BigInteger[] getExtDataInBigIntegerArray(String key); /** - * Helper method to store an exception. - * It actually stores the e.toString() value. - * - * @param key The ExtData key to store under - * @param e The throwable to store - * @return False if the key is invalid. + * Helper method to store an exception. It actually stores the e.toString() + * value. + * + * @param key The ExtData key to store under + * @param e The throwable to store + * @return False if the key is invalid. */ public boolean setExtData(String key, Throwable e); /** * Stores a byte array as base64 encoded text - * @param key The ExtData key - * @param data The byte array to store - * @return False if the key is invalid. + * + * @param key The ExtData key + * @param data The byte array to store + * @return False if the key is invalid. */ public boolean setExtData(String key, byte[] data); /** * Retrieves the data, which should be base64 encoded as a byte array. - * @param key The ExtData key - * @return The data, or null if an error occurs. + * + * @param key The ExtData key + * @return The data, or null if an error occurs. */ public byte[] getExtDataInByteArray(String key); /** * Stores a X509CertImpl as base64 encoded text using the getEncode() * method. - * @param key The ExtData key - * @param data certificate - * @return False if the key is invalid. + * + * @param key The ExtData key + * @param data certificate + * @return False if the key is invalid. */ public boolean setExtData(String key, X509CertImpl data); /** * Retrieves the data, which should be base64 encoded as a byte array. - * @param key The ExtData key - * @return The data, or null if an error occurs. + * + * @param key The ExtData key + * @return The data, or null if an error occurs. */ public X509CertImpl getExtDataInCert(String key); /** * Stores an array of X509CertImpls as a base64 encoded text. + * * @param key The ExtData key - * @param data The array of certs to store + * @param data The array of certs to store * @return False if the key or data is invalid. */ public boolean setExtData(String key, X509CertImpl[] data); /** * Retrieves an array of X509CertImpl. - * @param key The ExtData key - * @return Array of certs, or null if not found or invalid data. + * + * @param key The ExtData key + * @return Array of certs, or null if not found or invalid data. */ public X509CertImpl[] getExtDataInCertArray(String key); /** * Stores a X509CertInfo as base64 encoded text using the getEncodedInfo() * method. - * @param key The ExtData key - * @param data certificate - * @return False if the key is invalid. + * + * @param key The ExtData key + * @param data certificate + * @return False if the key is invalid. */ public boolean setExtData(String key, X509CertInfo data); /** * Retrieves the data, which should be base64 encoded as a byte array. - * @param key The ExtData key - * @return The data, or null if an error occurs. + * + * @param key The ExtData key + * @return The data, or null if an error occurs. */ public X509CertInfo getExtDataInCertInfo(String key); /** * Stores an array of X509CertInfos as a base64 encoded text. + * * @param key The ExtData key - * @param data The array of cert infos to store + * @param data The array of cert infos to store * @return False if the key or data is invalid. */ public boolean setExtData(String key, X509CertInfo[] data); /** * Retrieves an array of X509CertInfo. - * @param key The ExtData key - * @return Array of cert infos, or null if not found or invalid data. + * + * @param key The ExtData key + * @return Array of cert infos, or null if not found or invalid data. */ public X509CertInfo[] getExtDataInCertInfoArray(String key); /** * Stores an array of RevokedCertImpls as a base64 encoded text. + * * @param key The ExtData key - * @param data The array of cert infos to store + * @param data The array of cert infos to store * @return False if the key or data is invalid. */ public boolean setExtData(String key, RevokedCertImpl[] data); /** * Retrieves an array of RevokedCertImpl. - * @param key The ExtData key - * @return Array of cert infos, or null if not found or invalid data. + * + * @param key The ExtData key + * @return Array of cert infos, or null if not found or invalid data. */ public RevokedCertImpl[] getExtDataInRevokedCertArray(String key); /** - * Stores the contents of the String Vector in ExtData. - * TODO - as soon as we're allowed to use JDK5 this should be changed - * to use Vector<String> data. - * + * Stores the contents of the String Vector in ExtData. TODO - as soon as + * we're allowed to use JDK5 this should be changed to use Vector<String> + * data. + * * Note that modifications to the Vector are not automatically reflected - * after it is stored. You must call set() again to make the changes. - * - * @param key The extdata key to store + * after it is stored. You must call set() again to make the changes. + * + * @param key The extdata key to store * @param data A vector of Strings to store - * @return False on key error or invalid data. + * @return False on key error or invalid data. */ public boolean setExtData(String key, Vector<?> data); /** - * Returns a vector of strings for the key. - * Note that the returned vector, if modified, does not make changes - * in ExtData. You must call setExtData() to propogate changes back - * into ExtData. - * - * @param key The extdata key - * @return A Vector of strings, or null on error. + * Returns a vector of strings for the key. Note that the returned vector, + * if modified, does not make changes in ExtData. You must call setExtData() + * to propogate changes back into ExtData. + * + * @param key The extdata key + * @return A Vector of strings, or null on error. */ public Vector<String> getExtDataInStringVector(String key); /** - * Gets boolean value for given type or default value - * if attribute is absent. - * + * Gets boolean value for given type or default value if attribute is + * absent. + * * @param type attribute type * @param defVal default attribute value * @return attribute value */ boolean getExtDataInBoolean(String type, boolean defVal); - /** - * Gets extdata boolean value for given type or default value - * if attribute is absent for this request with this prefix. - * + * Gets extdata boolean value for given type or default value if attribute + * is absent for this request with this prefix. + * * @param prefix request prefix * @param type attribute type * @param defVal default attribute value @@ -668,59 +680,64 @@ public interface IRequest { */ public boolean getExtDataInBoolean(String prefix, String type, boolean defVal); - /** * Stores an AuthToken the same as a Hashtable. + * * @param key The ExtData key - * @param data The authtoken to store + * @param data The authtoken to store * @return False if the key or data is invalid. */ public boolean setExtData(String key, IAuthToken data); /** * Retrieves an authtoken. - * @param key The ExtData key - * @return AuthToken, or null if not found or invalid data. + * + * @param key The ExtData key + * @return AuthToken, or null if not found or invalid data. */ public IAuthToken getExtDataInAuthToken(String key); /** * Stores a CertificateExtensions in extdata. + * * @param key The ExtData key - * @param data The CertificateExtensions to store + * @param data The CertificateExtensions to store * @return False if the key or data is invalid. */ public boolean setExtData(String key, CertificateExtensions data); /** * Retrieves the CertificateExtensions associated with the key. - * @param key The ExtData key - * @return the object, or null if not found or invalid data. + * + * @param key The ExtData key + * @return the object, or null if not found or invalid data. */ public CertificateExtensions getExtDataInCertExts(String key); /** * Stores a CertificateSubjectName in extdata. + * * @param key The ExtData key - * @param data The CertificateSubjectName to store + * @param data The CertificateSubjectName to store * @return False if the key or data is invalid. */ public boolean setExtData(String key, CertificateSubjectName data); /** * Retrieves the CertificateSubjectName associated with the key. - * @param key The ExtData key - * @return the object, or null if not found or invalid data. + * + * @param key The ExtData key + * @return the object, or null if not found or invalid data. */ public CertificateSubjectName getExtDataInCertSubjectName(String key); /** - * This method returns an IAttrSet wrapper for the IRequest. - * Use of this method is strongly discouraged. It provides extremely - * limited functionality, and is only provided for the two places IRequest - * is being used as such in the code. If you are considering using this - * method, please don't. - * + * This method returns an IAttrSet wrapper for the IRequest. Use of this + * method is strongly discouraged. It provides extremely limited + * functionality, and is only provided for the two places IRequest is being + * used as such in the code. If you are considering using this method, + * please don't. + * * @return IAttrSet wrapper with basic "get" functionality. * @deprecated */ diff --git a/pki/base/common/src/com/netscape/certsrv/request/IRequestList.java b/pki/base/common/src/com/netscape/certsrv/request/IRequestList.java index a01ceb8c..f1979398 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/IRequestList.java +++ b/pki/base/common/src/com/netscape/certsrv/request/IRequestList.java @@ -17,41 +17,39 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.request; - import java.util.Enumeration; - /** - * An interface providing a list of RequestIds that match - * some criteria. It could be a list of all elements in a - * queue, or just some defined sub-set. - * + * An interface providing a list of RequestIds that match some criteria. It + * could be a list of all elements in a queue, or just some defined sub-set. + * * @version $Revision$, $Date$ */ public interface IRequestList - extends Enumeration { + extends Enumeration { /** - * Gets the next RequestId from this list. null is - * returned when there are no more elements in the list. - * <p> - * Callers should be sure there is another element in the - * list by calling hasMoreElements first. + * Gets the next RequestId from this list. null is returned when there are + * no more elements in the list. + * <p> + * Callers should be sure there is another element in the list by calling + * hasMoreElements first. * <p> + * * @return next request id */ RequestId nextRequestId(); /** * Gets next request from the list. - * + * * @return next request */ public Object nextRequest(); /** * Gets next request Object from the list. - * + * * @return next request */ public IRequest nextRequestObject(); diff --git a/pki/base/common/src/com/netscape/certsrv/request/IRequestListener.java b/pki/base/common/src/com/netscape/certsrv/request/IRequestListener.java index a98cd747..382ffc31 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/IRequestListener.java +++ b/pki/base/common/src/com/netscape/certsrv/request/IRequestListener.java @@ -17,23 +17,21 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.request; - import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.base.ISubsystem; - /** * An interface that defines abilities of request listener, - * + * * @version $Revision$, $Date$ */ public interface IRequestListener { /** - * Initializes request listener for the specific subsystem - * and configuration store. - * + * Initializes request listener for the specific subsystem and configuration + * store. + * * @param sub subsystem * @param config configuration store */ @@ -41,14 +39,14 @@ public interface IRequestListener { /** * Accepts request. - * + * * @param request request */ - public void accept(IRequest request); + public void accept(IRequest request); /** * Sets attribute. - * + * * @param name attribute name * @param val attribute value */ diff --git a/pki/base/common/src/com/netscape/certsrv/request/IRequestNotifier.java b/pki/base/common/src/com/netscape/certsrv/request/IRequestNotifier.java index ba06c626..66bd3543 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/IRequestNotifier.java +++ b/pki/base/common/src/com/netscape/certsrv/request/IRequestNotifier.java @@ -17,27 +17,25 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.request; - import java.util.Enumeration; - /** * IRequestNotifier interface defines methods to register listeners, - * + * * @version $Revision$, $Date$ */ public interface IRequestNotifier extends INotify { /** * Registers a request listener. - * + * * @param listener listener to be registered */ public void registerListener(IRequestListener listener); /** * Registers a request listener. - * + * * @param name listener name * @param listener listener to be registered */ @@ -45,28 +43,28 @@ public interface IRequestNotifier extends INotify { /** * Removes listener from the list of registered listeners. - * + * * @param listener listener to be removed from the list */ public void removeListener(IRequestListener listener); /** * Removes listener from the list of registered listeners. - * + * * @param name listener name to be removed from the list */ public void removeListener(String name); /** * Gets list of listener names. - * + * * @return enumeration of listener names */ - public Enumeration<String> getListenerNames(); + public Enumeration<String> getListenerNames(); /** * Gets listener from the list of registered listeners. - * + * * @param name listener name * @return listener */ @@ -74,55 +72,55 @@ public interface IRequestNotifier extends INotify { /** * Gets list of listeners. - * + * * @return enumeration of listeners */ - public Enumeration<IRequestListener> getListeners(); + public Enumeration<IRequestListener> getListeners(); /** * Gets request from publishing queue. - * + * * @return request */ public IRequest getRequest(); /** * Gets number of requests in publishing queue. - * + * * @return number of requests in publishing queue */ public int getNumberOfRequests(); /** * Checks if publishing queue is enabled. - * + * * @return true if publishing queue is enabled, false otherwise */ public boolean isPublishingQueueEnabled(); /** * Removes a notifier thread from the pool of publishing queue threads. - * + * * @param notifierThread Thread */ public void removeNotifierThread(Thread notifierThread); /** * Notifies all registered listeners about request. - * + * * @param r request */ public void addToNotify(IRequest r); /** * Sets publishing queue parameters. - * + * * @param isPublishingQueueEnabled publishing queue switch * @param publishingQueuePriorityLevel publishing queue priority level * @param maxNumberOfPublishingThreads maximum number of publishing threads * @param publishingQueuePageSize publishing queue page size */ - public void setPublishingQueue (boolean isPublishingQueueEnabled, + public void setPublishingQueue(boolean isPublishingQueueEnabled, int publishingQueuePriorityLevel, int maxNumberOfPublishingThreads, int publishingQueuePageSize, diff --git a/pki/base/common/src/com/netscape/certsrv/request/IRequestQueue.java b/pki/base/common/src/com/netscape/certsrv/request/IRequestQueue.java index 468336b4..943fd10a 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/IRequestQueue.java +++ b/pki/base/common/src/com/netscape/certsrv/request/IRequestQueue.java @@ -22,242 +22,222 @@ import java.math.BigInteger; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.dbs.repository.IRepository; - /** - * The IRequestQueue interface defines the operations on - * a collection of requests within the certificate server. - * There are may several collections, such as KRA, RA and CA - * requests. Each of these request collection has a defined - * set of policies, a notification service (for request - * completion) and a service routine. The request queue - * provides an interface for creating and viewing requests, - * as well as performing operations on them. + * The IRequestQueue interface defines the operations on a collection of + * requests within the certificate server. There are may several collections, + * such as KRA, RA and CA requests. Each of these request collection has a + * defined set of policies, a notification service (for request completion) and + * a service routine. The request queue provides an interface for creating and + * viewing requests, as well as performing operations on them. * <p> + * * @version $Revision$ $Date$ */ public interface IRequestQueue { /** - * Creates a new request object. A request id is - * assigned to it - see IRequest.getRequestId, and - * the status is set to RequestStatus.BEGIN + * Creates a new request object. A request id is assigned to it - see + * IRequest.getRequestId, and the status is set to RequestStatus.BEGIN * <p> - * The request is LOCKED. The caller MUST release the - * request object by calling releaseRequest(). + * The request is LOCKED. The caller MUST release the request object by + * calling releaseRequest(). * <p> - * TODO: provide other required values (such as type - * and sourceId) - * + * TODO: provide other required values (such as type and sourceId) + * * @param requestType request type * @return new request * @exception EBaseException failed to create new request */ public IRequest newRequest(String requestType) - throws EBaseException; + throws EBaseException; /** - * Clones a request object. A new request id is assigned - * and all attributes of the request is copied to cloned request, - * except for the sourceID of the original request - * (remote authority's request Id). + * Clones a request object. A new request id is assigned and all attributes + * of the request is copied to cloned request, except for the sourceID of + * the original request (remote authority's request Id). * <p> - * The cloned request that is returned is LOCKED. The caller MUST - * release the request object by calling releaseRequest(). - * + * The cloned request that is returned is LOCKED. The caller MUST release + * the request object by calling releaseRequest(). + * * @param r request to be cloned * @return cloned request * @exception EBaseException failed to clone request */ - public IRequest cloneRequest(IRequest r) - throws EBaseException; + public IRequest cloneRequest(IRequest r) + throws EBaseException; /** - * Gets the Request corresponding to id. - * Returns null if the id does not correspond - * to a valid request id. + * Gets the Request corresponding to id. Returns null if the id does not + * correspond to a valid request id. * <p> * Errors may be generated for other conditions. - * + * * @param id request id * @return found request * @exception EBaseException failed to access request queue */ public IRequest findRequest(RequestId id) - throws EBaseException; + throws EBaseException; /** - * Begins processing for this request. This call - * is valid only on requests with status BEGIN - * An error is generated for other cases. - * + * Begins processing for this request. This call is valid only on requests + * with status BEGIN An error is generated for other cases. + * * @param req request to be processed * @exception EBaseException failed to process request */ public void processRequest(IRequest req) - throws EBaseException; + throws EBaseException; /** * Sets request scheduler. - * + * * @param scheduler request scheduler */ public void setRequestScheduler(IRequestScheduler scheduler); /** * Gets request scheduler. - * + * * @return request scheduler */ public IRequestScheduler getRequestScheduler(); /** - * Puts a new request into the PENDING state. This call is - * only valid for requests with status BEGIN. An error is - * generated for other cases. + * Puts a new request into the PENDING state. This call is only valid for + * requests with status BEGIN. An error is generated for other cases. * <p> - * This call might be used by agent servlets that want to - * copy a previous request, and resubmit it. By putting it - * into PENDING state, the normal agent screens can be used - * for further processing. - * - * @param req - * the request to mark PENDING + * This call might be used by agent servlets that want to copy a previous + * request, and resubmit it. By putting it into PENDING state, the normal + * agent screens can be used for further processing. + * + * @param req the request to mark PENDING * @exception EBaseException failed to mark request as pending */ public void markRequestPending(IRequest req) - throws EBaseException; + throws EBaseException; /** - * Clones a request object and mark it pending. A new request id is assigned - * and all attributes of the request is copied to cloned request, - * except for the sourceID of the original request - * (remote authority's request Id). + * Clones a request object and mark it pending. A new request id is assigned + * and all attributes of the request is copied to cloned request, except for + * the sourceID of the original request (remote authority's request Id). * <p> - * The cloned request that is returned is LOCKED. The caller MUST - * release the request object by calling releaseRequest(). - * + * The cloned request that is returned is LOCKED. The caller MUST release + * the request object by calling releaseRequest(). + * * @param r request to be cloned * @return cloned request mark PENDING * @exception EBaseException failed to clone or mark request */ - public IRequest cloneAndMarkPending(IRequest r) - throws EBaseException; + public IRequest cloneAndMarkPending(IRequest r) + throws EBaseException; /** - * Approves a request. The request must be locked. + * Approves a request. The request must be locked. * <p> - * This call will fail if: - * the request is not in PENDING state - * the policy modules do not accept the request + * This call will fail if: the request is not in PENDING state the policy + * modules do not accept the request * <p> - * If the policy modules reject the request, then the request - * will remain in the PENDING state. Messages from the policy - * module can be display to the agent to indicate the source - * of the problem. + * If the policy modules reject the request, then the request will remain in + * the PENDING state. Messages from the policy module can be display to the + * agent to indicate the source of the problem. * <p> - * The request processing code adds an AgentApproval to this - * request that contains the authentication id of the agent. This - * data is retrieved from the Session object (qv). - * - * @param request - * the request that is being approved + * The request processing code adds an AgentApproval to this request that + * contains the authentication id of the agent. This data is retrieved from + * the Session object (qv). + * + * @param request the request that is being approved * @exception EBaseException failed to approve request */ public void approveRequest(IRequest request) - throws EBaseException; + throws EBaseException; /** - * Rejects a request. The request must be locked. + * Rejects a request. The request must be locked. * <p> - * This call will fail if: - * the request is not in PENDING state + * This call will fail if: the request is not in PENDING state * <p> - * The agent servlet (or other application) may wish to store - * AgentMessage values to indicate the reason for the action - * - * @param request - * the request that is being rejected + * The agent servlet (or other application) may wish to store AgentMessage + * values to indicate the reason for the action + * + * @param request the request that is being rejected * @exception EBaseException failed to reject request */ public void rejectRequest(IRequest request) - throws EBaseException; + throws EBaseException; /** - * Cancels a request. The request must be locked. + * Cancels a request. The request must be locked. * <p> - * This call will fail if: - * the request is not in PENDING state + * This call will fail if: the request is not in PENDING state * <p> - * The agent servlet (or other application) may wish to store - * AgentMessage values to indicate the reason for the action - * - * @param request - * the request that is being canceled + * The agent servlet (or other application) may wish to store AgentMessage + * values to indicate the reason for the action + * + * @param request the request that is being canceled * @exception EBaseException failed to cancel request */ public void cancelRequest(IRequest request) - throws EBaseException; + throws EBaseException; /** * Updates the request in the permanent data store. * <p> - * This call can be made after changing a value like source - * id or owner, to force the new value to be written. + * This call can be made after changing a value like source id or owner, to + * force the new value to be written. * <p> * The request must be locked to make this call. - * - * @param request - * the request that is being updated + * + * @param request the request that is being updated * @exception EBaseException failed to update request */ public void updateRequest(IRequest request) - throws EBaseException; + throws EBaseException; /** - * Returns an enumerator that lists all RequestIds in the - * queue. The caller should use the RequestIds to locate - * each request by calling findRequest(). + * Returns an enumerator that lists all RequestIds in the queue. The caller + * should use the RequestIds to locate each request by calling + * findRequest(). * <p> - * NOTE: This interface will not be useful for large databases. - * This needs to be replace by a VLV (paged) search object. - * + * NOTE: This interface will not be useful for large databases. This needs + * to be replace by a VLV (paged) search object. + * * @return request list */ public IRequestList listRequests(); /** - * Returns an enumerator that lists all RequestIds for requests - * that are in the given status. For example, all the PENDING - * requests could be listed by specifying RequestStatus.PENDING - * as the <i>status</i> argument + * Returns an enumerator that lists all RequestIds for requests that are in + * the given status. For example, all the PENDING requests could be listed + * by specifying RequestStatus.PENDING as the <i>status</i> argument * <p> - * NOTE: This interface will not be useful for large databases. - * This needs to be replace by a VLV (paged) search object. - * + * NOTE: This interface will not be useful for large databases. This needs + * to be replace by a VLV (paged) search object. + * * @param status request status * @return request list */ public IRequestList listRequestsByStatus(RequestStatus status); /** - * Returns an enumerator that lists all RequestIds for requests - * that match the filter. + * Returns an enumerator that lists all RequestIds for requests that match + * the filter. * <p> - * NOTE: This interface will not be useful for large databases. - * This needs to be replace by a VLV (paged) search object. - * + * NOTE: This interface will not be useful for large databases. This needs + * to be replace by a VLV (paged) search object. + * * @param filter search filter * @return request list */ public IRequestList listRequestsByFilter(String filter); /** - * Returns an enumerator that lists all RequestIds for requests - * that match the filter. + * Returns an enumerator that lists all RequestIds for requests that match + * the filter. * <p> - * NOTE: This interface will not be useful for large databases. - * This needs to be replace by a VLV (paged) search object. - * + * NOTE: This interface will not be useful for large databases. This needs + * to be replace by a VLV (paged) search object. + * * @param filter search filter * @param maxSize max size to return * @return request list @@ -265,12 +245,12 @@ public interface IRequestQueue { public IRequestList listRequestsByFilter(String filter, int maxSize); /** - * Returns an enumerator that lists all RequestIds for requests - * that match the filter. + * Returns an enumerator that lists all RequestIds for requests that match + * the filter. * <p> - * NOTE: This interface will not be useful for large databases. - * This needs to be replace by a VLV (paged) search object. - * + * NOTE: This interface will not be useful for large databases. This needs + * to be replace by a VLV (paged) search object. + * * @param filter search filter * @param maxSize max size to return * @param timeLimit timeout value for the search @@ -281,31 +261,30 @@ public interface IRequestQueue { /** * Gets requests that are pending on handling by the service * <p> + * * @return list of pending requests */ // public IRequestList listServicePendingRequests(); /** * Locates a request from the SourceId. - * - * @param id - * a unique identifier for the record that is based on the source - * of the request, and possibly an identify assigned by the source. - * @return - * The requestid corresponding to this source id. null is - * returned if the source id does not exist. + * + * @param id a unique identifier for the record that is based on the source + * of the request, and possibly an identify assigned by the + * source. + * @return The requestid corresponding to this source id. null is returned + * if the source id does not exist. */ public RequestId findRequestBySourceId(String id); /** * Locates all requests with a particular SourceId. * <p> - * @param id - * an identifier for the record that is based on the source - * of the request - * @return - * A list of requests corresponding to this source id. null is - * returned if the source id does not exist. + * + * @param id an identifier for the record that is based on the source of the + * request + * @return A list of requests corresponding to this source id. null is + * returned if the source id does not exist. */ public IRequestList findRequestsBySourceId(String id); @@ -313,26 +292,27 @@ public interface IRequestQueue { * Releases the LOCK on a request obtained from findRequest() or * newRequest() * <p> + * * @param r request */ public void releaseRequest(IRequest r); /** - * Marks as serviced after destination authority has serviced request. - * Used by connector. - * + * Marks as serviced after destination authority has serviced request. Used + * by connector. + * * @param r request */ public void markAsServiced(IRequest r); /** - * Resends requests + * Resends requests */ public void recover(); /** * Gets a pageable list of IRequest entries in this queue. - * + * * @param pageSize page size * @return request list */ @@ -340,18 +320,19 @@ public interface IRequestQueue { /** * Gets a pageable list of IRequest entries in this queue. - * + * * @param filter search filter * @param pageSize page size * @param sortKey the attributes to sort by * @return request list */ public IRequestVirtualList getPagedRequestsByFilter(String filter, - int pageSize, - String sortKey); + int pageSize, + String sortKey); + /** * Gets a pageable list of IRequest entries in this queue. - * + * * @param fromId request id to start with * @param filter search filter * @param pageSize page size @@ -359,14 +340,14 @@ public interface IRequestQueue { * @return request list */ public IRequestVirtualList getPagedRequestsByFilter(RequestId fromId, - String filter, - int pageSize, + String filter, + int pageSize, String sortKey); /** - * Gets a pageable list of IRequest entries in this queue. This - * jumps right to the end of the list - * + * Gets a pageable list of IRequest entries in this queue. This jumps right + * to the end of the list + * * @param fromId request id to start with * @param jumpToEnd jump to end of list (set fromId to null) * @param filter search filter @@ -375,26 +356,24 @@ public interface IRequestQueue { * @return request list */ public IRequestVirtualList getPagedRequestsByFilter(RequestId fromId, - boolean jumpToEnd, String filter, - int pageSize, + boolean jumpToEnd, String filter, + int pageSize, String sortKey); - /** * Retrieves the notifier for pending request. - * + * * @return notifier for pending request */ public INotify getPendingNotify(); - - public BigInteger getLastRequestIdInRange(BigInteger reqId_low_bound, BigInteger reqId_upper_bound); + public BigInteger getLastRequestIdInRange(BigInteger reqId_low_bound, BigInteger reqId_upper_bound); /** * Resets serial number. */ public void resetSerialNumber(BigInteger serial) throws EBaseException; - + /** * Removes all objects with this repository. */ @@ -402,7 +381,7 @@ public interface IRequestQueue { /** * Gets request repository. - * + * * @return request repository */ public IRepository getRequestRepository(); diff --git a/pki/base/common/src/com/netscape/certsrv/request/IRequestRecord.java b/pki/base/common/src/com/netscape/certsrv/request/IRequestRecord.java index 53a3e37b..d4e11a4f 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/IRequestRecord.java +++ b/pki/base/common/src/com/netscape/certsrv/request/IRequestRecord.java @@ -17,22 +17,21 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.request; - import java.util.Enumeration; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.dbs.IDBObj; - /** - * A request record is the stored version of a request. - * It has a set of attributes that are mapped into LDAP - * attributes for actual directory operations. + * A request record is the stored version of a request. It has a set of + * attributes that are mapped into LDAP attributes for actual directory + * operations. * <p> + * * @version $Revision$ $Date$ */ public interface IRequestRecord - extends IDBObj { + extends IDBObj { // // The names of the attributes stored in this record // @@ -57,28 +56,28 @@ public interface IRequestRecord public final static String ATTR_REQUEST_TYPE = "requestType"; - // Placeholder for ExtAttr data. this attribute is not in LDAP, but + // Placeholder for ExtAttr data. this attribute is not in LDAP, but // is used to trigger the ExtAttrDynMapper during conversion between LDAP // and the RequestRecord. public final static String ATTR_EXT_DATA = "requestExtData"; /** * Gets the request id. - * + * * @return request id */ public RequestId getRequestId(); /** * Gets attribute names of the request. - * + * * @return list of attribute names */ public Enumeration<String> getAttrNames(); /** * Gets the request attribute value by the name. - * + * * @param name attribute name * @return attribute value */ @@ -86,7 +85,7 @@ public interface IRequestRecord /** * Sets new attribute for the request. - * + * * @param name attribute name * @param o attribute value */ @@ -94,20 +93,20 @@ public interface IRequestRecord /** * Removes attribute from the request. - * + * * @param name attribute name */ public void delete(String name) - throws EBaseException; + throws EBaseException; /** * Gets attribute list of the request. - * + * * @return attribute list */ public Enumeration<String> getElements(); // IDBObj.getSerializableAttrNames - //public Enumeration getSerializableAttrNames(); + // public Enumeration getSerializableAttrNames(); } diff --git a/pki/base/common/src/com/netscape/certsrv/request/IRequestScheduler.java b/pki/base/common/src/com/netscape/certsrv/request/IRequestScheduler.java index 198092fc..2d1cb89d 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/IRequestScheduler.java +++ b/pki/base/common/src/com/netscape/certsrv/request/IRequestScheduler.java @@ -17,16 +17,12 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.request; - //import java.io.Serializable; - - /** - * This is an interface to a request scheduler that prioritizes - * the threads based on the request processing order. - * The request that enters the request queue first should - * be processed first. + * This is an interface to a request scheduler that prioritizes the threads + * based on the request processing order. The request that enters the request + * queue first should be processed first. * * @version $Revision$ $Date$ */ @@ -34,14 +30,14 @@ public interface IRequestScheduler { /** * Request entered the request queue processing. - * + * * @param r request */ public void requestIn(IRequest r); /** * Request exited the request queue processing. - * + * * @param r request */ public void requestOut(IRequest r); diff --git a/pki/base/common/src/com/netscape/certsrv/request/IRequestSubsystem.java b/pki/base/common/src/com/netscape/certsrv/request/IRequestSubsystem.java index c32c6698..f7d0d80d 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/IRequestSubsystem.java +++ b/pki/base/common/src/com/netscape/certsrv/request/IRequestSubsystem.java @@ -17,89 +17,78 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.request; - import com.netscape.certsrv.base.EBaseException; - /** - * This interface defines storage of request objects - * in the local database. + * This interface defines storage of request objects in the local database. * <p> + * * @version $Revision$, $Date$ */ public interface IRequestSubsystem { public static final String SUB_ID = "request"; /** - * Creates a new request queue. - * (Currently unimplemented. Just use getRequestQueue to create - * an in-memory queue.) + * Creates a new request queue. (Currently unimplemented. Just use + * getRequestQueue to create an in-memory queue.) * <p> - * @param name The name of the queue object. This name can be used - * in getRequestQueue to retrieve the queue later. + * + * @param name The name of the queue object. This name can be used in + * getRequestQueue to retrieve the queue later. * @exception EBaseException failed to create request queue */ public void createRequestQueue(String name) - throws EBaseException; + throws EBaseException; /** - * Retrieves a request queue. This operation should only be done - * once on each queue. For example, the RA subsystem should retrieve - * its queue, and store it somewhere for use by related services, and - * servlets. + * Retrieves a request queue. This operation should only be done once on + * each queue. For example, the RA subsystem should retrieve its queue, and + * store it somewhere for use by related services, and servlets. * <p> - * WARNING: retrieving the same queue twice with result in multi-thread - * race conditions. + * WARNING: retrieving the same queue twice with result in multi-thread race + * conditions. * <p> - * @param name - * the name of the request queue. (Ex: "ca" "ra") - * @param p - * A policy enforcement module. This object is called to make - * adjustments to the request, and decide whether it needs agent - * approval. - * @param s - * The service object. This object actually performs the request - * after it is finalized and approved. - * @param n - * A notifier object (optional). The notify() method of this object - * is invoked when the request is completed (COMPLETE, REJECTED or - * CANCELED states). + * + * @param name the name of the request queue. (Ex: "ca" "ra") + * @param p A policy enforcement module. This object is called to make + * adjustments to the request, and decide whether it needs agent + * approval. + * @param s The service object. This object actually performs the request + * after it is finalized and approved. + * @param n A notifier object (optional). The notify() method of this object + * is invoked when the request is completed (COMPLETE, REJECTED + * or CANCELED states). * @exception EBaseException failed to retrieve request queue */ public IRequestQueue - getRequestQueue(String name, int increment, IPolicy p, IService s, INotify n) - throws EBaseException; + getRequestQueue(String name, int increment, IPolicy p, IService s, INotify n) + throws EBaseException; /** - * Retrieves a request queue. This operation should only be done - * once on each queue. For example, the RA subsystem should retrieve - * its queue, and store it somewhere for use by related services, and - * servlets. + * Retrieves a request queue. This operation should only be done once on + * each queue. For example, the RA subsystem should retrieve its queue, and + * store it somewhere for use by related services, and servlets. * <p> - * WARNING: retrieving the same queue twice with result in multi-thread - * race conditions. + * WARNING: retrieving the same queue twice with result in multi-thread race + * conditions. * <p> - * @param name - * the name of the request queue. (Ex: "ca" "ra") - * @param p - * A policy enforcement module. This object is called to make - * adjustments to the request, and decide whether it needs agent - * approval. - * @param s - * The service object. This object actually performs the request - * after it is finalized and approved. - * @param n - * A notifier object (optional). The notify() method of this object - * is invoked when the request is completed (COMPLETE, REJECTED or - * CANCELED states). - * @param pendingNotifier - * A notifier object (optional). Like the 'n' argument, except the - * notification happens if the request is made PENDING. May be the - * same as the 'n' argument if desired. + * + * @param name the name of the request queue. (Ex: "ca" "ra") + * @param p A policy enforcement module. This object is called to make + * adjustments to the request, and decide whether it needs agent + * approval. + * @param s The service object. This object actually performs the request + * after it is finalized and approved. + * @param n A notifier object (optional). The notify() method of this object + * is invoked when the request is completed (COMPLETE, REJECTED + * or CANCELED states). + * @param pendingNotifier A notifier object (optional). Like the 'n' + * argument, except the notification happens if the request is + * made PENDING. May be the same as the 'n' argument if desired. * @exception EBaseException failed to retrieve request queue */ public IRequestQueue - getRequestQueue(String name, int increment, IPolicy p, IService s, INotify n, - INotify pendingNotifier) - throws EBaseException; + getRequestQueue(String name, int increment, IPolicy p, IService s, INotify n, + INotify pendingNotifier) + throws EBaseException; } diff --git a/pki/base/common/src/com/netscape/certsrv/request/IRequestVirtualList.java b/pki/base/common/src/com/netscape/certsrv/request/IRequestVirtualList.java index 4d877a77..faf8e07e 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/IRequestVirtualList.java +++ b/pki/base/common/src/com/netscape/certsrv/request/IRequestVirtualList.java @@ -17,25 +17,25 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.request; - /** * This interface defines access to request virtual list. * <p> + * * @version $Revision$, $Date$ */ public interface IRequestVirtualList { /** - * Gets the total size of the result set. Elements of the - * list are numbered from 0..(size-1) - * + * Gets the total size of the result set. Elements of the list are numbered + * from 0..(size-1) + * * @return size of the result set */ int getSize(); /** * Gets the element at the specified index - * + * * @param index index of the element * @return specified request */ @@ -43,7 +43,7 @@ public interface IRequestVirtualList { /** * Gets the current index - * + * * @return current index */ int getCurrentIndex(); diff --git a/pki/base/common/src/com/netscape/certsrv/request/IService.java b/pki/base/common/src/com/netscape/certsrv/request/IService.java index aeaf757a..20e87f12 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/IService.java +++ b/pki/base/common/src/com/netscape/certsrv/request/IService.java @@ -17,32 +17,29 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.request; - import com.netscape.certsrv.base.EBaseException; - /** - * This interface defines how requests are serviced. - * This covers certificate generation, revocation, renewals, - * revocation checking, and much more. + * This interface defines how requests are serviced. This covers certificate + * generation, revocation, renewals, revocation checking, and much more. * <p> + * * @version $Revision$, $Date$ */ public interface IService { /** - * Performs the service (such as certificate generation) - * represented by this request. + * Performs the service (such as certificate generation) represented by this + * request. * <p> - * @param request - * The request that needs service. The service may use - * attributes stored in the request, and may update the - * values, or store new ones. - * @return - * an indication of whether this request is still pending. - * 'false' means the request will wait for further notification. + * + * @param request The request that needs service. The service may use + * attributes stored in the request, and may update the values, + * or store new ones. + * @return an indication of whether this request is still pending. 'false' + * means the request will wait for further notification. * @exception EBaseException indicates major processing failure. */ boolean serviceRequest(IRequest request) - throws EBaseException; + throws EBaseException; } diff --git a/pki/base/common/src/com/netscape/certsrv/request/PolicyMessage.java b/pki/base/common/src/com/netscape/certsrv/request/PolicyMessage.java index 13cec161..dc0c6cbb 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/PolicyMessage.java +++ b/pki/base/common/src/com/netscape/certsrv/request/PolicyMessage.java @@ -17,18 +17,17 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.request; - import com.netscape.certsrv.base.EBaseException; - /** - * A (localizable) message recorded by a policy module that describes - * the reason for rejecting a request. + * A (localizable) message recorded by a policy module that describes the reason + * for rejecting a request. * <p> + * * @version $Revision$, $Date$ */ public class PolicyMessage - extends EBaseException { + extends EBaseException { /** * @@ -38,6 +37,7 @@ public class PolicyMessage /** * Class constructor that registers policy message. * <p> + * * @param message message string */ public PolicyMessage(String message) { diff --git a/pki/base/common/src/com/netscape/certsrv/request/PolicyResult.java b/pki/base/common/src/com/netscape/certsrv/request/PolicyResult.java index 2750e3d8..c7cad94f 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/PolicyResult.java +++ b/pki/base/common/src/com/netscape/certsrv/request/PolicyResult.java @@ -17,10 +17,9 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.request; - /** * This class defines results for policy actions. - * + * * @version $Revision$, $Date$ */ public final class PolicyResult { diff --git a/pki/base/common/src/com/netscape/certsrv/request/RequestId.java b/pki/base/common/src/com/netscape/certsrv/request/RequestId.java index 01bd65d3..f8a4133d 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/RequestId.java +++ b/pki/base/common/src/com/netscape/certsrv/request/RequestId.java @@ -17,32 +17,34 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.request; - /** - * The RequestId class represents the identifier for a particular - * request within a request queue. This identifier may be used to - * retrieve the request object itself from the request queue. + * The RequestId class represents the identifier for a particular request within + * a request queue. This identifier may be used to retrieve the request object + * itself from the request queue. * <p> + * * @version $Revision$ $Date$ */ public final class RequestId { /** - * Creates a new RequestId from its string representation. + * Creates a new RequestId from its string representation. * <p> - * @param id - * a string containing the decimal (base 10) value for the identifier. + * + * @param id a string containing the decimal (base 10) value for the + * identifier. */ public RequestId(String id) { mString = id; } /** - * Converts the RequestId into its string representation. The string - * form can be stored in a database (such as the LDAP directory) + * Converts the RequestId into its string representation. The string form + * can be stored in a database (such as the LDAP directory) * <p> - * @return - * a string containing the decimal (base 10) value for the identifier. + * + * @return a string containing the decimal (base 10) value for the + * identifier. */ public String toString() { return mString; @@ -51,6 +53,7 @@ public final class RequestId { /** * Implements Object.hashCode. * <p> + * * @return hash code of the object */ public int hashCode() { @@ -60,7 +63,8 @@ public final class RequestId { /** * Implements Object.equals. * <p> - * @param obj object to compare + * + * @param obj object to compare * @return true if objects are equal */ public boolean equals(Object obj) { diff --git a/pki/base/common/src/com/netscape/certsrv/request/RequestStatus.java b/pki/base/common/src/com/netscape/certsrv/request/RequestStatus.java index ad3b91e7..059e2b0d 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/RequestStatus.java +++ b/pki/base/common/src/com/netscape/certsrv/request/RequestStatus.java @@ -17,21 +17,19 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.request; - /** - * The RequestStatus class represents the current state of a request - * in a request queue. The state of the request changes as actions - * are performed on it. - * - * The request is created in the BEGIN state, then general progresses - * through the PENDING, APPROVED, SVC_PENDING, and COMPLETE states. - * Some requests may bypass the PENDING state if no agent action is - * required. - * - * Requests may be CANCELED (not implemented) or REJECTED. These are - * error conditions, and usually result because the request was invalid - * or was not approved by an agent. - * + * The RequestStatus class represents the current state of a request in a + * request queue. The state of the request changes as actions are performed on + * it. + * + * The request is created in the BEGIN state, then general progresses through + * the PENDING, APPROVED, SVC_PENDING, and COMPLETE states. Some requests may + * bypass the PENDING state if no agent action is required. + * + * Requests may be CANCELED (not implemented) or REJECTED. These are error + * conditions, and usually result because the request was invalid or was not + * approved by an agent. + * * @version $Revision$ $Date$ */ public final class RequestStatus { @@ -44,22 +42,22 @@ public final class RequestStatus { public static String COMPLETE_STRING = "complete"; /** - * The initial state of a request. Requests in this state have not - * been review by policy. - * - * While in this state the source of the request (usually the servlet, - * but it could be some other protocol module, such as email) - * should populate the request with data need to service it. + * The initial state of a request. Requests in this state have not been + * review by policy. + * + * While in this state the source of the request (usually the servlet, but + * it could be some other protocol module, such as email) should populate + * the request with data need to service it. */ public static RequestStatus BEGIN = new RequestStatus(BEGIN_STRING); /** - * The state of a request that is waiting for action by an agent. - * When the agent approves or rejects the request, process will - * continue as appropriate. - * - * In this state there may be PolicyMessages present that indicate - * the reason for the pending status. + * The state of a request that is waiting for action by an agent. When the + * agent approves or rejects the request, process will continue as + * appropriate. + * + * In this state there may be PolicyMessages present that indicate the + * reason for the pending status. */ public static RequestStatus PENDING = new RequestStatus(PENDING_STRING); @@ -67,80 +65,84 @@ public final class RequestStatus { * The state of a request that has been approved by an agent, or * automatically by the policy engine, but have not been successfully * transmitted to the service module. - * - * These requests are resent to the service during the recovery - * process that runs at server startup. + * + * These requests are resent to the service during the recovery process that + * runs at server startup. */ public static RequestStatus APPROVED = new RequestStatus(APPROVED_STRING); /** - * The state of a request that has been sent to the service, but - * has not been fully processed. The service will invoke the - * serviceComplete() method to cause processing to continue. + * The state of a request that has been sent to the service, but has not + * been fully processed. The service will invoke the serviceComplete() + * method to cause processing to continue. */ public static RequestStatus SVC_PENDING = - new RequestStatus(SVC_PENDING_STRING); + new RequestStatus(SVC_PENDING_STRING); /** - * Not implemented. This is intended to be a final state that is - * reached when a request is removed from the processing queue without - * normal notification occurring. (see REJECTED) + * Not implemented. This is intended to be a final state that is reached + * when a request is removed from the processing queue without normal + * notification occurring. (see REJECTED) */ public static RequestStatus CANCELED = new RequestStatus(CANCELED_STRING); /** - * The state of a request after it is rejected. When a request is - * rejected, the notifier is called prior to making the finl status - * change. - * - * Rejected requests may have PolicyMessages indicating the reason for - * the rejection, or AgentMessages, which allow the agent to give - * reasons for the action. + * The state of a request after it is rejected. When a request is rejected, + * the notifier is called prior to making the finl status change. + * + * Rejected requests may have PolicyMessages indicating the reason for the + * rejection, or AgentMessages, which allow the agent to give reasons for + * the action. */ public static RequestStatus REJECTED = new RequestStatus(REJECTED_STRING); /** - * The normal final state of a request. The completion status attribute - * gives other information about the request. The request is not - * necessarily successful, but may indicated that service processing - * did not succeed. + * The normal final state of a request. The completion status attribute + * gives other information about the request. The request is not necessarily + * successful, but may indicated that service processing did not succeed. */ public static RequestStatus COMPLETE = new RequestStatus(COMPLETE_STRING); /** - * Converts a string name for a request status into the - * request status enum object. + * Converts a string name for a request status into the request status enum + * object. * <p> - * @param s - * The string representation of the state. - * @return - * request status + * + * @param s The string representation of the state. + * @return request status */ public static RequestStatus fromString(String s) { - if (s.equals(BEGIN_STRING)) return BEGIN; - if (s.equals(PENDING_STRING)) return PENDING; - if (s.equals(APPROVED_STRING)) return APPROVED; - if (s.equals(SVC_PENDING_STRING)) return SVC_PENDING; - if (s.equals(CANCELED_STRING)) return CANCELED; - if (s.equals(REJECTED_STRING)) return REJECTED; - if (s.equals(COMPLETE_STRING)) return COMPLETE; + if (s.equals(BEGIN_STRING)) + return BEGIN; + if (s.equals(PENDING_STRING)) + return PENDING; + if (s.equals(APPROVED_STRING)) + return APPROVED; + if (s.equals(SVC_PENDING_STRING)) + return SVC_PENDING; + if (s.equals(CANCELED_STRING)) + return CANCELED; + if (s.equals(REJECTED_STRING)) + return REJECTED; + if (s.equals(COMPLETE_STRING)) + return COMPLETE; return null; } /** - * Returns the string form of the RequestStatus, which may be used - * to record the status in a database. - * + * Returns the string form of the RequestStatus, which may be used to record + * the status in a database. + * * @return request status */ public String toString() { return mString; } - + /** * Class constructor. Creates request status from the string. - * + * * @param string string describing request status */ private RequestStatus(String string) { @@ -151,21 +153,25 @@ public final class RequestStatus { /** * Compares request status with specified string. - * + * * @param string string describing request status */ public boolean equals(String string) { - if (string.equals(mString)) return true; - else return false; + if (string.equals(mString)) + return true; + else + return false; } - + /** * Compares current request status with request status. - * + * * @param rs request status */ public boolean equals(RequestStatus rs) { - if (mString.equals(rs.mString)) return true; - else return false; + if (mString.equals(rs.mString)) + return true; + else + return false; } } diff --git a/pki/base/common/src/com/netscape/certsrv/request/ldap/IRequestMod.java b/pki/base/common/src/com/netscape/certsrv/request/ldap/IRequestMod.java index 1fc0657f..c1e153a8 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/ldap/IRequestMod.java +++ b/pki/base/common/src/com/netscape/certsrv/request/ldap/IRequestMod.java @@ -25,31 +25,31 @@ import com.netscape.certsrv.request.RequestStatus; /** * This interface defines how to update request record. * <p> + * * @version $Revision$, $Date$ */ -public interface IRequestMod -{ - /** +public interface IRequestMod { + /** * Modifies request status. - * + * * @param r request * @param s request status */ - void modRequestStatus(IRequest r, RequestStatus s); + void modRequestStatus(IRequest r, RequestStatus s); - /** + /** * Modifies request creation time. - * + * * @param r request * @param d date */ - void modCreationTime(IRequest r, Date d); + void modCreationTime(IRequest r, Date d); - /** + /** * Modifies request modification time. - * + * * @param r request * @param d date */ - void modModificationTime(IRequest r, Date d); + void modModificationTime(IRequest r, Date d); } |