Changeset 6049 for SRUAggregator
- Timestamp:
- 02/25/15 11:11:38 (9 years ago)
- Location:
- SRUAggregator/trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
SRUAggregator/trunk/aggregator.yml
r6043 r6049 13 13 14 14 # AGGREGATOR_FILE_PATH: /data/fcsAggregator/fcsAggregatorCorpora.json 15 # AGGREGATOR_FILE_PATH_BACKUP: /data/fcsAggregator/fcsAggregatorCorpora.backup.json 15 16 AGGREGATOR_FILE_PATH: /Users/edima/fcsAggregatorCorpora.json 16 17 AGGREGATOR_FILE_PATH_BACKUP: /Users/edima/fcsAggregatorCorpora.backup.json 17 18 SCAN_MAX_DEPTH: 1 # recommended 3 18 19 SCAN_TASK_INITIAL_DELAY: 0 -
SRUAggregator/trunk/pom.xml
r6043 r6049 8 8 <groupId>eu.clarin.sru.fcs</groupId> 9 9 <artifactId>Aggregator2</artifactId> 10 <version>2.0.0-alpha-2 1</version>10 <version>2.0.0-alpha-22</version> 11 11 <name>FCS Aggregator</name> 12 12 -
SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/app/Aggregator.java
r6043 r6049 88 88 * @author edima 89 89 * 90 * TODO: Use weblicht with results91 *92 * TODO: disable popups easily93 *94 * TODO: atomic replace of cached corpora (file)95 *96 90 * TODO: zoom into the results from a corpus, allow functionality only for 97 91 * the view (search for next set of results) 98 92 * 99 * TODO: fix search bug after going to stats93 * TODO: Use weblicht with results 100 94 * 101 95 * TODO: Export search results to personal workspace as csv, excel, tcf, plain … … 151 145 bootstrap.addBundle(new AssetsBundle("/assets", "/", "index.html", "static")); 152 146 } 153 154 147 155 148 @Override … … 221 214 222 215 File corporaCacheFile = new File(params.AGGREGATOR_FILE_PATH); 223 try { 224 Corpora corpora = new ObjectMapper().readValue(corporaCacheFile, Corpora.class); 225 scanCacheAtom.set(corpora); 226 log.info("corpus list read from file; number of root corpora: " + scanCacheAtom.get().getCorpora().size()); 227 } catch (Exception e) { 228 log.error("Error while reading cached corpora:", e); 216 File corporaOldCacheFile = new File(params.AGGREGATOR_FILE_PATH_BACKUP); 217 218 // init corpora from file 219 { 220 Corpora corpora = null; 221 try { 222 corpora = new ObjectMapper().readValue(corporaCacheFile, Corpora.class); 223 } catch (Exception xc) { 224 log.error("Failed to load cached corpora from primary file:", xc); 225 } 226 if (corpora == null) { 227 try { 228 corpora = new ObjectMapper().readValue(corporaOldCacheFile, Corpora.class); 229 } catch (Exception e) { 230 log.error("Failed to load cached corpora from backup file:", e); 231 } 232 } 233 if (corpora != null) { 234 scanCacheAtom.set(corpora); 235 log.info("corpus list read from file; number of root corpora: " + scanCacheAtom.get().getCorpora().size()); 236 } 229 237 } 230 238 … … 236 244 params.CENTER_REGISTRY_URL, params.SCAN_MAX_DEPTH, 237 245 params.additionalCQLEndpoints, 238 null, scanCacheAtom, corporaCacheFile, 246 null, scanCacheAtom, corporaCacheFile, corporaOldCacheFile, 239 247 scanStatsAtom, searchStatsAtom); 240 248 scheduler.scheduleAtFixedRate(task, params.SCAN_TASK_INITIAL_DELAY, -
SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/app/AggregatorConfiguration.java
r5971 r6049 25 25 @JsonProperty 26 26 String AGGREGATOR_FILE_PATH; 27 28 @NotEmpty 29 @JsonProperty 30 String AGGREGATOR_FILE_PATH_BACKUP; 27 31 28 32 @JsonProperty -
SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/scan/ScanCrawlTask.java
r5971 r6049 24 24 private AtomicReference<Corpora> corporaAtom; 25 25 private File cachedCorpora; 26 private File oldCachedCorpora; 26 27 private AtomicReference<Statistics> scanStatisticsAtom; 27 28 private AtomicReference<Statistics> searchStatisticsAtom; … … 32 33 int cacheMaxDepth, List<URL> additionalCQLEndpoints, 33 34 EndpointFilter filter, 34 AtomicReference<Corpora> corporaAtom, File cachedCorpora, 35 AtomicReference<Corpora> corporaAtom, 36 File cachedCorpora, File oldCachedCorpora, 35 37 AtomicReference<Statistics> scanStatisticsAtom, 36 38 AtomicReference<Statistics> searchStatisticsAtom 37 39 ) { 38 40 this.sruClient = sruClient; 39 41 this.centerRegistryUrl = centerRegistryUrl; … … 43 45 this.corporaAtom = corporaAtom; 44 46 this.cachedCorpora = cachedCorpora; 47 this.oldCachedCorpora = oldCachedCorpora; 45 48 this.scanStatisticsAtom = scanStatisticsAtom; 46 49 this.searchStatisticsAtom = searchStatisticsAtom; … … 83 86 log.warn("ScanCrawlTask: Skipped writing to disk (no corpora). Finished."); 84 87 } else { 85 ObjectMapper mapper = new ObjectMapper(); 86 mapper.writerWithDefaultPrettyPrinter().writeValue(cachedCorpora, corpora); 88 dump(corpora, cachedCorpora, oldCachedCorpora); 87 89 log.info("ScanCrawlTask: wrote to disk, finished"); 88 90 } … … 94 96 } 95 97 } 98 99 private static void dump(Corpora corpora, 100 File cachedCorpora, File oldCachedCorpora) throws IOException { 101 if (cachedCorpora.exists()) { 102 try { 103 oldCachedCorpora.delete(); 104 } catch (Throwable txc) { 105 //ignore 106 } 107 try { 108 cachedCorpora.renameTo(oldCachedCorpora); 109 } catch (Throwable txc) { 110 // ignore 111 } 112 } 113 ObjectMapper mapper = new ObjectMapper(); 114 mapper.writerWithDefaultPrettyPrinter().writeValue(cachedCorpora, corpora); 115 } 96 116 } -
SRUAggregator/trunk/src/main/resources/assets/js/components.js
r5931 r6049 122 122 123 123 refresh: function() { 124 console.log("popover refresh", this.props.title); 124 125 $(this.getDOMNode()).popover('destroy'); 125 126 126 127 var content; 127 128 if (Array.isArray(this.props.children)) 128 content = this.props.children.map(React.renderToString).join(" 129 content = this.props.children.map(React.renderToString).join(""); 129 130 else 130 131 content = React.renderToString(this.props.children); … … 136 137 placement: this.props.placement, 137 138 title: this.props.title, 138 trigger: ' click',139 trigger: 'focus', 139 140 html: true, 140 141 }); -
SRUAggregator/trunk/src/main/resources/assets/js/components.jsx
r5931 r6049 126 126 var content; 127 127 if (Array.isArray(this.props.children)) 128 content = this.props.children.map(React.renderToString).join(" 128 content = this.props.children.map(React.renderToString).join(""); 129 129 else 130 130 content = React.renderToString(this.props.children); … … 136 136 placement: this.props.placement, 137 137 title: this.props.title, 138 trigger: ' click',138 trigger: 'focus', 139 139 html: true, 140 140 }); -
SRUAggregator/trunk/src/main/resources/assets/js/main.js
r6043 r6049 3 3 "use strict"; 4 4 5 var VERSION = "VERSION 2.0.0.α2 1";5 var VERSION = "VERSION 2.0.0.α22"; 6 6 var URLROOT = "/Aggregator-testing"; 7 7 -
SRUAggregator/trunk/src/main/resources/assets/js/main.jsx
r6043 r6049 3 3 "use strict"; 4 4 5 var VERSION = "VERSION 2.0.0.α2 1";5 var VERSION = "VERSION 2.0.0.α22"; 6 6 var URLROOT = "/Aggregator-testing"; 7 7 -
SRUAggregator/trunk/src/main/resources/assets/js/search.js
r6043 r6049 604 604 renderDiagnostic: function(d) { 605 605 return React.createElement("div", {className: "alert alert-warning"}, 606 React.createElement("div", null, "Diagnostic: ", d. diagnostic.message)606 React.createElement("div", null, "Diagnostic: ", d.message) 607 607 ); 608 608 }, -
SRUAggregator/trunk/src/main/resources/assets/js/search.jsx
r6043 r6049 604 604 renderDiagnostic: function(d) { 605 605 return <div className="alert alert-warning"> 606 <div>Diagnostic: {d. diagnostic.message}</div>606 <div>Diagnostic: {d.message}</div> 607 607 </div>; 608 608 },
Note: See TracChangeset
for help on using the changeset viewer.