Ignore:
Timestamp:
04/26/12 13:25:34 (12 years ago)
Author:
oschonef
Message:
  • first round of major refactoring to simply the provider
    • result sets converted to iterator/cursor-mode (better streaming support)
    • delegate serializing of records to Result and ResultList?
    • prepare getting rid of over-engineered and complicated MetadataFormats? classes (not done, yet)

HEADS UP: breaks existing API

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OAIProvider/trunk/src/main/java/eu/clarin/oai/provider/RecordList.java

    r1910 r1911  
    11package eu.clarin.oai.provider;
    22
     3import java.util.Date;
     4import java.util.List;
     5
     6import javax.xml.stream.XMLStreamException;
     7import javax.xml.stream.XMLStreamWriter;
    38
    49/**
     
    611 * <em>ListRecords</em> and <em>ListIdentifiers</em> verb. This can also be a
    712 * partial list if the repository wants do flow-control.
     13 *
     14 * A <code>RecordList</code> object maintains a cursor pointing to its
     15 * current record. Initially the cursor is positioned before the first row.
     16 * The next method moves the cursor to the next row, and because it returns
     17 * <code>false</code> when there are no more records in the
     18 * <code>RecordList</code> object, it can be used in a while loop to iterate through the
     19 * result set.
    820 */
    921public interface RecordList {
    1022
    1123    /**
    12      * Release resources as this record list instance is about to be discared.
    13      */
    14     public void close();
    15 
    16     /**
    17      * Returns <code>true</code> if the list has more records. (In other
    18      * words, returns <code>true</code> if <code>nextRecord</code> would
    19      * return an element rather than throwing an exception.)
    20      * 
    21      *  @return <code>true</code> if the list has more records
    22      */
    23     public boolean hasNextRecord();
    24 
    25     /**
    26      * Gets the next record in the list. RecordList implementations must set
    27      * the appropriate values to the passed Record instance.
    28      *
    29      * @param record
    30      *            a Record instance to gather the record data
    31      * @see Record
    32      * @throws NoSuchElementException - iteration has no more results.
    33      */
    34     public void nextRecord(Record record);
    35 
    36     /**
    37      * Return <code>true</code>, if no more partial result lists are
    38      * available for this request. In other words, this method should return
    39      * <code>true</code> either  if this list contains all appropriate records
    40      * for the request or if this result list is the last partial list for the
    41      * request. This is needed for flow-control.
    42      *
    43      * @return <code>true</code> if no more results are available in
    44      *         subsequent requests, <code>false</code> otherwise
    45      */
    46     public boolean isListComplete();
    47 
    48     /**
    4924     * Get the size of the complete result list.
    5025     *
    51      * @return the size of the complete result list or <code>-1</code>, if
    52      *         the repository cannot calculate the total size.
     26     * @return the size of the complete result list or <code>-1</code>, if the
     27     *         repository cannot calculate the total size.
    5328     * @see #getSize()
    5429     */
    5530    public int getTotalSize();
    5631
     32
     33    /**
     34     * Return <code>true</code>, if no more partial result lists are available
     35     * for this request. In other words, this method should return
     36     * <code>true</code> either if this list contains all appropriate records
     37     * for the request or if this result list is the last partial list for the
     38     * request. This is needed for flow-control.
     39     *
     40     * @return <code>true</code> if no more results are available in subsequent
     41     *         requests, <code>false</code> otherwise
     42     */
     43    public boolean isListComplete();
     44
     45
     46    /**
     47     * Release resources as this record list instance is about to be discarded.
     48     */
     49    public void close();
     50
     51   
     52    /**
     53     * Returns <code>true</code> if the list has more records. (In other words,
     54     * returns <code>true</code> if <code>nextRecord</code> would return an
     55     * element rather than throwing an exception.)
     56     *
     57     * @return <code>true</code> if the list has more records
     58     */
     59    public boolean next();
     60
     61   
     62    /**
     63     * Get the localId of the record. The returned object must be compatible
     64     * with repository's implementation of <code>parseLocalId</code> and
     65     * <code>unparseLocalId</code>.
     66     *
     67     * @returns the local Id object of the record
     68     */
     69    public Object getLocalId();
     70
     71    /**
     72     * Get the last changed timestamp of the item.
     73     *
     74     * @return the last changed timestamp of the item
     75     */
     76    public Date getDatestamp();
     77
     78    /**
     79     * set deletion state of the record.
     80     *
     81     * @return <code>true</code> of the record is deleted, <code>false</code>
     82     *         otherwise
     83     * @see Repository#getDeletedNotion()           
     84     */
     85    public boolean isDeleted();
     86
     87    /**
     88     * Get the sets to which this record belongs to.
     89     *
     90     * @return the list of sets to which the records belongs to or
     91     *         <code>null</code> if it does not belong to any sets or the
     92     *         repository does not support set
     93     */
     94    public List<String> getSetSpecs();
     95
     96   
     97    public void writeRecord(XMLStreamWriter writer) throws XMLStreamException;
     98   
     99    // /**
     100    // * Gets the next record in the list. RecordList implementations must set
     101    // * the appropriate values to the passed Record instance.
     102    // *
     103    // * @param record
     104    // * a Record instance to gather the record data
     105    // * @see Record
     106    // * @throws NoSuchElementException - iteration has no more results.
     107    // */
     108    // public void nextRecord(Record record);
     109    //
     110    // /**
     111    // * Return <code>true</code>, if no more partial result lists are
     112    // * available for this request. In other words, this method should return
     113    // * <code>true</code> either if this list contains all appropriate records
     114    // * for the request or if this result list is the last partial list for the
     115    // * request. This is needed for flow-control.
     116    // *
     117    // * @return <code>true</code> if no more results are available in
     118    // * subsequent requests, <code>false</code> otherwise
     119    // */
     120    // public boolean isListComplete();
     121    //
     122
    57123} // class RecordList
Note: See TracChangeset for help on using the changeset viewer.