Skip to content
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

Updates to support Airborne, Facility, Telescope #36

Merged
merged 5 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 107 additions & 16 deletions .secrets.baseline
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"version": "1.4.0",
"plugins_used": [
{
"name": "AbsolutePathDetectorExperimental"
},
{
"name": "ArtifactoryDetector"
},
Expand Down Expand Up @@ -84,6 +87,10 @@
{
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
},
{
"path": "detect_secrets.filters.common.is_baseline_file",
"filename": ".secrets.baseline"
},
{
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
"min_level": 2
Expand Down Expand Up @@ -118,9 +125,9 @@
{
"path": "detect_secrets.filters.regex.should_exclude_file",
"pattern": [
"\\.secrets..*",
"\\.git.*",
"\\.pre-commit-config\\.yaml",
"\\.secrets..*",
"target"
]
}
Expand All @@ -132,49 +139,56 @@
"filename": "pom.xml",
"hashed_secret": "1ac7d6deddaec3bd29b1f559a573231d20d764fd",
"is_verified": false,
"line_number": 54
"line_number": 54,
"is_secret": false
},
{
"type": "Email Address",
"filename": "pom.xml",
"hashed_secret": "540014818ba08bb201f4089dcd7a258df4c18def",
"is_verified": false,
"line_number": 63
"line_number": 63,
"is_secret": false
},
{
"type": "Email Address",
"filename": "pom.xml",
"hashed_secret": "e6177c16552f67db8291470da78bb5861528f099",
"is_verified": false,
"line_number": 72
"line_number": 72,
"is_secret": false
},
{
"type": "Email Address",
"filename": "pom.xml",
"hashed_secret": "65de0cd504a5eb6ad0f3d7b8c15f58b63d8d2756",
"is_verified": false,
"line_number": 81
"line_number": 81,
"is_secret": false
},
{
"type": "Email Address",
"filename": "pom.xml",
"hashed_secret": "7d0f4874e97bff44beab5ee6b1325c07d72e8669",
"is_verified": false,
"line_number": 90
"line_number": 90,
"is_secret": false
},
{
"type": "Email Address",
"filename": "pom.xml",
"hashed_secret": "ad490cee7e921f193b7af865d35c41319c192ff2",
"is_verified": false,
"line_number": 101
"line_number": 101,
"is_secret": false
},
{
"type": "Email Address",
"filename": "pom.xml",
"hashed_secret": "4b59e2ffa9a153c3e0c9aebbc172367f275b73cb",
"is_verified": false,
"line_number": 109
"line_number": 109,
"is_secret": false
}
],
"src/changes/changes.xml": [
Expand All @@ -183,14 +197,86 @@
"filename": "src/changes/changes.xml",
"hashed_secret": "1ac7d6deddaec3bd29b1f559a573231d20d764fd",
"is_verified": false,
"line_number": 22
"line_number": 22,
"is_secret": false
},
{
"type": "Email Address",
"filename": "src/changes/changes.xml",
"hashed_secret": "3a6d7aa49a8e4a2fe32a5cd0e53da9cb96bd8d29",
"is_verified": false,
"line_number": 428
"line_number": 428,
"is_secret": false
}
],
"src/main/webapp/pds/viewBundle.jsp": [
{
"type": "Email Address",
"filename": "src/main/webapp/pds/viewBundle.jsp",
"hashed_secret": "4fb813c304003b3813b35a85f05b7cb0c3994cc1",
"is_verified": false,
"line_number": 83,
"is_secret": false
}
],
"src/main/webapp/pds/viewCollection.jsp": [
{
"type": "Email Address",
"filename": "src/main/webapp/pds/viewCollection.jsp",
"hashed_secret": "4fb813c304003b3813b35a85f05b7cb0c3994cc1",
"is_verified": false,
"line_number": 85,
"is_secret": false
}
],
"src/main/webapp/pds/viewContext.jsp": [
{
"type": "Email Address",
"filename": "src/main/webapp/pds/viewContext.jsp",
"hashed_secret": "4fb813c304003b3813b35a85f05b7cb0c3994cc1",
"is_verified": false,
"line_number": 476,
"is_secret": false
}
],
"src/main/webapp/pds/viewDataset.jsp": [
{
"type": "Email Address",
"filename": "src/main/webapp/pds/viewDataset.jsp",
"hashed_secret": "4fb813c304003b3813b35a85f05b7cb0c3994cc1",
"is_verified": false,
"line_number": 362,
"is_secret": false
}
],
"src/main/webapp/pds/viewDocument.jsp": [
{
"type": "Email Address",
"filename": "src/main/webapp/pds/viewDocument.jsp",
"hashed_secret": "4fb813c304003b3813b35a85f05b7cb0c3994cc1",
"is_verified": false,
"line_number": 85,
"is_secret": false
}
],
"src/main/webapp/pds/viewProduct.jsp": [
{
"type": "Email Address",
"filename": "src/main/webapp/pds/viewProduct.jsp",
"hashed_secret": "4fb813c304003b3813b35a85f05b7cb0c3994cc1",
"is_verified": false,
"line_number": 102,
"is_secret": false
}
],
"src/main/webapp/pds/viewProductExternal.jsp": [
{
"type": "Email Address",
"filename": "src/main/webapp/pds/viewProductExternal.jsp",
"hashed_secret": "4fb813c304003b3813b35a85f05b7cb0c3994cc1",
"is_verified": false,
"line_number": 96,
"is_secret": false
}
],
"src/site/xdoc/index.xml": [
Expand All @@ -199,14 +285,16 @@
"filename": "src/site/xdoc/index.xml",
"hashed_secret": "1ac7d6deddaec3bd29b1f559a573231d20d764fd",
"is_verified": false,
"line_number": 22
"line_number": 22,
"is_secret": false
},
{
"type": "Email Address",
"filename": "src/site/xdoc/index.xml",
"hashed_secret": "3a6d7aa49a8e4a2fe32a5cd0e53da9cb96bd8d29",
"is_verified": false,
"line_number": 30
"line_number": 30,
"is_secret": false
}
],
"src/site/xdoc/install/index.xml.vm": [
Expand All @@ -215,14 +303,16 @@
"filename": "src/site/xdoc/install/index.xml.vm",
"hashed_secret": "1ac7d6deddaec3bd29b1f559a573231d20d764fd",
"is_verified": false,
"line_number": 22
"line_number": 22,
"is_secret": false
},
{
"type": "Email Address",
"filename": "src/site/xdoc/install/index.xml.vm",
"hashed_secret": "540014818ba08bb201f4089dcd7a258df4c18def",
"is_verified": false,
"line_number": 23
"line_number": 23,
"is_secret": false
}
],
"src/site/xdoc/operate/index.xml.vm": [
Expand All @@ -231,9 +321,10 @@
"filename": "src/site/xdoc/operate/index.xml.vm",
"hashed_secret": "1ac7d6deddaec3bd29b1f559a573231d20d764fd",
"is_verified": false,
"line_number": 22
"line_number": 22,
"is_secret": false
}
]
},
"generated_at": "2023-11-17T16:52:19Z"
"generated_at": "2024-11-12T20:50:42Z"
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
<version>9.6.1</version>
<version>9.7.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
Expand Down
40 changes: 39 additions & 1 deletion src/main/java/gov/nasa/pds/dsview/registry/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

