Commit a0a40ac7 authored by Robert Butora's avatar Robert Butora
Browse files

changes the base docker-image to be the official Tomcat9-image (on Ubuntu22)

parent ac02e59f
Loading
Loading
Loading
Loading
+25 −5
Original line number Diff line number Diff line
## vlkb-siav2

is a web-application to discover astronomical data stored in FITS-files and described in a VO ObsCore table.
It implements the SIA version 2, IVOA recommendation (https://ivoa.net/documents/SIA/20151223/) with optional VLKB-specific features:
is a web-application to discover astronomical data (supports FITS-files) and described in a VO ObsTAP table
(https://ivoa.net/documents/ObsCore).
It implements the SIA version 2, IVOA recommendation (https://ivoa.net/documents/SIA) with optional VLKB-specific features:

- provides overlap code
- the filtering paramters (POS, BAND) can be given in GALACTIC and VELO-LSRK-km/s coordinates systems
- handles addtional metadata about the surveys (name, species, transformation)
- VOTable response includes composed URLs for file download, file-cutout and files-demosaic services

The service consists of **vlkb-siav2** web-application and associated **vlkb-obscore** command line tool to create the VO ObsCore table from FITS-files.
The service consists of **vlkb-siav2** web-application and associated **vlkb-obscore** command line tool to create the ObsTAP table from FITS-files headers.

The vlkb-obscore cli is available from https://ict.inaf.it/gitlab/butora/vlkb-datasets .
Dockerized version of the web-app is available from https://ict.inaf.it/gitlab/butora/vlkb-datasets-docker .

## Docker image

To configure the application choose a context-root where the SIAv2 can be accessed,
provide database URI which points to the ObsTAP table and provide URL for data-access
(typically a SODA service).
Example compose.yaml entry for VLKB-SIAv2:

```yaml
  vlkb-siav2:
    container_name: vlkb-siav2
    image: git.ia2.inaf.it:5050/vialactea/vlkb-siav2/siav2:1.6
    ports:
      - 8080:8080
    environment:
      - DISCOVERY_CONTEXT_ROOT=vlkb#datasets#siav2
      - DB_URI=jdbc:postgresql://vlkb-db:5432/vialactea
      - DB_USERNAME=vialactea
      - DB_PASSWORD=ia2vlkb
      - CUTOUT_SERVICE_URL=http://vlkb-devel.ia2.inaf.it:8004/vlkb/datasets/soda
```

## Installation

There is a war-package for the search web-application and the package (deb or rpm) with linux
+12 −12
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ public class DbPSearch

   public String[] queryOverlapingPubdid(Coord coord)
   {
      LOGGER.info("trace");
      LOGGER.fine("trace");

      String inputRegion = toPgSphereSqlTypeString(coord.pos);
      String dbRegion    = toRegionColumnName(coord.pos.system);
@@ -90,11 +90,11 @@ public class DbPSearch

      //theQuery += " ORDER BY obs_collection";

      LOGGER.info(theQuery);
      LOGGER.fine(theQuery);

      List<String> pubdidList = new ArrayList<>();

      LOGGER.info("Connecting to: " + dbConn.uri()
      LOGGER.fine("Connecting to: " + dbConn.uri()
            + " with optional user/pwd: " + dbConn.userName() +" / "+ dbConn.password() );

      try( 
@@ -116,7 +116,7 @@ public class DbPSearch

      String[] pubdidArr = pubdidList.toArray(new String[0]);

      LOGGER.info("pubdidArr[] length: " + pubdidArr.length);
      LOGGER.fine("pubdidArr[] length: " + pubdidArr.length);

      return pubdidArr;
   }
@@ -153,7 +153,7 @@ public class DbPSearch

   public FormatResponseFilter.ObsCore[] queryOutputData(String[] pubdidArr, Pos pos)
   {
      LOGGER.info("");
      LOGGER.fine("trace");

      String commaSepPubdids  = String.join("\',\'", pubdidArr);

@@ -167,11 +167,11 @@ public class DbPSearch

      theQuery += " ORDER BY obs_collection";

      //LOGGER.info(theQuery);
      //LOGGER.fine(theQuery);

      List<FormatResponseFilter.ObsCore> obsCoreList = new ArrayList<>();

      LOGGER.info("Connecting to: " + dbConn.uri()
      LOGGER.fine("Connecting to: " + dbConn.uri()
            + " with optional user/pwd: " + dbConn.userName() +" / "+ dbConn.password() );
      try( 
            Connection conn = DriverManager.getConnection(dbConn.uri(), dbConn.userName(), dbConn.password());
@@ -237,7 +237,7 @@ public class DbPSearch
            obsCoreList.add(obsCore);
         }

         LOGGER.info("From DB collected # of ObsCore : " + obsCoreList.size());
         LOGGER.fine("From DB collected # of ObsCore : " + obsCoreList.size());
      }
      catch (SQLException se)
      {
@@ -336,12 +336,12 @@ public class DbPSearch

   private void logSqlExInfo(SQLException se)
   {
      LOGGER.info("SQLState : " + se.getSQLState());
      LOGGER.info("ErrorCode: " + se.getErrorCode());
      LOGGER.info("Message  : " + se.getMessage());
      LOGGER.fine("SQLState : " + se.getSQLState());
      LOGGER.fine("ErrorCode: " + se.getErrorCode());
      LOGGER.fine("Message  : " + se.getMessage());
      Throwable t = se.getCause();
      while(t != null) {
         LOGGER.info("Cause: " + t);
         LOGGER.fine("Cause: " + t);
         t = t.getCause();
      }
   }
+10 −8
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ public class SearchServlet extends javax.servlet.http.HttpServlet
   {
      super.init();

      LOGGER.info("DB   : " + settings.dbConn.toString());
      LOGGER.config("DB: " + settings.dbConn.toString());
   }

   protected void doMultiValuedParamNotSupported(String message, PrintWriter printWriter)
@@ -57,7 +57,7 @@ public class SearchServlet extends javax.servlet.http.HttpServlet
   protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException, UnsupportedEncodingException
   {
      LOGGER.info("trace");
      LOGGER.fine("trace");
      legacyLogEntry(request);

      try
@@ -105,13 +105,15 @@ public class SearchServlet extends javax.servlet.http.HttpServlet
         }
         String[] pubdidArr = dbps.queryOverlapingPubdid(coord);

         LOGGER.info("Found " + pubdidArr.length + " records");

         final String RESPONSE_ENCODING = "UTF-8";

         /* if filters installed response will be wrapped */

         if(response instanceof FormatResponseWrapper)
         {
            LOGGER.info("response-type is FormatResponseWrapper");
            LOGGER.finest("response-type is FormatResponseWrapper");

            response.setContentType("text/plain");
            response.setCharacterEncoding(RESPONSE_ENCODING);
@@ -123,7 +125,7 @@ public class SearchServlet extends javax.servlet.http.HttpServlet
         }
         else
         {
            LOGGER.info("response-type is HttpServletResponse");
            LOGGER.finest("response-type is HttpServletResponse");

            response.setContentType("text/plain");
            response.setCharacterEncoding(RESPONSE_ENCODING);
@@ -138,7 +140,7 @@ public class SearchServlet extends javax.servlet.http.HttpServlet
      }
      catch(MultiValuedParamNotSupported ex)
      {
         LOGGER.info("MultiValuedParamNotSupported: " + ex.getMessage());
         LOGGER.warning("MultiValuedParamNotSupported: " + ex.getMessage());

         response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
         response.setContentType("text/plain");
@@ -149,7 +151,7 @@ public class SearchServlet extends javax.servlet.http.HttpServlet
      }
      catch(IllegalArgumentException ex)
      {
         LOGGER.info("IllegalArgumentException: " + ex.getMessage());
         LOGGER.warning("IllegalArgumentException: " + ex.getMessage());

         response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
         response.setContentType("text/plain");
@@ -160,7 +162,7 @@ public class SearchServlet extends javax.servlet.http.HttpServlet
      }
      catch(Exception ex)
      {
         LOGGER.info("Exception: " + ex.getMessage());
         LOGGER.warning("Exception: " + ex.getMessage());
         ex.printStackTrace();

         response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
@@ -183,7 +185,7 @@ public class SearchServlet extends javax.servlet.http.HttpServlet
         requestURL.append("?").append(request.getQueryString());
         String completeURL = requestURL.toString();
         String className = this.getClass().getSimpleName();
         LOGGER.info(className + " vlkb req from: "
         LOGGER.finest(className + " vlkb req from: "
               + request.getRemoteAddr()
               + " doGet: " + URLDecoder.decode(completeURL, "UTF-8"));
      }
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ import java.io.PrintWriter;

class SearchSettings
{
   private static final Logger LOGGER = Logger.getLogger("SearchSettings");
   //private static final Logger LOGGER = Logger.getLogger("SearchSettings");

   public static class DefaultParamValues
   {
+9 −9
Original line number Diff line number Diff line
@@ -70,11 +70,11 @@ public class FormatResponseFilter implements Filter
   @Override
   public void init(FilterConfig filterConfig) throws ServletException
   {
      LOGGER.info("trace");
      LOGGER.fine("trace");

      String surveysAbsPathname = settings.serviceUrls.surveysAbsPathname();
      LOGGER.info("Default charset: " + Charset.defaultCharset());
      LOGGER.info("DB: " + settings.dbConn.toString());
      LOGGER.config("Default charset: " + Charset.defaultCharset());
      LOGGER.config("DB: " + settings.dbConn.toString());
   }


@@ -82,7 +82,7 @@ public class FormatResponseFilter implements Filter
   public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
   {
      LOGGER.fine("trace");
      LOGGER.info("REQUEST START =============================================================================================");
      LOGGER.fine("REQUEST START =============================================================================================");
      long startTime_msec = System.currentTimeMillis();

      FormatResponseWrapper responseWrapper = new FormatResponseWrapper((HttpServletResponse) response);
@@ -151,7 +151,7 @@ public class FormatResponseFilter implements Filter
         LOGGER.fine("SearchServlet returned no ID's.");
      }

      LOGGER.info("REQUEST END   =============================================================================================");
      LOGGER.fine("REQUEST END   =============================================================================================");
   }


@@ -159,7 +159,7 @@ public class FormatResponseFilter implements Filter
   @Override
   public void destroy()
   {
      LOGGER.info("trace");
      LOGGER.fine("trace");
   }


@@ -217,7 +217,7 @@ public class FormatResponseFilter implements Filter

   private FormatResponseFilter.ObsCore[] queryObsCore(String[] pubdidArr, Pos pos)//, String fitsRemotePath)
   {
      LOGGER.info("trace");
      LOGGER.fine("trace");

      DbPSearch dbps;
      synchronized(DbPSearch.class)
@@ -337,7 +337,7 @@ public class FormatResponseFilter implements Filter
   // generate cutout/merge queryStrings
   private String toQueryString(Pos pos, Band band)
   {
      LOGGER.info("trace");
      LOGGER.fine("trace");

      StringBuilder sb = new StringBuilder();

@@ -358,7 +358,7 @@ public class FormatResponseFilter implements Filter
               break;

            default:
               LOGGER.info("Coord::toQueryString: unknown shape: " + pos.shape.toString());
               LOGGER.warning("Coord::toQueryString: unknown shape: " + pos.shape.toString());
         }
      }
      sb.append("&POSSYS=" + pos.system.toString());
Loading