Claus Ibsen created CAMEL-27956:
-----------------------------------

             Summary: camel-oaipmh: verb header keeps the arguments of the 
endpoint verb, consumer harvests only once, from/until validation
                 Key: CAMEL-27956
                 URL: https://issues.apache.org/jira/browse/CAMEL-27956
             Project: Camel
          Issue Type: Bug
            Reporter: Claus Ibsen
             Fix For: 4.25.0


Found while improving the option descriptions of camel-oaipmh for CAMEL-23832 
(pull request https://github.com/apache/camel/pull/31196).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. A verb header keeps the arguments of the endpoint verb
{{Harvester}} clears metadataPrefix, from, until, set and identifier in its 
constructor for the endpoint verb only; 
{{OAIPMHProducer.overrideHarvesterConfigs}} then applies the CamelOaimphVerb 
header through setVerb without clearing them. An endpoint with the default 
ListRecords and a header verb of Identify, ListSets or ListMetadataFormats 
still sends metadataPrefix=oai_dc, and the repository answers badArgument; with 
endpoint verb Identify and header verb ListRecords no metadataPrefix is sent.
Proposed change: choose the arguments to send from the current verb in 
OAIPMHHttpClient.doRequest or Harvester.harvest, not in the constructor.

h4. 2. The consumer harvests only once
{{OAIPMHConsumer}} / Harvester: after the last page Harvester.empty stays true, 
so every later poll does nothing and new records are never harvested until the 
route restarts. poll() always returns 0, so backoff and greedy never see any 
work.
Proposed change: reset the harvester (empty=false, token=null) after a full 
pass, or document the consumer as one-shot; return the number of messages sent.

h4. 3. from and until validation
{{OAIPMHEndpoint.validateParameters}} uses 
ISODateTimeFormat.dateTimeNoMillis(): it rejects the day granularity YYYY-MM-DD 
that OAI-PMH allows and accepts offsets such as +01:00 that OAI-PMH does not. 
The CamelOaimphFrom and CamelOaimphUntil headers are not validated.
Proposed change: accept YYYY-MM-DD and YYYY-MM-DDThh:mm:ssZ, and validate the 
headers too.

h4. 4. Smaller issues
The Harvester constructor also clears identifier for ListMetadataFormats, where 
OAI-PMH 2.0 allows it. OAIPMHHttpClient.doRequest parses the query of the base 
URL with the default charset instead of UTF-8 and drops the user info of the 
base URL. Nine producer headers (CamelOaimphVerb, CamelOaimphMetadataPrefix, 
CamelOaimphFrom, ...) have no @Metadata and are not in the catalog, and the 
header names are spelled Oaimph. verb has no enums. getServiceProtocol returns 
"oai-phm". The doc page shows oaipmh:url while the syntax is oaipmh:baseUrl.


_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to