Class ARequestQueue
- Direct Known Subclasses:
RequestQueue
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 defines several abstract protected functions that need to be defined by the concrete implementation. In particular, this class does not implement the operations for storing requests persistently.
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 TypeFieldDescriptionstatic org.slf4j.Logger
static final String
global request version for tracking request changes. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ARequestQueue
(IPolicy policy, IService service, INotify notify, INotify pendingNotify) -
Method Summary
Modifier and TypeMethodDescriptionabstract void
approveRequest
(IRequest request) Approves a request.abstract void
cancelRequest
(IRequest request) Cancels a request.Clones a request object and mark it pending.abstract IRequest
Clones a request object.abstract RequestId
Locates a request from the SourceId.abstract IRequestList
Locates all requests with a particular SourceId.Retrieves the notifier for pending request.protected abstract Enumeration
<RequestId> Get complete list of RequestId values found i this queue.Gets request scheduler.protected String
get the identity of the current userReturns an enumerator that lists all RequestIds in the queue.abstract IRequestList
Returns an enumerator that lists all RequestIds for requests that are in the given status.protected void
log a change in the request statusabstract void
markAsServiced
(IRequest request) Marks as serviced after destination authority has serviced request.abstract void
markRequestPending
(IRequest request) Puts a new request into the PENDING state.final void
Begins processing for this request.void
recover()
Resends requests New non-blocking recover method.abstract void
recover from a crash.abstract void
rejectRequest
(IRequest request) Rejects a request.final void
releaseRequest
(IRequest request) Releases the LOCK on a request obtained from findRequest() or newRequest()protected final void
setCreationTime
(IRequest request, Date date) protected access for setting the creation time of a request.protected final void
setModificationTime
(IRequest request, Date date) protected access for setting the modification time of a request.void
setRequestScheduler
(IRequestScheduler scheduler) Sets request scheduler.protected final void
abstract void
Updates the request in the permanent data store.
-
Field Details
-
logger
public static org.slf4j.Logger logger -
REQUEST_VERSION
global request version for tracking request changes.- See Also:
-
-
Constructor Details
-
ARequestQueue
-
-
Method Details
-
getRawList
Get complete list of RequestId values found i this queue.This method can form the basis for creating other types of search/list operations (although there are probably more efficient ways of doing this. ARequestQueue implements default versions of some of the searching by using this method as a basis.
TODO: return IRequestList -or- just use listRequests as the basic engine.
- Returns:
- an Enumeration that generates RequestId objects.
-
setModificationTime
-
setCreationTime
-
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:
r
- request to be cloned- Returns:
- cloned request
- Throws:
EBaseException
- failed to clone request
-
setRequestScheduler
Sets request scheduler.- Parameters:
scheduler
- request scheduler
-
getRequestScheduler
-
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
-
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
-
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
-
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
-
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
-
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
-
listRequests
Returns an enumerator that lists all RequestIds in the queue. The caller should use the RequestIds to locate each request by calling findRequest().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.
- Returns:
- request list
-
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 argumentNOTE: 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
-
findRequestBySourceId
Locates a request from the SourceId.- Parameters:
id
- a unique identifier for the record that is based on the source of the request, and possibly an identify assigned by the source.- Returns:
- The requestid corresponding to this source id. null is returned if the source id does not exist.
-
findRequestsBySourceId
Locates all requests with a particular SourceId.- Parameters:
id
- an identifier for the record that is based on the source of the request- Returns:
- A list of requests corresponding to this source id. null is returned if the source id does not exist.
-
releaseRequest
Releases the LOCK on a request obtained from findRequest() or newRequest()- Parameters:
request
- request
-
updateRequest
Updates the request in the permanent data store.This call can be made after changing a value like source id or owner, to force the new value to be written.
The request must be locked to make this call.
- Parameters:
r
- the request that is being updated- Throws:
EBaseException
- failed to update request
-
stateEngine
- Throws:
EBaseException
-
logChange
log a change in the request status -
getUserIdentity
get the identity of the current user -
recover
public void recover()Resends requests New non-blocking recover method. -
recoverWillBlock
public abstract void recoverWillBlock()recover from a crash. Resends all requests that are in the APPROVED state. -
getPendingNotify
Retrieves the notifier for pending request.- Returns:
- notifier for pending request
-