Changeset 7150


Ignore:
Timestamp:
09/28/17 09:09:03 (7 years ago)
Author:
Leif-Jöran
Message:

Adding new configuration option 'additionalFCSEndpoints' for sideloading v2 endpoints explicitly.

Location:
SRUAggregator/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • SRUAggregator/trunk/aggregator.yml

    r6254 r7150  
    33  # additionalCQLEndpoints:
    44    # - https://clarin.ids-mannheim.de/digibibsru-new
     5  # additionalFCSEndpoints:
    56
     7  #AGGREGATOR_FILE_PATH: /var/lib/aggregator/fcsAggregatorCorpora.json
     8  #AGGREGATOR_FILE_PATH_BACKUP: /var/lib/aggregator/fcsAggregatorCorpora.backup.json
    69  AGGREGATOR_FILE_PATH: /var/lib/aggregator/fcsAggregatorCorpora.json
    710  AGGREGATOR_FILE_PATH_BACKUP: /var/lib/aggregator/fcsAggregatorCorpora.backup.json
     
    3740  applicationContextPath: /Aggregator
    3841  type: simple
     42  #rootPath: '/rest/*'
    3943  connector:
    4044    type: http
     
    5256  appenders:
    5357    - type: file
     58      #currentLogFilename: /var/log/aggregator/access.log
    5459      currentLogFilename: /var/log/aggregator/access.log
     60      #archivedLogFilenamePattern: /var/log/aggregator/access-%d.log.gz
    5561      archivedLogFilenamePattern: /var/log/aggregator/access-%d.log.gz
    5662      archivedFileCount: 5
     63#  appenders:
     64#    - type: console
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/scan/FCSProtocolVersion.java

    r7022 r7150  
    99        LEGACY, // https://trac.clarin.eu/wiki/FCS-specification
    1010        VERSION_1, // https://trac.clarin.eu/wiki/FCS/Specification
    11         VERSION_2, // https://trac.clarin.eu/wiki/Taskforces/FCS/FCS-Specification-Draft
     11        VERSION_2, // https://trac.clarin.eu/wiki/FCS/FCS-Specification-v2
    1212}
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/scan/Institution.java

    r5957 r7150  
    2828                endpoints.add(new Endpoint(endpointUrl, FCSProtocolVersion.LEGACY));
    2929                return endpointUrl;
     30        }
     31
     32        public String addEndpoint(String endpointUrl, FCSProtocolVersion version) {
     33            if (version.equals(FCSProtocolVersion.VERSION_2)) {
     34                endpoints.add(new Endpoint(endpointUrl, FCSProtocolVersion.VERSION_2));
     35            } else if (version.equals(FCSProtocolVersion.VERSION_1)) {
     36                endpoints.add(new Endpoint(endpointUrl, FCSProtocolVersion.VERSION_1));
     37            } else if (version.equals(FCSProtocolVersion.LEGACY)) {
     38                endpoints.add(new Endpoint(endpointUrl, FCSProtocolVersion.LEGACY));
     39            } else {
     40                endpoints.add(new Endpoint(endpointUrl, FCSProtocolVersion.LEGACY));
     41            }
     42            return endpointUrl;
    3043        }
    3144
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/scan/ScanCrawlTask.java

    r6396 r7150  
    3131        private String centerRegistryUrl;
    3232        private List<URL> additionalCQLEndpoints;
     33        private List<URL> additionalFCSEndpoints;
    3334
    3435        public ScanCrawlTask(ThrottledClient sruClient, String centerRegistryUrl,
    35                         int cacheMaxDepth, List<URL> additionalCQLEndpoints,
     36                        int cacheMaxDepth,
     37                        List<URL> additionalCQLEndpoints,
     38                        List<URL> additionalFCSEndpoints,
    3639                        EndpointFilter filter,
    3740                        AtomicReference<Corpora> corporaAtom,
     
    4447                this.cacheMaxDepth = cacheMaxDepth;
    4548                this.additionalCQLEndpoints = additionalCQLEndpoints;
     49                this.additionalFCSEndpoints = additionalFCSEndpoints;
    4650                this.filter = filter;
    4751                this.corporaAtom = corporaAtom;
     
    6468                        if (additionalCQLEndpoints != null && !additionalCQLEndpoints.isEmpty()) {
    6569                                institutions.add(0,
    66                                                 new Institution("Unknown Institution", null) {
     70                                                new Institution("Unknown Institution, legacy", null) {
    6771                                                        {
    6872                                                                for (URL u : additionalCQLEndpoints) {
    69                                                                         addEndpoint(u.toExternalForm());
     73                                                                        addEndpoint(u.toExternalForm(), FCSProtocolVersion.LEGACY);
     74                                                                }
     75                                                        }
     76                                                });
     77                        }
     78                        if (additionalFCSEndpoints != null && !additionalFCSEndpoints.isEmpty()) {
     79                                institutions.add(0,
     80                                                new Institution("Unknown Institution, FCS v2.0", null) {
     81                                                        {
     82                                                                for (URL u : additionalFCSEndpoints) {
     83                                                                        addEndpoint(u.toExternalForm(), FCSProtocolVersion.VERSION_2);
    7084                                                                }
    7185                                                        }
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/scan/Statistics.java

    r7022 r7150  
    172172                EndpointStats stats = getEndpointStats(institution, endpoint);
    173173                synchronized (stats.lock) {
    174                     stats.version = endpoint.getProtocol() == FCSProtocolVersion.VERSION_2 ? FCSProtocolVersion.VERSION_2 : FCSProtocolVersion.VERSION_1;
     174                    stats.version = endpoint.getProtocol().equals(FCSProtocolVersion.VERSION_2) ? FCSProtocolVersion.VERSION_2 : FCSProtocolVersion.VERSION_1;
    175175                }
    176176        }
Note: See TracChangeset for help on using the changeset viewer.