Changeset 30411

Show
Ignore:
Timestamp:
16.03.2016 20:50:45 (3 years ago)
Author:
davidb
Message:

Changes after debugging on MacOS El Capitan

Location:
gs3-extensions/audioDB/trunk/src/src/java/org/greenstone/gsdl3
Files:
3 modified

Legend:

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

    r26060 r30411  
    120120 
    121121    // replaces default AbstractSearch version with one tied to database 
    122     gs_doc_db = new BasicDocumentDatabase(this.doc, 
    123                            database_type,this.site_home, 
    124                            this.cluster_name, 
    125                            this.index_stem); 
     122    gs_doc_db = new BasicDocumentDatabase(database_type,this.site_home, 
     123                          this.cluster_name, 
     124                          this.index_stem); 
    126125    if (!gs_doc_db.isValid()) { 
    127126        logger.error("Failed to open Document Database."); 
  • gs3-extensions/audioDB/trunk/src/src/java/org/greenstone/gsdl3/service/GS2AudioDBSearch.java

    r24398 r30411  
    6767        synchronized(this.audiodb_src) { 
    6868        // Create a new (empty) result message ('doc' is in ServiceRack.java) 
    69         Element result = this.doc.createElement (GSXML.RESPONSE_ELEM); 
     69        Document result_doc = XMLConverter.newDOM(); 
     70        Element result = result_doc.createElement (GSXML.RESPONSE_ELEM); 
    7071 
    7172        // Rather than QUERY_SERVICE use "TextQuery"  
     
    109110        if (docs.isEmpty()) { 
    110111        // something has gone wrong 
    111         GSXML.addError (this.doc, result, "Couldn't query the audioDB database", GSXML.ERROR_TYPE_SYSTEM); 
     112        GSXML.addError (result, "Couldn't query the audioDB database", GSXML.ERROR_TYPE_SYSTEM); 
    112113        return result; 
    113114        } 
     
    120121         
    121122        // Create a metadata list to store information about the query results 
    122         Element metadata_list = this.doc.createElement (GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER); 
     123        Element metadata_list = result_doc.createElement (GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER); 
    123124        result.appendChild (metadata_list); 
    124125         
    125126        // Add a metadata element specifying the number of matching documents 
    126127        // because the total number is just the number returned, use numDocsReturned, not numDocsMatched 
    127         GSXML.addMetadata (this.doc, metadata_list, "numDocsReturned", ""+totalDocs); 
     128        GSXML.addMetadata (metadata_list, "numDocsReturned", ""+totalDocs); 
    128129        // add a metadata item to specify what actual query was done - eg if stuff was stripped out etc. and then we can use the query later, cos we don't know which parameter was the query 
    129         GSXML.addMetadata (this.doc, metadata_list, "query", query); 
     130        GSXML.addMetadata (metadata_list, "query", query); 
    130131         
    131132        if (docs.size () > 0) { 
    132133        // Create a document list to store the matching documents, and add them 
    133         Element document_list = this.doc.createElement (GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 
     134        Element document_list = result_doc.createElement (GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 
    134135        result.appendChild (document_list); 
    135136        for (int d = 0; d < docs.size (); d++) { 
     
    140141            String offsets = adb_doc.getOffsetList(); 
    141142 
    142             Element doc_node = createDocNode (doc_id, Double.toString (rank)); 
     143            Element doc_node = createDocNode (result_doc, doc_id, Double.toString (rank)); 
    143144            doc_node.setAttribute("frameOffset", offsets); 
    144145 
     
    148149         
    149150        // Create an empty term list as a place holder for the term information 
    150         Element term_list = this.doc.createElement (GSXML.TERM_ELEM+GSXML.LIST_MODIFIER); 
     151        Element term_list = result_doc.createElement (GSXML.TERM_ELEM+GSXML.LIST_MODIFIER); 
    151152        result.appendChild (term_list); 
    152153         
  • gs3-extensions/audioDB/trunk/src/src/java/org/greenstone/gsdl3/util/AudioDBWrapper.java

    r26290 r30411  
    117117    int num_matches_within_track = 6; 
    118118 
    119     String cmd = "audioDB" 
    120         + " -d " + "'" + full_adb_filename + "'" 
    121         + " -Q nsequence" 
    122         + " -p " + offset_  
    123         + " -n " + num_matches_within_track 
    124         + " -l " + length_ 
    125         + " -r " + max_docs_ 
    126         + " -f " + "'" + full_chr12_filename + "'"; 
    127  
    128     System.err.println("**** cmd = " + cmd); 
     119    String [] cmd_array = new String[] { 
     120        "audioDB", 
     121        "-d", full_adb_filename, 
     122        "-Q", "nsequence", 
     123        "-p", String.format("%d",offset_), 
     124        "-n", String.format("%d",num_matches_within_track), 
     125        "-l", String.format("%d",length_), 
     126        "-r", String.format("%d",max_docs_), 
     127        "-f", full_chr12_filename 
     128    }; 
     129 
     130    System.err.println("**** cmd_array = " + String.join(" ", cmd_array)); 
    129131 
    130132    Runtime runtime = Runtime.getRuntime(); 
    131133    try { 
    132         Process audioDB_proc = runtime.exec(cmd); 
     134        Process audioDB_proc = runtime.exec(cmd_array); 
     135        //int exitVal = audioDB_proc.waitFor(); 
     136        //System.err.println("*** exit status = " + exitVal); 
     137 
    133138        InputStream ais = audioDB_proc.getInputStream(); 
    134139        InputStreamReader aisr = new InputStreamReader(ais); 
     
    169174            if (line_count>1) { 
    170175            // struck new top-level entry => store vector vals for previous block 
     176 
    171177            first_entry = addQueryResult(first_entry,root_doc_id,rankVector,offsetVector); 
    172178            // and now reset vectors to empty to be ready for next chain of values