Class RequestQueue

java.lang.Object
com.netscape.cmscore.request.ARequestQueue
com.netscape.cmscore.request.RequestQueue

public class RequestQueue extends ARequestQueue
  • Field Details

    • logger

      public static org.slf4j.Logger logger
    • dbSubsystem

      protected DBSubsystem dbSubsystem
    • mBaseDN

      protected String mBaseDN
    • mRepository

      protected RequestRepository mRepository
  • Constructor Details

    • RequestQueue

      public RequestQueue(DBSubsystem dbSubsystem, RequestRepository requestRepository, IPolicy policy, IService service, INotify notifier, INotify 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

    • cloneRequest

      public IRequest cloneRequest(IRequest request) throws EBaseException
      Description copied from class: ARequestQueue
      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().

      Specified by:
      cloneRequest in class ARequestQueue
      Parameters:
      request - request to be cloned
      Returns:
      cloned request
      Throws:
      EBaseException - failed to clone request
    • findRequest

      public IRequest findRequest(RequestId id) throws EBaseException
      Throws:
      EBaseException
    • updateRequest

      public void updateRequest(IRequest request) throws EBaseException
      Description copied from class: ARequestQueue
      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.

      Specified by:
      updateRequest in class ARequestQueue
      Parameters:
      request - the request that is being updated
      Throws:
      EBaseException - failed to update request
    • markRequestPending

      public void markRequestPending(IRequest request) throws EBaseException
      Description copied from class: ARequestQueue
      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.

      Specified by:
      markRequestPending in class ARequestQueue
      Parameters:
      request - the request to mark PENDING
      Throws:
      EBaseException - failed to mark request as pending
    • cancelRequest

      public void cancelRequest(IRequest request) throws EBaseException
      Description copied from class: ARequestQueue
      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

      Specified by:
      cancelRequest in class ARequestQueue
      Parameters:
      request - the request that is being canceled
      Throws:
      EBaseException - failed to cancel request
    • rejectRequest

      public void rejectRequest(IRequest request) throws EBaseException
      Description copied from class: ARequestQueue
      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

      Specified by:
      rejectRequest in class ARequestQueue
      Parameters:
      request - the request that is being rejected
      Throws:
      EBaseException - failed to reject request
    • approveRequest

      public void approveRequest(IRequest request) throws EBaseException
      Description copied from class: ARequestQueue
      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).

      Specified by:
      approveRequest in class ARequestQueue
      Parameters:
      request - the request that is being approved
      Throws:
      EBaseException - failed to approve request
    • markAsServiced

      public void markAsServiced(IRequest request) throws EBaseException
      Description copied from class: ARequestQueue
      Marks as serviced after destination authority has serviced request. Used by connector. Caller must lock request and release request.
      Specified by:
      markAsServiced in class ARequestQueue
      Parameters:
      request - request
      Throws:
      EBaseException
    • findRequestBySourceId

      public RequestId findRequestBySourceId(String id)
      Description copied from class: ARequestQueue
      Locates a request from the SourceId.
      Specified by:
      findRequestBySourceId in class ARequestQueue
      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

      public IRequestList findRequestsBySourceId(String id)
      Description copied from class: ARequestQueue
      Locates all requests with a particular SourceId.

      Specified by:
      findRequestsBySourceId in class ARequestQueue
      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.
    • getRawList

      protected Enumeration<RequestId> getRawList()
      Description copied from class: ARequestQueue
      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.

      Specified by:
      getRawList in class ARequestQueue
      Returns:
      an Enumeration that generates RequestId objects.
    • listRequestsByStatus

      public IRequestList listRequestsByStatus(RequestStatus s)
      Description copied from class: ARequestQueue
      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.

      Specified by:
      listRequestsByStatus in class ARequestQueue
      Parameters:
      s - request status
      Returns:
      request list
    • recoverWillBlock

      public void recoverWillBlock()
      Recovers from a crash. Resends all requests that are in the APPROVED state.
      Specified by:
      recoverWillBlock in class ARequestQueue