Skip to content

248 enhancement native configuration for modules mod opencsv #249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- [fj-doc-mod-opencsv] added GraalVM native metadata to csv format
- [fj-doc-native-quarkus] added quarkus integration tests

## [8.10.7] - 2024-11-02
Expand Down
3 changes: 0 additions & 3 deletions fj-doc-base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ All basic features are implemented (plus helpers for other modules).

*Since* : fj-doc 0.1

*Native support* :
Enabled since version 1.4.0-rc.001, This module should fully support native image. (*reflect-config.json* and *resources-config.json* have been added and there is no dependent library without native support)

*Quickstart* :

This module is based on [DocHandlerFacade](src/main/java/org/fugerit/java/doc/base/facade/DocHandlerFacade.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

Whereas the link:https://github.com/fugerit-org/fj-doc/blob/main/CHANGELOG.md[CHANGELOG] is a detailed list of modification to project, the release notes just refers to most important changes.

* Native metadata for module fj-doc-mode-opencsv (and relevant tests)

[#doc-release-notes-8-10-7]
==== Version 8.10.7 [2024-11-02]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ The full GraalVM support is currently under development.

xref:#doc-handlers[Modules] with native support are marked as *native ready*.

Currently *native ready* modules :

. fj-doc-base
. fj-doc-freemarker
. fj-doc-mod-opencsv

There is a test project link:https://github.com/fugerit-org/fj-doc/tree/main/fj-doc-native-quarkus[fj-doc-native-quarkus]
and a link:https://github.com/fugerit-org/fj-doc/actions/workflows/build_fj-doc-native-quarkus_test.yml[GitHub workflow].

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ flowchart TB
| xref:#doc-handler-mod-opencsv[fj-doc-mod-opencsv]
| CSV
| Generates a CSV document using link:https://opencsv.sourceforge.net/[OpenCSV].
|
| native ready (1)

| xref:#doc-handler-mod-openpdf-ext-pdf[org.fugerit.java.doc.mod.openpdf.ext.​PdfTypeHandler]
| xref:#doc-handler-mod-openpdf-ext[fj-doc-mod-openpdf-ext] | PDF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

Requirement :

- maven 3.9.x
- java ${context.javaRelease}+
* maven 3.9.x
* java ${context.javaRelease}+

1. Start the app

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
## Quickstart

Requirement :
- maven 3.9.x
- java ${context.javaRelease}+

* maven 3.9.x
* java ${context.javaRelease}+

1. Start the app

Expand Down
4 changes: 1 addition & 3 deletions fj-doc-mod-opencsv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@

[![Maven Central](https://img.shields.io/maven-central/v/org.fugerit.java/fj-doc-mod-opencsv.svg)](https://mvnrepository.com/artifact/org.fugerit.java/fj-doc-mod-opencsv)
[![javadoc](https://javadoc.io/badge2/org.fugerit.java/fj-doc-mod-opencsv/javadoc.svg)](https://javadoc.io/doc/org.fugerit.java/fj-doc-mod-opencsv)
![GraalVM Ready](https://img.shields.io/badge/GraalVM-Ready-orange?style=plastic)

*Status* :
Basic features implemented. (Sample JUnit [TestFreeMarker01](../fj-doc-sample/src/test/java/test/org/fugerit/java/doc/sample/freemarker/TestFreeMarker01.java) is now working).
For the intrinsic limitations of the CSV format, is possible to choose a single table in the document and outputs it as CSV.

*Since* : fj-doc 0.6

*Native support* :
Disabled, native support will be added in a future release. OpenCSV native support must be verified.

*Quickstart* :
Basically this is only a type handler, see core library [fj-doc-base](../fj-doc-base/README.md).
NOTE: If you have any special need you can open a pull request or create your own handler based on this.
47 changes: 46 additions & 1 deletion fj-doc-mod-opencsv/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,52 @@
<distribution>repo</distribution>
</license>
</licenses>


<build>

<plugins>

<plugin>
<groupId>org.fugerit.java</groupId>
<artifactId>native-helper-maven-plugin</artifactId>
<version>${native-helper-maven-plugin-version}</version>
<executions>
<execution>
<id>generate-native-configuration</id>
<phase>prepare-package</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<createParentDirectory>true</createParentDirectory>
<nativeHelperConfigPath>${project.basedir}/src/main/config/native-helper-config.yaml</nativeHelperConfigPath>
<reflectConfigJsonOutputPath>${project.build.directory}/generated-resources/reflect-config-custom.json</reflectConfigJsonOutputPath>
<warnOnError>false</warnOnError>
</configuration>
</execution>
<execution>
<id>merge-native-configuration</id>
<phase>prepare-package</phase>
<goals>
<goal>merge</goal>
</goals>
<configuration>
<reflectConfigJsonFiles>
<reflectConfigJsonFile>${project.build.directory}/generated-resources/reflect-config-custom.json</reflectConfigJsonFile>
<reflectConfigJsonFile>${project.basedir}/src/main/config/reflect-config-nhg.json</reflectConfigJsonFile>
</reflectConfigJsonFiles>
<reflectConfigJsonOutputPath>${project.basedir}/src/main/resources/META-INF/native-image/reflect-config.json</reflectConfigJsonOutputPath>
<createParentDirectory>true</createParentDirectory>
<warnOnError>false</warnOnError>
</configuration>
</execution>
</executions>
</plugin>

</plugins>

</build>

<dependencies>

<dependency>
Expand Down
6 changes: 6 additions & 0 deletions fj-doc-mod-opencsv/src/main/config/native-helper-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Sample native helper config file
---
generate:
- packageName: org.fugerit.java.doc.mod.opencsv
mode: all
typeReachable: org.fugerit.java.doc.base.facade.DocFacadeSource
10 changes: 10 additions & 0 deletions fj-doc-mod-opencsv/src/main/config/reflect-config-nhg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"name": "java.lang.Class",
"methods": [
{ "name": "getSimpleName", "parameterTypes": [] },
{ "name": "getName", "parameterTypes": [] },
{ "name": "getCanonicalName", "parameterTypes": [] }
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
[ {
"condition" : {
"typeReachable" : "org.fugerit.java.doc.base.facade.DocFacadeSource"
},
"name" : "org.fugerit.java.doc.mod.opencsv.OpenCSVTypeHandler",
"fields" : [ ],
"methods" : [ {
"name" : "<init>",
"parameterTypes" : [ ]
}, {
"name" : "<init>",
"parameterTypes" : [ "java.nio.charset.Charset" ]
}, {
"name" : "configure",
"parameterTypes" : [ "java.util.Properties" ]
}, {
"name" : "configure",
"parameterTypes" : [ "org.w3c.dom.Element" ]
}, {
"name" : "configureProperties",
"parameterTypes" : [ "java.io.InputStream" ]
}, {
"name" : "configureXML",
"parameterTypes" : [ "java.io.InputStream" ]
}, {
"name" : "createKey",
"parameterTypes" : [ "java.lang.String", "java.lang.String" ]
}, {
"name" : "equals",
"parameterTypes" : [ "java.lang.Object" ]
}, {
"name" : "getCharset",
"parameterTypes" : [ ]
}, {
"name" : "getClass",
"parameterTypes" : [ ]
}, {
"name" : "getCustomId",
"parameterTypes" : [ ]
}, {
"name" : "getFormat",
"parameterTypes" : [ ]
}, {
"name" : "getKey",
"parameterTypes" : [ ]
}, {
"name" : "getKey",
"parameterTypes" : [ ]
}, {
"name" : "getMime",
"parameterTypes" : [ ]
}, {
"name" : "getModule",
"parameterTypes" : [ ]
}, {
"name" : "getType",
"parameterTypes" : [ ]
}, {
"name" : "handle",
"parameterTypes" : [ "org.fugerit.java.doc.base.config.DocInput", "org.fugerit.java.doc.base.config.DocOutput" ]
}, {
"name" : "hashCode",
"parameterTypes" : [ ]
}, {
"name" : "notify",
"parameterTypes" : [ ]
}, {
"name" : "notifyAll",
"parameterTypes" : [ ]
}, {
"name" : "setCustomId",
"parameterTypes" : [ "java.lang.String" ]
}, {
"name" : "toString",
"parameterTypes" : [ ]
}, {
"name" : "wait",
"parameterTypes" : [ ]
}, {
"name" : "wait",
"parameterTypes" : [ "long" ]
}, {
"name" : "wait",
"parameterTypes" : [ "long", "int" ]
} ]
}, {
"condition" : {
"typeReachable" : "org.fugerit.java.doc.base.facade.DocFacadeSource"
},
"name" : "org.fugerit.java.doc.mod.opencsv.OpenCSVTypeHandlerUTF8",
"fields" : [ ],
"methods" : [ {
"name" : "<init>",
"parameterTypes" : [ ]
}, {
"name" : "configure",
"parameterTypes" : [ "java.util.Properties" ]
}, {
"name" : "configure",
"parameterTypes" : [ "org.w3c.dom.Element" ]
}, {
"name" : "configureProperties",
"parameterTypes" : [ "java.io.InputStream" ]
}, {
"name" : "configureXML",
"parameterTypes" : [ "java.io.InputStream" ]
}, {
"name" : "createKey",
"parameterTypes" : [ "java.lang.String", "java.lang.String" ]
}, {
"name" : "equals",
"parameterTypes" : [ "java.lang.Object" ]
}, {
"name" : "getCharset",
"parameterTypes" : [ ]
}, {
"name" : "getClass",
"parameterTypes" : [ ]
}, {
"name" : "getCustomId",
"parameterTypes" : [ ]
}, {
"name" : "getFormat",
"parameterTypes" : [ ]
}, {
"name" : "getKey",
"parameterTypes" : [ ]
}, {
"name" : "getKey",
"parameterTypes" : [ ]
}, {
"name" : "getMime",
"parameterTypes" : [ ]
}, {
"name" : "getModule",
"parameterTypes" : [ ]
}, {
"name" : "getType",
"parameterTypes" : [ ]
}, {
"name" : "handle",
"parameterTypes" : [ "org.fugerit.java.doc.base.config.DocInput", "org.fugerit.java.doc.base.config.DocOutput" ]
}, {
"name" : "hashCode",
"parameterTypes" : [ ]
}, {
"name" : "notify",
"parameterTypes" : [ ]
}, {
"name" : "notifyAll",
"parameterTypes" : [ ]
}, {
"name" : "setCustomId",
"parameterTypes" : [ "java.lang.String" ]
}, {
"name" : "toString",
"parameterTypes" : [ ]
}, {
"name" : "unwrap",
"parameterTypes" : [ ]
}, {
"name" : "wait",
"parameterTypes" : [ ]
}, {
"name" : "wait",
"parameterTypes" : [ "long" ]
}, {
"name" : "wait",
"parameterTypes" : [ "long", "int" ]
} ]
}, {
"name" : "java.lang.Class",
"fields" : [ ],
"methods" : [ {
"name" : "getCanonicalName",
"parameterTypes" : [ ]
}, {
"name" : "getName",
"parameterTypes" : [ ]
}, {
"name" : "getSimpleName",
"parameterTypes" : [ ]
} ]
} ]
4 changes: 4 additions & 0 deletions fj-doc-native-quarkus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc-freemarker</artifactId>
</dependency>
<dependency>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc-mod-opencsv</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,17 @@ public byte[] asciidocExample() {
return processDocument(DocConfig.TYPE_ADOC);
}




@APIResponse(responseCode = "200", description = "The CSV document content" )
@APIResponse(responseCode = "500", description = "In case of an unexpected error" )
@Tag( name = "document" )
@Tag( name = "csv" )
@Operation( operationId = "AsciiDocExample", summary = "Example CSV generation",
description = "Generates an example CSV document using Fugerit Venus Doc handler" )
@GET
@Produces("text/csv")
@Path("/example.csv")
public byte[] csvExample() {
return processDocument(DocConfig.TYPE_CSV);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<docHandler id="html-fragment-fm" info="fhtml" type="org.fugerit.java.doc.freemarker.html.FreeMarkerHtmlFragmentTypeHandlerEscapeUTF8" />
<!-- type handler for asciidoc using freemarker -->
<docHandler id="asciidoc-fm" info="adoc" type="org.fugerit.java.doc.freemarker.asciidoc.FreeMarkerAsciidocTypeHandlerUTF8" />
<!-- type handler for csv using opencsv -->
<docHandler id="csv" info="csv" type="org.fugerit.java.doc.mod.opencsv.OpenCSVTypeHandlerUTF8" />
</docHandlerConfig>

<docChain id="shared">
Expand Down
Loading