From e2a6b699c22374541637cf4ccfa84463ad78e7c2 Mon Sep 17 00:00:00 2001
From: Robert Butora <robert.butora@gmail.com>
Date: Sat, 30 Mar 2024 07:24:25 -0400
Subject: [PATCH] config: renames Search-servlet config-file
 discovery.properties -> search.properties

---
 data-discovery/config/Makefile                         |  8 ++++----
 data-discovery/config/discovery.properties.in          |  9 ---------
 .../src/main/java/vlkb/search/DbPSearch.java           |  1 -
 .../src/main/java/vlkb/webapi/SearchServlet.java       |  2 +-
 .../{discovery.properties => search.properties}        |  0
 docker/entrypoint.sh                                   | 10 +++++-----
 6 files changed, 10 insertions(+), 20 deletions(-)
 delete mode 100644 data-discovery/config/discovery.properties.in
 rename data-discovery/src/main/resources/{discovery.properties => search.properties} (100%)

diff --git a/data-discovery/config/Makefile b/data-discovery/config/Makefile
index 5b4fd7c..d9a0f36 100644
--- a/data-discovery/config/Makefile
+++ b/data-discovery/config/Makefile
@@ -3,13 +3,13 @@ DBMS   ?= localhost  # localhost | pasquale | pasquale-devel
 AUTH   ?=            # ia2token | garrtoken | <empty>
 ################################################################
 
-all: formatresponsefilter.properties authpolicy.properties web.xml discovery.properties
+all: formatresponsefilter.properties authpolicy.properties web.xml search.properties
 
 web.xml:
 	cd web-xml && cat web.xml-begining web.xml-format-filter web.xml-$(AUTH)-filter web.xml-authorization-filter web.xml-servlets web.xml-ending > ../web.xml
 
-discovery.properties: discovery.properties.in
-	cat dbms.conf-$(DBMS) discovery.properties.in > $@
+search.properties: dbms.conf-$(DBMS)
+	cp dbms.conf-$(DBMS) $@
 
 formatresponsefilter.properties: formatresponsefilter.properties.in
 	cat dbms.conf-$(DBMS) formatresponsefilter.properties.in > $@
@@ -19,4 +19,4 @@ authpolicy.properties: dbms.conf-$(DBMS)
 
 .PHONY:
 clean:
-	-rm -f formatresponsefilter.properties authpolicy.properties discovery.properties web.xml
+	-rm -f formatresponsefilter.properties authpolicy.properties search.properties web.xml
diff --git a/data-discovery/config/discovery.properties.in b/data-discovery/config/discovery.properties.in
deleted file mode 100644
index 6a85146..0000000
--- a/data-discovery/config/discovery.properties.in
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-# database with 'surveys' table of metadata used to write VLKB-legacy response.xml
-#db_uri=jdbc:postgresql://localhost:5432/vialactea
-#db_schema=datasets
-#db_user_name=vialactea
-#db_password=IA2lbt09
-
-
diff --git a/data-discovery/src/main/java/vlkb/search/DbPSearch.java b/data-discovery/src/main/java/vlkb/search/DbPSearch.java
index ea62bcf..9de69b6 100644
--- a/data-discovery/src/main/java/vlkb/search/DbPSearch.java
+++ b/data-discovery/src/main/java/vlkb/search/DbPSearch.java
@@ -23,7 +23,6 @@ import java.lang.ClassNotFoundException;
 public class DbPSearch
 {
    private static final Logger LOGGER = Logger.getLogger(DbPSearch.class.getName());
-   //private static final SearchSettings.DBConn dbConn = SearchSettings.getInstance("discovery.properties").dbConn;
    private DBConn dbConn;
 
    //private static final String DB_DRIVER = "org.postgresql.Driver";
diff --git a/data-discovery/src/main/java/vlkb/webapi/SearchServlet.java b/data-discovery/src/main/java/vlkb/webapi/SearchServlet.java
index be6da0c..f66ca87 100644
--- a/data-discovery/src/main/java/vlkb/webapi/SearchServlet.java
+++ b/data-discovery/src/main/java/vlkb/webapi/SearchServlet.java
@@ -21,7 +21,7 @@ import javax.servlet.http.HttpServletResponse;
 public class SearchServlet extends javax.servlet.http.HttpServlet
 {
    private static final Logger         LOGGER   = Logger.getLogger("PSearch");
-   private static final SearchSettings settings = SearchSettings.getInstance("discovery.properties");
+   private static final SearchSettings settings = SearchSettings.getInstance("search.properties");
 
 
    public void init() throws ServletException
diff --git a/data-discovery/src/main/resources/discovery.properties b/data-discovery/src/main/resources/search.properties
similarity index 100%
rename from data-discovery/src/main/resources/discovery.properties
rename to data-discovery/src/main/resources/search.properties
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index 919f4c5..8a6f9cc 100755
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -30,12 +30,12 @@ then
    fi
 
    echo "<Context docBase=\"$WEBAPP_DIR/vlkb-search\"/>" > /var/lib/tomcat9/conf/Catalina/localhost/$DISCOVERY_CONTEXT_ROOT.xml
-   echo "db_uri=$DISCOVERY_DB_URI"  >  $WEBAPP_DIR/vlkb-search/WEB-INF/classes/discovery.properties
-   echo "db_schema=datasets"        >> $WEBAPP_DIR/vlkb-search/WEB-INF/classes/discovery.properties
-   echo "db_user_name=$DB_USERNAME" >> $WEBAPP_DIR/vlkb-search/WEB-INF/classes/discovery.properties
-   echo "db_password=$DB_PASSWORD"  >> $WEBAPP_DIR/vlkb-search/WEB-INF/classes/discovery.properties
+   echo "db_uri=$DISCOVERY_DB_URI"  >  $WEBAPP_DIR/vlkb-search/WEB-INF/classes/search.properties
+   echo "db_schema=datasets"        >> $WEBAPP_DIR/vlkb-search/WEB-INF/classes/search.properties
+   echo "db_user_name=$DB_USERNAME" >> $WEBAPP_DIR/vlkb-search/WEB-INF/classes/search.properties
+   echo "db_password=$DB_PASSWORD"  >> $WEBAPP_DIR/vlkb-search/WEB-INF/classes/search.properties
    # use the same DB for authz permissions (ObsCore with extensions)
-   cp $WEBAPP_DIR/vlkb-search/WEB-INF/classes/discovery.properties $WEBAPP_DIR/vlkb-search/WEB-INF/classes/authpolicy.properties
+   cp $WEBAPP_DIR/vlkb-search/WEB-INF/classes/search.properties $WEBAPP_DIR/vlkb-search/WEB-INF/classes/authpolicy.properties
 
    if test -n "$RESPONSE_FORMAT"
    then
-- 
GitLab