Changeset 16797

Show
Ignore:
Timestamp:
14.08.2008 19:53:04 (11 years ago)
Author:
ak19
Message:

Added method displayAllEntries() to return a display String of the key, value pairs in the database for debugging purposes

Location:
greenstone3/trunk/src/java/org/greenstone/gsdl3/util
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • greenstone3/trunk/src/java/org/greenstone/gsdl3/util/FlatDatabaseWrapper.java

    r15325 r16797  
    3838  public String getValue(String key); 
    3939 
     40  /** returns a string of key-value entries that can be  
     41   *    printed for debugging purposes*/ 
     42  public String displayAllEntries(); 
    4043} 
    4144 
  • greenstone3/trunk/src/java/org/greenstone/gsdl3/util/GDBMWrapper.java

    r15325 r16797  
    102102  } 
    103103 
     104    /** returns a string of key-value entries that  
     105     *  can be printed for debugging purposes. */ 
     106    public String displayAllEntries() { 
     107    StringBuffer output = new StringBuffer(); 
     108    try{ 
     109        java.util.Enumeration e = db_.keys(); 
     110        while(e.hasMoreElements()) { 
     111        Object key = e.nextElement(); 
     112        Object value = db_.fetch(key); 
     113 
     114        output.append("key href: "); 
     115        output.append((String)key); 
     116        output.append("\tvalue ID: "); 
     117        output.append((String)value); 
     118        output.append("\n"); 
     119        //logger.warn("key: " + key + "\tvalue: " + value); 
     120        } 
     121    } catch(Exception e) { 
     122        logger.warn("Exception encountered when trying to displayAllEntries():" + e); 
     123    } 
     124    return output.toString(); 
     125    } 
    104126} 
  • greenstone3/trunk/src/java/org/greenstone/gsdl3/util/JDBMWrapper.java

    r15325 r16797  
    4242  } 
    4343 
     44  /** returns a string of key-value entries that can be  
     45   *    printed for debugging purposes*/ 
     46  public String displayAllEntries() { 
     47    return "No entries."; 
     48  } 
    4449} 
  • greenstone3/trunk/src/java/org/greenstone/gsdl3/util/SimpleCollectionDatabase.java

    r15325 r16797  
    5757    particular main key in the database */ 
    5858  public DBInfo getInfo(String main_key) { 
     59      //   logger.warn("All the entries of the db are:"); 
     60      //   this.coll_db.displayAllEntries(); 
     61 
    5962    String key_info = this.coll_db.getValue(main_key); 
    6063    if (key_info == null || key_info.equals("")) {