Changeset 2097


Ignore:
Timestamp:
08/15/12 13:31:27 (12 years ago)
Author:
zastrow
Message:
 
Location:
SRUAggregator/trunk
Files:
7 edited
1 moved

Legend:

Unmodified
Added
Removed
  • SRUAggregator/trunk/nbproject/build-impl.xml

    r2075 r2097  
    976976    <target depends="init" if="dist.ear.dir" name="library-inclusion-in-manifest">
    977977        <copyfiles files="${libs.zk.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
     978        <copyfiles files="${libs.SRUCQLClient.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
    978979        <mkdir dir="${build.web.dir}/META-INF"/>
    979980        <manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update"/>
     
    981982    <target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir">
    982983        <copyfiles files="${libs.zk.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
     984        <copyfiles files="${libs.SRUCQLClient.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
    983985    </target>
    984986    <target depends="init" if="dist.ear.dir" name="-clean-webinf-lib">
  • SRUAggregator/trunk/nbproject/genfiles.properties

    r2077 r2097  
    1 build.xml.data.CRC32=e938706e
     1build.xml.data.CRC32=1ca8f689
    22build.xml.script.CRC32=e9ec94ca
    33build.xml.stylesheet.CRC32=651128d4@1.38.1.1
    44# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
    55# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    6 nbproject/build-impl.xml.data.CRC32=e938706e
    7 nbproject/build-impl.xml.script.CRC32=14072480
     6nbproject/build-impl.xml.data.CRC32=1ca8f689
     7nbproject/build-impl.xml.script.CRC32=1ad9793f
    88nbproject/build-impl.xml.stylesheet.CRC32=4e9cae83@1.38.1.1
  • SRUAggregator/trunk/nbproject/private/private.xml

    r2075 r2097  
    33    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
    44    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
     5    <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/1">
     6        <file>file:/Users/zastrow/Documents/ClarinD/schrauber/Aggregator/trunk/src/java/clarind/fcs/Harvester.java</file>
     7        <file>file:/Users/zastrow/Documents/ClarinD/schrauber/Aggregator/trunk/src/java/clarind/fcs/Aggregator.java</file>
     8        <file>file:/Users/zastrow/Documents/ClarinD/schrauber/Aggregator/trunk/web/index.zul</file>
     9    </open-files>
    510</project-private>
  • SRUAggregator/trunk/nbproject/project.properties

    r2075 r2097  
    3636jar.compress=false
    3737javac.classpath=\
    38     ${libs.zk.classpath}
     38    ${libs.zk.classpath}:\
     39    ${libs.SRUCQLClient.classpath}
    3940# Space-separated list of extra javac options
    4041javac.compilerargs=
  • SRUAggregator/trunk/nbproject/project.xml

    r2016 r2097  
    99                <library dirs="200">
    1010                    <file>${libs.zk.classpath}</file>
     11                    <path-in-war>WEB-INF/lib</path-in-war>
     12                </library>
     13                <library dirs="200">
     14                    <file>${libs.SRUCQLClient.classpath}</file>
    1115                    <path-in-war>WEB-INF/lib</path-in-war>
    1216                </library>
  • SRUAggregator/trunk/src/java/clarind/fcs/Aggregator.java

    r2085 r2097  
    1616import org.zkoss.zul.Groupbox;
    1717import org.zkoss.zul.Separator;
     18import org.zkoss.zul.Label;
    1819
    1920public class Aggregator extends SelectorComposer<Component> {
     
    2728    @Wire
    2829    private Checkbox ids1;
    29      @Wire
     30    @Wire
    3031    private Groupbox allCorpora;
    31    
    3232
    3333    @Override
     
    3535        super.doAfterCompose(comp); //wire variables and event listners
    3636        //do whatever you want (you could access wired variables here)
    37         CenterRegistry cr = new CenterRegistry();
    38         ArrayList<Endpoint> ep = cr.getEndpoints();
     37        Harvester harv = new Harvester();
     38        ArrayList<Endpoint> ep = harv.getEndpoints();
    3939
    40         int i;
     40        int i, i2;
    4141
    4242        for (i = 0; i < ep.size(); i++) {
    43             Checkbox cb = new Checkbox();
    44             cb.setLabel("LABEL: " +  ep.get(i).getInstitution());
    45             Row r = new Row();
    46            
    47             System.out.println(ep.get(i).getInstitution() + " " + ep.get(i).getUrl());
    48             allCorpora.getChildren().add(cb);
    49             allCorpora.getChildren().add(new Separator());
     43
     44            System.out.println("Calling corpora ...: " + ep.get(i).getUrl());
     45            ArrayList<String> corpora = harv.getCorporaOfAnEndpoint(ep.get(i).getUrl());
     46
     47            if (corpora.size() == 0) {
     48                Checkbox cb = new Checkbox();
     49                cb.setLabel(ep.get(i).getUrl());
     50                allCorpora.getChildren().add(cb);
     51                allCorpora.getChildren().add(new Separator());
     52            } else {
     53                Label l = new Label(ep.get(i).getUrl() + ":");
     54
     55                allCorpora.getChildren().add(l);
     56                allCorpora.getChildren().add(new Separator());
     57                for (i2 = 0; i2 < corpora.size(); i2++) {
     58                    Checkbox cb = new Checkbox();
     59                    cb.setLabel(corpora.get(i2));
     60                   
     61                    allCorpora.getChildren().add(cb);
     62                    allCorpora.getChildren().add(new Separator());
     63                } // for i2 ...
     64            } // if corpora.size else
    5065        } // for i ...
    5166    }
     
    7388
    7489            for (i = 0; i < allCorpora.getChildren().size(); i++) {
    75                     if(allCorpora.getChildren().get(i) instanceof Checkbox){
     90                if (allCorpora.getChildren().get(i) instanceof Checkbox) {
    7691                    Checkbox cb = (Checkbox) allCorpora.getChildren().get(i);
    7792                    if (cb.isChecked()) {
     93                        // now execute the search:
    7894                        display = display + cb.getLabel() + "\n";
    7995                    }
    80                     }
     96                }
    8197            } // for i ...
    82 
    83 
    84          
    8598
    8699            Messagebox.show(display);
  • SRUAggregator/trunk/src/java/clarind/fcs/Harvester.java

    r2085 r2097  
    1010import javax.xml.xpath.XPathExpressionException;
    1111import javax.xml.xpath.XPathFactory;
     12import org.w3c.dom.Node;
    1213import org.w3c.dom.NodeList;
    1314
    14 public class CenterRegistry {
     15public class Harvester {
    1516
    1617    final String crStartpoint = "http://130.183.206.32/restxml/";
     
    7071             for(i2=0; i2<endpointsUrls.getLength();i2++){
    7172                 String epUrl = endpointsUrls.item(i2).getTextContent();                 
    72                  ep.add(new Endpoint(instituteName, epUrl));
     73                 ep.add(new Endpoint(epUrl, instituteName));
    7374             } // for i2
    7475                         
     
    7980    } //getEndpoints
    8081   
     82   
     83    public ArrayList<String> getCorporaOfAnEndpoint(String endpointUrl) throws Exception {
     84        System.out.println("getCorporaOfAnEndpoint: " + endpointUrl);
     85        ArrayList<String> corpora = new ArrayList<String>();
     86       
     87        URL u = new URL(endpointUrl + "?operation=scan&scanClause=fcs.resource");
     88        InputStream is = u.openStream();
     89       
     90        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
     91        DocumentBuilder builder = factory.newDocumentBuilder();
     92        org.w3c.dom.Document document = builder.parse(is);
     93
     94        is.close();
     95       
     96        //http://clarinws.informatik.uni-leipzig.de:8080/CQL?
     97       
     98        NodeList corporaNodes = evaluateXPath("//*[local-name()='term']/*[local-name()='value']", document);
     99     
     100        int i, i2;
     101       
     102        for(i=0; i<corporaNodes.getLength();i++){
     103          corpora.add(corporaNodes.item(i).getTextContent());
     104           
     105        } // for i ...
     106        return corpora;
     107    }  // getCorporaOfAnEndpoint
     108   
     109   
    81110    public static void main (String[] args) throws Exception {
    82         CenterRegistry cr = new CenterRegistry();
     111        Harvester cr = new Harvester();
    83112        ArrayList<Endpoint> ep = cr.getEndpoints();
    84113       
     
    91120       
    92121    }
     122   
     123   
     124   
     125   
    93126}
  • SRUAggregator/trunk/web/index.zul

    r2085 r2097  
    2222                        <separator />
    2323                        <label>Language:</label>
    24                         <combobox id="languageSelect" width="150px">
     24                        <combobox id="languageSelect" width="150px">                           
    2525                            <!--<template name="model"> -->
    2626                            <comboitem label="German" />
     
    3434                       
    3535                        <groupbox mold="3d" id="allCorpora">
    36 
     36                        <caption>All Corpora</caption>
    3737                           
    3838                        </groupbox>
Note: See TracChangeset for help on using the changeset viewer.