-
Notifications
You must be signed in to change notification settings - Fork 1
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
auto detect latest ARDC versions #170
Conversation
put back to draft: try to implement this for other ticket:
|
02d0756
to
137366b
Compare
"/aodn-parameter-category-vocabulary/%s/concept.json", | ||
"/aodn-parameter-category-vocabulary/%s/resource.json?uri=%s", | ||
"/aodn-discovery-parameter-vocabulary/%s/concept.json", | ||
"/aodn-discovery-parameter-vocabulary/%s/resource.json?uri=%s" |
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.
although I could replace version
directly with current
, writing tests is a bit headache, after debugging I found that links like this for example:
https://vocabs.ardc.edu.au/repository/api/lda/aodn/aodn-platform-vocabulary/current/concept.json
or
https://vocabs.ardc.edu.au/repository/api/lda/aodn/aodn-platform-vocabulary/current/concept.json?_page=1
the next
and prev
fields refer to paths with specific version
instead of current
.
So less complex tests and later on ... check if there are versions change to update caches, I keep this template enum, and have separate method for extracting latest specific versions from current
, current
is just a starting point wrapper.
synchronized (this) { | ||
storedResolvedPathCollection = latestResolvedPathCollection; | ||
log.info("Updated storedResolvedPathCollection with the latest data."); | ||
} |
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.
I attempted to update each vocabulary with the associated specific version, but it seems unnecessary for the purpose of checking if there are version changes from the current context.
This one works with similar logic: upon bean creation, the initial collection of versions is gathered. The cron job will then scan and check if the initial collection of versions has changed. If so, it will make the latest versions the head (update storedResolvedPathCollection), repopulate the vocabularies, and update the associated caches.
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.
LGTM
for (ArdcRootPaths rootPath : ArdcRootPaths.values()) { | ||
try { | ||
// Fetch HTML contents for category and vocab | ||
String categoryRootHtmlContent = fetchHtmlContent(rootPath.getCategoryRoot()); |
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.
Is there a json version instead of HTML?
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.
Just for recording purpose which I mentioned to @vietnguyengit , you can use the word "current" instead of version in the restapi, so it points to the latest, from the you can check the json's version and decide if you need to download a new one
No description provided.