source: SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/data/InstitutionForTesting.java @ 2738

Last change on this file since 2738 was 2738, checked in by yana, 11 years ago

fixed no-scroll-in-search-results panel bug;
added testing mode to test endpoints on development servers;
added fist functionality for the show-case: save TCF into Personal Workspace using sardine library;
added: in scan operation the resource handle is put in quotes to avoid parse error.

File size: 1.8 KB
Line 
1package eu.clarin.sru.fcs.aggregator.data;
2
3import eu.clarin.sru.fcs.aggregator.sparam.CorpusTreeNode;
4import eu.clarin.sru.fcs.aggregator.data.CenterRegistry;
5import java.io.IOException;
6import java.io.InputStream;
7import java.net.URL;
8import java.util.*;
9import java.util.logging.Level;
10import java.util.logging.Logger;
11import javax.xml.parsers.DocumentBuilder;
12import javax.xml.parsers.DocumentBuilderFactory;
13import org.w3c.dom.Document;
14import org.w3c.dom.NodeList;
15
16/**
17 * Institution node. Can have Endpoint children.
18 *
19 * @author Yana Panchenko
20 */
21public class InstitutionForTesting extends Institution {
22
23    private List<Endpoint> endpoints = new ArrayList<Endpoint>();
24    private boolean hasChildrenLoaded = false;
25   
26    private static final String[] testEndpoints = new String[]{"http://lux17.mpi.nl/cqltest"};
27   
28    private static final Logger logger = Logger.getLogger(Institution.class.getName());
29
30    public InstitutionForTesting(String name, String link) {
31        super(name,link);
32    }
33
34   
35
36    @Override
37    public boolean hasChildrenLoaded() {
38        return hasChildrenLoaded;
39    }
40
41    @Override
42    public void loadChildren() {
43       
44        if (hasChildrenLoaded) {
45            return;
46        }
47        hasChildrenLoaded = true;
48       
49        for (int j = 0; j < testEndpoints.length; j++) {
50                String epUrl = testEndpoints[j];
51                Endpoint endpoint = new Endpoint(epUrl, this);
52                endpoints.add(endpoint);
53        } 
54       
55    }
56
57    @Override
58    public List<? extends CorpusTreeNode> getChildren() {
59        loadChildren();
60        return  this.endpoints;
61    }
62
63    @Override
64    public CorpusTreeNode getChild(int index) {
65        loadChildren();
66        if (index >= endpoints.size()) {
67            return null;
68        }
69        return endpoints.get(index);
70    }
71   
72
73}
Note: See TracBrowser for help on using the repository browser.