Package com.netscape.cmscore.request
Class RequestQueue
java.lang.Object
com.netscape.cmscore.request.RequestQueue
This class represents the request queue within the
certificate server. This class implements the state
engine for processing request objects.
There are several queues, such as KRA and CA requests.
Each of these request queues 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.
!Put state machine description here!
This class also provides several accessor functions for
setting fields in the request object. These functions are
provided for saving and restoring the state in the database.
This class also implements the locking operations.
- Version:
- $Revision$ $Date$
- Author:
- thayes
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DBSubsystem
static org.slf4j.Logger
protected String
static final String
Global request version for tracking request changes.protected RequestRepository
-
Constructor Summary
ConstructorsConstructorDescriptionRequestQueue
(DBSubsystem dbSubsystem, RequestRepository requestRepository, IPolicy policy, IService service, RequestNotifier notifier, RequestNotifier pendingNotifier) Create a request queue. -
Method Summary
Modifier and TypeMethodDescriptionvoid
approveRequest
(Request request) Approves a request.void
cancelRequest
(Request request) Cancels a request.Clones a request object and mark it pending.cloneRequest
(Request request) Clones a request object.Retrieves the notifier for pending request.Gets request scheduler.protected String
Get the identity of the current userReturns an enumerator that lists all RequestIds for requests that are in the given status.protected void
log a change in the request statusvoid
markAsServiced
(Request request) Marks as serviced after destination authority has serviced request.void
markRequestPending
(Request request) Puts a new request into the PENDING state.void
Begins processing for this request.void
Recovers from a crash.void
rejectRequest
(Request request) Rejects a request.final void
releaseRequest
(Request request) Releases the LOCK on a request obtained from findRequest() or newRequest()protected void
setCreationTime
(Request request, Date date) Protected access for setting the creation time of a request.protected void
setModificationTime
(Request request, Date date) Protected access for setting the modification time of a request.void
setRequestScheduler
(RequestScheduler scheduler) Sets request scheduler.protected void
-
Field Details
-
logger
public static org.slf4j.Logger logger -
REQUEST_VERSION
Global request version for tracking request changes.- See Also:
-
dbSubsystem
-
mBaseDN
-
requestRepository
-
-
Constructor Details
-
RequestQueue
public RequestQueue(DBSubsystem dbSubsystem, RequestRepository requestRepository, IPolicy policy, IService service, RequestNotifier notifier, RequestNotifier pendingNotifier) throws EBaseException Create a request queue.- Parameters:
policy
- A policy enforcement module. This object is called to make adjustments to the request, and decide whether it needs agent approval.service
- The service object. This object actually performs the request after it is finalized and approved.notifier
- A notifier object (optional). The notify() method of this object is invoked when the request is completed (COMPLETE, REJECTED or CANCELED states).pendingNotifier
- A notifier object (optional). Like the notifier, except the notification happens if the request is made PENDING. May be the same as the 'n' argument if desired.- Throws:
EBaseException
- failed to retrieve request queue
-
-
Method Details
-
getRequestScheduler
Gets request scheduler.- Returns:
- request scheduler
-
setRequestScheduler
Sets request scheduler.- Parameters:
scheduler
- request scheduler
-
cloneRequest
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). The cloned request that is returned is LOCKED. The caller MUST release the request object by calling releaseRequest().- Parameters:
request
- request to be cloned- Returns:
- cloned request
- Throws:
EBaseException
- failed to clone request
-
getUserIdentity
Get the identity of the current user -
stateEngine
- Throws:
EBaseException
-
markRequestPending
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. 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.- Parameters:
request
- the request to mark PENDING- Throws:
EBaseException
- failed to mark request as pending
-
cloneAndMarkPending
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). The cloned request that is returned is LOCKED. The caller MUST release the request object by calling releaseRequest().- Parameters:
r
- request to be cloned- Returns:
- cloned request mark PENDING
- Throws:
EBaseException
- failed to clone or mark request
-
cancelRequest
Cancels a request. The request must be locked. This call will fail if: the request is not in PENDING state The agent servlet (or other application) may wish to store AgentMessage values to indicate the reason for the action- Parameters:
request
- the request that is being canceled- Throws:
EBaseException
- failed to cancel request
-
rejectRequest
Rejects a request. The request must be locked. This call will fail if: the request is not in PENDING state The agent servlet (or other application) may wish to store AgentMessage values to indicate the reason for the action- Parameters:
request
- the request that is being rejected- Throws:
EBaseException
- failed to reject request
-
approveRequest
Approves a request. The request must be locked. This call will fail if: the request is not in PENDING state the policy modules do not accept the request 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. 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).- Parameters:
request
- the request that is being approved- Throws:
EBaseException
- failed to approve request
-
markAsServiced
Marks as serviced after destination authority has serviced request. Used by connector. Caller must lock request and release request.- Parameters:
request
- request- Throws:
EBaseException
-
setModificationTime
Protected access for setting the modification time of a request.- Parameters:
request
- The request to be modified.date
- The new value for the time.
-
setCreationTime
Protected access for setting the creation time of a request.- Parameters:
request
- The request to be modified.date
- The new value for the time.
-
listRequestsByStatus
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 status argument NOTE: This interface will not be useful for large databases. This needs to be replace by a VLV (paged) search object. Should be overridden by the specialized class if a more efficient method is available for implementing this operation.- Parameters:
s
- request status- Returns:
- request list
- Throws:
EBaseException
-
recoverWillBlock
Recovers from a crash. Resends all requests that are in the APPROVED state.- Throws:
Exception
-
getPendingNotify
Retrieves the notifier for pending request.- Returns:
- notifier for pending request
-
processRequest
Begins processing for this request. This call is valid only on requests with status BEGIN An error is generated for other cases.- Parameters:
r
- request to be processed- Throws:
EBaseException
- failed to process request
-
logChange
log a change in the request status -
releaseRequest
Releases the LOCK on a request obtained from findRequest() or newRequest()- Parameters:
request
- request
-