Skip to content

draft: Updated TableWriter to include service descriptors in query results#209

Open
aratikakadiya wants to merge 7 commits into
opencadc:mainfrom
aratikakadiya:service-descriptors-from-db
Open

draft: Updated TableWriter to include service descriptors in query results#209
aratikakadiya wants to merge 7 commits into
opencadc:mainfrom
aratikakadiya:service-descriptors-from-db

Conversation

@aratikakadiya

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread youcat/src/main/java/org/opencadc/youcat/YoucatTableWriter.java Outdated
Comment thread youcat/src/main/java/org/opencadc/youcat/YoucatTableWriter.java Outdated
Comment thread youcat/src/main/java/org/opencadc/youcat/YoucatTableWriter.java Outdated
String filename = fid + ".xml";
if (serviceDocument == null) {
return;
return; // TODO: verify - continue/return?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please confirm if we have to return if valid document is not found for one of the fieldId.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recall the origin of that check but it should not terminate (current usage is likely why we never noticed). Probably something like this is better:

if (serviceDocument != null) {
    for (VOTableResource metaResource : serviceDocument.getResources()) {
...

@pdowler pdowler left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some minor tweaks needed, otherwise looks right.

Have you considered some intTest(s) in youcat?

  1. create table with IDs (2-3)
  2. add single-ID and multi-ID service descriptor templates
  3. execute queries that select different column combinations

Would not need any rows in the table to get the VOTable result and verify the right descriptors are there.

}

protected void populateAccessURLParam(VOTableResource metaResource) throws MalformedURLException {
RegistryClient regClient = new RegistryClient();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably make regClient a member var rather than recreate each time this method is called. To be conservative, private transient ... and instantiate it here if it is null (lazxy init).

String filename = fid + ".xml";
if (serviceDocument == null) {
return;
return; // TODO: verify - continue/return?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recall the origin of that check but it should not terminate (current usage is likely why we never noticed). Probably something like this is better:

if (serviceDocument != null) {
    for (VOTableResource metaResource : serviceDocument.getResources()) {
...

} catch (URISyntaxException e) {
throw new RuntimeException("resourceIdentifier in " + filename + " is invalid", e);
}
populateAccessURLParam(metaResource);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't matter technically, but probably populateAccessURLParam before add as you have in the youcat-specific extension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants