diff --git a/data-discovery/config/Makefile b/data-discovery/config/Makefile index e03b2d63c7dc9bcf8f5431d7e5940444ea4910ca..5b4fd7c006065db8f97816600bc098c20f65f9ab 100644 --- a/data-discovery/config/Makefile +++ b/data-discovery/config/Makefile @@ -3,7 +3,7 @@ DBMS ?= localhost # localhost | pasquale | pasquale-devel AUTH ?= # ia2token | garrtoken | <empty> ################################################################ -all: authpolicy.properties web.xml discovery.properties +all: formatresponsefilter.properties authpolicy.properties web.xml discovery.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 @@ -11,9 +11,12 @@ web.xml: discovery.properties: discovery.properties.in cat dbms.conf-$(DBMS) discovery.properties.in > $@ +formatresponsefilter.properties: formatresponsefilter.properties.in + cat dbms.conf-$(DBMS) formatresponsefilter.properties.in > $@ + authpolicy.properties: dbms.conf-$(DBMS) cp dbms.conf-$(DBMS) $@ .PHONY: clean: - -rm -f authpolicy.properties discovery.properties web.xml + -rm -f formatresponsefilter.properties authpolicy.properties discovery.properties web.xml diff --git a/data-discovery/config/formatresponsefilter.properties b/data-discovery/config/formatresponsefilter.properties.in similarity index 100% rename from data-discovery/config/formatresponsefilter.properties rename to data-discovery/config/formatresponsefilter.properties.in diff --git a/data-discovery/src/main/java/vlkb/search/DbPSearch.java b/data-discovery/src/main/java/vlkb/search/DbPSearch.java index a65895a07f3a807e42d0803ef2639de96d703ef4..ea62bcff12154217af9f11a16066248c0c9921a3 100644 --- a/data-discovery/src/main/java/vlkb/search/DbPSearch.java +++ b/data-discovery/src/main/java/vlkb/search/DbPSearch.java @@ -23,9 +23,15 @@ 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 static final SearchSettings.DBConn dbConn = SearchSettings.getInstance("discovery.properties").dbConn; + private DBConn dbConn; - private static final String DB_DRIVER = "org.postgresql.Driver"; + //private static final String DB_DRIVER = "org.postgresql.Driver"; + + DbPSearch(DBConn dbConn) + { + this.dbConn = dbConn; + } public String[] queryOverlapingPubdid(Coord coord, SubsurveyId subsurveyId) { diff --git a/data-discovery/src/main/java/vlkb/webapi/DBConn.java b/data-discovery/src/main/java/vlkb/webapi/DBConn.java new file mode 100644 index 0000000000000000000000000000000000000000..85dc9cd86c46961124355bf9c2c10dd735d1d2f5 --- /dev/null +++ b/data-discovery/src/main/java/vlkb/webapi/DBConn.java @@ -0,0 +1,19 @@ + +class DBConn +{ + public String uri; + public String schema; + public String user_name; + public String password; + + public String uri() {return uri;} + public String schema() {return schema;} + public String userName() {return user_name;} + public String password() {return password;} + + public String toString() + { + return uri + " schema[" + schema + "] " + user_name + " / " + password; + } +} + diff --git a/data-discovery/src/main/java/vlkb/webapi/FormatResponseFilter.java b/data-discovery/src/main/java/vlkb/webapi/FormatResponseFilter.java index f6b777502ce802f9737bc3d753af35e970dc7ee5..832593f6727fd129c1743ae06d1a5e38afe98b8d 100644 --- a/data-discovery/src/main/java/vlkb/webapi/FormatResponseFilter.java +++ b/data-discovery/src/main/java/vlkb/webapi/FormatResponseFilter.java @@ -73,6 +73,7 @@ public class FormatResponseFilter implements Filter dbSubsurveyArr = Subsurvey.loadSubsurveys(surveysAbsPathname); LOGGER.info("Surveys: loaded metadata for " + dbSubsurveyArr.length + " known surveys"); LOGGER.info("Default charset: " + Charset.defaultCharset()); + LOGGER.info("DB: " + settings.dbConn.toString()); } @@ -224,7 +225,7 @@ public class FormatResponseFilter implements Filter DbPSearch dbps; synchronized(DbPSearch.class) { - dbps = new DbPSearch(); + dbps = new DbPSearch(settings.dbConn); } return dbps.queryOutputData(pubdidArr, coord); diff --git a/data-discovery/src/main/java/vlkb/webapi/FormatResponseSettings.java b/data-discovery/src/main/java/vlkb/webapi/FormatResponseSettings.java index b2979bd80fd2faeaa50f33f915b352344f9279f4..dcebe2af1ecc626fb97a16f970cc56c01628c464 100644 --- a/data-discovery/src/main/java/vlkb/webapi/FormatResponseSettings.java +++ b/data-discovery/src/main/java/vlkb/webapi/FormatResponseSettings.java @@ -11,7 +11,7 @@ class FormatResponseSettings { private static final Logger LOGGER = Logger.getLogger("FormatResponseSettings"); - +/* public static class DBConn { private String uri; @@ -29,7 +29,7 @@ class FormatResponseSettings return uri + " schema[" + schema + "] " + user_name + " / " + password; } } - +*/ public static class ServiceUrls { @@ -101,7 +101,7 @@ class FormatResponseSettings private static DBConn loadDBConn(Properties properties) { - DBConn dbConn = new FormatResponseSettings.DBConn(); + DBConn dbConn = new DBConn(); dbConn.uri = properties.getProperty("db_uri","jdbc:postgresql://localhost:5432/vialactea").strip(); dbConn.schema = properties.getProperty("db_schema","datasets").strip(); dbConn.user_name = properties.getProperty("db_user_name","").strip(); diff --git a/data-discovery/src/main/java/vlkb/webapi/SearchServlet.java b/data-discovery/src/main/java/vlkb/webapi/SearchServlet.java index 7e0433682c468363a9cb2020418e6a772e2abd27..be6da0c566c089c54ae3f9a4b09c396cd5d592c4 100644 --- a/data-discovery/src/main/java/vlkb/webapi/SearchServlet.java +++ b/data-discovery/src/main/java/vlkb/webapi/SearchServlet.java @@ -64,7 +64,7 @@ public class SearchServlet extends javax.servlet.http.HttpServlet DbPSearch dbps; synchronized(DbPSearch.class) { - dbps = new DbPSearch(); + dbps = new DbPSearch(settings.dbConn); } String[] pubdidArr = dbps.queryOverlapingPubdid(coord, subsurveyId); diff --git a/data-discovery/src/main/java/vlkb/webapi/SearchSettings.java b/data-discovery/src/main/java/vlkb/webapi/SearchSettings.java index 8e85f24f0adf6fa4fe35057e77c719ff8600d19a..0a08c5eb83bb4bdecf4eef27e6ca0427f4387c17 100644 --- a/data-discovery/src/main/java/vlkb/webapi/SearchSettings.java +++ b/data-discovery/src/main/java/vlkb/webapi/SearchSettings.java @@ -11,7 +11,7 @@ class SearchSettings { private static final Logger LOGGER = Logger.getLogger("SearchSettings"); - +/* public static class DBConn { private String uri; @@ -29,7 +29,7 @@ class SearchSettings return uri + " schema[" + schema + "] " + user_name + " / " + password; } } - +*/ public DBConn dbConn; @@ -47,7 +47,7 @@ class SearchSettings DBConn dbConn = loadDBConn(properties); - return new SearchSettings(dbConn/*, serviceUrls*/); + return new SearchSettings(dbConn); } else { @@ -72,7 +72,7 @@ class SearchSettings private static DBConn loadDBConn(Properties properties) { - DBConn dbConn = new SearchSettings.DBConn(); + DBConn dbConn = new DBConn(); dbConn.uri = properties.getProperty("db_uri","jdbc:postgresql://localhost:5432/vialactea").strip(); dbConn.schema = properties.getProperty("db_schema","datasets").strip(); dbConn.user_name = properties.getProperty("db_user_name","").strip(); diff --git a/data-discovery/src/main/resources/formatresponsefilter.properties b/data-discovery/src/main/resources/formatresponsefilter.properties index a2fd398bb82299c02bf802346a26c3c1b9e90321..997168d9f7d169b023c3379863e3cc9e9fd37a3c 100644 --- a/data-discovery/src/main/resources/formatresponsefilter.properties +++ b/data-discovery/src/main/resources/formatresponsefilter.properties @@ -6,7 +6,7 @@ db_user_name= db_password= # VLKB-legacy: surveys metadata in csv file -surveys_abs_pathname= +surveys_metadata_abs_pathname= # these URL's are used in response.xml so client can access those services cutout_url=