Class Request

java.lang.Object
com.netscape.cmscore.request.Request
All Implemented Interfaces:
IRequest, Serializable

public class Request extends Object implements IRequest
Request - implementation of the IRequest interface. This version is returned by ARequestQueue (and its derivatives)
See Also:
  • Field Details

    • logger

      public static org.slf4j.Logger logger
    • mRequestId

      protected RequestId mRequestId
    • mRequestStatus

      protected RequestStatus mRequestStatus
    • mSourceId

      protected String mSourceId
    • mSource

      protected String mSource
    • mOwner

      protected String mOwner
    • mRequestType

      protected String mRequestType
    • mContext

      protected String mContext
    • realm

      protected String realm
    • mExtData

      protected ExtDataHashtable<Object> mExtData
  • Constructor Details

  • Method Details

    • getRequestId

      public RequestId getRequestId()
      Description copied from interface: IRequest
      Gets the primary identifier for this request.
      Specified by:
      getRequestId in interface IRequest
      Returns:
      request id
    • getRequestStatus

      public RequestStatus getRequestStatus()
      Description copied from interface: IRequest
      Gets the current state of this request.
      Specified by:
      getRequestStatus in interface IRequest
      Returns:
      request status
    • setRequestStatus

      public void setRequestStatus(RequestStatus s)
      Description copied from interface: IRequest
      Sets status of this request.
      Specified by:
      setRequestStatus in interface IRequest
      Parameters:
      s - request status
    • isSuccess

      public boolean isSuccess()
      Description copied from interface: IRequest
      Gets status of connector transfer.
      Specified by:
      isSuccess in interface IRequest
      Returns:
      status of connector transfer
    • getError

      public String getError(Locale locale)
      Description copied from interface: IRequest
      Gets localized error message from connector transfer.
      Specified by:
      getError in interface IRequest
      Parameters:
      locale - request locale
      Returns:
      error message from connector transfer
    • getErrorCode

      public String getErrorCode(Locale locale)
      Description copied from interface: IRequest
      Get error code
      Specified by:
      getErrorCode in interface IRequest
      Parameters:
      locale - request locale
      Returns:
      error code
    • getSourceId

      public String getSourceId()
      Description copied from interface: IRequest
      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.

      The sourceId should be unique so that it can be used to retrieve request later without knowing the locally assigned primary id (RequestID)

      Specified by:
      getSourceId in interface IRequest
      Returns:
      the sourceId value (or null if none has been set)
    • setSourceId

      public void setSourceId(String id)
      Description copied from interface: IRequest
      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 ARequestQueue.update() or by performing one of the other operations like processRequest or approveRequest.
      Specified by:
      setSourceId in interface IRequest
      Parameters:
      id - source id for this request
    • getRequestOwner

      public String getRequestOwner()
      Description copied from interface: IRequest
      Gets the current owner of this request.
      Specified by:
      getRequestOwner in interface IRequest
      Returns:
      request owner
    • setRequestOwner

      public void setRequestOwner(String id)
      Description copied from interface: IRequest
      Sets the current owner of this request.
      Specified by:
      setRequestOwner in interface IRequest
      Parameters:
      id - The new owner of this request. If this value is set to null there will be no current owner
    • getRequestType

      public String getRequestType()
      Description copied from interface: IRequest
      Gets the type of this request.
      Specified by:
      getRequestType in interface IRequest
      Returns:
      request type
    • setRequestType

      public void setRequestType(String type)
      Description copied from interface: IRequest
      Sets the type or this request.
      Specified by:
      setRequestType in interface IRequest
      Parameters:
      type - request type
    • getRequestVersion

      public String getRequestVersion()
      Description copied from interface: IRequest
      Gets the version of this request.
      Specified by:
      getRequestVersion in interface IRequest
      Returns:
      request version
    • getCreationTime

      public Date getCreationTime()
      Description copied from interface: IRequest
      Gets the time this request was created.
      Specified by:
      getCreationTime in interface IRequest
      Returns:
      request creation time
    • setCreationTime

      public void setCreationTime(Date date)
      Specified by:
      setCreationTime in interface IRequest
    • getContext

      public String getContext()
      Description copied from interface: IRequest
      Gets context of this request.
      Specified by:
      getContext in interface IRequest
      Returns:
      request context
    • setContext

      public void setContext(String ctx)
      Description copied from interface: IRequest
      Sets context of this request.
      Specified by:
      setContext in interface IRequest
      Parameters:
      ctx - request context
    • getModificationTime

      public Date getModificationTime()
      Description copied from interface: IRequest
      Gets the time this request was last modified (defined as updated in the queue) (See ARequestQueue.update)
      Specified by:
      getModificationTime in interface IRequest
      Returns:
      request last modification time
    • setModificationTime

      public void setModificationTime(Date date)
      Specified by:
      setModificationTime in interface IRequest
    • copyContents

      public void copyContents(IRequest req)
      this isn't that efficient but will do for now.
      Specified by:
      copyContents in interface IRequest
      Parameters:
      req - another request
    • isValidExtDataKey

      protected boolean isValidExtDataKey(String key)
      This function used to check that the keys obeyed LDAP attribute name syntax rules. Keys are being encoded now, so it is changed to just filter out null and empty string keys.
      Parameters:
      key - The key to check
      Returns:
      false if invalid
    • isValidExtDataHashtableValue

      protected boolean isValidExtDataHashtableValue(Hashtable<String,String> hash)
    • setExtData

      public boolean setExtData(String key, String value)
      Description copied from interface: IRequest
      Sets an Extended Data string-key string-value pair. All keys are lower cased because LDAP does not preserve case.
      Specified by:
      setExtData in interface IRequest
      Parameters:
      key - The extended data key
      value - The extended data value
      Returns:
      false if key is invalid.
    • setExtData

      public boolean setExtData(String key, Hashtable<String,String> value)
      Description copied from interface: IRequest
      Sets an Extended Data string-key string-value pair. The key and hashtable keys are all lowercased because LDAP does not preserve case.
      Specified by:
      setExtData in interface IRequest
      Parameters:
      key - The extended data key
      value - The extended data value the Hashtable contains an illegal key.
      Returns:
      false if the key or hashtable keys are invalid
    • isSimpleExtDataValue

      public boolean isSimpleExtDataValue(String key)
      Description copied from interface: IRequest
      Checks whether the key is storing a simple String value, or a complex (Vector/hashtable) structure.
      Specified by:
      isSimpleExtDataValue in interface IRequest
      Parameters:
      key - The key to check for.
      Returns:
      True if the key maps to a string. False if it maps to a hashtable.
    • getExtDataInString

      public String getExtDataInString(String key)
      Description copied from interface: IRequest
      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).
      Specified by:
      getExtDataInString in interface IRequest
      Parameters:
      key - The key to lookup (case-insensitive)
      Returns:
      The value associated with the key. null if not found or if the key is associated with a non-string value.
    • getExtDataInHashtable

      public Hashtable<String,String> getExtDataInHashtable(String key)
      Description copied from interface: IRequest
      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 might behave strangely in some cases (e.g., iterating keys)
      Specified by:
      getExtDataInHashtable in interface IRequest
      Parameters:
      key - The key to lookup (case-insensitive)
      Returns:
      The hashtable value associated with the key. null if not found or if the key is associated with a string-value.
    • getExtDataKeys

      public Enumeration<String> getExtDataKeys()
      Description copied from interface: IRequest
      Returns all the keys stored in ExtData
      Specified by:
      getExtDataKeys in interface IRequest
      Returns:
      Enumeration of all the keys.
    • deleteExtData

      public void deleteExtData(String type)
      Description copied from interface: IRequest
      Removes the value of an extdata attribute.
      Specified by:
      deleteExtData in interface IRequest
      Parameters:
      type - key to delete
    • setExtData

      public boolean setExtData(String key, String subkey, String value)
      Description copied from 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. The key and subkey are lowercased because LDAP does not preserve case.
      Specified by:
      setExtData in interface IRequest
      Parameters:
      key - The top level key
      subkey - The hashtable data key
      value - The hashtable value
      Returns:
      False if the key or subkey are invalid
    • getExtDataInString

      public String getExtDataInString(String key, String subkey)
      Description copied from interface: IRequest
      Helper method to retrieve an individual value from a Hashtable value.
      Specified by:
      getExtDataInString in interface IRequest
      Parameters:
      key - the ExtData key
      subkey - the key in the Hashtable value (case insensitive)
      Returns:
      the value corresponding to the key/subkey
    • setExtData

      public boolean setExtData(String key, Integer value)
      Description copied from interface: IRequest
      Helper method to store an Integer value. It converts the integer value to a String and stores it.
      Specified by:
      setExtData in interface IRequest
      Parameters:
      key - the ExtData key
      value - the Integer to store (as a String)
      Returns:
      False if the key or value are invalid
    • getExtDataInInteger

      public Integer getExtDataInInteger(String key)
      Description copied from interface: IRequest
      Retrieves an integer value. Returns null if not found or the value can't be represented as an Integer.
      Specified by:
      getExtDataInInteger in interface IRequest
      Parameters:
      key - The ExtData key to lookup
      Returns:
      The integer value or null if not possible.
    • setExtData

      public boolean setExtData(String key, Integer[] data)
      Description copied from interface: IRequest
      Stores an array of Integers
      Specified by:
      setExtData in interface IRequest
      Parameters:
      key - The extdata key
      data - The array of Integers to store
      Returns:
      false if the key is invalid
    • getExtDataInIntegerArray

      public Integer[] getExtDataInIntegerArray(String key)
      Description copied from interface: IRequest
      Retrieves an array of Integers
      Specified by:
      getExtDataInIntegerArray in interface IRequest
      Parameters:
      key - The extdata key
      Returns:
      The array of Integers or null on error.
    • setExtData

      public boolean setExtData(String key, BigInteger value)
      Description copied from interface: IRequest
      Helper method to store a BigInteger value. It converts the integer value to a String and stores it.
      Specified by:
      setExtData in interface IRequest
      Parameters:
      key - the ExtData key
      value - the BigInteger to store (as a String)
      Returns:
      False if the key or value are invalid
    • getExtDataInBigInteger

      public BigInteger getExtDataInBigInteger(String key)
      Description copied from interface: IRequest
      Retrieves a BigInteger value. Returns null if not found or the value can't be represented as a BigInteger.
      Specified by:
      getExtDataInBigInteger in interface IRequest
      Parameters:
      key - The ExtData key to lookup
      Returns:
      The integer value or null if not possible.
    • setExtData

      public boolean setExtData(String key, BigInteger[] data)
      Description copied from interface: IRequest
      Stores an array of BigIntegers
      Specified by:
      setExtData in interface IRequest
      Parameters:
      key - The extdata key
      data - The array of BigIntegers to store
      Returns:
      false if the key is invalid
    • getExtDataInBigIntegerArray

      public BigInteger[] getExtDataInBigIntegerArray(String key)
      Description copied from interface: IRequest
      Retrieves an array of BigIntegers
      Specified by:
      getExtDataInBigIntegerArray in interface IRequest
      Parameters:
      key - The extdata key
      Returns:
      The array of BigIntegers or null on error.
    • setExtData

      public boolean setExtData(String key, Throwable e)
      Description copied from interface: IRequest
      Helper method to store an exception. It actually stores the e.toString() value.
      Specified by:
      setExtData in interface IRequest
      Parameters:
      key - The ExtData key to store under
      e - The throwable to store
      Returns:
      False if the key is invalid.
    • setExtData

      public boolean setExtData(String key, byte[] data)
      Description copied from interface: IRequest
      Stores a byte array as base64 encoded text
      Specified by:
      setExtData in interface IRequest
      Parameters:
      key - The ExtData key
      data - The byte array to store
      Returns:
      False if the key is invalid.
    • getExtDataInByteArray

      public byte[] getExtDataInByteArray(String key)
      Description copied from interface: IRequest
      Retrieves the data, which should be base64 encoded as a byte array.
      Specified by:
      getExtDataInByteArray in interface IRequest
      Parameters:
      key - The ExtData key
      Returns:
      The data, or null if an error occurs.
    • setExtData

      public boolean setExtData(String key, org.mozilla.jss.netscape.security.x509.X509CertImpl data)
      Description copied from interface: IRequest
      Stores a X509CertImpl as base64 encoded text using the getEncode() method.
      Specified by:
      setExtData in interface IRequest
      Parameters:
      key - The ExtData key
      data - certificate
      Returns:
      False if the key is invalid.
    • getExtDataInCert

      public org.mozilla.jss.netscape.security.x509.X509CertImpl getExtDataInCert(String key)
      Description copied from interface: IRequest
      Retrieves the data, which should be base64 encoded as a byte array.
      Specified by:
      getExtDataInCert in interface IRequest
      Parameters:
      key - The ExtData key
      Returns:
      The data, or null if an error occurs.
    • setExtData

      public boolean setExtData(String key, org.mozilla.jss.netscape.security.x509.X509CertImpl[] data)
      Description copied from interface: IRequest
      Stores an array of X509CertImpls as a base64 encoded text.
      Specified by:
      setExtData in interface IRequest
      Parameters:
      key - The ExtData key
      data - The array of certs to store
      Returns:
      False if the key or data is invalid.
    • getExtDataInCertArray

      public org.mozilla.jss.netscape.security.x509.X509CertImpl[] getExtDataInCertArray(String key)
      Description copied from interface: IRequest
      Retrieves an array of X509CertImpl.
      Specified by:
      getExtDataInCertArray in interface IRequest
      Parameters:
      key - The ExtData key
      Returns:
      Array of certs, or null if not found or invalid data.
    • setExtData

      public boolean setExtData(String key, org.mozilla.jss.netscape.security.x509.X509CertInfo data)
      Description copied from interface: IRequest
      Stores a X509CertInfo as base64 encoded text using the getEncodedInfo() method.
      Specified by:
      setExtData in interface IRequest
      Parameters:
      key - The ExtData key
      data - certificate
      Returns:
      False if the key is invalid.
    • getExtDataInCertInfo

      public org.mozilla.jss.netscape.security.x509.X509CertInfo getExtDataInCertInfo(String key)
      Description copied from interface: IRequest
      Retrieves the data, which should be base64 encoded as a byte array.
      Specified by:
      getExtDataInCertInfo in interface IRequest
      Parameters:
      key - The ExtData key
      Returns:
      The data, or null if an error occurs.
    • setExtData

      public boolean setExtData(String key, org.mozilla.jss.netscape.security.x509.X509CertInfo[] data)
      Description copied from interface: IRequest
      Stores an array of X509CertInfos as a base64 encoded text.
      Specified by:
      setExtData in interface IRequest
      Parameters:
      key - The ExtData key
      data - The array of cert infos to store
      Returns:
      False if the key or data is invalid.
    • getExtDataInCertInfoArray

      public org.mozilla.jss.netscape.security.x509.X509CertInfo[] getExtDataInCertInfoArray(String key)
      Description copied from interface: IRequest
      Retrieves an array of X509CertInfo.
      Specified by:
      getExtDataInCertInfoArray in interface IRequest
      Parameters:
      key - The ExtData key
      Returns:
      Array of cert infos, or null if not found or invalid data.
    • setExtData

      public boolean setExtData(String key, org.mozilla.jss.netscape.security.x509.RevokedCertImpl[] data)
      Description copied from interface: IRequest
      Stores an array of RevokedCertImpls as a base64 encoded text.
      Specified by:
      setExtData in interface IRequest
      Parameters:
      key - The ExtData key
      data - The array of cert infos to store
      Returns:
      False if the key or data is invalid.
    • getExtDataInRevokedCertArray

      public org.mozilla.jss.netscape.security.x509.RevokedCertImpl[] getExtDataInRevokedCertArray(String key)
      Description copied from interface: IRequest
      Retrieves an array of RevokedCertImpl.
      Specified by:
      getExtDataInRevokedCertArray in interface IRequest
      Parameters:
      key - The ExtData key
      Returns:
      Array of cert infos, or null if not found or invalid data.
    • setExtData

      public boolean setExtData(String key, Vector<?> stringVector)
      Description copied from interface: IRequest
      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 data. Note that modifications to the Vector are not automatically reflected after it is stored. You must call set() again to make the changes.
      Specified by:
      setExtData in interface IRequest
      Parameters:
      key - The extdata key to store
      stringVector - A vector of Strings to store
      Returns:
      False on key error or invalid data.
    • getExtDataInStringVector

      public Vector<String> getExtDataInStringVector(String key)
      Description copied from interface: IRequest
      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.
      Specified by:
      getExtDataInStringVector in interface IRequest
      Parameters:
      key - The extdata key
      Returns:
      A Vector of strings, or null on error.
    • getExtDataInBoolean

      public boolean getExtDataInBoolean(String key, boolean defVal)
      Description copied from interface: IRequest
      Gets boolean value for given type or default value if attribute is absent.
      Specified by:
      getExtDataInBoolean in interface IRequest
      Parameters:
      key - attribute type
      defVal - default attribute value
      Returns:
      attribute value
    • getExtDataInBoolean

      public boolean getExtDataInBoolean(String prefix, String type, boolean defVal)
      Description copied from interface: IRequest
      Gets extdata boolean value for given type or default value if attribute is absent for this request with this prefix.
      Specified by:
      getExtDataInBoolean in interface IRequest
      Parameters:
      prefix - request prefix
      type - attribute type
      defVal - default attribute value
      Returns:
      attribute value
    • setExtData

      public boolean setExtData(String key, IAuthToken data)
      Description copied from interface: IRequest
      Stores an AuthToken the same as a Hashtable.
      Specified by:
      setExtData in interface IRequest
      Parameters:
      key - The ExtData key
      data - The authtoken to store
      Returns:
      False if the key or data is invalid.
    • getExtDataInAuthToken

      public IAuthToken getExtDataInAuthToken(String key)
      Description copied from interface: IRequest
      Retrieves an authtoken.
      Specified by:
      getExtDataInAuthToken in interface IRequest
      Parameters:
      key - The ExtData key
      Returns:
      AuthToken, or null if not found or invalid data.
    • setExtData

      public boolean setExtData(String key, org.mozilla.jss.netscape.security.x509.CertificateExtensions data)
      Description copied from interface: IRequest
      Stores a CertificateExtensions in extdata.
      Specified by:
      setExtData in interface IRequest
      Parameters:
      key - The ExtData key
      data - The CertificateExtensions to store
      Returns:
      False if the key or data is invalid.
    • getExtDataInCertExts

      public org.mozilla.jss.netscape.security.x509.CertificateExtensions getExtDataInCertExts(String key)
      Description copied from interface: IRequest
      Retrieves the CertificateExtensions associated with the key.
      Specified by:
      getExtDataInCertExts in interface IRequest
      Parameters:
      key - The ExtData key
      Returns:
      the object, or null if not found or invalid data.
    • setExtData

      public boolean setExtData(String key, org.mozilla.jss.netscape.security.x509.CertificateSubjectName data)
      Description copied from interface: IRequest
      Stores a CertificateSubjectName in extdata.
      Specified by:
      setExtData in interface IRequest
      Parameters:
      key - The ExtData key
      data - The CertificateSubjectName to store
      Returns:
      False if the key or data is invalid.
    • getExtDataInCertSubjectName

      public org.mozilla.jss.netscape.security.x509.CertificateSubjectName getExtDataInCertSubjectName(String key)
      Description copied from interface: IRequest
      Retrieves the CertificateSubjectName associated with the key.
      Specified by:
      getExtDataInCertSubjectName in interface IRequest
      Parameters:
      key - The ExtData key
      Returns:
      the object, or null if not found or invalid data.
    • setExtData

      public boolean setExtData(String key, String[] values)
      Description copied from interface: IRequest
      Stores an array of Strings in ExtData. The indices of the array are used as subkeys.
      Specified by:
      setExtData in interface IRequest
      Parameters:
      key - the ExtData key
      values - the array of string values to store
      Returns:
      False if the key is invalid
    • getExtDataInStringArray

      public String[] getExtDataInStringArray(String key)
      Description copied from interface: IRequest
      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.
      Specified by:
      getExtDataInStringArray in interface IRequest
      Parameters:
      key - The ExtData key
      Returns:
      The value. Null if not found or the data isn't an array.
    • asIAttrSet

      public IAttrSet asIAttrSet()
      Specified by:
      asIAttrSet in interface IRequest
      Returns:
      IAttrSet wrapper with basic "get" functionality.
    • getRealm

      public String getRealm()
      Description copied from interface: IRequest
      Get realm
      Specified by:
      getRealm in interface IRequest
      Returns:
      String
    • setRealm

      public void setRealm(String realm)
      Description copied from interface: IRequest
      Set the realm
      Specified by:
      setRealm in interface IRequest