-
-
Notifications
You must be signed in to change notification settings - Fork 492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate OAIPMH server to Elasticsearch / Spring MVC #7583
base: main
Are you sure you want to change the base?
Conversation
42e59f4
to
9655067
Compare
9655067
to
492d9cb
Compare
492d9cb
to
65a7384
Compare
Hi @josegar74, thanks a lot for the contribution! One of our customers was asking for this feature to be brought back in V4, so I think it would be fair if someone from Camptocamp was doing a review. Can you please let us know if/when the feature is ready for review? Thanks |
@jahow the feature is ready for review, thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this work! The changes in general look OK to me, I think it's good that you are reusing most of the existing logic. I still noticed some bugs, see comments.
Here if a few things I have noticed while testing:
-
The query parameters (both their name and value) are case-sensitive: http://localhost:8080/geonetwork/srv/api/oaipmh?verb=listrecords will give an error, http://localhost:8080/geonetwork/srv/api/oaipmh?verb=ListRecords won't; I couldn't find whether this is spec-compliant, but it is definitely inconvenient (at least for
verb
) -
it looks like the base url is not set correctly in the responses, see in the
request
element:I suspect it is because of the logic here:
core-geonetwork/core/src/main/java/org/fao/geonet/kernel/oaipmh/OaiPmhDispatcher.java
Line 116 in 4c4943e
url = si.getSiteUrl() + context.getBaseUrl() + "/" + Jeeves.Prefix.SERVICE + "/en/" + context.getService();
Optionally, since we're moving away from Jeeves, I've identifier a few things that could help reduce even more the dependency to this framework:
-
could we maybe get rid of this file: https://github.com/geonetwork/core-geonetwork/blob/4c4943ea82b8016873499716fccebc2081059c80/oaipmh/src/main/java/org/fao/oaipmh/util/Xml.java
It looks like a remnant of Jeeves and might be replaced by something more up-to-date -
same thing for
core-geonetwork/core/src/main/java/org/fao/geonet/kernel/oaipmh/Lib.java
Lines 137 to 157 in 4c4943e
public static Element toJeevesException(OaiPmhException e) { String msg = e.getMessage(); String cls = e.getClass().getSimpleName(); String id = e.getCode(); Element res = e.getResponse(); Element error = new Element(Jeeves.Elem.ERROR) .addContent(new Element("message").setText(msg)) .addContent(new Element("class").setText(cls)); error.setAttribute("id", id); if (res != null) { Element elObj = new Element("object"); elObj.addContent(res.detach()); error.addContent(elObj); } return error; }
|
||
ObjectMapper objectMapper = new ObjectMapper(); | ||
|
||
String schema = (params.getChild(PARAM_METADATAPREFIX) != null) ? params.getChild(PARAM_METADATAPREFIX).getValue() : ISO19139SchemaPlugin.IDENTIFIER; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fallback seems useless to me since the request will give an error if no metadataPrefix
parameter is given
Thanks for the review @jahow, I'll take a look in the coming days to fix the issues. Related to this:
I haven't change anything about this afaik. For sure, if it's not correct can be fixed, but not something related to the update to work with Elasticsearch. |
Yes indeed, I understand it's not something that was touched by the migration. I was just mentioning it in case removing this inconvenience would be trivial, but I wouldn't say it's mandatory for this PR. |
@jahow I have fixed the base url and also handled the About the method It is mapped in Jeeves with the name Anyway, I prefer not to change this for now as it is not used in the OAIPMH server code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @josegar74, everything works great now! SonarCloud is giving an error, not sure why it wasn't there before, but I guess this can be merged once the error is resolved.
68f1cfe
to
89ee124
Compare
…lt filename to apply
89ee124
to
727e328
Compare
@jahow and @juanluisrp I've added this change: 727e328, that restricts the allowed characters, but seems CodeQL, just checks the original value is from a user entry. I've tried that change directly in the I guess probably we can dismiss the alert as a false positive, but if you know a better way that can solve the issue? |
I agree, we can probably flag this as false positive with your added check. In theory it would be better to not use user input at all, but seeing the process which leads to this error (44 steps!) I fear it would take this PR way too far. |
@josegar74 could you please share the status of this PR? Do you still intend to merge this eventually? Thanks |
@jahow I plan to merge it, but would like to try to solve the CodeQL issue reported. It has been also done in my personal time, so need to fine time out of my work to finish it. But hopefully it should be available for 4.4.3 |
Thanks Jose for your work on the subject ! At Camptocamp, we are expecting one of our customer to support this work. |
Hello people, do I understand right: if this pull request won't be merged, GeoNetwork 4.* will not be able to be harvested by the OAIPHM / OAI-PMH protocol? I need to understand this as we are still using GeoNetwork 3 for compatibility with OAIPHM, which is the protocol used to harvest our GeoNetwork metadata catalogue and provide metadata to the public. Thanks in advance! |
@aurisnoctis you are right, to be able to harvest GeoNetwork 4.2 / 4.4 using the OAIPHM / OAI-PMH protocol is required this pull request. For now it seems no resources to review it. |
Is it tied to financial issues? Can anybody put a price tag on this one so we can bring this up with our management at the German Meteorological Service? |
Hi @aurisnoctis, Please contact me so we can discuss options around this code review Jose has been working on. You can send me an email at [email protected] Kind regards, |
@aurisnoctis feel free to drop us an email at [email protected] if you need an alternate quotation |
|
This change requests migrates the OAIPMH server to Elasticsearch, previously in GeoNetwork 4.x using the search services, an exception was returned:
ES search does not support OAI yet
.The API has been migrated from the old Jeeves API to Spring MVC with the endpoint http://localhost:8080/geonetwork/srv/api/oaipmh
Checklist
main
branch, backports managed with labelREADME.md
filespom.xml
dependency management. Update build documentation with intended library use and library tutorials or documentation