Class StorageRecord<T>

  • Type Parameters:
    T - the type of id
    All Implemented Interfaces:
    Record<T>

    public final class StorageRecord<T>
    extends java.lang.Object
    implements Record<T>
    This class implements a default storage record.
    Author:
    Ween Jiann Lee
    • Method Detail

      • builder

        public static <T> StorageRecord.Builder<T> builder()
        Create an instance of builder.
        Type Parameters:
        T - the type of id
        Returns:
        a new instance of builder
      • getId

        public T getId()
        Specified by:
        getId in interface Record<T>
        Returns:
        valid id if the record is stored, null otherwise
      • getURL

        public java.lang.String getURL()
        Specified by:
        getURL in interface Record<T>
        Returns:
        URL of the stored content
      • getRequestHeaders

        public java.util.Map<java.lang.String,​java.lang.String> getRequestHeaders()
        Specified by:
        getRequestHeaders in interface Record<T>
        Returns:
        map of request headers
      • getRequestBody

        public java.util.Map<java.lang.String,​java.lang.String> getRequestBody()
        Specified by:
        getRequestBody in interface Record<T>
        Returns:
        map of request body
      • getStatusCode

        public int getStatusCode()
        Specified by:
        getStatusCode in interface Record<T>
        Returns:
        status code
      • getResponseHeaders

        public org.apache.http.Header[] getResponseHeaders()
        Specified by:
        getResponseHeaders in interface Record<T>
        Returns:
        BaseResponse headers
      • getContentType

        public org.apache.http.entity.ContentType getContentType()
        Specified by:
        getContentType in interface Record<T>
        Returns:
        ContentType of the content
      • getResponseContent

        public byte[] getResponseContent()
        Specified by:
        getResponseContent in interface Record<T>
        Returns:
        raw response file (uncompressed)
      • getDateCreated

        public long getDateCreated()
        Specified by:
        getDateCreated in interface Record<T>
        Returns:
        valid timestamp if the record is stored, -1 otherwise
      • getMD5

        public java.lang.String getMD5()
        Get md5 hash of the response content.
        Returns:
        md5 hash of the response content