Changeset 2203 for trunk/java-client/org


Ignore:
Timestamp:
2001-03-20T14:39:48+12:00 (23 years ago)
Author:
paynter
Message:

Get collection name and description.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/java-client/org/nzdl/gsdl/SearchAllCollections.java

    r2119 r2203  
    6161 *
    6262 * @author Gordon Paynter ([email protected])
    63  * @author stuart yeates ([email protected])
     63 * @author Stuart Yeates ([email protected])
    6464 * @author Dave Nichols ([email protected])
    6565 * @version $Revision$
     
    288288        String collectionName = (String) collectionSetIterator.next();
    289289        if (nzdl.hasCollection(collectionName) ) {
    290         if (nzdl.pingCollection(collectionName) ) {
    291             queryCollection(collectionName, queryText);
    292         }
     290        // if (nzdl.pingCollection(collectionName) ) {
     291
     292        // ping is broken, so use builddate to decide whether this
     293                // collection is valid
     294            NzdlCollectionInfo info = nzdl.getCollectionInfo(collectionName);
     295            if (info != null && info.getBuildDate() != 0) {
     296            queryCollection(collectionName, queryText);
     297            }
     298        // }
    293299        }
    294300    }
    295301    }
    296 
    297302
    298303    void queryCollection(String collectionName, String queryText)
     
    308313    int frequency = response.getResultSet().getNumOfDocs();
    309314    if (frequency > 0) {
    310         System.out.println("------------------------------");
     315        System.out.println("\n------------------------------");
    311316        System.out.println(frequency + "\t" + collectionName);
    312317        describeCollection(collectionName);
     
    316321    void describeCollection(String collectionName) {
    317322
    318     String document = nzdl.getDocument(collectionName, "collection");
    319     System.out.println(document);
    320 
    321     Set s = nzdl.getMetaData(collectionName, "document", "collectionextra");
    322     /*
    323     Iterator setIterator = s.iterator();
    324     while (setIterator.hasNext() ) {
    325         String value = (String) setIterator.next();
    326         System.out.println("collectionextra: " + value + "\n---\n");
     323      // collection name
     324      Set n = nzdl.getMetaData(collectionName, "collection", "collectionname");
     325      if (n.size() == 1) {
     326    System.out.println("\nName: " + n.toArray()[0]);
     327      }
     328
     329      // collection description
     330      Set d = nzdl.getMetaData(collectionName, "collection", "collectionextra");
     331      if (d.size() == 1) {
     332    String value = (String) d.toArray()[0];
     333    if (value.length() > 0) {
     334      System.out.println("Description: " + value);
    327335    }
    328     */
    329    
     336      }
     337
     338      // basic collection information
     339      NzdlCollectionInfo info = nzdl.getCollectionInfo(collectionName);
     340      System.out.println("Info: " + info);
    330341    }
    331342   
Note: See TracChangeset for help on using the changeset viewer.