From ac20cbd77af44d80fddd0c5500a206afeb51ea52 Mon Sep 17 00:00:00 2001 From: Jordan Padams Date: Fri, 18 Oct 2024 18:21:39 -0700 Subject: [PATCH 1/5] Update error message to be more user-friendly --- src/main/webapp/pds/viewBundle.jsp | 4 ++-- src/main/webapp/pds/viewCollection.jsp | 4 ++-- src/main/webapp/pds/viewDataset.jsp | 2 +- src/main/webapp/pds/viewDocument.jsp | 4 ++-- src/main/webapp/pds/viewProduct.jsp | 4 ++-- src/main/webapp/pds/viewProductExternal.jsp | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/webapp/pds/viewBundle.jsp b/src/main/webapp/pds/viewBundle.jsp index f063e2c02..ba3dbf178 100644 --- a/src/main/webapp/pds/viewBundle.jsp +++ b/src/main/webapp/pds/viewBundle.jsp @@ -80,7 +80,7 @@ %> - No Search Service found: <%=searchUrl%> to retrieve the Bundle Information. + The PDS Database is temporarily down for maintenance. Check back later or please contact the PDS Help Desk for assistance. <% @@ -713,7 +713,7 @@ %> - No Search Service found: <%=searchUrl%> to retrieve the Bundle Information. + The PDS Database is temporarily down for maintenance. Check back later or please contact the PDS Help Desk for assistance. <% diff --git a/src/main/webapp/pds/viewCollection.jsp b/src/main/webapp/pds/viewCollection.jsp index e922dd270..22d395aee 100644 --- a/src/main/webapp/pds/viewCollection.jsp +++ b/src/main/webapp/pds/viewCollection.jsp @@ -82,7 +82,7 @@ %> - No Search Service found: <%=searchUrl%> to retrieve the Collection Information. + The PDS Database is temporarily down for maintenance. Check back later or please contact the PDS Help Desk for assistance. <% @@ -414,7 +414,7 @@ %> - No Search Service found: <%=searchUrl%> to retrieve the Collection Information. + The PDS Database is temporarily down for maintenance. Check back later or please contact the PDS Help Desk for assistance. <% diff --git a/src/main/webapp/pds/viewDataset.jsp b/src/main/webapp/pds/viewDataset.jsp index abb96e335..68dba3b18 100644 --- a/src/main/webapp/pds/viewDataset.jsp +++ b/src/main/webapp/pds/viewDataset.jsp @@ -359,7 +359,7 @@ else { - No Search Service found: <%=searchUrl%> to retrieve the Data Set Information. + The PDS Database is temporarily down for maintenance. Check back later or please contact the PDS Help Desk for assistance. diff --git a/src/main/webapp/pds/viewDocument.jsp b/src/main/webapp/pds/viewDocument.jsp index fcdefc430..ae31e0d05 100644 --- a/src/main/webapp/pds/viewDocument.jsp +++ b/src/main/webapp/pds/viewDocument.jsp @@ -82,7 +82,7 @@ %> - No Search Service found: <%=searchUrl%> to retrieve the Document Information. + The PDS Database is temporarily down for maintenance. Check back later or please contact the PDS Help Desk for assistance. <% @@ -404,7 +404,7 @@ %> - No Search Service found: <%=searchUrl%> to retrieve the Document Information. + The PDS Database is temporarily down for maintenance. Check back later or please contact the PDS Help Desk for assistance. <% diff --git a/src/main/webapp/pds/viewProduct.jsp b/src/main/webapp/pds/viewProduct.jsp index 56d8d22ab..ec139fe9d 100644 --- a/src/main/webapp/pds/viewProduct.jsp +++ b/src/main/webapp/pds/viewProduct.jsp @@ -99,7 +99,7 @@ %> - No Search Service found: <%=searchUrl%> to retrieve the Observational Product Information. + The PDS Database is temporarily down for maintenance. Check back later or please contact the PDS Help Desk for assistance. <% @@ -369,7 +369,7 @@ %> - No Search Service found: <%=searchUrl%> to retrieve <%=objLid%> + The PDS Database is temporarily down for maintenance. Check back later or please contact the PDS Help Desk for assistance. <% diff --git a/src/main/webapp/pds/viewProductExternal.jsp b/src/main/webapp/pds/viewProductExternal.jsp index 2186996ce..6105db147 100644 --- a/src/main/webapp/pds/viewProductExternal.jsp +++ b/src/main/webapp/pds/viewProductExternal.jsp @@ -93,7 +93,7 @@ %> - No Search Service found: <%=searchUrl%> to retrieve the Document Information. + The PDS Database is temporarily down for maintenance. Check back later or please contact the PDS Help Desk for assistance. <% @@ -412,7 +412,7 @@ %> - No Search Service found: <%=searchUrl%> to retrieve the Document Information. + The PDS Database is temporarily down for maintenance. Check back later or please contact the PDS Help Desk for assistance. <% From edc962966d23a2fbc35ff0c781c18acf7545a1a6 Mon Sep 17 00:00:00 2001 From: Jordan Padams Date: Fri, 18 Oct 2024 19:37:38 -0700 Subject: [PATCH 2/5] Updates to support Airborne, Facility, Telescope Resolves #35 --- pom.xml | 2 +- .../nasa/pds/dsview/registry/Constants.java | 40 +- .../nasa/pds/dsview/registry/PDS3Search.java | 66 +- .../nasa/pds/dsview/registry/PDS4Search.java | 7 +- .../dsview/servlets/RegistryQueryServlet.java | 25 +- src/main/webapp/pds/viewContext.jsp | 709 ++++++++++-------- 6 files changed, 509 insertions(+), 340 deletions(-) diff --git a/pom.xml b/pom.xml index 0f605b212..09a9427cc 100644 --- a/pom.xml +++ b/pom.xml @@ -171,7 +171,7 @@ org.apache.solr solr-solrj - 9.6.1 + 9.7.0 javax.servlet diff --git a/src/main/java/gov/nasa/pds/dsview/registry/Constants.java b/src/main/java/gov/nasa/pds/dsview/registry/Constants.java index b530e3317..c14a01b6c 100644 --- a/src/main/java/gov/nasa/pds/dsview/registry/Constants.java +++ b/src/main/java/gov/nasa/pds/dsview/registry/Constants.java @@ -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. * @@ -328,4 +328,42 @@ public class Constants { observationalPds4ToSearch.put("TYPE", "data_class"); observationalPds4ToSearch.put("FILE(S)", "file_name"); } + + public static final Map telescopePds4ToRegistry = + new LinkedHashMap(); + 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 facilityPds4ToRegistry = + new LinkedHashMap(); + 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 airbornePds4ToRegistry = + new LinkedHashMap(); + static { + airbornePds4ToRegistry.put("IDENTIFIER", "identifier"); + airbornePds4ToRegistry.put("NAME", "title"); + airbornePds4ToRegistry.put("TYPE", "airborne_type"); + airbornePds4ToRegistry.put("DESCRIPTION", "description"); + } } diff --git a/src/main/java/gov/nasa/pds/dsview/registry/PDS3Search.java b/src/main/java/gov/nasa/pds/dsview/registry/PDS3Search.java index 17b892ff9..b2986605b 100644 --- a/src/main/java/gov/nasa/pds/dsview/registry/PDS3Search.java +++ b/src/main/java/gov/nasa/pds/dsview/registry/PDS3Search.java @@ -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()); Iterator itr = solrResults.iterator(); SolrDocument doc = null; @@ -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); @@ -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 "" + doi + ""; - } else { - return "Multiple DOIs found. Use DOI Search 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 == 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 "" + doi + ""; + } else { + return "Multiple DOIs found. Use DOI Search to select the most appropriate."; + } + } else { + return null; + } + } finally { + conn.disconnect(); } } diff --git a/src/main/java/gov/nasa/pds/dsview/registry/PDS4Search.java b/src/main/java/gov/nasa/pds/dsview/registry/PDS4Search.java index 9ea4d8c99..9894fa12a 100644 --- a/src/main/java/gov/nasa/pds/dsview/registry/PDS4Search.java +++ b/src/main/java/gov/nasa/pds/dsview/registry/PDS4Search.java @@ -348,7 +348,9 @@ private String getValue(Map.Entry entry) { public JSONArray getDoiResponse(URL url) throws IOException, JSONException { log.fine("getDoiResponse(" + url + ")"); - HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + HttpURLConnection conn = null; + try { + conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setConnectTimeout(5000); conn.setReadTimeout(5000); @@ -371,6 +373,9 @@ public JSONArray getDoiResponse(URL url) throws IOException, JSONException { log.warning("getDoiResponse's responseCode != 200"); return null; } + } finally { + conn.disconnect(); + } } diff --git a/src/main/java/gov/nasa/pds/dsview/servlets/RegistryQueryServlet.java b/src/main/java/gov/nasa/pds/dsview/servlets/RegistryQueryServlet.java index 20776f95c..787410a93 100644 --- a/src/main/java/gov/nasa/pds/dsview/servlets/RegistryQueryServlet.java +++ b/src/main/java/gov/nasa/pds/dsview/servlets/RegistryQueryServlet.java @@ -57,21 +57,16 @@ public void doIt(HttpServletRequest req, HttpServletResponse res) String queryString = constructKeywordQuery(req); System.out.println("queryString = " + queryString); - /* - res.setContentType("text/html"); - PrintWriter out = res.getWriter(); - out.println(""); - out.println(""); - out.println("Testing RegistryQueryServlet!"); - out.println(""); - out.println(""); - out.println("

Testing RegistryQueyrServlet!

"); - out.println("parameter names = " + req.getParameterMap().toString() + "
"); - //out.println("parameter values = " + req.getParameterValues().toString() + "
"); - //out.println("registryUrl = " + req.getParameterValues("registryUrl")[0]); - out.println(""); - out.println(""); - */ + /* + * res.setContentType("text/html"); PrintWriter out = res.getWriter(); + * out.println(""); out.println(""); + * out.println("Testing RegistryQueryServlet!"); out.println(""); + * out.println(""); out.println("

Testing RegistryQueyrServlet!

"); + * out.println("parameter names = " + req.getParameterMap().toString() + "
"); + * //out.println("parameter values = " + req.getParameterValues().toString() + "
"); + * //out.println("registryUrl = " + req.getParameterValues("registryUrl")[0]); + * out.println(""); out.println(""); + */ req.getSession().setAttribute("queryString", queryString); getServletConfig().getServletContext().getRequestDispatcher ("/pds/results.jsp").forward(req,res); diff --git a/src/main/webapp/pds/viewContext.jsp b/src/main/webapp/pds/viewContext.jsp index 65e41beb5..0ebcfb0c4 100644 --- a/src/main/webapp/pds/viewContext.jsp +++ b/src/main/webapp/pds/viewContext.jsp @@ -13,6 +13,7 @@ isErrorPage="false" contentType="text/html; charset=ISO-8859-1" import="gov.nasa.pds.dsview.registry.PDS4Search, gov.nasa.pds.dsview.registry.Constants, org.apache.solr.common.SolrDocument, org.apache.solr.common.SolrDocumentList, + org.apache.solr.client.solrj.SolrServerException, java.util.*, java.net.*, java.io.*, java.lang.*" %> @@ -31,11 +32,58 @@
- + +<%! + public String insertContextInformation(PDS4Search pds4Search, SolrDocument doc, String tmpValue) throws IOException, SolrServerException { + StringWriter writer = new StringWriter(); + List values = pds4Search.getValues(doc, tmpValue); + String val=""; + if (values != null) { + if (tmpValue.equals("description")){ + val = values.get(0); + //out.println(val); + } + else if (tmpValue.equals("identifier")) { + val = values.get(0); + String version = pds4Search.getValues(doc, "version_id").get(0); + if (version!=null) + val += "::" + version; + // out.println(val); + } // end if (values!=null) + else if (tmpValue.endsWith("_ref")) { + List refLids = pds4Search.getValues(doc, tmpValue); + if (refLids != null) { + for (String refLid : refLids) { + SolrDocument refObj = pds4Search.getContext(refLid); + if (refObj != null) { + List titleList = pds4Search.getValues(refObj, "title"); + if (titleList != null) { + String title = titleList.get(0); + val = "" + title + "
"; + //out.println(val); + } + } // end if refObj != null + } // end for refLids + } + } // end if contains _ref + else { + for (int j=0; j"; + if (values.size()>1) + // out.println("
"); + val += "
"; + } // end for + } // end else + } // end else + return val; + } +%> + + <% String lid = request.getParameter("identifier"); if ((lid == null) || (lid == "")) { @@ -56,299 +104,376 @@ else { PDS4Search pds4Search = new PDS4Search(searchUrl); try { - SolrDocument doc = pds4Search.getContext(lid); - - if (doc==null) { - %> -
- - - <% - } - else { - if ((lid.contains("investigation") || lid.contains("mission")) && !lid.contains("resource:resource")) { - %> - - - - <% - for (java.util.Map.Entry entry: Constants.msnPds4ToRegistry.entrySet()) { - String key = entry.getKey(); - String tmpValue = entry.getValue(); - %> - - - - - <% - } // for loop - } // end if (investigation) - else if (lid.contains("target")) { - %> - - - - <% - - for (java.util.Map.Entry entry: Constants.targetPds4ToRegistry.entrySet()) { - String key = entry.getKey(); - String tmpValue = entry.getValue(); - %> - - - - - <% - } // for loop - } // end if target - else if (lid.contains("instrument_host")) { - %> - - - - <% - for (java.util.Map.Entry entry: Constants.instHostCtxPds4ToSearch.entrySet()) { - String key = entry.getKey(); - String tmpValue = entry.getValue(); - %> - - - - - <% - } // for loop - }// end if (instrument_host) - else if (lid.contains("instrument:")) { - %> - - - - <% - for (java.util.Map.Entry entry: Constants.instCtxPds4ToSearch.entrySet()) { - String key = entry.getKey(); - String tmpValue = entry.getValue(); - %> - - - - - <% - } // for loop - }// end if (instrument) - else if (lid.contains("resource:resource")) { - %> - - - - <% - - for (java.util.Map.Entry entry: Constants.resrcCtxPds4ToSearch.entrySet()) { - String key = entry.getKey(); - String tmpValue = entry.getValue(); - %> - - - - - <% - } // end else - } // for loop - } // end if target - } // if extObj !=null + SolrDocument doc = pds4Search.getContext(lid); + + if (doc==null) { + %> + + + + <% + } + else { + if ((lid.contains("investigation") || lid.contains("mission")) && !lid.contains("resource:resource")) { + %> + + + + <% + for (java.util.Map.Entry entry: Constants.msnPds4ToRegistry.entrySet()) { + String key = entry.getKey(); + String tmpValue = entry.getValue(); + %> + + + + + <% + } // for loop + } // end if (investigation) + else if (lid.contains("target")) { + %> + + + + <% + + for (java.util.Map.Entry entry: Constants.targetPds4ToRegistry.entrySet()) { + String key = entry.getKey(); + String tmpValue = entry.getValue(); + %> + + + + + <% + } // for loop + } // end if target + else if (lid.contains("instrument_host")) { + %> + + + + <% + for (java.util.Map.Entry entry: Constants.instHostCtxPds4ToSearch.entrySet()) { + String key = entry.getKey(); + String tmpValue = entry.getValue(); + %> + + + + + <% + } // for loop + }// end if (instrument_host) + else if (lid.contains("instrument:")) { + %> + + + + <% + for (java.util.Map.Entry entry: Constants.instCtxPds4ToSearch.entrySet()) { + String key = entry.getKey(); + String tmpValue = entry.getValue(); + %> + + + + + <% + } // for loop + }// end if (instrument) + else if (lid.contains("resource:resource")) { + %> + + + + <% + + for (java.util.Map.Entry entry: Constants.resrcCtxPds4ToSearch.entrySet()) { + String key = entry.getKey(); + String tmpValue = entry.getValue(); + %> + + + + + <% + } // end else + } // for loop + } // end if resource:resource + else if (lid.contains("telescope")) { + %> + + + + <% + for (java.util.Map.Entry entry: Constants.telescopePds4ToRegistry.entrySet()) { + String key = entry.getKey(); + String tmpValue = entry.getValue(); + %> + + + + + <% + } // for loop + }// end if (telescope) + else if (lid.contains("facility")) { + %> + + + + <% + for (java.util.Map.Entry entry: Constants.facilityPds4ToRegistry.entrySet()) { + String key = entry.getKey(); + String tmpValue = entry.getValue(); + %> + + + + + <% + } // for loop + }// end if (facility) + else if (lid.contains("airborne")) { + %> + + + + <% + for (java.util.Map.Entry entry: Constants.airbornePds4ToRegistry.entrySet()) { + String key = entry.getKey(); + String tmpValue = entry.getValue(); + %> + + + + + <% + } // for loop + }// end if (airborne) + + } // if doc == null } catch (Exception e) { e.printStackTrace(); %> <% @@ -356,9 +481,9 @@ else { }// if mission name is specified %>
- Information not found for identifier <%=lid%>. Please verify the value. -
- Investigation Information
-
<%=key%> - <% - List values = pds4Search.getValues(doc, tmpValue); - String val=""; - if (values!=null) { - if (tmpValue.equals("investigation_description") || - tmpValue.equals("investigation_objectives_summary")) { - val = values.get(0); - %> -
<%=val%>
- <% - } - else if (tmpValue.equals("identifier")) { - val = values.get(0); - String version = pds4Search.getValues(doc, "version_id").get(0); - if (version!=null) - val += "::" + version; - out.println(val); - } - else { - for (int j=0; j"); - if (values.size()>1) - out.println("
"); - } // end for - } // end else - } // end if (values!=null) - %> -
- Target Information
-
<%=key%> - <% - String val = ""; - List values = pds4Search.getValues(doc, tmpValue); - if (values!=null) { - if (tmpValue.equals("target_description")){ - val = values.get(0); - %> -
<%=val%>
- <% - } - else if (tmpValue.equals("identifier")) { - val = values.get(0); - String version = pds4Search.getValues(doc, "version_id").get(0); - if (version!=null) - val += "::" + version; - out.println(val); - } - else { - for (int j=0; j"); - } - } - } // end if (values!=null) - else { - if (tmpValue.equals("resource_link")) { - List rvalues = pds4Search.getValues(doc, tmpValue); - if (rvalues != null) { - String refLid = rvalues.get(0); - refLid = refLid.substring(0, refLid.indexOf("::")); - - SolrDocument resource1 = pds4Search.getContext(refLid); - if (resource1!=null) { - String resname, reslink; - if (tmpValue.equals("resource_link")) { - List reslinks = pds4Search.getValues(resource1, "resource_url"); - reslink = reslinks.get(0); - out.println(reslink); - } - } - } - } - } - %> -
- Instrument Host Information
-
<%=key%> - <% - String val=""; - List values = pds4Search.getValues(doc, tmpValue); - if (values!=null) { - if (tmpValue.equals("instrument_host_description")){ - val = values.get(0); - %> -
<%=val%>
- <% - } // end if (tmpValue.equals("instrument_host_desc") - else if (tmpValue.equals("identifier")) { - val = values.get(0); - String version = pds4Search.getValues(doc, "version_id").get(0); - if (version!=null) - val += "::" + version; - out.println(val); - } - else { - for (int j=0; j"); - if (values.size()>1) - out.println("
"); - } // end for - } // end else - } // end if (values!=null) - %> -
- Instrument Information
-
<%=key%> - <% - List values = pds4Search.getValues(doc, tmpValue); - String val=""; - if (values!=null) { - if (tmpValue.equals("instrument_description")){ - val = values.get(0); - %> -
<%=val%>
- <% - } - else if (tmpValue.equals("identifier")) { - val = values.get(0); - String version = pds4Search.getValues(doc, "version_id").get(0); - if (version!=null) - val += "::" + version; - out.println(val); - } - else { - for (int j=0; j"); - if (values.size()>1) - out.println("
"); - } // end for - } // end else - } // end if (values!=null) - else { - if (tmpValue.equals("instrument_host_id")) { - List instHostValues = pds4Search.getValues(doc, "instrument_host_ref"); - if (instHostValues != null) { - String instHostLid = instHostValues.get(0); - - SolrDocument instHostObj = pds4Search.getContext(instHostLid); - if (instHostObj!=null) { - List instHostIdValues = pds4Search.getValues(instHostObj, "instrument_host_name"); - String instHostId=""; - if (instHostIdValues!=null) - instHostId = instHostIdValues.get(0); - out.println(instHostId + "
"); - } - } - } // end if instrument_host_id - } // end else - //} - %> -
- Resource Information
-
<%=key%> - <% - String val = ""; - String resname="", reslink=""; - if (tmpValue.equals("resources")) { - resname = pds4Search.getValues(doc, "resource_name").get(0); - reslink = pds4Search.getValues(doc, "resource_url").get(0); - %> -
  • <%=resname%>
    - <% - } - else { - List values = pds4Search.getValues(doc, tmpValue); - if (values!=null) { - if (tmpValue.equals("resource_description")){ - val = values.get(0); - out.println(val); - } - else if (tmpValue.equals("identifier")) { - val = values.get(0); - String version = pds4Search.getValues(doc, "version_id").get(0); - if (version!=null) - val += "::" + version; - out.println(val); - } - else { - for (int j=0; j"); - } - } - } // end if (values!=null) - %> -
  • + Information not found for identifier <%=lid%>. Please verify the value. +
    + Investigation Information
    +
    <%=key%> + <% + List values = pds4Search.getValues(doc, tmpValue); + String val=""; + if (values!=null) { + if (tmpValue.equals("investigation_description") || + tmpValue.equals("investigation_objectives_summary")) { + val = values.get(0); + out.println(val); + } + else if (tmpValue.equals("identifier")) { + val = values.get(0); + String version = pds4Search.getValues(doc, "version_id").get(0); + if (version!=null) + val += "::" + version; + out.println(val); + } + else { + for (int j=0; j"); + if (values.size()>1) + out.println("
    "); + } // end for + } // end else + } // end if (values!=null) + %> +
    + Target Information
    +
    <%=key%> + <% + String val = ""; + List values = pds4Search.getValues(doc, tmpValue); + if (values!=null) { + if (tmpValue.equals("target_description")){ + val = values.get(0); + out.println(val); + } + else if (tmpValue.equals("identifier")) { + val = values.get(0); + String version = pds4Search.getValues(doc, "version_id").get(0); + if (version!=null) + val += "::" + version; + out.println(val); + } + else { + for (int j=0; j"); + } + } + } // end if (values!=null) + else { + if (tmpValue.equals("resource_link")) { + List rvalues = pds4Search.getValues(doc, tmpValue); + if (rvalues != null) { + String refLid = rvalues.get(0); + refLid = refLid.substring(0, refLid.indexOf("::")); + + SolrDocument resource1 = pds4Search.getContext(refLid); + if (resource1!=null) { + String resname, reslink; + if (tmpValue.equals("resource_link")) { + List reslinks = pds4Search.getValues(resource1, "resource_url"); + reslink = reslinks.get(0); + out.println(reslink); + } + } + } + } + } + %> +
    + Instrument Host Information
    +
    <%=key%> + <% + String val=""; + List values = pds4Search.getValues(doc, tmpValue); + if (values!=null) { + if (tmpValue.equals("instrument_host_description")){ + val = values.get(0); + out.println(val); + } // end if (tmpValue.equals("instrument_host_desc") + else if (tmpValue.equals("identifier")) { + val = values.get(0); + String version = pds4Search.getValues(doc, "version_id").get(0); + if (version!=null) + val += "::" + version; + out.println(val); + } + else { + for (int j=0; j"); + if (values.size()>1) + out.println("
    "); + } // end for + } // end else + } // end if (values!=null) + %> +
    + Instrument Information
    +
    <%=key%> + <% + List values = pds4Search.getValues(doc, tmpValue); + String val=""; + if (values!=null) { + if (tmpValue.equals("instrument_description")){ + val = values.get(0); + out.println(val); + } + else if (tmpValue.equals("identifier")) { + val = values.get(0); + String version = pds4Search.getValues(doc, "version_id").get(0); + if (version!=null) + val += "::" + version; + out.println(val); + } + else if (key.endsWith("_ref")) { + List refLids = pds4Search.getValues(doc, tmpValue); + if (refLids != null) { + for (String refLid : refLids) { + SolrDocument refObj = pds4Search.getContext(lid); + if (refObj != null) { + List titleList = pds4Search.getValues(refObj, "title"); + if (titleList != null) { + String title = titleList.get(0); + out.println("" + title + "
    "); + } + } // end if refObj != null + } // end for refLids + } + } // end if contains _ref + else { + for (int j=0; j"); + if (values.size()>1) + out.println("
    "); + } // end for + } // end else + } // end if (values!=null) + else if (lid.contains("instrument:")) { + if (tmpValue.equals("instrument_host_id")) { + List instHostValues = pds4Search.getValues(doc, "instrument_host_ref"); + if (instHostValues != null) { + String instHostLid = instHostValues.get(0); + + SolrDocument instHostObj = pds4Search.getContext(instHostLid); + if (instHostObj!=null) { + List instHostIdValues = pds4Search.getValues(instHostObj, "instrument_host_name"); + String instHostId=""; + if (instHostIdValues!=null) + instHostId = instHostIdValues.get(0); + out.println(instHostId + "
    "); + } + } + } // end if instrument_host_id + } // end else + //} + %> +
    + Resource Information
    +
    <%=key%> + <% + String val = ""; + String resname="", reslink=""; + if (tmpValue.equals("resources")) { + resname = pds4Search.getValues(doc, "resource_name").get(0); + reslink = pds4Search.getValues(doc, "resource_url").get(0); + %> +
  • <%=resname%>
    + <% + } + else { + List values = pds4Search.getValues(doc, tmpValue); + if (values!=null) { + if (tmpValue.equals("resource_description")){ + val = values.get(0); + out.println(val); + } + else if (tmpValue.equals("identifier")) { + val = values.get(0); + String version = pds4Search.getValues(doc, "version_id").get(0); + if (version!=null) + val += "::" + version; + out.println(val); + } + else { + for (int j=0; j"); + } + } + } // end if (values!=null) + %> +
  • + Telescope Information
    +
    <%=key%> + <% + out.println(insertContextInformation(pds4Search, doc, tmpValue)); + %> +
    + Facility Information
    +
    <%=key%> + <% + out.println(insertContextInformation(pds4Search, doc, tmpValue)); + %> +
    + Airborne Information
    +
    <%=key%> + <% + out.println(insertContextInformation(pds4Search, doc, tmpValue)); + %> +
    - No Search Service found: <%=searchUrl%> to retrieve the Context Information. + The PDS Database is temporarily down for maintenance. Check back later or please contact the PDS Help Desk for assistance.
    - +
    From ab34b6150bc5c98d284ee6439bfe5962d5e1319c Mon Sep 17 00:00:00 2001 From: Jordan Padams <33492486+jordanpadams@users.noreply.github.com> Date: Wed, 23 Oct 2024 10:48:06 -0700 Subject: [PATCH 3/5] Change to HttpUrlConnection.HTTP_OK per comments --- src/main/java/gov/nasa/pds/dsview/registry/PDS3Search.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/gov/nasa/pds/dsview/registry/PDS3Search.java b/src/main/java/gov/nasa/pds/dsview/registry/PDS3Search.java index b2986605b..4a7061599 100644 --- a/src/main/java/gov/nasa/pds/dsview/registry/PDS3Search.java +++ b/src/main/java/gov/nasa/pds/dsview/registry/PDS3Search.java @@ -454,7 +454,7 @@ public String getDoi(String identifier) throws IOException, JSONException { conn.setReadTimeout(5000); int responseCode = conn.getResponseCode(); - if (responseCode == 200) { + if (responseCode == HttpUrlConnection.HTTP_OK) { BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; StringBuffer response = new StringBuffer(); From 07dd03da37e233ebe554f618042d4b8b0f83aff9 Mon Sep 17 00:00:00 2001 From: Jordan Padams Date: Tue, 12 Nov 2024 12:50:51 -0800 Subject: [PATCH 4/5] Update secrets baseline --- .secrets.baseline | 123 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 107 insertions(+), 16 deletions(-) diff --git a/.secrets.baseline b/.secrets.baseline index fc7cf39d8..3b23ee8be 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -1,6 +1,9 @@ { "version": "1.4.0", "plugins_used": [ + { + "name": "AbsolutePathDetectorExperimental" + }, { "name": "ArtifactoryDetector" }, @@ -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 @@ -118,9 +125,9 @@ { "path": "detect_secrets.filters.regex.should_exclude_file", "pattern": [ - "\\.secrets..*", "\\.git.*", "\\.pre-commit-config\\.yaml", + "\\.secrets..*", "target" ] } @@ -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": [ @@ -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": [ @@ -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": [ @@ -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": [ @@ -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" } From 8a0bb6ccf3a839bdb53bcf0e46aa03fc1a654cf8 Mon Sep 17 00:00:00 2001 From: Jordan Padams Date: Tue, 12 Nov 2024 13:15:32 -0800 Subject: [PATCH 5/5] Fix typo --- src/main/java/gov/nasa/pds/dsview/registry/PDS3Search.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/gov/nasa/pds/dsview/registry/PDS3Search.java b/src/main/java/gov/nasa/pds/dsview/registry/PDS3Search.java index 4a7061599..2f08a828d 100644 --- a/src/main/java/gov/nasa/pds/dsview/registry/PDS3Search.java +++ b/src/main/java/gov/nasa/pds/dsview/registry/PDS3Search.java @@ -454,7 +454,7 @@ public String getDoi(String identifier) throws IOException, JSONException { conn.setReadTimeout(5000); int responseCode = conn.getResponseCode(); - if (responseCode == HttpUrlConnection.HTTP_OK) { + if (responseCode == HttpURLConnection.HTTP_OK) { BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; StringBuffer response = new StringBuffer();