Changeset 5035


Ignore:
Timestamp:
04/24/14 09:59:28 (10 years ago)
Author:
yana.panchenko@uni-tuebingen.de
Message:

some code refactoring

rename and reorganize classes to prepare for easier change to the specification changes
delete unnecessary classes
add documentation

Location:
SRUAggregator/trunk/src
Files:
1 added
9 deleted
22 edited
1 copied
1 moved

Legend:

Unmodified
Added
Removed
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/app/Aggregator.java

    r4106 r5035  
    1414import org.zkoss.zul.Textbox;
    1515import eu.clarin.sru.fcs.aggregator.sopt.Corpus;
     16import eu.clarin.sru.fcs.aggregator.util.SRUCQL;
    1617import org.zkoss.zul.A;
    17 import org.zkoss.zul.Button;
    1818import org.zkoss.zul.Div;
    1919import org.zkoss.zul.Menubar;
     
    2525
    2626/**
    27  * Main window of the Aggregator application.
     27 * Main component of the Aggregator application.
    2828 *
    2929 * @author Yana Panchenko
     
    7979    private PagesVisibility pagesVisibility;
    8080
    81     private static final String WEBLICHT_URL = "https://weblicht.sfs.uni-tuebingen.de/WebLicht-4/?input=";
     81    private static final String WEBLICHT_URL =
     82            "https://weblicht.sfs.uni-tuebingen.de/WebLicht-4/?input=";
    8283   
    8384   
     
    324325        String[] paramValue;
    325326        String query = null;
    326         paramValue = Executions.getCurrent().getParameterMap().get("query");
     327        paramValue = Executions.getCurrent().getParameterMap().get(SRUCQL.SEARCH_QUERY_PARAMETER);
    327328        if (paramValue != null) {
    328329            query = paramValue[0].trim();
     
    330331        }
    331332        LOGGER.log(Level.INFO, "Received parameter: query[{0}], ", query);
    332         paramValue = Executions.getCurrent().getParameterMap().get("operation");
     333        paramValue = Executions.getCurrent().getParameterMap().get(SRUCQL.OPERATION);
    333334        String operationString = null;
    334335        if (paramValue != null) {
    335336            operationString = paramValue[0].trim();
    336             if (!operationString.equals("searchRetrieve")) {
     337            if (!operationString.equals(SRUCQL.SEARCH_RETRIEVE)) {
    337338                Messagebox.show("Not supported operation " + operationString, "FCS", 0, Messagebox.INFORMATION);
    338339            }
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/app/ControlsVisibility.java

    r3038 r5035  
    22
    33import org.zkoss.zul.A;
    4 import org.zkoss.zul.Button;
    5 import org.zkoss.zul.Label;
    64import org.zkoss.zul.Menubar;
    75import org.zkoss.zul.North;
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/app/SearchOptions.java

    r5034 r5035  
    1919import eu.clarin.sru.fcs.aggregator.sopt.CorpusRendererLive;
    2020import eu.clarin.sru.fcs.aggregator.sopt.Languages;
    21 import eu.clarin.sru.fcs.aggregator.cache.ScanCacheI;
     21import eu.clarin.sru.fcs.aggregator.cache.ScanCache;
     22import eu.clarin.sru.fcs.aggregator.util.SRUCQL;
    2223import java.lang.reflect.Type;
    2324import java.util.ArrayList;
     
    7576   
    7677    private boolean liveMode = false;
    77    
    78     private SRUVersion version = SRUVersion.VERSION_1_2;
    79 
    80     private ScanCacheI cache;
     78
     79    private ScanCache cache;
    8180   
    8281    @Override
    8382    public void doAfterCompose(Component comp) throws Exception {
    8483        super.doAfterCompose(comp);
    85         setUpSRUVersion();
    8684        setUpAggerationContext();
    87         cache = (ScanCacheI) Executions.getCurrent().getDesktop().getWebApp().getAttribute(WebAppListener.CORPUS_CACHE);
     85        cache = (ScanCache) Executions.getCurrent().getDesktop().getWebApp().getAttribute(WebAppListener.CORPUS_CACHE);
    8886        //if (cache.isEmpty()) {
    8987        //    liveMode = true;
     
    111109            DefaultTreeNode<Corpus> node = (DefaultTreeNode<Corpus>) treeitem.getValue();
    112110            Corpus corpus = node.getData();
    113             if (corpus.getLanguages().contains(selectedLang) || selectedLang.equals("anylang")) {
     111            if (corpus.getLanguages().contains(selectedLang) || selectedLang.equals(Languages.ANY_LANGUAGE_NAME)) {
    114112                treeitem.setVisible(true);
    115113            } else {
     
    244242
    245243    private void setUpAggerationContext() {
    246         String[] paramValue = Executions.getCurrent().getParameterMap().get("x-aggregation-context");
     244        String[] paramValue = Executions.getCurrent().getParameterMap().get(SRUCQL.AGGREGATION_CONTEXT);
    247245        String contextJson = null;
    248246        if (paramValue != null) {
    249247            contextJson = paramValue[0].trim();
    250248        }
    251         LOGGER.log(Level.INFO, "Received parameter: x-aggregation-context[{0}], ", contextJson);
     249        LOGGER.log(Level.INFO, "Received parameter {0}:[{1}], ", new String[]{SRUCQL.AGGREGATION_CONTEXT, contextJson});
    252250
    253251        if (contextJson != null) {
     
    259257            } catch (Exception ex) {
    260258                LOGGER.log(Level.SEVERE, "Error parsing JSON from x-aggregation-context: {0} {1}", new String[]{ex.getMessage(), contextJson});
    261                 Messagebox.show("Error in x-aggregation-context parameter", "FCS", 0, Messagebox.INFORMATION);
     259                Messagebox.show("Error in " + SRUCQL.AGGREGATION_CONTEXT, "FCS", 0, Messagebox.INFORMATION);
    262260            }
    263261        }
     
    301299    }
    302300
    303     private void setUpSRUVersion() {
    304         String[] paramValue = Executions.getCurrent().getParameterMap().get("version");
    305         String versionString = null;
    306         if (paramValue != null) {
    307             versionString = paramValue[0].trim();
    308             if (versionString.equals("1.2")) {
    309                 version = SRUVersion.VERSION_1_2;
    310             } else if (versionString.equals("1.1")) {
    311                 version = SRUVersion.VERSION_1_1;
    312             } else {
    313                 Messagebox.show("SRU Version " + version + " not supported", "FCS", 0, Messagebox.INFORMATION);
    314             }
    315         }
    316         LOGGER.log(Level.INFO, "Received parameter: version[{0}], ", versionString);
    317     }
    318301
    319302    private void selectCorpora(Treeitem openItem, Corpus data, List<String> handles) {
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/app/SearchResults.java

    r4106 r5035  
    3434import eu.clarin.sru.fcs.aggregator.sresult.SearchResult;
    3535import eu.clarin.sru.fcs.aggregator.sresult.SearchResultRecordRenderer;
    36 import eu.clarin.sru.fcs.aggregator.util.SRUCQLsearchRetrieve;
     36import eu.clarin.sru.fcs.aggregator.util.SRUCQL;
    3737import eu.clarin.weblicht.wlfxb.io.WLDObjector;
    3838import eu.clarin.weblicht.wlfxb.io.WLFormatException;
     
    5353import java.util.concurrent.Future;
    5454import java.util.concurrent.atomic.AtomicBoolean;
    55 import javax.ws.rs.core.MediaType;
    5655import opennlp.tools.tokenize.TokenizerME;
    5756import opennlp.tools.tokenize.TokenizerModel;
     
    114113        Executions.getCurrent().getDesktop().enableServerPush(true);
    115114        searchClient = (SRUThreadedClient) Executions.getCurrent().getDesktop().getWebApp().getAttribute(WebAppListener.SHARED_SRU_CLIENT);
    116         setUpSRUVersion();
    117115        // assign the search controller to desktop, so that it can be accessed to be shutdown when the desktop is destroyed
    118116        Executions.getCurrent().getDesktop().setAttribute(this.getClass().getSimpleName(), this);
     
    187185        searchRequest.setStartRecord(searchOffset[0] + searchOffset[1]);
    188186        if (resultsItem.hasCorpusHandler()) {
    189             searchRequest.setExtraRequestData(SRUCQLsearchRetrieve.CORPUS_HANDLE_PARAMETER, resultsItem.getCorpus().getHandle());
     187            searchRequest.setExtraRequestData(SRUCQL.SEARCH_CORPUS_HANDLE_PARAMETER, resultsItem.getCorpus().getHandle());
    190188        }
    191189        try {
     
    853851
    854852    private void setUpSRUVersion() {
    855         String[] paramValue = Executions.getCurrent().getParameterMap().get("version");
     853        String[] paramValue = Executions.getCurrent().getParameterMap().get(SRUCQL.VERSION);
    856854        String versionString = null;
    857855        if (paramValue != null) {
     
    865863            }
    866864        }
    867         LOGGER.log(Level.INFO, "Received parameter: version[{0}], ", versionString);
     865        LOGGER.log(Level.INFO, "Received parameter: {0}[{1}], ", new String[]{SRUCQL.VERSION,versionString});
    868866    }
    869867   
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/app/WebAppListener.java

    r5034 r5035  
    11package eu.clarin.sru.fcs.aggregator.app;
    22
    3 import eu.clarin.sru.fcs.aggregator.cache.ScanCrawlerRunnable;
     3import eu.clarin.sru.fcs.aggregator.cache.ScanCrawlTask;
    44import eu.clarin.sru.fcs.aggregator.cache.ScanCrawler;
    55import eu.clarin.sru.fcs.aggregator.cache.ScanCacheFiled;
    6 import eu.clarin.sru.fcs.aggregator.cache.ScanCache;
     6import eu.clarin.sru.fcs.aggregator.cache.SimpleInMemScanCache;
    77import eu.clarin.sru.client.SRUThreadedClient;
    88import eu.clarin.sru.client.fcs.ClarinFCSRecordParser;
     9import eu.clarin.sru.fcs.aggregator.cache.EndpointUrlFilter;
    910import eu.clarin.sru.fcs.aggregator.sopt.CenterRegistryI;
    1011import eu.clarin.sru.fcs.aggregator.sopt.CenterRegistryLive;
    1112import eu.clarin.sru.fcs.aggregator.sopt.Languages;
    12 import eu.clarin.sru.fcs.aggregator.cache.ScanCacheI;
     13import eu.clarin.sru.fcs.aggregator.cache.ScanCache;
    1314import java.io.File;
    1415import java.io.IOException;
     
    9091
    9192    private String getScanDirectory() {
    92         //File aggregatorDir = new File(System.getProperty("user.home"), "/." + AGGREGATOR_DIR_NAME);
    93         File aggregatorDir = new File("/var/www", "/." + AGGREGATOR_DIR_NAME);
     93        File aggregatorDir = new File(System.getProperty("user.home"), "/." + AGGREGATOR_DIR_NAME);
     94        //File aggregatorDir = new File("/var/www", "/." + AGGREGATOR_DIR_NAME);
    9495       
    9596        if (!aggregatorDir.exists()) {
     
    110111        CenterRegistryI centerRegistry = new CenterRegistryLive();
    111112        SRUThreadedClient sruScanClient = (SRUThreadedClient) webapp.getAttribute(WebAppListener.SHARED_SRU_CLIENT);
    112         //EndpointUrlFilter filter = new EndpointUrlFilter();
     113        EndpointUrlFilter filter = new EndpointUrlFilter();
    113114        //filter.urlShouldContainAnyOf("leipzig", ".mpi.nl");
    114115        //filter.urlShouldContainAnyOf("uni-tuebingen.de", ".mpi.nl");
    115         //filter.urlShouldContainAnyOf("dspin.dwds.de", "lindat.");
    116         //ScanCrawler scanCrawler = new ScanCrawler(centerRegistry, sruScanClient, filter, maxDepth);
    117         ScanCrawler scanCrawler = new ScanCrawler(centerRegistry, sruScanClient, null, CACHE_MAX_DEPTH);
    118         ScanCacheI scanCache;
     116        filter.urlShouldContainAnyOf("dspin.dwds.de", "lindat.");
     117        ScanCrawler scanCrawler = new ScanCrawler(centerRegistry, sruScanClient, filter, CACHE_MAX_DEPTH);
     118        //ScanCrawler scanCrawler = new ScanCrawler(centerRegistry, sruScanClient, null, CACHE_MAX_DEPTH);
     119        ScanCache scanCache;
    119120
    120121        //synchronized (scanCrawler) {
     
    125126            } catch (Exception e) {
    126127                LOGGER.log(Level.SEVERE, "Error while reading the scan cache!", e);
    127                 scanCache = new ScanCache();
     128                scanCache = new SimpleInMemScanCache();
    128129            }
    129130        //}
     
    132133
    133134        scheduler.scheduleAtFixedRate(
    134                 new ScanCrawlerRunnable(scanCrawler, scanCacheFiled, webapp),
     135                new ScanCrawlTask(scanCrawler, scanCacheFiled, webapp),
    135136                0, CACHE_UPDATE_INTERVAL, CACHE_UPDATE_INTERVAL_UNIT);
    136137
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/cache/EndpointFilter.java

    r5034 r5035  
    44
    55/**
    6  *
     6 * Filter for the cache of scan data (endpoint/resources descriptions) - for
     7 * specifying if only particular endpoints have not to be cached. Useful for
     8 * testing the endpoints.
     9 *
    710 * @author yanapanchenko
    811 */
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/cache/EndpointUrlFilter.java

    r5034 r5035  
    66
    77/**
    8  *
     8 * Filters for the cache of scan data (endpoint/resources descriptions) based
     9 * on endpoint url. Only endpoints containing one of the specified string in the
     10 * endpoint url will be cached. Useful for testing the endpoints.
     11 *
    912 * @author yanapanchenko
    1013 */
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/cache/ScanCache.java

    r5034 r5035  
    22
    33import eu.clarin.sru.fcs.aggregator.sopt.Corpus;
    4 import eu.clarin.sru.fcs.aggregator.sopt.InstitutionI;
    5 import eu.clarin.sru.fcs.aggregator.cache.ScanCacheI;
    6 import java.util.ArrayList;
    7 import java.util.HashMap;
    8 import java.util.HashSet;
    9 import java.util.LinkedHashMap;
     4import eu.clarin.sru.fcs.aggregator.sopt.Institution;
    105import java.util.List;
    116import java.util.Map;
    127import java.util.Set;
    13 import java.util.logging.Logger;
    148
    159/**
     10 * Interface for the cached scan data (endpoints descriptions).
    1611 *
    17  * @author yanapanchenko
     12 * @author Yana Panchenko
    1813 */
    19 public class ScanCache implements ScanCacheI {
     14public interface ScanCache {
    2015
    21     private Map<String, List<Corpus>> enpUrlToRootCorpora = new LinkedHashMap<String, List<Corpus>>(30);
    22     private Map<String, List<Corpus>> corpusToChildren = new HashMap<String, List<Corpus>>();
    23     private Map<String, String> childToParent = new HashMap<String, String>();
    24     private Map<String, Set<Corpus>> langToRootCorpora = new HashMap<String, Set<Corpus>>();
    25     private Map<String, Set<Corpus>> langToTopUniqueCorpora = new HashMap<String, Set<Corpus>>();
    26     private List<InstitutionI> institutions = new ArrayList<InstitutionI>();
     16    /**
     17     * Checks whether the Cache has the endpoints resource tree cached.
     18     * @return true if the Cache is empty, false otherwise
     19     */
     20    public boolean isEmpty();
     21   
     22   
     23    /**
     24     * Gets all the institutions registered in center repository
     25     * as having a SRU/CQL endpoint
     26     * @return list of institutions that support SRU/CQL
     27     */
     28    public List<Institution> getInstitutions();
    2729
    28     private static final Logger LOGGER = Logger.getLogger(ScanCache.class.getName());
     30    /**
     31     * Gets all the root corpora of the endpoints (top nodes in the corpus
     32     * resource tree)
     33     * @return root corpora of the endpoints
     34     */
     35    public List<Corpus> getRootCorpora();
     36
    2937   
     38     /**
     39     * Gets languages mapped to all the root corpora of the endpoints
     40     * (top nodes in the corpus resource tree) that have the corresponding language
     41     * @return a map from the languages to the root corpora of the endpoints
     42     * in the corresponding language
     43     */
     44    public Map<String, Set<Corpus>> getRootCorporaForLang();
     45   
     46    /**
     47     * Gets all the root corpora of the endpoints (top nodes in the corpus
     48     * resource tree) that have the specified language
     49     * @param lang language of interest as a three-letter iso code
     50     * @return root corpora of the endpoints that are in the specified language
     51     */
     52    public List<Corpus> getRootCorporaForLang(String lang);
     53   
     54    /**
     55     * In the corpus resource tree, gets all the languages mapped to the corpus
     56     * resources that have the corresponding language as the only one language,
     57     * and either have no parent resource or its parent has multiple languages.
     58     * @return map of languages to top corpora (in the corpus resource tree)
     59     * that have the corresponding language as the only language
     60     */
     61    public Map<String, Set<Corpus>> getTopUniqueLangToCorpora();
     62   
     63    /**
     64     * In the corpus resource tree, gets all the resource nodes of the tree
     65     * that have the specified language as the only language of the resource,
     66     * and either have no parent resource or its parent resource has multiple
     67     * languages.
     68     * @param lang language of interest as three-letter iso code
     69     * @return corpora that have the specified language as the only language
     70     * and whose parent corpora do not have it as the only language
     71     */
     72    public List<Corpus> getTopUniqueLanguageCorpora(String lang);
     73   
     74    /**
     75     * Gets all the root corpora of the specified endpoints
     76     * @param enpointUrl the URL of the endpoint of interest
     77     * @return root corpora of the endpoint
     78     */
     79    public List<Corpus> getRootCorporaOfEndpoint(String enpointUrl);
     80   
     81    /**
     82     * Gets all the languages of the existing corpora in the corpus resource
     83     * tree (since parent corpora sum-up languages of their children corpora,
     84     * that's all the languages of the root corpora)
     85     * @return all the languages specified in the corpus resource tree
     86     */
     87    public Set<String> getLanguages();
    3088
    31     public List<InstitutionI> getInstitutions() {
    32         return institutions;
    33     }
     89    /**
     90     * Gets all children corpora of the specified corpus in the endpoints
     91     * resource tree
     92     * @param corpus the parent corpus
     93     * @return children corpora of the specified parent corpus
     94     */
     95    public List<Corpus> getChildren(Corpus corpus);
     96   
     97   
     98    /**
     99     * Adds institution that supports SRU/CQL into the cache.
     100     *
     101     * @param institution that supports SRU/CQL
     102     */
     103    public void addInstitution(Institution institution);
     104   
     105    /**
     106     * Adds corpus that is the top level resource of an endpoint
     107     * (root corpus that has no parent corpus) into the cache.
     108     * Same as addCorpus(c, null)
     109     *
     110     * @param c root corpus to be added
     111     */
     112    public void addCorpus(Corpus c);
    34113
    35     @Override
    36     public List<Corpus> getRootCorporaOfEndpoint(String enpointUrl) {
    37         List<Corpus> roots = new ArrayList<Corpus>();
    38         if (enpUrlToRootCorpora.containsKey(enpointUrl)) {
    39             roots.addAll(enpUrlToRootCorpora.get(enpointUrl));
    40         }
    41         return roots;
    42     }
     114   
     115    /**
     116     * Adds corpus into the cache.
     117     *
     118     * @param c corpus to be added
     119     * @param parentCorpus parent of the corpus to be added
     120     */
     121    public void addCorpus(Corpus c, Corpus parentCorpus);
    43122
    44     public List<Corpus> getChildrenCorpora(String handle) {
    45         List<Corpus> children = new ArrayList<Corpus>();
    46         if (corpusToChildren.containsKey(handle)) {
    47             children.addAll(corpusToChildren.get(handle));
    48         }
    49         return children;
    50     }
    51 
    52     public void addInstitution(InstitutionI institution) {
    53         institutions.add(institution);
    54     }
    55 
    56     public void addCorpus(Corpus c) {
    57         addCorpus(c, true, null);
    58     }
    59 
    60     public void addCorpus(Corpus c, Corpus parentCorpus) {
    61         addCorpus(c, false, parentCorpus);
    62     }
    63 
    64     public void addCorpus(Corpus c, boolean root, Corpus parentCorpus) {
    65 
    66         // index top corpora with unique language as for their languages
    67         //if (c.getLanguages().size() == 1 &&
    68         //        (root || this.))
    69        
    70        
    71         // don't add corpus that introduces cyclic references
    72         if (this.childToParent.containsKey(c.getHandle())) {
    73             // as of March 2014, there are 2 such endpoints...
    74             LOGGER.warning("Cyclic reference in corpus " + c.getHandle() + " of endpoint " + c.getEndpointUrl());
    75             return;
    76         }
    77        
    78 
    79         if (root) {
    80             // index root corpora as for their languages
    81             for (String lang : c.getLanguages()) {
    82                 if (!langToRootCorpora.containsKey(lang)) {
    83                     langToRootCorpora.put(lang, new HashSet<Corpus>());
    84                 }
    85                 langToRootCorpora.get(lang).add(c);
    86             }
    87             // index root corpora as for their endpint url
    88             if (!enpUrlToRootCorpora.containsKey(c.getEndpointUrl())) {
    89                 enpUrlToRootCorpora.put(c.getEndpointUrl(), new ArrayList<Corpus>());
    90             }
    91             enpUrlToRootCorpora.get(c.getEndpointUrl()).add(c);
    92             childToParent.put(c.getHandle(), Corpus.ROOT_HANDLE);
    93         } else {
    94             if (!corpusToChildren.containsKey(parentCorpus.getHandle())) {
    95                 corpusToChildren.put(parentCorpus.getHandle(), new ArrayList<Corpus>());
    96             }
    97             corpusToChildren.get(parentCorpus.getHandle()).add(c);
    98             childToParent.put(c.getHandle(), parentCorpus.getHandle());
    99         }
    100     }
    101 
    102     @Override
    103     public String toString() {
    104         return "cache{\n" + "institutions=" + institutions + "\n"
    105                 + "enpUrlToRootCorpora=" + enpUrlToRootCorpora
    106                 + "\n corpusToChildren=" + corpusToChildren
    107                 + "\n langToTopUniqueCorpora=" + langToTopUniqueCorpora + "\n}";
    108     }
    109 
    110     @Override
    111     public boolean isEmpty() {
    112         return enpUrlToRootCorpora.isEmpty();
    113     }
    114 
    115     @Override
    116     public List<Corpus> getRootCorpora() {
    117         List<Corpus> rootCorpora = new ArrayList<Corpus>(enpUrlToRootCorpora.size());
    118         for (List<Corpus> corpora : this.enpUrlToRootCorpora.values()) {
    119             rootCorpora.addAll(corpora);
    120         }
    121         return rootCorpora;
    122     }
    123 
    124     @Override
    125     public Set<String> getLanguages() {
    126         Set<String> languages = new HashSet<String>(this.langToRootCorpora.size());
    127         languages.addAll(this.langToRootCorpora.keySet());
    128         return languages;
    129     }
    130 
    131     @Override
    132     public List<Corpus> getChildren(Corpus corpus) {
    133         List<Corpus> corpora = this.corpusToChildren.get(corpus.getHandle());
    134         if (corpora == null) {
    135             return (new ArrayList<Corpus>());
    136         } else {
    137             List<Corpus> corporaCopy = new ArrayList<Corpus>(corpora);
    138             return corporaCopy;
    139         }
    140     }
    141 
    142     @Override
    143     public Map<String, Set<Corpus>> getRootCorporaForLang() {
    144         return langToRootCorpora;
    145     }
    146 
    147     @Override
    148     public List<Corpus> getRootCorporaForLang(String lang) {
    149         List<Corpus> rootCorpora = new ArrayList<Corpus>(enpUrlToRootCorpora.size());
    150         for (List<Corpus> corpora : this.enpUrlToRootCorpora.values()) {
    151             for (Corpus corpus : corpora) {
    152                 if (corpus.getLanguages().contains(lang)) {
    153                     rootCorpora.add(corpus);
    154                 }
    155             }
    156         }
    157         return rootCorpora;
    158     }
    159 
    160     @Override
    161     public Map<String, Set<Corpus>> getTopUniqueLangToCorpora() {
    162         throw new UnsupportedOperationException("Not supported yet.");
    163     }
    164 
    165     @Override
    166     public List<Corpus> getTopUniqueLanguageCorpora(String lang) {
    167         throw new UnsupportedOperationException("Not supported yet.");
    168     }
     123   
     124    /**
     125     * Gets Corpus that corresponds to the specified handle.
     126     *
     127     * @param handle of the Corpus of interest.
     128     * @return Corpus of the handle or null if there is no Corpus with
     129     * this handle in the cache.
     130     */
     131    public Corpus getCorpus(String handle);
     132   
    169133}
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/cache/ScanCacheFiled.java

    r5034 r5035  
    11package eu.clarin.sru.fcs.aggregator.cache;
    22
    3 import eu.clarin.sru.fcs.aggregator.app.CacheCorporaScanIntoFileTask;
    4 import eu.clarin.sru.fcs.aggregator.cache.ScanCache;
    53import eu.clarin.sru.fcs.aggregator.sopt.Corpus;
    64import eu.clarin.sru.fcs.aggregator.sopt.Endpoint;
    75import eu.clarin.sru.fcs.aggregator.sopt.Institution;
    8 import eu.clarin.sru.fcs.aggregator.sopt.InstitutionI;
    96import java.io.BufferedOutputStream;
    107import java.io.BufferedReader;
     
    2320
    2421/**
     22 * Utility for reading/writing scan data (endpoints descriptions) from/to
     23 * ScanCache from/to local files.
    2524 *
    2625 * @author yanapanchenko
     
    3938    private static final Logger LOGGER = Logger.getLogger(ScanCacheFiled.class.getName());
    4039
     40    /**
     41     * Constructs ScanCache/files reading/writing utility.
     42     *
     43     * @param scanDirectory path to local directory were files with
     44     * ScanCache data are/should be stored.
     45     */
    4146    public ScanCacheFiled(String scanDirectory) {
    4247        this.scanDirectory = scanDirectory;
    4348    }
    4449
     50    /**
     51     * Writes ScanCache data (endpoints and resources descriptions) in a special
     52     * simple plain text format into the files.
     53     *
     54     * @param cache ScanCache the data of which should be written into the files.
     55     */
    4556    public void write(ScanCache cache) {
    4657
     
    5162            File sruInstitutionsFile = new File(scanDirectory, INSTITUTION_ENDPOINTS_FILENAME);
    5263            os = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(sruInstitutionsFile)), ENCODING);
    53             for (InstitutionI institution : cache.getInstitutions()) {
     64            for (Institution institution : cache.getInstitutions()) {
    5465                writeInstitutionInfo(os, institution);
    5566                for (Endpoint endp : institution.getEndpoints()) {
     
    95106            writeCorpusInfo(os, c);
    96107
    97             List<Corpus> children = cache.getChildrenCorpora(c.getHandle());
     108            List<Corpus> children = cache.getChildren(c);
    98109            if (children != null) {
    99110                for (Corpus child : children) {
     
    121132    }
    122133
    123     private void writeInstitutionInfo(Writer writer, InstitutionI institution) throws IOException {
     134    private void writeInstitutionInfo(Writer writer, Institution institution) throws IOException {
    124135
    125136        writer.write(I);
     
    182193    }
    183194
     195    /**
     196     * Reads ScanCache data from the files in scanDirectory directory. The files
     197     * contain endpoint and resources descriptions in a special simple plain
     198     * text format, resulting from applying write(ScanCache scanCache) method.
     199     *
     200     * @return ScanCache with the data read from the files containing endpoints
     201     * and resources descriptions.
     202     */
    184203    public ScanCache read() {
    185         ScanCache cache = new ScanCache();
     204        SimpleInMemScanCache cache = new SimpleInMemScanCache();
    186205        File sruInstitutionsFile = new File(scanDirectory, INSTITUTION_ENDPOINTS_FILENAME);
    187206        BufferedReader reader = null;
     
    194213                line = line.trim();
    195214                if (line.length() > 0) {
    196                     String[] splitted = line.split("\\" + CacheCorporaScanIntoFileTask.SEP);
    197                     if (splitted.length == 2 && splitted[0].equals(CacheCorporaScanIntoFileTask.I)) {
     215                    String[] splitted = line.split("\\" + SEP);
     216                    if (splitted.length == 2 && splitted[0].equals(I)) {
    198217                        inst = new Institution(splitted[1], "");
    199218                        if (!institutions.contains(inst)) {
     
    201220                            cache.addInstitution(inst);
    202221                        }
    203                     } else if (inst != null && splitted.length == 3 && splitted[0].equals(CacheCorporaScanIntoFileTask.IE)) {
     222                    } else if (inst != null && splitted.length == 3 && splitted[0].equals(IE)) {
    204223                        Endpoint ep = inst.add(splitted[2]);
    205224                        if (!splitted[1].trim().isEmpty()) {
     
    229248    }
    230249
    231     private void readAndAddCorpus(String path, Corpus parentCorpus, InstitutionI inst, ScanCache cache) {
     250    private void readAndAddCorpus(String path, Corpus parentCorpus, Institution inst, SimpleInMemScanCache cache) {
    232251        File corpusFile = new File(path, CORPUS_INFO_FILENAME);
    233252        BufferedReader reader = null;
     
    258277                        // corpus langs
    259278                        Set<String> langs = new HashSet<String>();
    260                         for (String lang : line.split("\\" + CacheCorporaScanIntoFileTask.SEP)) {
     279                        for (String lang : line.split("\\" + SEP)) {
    261280                            langs.add(lang);
    262281                        }
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/cache/ScanCrawlTask.java

    r5034 r5035  
    11package eu.clarin.sru.fcs.aggregator.cache;
    22
    3 import eu.clarin.sru.fcs.aggregator.cache.ScanCrawler;
    4 import eu.clarin.sru.fcs.aggregator.cache.ScanCacheFiled;
    5 import eu.clarin.sru.fcs.aggregator.cache.ScanCache;
    63import static eu.clarin.sru.fcs.aggregator.app.WebAppListener.CORPUS_CACHE;
    74import java.util.logging.Level;
     
    107
    118/**
    12  *
     9 * A task for crawling endpoint scan operation responses of FCS specification.
     10 * If successful, saves found endpoints and resources descriptions into a new
     11 * ScanCache and updates the web application contexts with this new cache, as
     12 * well as rewrites the previously scanned data saved on the disk.
     13 *
    1314 * @author yanapanchenko
    1415 */
    15 public class ScanCrawlerRunnable implements Runnable {
     16public class ScanCrawlTask implements Runnable {
    1617   
    17     private static final Logger logger = Logger.getLogger(ScanCrawlerRunnable.class.getName());
     18    private static final Logger logger = Logger.getLogger(ScanCrawlTask.class.getName());
    1819   
    1920    private final ScanCrawler scanCrawler;
     
    2122    private WebApp webapp;
    2223
    23     public ScanCrawlerRunnable(
     24    public ScanCrawlTask(
    2425            ScanCrawler scanCrawler, ScanCacheFiled scanCacheFiled, WebApp webapp) {
    2526        this.scanCrawler = scanCrawler;
     
    3233       
    3334        logger.info("STARTING CACHING CORPORA SCAN");
    34         ScanCache cacheNew = scanCrawler.crawl();
     35        SimpleInMemScanCache cacheNew = new SimpleInMemScanCache();
     36        scanCrawler.crawl(cacheNew);
    3537        logger.info("New Cache, number of root corpora: " + cacheNew.getRootCorpora().size());
    3638       
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/cache/ScanCrawler.java

    r5034 r5035  
    11package eu.clarin.sru.fcs.aggregator.cache;
    22
    3 import eu.clarin.sru.fcs.aggregator.cache.ScanCache;
    43import eu.clarin.sru.client.SRUScanRequest;
    54import eu.clarin.sru.client.SRUScanResponse;
     
    98import eu.clarin.sru.fcs.aggregator.sopt.Corpus;
    109import eu.clarin.sru.fcs.aggregator.sopt.Endpoint;
    11 import eu.clarin.sru.fcs.aggregator.sopt.InstitutionI;
    12 import eu.clarin.sru.fcs.aggregator.util.SRUCQLscan;
     10import eu.clarin.sru.fcs.aggregator.sopt.Institution;
     11import eu.clarin.sru.fcs.aggregator.util.SRUCQL;
    1312import java.util.List;
    1413import java.util.concurrent.Future;
     
    2322
    2423/**
    25  *
     24 * Crawler for collecting endpoint scan operation responses of FCS specification.
     25 * Collects all the endpoints and resources descriptions.
     26 *
    2627 * @author yanapanchenko
    2728 */
     
    4546    }
    4647
    47     public ScanCache crawl() {
    48 
    49         ScanCache cache = new ScanCache();
     48    /**
     49     * Crawler of scan operation of FCS specification. Collects all the endpoints
     50     * and resources descriptions into the provided cache.
     51     *
     52     * @param cache cache into which the endpoints and resources descriptions
     53     * from scan operation responses should be collected.
     54     */
     55    public void crawl(ScanCache cache) {
    5056
    5157        //TODO remember not responding root corpora and come back to them later... ?
    52         List<InstitutionI> institutions = cr.getCQLInstitutions();
     58        List<Institution> institutions = cr.getCQLInstitutions();
    5359        //LOGGER.info(institutions.toString());
    54         for (InstitutionI institution : institutions) {
     60        for (Institution institution : institutions) {
    5561            cache.addInstitution(institution);
    5662            Iterable<Endpoint> endpoints = institution.getEndpoints();
     
    6470        }
    6571
    66         return cache;
    67 
    6872    }
    6973
     74    // TODO: ask Oliver to add API support for the extra info in the
     75    // SRU client/server libraries, so that it's not necessary to work
     76    // with DocumentFragment
    7077    private void addExtraInfo(Corpus c, SRUTerm term) {
    7178
     
    111118
    112119    private void addCorpora(SRUThreadedClient sruScanClient, String endpointUrl,
    113             InstitutionI institution, int depth, Corpus parentCorpus, ScanCache cache) {
    114         //System.out.println("Adding Corpora: " + endpointUrl + " " + handle);
    115 
     120            Institution institution, int depth, Corpus parentCorpus, ScanCache cache) {
     121       
    116122        Future<SRUScanResponse> corporaResponse = null;
    117123
     
    127133
    128134            SRUScanRequest corporaRequest = new SRUScanRequest(endpointUrl);
    129             StringBuilder scanClause = new StringBuilder(SRUCQLscan.RESOURCE_PARAMETER);
     135            StringBuilder scanClause = new StringBuilder(SRUCQL.SCAN_RESOURCE_PARAMETER);
    130136            scanClause.append("=");
    131             //String normalizedHandle = normalizeHandle(handle, root);
    132137            String normalizedHandle = normalizeHandle(parentCorpus, root);
    133138            scanClause.append(normalizedHandle);
    134139            corporaRequest.setScanClause(scanClause.toString());
    135             corporaRequest.setExtraRequestData(SRUCQLscan.RESOURCE_INFO_PARAMETER, "true");
     140            corporaRequest.setExtraRequestData(SRUCQL.SCAN_RESOURCE_INFO_PARAMETER,
     141                    SRUCQL.SCAN_RESOURCE_INFO_PARAMETER_DEFAULT_VALUE);
    136142            corporaResponse = sruScanClient.scan(corporaRequest);
    137143            Thread.sleep(5000);
     
    139145            if (response != null && response.hasTerms()) {
    140146                for (SRUTerm term : response.getTerms()) {
     147                    // don't add corpus that introduces cyclic references
     148                    // as of March 2014, there are 2 such endpoints...
     149                    if (cache.getCorpus(term.getValue())!= null) {
     150                        LOGGER.warning("Cyclic reference in corpus " + term.getValue() + " of endpoint " + endpointUrl);
     151                        continue;
     152                    }
    141153                    Corpus c = new Corpus(institution, endpointUrl);
    142154                    c.setHandle(term.getValue());
     
    144156                    c.setNumberOfRecords(term.getNumberOfRecords());
    145157                    addExtraInfo(c, term);
    146                     cache.addCorpus(c, root, parentCorpus);
     158                    cache.addCorpus(c, parentCorpus);
    147159                    addCorpora(sruScanClient, c.getEndpointUrl(), c.getInstitution(),
    148160                            depth, c, cache);
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/cache/SimpleInMemScanCache.java

    r5034 r5035  
    22
    33import eu.clarin.sru.fcs.aggregator.sopt.Corpus;
    4 import eu.clarin.sru.fcs.aggregator.sopt.InstitutionI;
    5 import eu.clarin.sru.fcs.aggregator.cache.ScanCacheI;
     4import eu.clarin.sru.fcs.aggregator.sopt.Institution;
    65import java.util.ArrayList;
    76import java.util.HashMap;
     
    1413
    1514/**
     15 * Implementation of the cached scan data (endpoints descriptions) that
     16 * stores the cache in memory in maps.
    1617 *
    1718 * @author yanapanchenko
    1819 */
    19 public class ScanCache implements ScanCacheI {
     20public class SimpleInMemScanCache implements ScanCache {
    2021
    2122    private Map<String, List<Corpus>> enpUrlToRootCorpora = new LinkedHashMap<String, List<Corpus>>(30);
    2223    private Map<String, List<Corpus>> corpusToChildren = new HashMap<String, List<Corpus>>();
    23     private Map<String, String> childToParent = new HashMap<String, String>();
     24    //private Map<String, String> childToParent = new HashMap<String, String>();
     25    private Map<String, Corpus> handleToCorpus = new HashMap<String, Corpus>();
    2426    private Map<String, Set<Corpus>> langToRootCorpora = new HashMap<String, Set<Corpus>>();
    2527    private Map<String, Set<Corpus>> langToTopUniqueCorpora = new HashMap<String, Set<Corpus>>();
    26     private List<InstitutionI> institutions = new ArrayList<InstitutionI>();
     28    private List<Institution> institutions = new ArrayList<Institution>();
    2729
    28     private static final Logger LOGGER = Logger.getLogger(ScanCache.class.getName());
     30    private static final Logger LOGGER = Logger.getLogger(SimpleInMemScanCache.class.getName());
    2931   
    30 
    31     public List<InstitutionI> getInstitutions() {
     32    @Override
     33    public List<Institution> getInstitutions() {
    3234        return institutions;
    3335    }
     
    4244    }
    4345
    44     public List<Corpus> getChildrenCorpora(String handle) {
    45         List<Corpus> children = new ArrayList<Corpus>();
    46         if (corpusToChildren.containsKey(handle)) {
    47             children.addAll(corpusToChildren.get(handle));
    48         }
    49         return children;
    50     }
    51 
    52     public void addInstitution(InstitutionI institution) {
     46    @Override
     47    public void addInstitution(Institution institution) {
    5348        institutions.add(institution);
    5449    }
    5550
     51    @Override
    5652    public void addCorpus(Corpus c) {
    57         addCorpus(c, true, null);
     53        addCorpus(c, null);
    5854    }
    5955
     56    @Override
    6057    public void addCorpus(Corpus c, Corpus parentCorpus) {
    61         addCorpus(c, false, parentCorpus);
    62     }
    63 
    64     public void addCorpus(Corpus c, boolean root, Corpus parentCorpus) {
    6558
    6659        // index top corpora with unique language as for their languages
    6760        //if (c.getLanguages().size() == 1 &&
    6861        //        (root || this.))
    69        
    70        
    71         // don't add corpus that introduces cyclic references
    72         if (this.childToParent.containsKey(c.getHandle())) {
    73             // as of March 2014, there are 2 such endpoints...
    74             LOGGER.warning("Cyclic reference in corpus " + c.getHandle() + " of endpoint " + c.getEndpointUrl());
    75             return;
    76         }
    77        
    7862
    79         if (root) {
     63        handleToCorpus.put(c.getHandle(), c);
     64
     65        if (parentCorpus == null) { //i.e it's a root corpus
    8066            // index root corpora as for their languages
    8167            for (String lang : c.getLanguages()) {
     
    9076            }
    9177            enpUrlToRootCorpora.get(c.getEndpointUrl()).add(c);
    92             childToParent.put(c.getHandle(), Corpus.ROOT_HANDLE);
     78            //childToParent.put(c.getHandle(), Corpus.ROOT_HANDLE);
    9379        } else {
    9480            if (!corpusToChildren.containsKey(parentCorpus.getHandle())) {
     
    9682            }
    9783            corpusToChildren.get(parentCorpus.getHandle()).add(c);
    98             childToParent.put(c.getHandle(), parentCorpus.getHandle());
     84            //childToParent.put(c.getHandle(), parentCorpus.getHandle());
    9985        }
    10086    }
     
    167153        throw new UnsupportedOperationException("Not supported yet.");
    168154    }
     155
     156    @Override
     157    public Corpus getCorpus(String handle) {
     158        return this.handleToCorpus.get(handle);
     159    }
    169160}
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/rest/AggregatorService.java

    r5034 r5035  
    77
    88/**
    9  *
     9 * RESTful service. At the moment does nothing useful and was added just to
     10 * make sure that it would be possible to combine REST services with ZK app,
     11 * and add to the aggregator the support for its usage as aggregated FCS
     12 * server, as was planned in the initial FCS specification.
     13 *
    1014 * @author yanapanchenko
    1115 */
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/sopt/CenterRegistryForTesting.java

    r3044 r5035  
    77
    88/**
    9  * Center registry node. Its children are centers (institutions).
     9 * Center registry node. Its children are centers (institutions).
     10 * The class is created after a request from MPI to provide them
     11 * with a possibility to test their endpoints on development
     12 * servers with the aggregator before they put them on production
     13 * server. Institutions and endpoint urls that need to be tested are hard-coded.
    1014 *
    1115 * @author Yana Panchenko
     
    1519    private static final Logger logger = Logger.getLogger(CenterRegistryForTesting.class.getName());
    1620    private boolean hasChildrenLoaded = false;
    17     private List<InstitutionI> centers = new ArrayList<InstitutionI>();
     21    private List<Institution> centers = new ArrayList<Institution>();
    1822    private static final String[] INSTITUTION_URLS = new String[]{
    1923        "http://130.183.206.32/restxml/5"
     
    4448
    4549    @Override
    46     public List<InstitutionI> getCQLInstitutions() {
     50    public List<Institution> getCQLInstitutions() {
    4751        loadCQLInstitutions();
    4852        return centers;
     
    5054
    5155    @Override
    52     public InstitutionI getCQLInstitution(int index) {
     56    public Institution getCQLInstitution(int index) {
    5357        loadCQLInstitutions();
    5458        if (index >= centers.size()) {
     
    6064    private void loadCQLInstitutionsForTesting() {
    6165        for (int i = 0; i < INSTITUTION_ENDPOINTS.length; i++) {
    62             InstitutionI institution = new Institution(INSTITUTION_NAMES[i], INSTITUTION_URLS[i]);
     66            Institution institution = new Institution(INSTITUTION_NAMES[i], INSTITUTION_URLS[i]);
    6367            for (int j = 0; j < INSTITUTION_ENDPOINTS.length; j++) {
    6468                institution.add(INSTITUTION_ENDPOINTS[i][j]);
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/sopt/CenterRegistryI.java

    r3044 r5035  
    1616    public void loadCQLInstitutions();
    1717       
    18     public List<InstitutionI> getCQLInstitutions();
     18    public List<Institution> getCQLInstitutions();
    1919
    20     public InstitutionI getCQLInstitution(int index);
     20    public Institution getCQLInstitution(int index);
    2121
    2222}
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/sopt/CenterRegistryLive.java

    r3044 r5035  
    2525    //https://centerregistry-clarin.esc.rzg.mpg.de/restxml/
    2626    private boolean hasInstitutionsLoaded = false;
    27     private List<InstitutionI> centers = new ArrayList<InstitutionI>();
     27    private List<Institution> centers = new ArrayList<Institution>();
    2828
    2929    @Override
     
    4646                String institutionUrl = regCenter.getId();
    4747                String institutionName = regCenter.getCenterName();
    48                 InstitutionI institution = new Institution(institutionName, institutionUrl);
     48                Institution institution = new Institution(institutionName, institutionUrl);
    4949                // display in the tree only those institutions that have CQL endpoints:
    5050                CenterProfile profile = connector.retrieveCenterProfile(regCenter);
     
    7777
    7878    @Override
    79     public List<InstitutionI> getCQLInstitutions() {
     79    public List<Institution> getCQLInstitutions() {
    8080        loadCQLInstitutions();
    8181        return centers;
     
    8383
    8484    @Override
    85     public InstitutionI getCQLInstitution(int index) {
     85    public Institution getCQLInstitution(int index) {
    8686        loadCQLInstitutions();
    8787        if (index >= centers.size()) {
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/sopt/Corpus.java

    r3058 r5035  
    1313    public static final String ROOT_HANDLE = "root";
    1414    public static final Pattern HANDLE_WITH_SPECIAL_CHARS = Pattern.compile(".*[<>=/()\\s].*");
    15     private InstitutionI institution;
     15    private Institution institution;
    1616    private String endpointUrl;
    1717    private String handle;
     
    2828    }
    2929
    30     public Corpus(InstitutionI institution, String endpointUrl) {
     30    public Corpus(Institution institution, String endpointUrl) {
    3131        this.institution = institution;
    3232        this.endpointUrl = endpointUrl;
     
    6565    }
    6666
    67     public InstitutionI getInstitution() {
     67    public Institution getInstitution() {
    6868        return institution;
    6969    }
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/sopt/CorpusModelCached.java

    r5034 r5035  
    11package eu.clarin.sru.fcs.aggregator.sopt;
    22
    3 import eu.clarin.sru.fcs.aggregator.cache.ScanCacheI;
     3import eu.clarin.sru.fcs.aggregator.cache.ScanCache;
    44import java.util.ArrayList;
    55import java.util.Arrays;
     
    2222    private static final Logger logger = Logger.getLogger(CorpusModelCached.class.getName());
    2323    private Map<String, Set<Corpus>> selectedCorpora = new HashMap<String, Set<Corpus>>();
    24     private ScanCacheI cache;
     24    private ScanCache cache;
    2525
    26     public CorpusModelCached(ScanCacheI cache) {
     26    public CorpusModelCached(ScanCache cache) {
    2727        super(new DefaultTreeNode(new Corpus(), new ArrayList<DefaultTreeNode<Corpus>>()));
    2828        this.cache = cache;
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/sopt/CorpusModelLive.java

    r3058 r5035  
    88import eu.clarin.sru.fcs.aggregator.app.WebAppListener;
    99import static eu.clarin.sru.fcs.aggregator.sopt.Corpus.ROOT_HANDLE;
    10 import eu.clarin.sru.fcs.aggregator.util.SRUCQLscan;
     10import eu.clarin.sru.fcs.aggregator.util.SRUCQL;
    1111import java.util.ArrayList;
    1212import java.util.Arrays;
     
    186186
    187187    private void initRootChildren(CenterRegistryI startingPoint) {
    188         for (InstitutionI instit : startingPoint.getCQLInstitutions()) {
     188        for (Institution instit : startingPoint.getCQLInstitutions()) {
    189189            for (Endpoint endp : instit.getEndpoints()) {
    190190                try {
     
    199199                    Future<SRUScanResponse> corporaResponse = null;
    200200                    SRUScanRequest corporaRequest = new SRUScanRequest(endp.getUrl());
    201                     StringBuilder scanClause = new StringBuilder(SRUCQLscan.RESOURCE_PARAMETER);
     201                    StringBuilder scanClause = new StringBuilder(SRUCQL.SCAN_RESOURCE_PARAMETER);
    202202                    scanClause.append("=");
    203203                    scanClause.append(ROOT_HANDLE);
    204204                    corporaRequest.setScanClause(scanClause.toString());
    205                     corporaRequest.setExtraRequestData(SRUCQLscan.RESOURCE_INFO_PARAMETER, "true");
     205                    corporaRequest.setExtraRequestData(SRUCQL.SCAN_RESOURCE_INFO_PARAMETER, "true");
    206206                    corporaResponse = sruClient.scan(corporaRequest);
    207207                    SRUScanResponse response = corporaResponse.get(200, TimeUnit.SECONDS);
     
    244244        try {
    245245            SRUScanRequest corporaRequest = new SRUScanRequest(corpus.getEndpointUrl());
    246             StringBuilder scanClause = new StringBuilder(SRUCQLscan.RESOURCE_PARAMETER);
     246            StringBuilder scanClause = new StringBuilder(SRUCQL.SCAN_RESOURCE_PARAMETER);
    247247            scanClause.append("=");
    248248            String resourceValue = corpus.getHandle();
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/sopt/Endpoint.java

    r5034 r5035  
    99
    1010    private String url;
    11     private InstitutionI institution;
     11    private Institution institution;
    1212
    13     public Endpoint(String url, InstitutionI institution) {
     13    public Endpoint(String url, Institution institution) {
    1414        this.url = url;
    1515        this.institution = institution;
     
    2424    }
    2525
    26     public InstitutionI getInstitution() {
     26    public Institution getInstitution() {
    2727        return institution;
    2828    }
    2929
    30     public void setInstitution(InstitutionI institution) {
     30    public void setInstitution(Institution institution) {
    3131        this.institution = institution;
    3232    }
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/sopt/Institution.java

    r5034 r5035  
    88 * @author Yana Panchenko
    99 */
    10     public class Institution implements InstitutionI {
     10    public class Institution {
    1111
    1212    private String name;
     
    2020    }
    2121   
    22     @Override
    2322    public Endpoint add(String endpointUrl) {
    2423        Endpoint ep = getEndpoint(endpointUrl);
     
    3029    }
    3130
    32     @Override
    3331    public String getName() {
    3432        return name;
    3533    }
    3634   
    37     @Override
    3835    public String getLink() {
    3936        return link;
    4037    }
    4138   
    42     @Override
    4339   public List<Endpoint> getEndpoints() {
    4440        return  this.endpoints;
     
    4642   
    4743   
    48     @Override
    4944    public Endpoint getEndpoint(int index) {
    5045        if (index >= endpoints.size()) {
     
    5449    }
    5550   
    56     @Override
    5751    public Endpoint getEndpoint(String endpointUrl) {
    5852        for (Endpoint ep : endpoints) {
     
    6458    }
    6559   
    66     @Override
    6760    public String toString() {
    6861        if (name != null && name.length() > 0) {
     
    7366    }
    7467   
    75    
    7668}
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/sopt/Languages.java

    r3044 r5035  
    22
    33import java.io.BufferedReader;
    4 import java.io.FileNotFoundException;
    5 import java.io.FileReader;
    64import java.io.IOException;
    75import java.io.InputStream;
    86import java.io.InputStreamReader;
    9 import java.io.UnsupportedEncodingException;
    10 import java.util.Arrays;
    117import java.util.HashMap;
    12 import java.util.HashSet;
    138import java.util.Map;
    149import java.util.Set;
     
    2520    private Map<String,String> code22Code = new HashMap<String,String>();
    2621    public static final String LANGUAGES_FILE_PATH = "/lang/ISO-639-2_utf-8.txt";
     22    public static final String LANGUAGES_FILE_ENCODING = "UTF-8";
     23    public static final String ANY_LANGUAGE_NAME = "anylang";
    2724   
    2825    public Languages() {
     
    4643        BufferedReader br = null;
    4744        try {
    48             br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
     45            br = new BufferedReader(new InputStreamReader(is, LANGUAGES_FILE_ENCODING));
    4946            String line;
    5047            while ((line = br.readLine()) != null) {
  • SRUAggregator/trunk/src/test/java/eu/clarin/sru/fcs/aggregator/app/ScanCacheFiledTest.java

    r5034 r5035  
    22
    33import eu.clarin.sru.fcs.aggregator.cache.ScanCacheFiled;
     4import eu.clarin.sru.fcs.aggregator.cache.SimpleInMemScanCache;
    45import eu.clarin.sru.fcs.aggregator.cache.ScanCache;
    56import eu.clarin.sru.fcs.aggregator.sopt.Corpus;
     
    1617public class ScanCacheFiledTest {
    1718   
    18 //   
    19 //   
    20 //    @Test
    21 //    public void testReadWriteDepth1() {
    22 //        String scanDir = "/scan-bas";
    23 //        String scanPath1 = this.getClass().getResource(scanDir).getFile();
    24 //        String scanPath2 = "/tmp/scan-bas";
    25 //        File scanDir2 = new File(scanPath2);
    26 //        if (!scanDir2.exists()) {
    27 //            scanDir2.mkdir();
    28 //        }
    29 //       
    30 //        ScanCacheFiled scanFiled1 = new ScanCacheFiled(scanPath1);
    31 //        ScanCache cacheOrig = scanFiled1.read();
    32 //       
    33 //        ScanCacheFiled scanFiled2 = new ScanCacheFiled(scanPath2);
    34 //        scanFiled2.write(cacheOrig);
    35 //       
    36 //        ScanCacheFiled scanFiled3 = new ScanCacheFiled(scanPath2);
    37 //        ScanCache cacheRewritten = scanFiled3.read();
    38 //       
    39 //        //make sure caches contain the same info after read-write
    40 //        Assert.assertEquals(cacheOrig.getInstitutions().size(), cacheRewritten.getInstitutions().size());
    41 //        Endpoint epOrig = cacheOrig.getInstitutions().get(2).getEndpoint(0);
    42 //        Endpoint epRewritten = cacheRewritten.getInstitutions().get(2).getEndpoint(0);
    43 //        Assert.assertEquals(epOrig.getUrl(), epRewritten.getUrl());
    44 //        Assert.assertEquals(epOrig, epRewritten);
    45 //        List<Corpus> rootCorporaOrig = cacheOrig.getRootCorporaOfEndpoint(epOrig.getUrl());
    46 //        List<Corpus> rootCorporaRewritten = cacheRewritten.getRootCorporaOfEndpoint(epOrig.getUrl());
    47 //        Assert.assertEquals(rootCorporaOrig.size(), rootCorporaRewritten.size());
    48 //        Assert.assertEquals(3, rootCorporaRewritten.size());
    49 //        Assert.assertEquals(rootCorporaOrig.get(0), rootCorporaRewritten.get(0));
    50 //        List<Corpus> childenOrig = cacheOrig.getChildrenCorpora(rootCorporaOrig.get(0).getHandle());
    51 //        List<Corpus> childenRewritten = cacheRewritten.getChildrenCorpora(rootCorporaOrig.get(0).getHandle());
    52 //        Assert.assertEquals(childenOrig, childenRewritten);
    53 //        Assert.assertEquals(rootCorporaOrig.get(0).getLanguages(), rootCorporaRewritten.get(0).getLanguages());
    54 //       
    55 //        //System.out.println(cacheOrig);
    56 //        //System.out.println();
    57 //        //System.out.println(cacheRewritten);
    58 //    }
    59 //   
    60 //    @Test
    61 //    public void testReadWriteDepth2() {
    62 //        String scanDir = "/scan-mpi";
    63 //        String scanPath1 = this.getClass().getResource(scanDir).getFile();
    64 //        String scanPath2 = "/tmp/scan-mpi";
    65 //        File scanDir2 = new File(scanPath2);
    66 //        if (!scanDir2.exists()) {
    67 //            scanDir2.mkdir();
    68 //        }
    69 //       
    70 //        ScanCacheFiled scanFiled1 = new ScanCacheFiled(scanPath1);
    71 //        ScanCache cacheOrig = scanFiled1.read();
    72 //       
    73 //        ScanCacheFiled scanFiled2 = new ScanCacheFiled(scanPath2);
    74 //        scanFiled2.write(cacheOrig);
    75 //       
    76 //        ScanCacheFiled scanFiled3 = new ScanCacheFiled(scanPath2);
    77 //        ScanCache cacheRewritten = scanFiled3.read();
    78 //       
    79 //        //make sure caches contain the same info after read-write
    80 //        Assert.assertEquals(cacheOrig.getInstitutions().size(), cacheRewritten.getInstitutions().size());
    81 //        Endpoint epOrig = cacheOrig.getInstitutions().get(4).getEndpoint(0);
    82 //        Endpoint epRewritten = cacheRewritten.getInstitutions().get(4).getEndpoint(0);
    83 //        Assert.assertEquals(epOrig.getUrl(), epRewritten.getUrl());
    84 //        Assert.assertEquals(epOrig, epRewritten);
    85 //        List<Corpus> rootCorporaOrig = cacheOrig.getRootCorporaOfEndpoint(epOrig.getUrl());
    86 //        List<Corpus> rootCorporaRewritten = cacheRewritten.getRootCorporaOfEndpoint(epOrig.getUrl());
    87 //        Assert.assertEquals(rootCorporaOrig.size(), rootCorporaRewritten.size());
    88 //        Assert.assertEquals(3, rootCorporaRewritten.size());
    89 //        Assert.assertEquals(rootCorporaOrig.get(0), rootCorporaRewritten.get(0));
    90 //        List<Corpus> childenOrig = cacheOrig.getChildrenCorpora(rootCorporaOrig.get(0).getHandle());
    91 //        List<Corpus> childenRewritten = cacheRewritten.getChildrenCorpora(rootCorporaOrig.get(0).getHandle());
    92 //        Assert.assertEquals(childenOrig, childenRewritten);
    93 //        Assert.assertEquals(2, childenRewritten.size());
    94 //        Assert.assertEquals(rootCorporaOrig.get(0).getLanguages(), rootCorporaRewritten.get(0).getLanguages());
    95 //       
    96 ////        System.out.println(cacheOrig);
    97 ////        System.out.println();
    98 ////        System.out.println(cacheRewritten);
    99 //    }
    100 //   
    101 //        @Test
    102 //    public void testReadWriteDefaultCorpus() {
    103 //        String scanDir = "/scan-def";
    104 //        String scanPath1 = this.getClass().getResource(scanDir).getFile();
    105 //        String scanPath2 = "/tmp/scan-def";
    106 //        File scanDir2 = new File(scanPath2);
    107 //        if (!scanDir2.exists()) {
    108 //            scanDir2.mkdir();
    109 //        }
    110 //       
    111 //        ScanCacheFiled scanFiled1 = new ScanCacheFiled(scanPath1);
    112 //        ScanCache cacheOrig = scanFiled1.read();
    113 //       
    114 //        ScanCacheFiled scanFiled2 = new ScanCacheFiled(scanPath2);
    115 //        scanFiled2.write(cacheOrig);
    116 //       
    117 //        ScanCacheFiled scanFiled3 = new ScanCacheFiled(scanPath2);
    118 //        ScanCache cacheRewritten = scanFiled3.read();
    119 //       
    120 //        //make sure caches contain the same info after read-write
    121 //        Assert.assertEquals(cacheOrig.getInstitutions().size(), cacheRewritten.getInstitutions().size());
    122 //        Endpoint epOrig = cacheOrig.getInstitutions().get(4).getEndpoint(0);
    123 //        Endpoint epRewritten = cacheRewritten.getInstitutions().get(4).getEndpoint(0);
    124 //        Assert.assertEquals(epOrig.getUrl(), epRewritten.getUrl());
    125 //        Assert.assertEquals(epOrig, epRewritten);
    126 //        List<Corpus> rootCorporaOrig = cacheOrig.getRootCorporaOfEndpoint(epOrig.getUrl());
    127 //        List<Corpus> rootCorporaRewritten = cacheRewritten.getRootCorporaOfEndpoint(epOrig.getUrl());
    128 //        Assert.assertEquals(rootCorporaOrig.size(), rootCorporaRewritten.size());
    129 //        Assert.assertEquals(1, rootCorporaRewritten.size());
    130 //        Assert.assertEquals(rootCorporaOrig.get(0).getLanguages(), rootCorporaRewritten.get(0).getLanguages());
    131 //       
    132 ////        System.out.println(cacheOrig);
    133 ////        System.out.println();
    134 ////        System.out.println(cacheRewritten);
    135 //    }
     19   
     20   
     21    @Test
     22    public void testReadWriteDepth1() {
     23        String scanDir = "/scan-bas";
     24        String scanPath1 = this.getClass().getResource(scanDir).getFile();
     25        String scanPath2 = "/tmp/scan-bas";
     26        File scanDir2 = new File(scanPath2);
     27        if (!scanDir2.exists()) {
     28            scanDir2.mkdir();
     29        }
     30       
     31        ScanCacheFiled scanFiled1 = new ScanCacheFiled(scanPath1);
     32        ScanCache cacheOrig = scanFiled1.read();
     33       
     34        ScanCacheFiled scanFiled2 = new ScanCacheFiled(scanPath2);
     35        scanFiled2.write(cacheOrig);
     36       
     37        ScanCacheFiled scanFiled3 = new ScanCacheFiled(scanPath2);
     38        ScanCache cacheRewritten = scanFiled3.read();
     39       
     40        //make sure caches contain the same info after read-write
     41        Assert.assertEquals(cacheOrig.getInstitutions().size(), cacheRewritten.getInstitutions().size());
     42        Endpoint epOrig = cacheOrig.getInstitutions().get(2).getEndpoint(0);
     43        Endpoint epRewritten = cacheRewritten.getInstitutions().get(2).getEndpoint(0);
     44        Assert.assertEquals(epOrig.getUrl(), epRewritten.getUrl());
     45        Assert.assertEquals(epOrig, epRewritten);
     46        List<Corpus> rootCorporaOrig = cacheOrig.getRootCorporaOfEndpoint(epOrig.getUrl());
     47        List<Corpus> rootCorporaRewritten = cacheRewritten.getRootCorporaOfEndpoint(epOrig.getUrl());
     48        Assert.assertEquals(rootCorporaOrig.size(), rootCorporaRewritten.size());
     49        Assert.assertEquals(3, rootCorporaRewritten.size());
     50        Assert.assertEquals(rootCorporaOrig.get(0), rootCorporaRewritten.get(0));
     51        List<Corpus> childenOrig = cacheOrig.getChildren(rootCorporaOrig.get(0));
     52        List<Corpus> childenRewritten = cacheRewritten.getChildren(rootCorporaOrig.get(0));
     53        Assert.assertEquals(childenOrig, childenRewritten);
     54        Assert.assertEquals(rootCorporaOrig.get(0).getLanguages(), rootCorporaRewritten.get(0).getLanguages());
     55       
     56        //System.out.println(cacheOrig);
     57        //System.out.println();
     58        //System.out.println(cacheRewritten);
     59    }
     60   
     61    @Test
     62    public void testReadWriteDepth2() {
     63        String scanDir = "/scan-mpi";
     64        String scanPath1 = this.getClass().getResource(scanDir).getFile();
     65        String scanPath2 = "/tmp/scan-mpi";
     66        File scanDir2 = new File(scanPath2);
     67        if (!scanDir2.exists()) {
     68            scanDir2.mkdir();
     69        }
     70       
     71        ScanCacheFiled scanFiled1 = new ScanCacheFiled(scanPath1);
     72        ScanCache cacheOrig = scanFiled1.read();
     73       
     74        ScanCacheFiled scanFiled2 = new ScanCacheFiled(scanPath2);
     75        scanFiled2.write(cacheOrig);
     76       
     77        ScanCacheFiled scanFiled3 = new ScanCacheFiled(scanPath2);
     78        ScanCache cacheRewritten = scanFiled3.read();
     79       
     80        //make sure caches contain the same info after read-write
     81        Assert.assertEquals(cacheOrig.getInstitutions().size(), cacheRewritten.getInstitutions().size());
     82        Endpoint epOrig = cacheOrig.getInstitutions().get(4).getEndpoint(0);
     83        Endpoint epRewritten = cacheRewritten.getInstitutions().get(4).getEndpoint(0);
     84        Assert.assertEquals(epOrig.getUrl(), epRewritten.getUrl());
     85        Assert.assertEquals(epOrig, epRewritten);
     86        List<Corpus> rootCorporaOrig = cacheOrig.getRootCorporaOfEndpoint(epOrig.getUrl());
     87        List<Corpus> rootCorporaRewritten = cacheRewritten.getRootCorporaOfEndpoint(epOrig.getUrl());
     88        Assert.assertEquals(rootCorporaOrig.size(), rootCorporaRewritten.size());
     89        Assert.assertEquals(3, rootCorporaRewritten.size());
     90        Assert.assertEquals(rootCorporaOrig.get(0), rootCorporaRewritten.get(0));
     91        List<Corpus> childenOrig = cacheOrig.getChildren(rootCorporaOrig.get(0));
     92        List<Corpus> childenRewritten = cacheRewritten.getChildren(rootCorporaOrig.get(0));
     93        Assert.assertEquals(childenOrig, childenRewritten);
     94        Assert.assertEquals(2, childenRewritten.size());
     95        Assert.assertEquals(rootCorporaOrig.get(0).getLanguages(), rootCorporaRewritten.get(0).getLanguages());
     96       
     97//        System.out.println(cacheOrig);
     98//        System.out.println();
     99//        System.out.println(cacheRewritten);
     100    }
     101   
     102        @Test
     103    public void testReadWriteDefaultCorpus() {
     104        String scanDir = "/scan-def";
     105        String scanPath1 = this.getClass().getResource(scanDir).getFile();
     106        String scanPath2 = "/tmp/scan-def";
     107        File scanDir2 = new File(scanPath2);
     108        if (!scanDir2.exists()) {
     109            scanDir2.mkdir();
     110        }
     111       
     112        ScanCacheFiled scanFiled1 = new ScanCacheFiled(scanPath1);
     113        ScanCache cacheOrig = scanFiled1.read();
     114       
     115        ScanCacheFiled scanFiled2 = new ScanCacheFiled(scanPath2);
     116        scanFiled2.write(cacheOrig);
     117       
     118        ScanCacheFiled scanFiled3 = new ScanCacheFiled(scanPath2);
     119        ScanCache cacheRewritten = scanFiled3.read();
     120       
     121        //make sure caches contain the same info after read-write
     122        Assert.assertEquals(cacheOrig.getInstitutions().size(), cacheRewritten.getInstitutions().size());
     123        Endpoint epOrig = cacheOrig.getInstitutions().get(4).getEndpoint(0);
     124        Endpoint epRewritten = cacheRewritten.getInstitutions().get(4).getEndpoint(0);
     125        Assert.assertEquals(epOrig.getUrl(), epRewritten.getUrl());
     126        Assert.assertEquals(epOrig, epRewritten);
     127        List<Corpus> rootCorporaOrig = cacheOrig.getRootCorporaOfEndpoint(epOrig.getUrl());
     128        List<Corpus> rootCorporaRewritten = cacheRewritten.getRootCorporaOfEndpoint(epOrig.getUrl());
     129        Assert.assertEquals(rootCorporaOrig.size(), rootCorporaRewritten.size());
     130        Assert.assertEquals(1, rootCorporaRewritten.size());
     131        Assert.assertEquals(rootCorporaOrig.get(0).getLanguages(), rootCorporaRewritten.get(0).getLanguages());
     132       
     133//        System.out.println(cacheOrig);
     134//        System.out.println();
     135//        System.out.println(cacheRewritten);
     136    }
    136137       
    137138        @Test
  • SRUAggregator/trunk/src/test/java/eu/clarin/sru/fcs/aggregator/app/ScanCrawlerTest.java

    r5034 r5035  
    22
    33import eu.clarin.sru.client.SRUThreadedClient;
     4import eu.clarin.sru.fcs.aggregator.cache.EndpointUrlFilter;
     5import eu.clarin.sru.fcs.aggregator.cache.SimpleInMemScanCache;
     6import eu.clarin.sru.fcs.aggregator.cache.ScanCrawler;
    47import eu.clarin.sru.fcs.aggregator.sopt.CenterRegistryLive;
    58import eu.clarin.sru.fcs.aggregator.sopt.Corpus;
     
    1922    public void testCrawlForMpiAndTue() {
    2023
    21 //        SRUThreadedClient sruClient = new SRUThreadedClient();
    22 //
    23 //        try {
    24 //            EndpointUrlFilter filter = new EndpointUrlFilter();
    25 //            filter.urlShouldContainAnyOf("uni-tuebingen.de", "mpi.nl");
    26 //            ScanCrawler crawler = new ScanCrawler(new CenterRegistryLive(), sruClient, filter, 2);
    27 //            ScanCache cache = crawler.crawl();
    28 //            Corpus tueRootCorpus = cache.getRootCorporaOfEndpoint("http://weblicht.sfs.uni-tuebingen.de/rws/sru/").get(0);
    29 //            Corpus mpiRootCorpus = cache.getRootCorporaOfEndpoint("http://cqlservlet.mpi.nl/").get(0);
    30 //            Assert.assertEquals("http://hdl.handle.net/11858/00-1778-0000-0001-DDAF-D",
    31 //                    tueRootCorpus.getHandle());
    32 //            Assert.assertEquals("hdl:1839/00-0000-0000-0003-4692-D@format=cmdi",
    33 //                    cache.getChildrenCorpora("hdl:1839/00-0000-0000-0001-53A5-2@format=cmdi").get(0).getHandle());
    34 //            //check if languages and other corpus data is crawled corectly...
    35 //            Set<String> tueLangs = new HashSet<String>();
    36 //            tueLangs.add("deu");
    37 //            Assert.assertEquals(tueLangs, tueRootCorpus.getLanguages());
    38 //            String tueDescSubstring = "TÃŒbingen Treebank";
    39 //            Assert.assertTrue("Description problem", tueRootCorpus.getDescription().contains(tueDescSubstring));
    40 //            String tueNameSubstring = "TuebaDDC";
    41 //            Assert.assertTrue("Name problem", tueRootCorpus.getDisplayName().contains(tueNameSubstring));
    42 //            String tuePageSubstring = "sfs.uni-tuebingen.de";
    43 //            Assert.assertTrue("Landing page problem", tueRootCorpus.getLandingPage().contains(tuePageSubstring));
    44 //            Assert.assertTrue("Number of records problem", mpiRootCorpus.getNumberOfRecords() > 10);
    45 //
    46 //        } finally {
    47 //            sruClient.shutdown();
    48 //        }
    49 //
     24        SRUThreadedClient sruClient = new SRUThreadedClient();
     25
     26        try {
     27            EndpointUrlFilter filter = new EndpointUrlFilter();
     28            //filter.urlShouldContainAnyOf("leipzig", ".mpi.nl");
     29            filter.urlShouldContainAnyOf("uni-tuebingen.de", ".mpi.nl");
     30            //filter.urlShouldContainAnyOf("dspin.dwds.de", "lindat.");
     31            ScanCrawler crawler = new ScanCrawler(new CenterRegistryLive(), sruClient, filter, 2);
     32            SimpleInMemScanCache cache = new SimpleInMemScanCache();
     33            crawler.crawl(cache);
     34            Corpus tueRootCorpus = cache.getRootCorporaOfEndpoint("http://weblicht.sfs.uni-tuebingen.de/rws/sru/").get(0);
     35            Corpus mpiRootCorpus = cache.getRootCorporaOfEndpoint("http://cqlservlet.mpi.nl/").get(0);
     36            Assert.assertEquals("http://hdl.handle.net/11858/00-1778-0000-0001-DDAF-D",
     37                    tueRootCorpus.getHandle());
     38            Corpus mpiCorpus = cache.getCorpus("hdl:1839/00-0000-0000-0001-53A5-2@format=cmdi");
     39            Assert.assertEquals("hdl:1839/00-0000-0000-0003-4692-D@format=cmdi", cache.getChildren(mpiCorpus).get(0).getHandle());
     40            //check if languages and other corpus data is crawled corectly...
     41            Set<String> tueLangs = new HashSet<String>();
     42            tueLangs.add("deu");
     43            Assert.assertEquals(tueLangs, tueRootCorpus.getLanguages());
     44            String tueDescSubstring = "TÃŒbingen Treebank";
     45            Assert.assertTrue("Description problem", tueRootCorpus.getDescription().contains(tueDescSubstring));
     46            String tueNameSubstring = "TuebaDDC";
     47            Assert.assertTrue("Name problem", tueRootCorpus.getDisplayName().contains(tueNameSubstring));
     48            String tuePageSubstring = "sfs.uni-tuebingen.de";
     49            Assert.assertTrue("Landing page problem", tueRootCorpus.getLandingPage().contains(tuePageSubstring));
     50            Assert.assertTrue("Number of records problem", mpiRootCorpus.getNumberOfRecords() > 10);
     51
     52        } finally {
     53            sruClient.shutdown();
     54        }
     55
    5056    }
    5157}
Note: See TracChangeset for help on using the changeset viewer.