package gov.nasa.pds.dsview.registry;

import java.util.Map;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* Class that holds constants used in ds-view.
*
Expand Down Expand Up @@ -328,4 +328,42 @@ public class Constants {
observationalPds4ToSearch.put("TYPE", "data_class");
observationalPds4ToSearch.put("FILE(S)", "file_name");
}

public static final Map<String, String> telescopePds4ToRegistry =
new LinkedHashMap<String, String>();
static {
telescopePds4ToRegistry.put("IDENTIFIER", "identifier");
telescopePds4ToRegistry.put("NAME", "title");
telescopePds4ToRegistry.put("DESCRIPTION", "description");
telescopePds4ToRegistry.put("FACILITY", "facility_ref");
telescopePds4ToRegistry.put("APERTURE", "telescope_aperture");
telescopePds4ToRegistry.put("LONGITUDE", "telescope_longitude");
telescopePds4ToRegistry.put("LATITUDE", "telescope_latitude");
telescopePds4ToRegistry.put("ALTITUDE", "telescope_altitude");
telescopePds4ToRegistry.put("COORIDINATE SOURCE", "telescope_coordinate_source");
telescopePds4ToRegistry.put("INVESTIGATION(S)", "investigation_ref");
telescopePds4ToRegistry.put("INSTRUMENT(S)", "instrument_ref");
}

