Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/ImportDump.java |
— | — | @@ -18,8 +18,9 @@ |
19 | 19 | protected URL dumpFile; |
20 | 20 | |
21 | 21 | @Override |
22 | | - protected void applyArguments() { |
| 22 | + protected boolean applyArguments() { |
23 | 23 | String d = getTargetFileName(); |
| 24 | + if (d==null) return false; |
24 | 25 | |
25 | 26 | if (args.isSet("url")) { |
26 | 27 | try { |
— | — | @@ -35,6 +36,8 @@ |
36 | 37 | throw new RuntimeException("failed to generate local file url for `"+d+"`"); |
37 | 38 | } |
38 | 39 | } |
| 40 | + |
| 41 | + return true; |
39 | 42 | } |
40 | 43 | |
41 | 44 | @Override |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/ImportApp.java |
— | — | @@ -44,7 +44,7 @@ |
45 | 45 | @SuppressWarnings("unchecked") |
46 | 46 | @Override |
47 | 47 | protected WikiWordStoreFactory<S> createConceptStoreFactory() throws IOException, PersistenceException { |
48 | | - return new DatabaseConceptStoreBuilders.Factory(getConfiguredDataSource(), getConfiguredDataset(), tweaks, true, true); |
| 48 | + return new DatabaseConceptStoreBuilders.Factory(getConfiguredDataSource(), getConfiguredDataset(), tweaks, null, true, true); |
49 | 49 | } |
50 | 50 | |
51 | 51 | @Override |
— | — | @@ -248,6 +248,16 @@ |
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
| 252 | + protected void createStores(WikiWordStoreFactory<? extends S> factory) throws IOException, PersistenceException { |
| 253 | + super.createStores(factory); |
| 254 | + |
| 255 | + boolean noimport = args.isSet("noimport"); |
| 256 | + |
| 257 | + if (!noimport && useAgenda) { |
| 258 | + agenda = conceptStore.createAgenda(); |
| 259 | + } |
| 260 | + } |
| 261 | + |
252 | 262 | @Override |
253 | 263 | protected void execute() throws Exception { |
254 | 264 | boolean noimport = args.isSet("noimport"); |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/AbstractImporter.java |
— | — | @@ -51,6 +51,34 @@ |
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
| 55 | + protected static class MemoryTracker extends ProgressRateTracker { |
| 56 | + protected long baseline = 0; |
| 57 | + protected long used = 0; |
| 58 | + |
| 59 | + public MemoryTracker() { |
| 60 | + } |
| 61 | + |
| 62 | + protected long getUsedMemory() { |
| 63 | + return Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); |
| 64 | + } |
| 65 | + |
| 66 | + protected void step() { |
| 67 | + if (baseline<=0) baseline = getUsedMemory(); |
| 68 | + } |
| 69 | + |
| 70 | + protected void chunk() { |
| 71 | + if (baseline<=0) baseline = getUsedMemory(); |
| 72 | + used = getUsedMemory(); |
| 73 | + super.progress(new Progress.Event(Progress.PROGRESS, null, "memory", Runtime.getRuntime().totalMemory() - baseline, used - baseline, null)); |
| 74 | + } |
| 75 | + |
| 76 | + @Override |
| 77 | + public String toString() { |
| 78 | + //return MessageFormat.format("{0}: {1,number,0}KB ({2,number,0.0}KB/sec, currently {3,number,0.0}KB/sec)", "memory", position/1024, getAverageRate()/1024, getCurrentRate()/1024); |
| 79 | + return MessageFormat.format("{0}: {1,number,0}KB", "memory", position/1024); |
| 80 | + } |
| 81 | + } |
| 82 | + |
55 | 83 | private int progressInterval = 1000; |
56 | 84 | private int safepointInterval = 30 * 1000; |
57 | 85 | |
— | — | @@ -59,6 +87,8 @@ |
60 | 88 | |
61 | 89 | private Tracker pageTracker; |
62 | 90 | private Tracker bulkTracker; |
| 91 | + private MemoryTracker memoryTracker; |
| 92 | + |
63 | 93 | private int progressTicks = 0; |
64 | 94 | private int safepointTicks = 0; |
65 | 95 | private int safepointNumber = 0; |
— | — | @@ -112,6 +142,7 @@ |
113 | 143 | public void reset() { |
114 | 144 | pageTracker = new Tracker("pages"); |
115 | 145 | bulkTracker = new Tracker("chars"); |
| 146 | + memoryTracker = new MemoryTracker(); |
116 | 147 | progressTicks = 0; |
117 | 148 | safepointTicks = 0; |
118 | 149 | } |
— | — | @@ -119,11 +150,20 @@ |
120 | 151 | public void trackerChunk() { |
121 | 152 | pageTracker.chunk(); |
122 | 153 | bulkTracker.chunk(); |
| 154 | + memoryTracker.chunk(); |
123 | 155 | |
124 | 156 | out.info("--- "+new Date()+" ---"); |
125 | 157 | out.info("- "+pageTracker); |
126 | 158 | out.info("- "+bulkTracker); |
| 159 | + out.info("- "+memoryTracker); |
127 | 160 | } |
| 161 | + |
| 162 | + public void memoryTrackerChunk() { |
| 163 | + memoryTracker.chunk(); |
| 164 | + |
| 165 | + out.info("--- "+new Date()+" ---"); |
| 166 | + out.info("- "+memoryTracker); |
| 167 | + } |
128 | 168 | |
129 | 169 | /* |
130 | 170 | public boolean isSafepoint(Agenda.Record rec) { |
— | — | @@ -184,6 +224,7 @@ |
185 | 225 | if (doit) { |
186 | 226 | pageTracker.step(); |
187 | 227 | bulkTracker.step(text.length()); |
| 228 | + memoryTracker.step(); |
188 | 229 | |
189 | 230 | int rcId = importPage(namespace, title, text, timestamp); |
190 | 231 | if (rcId>0) lastRcId = rcId; |
— | — | @@ -342,6 +383,7 @@ |
343 | 384 | |
344 | 385 | public void endTask(String context, String task) throws PersistenceException { |
345 | 386 | store.getAgenda().endTask(context, task); |
| 387 | + memoryTrackerChunk(); |
346 | 388 | } |
347 | 389 | |
348 | 390 | public int getSkip() { |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DebugLocalConceptStoreBuilder.java |
— | — | @@ -68,6 +68,10 @@ |
69 | 69 | return null; |
70 | 70 | } |
71 | 71 | |
| 72 | + public Agenda createAgenda() throws PersistenceException { |
| 73 | + return null; |
| 74 | + } |
| 75 | + |
72 | 76 | public int getNumberOfWarnings() throws PersistenceException { |
73 | 77 | return 0; |
74 | 78 | } |
— | — | @@ -162,6 +166,10 @@ |
163 | 167 | return null; |
164 | 168 | } |
165 | 169 | |
| 170 | + public Agenda createAgenda() throws PersistenceException { |
| 171 | + return null; |
| 172 | + } |
| 173 | + |
166 | 174 | public int getNumberOfWarnings() throws PersistenceException { |
167 | 175 | return 0; |
168 | 176 | } |
— | — | @@ -252,6 +260,10 @@ |
253 | 261 | return agenda; |
254 | 262 | } |
255 | 263 | |
| 264 | + public Agenda createAgenda() throws PersistenceException { |
| 265 | + return null; |
| 266 | + } |
| 267 | + |
256 | 268 | public int getNumberOfWarnings() throws PersistenceException { |
257 | 269 | return 0; |
258 | 270 | } |
— | — | @@ -335,6 +347,10 @@ |
336 | 348 | return agenda; |
337 | 349 | } |
338 | 350 | |
| 351 | + public Agenda createAgenda() throws PersistenceException { |
| 352 | + return null; |
| 353 | + } |
| 354 | + |
339 | 355 | public int getNumberOfWarnings() throws PersistenceException { |
340 | 356 | return 0; |
341 | 357 | } |
— | — | @@ -573,6 +589,10 @@ |
574 | 590 | return agenda; |
575 | 591 | } |
576 | 592 | |
| 593 | + public Agenda createAgenda() throws PersistenceException { |
| 594 | + return null; |
| 595 | + } |
| 596 | + |
577 | 597 | public void optimize() { |
578 | 598 | trace("- optimize"); |
579 | 599 | } |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseWikiWordStoreBuilder.java |
— | — | @@ -28,7 +28,8 @@ |
29 | 29 | extends DatabaseWikiWordStore |
30 | 30 | implements WikiWordStoreBuilder { |
31 | 31 | |
32 | | - protected Agenda agenda; |
| 32 | + private Agenda agenda; |
| 33 | + |
33 | 34 | protected Map<String, Inserter> inserters = new HashMap<String, Inserter>(); |
34 | 35 | |
35 | 36 | protected Inserter warningInserter; |
— | — | @@ -42,9 +43,11 @@ |
43 | 44 | protected boolean useEntityBuffer; |
44 | 45 | protected boolean useRelationBuffer; |
45 | 46 | |
46 | | - protected DatabaseWikiWordStoreBuilder(WikiWordStoreSchema database, TweakSet tweaks) throws SQLException { |
| 47 | + protected DatabaseWikiWordStoreBuilder(WikiWordStoreSchema database, TweakSet tweaks, Agenda agenda) throws SQLException { |
47 | 48 | super(database, tweaks); |
48 | 49 | |
| 50 | + this.agenda = agenda; |
| 51 | + |
49 | 52 | int bufferScale = database.getBufferScale(); |
50 | 53 | |
51 | 54 | useEntityBuffer = bufferScale > 0 && tweaks.getTweak("dbstore.useEntityBuffer", Boolean.TRUE); |
— | — | @@ -400,15 +403,21 @@ |
401 | 404 | * @see de.brightbyte.wikiword.store.builder.LocalConceptStoreBuilder#getAgenda() |
402 | 405 | */ |
403 | 406 | @Override |
404 | | - public Agenda getAgenda() throws PersistenceException { |
405 | | - if (agenda==null) { |
406 | | - try { |
407 | | - DatabaseAgendaPersistor log = new DatabaseAgendaPersistor(database.getTable("log")); |
408 | | - agenda = new Agenda(log); |
409 | | - } catch (SQLException e) { |
410 | | - throw new PersistenceException(e); |
411 | | - } |
| 407 | + public Agenda getAgenda() { |
| 408 | + return agenda; |
| 409 | + } |
| 410 | + |
| 411 | + @Override |
| 412 | + public Agenda createAgenda() throws PersistenceException { |
| 413 | + if (agenda!=null) return agenda; |
| 414 | + |
| 415 | + try { |
| 416 | + DatabaseAgendaPersistor log = new DatabaseAgendaPersistor(database.getTable("log")); |
| 417 | + agenda = new Agenda(log); |
| 418 | + } catch (SQLException e) { |
| 419 | + throw new PersistenceException(e); |
412 | 420 | } |
| 421 | + |
413 | 422 | return agenda; |
414 | 423 | } |
415 | 424 | |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseIncrementalStoreBuilder.java |
— | — | @@ -2,14 +2,15 @@ |
3 | 3 | |
4 | 4 | import java.sql.SQLException; |
5 | 5 | |
| 6 | +import de.brightbyte.application.Agenda; |
6 | 7 | import de.brightbyte.util.PersistenceException; |
7 | 8 | import de.brightbyte.wikiword.TweakSet; |
8 | 9 | import de.brightbyte.wikiword.schema.WikiWordStoreSchema; |
9 | 10 | |
10 | 11 | public abstract class DatabaseIncrementalStoreBuilder extends DatabaseWikiWordStoreBuilder implements IncrementalStoreBuilder { |
11 | 12 | |
12 | | - public DatabaseIncrementalStoreBuilder(WikiWordStoreSchema database, TweakSet tweaks) throws SQLException { |
13 | | - super(database, tweaks); |
| 13 | + protected DatabaseIncrementalStoreBuilder(WikiWordStoreSchema database, TweakSet tweaks, Agenda agenda) throws SQLException { |
| 14 | + super(database, tweaks, agenda); |
14 | 15 | } |
15 | 16 | |
16 | 17 | protected abstract void deleteDataFrom(int rcId, String op) throws PersistenceException; |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseLocalConceptStoreBuilder.java |
— | — | @@ -11,6 +11,7 @@ |
12 | 12 | |
13 | 13 | import javax.sql.DataSource; |
14 | 14 | |
| 15 | +import de.brightbyte.application.Agenda; |
15 | 16 | import de.brightbyte.data.PersistentIdManager; |
16 | 17 | import de.brightbyte.data.cursor.CursorProcessor; |
17 | 18 | import de.brightbyte.data.cursor.DataSet; |
— | — | @@ -86,8 +87,8 @@ |
87 | 88 | * @param dbInfo database connection info, used to connect to the database |
88 | 89 | * @param tweaks a tweak set from which additional options can be taken (see description at the top). |
89 | 90 | */ |
90 | | - public DatabaseLocalConceptStoreBuilder(Corpus corpus, DataSource dbInfo, TweakSet tweaks) throws SQLException { |
91 | | - this(new LocalConceptStoreSchema(corpus, dbInfo, tweaks, true), tweaks); |
| 91 | + public DatabaseLocalConceptStoreBuilder(Corpus corpus, DataSource dbInfo, TweakSet tweaks, Agenda agenda) throws SQLException { |
| 92 | + this(new LocalConceptStoreSchema(corpus, dbInfo, tweaks, true), tweaks, agenda); |
92 | 93 | } |
93 | 94 | |
94 | 95 | /** |
— | — | @@ -99,8 +100,8 @@ |
100 | 101 | * @param db a database connection |
101 | 102 | * @param tweaks a tweak set from which additional options can be taken (see description at the top). |
102 | 103 | */ |
103 | | - public DatabaseLocalConceptStoreBuilder(Corpus corpus, Connection db, TweakSet tweaks) throws SQLException { |
104 | | - this(new LocalConceptStoreSchema(corpus, db, tweaks, true), tweaks); |
| 104 | + public DatabaseLocalConceptStoreBuilder(Corpus corpus, Connection db, TweakSet tweaks, Agenda agenda) throws SQLException { |
| 105 | + this(new LocalConceptStoreSchema(corpus, db, tweaks, true), tweaks, agenda); |
105 | 106 | } |
106 | 107 | |
107 | 108 | /** |
— | — | @@ -113,8 +114,8 @@ |
114 | 115 | * @param tweaks a tweak set from which additional options can be taken (see description at the top). |
115 | 116 | * @throws SQLException |
116 | 117 | */ |
117 | | - public DatabaseLocalConceptStoreBuilder(LocalConceptStoreSchema database, TweakSet tweaks) throws SQLException { |
118 | | - super(database, tweaks); |
| 118 | + public DatabaseLocalConceptStoreBuilder(LocalConceptStoreSchema database, TweakSet tweaks, Agenda agenda) throws SQLException { |
| 119 | + super(database, tweaks, agenda); |
119 | 120 | |
120 | 121 | this.corpus = database.getCorpus(); |
121 | 122 | this.tweaks = tweaks; |
— | — | @@ -1150,8 +1151,8 @@ |
1151 | 1152 | protected class DatabaseLocalStatisticsStoreBuilder extends DatabaseStatisticsStoreBuilder { |
1152 | 1153 | protected EntityTable termTable; |
1153 | 1154 | |
1154 | | - protected DatabaseLocalStatisticsStoreBuilder(StatisticsStoreSchema database, TweakSet tweaks) throws SQLException { |
1155 | | - super(database, tweaks); |
| 1155 | + protected DatabaseLocalStatisticsStoreBuilder(StatisticsStoreSchema database, TweakSet tweaks, Agenda agenda) throws SQLException { |
| 1156 | + super(database, tweaks, agenda); |
1156 | 1157 | |
1157 | 1158 | Inserter termInserter = configureTable("term", 64, 1024); |
1158 | 1159 | termTable = (EntityTable)termInserter.getTable(); |
— | — | @@ -1207,8 +1208,8 @@ |
1208 | 1209 | |
1209 | 1210 | protected EntityTable conceptDescriptionTable; |
1210 | 1211 | |
1211 | | - protected DatabaseLocalConceptInfoStoreBuilder(ConceptInfoStoreSchema database, TweakSet tweaks) throws SQLException { |
1212 | | - super(database, tweaks); |
| 1212 | + protected DatabaseLocalConceptInfoStoreBuilder(ConceptInfoStoreSchema database, TweakSet tweaks, Agenda agenda) throws SQLException { |
| 1213 | + super(database, tweaks, agenda); |
1213 | 1214 | |
1214 | 1215 | Inserter conceptDescriptionInserter = configureTable("concept_description", 64, 1024); |
1215 | 1216 | conceptDescriptionTable = (EntityTable)conceptDescriptionInserter.getTable(); |
— | — | @@ -1267,13 +1268,13 @@ |
1268 | 1269 | @Override |
1269 | 1270 | protected DatabaseConceptInfoStoreBuilder<LocalConcept> newConceptInfoStoreBuilder() throws SQLException { |
1270 | 1271 | ConceptInfoStoreSchema schema = new ConceptInfoStoreSchema(getDatasetIdentifier(), getDatabaseAccess().getConnection(), true, tweaks, false, true); |
1271 | | - return new DatabaseLocalConceptInfoStoreBuilder(schema, tweaks); |
| 1272 | + return new DatabaseLocalConceptInfoStoreBuilder(schema, tweaks, getAgenda()); |
1272 | 1273 | } |
1273 | 1274 | |
1274 | 1275 | @Override |
1275 | 1276 | protected DatabaseStatisticsStoreBuilder newStatisticsStoreBuilder() throws SQLException { |
1276 | 1277 | StatisticsStoreSchema schema = new LocalStatisticsStoreSchema(getDatasetIdentifier(), getDatabaseAccess().getConnection(), tweaks, false); |
1277 | | - return new DatabaseLocalStatisticsStoreBuilder(schema, tweaks); |
| 1278 | + return new DatabaseLocalStatisticsStoreBuilder(schema, tweaks, getAgenda()); |
1278 | 1279 | } |
1279 | 1280 | |
1280 | 1281 | @Override |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/WikiWordStoreBuilder.java |
— | — | @@ -27,6 +27,8 @@ |
28 | 28 | |
29 | 29 | //public abstract void deleteDataAfter(int rcId) throws PersistenceException; |
30 | 30 | |
| 31 | + public abstract Agenda createAgenda() throws PersistenceException; |
| 32 | + |
31 | 33 | public abstract Agenda getAgenda() throws PersistenceException; |
32 | 34 | |
33 | 35 | public abstract void optimize() throws PersistenceException; |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseWikiWordConceptStoreBuilder.java |
— | — | @@ -9,6 +9,7 @@ |
10 | 10 | import java.util.List; |
11 | 11 | import java.util.Map; |
12 | 12 | |
| 13 | +import de.brightbyte.application.Agenda; |
13 | 14 | import de.brightbyte.data.IntList; |
14 | 15 | import de.brightbyte.data.IntRelation; |
15 | 16 | import de.brightbyte.data.cursor.DataSet; |
— | — | @@ -57,8 +58,8 @@ |
58 | 59 | * @param tweaks a tweak set from which additional options can be taken (see description at the top). |
59 | 60 | * @throws SQLException |
60 | 61 | */ |
61 | | - public DatabaseWikiWordConceptStoreBuilder(WikiWordConceptStoreSchema database, TweakSet tweaks) throws SQLException { |
62 | | - super(database, tweaks); |
| 62 | + public DatabaseWikiWordConceptStoreBuilder(WikiWordConceptStoreSchema database, TweakSet tweaks, Agenda agenda) throws SQLException { |
| 63 | + super(database, tweaks, agenda); |
63 | 64 | |
64 | 65 | conceptInserter = configureTable("concept", 256, 32); |
65 | 66 | broaderInserter = configureTable("broader", 1024, 64); |
— | — | @@ -463,8 +464,8 @@ |
464 | 465 | protected EntityTable statsTable; |
465 | 466 | protected EntityTable degreeTable; |
466 | 467 | |
467 | | - protected DatabaseStatisticsStoreBuilder(StatisticsStoreSchema database, TweakSet tweaks) throws SQLException { |
468 | | - super(database, tweaks); |
| 468 | + protected DatabaseStatisticsStoreBuilder(StatisticsStoreSchema database, TweakSet tweaks, Agenda agenda) throws SQLException { |
| 469 | + super(database, tweaks, agenda); |
469 | 470 | |
470 | 471 | //XXX: wen don't need inserters, really... |
471 | 472 | Inserter statsInserter = configureTable("stats", 64, 1024); |
— | — | @@ -764,8 +765,8 @@ |
765 | 766 | |
766 | 767 | protected EntityTable conceptInfoTable; |
767 | 768 | |
768 | | - protected DatabaseConceptInfoStoreBuilder(ConceptInfoStoreSchema database, TweakSet tweaks) throws SQLException { |
769 | | - super(database, tweaks); |
| 769 | + protected DatabaseConceptInfoStoreBuilder(ConceptInfoStoreSchema database, TweakSet tweaks, Agenda agenda) throws SQLException { |
| 770 | + super(database, tweaks, agenda); |
770 | 771 | |
771 | 772 | Inserter conceptInfoInserter = configureTable("concept_info", 64, 1024); |
772 | 773 | conceptInfoTable = (EntityTable)conceptInfoInserter.getTable(); |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseGlobalConceptStoreBuilder.java |
— | — | @@ -69,8 +69,8 @@ |
70 | 70 | * @param dbInfo database connection info, used to connect to the database |
71 | 71 | * @param tweaks a tweak set from which additional options can be taken (see description at the top). |
72 | 72 | */ |
73 | | - public DatabaseGlobalConceptStoreBuilder(DatasetIdentifier set, DataSource dbInfo, TweakSet tweaks) throws SQLException { |
74 | | - this(new GlobalConceptStoreSchema(set, dbInfo, tweaks, true), tweaks); |
| 73 | + public DatabaseGlobalConceptStoreBuilder(DatasetIdentifier set, DataSource dbInfo, TweakSet tweaks, Agenda agenda) throws SQLException { |
| 74 | + this(new GlobalConceptStoreSchema(set, dbInfo, tweaks, true), tweaks, agenda); |
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
— | — | @@ -82,8 +82,8 @@ |
83 | 83 | * @param db a database connection |
84 | 84 | * @param tweaks a tweak set from which additional options can be taken (see description at the top). |
85 | 85 | */ |
86 | | - public DatabaseGlobalConceptStoreBuilder(DatasetIdentifier set, Connection db, TweakSet tweaks) throws SQLException { |
87 | | - this(new GlobalConceptStoreSchema(set, db, tweaks, true), tweaks); |
| 86 | + public DatabaseGlobalConceptStoreBuilder(DatasetIdentifier set, Connection db, TweakSet tweaks, Agenda agenda) throws SQLException { |
| 87 | + this(new GlobalConceptStoreSchema(set, db, tweaks, true), tweaks, agenda); |
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
— | — | @@ -96,8 +96,8 @@ |
97 | 97 | * @param tweaks a tweak set from which additional options can be taken (see description at the top). |
98 | 98 | * @throws SQLException |
99 | 99 | */ |
100 | | - public DatabaseGlobalConceptStoreBuilder(GlobalConceptStoreSchema database, TweakSet tweaks) throws SQLException { |
101 | | - super(database, tweaks); |
| 100 | + public DatabaseGlobalConceptStoreBuilder(GlobalConceptStoreSchema database, TweakSet tweaks, Agenda agenda) throws SQLException { |
| 101 | + super(database, tweaks, agenda); |
102 | 102 | |
103 | 103 | this.tweaks = tweaks; |
104 | 104 | |
— | — | @@ -853,8 +853,8 @@ |
854 | 854 | ///////////////////////////////////////////////////////////////////////////////////////////// |
855 | 855 | protected class DatabaseGlobalStatisticsStoreBuilder extends DatabaseStatisticsStoreBuilder { |
856 | 856 | |
857 | | - protected DatabaseGlobalStatisticsStoreBuilder(StatisticsStoreSchema database, TweakSet tweaks) throws SQLException { |
858 | | - super(database, tweaks); |
| 857 | + protected DatabaseGlobalStatisticsStoreBuilder(StatisticsStoreSchema database, TweakSet tweaks, Agenda agenda) throws SQLException { |
| 858 | + super(database, tweaks, agenda); |
859 | 859 | // TODO Auto-generated constructor stub |
860 | 860 | } |
861 | 861 | |
— | — | @@ -870,8 +870,8 @@ |
871 | 871 | |
872 | 872 | protected class DatabaseGlobalConceptInfoStoreBuilder extends DatabaseConceptInfoStoreBuilder<GlobalConcept> { |
873 | 873 | |
874 | | - protected DatabaseGlobalConceptInfoStoreBuilder(ConceptInfoStoreSchema database, TweakSet tweaks) throws SQLException { |
875 | | - super(database, tweaks); |
| 874 | + protected DatabaseGlobalConceptInfoStoreBuilder(ConceptInfoStoreSchema database, TweakSet tweaks, Agenda agenda) throws SQLException { |
| 875 | + super(database, tweaks, agenda); |
876 | 876 | } |
877 | 877 | |
878 | 878 | @Override |
— | — | @@ -891,13 +891,13 @@ |
892 | 892 | @Override |
893 | 893 | protected DatabaseConceptInfoStoreBuilder<GlobalConcept> newConceptInfoStoreBuilder() throws SQLException { |
894 | 894 | ConceptInfoStoreSchema schema = new ConceptInfoStoreSchema(getDatasetIdentifier(), getDatabaseAccess().getConnection(), false, tweaks, false, false); |
895 | | - return new DatabaseGlobalConceptInfoStoreBuilder(schema, tweaks); |
| 895 | + return new DatabaseGlobalConceptInfoStoreBuilder(schema, tweaks, getAgenda()); |
896 | 896 | } |
897 | 897 | |
898 | 898 | @Override |
899 | 899 | protected DatabaseStatisticsStoreBuilder newStatisticsStoreBuilder() throws SQLException { |
900 | 900 | StatisticsStoreSchema schema = new StatisticsStoreSchema(getDatasetIdentifier(), getDatabaseAccess().getConnection(), true, tweaks, false); |
901 | | - return new DatabaseGlobalStatisticsStoreBuilder(schema, tweaks); |
| 901 | + return new DatabaseGlobalStatisticsStoreBuilder(schema, tweaks, getAgenda()); |
902 | 902 | } |
903 | 903 | |
904 | 904 | @Override |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseConceptStoreBuilders.java |
— | — | @@ -4,6 +4,7 @@ |
5 | 5 | |
6 | 6 | import javax.sql.DataSource; |
7 | 7 | |
| 8 | +import de.brightbyte.application.Agenda; |
8 | 9 | import de.brightbyte.db.DatabaseSchema; |
9 | 10 | import de.brightbyte.util.PersistenceException; |
10 | 11 | import de.brightbyte.wikiword.Corpus; |
— | — | @@ -19,25 +20,27 @@ |
20 | 21 | private DataSource db; |
21 | 22 | private DatasetIdentifier dataset; |
22 | 23 | private TweakSet tweaks; |
| 24 | + private Agenda agenda; |
23 | 25 | private boolean allowCorpus; |
24 | 26 | private boolean allowThesaurus; |
25 | 27 | |
26 | | - public Factory(DataSource db, DatasetIdentifier dataset, TweakSet tweaks, boolean allowCorpus, boolean allowThesaurus) { |
| 28 | + public Factory(DataSource db, DatasetIdentifier dataset, TweakSet tweaks, Agenda agenda, boolean allowCorpus, boolean allowThesaurus) { |
27 | 29 | super(); |
28 | 30 | this.db = db; |
29 | 31 | this.dataset = dataset; |
30 | 32 | this.tweaks = tweaks; |
| 33 | + this.agenda = agenda; |
31 | 34 | this.allowCorpus = allowCorpus; |
32 | 35 | this.allowThesaurus = allowThesaurus; |
33 | 36 | } |
34 | 37 | |
35 | 38 | @SuppressWarnings("unchecked") |
36 | 39 | public DatabaseWikiWordConceptStoreBuilder<C> newStore() throws PersistenceException { |
37 | | - return (DatabaseWikiWordConceptStoreBuilder<C>)createConceptStoreBuilder(db, dataset, tweaks, allowCorpus, allowThesaurus); |
| 40 | + return (DatabaseWikiWordConceptStoreBuilder<C>)createConceptStoreBuilder(db, dataset, tweaks, agenda, allowCorpus, allowThesaurus); |
38 | 41 | } |
39 | 42 | } |
40 | 43 | |
41 | | - public static DatabaseWikiWordConceptStoreBuilder<? extends WikiWordConcept> createConceptStoreBuilder(DataSource db, DatasetIdentifier dataset, TweakSet tweaks, boolean allowCorpus, boolean allowThesaurus) throws PersistenceException { |
| 44 | + public static DatabaseWikiWordConceptStoreBuilder<? extends WikiWordConcept> createConceptStoreBuilder(DataSource db, DatasetIdentifier dataset, TweakSet tweaks, Agenda agenda, boolean allowCorpus, boolean allowThesaurus) throws PersistenceException { |
42 | 45 | //XXX: UGLY HACK! |
43 | 46 | try { |
44 | 47 | DatabaseSchema dummy = new WikiWordStoreSchema(dataset, db, tweaks, false); |
— | — | @@ -57,12 +60,12 @@ |
58 | 61 | if (dataset instanceof Corpus) { |
59 | 62 | if (!allowCorpus) throw new RuntimeException("application is not corpus-based, but a corpus dataset was provided"); |
60 | 63 | |
61 | | - store = new DatabaseLocalConceptStoreBuilder((Corpus)dataset, dummy.getConnection(), tweaks); |
| 64 | + store = new DatabaseLocalConceptStoreBuilder((Corpus)dataset, dummy.getConnection(), tweaks, agenda); |
62 | 65 | } |
63 | 66 | else { |
64 | 67 | if (!allowThesaurus) throw new RuntimeException("application is not corpus, but no corpus dataset was provided"); |
65 | 68 | |
66 | | - store = new DatabaseGlobalConceptStoreBuilder(dataset, dummy.getConnection(), tweaks); |
| 69 | + store = new DatabaseGlobalConceptStoreBuilder(dataset, dummy.getConnection(), tweaks, agenda); |
67 | 70 | } |
68 | 71 | |
69 | 72 | return store; |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/FauxStoreBuilder.java |
— | — | @@ -55,11 +55,15 @@ |
56 | 56 | //noop |
57 | 57 | } |
58 | 58 | |
59 | | - public Agenda getAgenda() throws PersistenceException { |
| 59 | + public Agenda createAgenda() throws PersistenceException { |
60 | 60 | if (agenda==null) agenda = new Agenda(new Agenda.TransientPersistor()); |
61 | 61 | return agenda; |
62 | 62 | } |
63 | 63 | |
| 64 | + public Agenda getAgenda() { |
| 65 | + return agenda; |
| 66 | + } |
| 67 | + |
64 | 68 | public int getNumberOfWarnings() throws PersistenceException { |
65 | 69 | return 0; |
66 | 70 | } |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseTextStoreBuilder.java |
— | — | @@ -49,10 +49,9 @@ |
50 | 50 | } |
51 | 51 | |
52 | 52 | protected DatabaseTextStoreBuilder(LocalConceptStoreSchema conceptStoreSchema, TextStoreSchema database, TweakSet tweaks, Agenda agenda) throws SQLException, PersistenceException { |
53 | | - super(database, tweaks); |
| 53 | + super(database, tweaks, agenda); |
54 | 54 | |
55 | 55 | localConceptDatabase = new LocalConceptStoreSchema(database.getCorpus(), database.getConnection(), tweaks, false); |
56 | | - this.agenda = agenda; |
57 | 56 | |
58 | 57 | //XXX: wen don't need inserters, really... |
59 | 58 | plainTextInserter = configureTable("plaintext", 32, 8*1024); |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabasePropertyStoreBuilder.java |
— | — | @@ -37,7 +37,7 @@ |
38 | 38 | } |
39 | 39 | |
40 | 40 | protected DatabasePropertyStoreBuilder(LocalConceptStoreSchema conceptStoreSchema, PropertyStoreSchema database, TweakSet tweaks, Agenda agenda) throws SQLException, PersistenceException { |
41 | | - super(database, tweaks); |
| 41 | + super(database, tweaks, agenda); |
42 | 42 | |
43 | 43 | //this.conceptStore = conceptStore; |
44 | 44 | |
— | — | @@ -45,7 +45,6 @@ |
46 | 46 | this.propertyTable = (RelationTable)propertyInserter.getTable(); |
47 | 47 | |
48 | 48 | this.conceptStoreSchema = conceptStoreSchema; |
49 | | - this.agenda = agenda; |
50 | 49 | } |
51 | 50 | |
52 | 51 | @Override |