Skip to content

Commit 0c7049f

Browse files
committed
1.1.2-rc.001 (2023-07-03)
+ Updated quarkus version to 3.1.3.Final + Added generation time on playgroud quarkus + Added lombok dependency + Added API for AOT type handlers initialization (especially useful for libraries like apache fop)
1 parent e950892 commit 0c7049f

File tree

29 files changed

+176
-42
lines changed

29 files changed

+176
-42
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.1.1-rc.001",
5-
"date" : "02/07/2023",
4+
"version" : "1.1.2-rc.001",
5+
"date" : "03/07/2023",
66
"organization" : {
77
"name" : "Fugerit Org",
88
"url" : "https://www.fugerit.org"

docgen/release-notes.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
1.1.2-rc.001 (2023-07-XX)
1+
1.1.2-rc.001 (2023-07-03)
22
------------------
33
+ Updated quarkus version to 3.1.3.Final
4+
+ Added generation time on playgroud quarkus
5+
+ Added lombok dependency
6+
+ Added API for AOT type handlers initialization (especially useful for libraries like apache fop)
47

58
1.1.1-rc.001 (2023-07-02)
69
------------------

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.1.1-rc.001</version>
10+
<version>1.1.2-rc.001</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.1.1-rc.001</version>
10+
<version>1.1.2-rc.001</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.1.1-rc.001</version>
10+
<version>1.1.2-rc.001</version>
1111
</parent>
1212

1313
<name>fj-doc-base</name>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package org.fugerit.java.doc.base.config;
2+
3+
import java.io.ByteArrayOutputStream;
4+
import java.io.InputStreamReader;
5+
6+
import org.fugerit.java.core.cfg.ConfigException;
7+
import org.fugerit.java.core.lang.helpers.ClassHelper;
8+
import org.fugerit.java.core.util.checkpoint.CheckpointUtils;
9+
10+
import lombok.extern.slf4j.Slf4j;
11+
12+
/**
13+
* DocTypeHandler Initializer.
14+
* If AOT initialization is needed it is possible to call these Facade.
15+
*
16+
*/
17+
@Slf4j
18+
public class InitHandler {
19+
20+
public static final String PATH_INIT_DOC = "config/init_doc/doc-init.xml";
21+
22+
public static boolean initDoc( DocTypeHandler handler ) throws ConfigException {
23+
boolean init = true;
24+
long startTime = System.currentTimeMillis();
25+
try ( InputStreamReader reader = new InputStreamReader( ClassHelper.loadFromDefaultClassLoader( PATH_INIT_DOC ) );
26+
ByteArrayOutputStream baos = new ByteArrayOutputStream() ) {
27+
handler.handle( DocInput.newInput( handler.getType() , reader ) , DocOutput.newOutput( baos ) );
28+
log.info( "Init handler time {} -> {}", handler, CheckpointUtils.formatTimeDiffMillis( startTime , System.currentTimeMillis() ) );
29+
} catch (Exception e) {
30+
throw new ConfigException( "Init exception : "+e, e );
31+
}
32+
return init;
33+
}
34+
35+
public static void initDocAsync( DocTypeHandler handler ) {
36+
Runnable runInitDoc = new Runnable() {
37+
@Override
38+
public void run() {
39+
log.info( "Init handler start : {}", handler );
40+
try {
41+
boolean initOk = initDoc(handler);
42+
log.info( "Init handler end : {} -> {}", handler, initOk );
43+
} catch (ConfigException e) {
44+
log.info( "Init handler error "+e, e );
45+
}
46+
}
47+
};
48+
Thread t = new Thread( runInitDoc );
49+
t.start();
50+
}
51+
52+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version = "1.0" encoding = "UTF-8" standalone = "no" ?>
2+
<doc
3+
xmlns="http://javacoredoc.fugerit.org"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://javacoredoc.fugerit.org http://www.fugerit.org/data/java/doc/xsd/doc-2-0.xsd" >
6+
7+
<metadata>
8+
<info name="margins">10;10;10;10</info>
9+
<info name="doc-title">Test XML 01 title</info>
10+
<info name="doc-subject">Test XML 01 subject</info>
11+
<info name="doc-author">Fugerit</info>
12+
<info name="doc-creator">fj-doc (Venus) Sample</info>
13+
<info name="doc-language">en</info>
14+
<bookmark-tree>
15+
<bookmark ref="b1">Bookmark 1</bookmark>
16+
<bookmark ref="b2">Bookmark 2</bookmark>
17+
</bookmark-tree>
18+
</metadata>
19+
<body>
20+
<h head-level="1" align="center" id="b1">Header 1</h>
21+
</body>
22+
</doc>

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.1.1-rc.001</version>
10+
<version>1.1.2-rc.001</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.1.1-rc.001</version>
10+
<version>1.1.2-rc.001</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.1.1-rc.001</version>
10+
<version>1.1.2-rc.001</version>
1111
</parent>
1212

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

fj-doc-lib-autodoc/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.1.1-rc.001</version>
10+
<version>1.1.2-rc.001</version>
1111
</parent>
1212

1313
<name>fj-doc-lib-autodoc</name>

fj-doc-lib-simpletable/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.1.1-rc.001</version>
10+
<version>1.1.2-rc.001</version>
1111
</parent>
1212

1313
<name>fj-doc-lib-simpletable</name>

fj-doc-mod-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.1.1-rc.001</version>
10+
<version>1.1.2-rc.001</version>
1111
</parent>
1212

1313
<name>fj-doc-mod-fop</name>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package org.fugerit.java.doc.mod.fop;
2+
3+
import org.fugerit.java.core.cfg.ConfigException;
4+
import org.fugerit.java.doc.base.config.InitHandler;
5+
6+
/**
7+
* PdfFopTypeHandler Initializer based on a base configuration.
8+
* If AOT initialization is needed it is possible to call these Facade.
9+
*
10+
*/
11+
public class InitFopHandler {
12+
13+
public static final PdfFopTypeHandler HANDLER = new PdfFopTypeHandler();
14+
15+
public static boolean initDoc() throws ConfigException {
16+
return InitHandler.initDoc( HANDLER );
17+
}
18+
19+
public static void initDocAsync() {
20+
InitHandler.initDocAsync( HANDLER );
21+
}
22+
23+
}

fj-doc-mod-opencsv/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.1.1-rc.001</version>
10+
<version>1.1.2-rc.001</version>
1111
</parent>
1212

1313
<name>fj-doc-mod-opencsv</name>

fj-doc-mod-poi/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.1.1-rc.001</version>
10+
<version>1.1.2-rc.001</version>
1111
</parent>
1212

1313
<name>fj-doc-mod-poi</name>

fj-doc-playground-quarkus/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.fugerit.java</groupId>
66
<artifactId>fj-doc</artifactId>
7-
<version>1.1.1-rc.001</version>
7+
<version>1.1.2-rc.001</version>
88
</parent>
99
<artifactId>fj-doc-playground-quarkus</artifactId>
1010
<properties>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package org.fugerit.java.doc.playground.config;
2+
3+
import org.fugerit.java.doc.base.config.InitHandler;
4+
import org.fugerit.java.doc.mod.fop.PdfFopTypeHandler;
5+
6+
import io.quarkus.runtime.StartupEvent;
7+
import jakarta.enterprise.context.ApplicationScoped;
8+
import jakarta.enterprise.event.Observes;
9+
import lombok.extern.slf4j.Slf4j;
10+
11+
@Slf4j
12+
@ApplicationScoped
13+
public class InitPlayground {
14+
15+
public static final PdfFopTypeHandler PDF_FOP_TYPE_HANDLER = new PdfFopTypeHandler();
16+
17+
void onStart(@Observes StartupEvent ev) {
18+
log.info( "InitPlayground start" );
19+
InitHandler.initDocAsync( PDF_FOP_TYPE_HANDLER );
20+
log.info( "InitPlayground end" );
21+
}
22+
23+
}

fj-doc-playground-quarkus/src/main/java/org/fugerit/java/doc/playground/doc/GenerateOutput.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22

33
import org.fugerit.java.doc.playground.facade.BasicOutput;
44

5+
import lombok.Getter;
6+
import lombok.Setter;
7+
58
public class GenerateOutput extends BasicOutput {
69

10+
@Setter
11+
@Getter
12+
private String generationTime;
13+
14+
@Setter
15+
@Getter
716
private String docOutputBase64;
8-
9-
public String getDocOutputBase64() {
10-
return docOutputBase64;
11-
}
12-
13-
public void setDocOutputBase64(String docOutputBase64) {
14-
this.docOutputBase64 = docOutputBase64;
15-
}
1617

1718
}

fj-doc-playground-quarkus/src/main/java/org/fugerit/java/doc/playground/doc/GenerateRest.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.util.Base64;
66

77
import org.fugerit.java.core.lang.helpers.BooleanUtils;
8+
import org.fugerit.java.core.util.checkpoint.CheckpointUtils;
89
import org.fugerit.java.doc.base.config.DocInput;
910
import org.fugerit.java.doc.base.config.DocOutput;
1011
import org.fugerit.java.doc.base.config.DocTypeHandler;
@@ -16,12 +17,10 @@
1617
import org.fugerit.java.doc.lib.simpletable.SimpleTableFacade;
1718
import org.fugerit.java.doc.lib.simpletable.model.SimpleRow;
1819
import org.fugerit.java.doc.lib.simpletable.model.SimpleTable;
19-
import org.fugerit.java.doc.mod.fop.PdfFopTypeHandler;
2020
import org.fugerit.java.doc.mod.poi.XlsxPoiTypeHandler;
21+
import org.fugerit.java.doc.playground.config.InitPlayground;
2122
import org.fugerit.java.doc.playground.facade.BasicInput;
2223
import org.fugerit.java.doc.playground.facade.InputFacade;
23-
import org.slf4j.Logger;
24-
import org.slf4j.LoggerFactory;
2524

2625
import jakarta.enterprise.context.ApplicationScoped;
2726
import jakarta.ws.rs.Consumes;
@@ -30,13 +29,13 @@
3029
import jakarta.ws.rs.Produces;
3130
import jakarta.ws.rs.core.MediaType;
3231
import jakarta.ws.rs.core.Response;
32+
import lombok.extern.slf4j.Slf4j;
3333

3434
@ApplicationScoped
35+
@Slf4j
3536
@Path("/generate")
3637
public class GenerateRest {
3738

38-
private final static Logger logger = LoggerFactory.getLogger(GenerateRest.class);
39-
4039
private byte[] generateHelper( GenerateInput input, DocTypeHandler handler) throws Exception {
4140
byte[] result = null;
4241
if ( input.getDocContent() != null ) {
@@ -49,7 +48,7 @@ private byte[] generateHelper( GenerateInput input, DocTypeHandler handler) thro
4948
sourceType = DocFacadeSource.SOURCE_TYPE_YAML;
5049
}
5150
String type = input.getOutputFormat().toLowerCase();
52-
logger.info( "output format : {}", type );
51+
log.info( "output format : {}", type );
5352
DocInput docInput = DocInput.newInput( type, reader , sourceType );
5453
DocOutput docOutput = DocOutput.newOutput( baos );
5554
handler.handle(docInput, docOutput);
@@ -60,7 +59,7 @@ private byte[] generateHelper( GenerateInput input, DocTypeHandler handler) thro
6059
}
6160

6261
private DocTypeHandler findHandler( BasicInput input ) {
63-
DocTypeHandler handler = new PdfFopTypeHandler();
62+
DocTypeHandler handler = InitPlayground.PDF_FOP_TYPE_HANDLER;
6463
if ( "XLSX".equalsIgnoreCase( input.getOutputFormat() ) ) {
6564
handler = XlsxPoiTypeHandler.HANDLER;
6665
} else if ( "HTML".equalsIgnoreCase( input.getOutputFormat() ) ) {
@@ -86,13 +85,15 @@ private DocParser findParser( BasicInput input ) {
8685
public Response document( GenerateInput input) {
8786
Response res = Response.status(Response.Status.BAD_REQUEST).build();
8887
try {
88+
long time = System.currentTimeMillis();
8989
DocTypeHandler handler = this.findHandler(input);
9090
byte[] data = this.generateHelper(input, handler);
9191
GenerateOutput output = new GenerateOutput();
9292
output.setDocOutputBase64( Base64.getEncoder().encodeToString( data ) );
93+
output.setGenerationTime( CheckpointUtils.formatTimeDiffMillis( time , System.currentTimeMillis() ) );
9394
res = Response.ok().entity( output ).build();
9495
} catch (Exception e) {
95-
logger.info("Error : " + e, e);
96+
log.info("Error : " + e, e);
9697
res = Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
9798
}
9899
return res;
@@ -145,7 +146,7 @@ public Response validate( GenerateInput input) {
145146
res = Response.ok().entity( output ).build();
146147
}
147148
} catch (Exception e) {
148-
logger.info("Error : " + e, e);
149+
log.info("Error : " + e, e);
149150
res = Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
150151
}
151152
return res;

fj-doc-playground-quarkus/src/main/react/src/playground/DocXmlEditor.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ class DocXmlEditor extends Component {
2424
outputFormat: 'HTML',
2525
docContent: '',
2626
docOutput: null,
27-
docFormat: null
27+
docFormat: null,
28+
generationTime: null
2829
}
2930
}
3031

@@ -45,7 +46,8 @@ class DocXmlEditor extends Component {
4546
if (response.success) {
4647
reactState.setState({
4748
docOutput: response.result.docOutputBase64,
48-
docFormat: this.state.outputFormat
49+
docFormat: this.state.outputFormat,
50+
generationTime: response.result.generationTime
4951
})
5052
}
5153
})
@@ -123,6 +125,7 @@ class DocXmlEditor extends Component {
123125
let srcData = 'data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,'+ this.state.docOutput;
124126
outputData = <a href={srcData} download='generated_document.xlsx'>generated_document.xlsx</a>
125127
}
128+
outputData = <Fragment>{outputData}<p>Generation time : {this.state.generationTime}</p></Fragment>
126129
}
127130

128131
return <Fragment>

fj-doc-sample/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.1.1-rc.001</version>
10+
<version>1.1.2-rc.001</version>
1111
</parent>
1212

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

0 commit comments

Comments
 (0)