public static final Map<String, String> facilityPds4ToRegistry =
new LinkedHashMap<String, String>();
static {
facilityPds4ToRegistry.put("IDENTIFIER", "identifier");
facilityPds4ToRegistry.put("NAME", "title");
facilityPds4ToRegistry.put("TYPE", "facility_type");
facilityPds4ToRegistry.put("DESCRIPTION", "description");
facilityPds4ToRegistry.put("ADDRESS", "facility_address");
facilityPds4ToRegistry.put("COUNTRY", "facility_country");
facilityPds4ToRegistry.put("INVESTIGATION(S)", "investigation_ref");
facilityPds4ToRegistry.put("TELESCOPE(S)", "telescope_ref");
}

public static final Map<String, String> airbornePds4ToRegistry =
new LinkedHashMap<String, String>();
static {
airbornePds4ToRegistry.put("IDENTIFIER", "identifier");
airbornePds4ToRegistry.put("NAME", "title");
airbornePds4ToRegistry.put("TYPE", "airborne_type");
airbornePds4ToRegistry.put("DESCRIPTION", "description");
}
}
66 changes: 36 additions & 30 deletions src/main/java/gov/nasa/pds/dsview/registry/PDS3Search.java
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public SolrDocument getInst(String instId, String instHostId) throws SolrServerE
org.apache.solr.client.solrj.SolrRequest.METHOD.GET);

SolrDocumentList solrResults = response.getResults();
log.info("numFound = " + solrResults.getNumFound());
log.fine("numFound = " + solrResults.getNumFound());
nutjob4life marked this conversation as resolved.
Show resolved Hide resolved

Iterator<SolrDocument> itr = solrResults.iterator();
SolrDocument doc = null;
Expand Down Expand Up @@ -341,7 +341,7 @@ public SolrDocument getTarget(String identifier) throws SolrServerException, IOE
params.set("wt", "xml");
params.set("fq", "facet_type:\"1,target\"");

log.info("params = " + params.toString());
log.info("params = " + params.toString());
QueryResponse response = solr.query(params,
org.apache.solr.client.solrj.SolrRequest.METHOD.GET);

Expand Down Expand Up @@ -446,34 +446,40 @@ public String getDoi(String identifier) throws IOException, JSONException {
log.info("getDOI(" + identifier + ")");
URL url = new URL(DOI_SERVER_URL + "?ids=" + URLEncoder.encode(identifier, "UTF-8"));

HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setConnectTimeout(5000);
conn.setReadTimeout(5000);

int responseCode = conn.getResponseCode();
if (responseCode == 200) {
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
StringBuffer response = new StringBuffer();
while ((line = br.readLine()) != null) {
response.append(line);
}
br.close();

JSONArray jsonArray = new JSONArray(response.toString());
log.info("DOI Service response = " + jsonArray.toString(2));
if (jsonArray.length() == 0) {
return null;
} else if (jsonArray.length() == 1) {
JSONObject jsonResponse = jsonArray.getJSONObject(0);
String doi = jsonResponse.getString("doi");
return "<a href=\"https://doi.org/" + doi + "\">" + doi + "</a>";
} else {
return "Multiple DOIs found. Use <a href=\"/tools/doi/#/search/" + identifier + "\">DOI Search</a> to select the most appropriate.";
}
} else {
return null;
HttpURLConnection conn = null;
try {
conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setConnectTimeout(5000);
conn.setReadTimeout(5000);

int responseCode = conn.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
StringBuffer response = new StringBuffer();
while ((line = br.readLine()) != null) {
response.append(line);
}
br.close();

JSONArray jsonArray = new JSONArray(response.toString());
log.info("DOI Service response = " + jsonArray.toString(2));
if (jsonArray.length() == 0) {
return null;
} else if (jsonArray.length() == 1) {
JSONObject jsonResponse = jsonArray.getJSONObject(0);
String doi = jsonResponse.getString("doi");
return "<a href=\"https://doi.org/" + doi + "\">" + doi + "</a>";
} else {
return "Multiple DOIs found. Use <a href=\"/tools/doi/#/search/" + identifier
+ "\">DOI Search</a> to select the most appropriate.";
}
} else {
return null;
}
} finally {
conn.disconnect();
}
}

Expand Down
Loading
Loading