Changeset 2239 for SRUAggregator


Ignore:
Timestamp:
09/19/12 11:51:14 (12 years ago)
Author:
zastrow
Message:
 
Location:
SRUAggregator/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • SRUAggregator/trunk/src/java/clarind/fcs/Aggregator.java

    r2217 r2239  
    2727import java.util.logging.*;
    2828
    29 
    3029public class Aggregator extends SelectorComposer<Component> {
    31    
     30
    3231    private static Logger logger = Logger.getLogger("FCS-AGGREGATOR");
    33 
    3432    @Wire
    3533    private Grid anzeigeGrid;
     
    5654    @Wire
    5755    private Combobox maximumRecordsSelect;
     56    @Wire
     57    private Button addForeignEndpoint;
     58    @Wire
     59    Combobox foreignEndpointSelect;
    5860
    5961    @Override
    6062    public void doAfterCompose(Component comp) throws Exception {
    61         super.doAfterCompose(comp); 
     63        super.doAfterCompose(comp);
    6264
    6365        languageSelect.setSelectedItem(german);
     
    184186                    for (i3 = 0; i3 < r.getChildren().size(); i3++) {
    185187                        Label l = (Label) r.getChildren().get(i3);
    186                         temp = temp + "\"" + l.getValue().replace("\"", "QUOTE")  + "\"";
     188                        temp = temp + "\"" + l.getValue().replace("\"", "QUOTE") + "\"";
    187189                        if (i3 < r.getChildren().size() - 1) {
    188190                            temp = temp + ",";
     
    255257
    256258            boolean isACorpusSelected = false;
    257                      
     259
    258260            //SRUSearch srusearch = new SRUSearch();
    259                        
    260             SRUSearchThreaded srusearch =  SRUSearchThreaded.getInstance();
     261
     262            SRUSearchThreaded srusearch = SRUSearchThreaded.getInstance();
    261263
    262264            for (i = 0; i < allCorpora.getChildren().size(); i++) {
     
    267269
    268270                        isACorpusSelected = true;
    269                        
     271
    270272                        String endpointURL = null;
    271273                        String corpus = null;
     
    285287
    286288                        int maximumRecords = Integer.parseInt(maximumRecordsSelect.getValue());
    287                        
    288                         if(maximumRecords > 30){
     289
     290                        if (maximumRecords > 30) {
    289291                            Messagebox.show("The allowed maximum of hits is 30! Please don't specify a higher value!");
    290292                            break;
    291293                        }
    292                        
    293                        
    294                         logger.info("Now executing search: " + searchString.getText() + " " + endpointURL + " " +  corpus + " " + maximumRecords);
    295                      
     294
     295
     296                        logger.info("Now executing search: " + searchString.getText() + " " + endpointURL + " " + corpus + " " + maximumRecords);
     297
    296298                        ArrayList<Row> zeilen = new ArrayList<Row>();
    297                        
     299
    298300                        try {
    299301                            zeilen = srusearch.execute(searchString.getText(), endpointURL, corpus, maximumRecords);
     
    348350                }
    349351            } // for i ...
    350            
    351            
    352            
    353            
     352
     353
     354
     355
    354356            if (!isACorpusSelected) {
    355357
     
    358360
    359361
    360            logger.info("Search done.");
     362            logger.info("Search done.");
    361363
    362364        } catch (Exception ex) {
     
    365367
    366368    }
     369
     370    @Listen("onClick=#addForeignEndpoint")
     371    public void onAddForeignEndpoint(Event ev) {
     372        try {
     373            Endpoint ep = new Endpoint(foreignEndpointSelect.getValue().split(";")[1], foreignEndpointSelect.getValue().split(";")[0]);
     374            Harvester harv = new Harvester();
     375            ArrayList<Corpus> corpora = harv.getCorporaOfAnEndpoint(ep.getUrl());
     376            int i, i2;
     377
     378            if (corpora.isEmpty()) {
     379                Checkbox cb = new Checkbox();
     380                cb.setId(ep.getUrl());
     381
     382                //"?operation=searchRetrieve&version=1.2"
     383                cb.setLabel(ep.getUrl());
     384
     385                allCorpora.getChildren().add(cb);
     386                allCorpora.getChildren().add(new Separator());
     387
     388                logger.info("Created Checkbox for endpoint" + cb.getId());
     389            } else {
     390                Label l = new Label(ep.getUrl() + ":");
     391
     392                l.setStyle("font-weight:bold");
     393
     394                allCorpora.getChildren().add(l);
     395                allCorpora.getChildren().add(new Separator());
     396                for (i2 = 0; i2 < corpora.size(); i2++) {
     397                    Checkbox cb = new Checkbox();
     398
     399                    cb.setId(ep.getUrl() + "\t" + corpora.get(i2).getValue());
     400                    cb.setLabel(corpora.get(i2).getDisplayTerm());
     401
     402                    allCorpora.getChildren().add(cb);
     403                    allCorpora.getChildren().add(new Separator());
     404
     405                    logger.info("Created Checkbox for corpus " + cb.getId());
     406                } // for i2 ...
     407            } // if corpora.size else
     408
     409
     410
     411        } catch (Exception ex) {
     412            System.out.println(ex.getMessage());
     413        }
     414
     415    }
    367416}
  • SRUAggregator/trunk/web/index.zul

    r2217 r2239  
    4949                                                                                       
    5050                        </groupbox>
     51                       
     52                        <separator />
     53                       
     54                        <groupbox mold="3d" id="gbForeignEndpoints">
     55                            <caption>Foreign Endpoints</caption>
     56                            <combobox id="foreignEndpointSelect" width="150px" value="Select an endpoint">
     57                                <comboitem label="Mimore;http://www.meertens.knaw.nl/mimore/srucql/"/>
     58                                <comboitem label="INL;http://gysseling.corpus.taalbanknederlands.inl.nl/cqlwebapp/cql"/>                               
     59                                <comboitem label="DANS;http://srucql.dans.knaw.nl"/>
     60                                <comboitem label="ICLTT;http://corpus3.aac.ac.at/ddconsru"/>
     61                                <comboitem label="UPF;http://gilmere.upf.edu/pais_sru"/>
     62                            </combobox>
     63                           
     64                           
     65                           
     66                            <button id="addForeignEndpoint" label="Add" />
     67                           
     68                        </groupbox>
     69                       
    5170                    </panelchildren>
    5271                </panel>
Note: See TracChangeset for help on using the changeset viewer.