From 9007092832478a0a64f33613346948b18af286c6 Mon Sep 17 00:00:00 2001 From: "Matteo Franci a.k.a. Fugerit" Date: Mon, 17 Jul 2023 21:07:49 +0200 Subject: [PATCH 1/3] Added configuration stub tool Freemarker html type handler converted to new configuration model --- docgen/release-notes.txt | 7 +- .../helper/FreeMarkerDocProcess.java | 9 +- .../FreemarkerDocProcessConfigFacade.java | 13 ++ .../doc/freemarker/tool/GenerateStub.java | 58 +++++++++ .../fm-freemarker-doc-process-config.xml | 43 +++++++ .../fm-process-config.xml | 41 ------- .../freemarker-doc-process-config-stub.ftl | 103 ++++++++++++++++ .../process/TestFreemarkerGenerateStub.java | 29 +++++ fj-doc-tool/pom.xml | 115 ++++++++++++++++++ .../org/fugerit/java/doc/tool/DocTool.java | 66 ++++++++++ .../doc/tool/handler/GenerateStubHandler.java | 34 ++++++ .../resources/help/generate-stub.properties | 9 ++ fj-doc-tool/src/main/resources/log4j2.xml | 13 ++ .../fugerit/java/doc/tool/TestDocTool.java | 26 ++++ .../java/doc/tool/TestGenerateStubTool.java | 22 ++++ fj-doc-tool/src/test/resources/log4j2.xml | 13 ++ .../params-test/generate-stub-001.properties | 3 + .../params-test/generate-stub-002.properties | 10 ++ .../params-test/generate-stub-help.properties | 3 + pom.xml | 1 + 20 files changed, 572 insertions(+), 46 deletions(-) create mode 100644 fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/GenerateStub.java create mode 100644 fj-doc-freemarker/src/main/resources/fj_doc_freemarker_config/fm-freemarker-doc-process-config.xml delete mode 100644 fj-doc-freemarker/src/main/resources/fj_doc_freemarker_config/fm-process-config.xml create mode 100644 fj-doc-freemarker/src/main/resources/fj_doc_freemarker_config/template/freemarker-doc-process-config-stub.ftl create mode 100644 fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerGenerateStub.java create mode 100644 fj-doc-tool/pom.xml create mode 100644 fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/DocTool.java create mode 100644 fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/handler/GenerateStubHandler.java create mode 100644 fj-doc-tool/src/main/resources/help/generate-stub.properties create mode 100644 fj-doc-tool/src/main/resources/log4j2.xml create mode 100644 fj-doc-tool/src/test/java/test/org/fugerit/java/doc/tool/TestDocTool.java create mode 100644 fj-doc-tool/src/test/java/test/org/fugerit/java/doc/tool/TestGenerateStubTool.java create mode 100644 fj-doc-tool/src/test/resources/log4j2.xml create mode 100644 fj-doc-tool/src/test/resources/params-test/generate-stub-001.properties create mode 100644 fj-doc-tool/src/test/resources/params-test/generate-stub-002.properties create mode 100644 fj-doc-tool/src/test/resources/params-test/generate-stub-help.properties diff --git a/docgen/release-notes.txt b/docgen/release-notes.txt index 52b6f9d63..3e8812e1a 100644 --- a/docgen/release-notes.txt +++ b/docgen/release-notes.txt @@ -1,4 +1,9 @@ -1.3.1-rc.002 (2023-07-13) +1.3.X (2023-07-XX) +------------------ ++ Freemarker html type handler converted to new configuration model ++ Configuration stub for freemarker configuration model + +1.3.1-rc.002 (2023-07-13) ------------------ + Updated fj-core version to 8.0.11-rc.002 + Simplified FreemarkerDocProcessConfig diff --git a/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/helper/FreeMarkerDocProcess.java b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/helper/FreeMarkerDocProcess.java index b743ff899..5723d5db6 100644 --- a/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/helper/FreeMarkerDocProcess.java +++ b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/helper/FreeMarkerDocProcess.java @@ -2,7 +2,8 @@ import java.io.Serializable; -import org.fugerit.java.doc.base.process.DocProcessConfig; +import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfig; +import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfigFacade; public class FreeMarkerDocProcess implements Serializable { @@ -11,11 +12,11 @@ public class FreeMarkerDocProcess implements Serializable { */ private static final long serialVersionUID = 1277168639030295400L; - public static final String CONFIG_PATH = "cl://fj_doc_freemarker_config/fm-process-config.xml"; + public static final String CONFIG_PATH = "cl://fj_doc_freemarker_config/fm-freemarker-doc-process-config.xml"; - private static DocProcessConfig INSTANCE = DocProcessConfig.loadConfigSafe( CONFIG_PATH ); + private static FreemarkerDocProcessConfig INSTANCE = FreemarkerDocProcessConfigFacade.loadConfigSafe( CONFIG_PATH ); - public static DocProcessConfig getInstance() { + public static FreemarkerDocProcessConfig getInstance() { return INSTANCE; } diff --git a/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/process/FreemarkerDocProcessConfigFacade.java b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/process/FreemarkerDocProcessConfigFacade.java index e2873319e..947ddf39f 100644 --- a/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/process/FreemarkerDocProcessConfigFacade.java +++ b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/process/FreemarkerDocProcessConfigFacade.java @@ -1,5 +1,6 @@ package org.fugerit.java.doc.freemarker.process; +import java.io.InputStreamReader; import java.io.Reader; import java.util.Properties; @@ -7,9 +8,11 @@ import javax.xml.parsers.DocumentBuilderFactory; import org.fugerit.java.core.cfg.ConfigException; +import org.fugerit.java.core.cfg.ConfigRuntimeException; import org.fugerit.java.core.cfg.ConfigurableObject; import org.fugerit.java.core.cfg.helpers.UnsafeHelper; import org.fugerit.java.core.cfg.xml.XmlBeanHelper; +import org.fugerit.java.core.io.helper.StreamHelper; import org.fugerit.java.core.lang.helpers.ClassHelper; import org.fugerit.java.core.lang.helpers.StringUtils; import org.fugerit.java.core.util.filterchain.MiniFilterBase; @@ -92,6 +95,16 @@ private static DocTypeHandler createHelper( Element docHandlerConfig ) throws Co return res; } + public static FreemarkerDocProcessConfig loadConfigSafe( String configPath ) { + FreemarkerDocProcessConfig config = null; + try ( Reader xmlReader = new InputStreamReader(StreamHelper.resolveStream( configPath ) ) ) { + config = loadConfig(xmlReader); + } catch (Exception e) { + throw new ConfigRuntimeException( e ); + } + return config; + } + public static FreemarkerDocProcessConfig loadConfig( Reader xmlReader ) throws ConfigException { FreemarkerDocProcessConfig result = null; try { diff --git a/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/GenerateStub.java b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/GenerateStub.java new file mode 100644 index 000000000..3f6b09a44 --- /dev/null +++ b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/GenerateStub.java @@ -0,0 +1,58 @@ +package org.fugerit.java.doc.freemarker.tool; + +import java.io.Writer; +import java.util.Properties; + +import org.fugerit.java.core.io.StreamIO; +import org.fugerit.java.doc.base.process.DocProcessContext; +import org.fugerit.java.doc.base.process.DocProcessData; +import org.fugerit.java.doc.freemarker.helper.FreeMarkerDocProcess; + +public class GenerateStub { + + public static final String CONFIG_STUB_CHAIN_ID = "freemarker-doc-process-config-stub"; + + public static final String ATT_STUB_PARAMS = "stubParams"; + + /** + * Enable FOP basic type handler in stub ('1' = enabled, default = '0') + */ + public static final String PARAM_ENABLE_FOP_BASE = "enable-fop-base"; + + /** + * Enable FOP basic type handler in stub ('1' = enabled, default = '0') + */ + public static final String PARAM_ENABLE_FOP_FULL = "enable-fop-full"; + + /** + * Enable POI type handler in stub ('1' = enabled, default = '0') + */ + public static final String PARAM_ENABLE_POI = "enable-poi"; + + /** + * Enable opencsv type handler in stub ('1' = enabled, default = '0') + */ + public static final String PARAM_ENABLE_OPENCSV = "enable-opencsv"; + + /** + * Freemarker config id (default = 'FJ_DOC_STUB') + */ + public static final String PARAM_CONFIG_ID = "config-id"; + + /** + * Freemarker version (default = '2.3.29') + */ + public static final String PARAM_FM_VERSION = "fm-version"; + + /** + * Freemarker template path (default = '/free_marker/') + */ + public static final String PARAM_FM_TEMPLATE_PATH = "fm-template-path"; + + public static void generate( Writer w, Properties params ) throws Exception { + DocProcessData data = new DocProcessData(); + FreeMarkerDocProcess.getInstance().process( CONFIG_STUB_CHAIN_ID, DocProcessContext.newContext( ATT_STUB_PARAMS, params ), data ); + StreamIO.pipeChar( data.getCurrentXmlReader() , w, StreamIO.MODE_CLOSE_IN_ONLY ); + } + +} diff --git a/fj-doc-freemarker/src/main/resources/fj_doc_freemarker_config/fm-freemarker-doc-process-config.xml b/fj-doc-freemarker/src/main/resources/fj_doc_freemarker_config/fm-freemarker-doc-process-config.xml new file mode 100644 index 000000000..98304ae01 --- /dev/null +++ b/fj-doc-freemarker/src/main/resources/fj_doc_freemarker_config/fm-freemarker-doc-process-config.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fj-doc-freemarker/src/main/resources/fj_doc_freemarker_config/fm-process-config.xml b/fj-doc-freemarker/src/main/resources/fj_doc_freemarker_config/fm-process-config.xml deleted file mode 100644 index 632ce7df0..000000000 --- a/fj-doc-freemarker/src/main/resources/fj_doc_freemarker_config/fm-process-config.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/fj-doc-freemarker/src/main/resources/fj_doc_freemarker_config/template/freemarker-doc-process-config-stub.ftl b/fj-doc-freemarker/src/main/resources/fj_doc_freemarker_config/template/freemarker-doc-process-config-stub.ftl new file mode 100644 index 000000000..e35aa1b62 --- /dev/null +++ b/fj-doc-freemarker/src/main/resources/fj_doc_freemarker_config/template/freemarker-doc-process-config-stub.ftl @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + <#assign enableFopBase=stubParams['enable-fop-base']!'0'> + <#assign enableFopFull=stubParams['enable-fop-full']!'0'> + + + + <#if enableFopBase != '1'> --> + + + <#if enableFopBase != '1'> --> + + + + + <#if enableFopFull != '1'> --> + + + + + <#if enableFopFull != '1'> --> + + <#assign enablePoi=stubParams['enable-poi']!'0'> + + + + <#if enablePoi != '1'>--> + + + <#if enablePoi != '1'>--> + + <#assign enableOpencsv=stubParams['enable-opencsv']!'0'> + + + + <#if enableOpencsv != '1'>--> + + + + <#assign configId=stubParams['config-id']!'FJ_DOC_STUB'> + <#assign fmVersion=stubParams['fm-version']!'2.3.29'> + <#assign fmTemplatePath=stubParams['fm-template-path']!'/free_marker/'> + + + + + + + + + + + + + + + + + + diff --git a/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerGenerateStub.java b/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerGenerateStub.java new file mode 100644 index 000000000..d0349515d --- /dev/null +++ b/fj-doc-freemarker/src/test/java/test/org/fugerit/java/doc/freemarker/process/TestFreemarkerGenerateStub.java @@ -0,0 +1,29 @@ +package test.org.fugerit.java.doc.freemarker.process; + +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.FileWriter; +import java.io.Writer; +import java.util.Properties; + +import org.fugerit.java.doc.freemarker.tool.GenerateStub; +import org.junit.Test; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class TestFreemarkerGenerateStub { + + @Test + public void testGenerateStub() { + try ( Writer writer = new FileWriter( new File( "target/freemarker-doc-process-config-stub.xml" ) ) ) { + GenerateStub.generate(writer, new Properties() ); + } catch (Exception e) { + String message = "Error : "+e; + log.error( message, e ); + fail(message); + } + } + +} diff --git a/fj-doc-tool/pom.xml b/fj-doc-tool/pom.xml new file mode 100644 index 000000000..ed31c023e --- /dev/null +++ b/fj-doc-tool/pom.xml @@ -0,0 +1,115 @@ + + 4.0.0 + + fj-doc-tool + + + org.fugerit.java + fj-doc + 1.3.1-rc.002 + + + fj-doc-tool + Fugerit Venus doc tool + + + + Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + 2.3.31 + + + + + + + + + + org.fugerit.java + fj-core + + + + org.fugerit.java + fj-doc-base + + + + org.fugerit.java + fj-doc-freemarker + + + + + + https://www.fugerit.org + Fugerit + + + https://www.fugerit.org/perm/venus/ + + + + + singlepackage + + + org.slf4j + slf4j-api + + + org.apache.logging.log4j + log4j-api + + + org.apache.logging.log4j + log4j-core + + + org.apache.logging.log4j + log4j-slf4j2-impl + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + org.fugerit.java.doc.tool.DocTool + + + + + + org.apache.maven.plugins + maven-shade-plugin + + + package + + shade + + + + + dist-${project.artifactId}-${project.version} + + + + + + + + + diff --git a/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/DocTool.java b/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/DocTool.java new file mode 100644 index 000000000..bfcdac079 --- /dev/null +++ b/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/DocTool.java @@ -0,0 +1,66 @@ +package org.fugerit.java.doc.tool; + +import java.util.Collections; +import java.util.List; +import java.util.Properties; +import java.util.function.Consumer; +import java.util.stream.Collectors; + +import org.fugerit.java.core.cfg.ConfigException; +import org.fugerit.java.core.cli.ArgUtils; +import org.fugerit.java.core.lang.helpers.StringUtils; +import org.fugerit.java.core.util.PropsIO; +import org.fugerit.java.doc.tool.handler.GenerateStubHandler; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class DocTool { + + public static final String ARG_TOOL = "tool"; + + public static final String ARG_HELP = "help"; + + public static final String ARG_TOOL_GENERATE_STUB = "generate-stub"; + + public static void handle( Properties params ) throws Exception { + String toolHandler = params.getProperty( ARG_TOOL ); + if ( StringUtils.isEmpty( toolHandler ) ) { + throw new ConfigException( "Required parameter : "+ARG_TOOL ); + } + Consumer handler = null; + if ( ARG_TOOL_GENERATE_STUB.equalsIgnoreCase( toolHandler ) ) { + handler = new GenerateStubHandler(); + } else { + throw new ConfigException( "Unknown tool : "+toolHandler ); + } + String helpParam = params.getProperty( ARG_HELP ); + if ( helpParam != null ) { + String path = "help/"+toolHandler+".properties"; + Properties helpProps = PropsIO.loadFromClassLoader( path ); + List keySet = helpProps.keySet().stream().map( m -> String.valueOf( m ) ).collect( Collectors.toList() ); + Collections.sort( keySet ); + log.info( "----------------------------------------------------------" ); + log.info( "help params for tool : {}", toolHandler ); + log.info( "----------------------------------------------------------" ); + for ( String k : keySet ) { + log.info( "param : {} -> {}", k, helpProps.getProperty( k ) ); + } + log.info( "----------------------------------------------------------" ); + } else { + handler.accept(params); + } + } + + public static void main( String[] args ) { + log.info( "START" ); + try { + Properties params = ArgUtils.getArgs( args ); + handle(params); + } catch (Exception e) { + log.error( "Error : "+e, e ); + } + log.info( "END" ); + } + +} diff --git a/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/handler/GenerateStubHandler.java b/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/handler/GenerateStubHandler.java new file mode 100644 index 000000000..604680499 --- /dev/null +++ b/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/handler/GenerateStubHandler.java @@ -0,0 +1,34 @@ +package org.fugerit.java.doc.tool.handler; + +import java.io.File; +import java.io.FileWriter; +import java.io.Writer; +import java.util.Properties; +import java.util.function.Consumer; + +import org.fugerit.java.core.cfg.ConfigRuntimeException; +import org.fugerit.java.core.lang.helpers.StringUtils; +import org.fugerit.java.doc.freemarker.tool.GenerateStub; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class GenerateStubHandler implements Consumer { + + public static final String ARG_OUTPUT_FILE = "output"; + + @Override + public void accept(Properties t) { + String output = t.getProperty( ARG_OUTPUT_FILE ); + if ( StringUtils.isEmpty( output ) ) { + throw new ConfigRuntimeException( "Required parameter : "+ARG_OUTPUT_FILE ); + } + log.info( "output file path {}", output ); + try ( Writer w = new FileWriter( new File( output ) ) ) { + GenerateStub.generate( w, t); + } catch (Exception e) { + throw new ConfigRuntimeException( "Error generating stub "+e, e ); + } + } + +} diff --git a/fj-doc-tool/src/main/resources/help/generate-stub.properties b/fj-doc-tool/src/main/resources/help/generate-stub.properties new file mode 100644 index 000000000..9bece7fcf --- /dev/null +++ b/fj-doc-tool/src/main/resources/help/generate-stub.properties @@ -0,0 +1,9 @@ +# additional config params for generate stub helper +output=[required] path to the stub configuration to be generated +enable-fop-base=[default='0'] '1' will enable basic fop type handlers for .fo and .pdf formats +enable-fop-full=[default='0'] '1' will enable full fop type handlers for custon and PDF/A .pdf format (Additional configuration may be required) +enable-poi=[default='0'] '1' will enable xls and xlsx formats +enable-opencsv=[default='0'] '1' will enable xls and xlsx formats +config-id=[default='FJ_DOC_STUB'] The freemarker configuration id to use +fm-version=[default='2.3.29'] +fm-template-path=[default='/free_marker/'] diff --git a/fj-doc-tool/src/main/resources/log4j2.xml b/fj-doc-tool/src/main/resources/log4j2.xml new file mode 100644 index 000000000..51b9129fc --- /dev/null +++ b/fj-doc-tool/src/main/resources/log4j2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/fj-doc-tool/src/test/java/test/org/fugerit/java/doc/tool/TestDocTool.java b/fj-doc-tool/src/test/java/test/org/fugerit/java/doc/tool/TestDocTool.java new file mode 100644 index 000000000..c7bc34543 --- /dev/null +++ b/fj-doc-tool/src/test/java/test/org/fugerit/java/doc/tool/TestDocTool.java @@ -0,0 +1,26 @@ +package test.org.fugerit.java.doc.tool; + +import static org.junit.Assert.fail; + +import java.util.Properties; + +import org.fugerit.java.core.util.PropsIO; +import org.fugerit.java.doc.tool.DocTool; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class TestDocTool { + + protected void docToolWorker( String paramsPath ) { + try { + Properties params = PropsIO.loadFromFile( paramsPath ); + DocTool.handle( params ); + } catch (Exception e) { + String message = "Error : "+e; + log.error( message, e ); + fail( message ); + } + } + +} diff --git a/fj-doc-tool/src/test/java/test/org/fugerit/java/doc/tool/TestGenerateStubTool.java b/fj-doc-tool/src/test/java/test/org/fugerit/java/doc/tool/TestGenerateStubTool.java new file mode 100644 index 000000000..ba1583a84 --- /dev/null +++ b/fj-doc-tool/src/test/java/test/org/fugerit/java/doc/tool/TestGenerateStubTool.java @@ -0,0 +1,22 @@ +package test.org.fugerit.java.doc.tool; + +import org.junit.Test; + +public class TestGenerateStubTool extends TestDocTool { + + @Test + public void testGenerateStub001() { + this.docToolWorker( "src/test/resources/params-test/generate-stub-001.properties" ); + } + + @Test + public void testGenerateStub002() { + this.docToolWorker( "src/test/resources/params-test/generate-stub-002.properties" ); + } + + @Test + public void testGenerateStubHelp() { + this.docToolWorker( "src/test/resources/params-test/generate-stub-help.properties" ); + } + +} diff --git a/fj-doc-tool/src/test/resources/log4j2.xml b/fj-doc-tool/src/test/resources/log4j2.xml new file mode 100644 index 000000000..51b9129fc --- /dev/null +++ b/fj-doc-tool/src/test/resources/log4j2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/fj-doc-tool/src/test/resources/params-test/generate-stub-001.properties b/fj-doc-tool/src/test/resources/params-test/generate-stub-001.properties new file mode 100644 index 000000000..d2ce9a445 --- /dev/null +++ b/fj-doc-tool/src/test/resources/params-test/generate-stub-001.properties @@ -0,0 +1,3 @@ +# test params for generate stub +tool=generate-stub +output=target/freemarker-doc-config-stub-001.xml diff --git a/fj-doc-tool/src/test/resources/params-test/generate-stub-002.properties b/fj-doc-tool/src/test/resources/params-test/generate-stub-002.properties new file mode 100644 index 000000000..32b2f5995 --- /dev/null +++ b/fj-doc-tool/src/test/resources/params-test/generate-stub-002.properties @@ -0,0 +1,10 @@ +# test params for generate stub +tool=generate-stub +output=target/freemarker-doc-config-stub-002.xml +config-id=FJ_DOC_STUB_002 +fm-version=2.3.31 +fm-template-path=/free_marker/ +enable-opencsv=1 +enable-fop-base=1 +enable-fop-full=0 +enable-poi=1 \ No newline at end of file diff --git a/fj-doc-tool/src/test/resources/params-test/generate-stub-help.properties b/fj-doc-tool/src/test/resources/params-test/generate-stub-help.properties new file mode 100644 index 000000000..c2e501225 --- /dev/null +++ b/fj-doc-tool/src/test/resources/params-test/generate-stub-help.properties @@ -0,0 +1,3 @@ +# test params for generate stub +tool=generate-stub +help= \ No newline at end of file diff --git a/pom.xml b/pom.xml index 9de1bca0c..4f62faa24 100644 --- a/pom.xml +++ b/pom.xml @@ -88,6 +88,7 @@ fj-doc-val-pdfbox fj-doc-val-poi fj-doc-val + fj-doc-tool fj-doc-sample fj-doc-bom-core fj-doc-bom-fop From fbec6e4174271225548aa71e7471bc817826f400 Mon Sep 17 00:00:00 2001 From: "Matteo Franci a.k.a. Fugerit" Date: Tue, 18 Jul 2023 21:28:54 +0200 Subject: [PATCH 2/3] Tool converting old config model to new one --- docgen/release-notes.txt | 2 + .../FreemarkerDocProcessConfigFacade.java | 8 +- .../doc/freemarker/tool/ConvertConfig.java | 77 ++++++++++ .../doc/freemarker/tool/GenerateStub.java | 10 ++ .../doc/freemarker/tool/model/ChainModel.java | 23 +++ .../freemarker/tool/model/ConfigModel.java | 20 +++ .../doc/freemarker/tool/model/StepModel.java | 25 ++++ .../fm-freemarker-doc-process-config.xml | 1 + .../freemarker-doc-process-config-stub.ftl | 33 +++++ .../org/fugerit/java/doc/tool/DocTool.java | 5 + .../tool/handler/ConvertConfigHandler.java | 43 ++++++ .../resources/help/convert-config.properties | 12 ++ .../resources/help/generate-stub.properties | 1 + .../java/doc/tool/TestConvertConfigTool.java | 22 +++ .../conver-config-test/doc-process-sample.xml | 135 ++++++++++++++++++ .../conver-config-test/fop-process-config.xml | 29 ++++ .../params-test/convert-config-fop.properties | 5 + .../convert-config-help.properties | 3 + .../convert-config-sample.properties | 8 ++ .../params-test/generate-stub-001.properties | 1 + .../params-test/generate-stub-002.properties | 1 + 21 files changed, 462 insertions(+), 2 deletions(-) create mode 100644 fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/ConvertConfig.java create mode 100644 fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/model/ChainModel.java create mode 100644 fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/model/ConfigModel.java create mode 100644 fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/model/StepModel.java create mode 100644 fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/handler/ConvertConfigHandler.java create mode 100644 fj-doc-tool/src/main/resources/help/convert-config.properties create mode 100644 fj-doc-tool/src/test/java/test/org/fugerit/java/doc/tool/TestConvertConfigTool.java create mode 100644 fj-doc-tool/src/test/resources/conver-config-test/doc-process-sample.xml create mode 100644 fj-doc-tool/src/test/resources/conver-config-test/fop-process-config.xml create mode 100644 fj-doc-tool/src/test/resources/params-test/convert-config-fop.properties create mode 100644 fj-doc-tool/src/test/resources/params-test/convert-config-help.properties create mode 100644 fj-doc-tool/src/test/resources/params-test/convert-config-sample.properties diff --git a/docgen/release-notes.txt b/docgen/release-notes.txt index 3e8812e1a..d7d3f5b4d 100644 --- a/docgen/release-notes.txt +++ b/docgen/release-notes.txt @@ -2,6 +2,8 @@ ------------------ + Freemarker html type handler converted to new configuration model + Configuration stub for freemarker configuration model ++ Tool for stub generation (new maven module fj-doc-tool) ++ Tool converting old config model to new one (new maven module fj-doc-tool) 1.3.1-rc.002 (2023-07-13) ------------------ diff --git a/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/process/FreemarkerDocProcessConfigFacade.java b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/process/FreemarkerDocProcessConfigFacade.java index 947ddf39f..abfabd2f0 100644 --- a/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/process/FreemarkerDocProcessConfigFacade.java +++ b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/process/FreemarkerDocProcessConfigFacade.java @@ -47,6 +47,8 @@ public class FreemarkerDocProcessConfigFacade { public static final String STEP_TYPE_FUNCTION = "function"; + public static final String STEP_TYPE_COMPLEX = "complex"; + public static final String STEP_TYPE_MAP = "map"; public static FreemarkerDocProcessConfig newSimpleConfig( String id, String templatePath ) throws ConfigException { @@ -200,11 +202,13 @@ public static FreemarkerDocProcessConfig loadConfig( Reader xmlReader ) throws C } private static final Properties BUILT_IN_STEPS = new Properties(); + public static final Properties BUILT_IN_STEPS_REVERSE = new Properties(); static { BUILT_IN_STEPS.setProperty( STEP_TYPE_CONFIG , FreeMarkerConfigStep.class.getName() ); BUILT_IN_STEPS.setProperty( STEP_TYPE_FUNCTION , FreeMarkerFunctionStep.class.getName() ); - BUILT_IN_STEPS.setProperty( "complex" , FreeMarkerComplexProcessStep.class.getName() ); - BUILT_IN_STEPS.setProperty( "map" , FreeMarkerMapStep.class.getName() ); + BUILT_IN_STEPS.setProperty( STEP_TYPE_COMPLEX , FreeMarkerComplexProcessStep.class.getName() ); + BUILT_IN_STEPS.setProperty( STEP_TYPE_MAP , FreeMarkerMapStep.class.getName() ); + BUILT_IN_STEPS.keySet().stream().forEach( k -> BUILT_IN_STEPS_REVERSE.put( BUILT_IN_STEPS.get( k ) , k ) ); } private static Properties convertConfiguration( Properties props ) { diff --git a/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/ConvertConfig.java b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/ConvertConfig.java new file mode 100644 index 000000000..a7a998d16 --- /dev/null +++ b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/ConvertConfig.java @@ -0,0 +1,77 @@ +package org.fugerit.java.doc.freemarker.tool; + +import java.io.InputStream; +import java.io.Writer; +import java.util.Properties; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.fugerit.java.core.io.StreamIO; +import org.fugerit.java.doc.base.process.DocProcessContext; +import org.fugerit.java.doc.base.process.DocProcessData; +import org.fugerit.java.doc.freemarker.config.FreeMarkerProcessStep; +import org.fugerit.java.doc.freemarker.helper.FreeMarkerDocProcess; +import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfigFacade; +import org.fugerit.java.doc.freemarker.tool.model.ChainModel; +import org.fugerit.java.doc.freemarker.tool.model.ConfigModel; +import org.fugerit.java.doc.freemarker.tool.model.StepModel; +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.NodeList; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class ConvertConfig { + + public static final String ATT_CONFIG_MODEL = "configModel"; + + public static void generate( InputStream is, Writer out, Properties params ) throws Exception { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setNamespaceAware( true ); + DocumentBuilder parser = dbf.newDocumentBuilder(); + Document inputDoc = parser.parse( is ); + NodeList chainTagList = inputDoc.getDocumentElement().getElementsByTagName( "chain" ); + ConfigModel configModel = new ConfigModel(); + for ( int k=0; k 0 ) { + Element propertyTag = (Element) propertiesTagList.item( 0 ); + NamedNodeMap attMap = propertyTag.getAttributes(); + for ( int j=0; j {}", currentAtt.getName() , currentAtt.getValue() ); + stepModel.getAtts().put( currentAtt.getName() , currentAtt.getValue() ); + } + } + } + } + DocProcessData data = new DocProcessData(); + DocProcessContext context = DocProcessContext.newContext( GenerateStub.ATT_STUB_PARAMS, params ).withAtt( ATT_CONFIG_MODEL , configModel ); + FreeMarkerDocProcess.getInstance().process( GenerateStub.CONFIG_STUB_CHAIN_ID, context, data ); + StreamIO.pipeChar( data.getCurrentXmlReader() , out, StreamIO.MODE_CLOSE_IN_ONLY ); + } + +} diff --git a/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/GenerateStub.java b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/GenerateStub.java index 3f6b09a44..fbb522571 100644 --- a/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/GenerateStub.java +++ b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/GenerateStub.java @@ -13,6 +13,16 @@ public class GenerateStub { public static final String CONFIG_STUB_CHAIN_ID = "freemarker-doc-process-config-stub"; public static final String ATT_STUB_PARAMS = "stubParams"; + + /** + * Generate the docHandlerConfig stub ('1' = enabled, default = '1') + */ + public static final String PARAM_STUB_HANDLER = "stub-handler"; + + /** + * Generate the docChain stub ('0' = enabled, default = '1') + */ + public static final String PARAM_STUB_CHAIN = "stub-chain"; /** * Enable FOP basic type handler in stub ('1' = enabled, default = '0') diff --git a/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/model/ChainModel.java b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/model/ChainModel.java new file mode 100644 index 000000000..d31d6f94a --- /dev/null +++ b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/model/ChainModel.java @@ -0,0 +1,23 @@ +package org.fugerit.java.doc.freemarker.tool.model; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import lombok.Data; + +@Data +public class ChainModel implements Serializable { + + private static final long serialVersionUID = 3421438389573953861L; + + private List stepList; + + private String id; + + public ChainModel( String id ) { + this.setId( id ); + this.stepList = new ArrayList<>(); + } + +} diff --git a/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/model/ConfigModel.java b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/model/ConfigModel.java new file mode 100644 index 000000000..af324a5b4 --- /dev/null +++ b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/model/ConfigModel.java @@ -0,0 +1,20 @@ +package org.fugerit.java.doc.freemarker.tool.model; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import lombok.Data; + +@Data +public class ConfigModel implements Serializable { + + private static final long serialVersionUID = 5198896174327509127L; + + private List chainList; + + public ConfigModel() { + this.chainList = new ArrayList<>(); + } + +} diff --git a/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/model/StepModel.java b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/model/StepModel.java new file mode 100644 index 000000000..8709b4de4 --- /dev/null +++ b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/model/StepModel.java @@ -0,0 +1,25 @@ +package org.fugerit.java.doc.freemarker.tool.model; + +import java.util.LinkedHashMap; +import java.util.Set; + +import lombok.Data; + +@Data +public class StepModel { + + private String type; + + private LinkedHashMap atts; + + public StepModel(String type) { + super(); + this.type = type; + this.atts = new LinkedHashMap<>(); + } + + public Set getAttNames() { + return this.getAtts().keySet(); + } + +} diff --git a/fj-doc-freemarker/src/main/resources/fj_doc_freemarker_config/fm-freemarker-doc-process-config.xml b/fj-doc-freemarker/src/main/resources/fj_doc_freemarker_config/fm-freemarker-doc-process-config.xml index 98304ae01..07ad3eedf 100644 --- a/fj-doc-freemarker/src/main/resources/fj_doc_freemarker_config/fm-freemarker-doc-process-config.xml +++ b/fj-doc-freemarker/src/main/resources/fj_doc_freemarker_config/fm-freemarker-doc-process-config.xml @@ -36,6 +36,7 @@ + diff --git a/fj-doc-freemarker/src/main/resources/fj_doc_freemarker_config/template/freemarker-doc-process-config-stub.ftl b/fj-doc-freemarker/src/main/resources/fj_doc_freemarker_config/template/freemarker-doc-process-config-stub.ftl index e35aa1b62..712abd448 100644 --- a/fj-doc-freemarker/src/main/resources/fj_doc_freemarker_config/template/freemarker-doc-process-config-stub.ftl +++ b/fj-doc-freemarker/src/main/resources/fj_doc_freemarker_config/template/freemarker-doc-process-config-stub.ftl @@ -8,6 +8,9 @@ Configuration stub version : 002 (2023-07-18) --> + <#assign stubHandler=stubParams['stub-handler']!'1'> + <#if stubHandler == '1'> + @@ -74,7 +77,10 @@ <#if enableOpencsv != '1'>--> + + <#assign stubChain=stubParams['stub-chain']!'0'> + <#if stubChain == '1'> <#assign configId=stubParams['config-id']!'FJ_DOC_STUB'> <#assign fmVersion=stubParams['fm-version']!'2.3.29'> <#assign fmTemplatePath=stubParams['fm-template-path']!'/free_marker/'> @@ -99,5 +105,32 @@ --> + + + <#if (configModel)??> + <#list configModel.chainList as chainModel> + + <#list chainModel.stepList as stepModel> + <#list stepModel.attNames as currentAttName> ${currentAttName}="${stepModel.atts[currentAttName]}"> + <#if stepModel.type == 'map'> + <#list stepModel.attNames as currentAttName> + + + <#elseif stepModel.type == 'config'> + + ${currentAttName}="${stepModel.atts[currentAttName]}" + + /> + <#elseif stepModel.type == 'complex'> + <#else> + + + + + + + + diff --git a/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/DocTool.java b/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/DocTool.java index bfcdac079..8f0566485 100644 --- a/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/DocTool.java +++ b/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/DocTool.java @@ -10,6 +10,7 @@ import org.fugerit.java.core.cli.ArgUtils; import org.fugerit.java.core.lang.helpers.StringUtils; import org.fugerit.java.core.util.PropsIO; +import org.fugerit.java.doc.tool.handler.ConvertConfigHandler; import org.fugerit.java.doc.tool.handler.GenerateStubHandler; import lombok.extern.slf4j.Slf4j; @@ -23,6 +24,8 @@ public class DocTool { public static final String ARG_TOOL_GENERATE_STUB = "generate-stub"; + public static final String ARG_TOOL_CONVERT_CONFIG = "convert-config"; + public static void handle( Properties params ) throws Exception { String toolHandler = params.getProperty( ARG_TOOL ); if ( StringUtils.isEmpty( toolHandler ) ) { @@ -31,6 +34,8 @@ public static void handle( Properties params ) throws Exception { Consumer handler = null; if ( ARG_TOOL_GENERATE_STUB.equalsIgnoreCase( toolHandler ) ) { handler = new GenerateStubHandler(); + } else if ( ARG_TOOL_CONVERT_CONFIG.equalsIgnoreCase( toolHandler ) ) { + handler = new ConvertConfigHandler(); } else { throw new ConfigException( "Unknown tool : "+toolHandler ); } diff --git a/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/handler/ConvertConfigHandler.java b/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/handler/ConvertConfigHandler.java new file mode 100644 index 000000000..412f6366a --- /dev/null +++ b/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/handler/ConvertConfigHandler.java @@ -0,0 +1,43 @@ +package org.fugerit.java.doc.tool.handler; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.InputStream; +import java.io.Writer; +import java.util.Properties; +import java.util.function.Consumer; + +import org.fugerit.java.core.cfg.ConfigRuntimeException; +import org.fugerit.java.core.lang.helpers.StringUtils; +import org.fugerit.java.doc.freemarker.tool.ConvertConfig; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class ConvertConfigHandler implements Consumer { + + public static final String ARG_INPUT_FILE = "input"; + + public static final String ARG_OUTPUT_FILE = "output"; + + @Override + public void accept(Properties t) { + String input = t.getProperty( ARG_INPUT_FILE ); + String output = t.getProperty( ARG_OUTPUT_FILE ); + if ( StringUtils.isEmpty( input ) ) { + throw new ConfigRuntimeException( "Required parameter : "+ARG_INPUT_FILE ); + } + if ( StringUtils.isEmpty( output ) ) { + throw new ConfigRuntimeException( "Required parameter : "+ARG_OUTPUT_FILE ); + } + log.info( "input {} / {} output file path", input, output ); + try ( InputStream is = new FileInputStream( new File( input ) ); + Writer w = new FileWriter( new File( output ) ) ) { + ConvertConfig.generate(is, w, t); + } catch (Exception e) { + throw new ConfigRuntimeException( "Error generating stub "+e, e ); + } + } + +} diff --git a/fj-doc-tool/src/main/resources/help/convert-config.properties b/fj-doc-tool/src/main/resources/help/convert-config.properties new file mode 100644 index 000000000..0effa37f4 --- /dev/null +++ b/fj-doc-tool/src/main/resources/help/convert-config.properties @@ -0,0 +1,12 @@ +# additional config params for generate stub helper +output=[required] path to the stub configuration to be generated +input=[required] path to input config file in old model +stub-handler=[default='1'] '1' to add the default handlers configuration to the stub +stub-chain=[default='0'] '1' to add the default chain to the stub +enable-fop-base=[default='0'] '1' will enable basic fop type handlers for .fo and .pdf formats +enable-fop-full=[default='0'] '1' will enable full fop type handlers for custon and PDF/A .pdf format (Additional configuration may be required) +enable-poi=[default='0'] '1' will enable xls and xlsx formats +enable-opencsv=[default='0'] '1' will enable xls and xlsx formats +config-id=[default='FJ_DOC_STUB'] The freemarker configuration id to use +fm-version=[default='2.3.29'] +fm-template-path=[default='/free_marker/'] diff --git a/fj-doc-tool/src/main/resources/help/generate-stub.properties b/fj-doc-tool/src/main/resources/help/generate-stub.properties index 9bece7fcf..35f27036a 100644 --- a/fj-doc-tool/src/main/resources/help/generate-stub.properties +++ b/fj-doc-tool/src/main/resources/help/generate-stub.properties @@ -1,5 +1,6 @@ # additional config params for generate stub helper output=[required] path to the stub configuration to be generated +stub-chain=[default='0'] '1' to add the default chain to the stub enable-fop-base=[default='0'] '1' will enable basic fop type handlers for .fo and .pdf formats enable-fop-full=[default='0'] '1' will enable full fop type handlers for custon and PDF/A .pdf format (Additional configuration may be required) enable-poi=[default='0'] '1' will enable xls and xlsx formats diff --git a/fj-doc-tool/src/test/java/test/org/fugerit/java/doc/tool/TestConvertConfigTool.java b/fj-doc-tool/src/test/java/test/org/fugerit/java/doc/tool/TestConvertConfigTool.java new file mode 100644 index 000000000..5633eabd9 --- /dev/null +++ b/fj-doc-tool/src/test/java/test/org/fugerit/java/doc/tool/TestConvertConfigTool.java @@ -0,0 +1,22 @@ +package test.org.fugerit.java.doc.tool; + +import org.junit.Test; + +public class TestConvertConfigTool extends TestDocTool { + + @Test + public void testConvertConfigFop() { + this.docToolWorker( "src/test/resources/params-test/convert-config-fop.properties" ); + } + + @Test + public void testConvertConfigSample() { + this.docToolWorker( "src/test/resources/params-test/convert-config-sample.properties" ); + } + + @Test + public void testConvertConfigHelp() { + this.docToolWorker( "src/test/resources/params-test/convert-config-help.properties" ); + } + +} diff --git a/fj-doc-tool/src/test/resources/conver-config-test/doc-process-sample.xml b/fj-doc-tool/src/test/resources/conver-config-test/doc-process-sample.xml new file mode 100644 index 000000000..d5202b3be --- /dev/null +++ b/fj-doc-tool/src/test/resources/conver-config-test/doc-process-sample.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/fj-doc-tool/src/test/resources/conver-config-test/fop-process-config.xml b/fj-doc-tool/src/test/resources/conver-config-test/fop-process-config.xml new file mode 100644 index 000000000..e8c2331e1 --- /dev/null +++ b/fj-doc-tool/src/test/resources/conver-config-test/fop-process-config.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/fj-doc-tool/src/test/resources/params-test/convert-config-fop.properties b/fj-doc-tool/src/test/resources/params-test/convert-config-fop.properties new file mode 100644 index 000000000..8908f0e83 --- /dev/null +++ b/fj-doc-tool/src/test/resources/params-test/convert-config-fop.properties @@ -0,0 +1,5 @@ +# test params for generate stub +tool=convert-config +input=src/test/resources/conver-config-test/fop-process-config.xml +output=target/fop-new-process-config.xml +stub-handler=0 \ No newline at end of file diff --git a/fj-doc-tool/src/test/resources/params-test/convert-config-help.properties b/fj-doc-tool/src/test/resources/params-test/convert-config-help.properties new file mode 100644 index 000000000..49c9a852f --- /dev/null +++ b/fj-doc-tool/src/test/resources/params-test/convert-config-help.properties @@ -0,0 +1,3 @@ +# test params for generate stub +tool=convert-config +help= \ No newline at end of file diff --git a/fj-doc-tool/src/test/resources/params-test/convert-config-sample.properties b/fj-doc-tool/src/test/resources/params-test/convert-config-sample.properties new file mode 100644 index 000000000..a90e9b131 --- /dev/null +++ b/fj-doc-tool/src/test/resources/params-test/convert-config-sample.properties @@ -0,0 +1,8 @@ +# test params for generate stub +tool=convert-config +input=src/test/resources/conver-config-test/doc-process-sample.xml +output=target/sample-new-process-config.xml +enable-opencsv=1 +enable-fop-base=1 +enable-fop-full=0 +enable-poi=1 \ No newline at end of file diff --git a/fj-doc-tool/src/test/resources/params-test/generate-stub-001.properties b/fj-doc-tool/src/test/resources/params-test/generate-stub-001.properties index d2ce9a445..71cc95496 100644 --- a/fj-doc-tool/src/test/resources/params-test/generate-stub-001.properties +++ b/fj-doc-tool/src/test/resources/params-test/generate-stub-001.properties @@ -1,3 +1,4 @@ # test params for generate stub tool=generate-stub output=target/freemarker-doc-config-stub-001.xml +stub-chain=1 \ No newline at end of file diff --git a/fj-doc-tool/src/test/resources/params-test/generate-stub-002.properties b/fj-doc-tool/src/test/resources/params-test/generate-stub-002.properties index 32b2f5995..896498c38 100644 --- a/fj-doc-tool/src/test/resources/params-test/generate-stub-002.properties +++ b/fj-doc-tool/src/test/resources/params-test/generate-stub-002.properties @@ -1,6 +1,7 @@ # test params for generate stub tool=generate-stub output=target/freemarker-doc-config-stub-002.xml +stub-chain=1 config-id=FJ_DOC_STUB_002 fm-version=2.3.31 fm-template-path=/free_marker/ From bafe47320c6ab23bfc5fc0a5e7b367cb5225f283 Mon Sep 17 00:00:00 2001 From: "Matteo Franci a.k.a. Fugerit" Date: Wed, 19 Jul 2023 00:28:03 +0200 Subject: [PATCH 3/3] 1.3.1-rc.003 (2023-07-18) + Freemarker html type handler converted to new configuration model + Configuration stub for freemarker configuration model + Tool for stub generation and conversion from old model (new maven module fj-doc-tool) --- docgen/parameters.json | 4 +- docgen/release-notes.txt | 5 +-- fj-doc-base-json/pom.xml | 2 +- fj-doc-base-yaml/pom.xml | 2 +- fj-doc-base/pom.xml | 2 +- fj-doc-bom-core/pom.xml | 2 +- fj-doc-bom-fop/pom.xml | 2 +- fj-doc-freemarker/pom.xml | 2 +- .../doc/freemarker/tool/GenerateStub.java | 38 ++++++++++++++-- ...nvertConfig.java => LegacyConfigRead.java} | 19 ++------ fj-doc-lib-autodoc/pom.xml | 2 +- fj-doc-lib-simpletable-import/pom.xml | 2 +- fj-doc-lib-simpletable/pom.xml | 2 +- fj-doc-mod-fop/pom.xml | 2 +- fj-doc-mod-opencsv/pom.xml | 2 +- fj-doc-mod-poi/pom.xml | 2 +- fj-doc-playground-quarkus/pom.xml | 2 +- fj-doc-sample/pom.xml | 2 +- fj-doc-tool/CHANGELOG.md | 4 ++ fj-doc-tool/README.md | 45 +++++++++++++++++++ fj-doc-tool/pom.xml | 2 +- .../org/fugerit/java/doc/tool/DocTool.java | 5 --- .../tool/handler/ConvertConfigHandler.java | 43 ------------------ .../doc/tool/handler/GenerateStubHandler.java | 4 +- .../resources/help/convert-config.properties | 12 ----- .../resources/help/generate-stub.properties | 2 + .../doc-process-sample.xml | 0 .../fop-process-config.xml | 0 .../params-test/convert-config-fop.properties | 4 +- .../convert-config-help.properties | 2 +- .../convert-config-sample.properties | 4 +- fj-doc-val-core/pom.xml | 2 +- fj-doc-val-pdfbox/pom.xml | 2 +- fj-doc-val-poi/pom.xml | 2 +- fj-doc-val/pom.xml | 2 +- pom.xml | 2 +- 36 files changed, 120 insertions(+), 111 deletions(-) rename fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/{ConvertConfig.java => LegacyConfigRead.java} (77%) create mode 100644 fj-doc-tool/CHANGELOG.md create mode 100644 fj-doc-tool/README.md delete mode 100644 fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/handler/ConvertConfigHandler.java delete mode 100644 fj-doc-tool/src/main/resources/help/convert-config.properties rename fj-doc-tool/src/test/resources/{conver-config-test => convert-config-test}/doc-process-sample.xml (100%) rename fj-doc-tool/src/test/resources/{conver-config-test => convert-config-test}/fop-process-config.xml (100%) diff --git a/docgen/parameters.json b/docgen/parameters.json index 12b0f3538..9bce82177 100644 --- a/docgen/parameters.json +++ b/docgen/parameters.json @@ -1,8 +1,8 @@ { "title" : "Venus (Fugerit Document Generation Framework)", "name": "Venus", - "version" : "1.3.1-rc.002", - "date" : "14/07/2023", + "version" : "1.3.1-rc.003", + "date" : "18/07/2023", "organization" : { "name" : "Fugerit Org", "url" : "https://www.fugerit.org" diff --git a/docgen/release-notes.txt b/docgen/release-notes.txt index d7d3f5b4d..323b7db96 100644 --- a/docgen/release-notes.txt +++ b/docgen/release-notes.txt @@ -1,9 +1,8 @@ -1.3.X (2023-07-XX) +1.3.1-rc.003 (2023-07-18) ------------------ + Freemarker html type handler converted to new configuration model + Configuration stub for freemarker configuration model -+ Tool for stub generation (new maven module fj-doc-tool) -+ Tool converting old config model to new one (new maven module fj-doc-tool) ++ Tool for stub generation and conversion from old model (new maven module fj-doc-tool) 1.3.1-rc.002 (2023-07-13) ------------------ diff --git a/fj-doc-base-json/pom.xml b/fj-doc-base-json/pom.xml index f7b103f5a..5d2152096 100644 --- a/fj-doc-base-json/pom.xml +++ b/fj-doc-base-json/pom.xml @@ -7,7 +7,7 @@ org.fugerit.java fj-doc - 1.3.1-rc.002 + 1.3.1-rc.003 fj-doc-base-json diff --git a/fj-doc-base-yaml/pom.xml b/fj-doc-base-yaml/pom.xml index 2613dff5c..d3d34b0d8 100644 --- a/fj-doc-base-yaml/pom.xml +++ b/fj-doc-base-yaml/pom.xml @@ -7,7 +7,7 @@ org.fugerit.java fj-doc - 1.3.1-rc.002 + 1.3.1-rc.003 fj-doc-base-yaml diff --git a/fj-doc-base/pom.xml b/fj-doc-base/pom.xml index b68e41079..73feb445f 100644 --- a/fj-doc-base/pom.xml +++ b/fj-doc-base/pom.xml @@ -7,7 +7,7 @@ org.fugerit.java fj-doc - 1.3.1-rc.002 + 1.3.1-rc.003 fj-doc-base diff --git a/fj-doc-bom-core/pom.xml b/fj-doc-bom-core/pom.xml index 1fe3a0217..98447d171 100644 --- a/fj-doc-bom-core/pom.xml +++ b/fj-doc-bom-core/pom.xml @@ -7,7 +7,7 @@ org.fugerit.java fj-doc - 1.3.1-rc.002 + 1.3.1-rc.003 fj-doc-bom-core diff --git a/fj-doc-bom-fop/pom.xml b/fj-doc-bom-fop/pom.xml index 79c5f2786..2d87f7f66 100644 --- a/fj-doc-bom-fop/pom.xml +++ b/fj-doc-bom-fop/pom.xml @@ -7,7 +7,7 @@ org.fugerit.java fj-doc - 1.3.1-rc.002 + 1.3.1-rc.003 fj-doc-bom-fop diff --git a/fj-doc-freemarker/pom.xml b/fj-doc-freemarker/pom.xml index dd8595d40..fa3ef5b09 100644 --- a/fj-doc-freemarker/pom.xml +++ b/fj-doc-freemarker/pom.xml @@ -7,7 +7,7 @@ org.fugerit.java fj-doc - 1.3.1-rc.002 + 1.3.1-rc.003 fj-doc-freemarker diff --git a/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/GenerateStub.java b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/GenerateStub.java index fbb522571..11717e423 100644 --- a/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/GenerateStub.java +++ b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/GenerateStub.java @@ -1,15 +1,25 @@ package org.fugerit.java.doc.freemarker.tool; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; import java.io.Writer; import java.util.Properties; import org.fugerit.java.core.io.StreamIO; +import org.fugerit.java.core.lang.helpers.StringUtils; import org.fugerit.java.doc.base.process.DocProcessContext; import org.fugerit.java.doc.base.process.DocProcessData; import org.fugerit.java.doc.freemarker.helper.FreeMarkerDocProcess; +import org.fugerit.java.doc.freemarker.tool.model.ConfigModel; -public class GenerateStub { +import lombok.extern.slf4j.Slf4j; +@Slf4j +public class GenerateStub { + + public static final String ATT_CONFIG_MODEL = "configModel"; + public static final String CONFIG_STUB_CHAIN_ID = "freemarker-doc-process-config-stub"; public static final String ATT_STUB_PARAMS = "stubParams"; @@ -59,10 +69,30 @@ public class GenerateStub { */ public static final String PARAM_FM_TEMPLATE_PATH = "fm-template-path"; - public static void generate( Writer w, Properties params ) throws Exception { + public static final String ARG_INPUT_FILE = "input"; + + public static void generate( Writer out, Properties params ) throws Exception { + String input = params.getProperty(ARG_INPUT_FILE); + if ( StringUtils.isNotEmpty( input ) ) { + try ( InputStream is = new FileInputStream( new File( input ) ) ) { + generate(out, params, is); + } + } else { + generate(out, params, null); + } + } + + public static void generate( Writer out, Properties params, InputStream is ) throws Exception { + ConfigModel configModel = null; DocProcessData data = new DocProcessData(); - FreeMarkerDocProcess.getInstance().process( CONFIG_STUB_CHAIN_ID, DocProcessContext.newContext( ATT_STUB_PARAMS, params ), data ); - StreamIO.pipeChar( data.getCurrentXmlReader() , w, StreamIO.MODE_CLOSE_IN_ONLY ); + DocProcessContext context = DocProcessContext.newContext( ATT_STUB_PARAMS, params ); + if ( is != null ) { + log.info( "read legacy config model" ); + configModel = LegacyConfigRead.readConfig(is); + context = context.withAtt( ATT_CONFIG_MODEL , configModel ); + } + FreeMarkerDocProcess.getInstance().process( CONFIG_STUB_CHAIN_ID, context, data ); + StreamIO.pipeChar( data.getCurrentXmlReader() , out, StreamIO.MODE_CLOSE_IN_ONLY ); } } diff --git a/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/ConvertConfig.java b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/LegacyConfigRead.java similarity index 77% rename from fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/ConvertConfig.java rename to fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/LegacyConfigRead.java index a7a998d16..082b9dbd7 100644 --- a/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/ConvertConfig.java +++ b/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/LegacyConfigRead.java @@ -1,17 +1,11 @@ package org.fugerit.java.doc.freemarker.tool; import java.io.InputStream; -import java.io.Writer; -import java.util.Properties; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import org.fugerit.java.core.io.StreamIO; -import org.fugerit.java.doc.base.process.DocProcessContext; -import org.fugerit.java.doc.base.process.DocProcessData; import org.fugerit.java.doc.freemarker.config.FreeMarkerProcessStep; -import org.fugerit.java.doc.freemarker.helper.FreeMarkerDocProcess; import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfigFacade; import org.fugerit.java.doc.freemarker.tool.model.ChainModel; import org.fugerit.java.doc.freemarker.tool.model.ConfigModel; @@ -25,11 +19,9 @@ import lombok.extern.slf4j.Slf4j; @Slf4j -public class ConvertConfig { - - public static final String ATT_CONFIG_MODEL = "configModel"; - - public static void generate( InputStream is, Writer out, Properties params ) throws Exception { +public class LegacyConfigRead { + + public static ConfigModel readConfig( InputStream is ) throws Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware( true ); DocumentBuilder parser = dbf.newDocumentBuilder(); @@ -68,10 +60,7 @@ public static void generate( InputStream is, Writer out, Properties params ) thr } } } - DocProcessData data = new DocProcessData(); - DocProcessContext context = DocProcessContext.newContext( GenerateStub.ATT_STUB_PARAMS, params ).withAtt( ATT_CONFIG_MODEL , configModel ); - FreeMarkerDocProcess.getInstance().process( GenerateStub.CONFIG_STUB_CHAIN_ID, context, data ); - StreamIO.pipeChar( data.getCurrentXmlReader() , out, StreamIO.MODE_CLOSE_IN_ONLY ); + return configModel; } } diff --git a/fj-doc-lib-autodoc/pom.xml b/fj-doc-lib-autodoc/pom.xml index 2b637eeab..e2cf842d6 100644 --- a/fj-doc-lib-autodoc/pom.xml +++ b/fj-doc-lib-autodoc/pom.xml @@ -7,7 +7,7 @@ org.fugerit.java fj-doc - 1.3.1-rc.002 + 1.3.1-rc.003 fj-doc-lib-autodoc diff --git a/fj-doc-lib-simpletable-import/pom.xml b/fj-doc-lib-simpletable-import/pom.xml index 6404d73d7..f22f00a38 100644 --- a/fj-doc-lib-simpletable-import/pom.xml +++ b/fj-doc-lib-simpletable-import/pom.xml @@ -7,7 +7,7 @@ org.fugerit.java fj-doc - 1.3.1-rc.002 + 1.3.1-rc.003 fj-doc-lib-simpletable-import diff --git a/fj-doc-lib-simpletable/pom.xml b/fj-doc-lib-simpletable/pom.xml index b6884f066..1aa63b469 100644 --- a/fj-doc-lib-simpletable/pom.xml +++ b/fj-doc-lib-simpletable/pom.xml @@ -7,7 +7,7 @@ org.fugerit.java fj-doc - 1.3.1-rc.002 + 1.3.1-rc.003 fj-doc-lib-simpletable diff --git a/fj-doc-mod-fop/pom.xml b/fj-doc-mod-fop/pom.xml index c5a03063f..2ebecb443 100644 --- a/fj-doc-mod-fop/pom.xml +++ b/fj-doc-mod-fop/pom.xml @@ -7,7 +7,7 @@ org.fugerit.java fj-doc - 1.3.1-rc.002 + 1.3.1-rc.003 fj-doc-mod-fop diff --git a/fj-doc-mod-opencsv/pom.xml b/fj-doc-mod-opencsv/pom.xml index 6783e890b..295422f24 100644 --- a/fj-doc-mod-opencsv/pom.xml +++ b/fj-doc-mod-opencsv/pom.xml @@ -7,7 +7,7 @@ org.fugerit.java fj-doc - 1.3.1-rc.002 + 1.3.1-rc.003 fj-doc-mod-opencsv diff --git a/fj-doc-mod-poi/pom.xml b/fj-doc-mod-poi/pom.xml index 35ab24be1..13c13b676 100644 --- a/fj-doc-mod-poi/pom.xml +++ b/fj-doc-mod-poi/pom.xml @@ -7,7 +7,7 @@ org.fugerit.java fj-doc - 1.3.1-rc.002 + 1.3.1-rc.003 fj-doc-mod-poi diff --git a/fj-doc-playground-quarkus/pom.xml b/fj-doc-playground-quarkus/pom.xml index 39dddaeb5..f0adc6771 100644 --- a/fj-doc-playground-quarkus/pom.xml +++ b/fj-doc-playground-quarkus/pom.xml @@ -4,7 +4,7 @@ org.fugerit.java fj-doc - 1.3.1-rc.002 + 1.3.1-rc.003 fj-doc-playground-quarkus diff --git a/fj-doc-sample/pom.xml b/fj-doc-sample/pom.xml index 0e9466efd..fe614d860 100644 --- a/fj-doc-sample/pom.xml +++ b/fj-doc-sample/pom.xml @@ -7,7 +7,7 @@ org.fugerit.java fj-doc - 1.3.1-rc.002 + 1.3.1-rc.003 fj-doc-sample diff --git a/fj-doc-tool/CHANGELOG.md b/fj-doc-tool/CHANGELOG.md new file mode 100644 index 000000000..823d96f48 --- /dev/null +++ b/fj-doc-tool/CHANGELOG.md @@ -0,0 +1,4 @@ +# Changelog for module fj-doc-tool + +## version 1.3.1-rc.003 +* generate-stub tool \ No newline at end of file diff --git a/fj-doc-tool/README.md b/fj-doc-tool/README.md new file mode 100644 index 000000000..82b041eca --- /dev/null +++ b/fj-doc-tool/README.md @@ -0,0 +1,45 @@ +# Fugerit Document Generation Framework (fj-doc) + +## Doc tool - utilities (fj-doc-tool) + +[back to fj-doc index](../README.md) + +*Description* : +This modules contains useful tools for the Venus Doc Generation Framework + +*Status* : +generate-stub tool implemented (allows generation of stub configuration of the new freemarker doc process config) + +*[ChangeLog](CHANGELOG.md)* + +*Quickstart* : + +Build : + +``` +mvn clean install -P singlepackage +``` + +Run (sample) : + +``` +java -jar target/dist-fj-doc-tool-1.3.1-rc.002.jar \ + --tool generate-stub \ + --input src/test/resources/convert-config-test/doc-process-sample.xml \ + --output target/new-config.xml +``` + +## reference parameters for tool : generate-stub + +1. output=[required] path to the stub configuration to be generated +2. input=[optional] path to input config file in old model +3. stub-handler=[default='1'] '1' to add the default handlers configuration to the stub +4. stub-chain=[default='0'] '1' to add the default chain to the stub +5. enable-fop-base=[default='0'] '1' will enable basic fop type handlers for .fo and .pdf formats +6. enable-fop-full=[default='0'] '1' will enable full fop type handlers for custon and PDF/A .pdf format (Additional configuration may be required) +7. enable-poi=[default='0'] '1' will enable xls and xlsx formats +8. enable-opencsv=[default='0'] '1' will enable xls and xlsx formats +9. config-id=[default='FJ_DOC_STUB'] The freemarker configuration id to use +10. fm-version=[default='2.3.29'] +11. fm-template-path=[default='/free_marker/'] + diff --git a/fj-doc-tool/pom.xml b/fj-doc-tool/pom.xml index ed31c023e..1e8b77b41 100644 --- a/fj-doc-tool/pom.xml +++ b/fj-doc-tool/pom.xml @@ -7,7 +7,7 @@ org.fugerit.java fj-doc - 1.3.1-rc.002 + 1.3.1-rc.003 fj-doc-tool diff --git a/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/DocTool.java b/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/DocTool.java index 8f0566485..bfcdac079 100644 --- a/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/DocTool.java +++ b/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/DocTool.java @@ -10,7 +10,6 @@ import org.fugerit.java.core.cli.ArgUtils; import org.fugerit.java.core.lang.helpers.StringUtils; import org.fugerit.java.core.util.PropsIO; -import org.fugerit.java.doc.tool.handler.ConvertConfigHandler; import org.fugerit.java.doc.tool.handler.GenerateStubHandler; import lombok.extern.slf4j.Slf4j; @@ -24,8 +23,6 @@ public class DocTool { public static final String ARG_TOOL_GENERATE_STUB = "generate-stub"; - public static final String ARG_TOOL_CONVERT_CONFIG = "convert-config"; - public static void handle( Properties params ) throws Exception { String toolHandler = params.getProperty( ARG_TOOL ); if ( StringUtils.isEmpty( toolHandler ) ) { @@ -34,8 +31,6 @@ public static void handle( Properties params ) throws Exception { Consumer handler = null; if ( ARG_TOOL_GENERATE_STUB.equalsIgnoreCase( toolHandler ) ) { handler = new GenerateStubHandler(); - } else if ( ARG_TOOL_CONVERT_CONFIG.equalsIgnoreCase( toolHandler ) ) { - handler = new ConvertConfigHandler(); } else { throw new ConfigException( "Unknown tool : "+toolHandler ); } diff --git a/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/handler/ConvertConfigHandler.java b/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/handler/ConvertConfigHandler.java deleted file mode 100644 index 412f6366a..000000000 --- a/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/handler/ConvertConfigHandler.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.fugerit.java.doc.tool.handler; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileWriter; -import java.io.InputStream; -import java.io.Writer; -import java.util.Properties; -import java.util.function.Consumer; - -import org.fugerit.java.core.cfg.ConfigRuntimeException; -import org.fugerit.java.core.lang.helpers.StringUtils; -import org.fugerit.java.doc.freemarker.tool.ConvertConfig; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -public class ConvertConfigHandler implements Consumer { - - public static final String ARG_INPUT_FILE = "input"; - - public static final String ARG_OUTPUT_FILE = "output"; - - @Override - public void accept(Properties t) { - String input = t.getProperty( ARG_INPUT_FILE ); - String output = t.getProperty( ARG_OUTPUT_FILE ); - if ( StringUtils.isEmpty( input ) ) { - throw new ConfigRuntimeException( "Required parameter : "+ARG_INPUT_FILE ); - } - if ( StringUtils.isEmpty( output ) ) { - throw new ConfigRuntimeException( "Required parameter : "+ARG_OUTPUT_FILE ); - } - log.info( "input {} / {} output file path", input, output ); - try ( InputStream is = new FileInputStream( new File( input ) ); - Writer w = new FileWriter( new File( output ) ) ) { - ConvertConfig.generate(is, w, t); - } catch (Exception e) { - throw new ConfigRuntimeException( "Error generating stub "+e, e ); - } - } - -} diff --git a/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/handler/GenerateStubHandler.java b/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/handler/GenerateStubHandler.java index 604680499..66ad1a220 100644 --- a/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/handler/GenerateStubHandler.java +++ b/fj-doc-tool/src/main/java/org/fugerit/java/doc/tool/handler/GenerateStubHandler.java @@ -23,9 +23,9 @@ public void accept(Properties t) { if ( StringUtils.isEmpty( output ) ) { throw new ConfigRuntimeException( "Required parameter : "+ARG_OUTPUT_FILE ); } - log.info( "output file path {}", output ); + log.info( "output file path : {}", output ); try ( Writer w = new FileWriter( new File( output ) ) ) { - GenerateStub.generate( w, t); + GenerateStub.generate( w, t ); } catch (Exception e) { throw new ConfigRuntimeException( "Error generating stub "+e, e ); } diff --git a/fj-doc-tool/src/main/resources/help/convert-config.properties b/fj-doc-tool/src/main/resources/help/convert-config.properties deleted file mode 100644 index 0effa37f4..000000000 --- a/fj-doc-tool/src/main/resources/help/convert-config.properties +++ /dev/null @@ -1,12 +0,0 @@ -# additional config params for generate stub helper -output=[required] path to the stub configuration to be generated -input=[required] path to input config file in old model -stub-handler=[default='1'] '1' to add the default handlers configuration to the stub -stub-chain=[default='0'] '1' to add the default chain to the stub -enable-fop-base=[default='0'] '1' will enable basic fop type handlers for .fo and .pdf formats -enable-fop-full=[default='0'] '1' will enable full fop type handlers for custon and PDF/A .pdf format (Additional configuration may be required) -enable-poi=[default='0'] '1' will enable xls and xlsx formats -enable-opencsv=[default='0'] '1' will enable xls and xlsx formats -config-id=[default='FJ_DOC_STUB'] The freemarker configuration id to use -fm-version=[default='2.3.29'] -fm-template-path=[default='/free_marker/'] diff --git a/fj-doc-tool/src/main/resources/help/generate-stub.properties b/fj-doc-tool/src/main/resources/help/generate-stub.properties index 35f27036a..b757d801c 100644 --- a/fj-doc-tool/src/main/resources/help/generate-stub.properties +++ b/fj-doc-tool/src/main/resources/help/generate-stub.properties @@ -1,5 +1,7 @@ # additional config params for generate stub helper output=[required] path to the stub configuration to be generated +input=[optional] path to input config file in old model +stub-handler=[default='1'] '1' to add the default handlers configuration to the stub stub-chain=[default='0'] '1' to add the default chain to the stub enable-fop-base=[default='0'] '1' will enable basic fop type handlers for .fo and .pdf formats enable-fop-full=[default='0'] '1' will enable full fop type handlers for custon and PDF/A .pdf format (Additional configuration may be required) diff --git a/fj-doc-tool/src/test/resources/conver-config-test/doc-process-sample.xml b/fj-doc-tool/src/test/resources/convert-config-test/doc-process-sample.xml similarity index 100% rename from fj-doc-tool/src/test/resources/conver-config-test/doc-process-sample.xml rename to fj-doc-tool/src/test/resources/convert-config-test/doc-process-sample.xml diff --git a/fj-doc-tool/src/test/resources/conver-config-test/fop-process-config.xml b/fj-doc-tool/src/test/resources/convert-config-test/fop-process-config.xml similarity index 100% rename from fj-doc-tool/src/test/resources/conver-config-test/fop-process-config.xml rename to fj-doc-tool/src/test/resources/convert-config-test/fop-process-config.xml diff --git a/fj-doc-tool/src/test/resources/params-test/convert-config-fop.properties b/fj-doc-tool/src/test/resources/params-test/convert-config-fop.properties index 8908f0e83..6dc17d469 100644 --- a/fj-doc-tool/src/test/resources/params-test/convert-config-fop.properties +++ b/fj-doc-tool/src/test/resources/params-test/convert-config-fop.properties @@ -1,5 +1,5 @@ # test params for generate stub -tool=convert-config -input=src/test/resources/conver-config-test/fop-process-config.xml +tool=generate-stub +input=src/test/resources/convert-config-test/fop-process-config.xml output=target/fop-new-process-config.xml stub-handler=0 \ No newline at end of file diff --git a/fj-doc-tool/src/test/resources/params-test/convert-config-help.properties b/fj-doc-tool/src/test/resources/params-test/convert-config-help.properties index 49c9a852f..c2e501225 100644 --- a/fj-doc-tool/src/test/resources/params-test/convert-config-help.properties +++ b/fj-doc-tool/src/test/resources/params-test/convert-config-help.properties @@ -1,3 +1,3 @@ # test params for generate stub -tool=convert-config +tool=generate-stub help= \ No newline at end of file diff --git a/fj-doc-tool/src/test/resources/params-test/convert-config-sample.properties b/fj-doc-tool/src/test/resources/params-test/convert-config-sample.properties index a90e9b131..b2b60f666 100644 --- a/fj-doc-tool/src/test/resources/params-test/convert-config-sample.properties +++ b/fj-doc-tool/src/test/resources/params-test/convert-config-sample.properties @@ -1,6 +1,6 @@ # test params for generate stub -tool=convert-config -input=src/test/resources/conver-config-test/doc-process-sample.xml +tool=generate-stub +input=src/test/resources/convert-config-test/doc-process-sample.xml output=target/sample-new-process-config.xml enable-opencsv=1 enable-fop-base=1 diff --git a/fj-doc-val-core/pom.xml b/fj-doc-val-core/pom.xml index e0b0a4a08..25ac0728b 100644 --- a/fj-doc-val-core/pom.xml +++ b/fj-doc-val-core/pom.xml @@ -7,7 +7,7 @@ org.fugerit.java fj-doc - 1.3.1-rc.002 + 1.3.1-rc.003 fj-doc-val-core diff --git a/fj-doc-val-pdfbox/pom.xml b/fj-doc-val-pdfbox/pom.xml index b67a5e046..66b4143e9 100644 --- a/fj-doc-val-pdfbox/pom.xml +++ b/fj-doc-val-pdfbox/pom.xml @@ -7,7 +7,7 @@ org.fugerit.java fj-doc - 1.3.1-rc.002 + 1.3.1-rc.003 fj-doc-val-pdfbox diff --git a/fj-doc-val-poi/pom.xml b/fj-doc-val-poi/pom.xml index 7cbec28c5..0a2a29f9b 100644 --- a/fj-doc-val-poi/pom.xml +++ b/fj-doc-val-poi/pom.xml @@ -7,7 +7,7 @@ org.fugerit.java fj-doc - 1.3.1-rc.002 + 1.3.1-rc.003 fj-doc-val-poi diff --git a/fj-doc-val/pom.xml b/fj-doc-val/pom.xml index c7ac80a2c..a1f897359 100644 --- a/fj-doc-val/pom.xml +++ b/fj-doc-val/pom.xml @@ -7,7 +7,7 @@ org.fugerit.java fj-doc - 1.3.1-rc.002 + 1.3.1-rc.003 fj-doc-val diff --git a/pom.xml b/pom.xml index 4f62faa24..4cfa77545 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ fj-doc - 1.3.1-rc.002 + 1.3.1-rc.003 pom fj-doc