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
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -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
+8 −2
Original line number Diff line number Diff line
@@ -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)
   {
+19 −0
Original line number Diff line number Diff line

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;
   }
}
+2 −1
Original line number Diff line number Diff line
@@ -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);
Loading