Index: trunk/WikiWord/WikiWordIntegrator/src/main/java/de/brightbyte/wikiword/integrator/AbstractIntegratorApp.java |
— | — | @@ -14,7 +14,6 @@ |
15 | 15 | import java.util.Collection; |
16 | 16 | import java.util.List; |
17 | 17 | import java.util.Map; |
18 | | -import java.util.regex.Pattern; |
19 | 18 | |
20 | 19 | import javax.sql.DataSource; |
21 | 20 | |
— | — | @@ -389,9 +388,9 @@ |
390 | 389 | List<Functor<String, String>> more = sourceDescriptor.getScriptManglers(); |
391 | 390 | if (more!=null) list.addAll(more); |
392 | 391 | |
393 | | - list.add( new SqlScriptRunner.RegularExpressionMangler(Pattern.compile("/\\* *wikiword_prefix* \\*/"), getConfiguredDataset().getDbPrefix()) ); |
394 | | - list.add( new SqlScriptRunner.RegularExpressionMangler(Pattern.compile("/\\* *wikiword_db* \\*/"), getConfiguredDatasetName()) ); |
395 | | - list.add( new SqlScriptRunner.RegularExpressionMangler(Pattern.compile("/\\* *wikiword_target_table* \\*/"), getTargetTableName()) ); |
| 392 | + list.add( SqlScriptRunner.makeCommentSubstitutionMangler("wikiword_prefix", getConfiguredDataset().getDbPrefix()) ); |
| 393 | + list.add( SqlScriptRunner.makeCommentSubstitutionMangler("wikiword_db", getConfiguredDatasetName()) ); |
| 394 | + list.add( SqlScriptRunner.makeCommentSubstitutionMangler("wikiword_target_table", getTargetTableName()) ); |
396 | 395 | |
397 | 396 | return list; |
398 | 397 | } |
Index: trunk/WikiWord/WikiWordIntegrator/src/main/java/de/brightbyte/wikiword/integrator/FeatureSetSourceDescriptor.java |
— | — | @@ -11,6 +11,7 @@ |
12 | 12 | import java.util.regex.Pattern; |
13 | 13 | |
14 | 14 | import de.brightbyte.data.Functor; |
| 15 | +import de.brightbyte.db.SqlScriptRunner; |
15 | 16 | import de.brightbyte.db.SqlScriptRunner.RegularExpressionMangler; |
16 | 17 | import de.brightbyte.text.Chunker; |
17 | 18 | import de.brightbyte.text.CsvLineChunker; |
— | — | @@ -144,9 +145,7 @@ |
145 | 146 | Map<String, String> subst = getTweak("sql-comment-subst", Collections.<String, String>emptyMap()); |
146 | 147 | |
147 | 148 | for (Map.Entry<String, String>e: subst.entrySet()) { |
148 | | - Pattern p = Pattern.compile("/\\* *"+e.getKey()+" *\\*/"); |
149 | | - RegularExpressionMangler m = new RegularExpressionMangler(p, e.getValue()); |
150 | | - manglers.add(m); |
| 149 | + manglers.add(SqlScriptRunner.makeCommentSubstitutionMangler(e.getKey(), e.getValue())); |
151 | 150 | } |
152 | 151 | |
153 | 152 | return manglers; |
Index: trunk/WikiWord/WikiWordIntegrator/src/main/java/de/brightbyte/wikiword/integrator/scriptURL.bsh |
— | — | @@ -0,0 +1,3 @@ |
| 2 | +scriptURL( path ) { |
| 3 | + return new java.net.URL(scriptBaseUrl, path).toString(); |
| 4 | +} |
\ No newline at end of file |
Property changes on: trunk/WikiWord/WikiWordIntegrator/src/main/java/de/brightbyte/wikiword/integrator/scriptURL.bsh |
___________________________________________________________________ |
Added: svn:mergeinfo |
Index: trunk/WikiWord/WikiWordIntegrator/src/main/java/de/brightbyte/wikiword/integrator/RunIntegratorSql.java |
— | — | @@ -12,6 +12,7 @@ |
13 | 13 | import java.util.ArrayList; |
14 | 14 | import java.util.Collection; |
15 | 15 | import java.util.Map; |
| 16 | +import java.util.regex.Matcher; |
16 | 17 | import java.util.regex.Pattern; |
17 | 18 | |
18 | 19 | import javax.sql.DataSource; |
— | — | @@ -123,11 +124,15 @@ |
124 | 125 | |
125 | 126 | for (Map.Entry<Object, String> e: subst.entrySet()) { |
126 | 127 | Object o = e.getKey(); |
127 | | - Pattern p; |
128 | | - if (o instanceof Pattern) p = (Pattern)o; |
129 | | - else p = Pattern.compile("/\\* *"+o+"* \\*/"); |
| 128 | + Functor<String, String> f; |
| 129 | + if (o instanceof Pattern) { |
| 130 | + f = new SqlScriptRunner.RegularExpressionMangler((Pattern)o, Matcher.quoteReplacement(e.getValue())); |
| 131 | + } |
| 132 | + else { |
| 133 | + f = SqlScriptRunner.makeCommentSubstitutionMangler(e.getKey().toString(), e.getValue()); |
| 134 | + } |
130 | 135 | |
131 | | - this.subsitutions.add(new SqlScriptRunner.RegularExpressionMangler(p, e.getValue())); |
| 136 | + this.subsitutions.add(f); |
132 | 137 | } |
133 | 138 | } |
134 | 139 | |
— | — | @@ -246,11 +251,11 @@ |
247 | 252 | |
248 | 253 | if (this.subsitutions!=null) list.addAll(this.subsitutions); |
249 | 254 | |
250 | | - list.add( new SqlScriptRunner.RegularExpressionMangler(Pattern.compile("/\\* *wikiword_prefix* \\*/"), getConfiguredDataset().getDbPrefix()) ); |
251 | | - list.add( new SqlScriptRunner.RegularExpressionMangler(Pattern.compile("/\\* *wikiword_db* \\*/"), getConfiguredDatasetName()) ); |
| 255 | + list.add( SqlScriptRunner.makeCommentSubstitutionMangler("wikiword_prefix", getConfiguredDataset().getDbPrefix()) ); |
| 256 | + list.add( SqlScriptRunner.makeCommentSubstitutionMangler("wikiword_db", getConfiguredDatasetName()) ); |
252 | 257 | |
253 | | - if (getMappingTableName()!=null) list.add( new SqlScriptRunner.RegularExpressionMangler(Pattern.compile("/\\* *wikiword_mapping_table* \\*/"), getMappingTableName()) ); |
254 | | - if (getForeignTableName()!=null) list.add( new SqlScriptRunner.RegularExpressionMangler(Pattern.compile("/\\* *wikiword_foreign_table* \\*/"), getForeignTableName()) ); |
| 258 | + if (getMappingTableName()!=null) list.add( SqlScriptRunner.makeCommentSubstitutionMangler("wikiword_mapping_table", getMappingTableName()) ); |
| 259 | + if (getForeignTableName()!=null) list.add( SqlScriptRunner.makeCommentSubstitutionMangler("wikiword_foreign_table", getForeignTableName()) ); |
255 | 260 | |
256 | 261 | return list; |
257 | 262 | } |
Index: trunk/WikiWord/WikiWordIntegrator/src/main/java/de/brightbyte/wikiword/integrator/RunIntegratorScript.java |
— | — | @@ -99,6 +99,7 @@ |
100 | 100 | i.set("datasource", getConfiguredDataSource()); |
101 | 101 | i.set("scriptManglers", getSqlScriptManglers()); |
102 | 102 | i.set("tablePrefix", getConfiguredDataset().getDbPrefix()); |
| 103 | + i.set("scriptBaseUrl", getInputHelper().getURL(n)); |
103 | 104 | |
104 | 105 | i.eval("import java.util.*;"); |
105 | 106 | i.eval("import de.brightbyte.wikiword.*;"); |
— | — | @@ -120,8 +121,8 @@ |
121 | 122 | protected Collection<Functor<String, String>> getSqlScriptManglers() { |
122 | 123 | ArrayList<Functor<String, String>> list = new ArrayList<Functor<String, String>>(); |
123 | 124 | |
124 | | - list.add( new SqlScriptRunner.RegularExpressionMangler(Pattern.compile("/\\* *wikiword_prefix* \\*/"), getConfiguredDataset().getDbPrefix()) ); |
125 | | - list.add( new SqlScriptRunner.RegularExpressionMangler(Pattern.compile("/\\* *wikiword_db* \\*/"), getConfiguredDatasetName()) ); |
| 125 | + list.add( SqlScriptRunner.makeCommentSubstitutionMangler("wikiword_prefix", getConfiguredDataset().getDbPrefix()) ); |
| 126 | + list.add( SqlScriptRunner.makeCommentSubstitutionMangler("wikiword_db", getConfiguredDatasetName()) ); |
126 | 127 | |
127 | 128 | return list; |
128 | 129 | } |
Index: trunk/WikiWord/WikiWordIntegrator/src/main/java/de/brightbyte/wikiword/integrator/list.sql |
— | — | @@ -1 +1 @@ |
2 | | -SELECT * FROM /* wikiword_prefix *//* wikiword_mapping_table */ /* list_order */ /* list_limit */; |
\ No newline at end of file |
| 2 | +SELECT /* list_fields | * */ FROM /* wikiword_prefix *//* wikiword_mapping_table */ /* list_order */ /* list_limit */; |
\ No newline at end of file |