Skip to content

Commit bafe473

Browse files
committed
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)
1 parent fbec6e4 commit bafe473

File tree

36 files changed

+120
-111
lines changed

36 files changed

+120
-111
lines changed

docgen/parameters.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"title" : "Venus (Fugerit Document Generation Framework)",
33
"name": "Venus",
4-
"version" : "1.3.1-rc.002",
5-
"date" : "14/07/2023",
4+
"version" : "1.3.1-rc.003",
5+
"date" : "18/07/2023",
66
"organization" : {
77
"name" : "Fugerit Org",
88
"url" : "https://www.fugerit.org"

docgen/release-notes.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
1.3.X (2023-07-XX)
1+
1.3.1-rc.003 (2023-07-18)
22
------------------
33
+ Freemarker html type handler converted to new configuration model
44
+ Configuration stub for freemarker configuration model
5-
+ Tool for stub generation (new maven module fj-doc-tool)
6-
+ Tool converting old config model to new one (new maven module fj-doc-tool)
5+
+ Tool for stub generation and conversion from old model (new maven module fj-doc-tool)
76

87
1.3.1-rc.002 (2023-07-13)
98
------------------

fj-doc-base-json/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.fugerit.java</groupId>
99
<artifactId>fj-doc</artifactId>
10-
<version>1.3.1-rc.002</version>
10+
<version>1.3.1-rc.003</version>
1111
</parent>
1212

1313
<name>fj-doc-base-json</name>

fj-doc-base-yaml/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.fugerit.java</groupId>
99
<artifactId>fj-doc</artifactId>
10-
<version>1.3.1-rc.002</version>
10+
<version>1.3.1-rc.003</version>
1111
</parent>
1212

1313
<name>fj-doc-base-yaml</name>

fj-doc-base/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.fugerit.java</groupId>
99
<artifactId>fj-doc</artifactId>
10-
<version>1.3.1-rc.002</version>
10+
<version>1.3.1-rc.003</version>
1111
</parent>
1212

1313
<name>fj-doc-base</name>

fj-doc-bom-core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.fugerit.java</groupId>
99
<artifactId>fj-doc</artifactId>
10-
<version>1.3.1-rc.002</version>
10+
<version>1.3.1-rc.003</version>
1111
</parent>
1212

1313
<name>fj-doc-bom-core</name>

fj-doc-bom-fop/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.fugerit.java</groupId>
99
<artifactId>fj-doc</artifactId>
10-
<version>1.3.1-rc.002</version>
10+
<version>1.3.1-rc.003</version>
1111
</parent>
1212

1313
<name>fj-doc-bom-fop</name>

fj-doc-freemarker/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.fugerit.java</groupId>
99
<artifactId>fj-doc</artifactId>
10-
<version>1.3.1-rc.002</version>
10+
<version>1.3.1-rc.003</version>
1111
</parent>
1212

1313
<name>fj-doc-freemarker</name>

fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/GenerateStub.java

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
package org.fugerit.java.doc.freemarker.tool;
22

3+
import java.io.File;
4+
import java.io.FileInputStream;
5+
import java.io.InputStream;
36
import java.io.Writer;
47
import java.util.Properties;
58

69
import org.fugerit.java.core.io.StreamIO;
10+
import org.fugerit.java.core.lang.helpers.StringUtils;
711
import org.fugerit.java.doc.base.process.DocProcessContext;
812
import org.fugerit.java.doc.base.process.DocProcessData;
913
import org.fugerit.java.doc.freemarker.helper.FreeMarkerDocProcess;
14+
import org.fugerit.java.doc.freemarker.tool.model.ConfigModel;
1015

11-
public class GenerateStub {
16+
import lombok.extern.slf4j.Slf4j;
1217

18+
@Slf4j
19+
public class GenerateStub {
20+
21+
public static final String ATT_CONFIG_MODEL = "configModel";
22+
1323
public static final String CONFIG_STUB_CHAIN_ID = "freemarker-doc-process-config-stub";
1424

1525
public static final String ATT_STUB_PARAMS = "stubParams";
@@ -59,10 +69,30 @@ public class GenerateStub {
5969
*/
6070
public static final String PARAM_FM_TEMPLATE_PATH = "fm-template-path";
6171

62-
public static void generate( Writer w, Properties params ) throws Exception {
72+
public static final String ARG_INPUT_FILE = "input";
73+
74+
public static void generate( Writer out, Properties params ) throws Exception {
75+
String input = params.getProperty(ARG_INPUT_FILE);
76+
if ( StringUtils.isNotEmpty( input ) ) {
77+
try ( InputStream is = new FileInputStream( new File( input ) ) ) {
78+
generate(out, params, is);
79+
}
80+
} else {
81+
generate(out, params, null);
82+
}
83+
}
84+
85+
public static void generate( Writer out, Properties params, InputStream is ) throws Exception {
86+
ConfigModel configModel = null;
6387
DocProcessData data = new DocProcessData();
64-
FreeMarkerDocProcess.getInstance().process( CONFIG_STUB_CHAIN_ID, DocProcessContext.newContext( ATT_STUB_PARAMS, params ), data );
65-
StreamIO.pipeChar( data.getCurrentXmlReader() , w, StreamIO.MODE_CLOSE_IN_ONLY );
88+
DocProcessContext context = DocProcessContext.newContext( ATT_STUB_PARAMS, params );
89+
if ( is != null ) {
90+
log.info( "read legacy config model" );
91+
configModel = LegacyConfigRead.readConfig(is);
92+
context = context.withAtt( ATT_CONFIG_MODEL , configModel );
93+
}
94+
FreeMarkerDocProcess.getInstance().process( CONFIG_STUB_CHAIN_ID, context, data );
95+
StreamIO.pipeChar( data.getCurrentXmlReader() , out, StreamIO.MODE_CLOSE_IN_ONLY );
6696
}
6797

6898
}

fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/ConvertConfig.java renamed to fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/LegacyConfigRead.java

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
package org.fugerit.java.doc.freemarker.tool;
22

33
import java.io.InputStream;
4-
import java.io.Writer;
5-
import java.util.Properties;
64

75
import javax.xml.parsers.DocumentBuilder;
86
import javax.xml.parsers.DocumentBuilderFactory;
97

10-
import org.fugerit.java.core.io.StreamIO;
11-
import org.fugerit.java.doc.base.process.DocProcessContext;
12-
import org.fugerit.java.doc.base.process.DocProcessData;
138
import org.fugerit.java.doc.freemarker.config.FreeMarkerProcessStep;
14-
import org.fugerit.java.doc.freemarker.helper.FreeMarkerDocProcess;
159
import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfigFacade;
1610
import org.fugerit.java.doc.freemarker.tool.model.ChainModel;
1711
import org.fugerit.java.doc.freemarker.tool.model.ConfigModel;
@@ -25,11 +19,9 @@
2519
import lombok.extern.slf4j.Slf4j;
2620

2721
@Slf4j
28-
public class ConvertConfig {
29-
30-
public static final String ATT_CONFIG_MODEL = "configModel";
31-
32-
public static void generate( InputStream is, Writer out, Properties params ) throws Exception {
22+
public class LegacyConfigRead {
23+
24+
public static ConfigModel readConfig( InputStream is ) throws Exception {
3325
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
3426
dbf.setNamespaceAware( true );
3527
DocumentBuilder parser = dbf.newDocumentBuilder();
@@ -68,10 +60,7 @@ public static void generate( InputStream is, Writer out, Properties params ) thr
6860
}
6961
}
7062
}
71-
DocProcessData data = new DocProcessData();
72-
DocProcessContext context = DocProcessContext.newContext( GenerateStub.ATT_STUB_PARAMS, params ).withAtt( ATT_CONFIG_MODEL , configModel );
73-
FreeMarkerDocProcess.getInstance().process( GenerateStub.CONFIG_STUB_CHAIN_ID, context, data );
74-
StreamIO.pipeChar( data.getCurrentXmlReader() , out, StreamIO.MODE_CLOSE_IN_ONLY );
63+
return configModel;
7564
}
7665

7766
}

0 commit comments

Comments
 (0)