Skip to content
Snippets Groups Projects
Commit 402cd807 authored by Robert Butora's avatar Robert Butora
Browse files

config: adss DB-config to Format-filter (Search-servlet ahs its own config...

config: adss DB-config to Format-filter (Search-servlet ahs its own config entry) and Db-search module is inited by Search-config or Format-config
parent d840105e
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ DBMS ?= localhost # localhost | pasquale | pasquale-devel ...@@ -3,7 +3,7 @@ DBMS ?= localhost # localhost | pasquale | pasquale-devel
AUTH ?= # ia2token | garrtoken | <empty> AUTH ?= # ia2token | garrtoken | <empty>
################################################################ ################################################################
all: authpolicy.properties web.xml discovery.properties all: formatresponsefilter.properties authpolicy.properties web.xml discovery.properties
web.xml: 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 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: ...@@ -11,9 +11,12 @@ web.xml:
discovery.properties: discovery.properties.in discovery.properties: discovery.properties.in
cat dbms.conf-$(DBMS) 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) authpolicy.properties: dbms.conf-$(DBMS)
cp dbms.conf-$(DBMS) $@ cp dbms.conf-$(DBMS) $@
.PHONY: .PHONY:
clean: clean:
-rm -f authpolicy.properties discovery.properties web.xml -rm -f formatresponsefilter.properties authpolicy.properties discovery.properties web.xml
...@@ -23,9 +23,15 @@ import java.lang.ClassNotFoundException; ...@@ -23,9 +23,15 @@ import java.lang.ClassNotFoundException;
public class DbPSearch public class DbPSearch
{ {
private static final Logger LOGGER = Logger.getLogger(DbPSearch.class.getName()); 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) public String[] queryOverlapingPubdid(Coord coord, SubsurveyId subsurveyId)
{ {
......
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;
}
}
...@@ -73,6 +73,7 @@ public class FormatResponseFilter implements Filter ...@@ -73,6 +73,7 @@ public class FormatResponseFilter implements Filter
dbSubsurveyArr = Subsurvey.loadSubsurveys(surveysAbsPathname); dbSubsurveyArr = Subsurvey.loadSubsurveys(surveysAbsPathname);
LOGGER.info("Surveys: loaded metadata for " + dbSubsurveyArr.length + " known surveys"); LOGGER.info("Surveys: loaded metadata for " + dbSubsurveyArr.length + " known surveys");
LOGGER.info("Default charset: " + Charset.defaultCharset()); LOGGER.info("Default charset: " + Charset.defaultCharset());
LOGGER.info("DB: " + settings.dbConn.toString());
} }
...@@ -224,7 +225,7 @@ public class FormatResponseFilter implements Filter ...@@ -224,7 +225,7 @@ public class FormatResponseFilter implements Filter
DbPSearch dbps; DbPSearch dbps;
synchronized(DbPSearch.class) synchronized(DbPSearch.class)
{ {
dbps = new DbPSearch(); dbps = new DbPSearch(settings.dbConn);
} }
return dbps.queryOutputData(pubdidArr, coord); return dbps.queryOutputData(pubdidArr, coord);
......
...@@ -11,7 +11,7 @@ class FormatResponseSettings ...@@ -11,7 +11,7 @@ class FormatResponseSettings
{ {
private static final Logger LOGGER = Logger.getLogger("FormatResponseSettings"); private static final Logger LOGGER = Logger.getLogger("FormatResponseSettings");
/*
public static class DBConn public static class DBConn
{ {
private String uri; private String uri;
...@@ -29,7 +29,7 @@ class FormatResponseSettings ...@@ -29,7 +29,7 @@ class FormatResponseSettings
return uri + " schema[" + schema + "] " + user_name + " / " + password; return uri + " schema[" + schema + "] " + user_name + " / " + password;
} }
} }
*/
public static class ServiceUrls public static class ServiceUrls
{ {
...@@ -101,7 +101,7 @@ class FormatResponseSettings ...@@ -101,7 +101,7 @@ class FormatResponseSettings
private static DBConn loadDBConn(Properties properties) 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.uri = properties.getProperty("db_uri","jdbc:postgresql://localhost:5432/vialactea").strip();
dbConn.schema = properties.getProperty("db_schema","datasets").strip(); dbConn.schema = properties.getProperty("db_schema","datasets").strip();
dbConn.user_name = properties.getProperty("db_user_name","").strip(); dbConn.user_name = properties.getProperty("db_user_name","").strip();
......
...@@ -64,7 +64,7 @@ public class SearchServlet extends javax.servlet.http.HttpServlet ...@@ -64,7 +64,7 @@ public class SearchServlet extends javax.servlet.http.HttpServlet
DbPSearch dbps; DbPSearch dbps;
synchronized(DbPSearch.class) synchronized(DbPSearch.class)
{ {
dbps = new DbPSearch(); dbps = new DbPSearch(settings.dbConn);
} }
String[] pubdidArr = dbps.queryOverlapingPubdid(coord, subsurveyId); String[] pubdidArr = dbps.queryOverlapingPubdid(coord, subsurveyId);
......
...@@ -11,7 +11,7 @@ class SearchSettings ...@@ -11,7 +11,7 @@ class SearchSettings
{ {
private static final Logger LOGGER = Logger.getLogger("SearchSettings"); private static final Logger LOGGER = Logger.getLogger("SearchSettings");
/*
public static class DBConn public static class DBConn
{ {
private String uri; private String uri;
...@@ -29,7 +29,7 @@ class SearchSettings ...@@ -29,7 +29,7 @@ class SearchSettings
return uri + " schema[" + schema + "] " + user_name + " / " + password; return uri + " schema[" + schema + "] " + user_name + " / " + password;
} }
} }
*/
public DBConn dbConn; public DBConn dbConn;
...@@ -47,7 +47,7 @@ class SearchSettings ...@@ -47,7 +47,7 @@ class SearchSettings
DBConn dbConn = loadDBConn(properties); DBConn dbConn = loadDBConn(properties);
return new SearchSettings(dbConn/*, serviceUrls*/); return new SearchSettings(dbConn);
} }
else else
{ {
...@@ -72,7 +72,7 @@ class SearchSettings ...@@ -72,7 +72,7 @@ class SearchSettings
private static DBConn loadDBConn(Properties properties) 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.uri = properties.getProperty("db_uri","jdbc:postgresql://localhost:5432/vialactea").strip();
dbConn.schema = properties.getProperty("db_schema","datasets").strip(); dbConn.schema = properties.getProperty("db_schema","datasets").strip();
dbConn.user_name = properties.getProperty("db_user_name","").strip(); dbConn.user_name = properties.getProperty("db_user_name","").strip();
......
...@@ -6,7 +6,7 @@ db_user_name= ...@@ -6,7 +6,7 @@ db_user_name=
db_password= db_password=
# VLKB-legacy: surveys metadata in csv file # 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 # these URL's are used in response.xml so client can access those services
cutout_url= cutout_url=
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment