1 package org.kuali.ole.externalds; 2 // NOTE: Uncomment this file to enable Searching external Z39.50 data sources. 3 4 //import net.sf.jz3950.Association; 5 //import net.sf.jz3950.RecordResultSet; 6 //import net.sf.jz3950.query.PrefixQuery; 7 //import org.kuali.ole.docstore.OleException; 8 //import org.kuali.ole.docstore.discovery.model.SearchParams; 9 // 10 //import java.util.ArrayList; 11 //import java.util.List; 12 // 13 ///** 14 // * Created by IntelliJ IDEA. 15 // * User: ND6967 16 // * Date: 2/19/13 17 // * Time: 12:42 PM 18 // * To change this template use File | Settings | File Templates. 19 // */ 20 public class Z3950DataSource 21 extends AbstractExternalDataSource { 22 // private DataSourceConfig dataSourceConfig; 23 // private static final int RESULT_SET_ITERATION_LIMIT = 80; 24 // 25 // @Override 26 // public List<String> searchForBibs(SearchParams searchParams, DataSourceConfig dataSourceConfigInfo) 27 // throws Exception, OleException { 28 // 29 // Association association = new Association(); 30 // String domainName = dataSourceConfigInfo.getDomainName(); 31 // String port = dataSourceConfigInfo.getPortNum(); 32 // System.out.println("searchForBibs getDomainName " + dataSourceConfigInfo.getDomainName()); 33 // System.out.println("searchForBibs getPortNum " + dataSourceConfigInfo.getPortNum()); 34 // association.connect(domainName, Integer.parseInt(port)); 35 // System.out.println("connected.........."); 36 // //String query="@attrset bib-1 @attr 1=4 \"advanced java\""; 37 // Z3950QueryBuilder z3950QueryBuilde = new Z3950QueryBuilder(); 38 // String query = z3950QueryBuilde.buildQuery(searchParams); 39 // System.out.println("Z3950DataSource : searchForBibs : query " + query); 40 // List<String> results = iterateOverPartOfResultSet(association.search(new PrefixQuery("Voyager", query))); 41 // System.out.println("searchForBibs: results size " + results.size()); 42 // association.disconnect(); 43 // return results; 44 // } 45 // 46 // private List iterateOverPartOfResultSet(RecordResultSet resultSet) { 47 // List<String> results = new ArrayList<String>(); 48 // System.out.println(("Iterating over maximum of " + RESULT_SET_ITERATION_LIMIT + " record(s) from " 49 // + resultSet.getTotalResults() + " record(s) in total")); 50 // 51 // int recordCount = 0; 52 // 53 // // while(resultSet.hasNext()){ 54 // // results.add(resultSet.next().getData()); 55 // // // System.out.println("iterateOverPartOfResultSet "); 56 // // 57 // // 58 // // if (++recordCount == RESULT_SET_ITERATION_LIMIT) { 59 // // break; 60 // // } 61 // // 62 // // } 63 // for (net.sf.jz3950.record.Record result : resultSet) { 64 // // System.out.println("iterateOverPartOfResultSet "+result); 65 // results.add(result.getData()); 66 // 67 // if (++recordCount == RESULT_SET_ITERATION_LIMIT) { 68 // break; 69 // } 70 // } 71 // return results; 72 // } 73 }