Class HarvestClient

java.lang.Object
org.javastro.ivoa.registry.harvesting.HarvestClient

public class HarvestClient extends Object
A registry client that will directly return Registry objects. Also deals with continuation tokens seamlessly. TODO it would be a good idea to have an asynchronous streaming style client too for really big harvests.
  • Field Details

  • Constructor Details

    • HarvestClient

      public HarvestClient(String url, boolean doXMLValidation, int harvestChunkSize)
      Create a new harvest client for the given registry OAI-PMH URL. The client creates objects for the responses and will do XML validation if required. Note, however, that failed validation will fail the operations. Otherwise it is somewhat lax in its parsing. OAI-PMH services are able to chunk their responses - the client will automatically handle the continuation. It is possible to limit the number of records returned in a single call to getRecords, which may be useful for very large harvests.
      Parameters:
      url - The oai-pmh endpoint of the registry to harvest.
      doXMLValidation - if true do XML validation of the responses.
      harvestChunkSize - the maximum number of records to return in a single call to getRecords - 0 means return whatever the registry gives in a single response.
  • Method Details

    • resetCursor

      public void resetCursor()
    • hasMoreRecords

      public boolean hasMoreRecords()
    • validate

      public boolean validate()
      check that the registry is set up to be harvestable
      Returns:
      true if OK
    • identify

      public org.javastro.ivoa.entities.resource.Resource identify()
      The registry entry for the registry being harvested.
      Returns:
      the resource describing the registry.
    • getRecord

      public org.javastro.ivoa.entities.resource.Resource getRecord(String identifier)
    • getIdentifiers

      public List<org.javastro.ivoa.entities.oai.oaipmh.HeaderType> getIdentifiers(Instant from, Instant until)
    • getIdentifiers

      public List<org.javastro.ivoa.entities.oai.oaipmh.HeaderType> getIdentifiers(Instant from, Instant until, String set)
    • getRecords

      public List<org.javastro.ivoa.entities.oai.oaipmh.RecordType> getRecords(Instant from, Instant until)
    • getRecords

      public List<org.javastro.ivoa.entities.oai.oaipmh.RecordType> getRecords(Instant from, Instant until, String set)