11package org .fugerit .java .doc .lib .simpletable ;
22
3- import java .io .InputStream ;
43import java .io .OutputStream ;
54
65import org .fugerit .java .core .cfg .ConfigException ;
7- import org .fugerit .java .core .lang .helpers .ClassHelper ;
8- import org .fugerit .java .core .util .filterchain .MiniFilterChain ;
96import org .fugerit .java .doc .base .config .DocException ;
107import org .fugerit .java .doc .base .config .DocInput ;
118import org .fugerit .java .doc .base .config .DocOutput ;
1512import org .fugerit .java .doc .base .process .DocProcessConfig ;
1613import org .fugerit .java .doc .base .process .DocProcessContext ;
1714import org .fugerit .java .doc .base .process .DocProcessData ;
15+ import org .fugerit .java .doc .freemarker .process .FreemarkerDocProcessConfig ;
16+ import org .fugerit .java .doc .freemarker .process .FreemarkerDocProcessConfigFacade ;
1817import org .fugerit .java .doc .lib .simpletable .model .SimpleTable ;
1918
2019public class SimpleTableDocConfig {
2120
22- private final static String CONFIG_PATH = "fj_doc_lib_simpletable/doc-process-config.xml " ;
21+ private static final String CONFIG_ID = "FJ_DOC_LIB_SIMPLETABLE " ;
2322
24- private DocProcessConfig config ;
23+ private FreemarkerDocProcessConfig config ;
2524
26- private SimpleTableDocConfig ( DocProcessConfig config ) {
25+ private SimpleTableDocConfig ( FreemarkerDocProcessConfig config ) {
2726 this .config = config ;
2827 }
2928
3029 public static SimpleTableDocConfig newConfig () throws ConfigException {
31- SimpleTableDocConfig simpleTableDocConfig = null ;
32- try ( InputStream is = ClassHelper .loadFromDefaultClassLoader (CONFIG_PATH ) ) {
33- DocProcessConfig config = DocProcessConfig .loadConfig ( is );
34- simpleTableDocConfig = new SimpleTableDocConfig ( config );
35- } catch (Exception e ) {
36- throw new ConfigException ( "Error creating configuration : " +e , e );
37- }
38- return simpleTableDocConfig ;
30+ FreemarkerDocProcessConfig config = FreemarkerDocProcessConfigFacade .newSimpleConfig ( CONFIG_ID , "/fj_doc_lib_simpletable/template/" );
31+ return new SimpleTableDocConfig (config );
3932 }
4033
4134 public static final String CHAIN_ID_SIMPLE_TABLE = "simple_table" ;
4235
4336 public DocProcessConfig getConfig () {
44- return config ;
37+ return this . config ;
4538 }
4639
4740 private void process ( String chainId , DocProcessContext context , DocProcessData data ) throws Exception {
48- MiniFilterChain chain = this .config .getChainCache ( chainId );
49- chain .apply ( context , data );
41+ this .config .process (CONFIG_ID , CHAIN_ID_SIMPLE_TABLE , context , data );
5042 }
51-
43+
5244 public void processSimpleTable ( SimpleTable simpleTableModel , DocTypeHandler handler , OutputStream os ) throws DocException {
5345 try {
5446 DocProcessData data = new DocProcessData ();
@@ -62,5 +54,5 @@ public void processSimpleTable( SimpleTable simpleTableModel, DocTypeHandler ha
6254 throw new DocException ( "Simple table generation error : " +e , e );
6355 }
6456 }
65-
57+
6658}
0 commit comments