Changeset 32411

Show
Ignore:
Timestamp:
31.08.2018 18:43:12 (8 months ago)
Author:
ak19
Message:

Next incremental change: now GS3 solr ext java code goes through ProtocolPortProperties?.java to obtain the port and protocol. Will hereafter need to make ProtocolPortProperties? constructors throw an exception on error and update all code using it.

Location:
gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service/GS2SolrSearch.java

    r32410 r32411  
    4949import org.greenstone.gsdl3.util.SolrQueryWrapper; 
    5050import org.greenstone.util.GlobalProperties; 
     51import org.greenstone.util.ProtocolPortProperties; 
    5152import org.w3c.dom.Document; 
    5253import org.w3c.dom.Element; 
     
    9697            globalProperties.load(Class.forName("org.greenstone.util.GlobalProperties").getClassLoader().getResourceAsStream("global.properties")); 
    9798            String host = globalProperties.getProperty("tomcat.server", "localhost"); 
    98             String port = globalProperties.getProperty("tomcat.port.http", "8383"); 
    99             String protocol = globalProperties.getProperty("server.protocol", "http"); 
     99            //String port = globalProperties.getProperty("tomcat.port.http", "8383"); 
     100            //String protocol = globalProperties.getProperty("server.protocol", "http"); 
     101            ProtocolPortProperties protocolPortProps = new ProtocolPortProperties(globalProperties); 
     102            if(protocolPortProps.hadError()) { 
     103            throw new Exception("**** ERROR with port and/or protocol in build.properties:\n" + protocolPortProps.getErrorMsg()); 
     104            } 
     105            String protocol = protocolPortProps.getProtocol(); 
     106            String port = protocolPortProps.getPort(); 
    100107            String solrContext = globalProperties.getProperty("solr.context", "solr"); 
    101108             
  • gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service/SolrSearch.java

    r32410 r32411  
    77import org.greenstone.gsdl3.util.*; 
    88import org.greenstone.util.GlobalProperties; 
     9import org.greenstone.util.ProtocolPortProperties; 
    910 
    1011// XML classes 
     
    4647        globalProperties.load(Class.forName("org.greenstone.util.GlobalProperties").getClassLoader().getResourceAsStream("global.properties")); 
    4748        String host = globalProperties.getProperty("tomcat.server", "localhost"); 
    48         String port = globalProperties.getProperty("tomcat.port.http", "8383"); 
    49         String protocol = globalProperties.getProperty("server.protocol", "http"); 
     49        //String port = globalProperties.getProperty("tomcat.port.http", "8383"); 
     50        //String protocol = globalProperties.getProperty("server.protocol", "http"); 
     51        ProtocolPortProperties protocolPortProps = new ProtocolPortProperties(globalProperties); 
     52        if(protocolPortProps.hadError()) { 
     53        throw new Exception("**** ERROR with port and/or protocol in build.properties:\n" + protocolPortProps.getErrorMsg()); 
     54        } 
     55        String protocol = protocolPortProps.getProtocol(); 
     56        String port = protocolPortProps.getPort(); 
    5057        String solrContext = globalProperties.getProperty("solr.context", "solr"); 
    5158