Multiple output files: How open are you to the idea if someone else wants to add that though? The use-case is when it's input data that drives what output files you will have (as in my example with the employees), and working that around with multiple invocations is not very nice.
Default locale: And also default charset to UTF-8, if that wasn't done. JDBC drivers: There was some discussion of how to add user defined classes to the tool earlier. Well, I guess it's about the same as you add your own jar-s to the classpath too, so, it shouldn't be a big deal. That could solve this side of the JDBC problem as well. As of storing credentials, that has to be solved when using external tools as well... but my practical experience is that people just put them in to a config file as plain text (maybe on a drive that has to be mounted with password first), or bind it to the OS user. Yes, Spring support is definitely important, given the omnipresence of Spring. It's not just web pages there, but e-mail templates (especially as there modern the UI technologies that has taken over at most places, aren't applicable). Would be good if someone can take ownership of that aspect for FreeMarker 2, probably using what was done in FM3. (Or maybe the same resources are better redirected to pushing FM3... who knows. There are really no resources to push two branches in parallel.) On Wed, Dec 18, 2019 at 2:02 PM Siegfried Goeschl < [email protected]> wrote: > Hi Daniel, > > try to write a top-level post to keep the discussion readable > > > Ad Multi-file Output > =============================================================== > > Currently no plans to implement it - I personally don’t have a need for it > and it is a hypothetical requirement for now > > > Ad POI Integration > =============================================================== > > No problem in exposing the non-String data - it is a good idea and will be > implemented > > > Ad Default Locale > =============================================================== > > * I need to define a locale for the unit tests > * I guess it is a good idea to pin it to “en_US” to avoid suprises > > > Ad JDBC Access > =============================================================== > > It is part of a wider problem - when leaving the document-centric approach > into scripting there is a lot of useful functionality, e.g. JDBC and HTTP > clients. > > The problems > > * JDBC: You need to add JDBC drivers, where to store the credentials, > database schema, ... > * HTTP: More libraries, certificates, proxy support,... > > It is possible to implement something but it will never work properly so I > decided to tackle the problem differently b using commons-exec > > * REST calls can be easily made by invoking cURL > * Database command line clients can export the result of a SELECT query to > a CSV file > > > Ad Templates aren't used much for Web UI-s anymore > =============================================================== > > Yes and no - IMHO it is quite useful to embed a UI into certain "micro > services”. Therefore I think that a ready-to-use Spring Boot (& Micronaut, > etc..) integration is important and should not be an afterthought. > > > Thanks in advance, > > Siegfried Goeschl > > > > On 18 Dec 2019, at 01:32, Daniel Dekany <[email protected]> wrote: > > > > Hi, > > > > Find my comments inline below. > > > > On Tue, Dec 17, 2019 at 10:46 PM Siegfried Goeschl < > > [email protected] <mailto:[email protected]>> wrote: > > > >> Hi Daniel, > >> > >> Thanks for spending your time - feed back is always appreciated when > doing > >> things in isolation .... > >> > >> Please see my comments below > >> > >> Thanks in advance, > >> > >> Siegfried Goeschl > >> > >> > >> > >>> On 17.12.2019, at 19:19, Daniel Dekany <[email protected]> > wrote: > >>> > >>> Hi Siegfried, > >>> > >>> Looks good! > >>> > >>> Some random things I happened to notice: > >>> > >>> - The ability generating multiple output files from the same template > >>> would be worthy addition. Like you load a CSV file that has employees > >> in > >>> it, and based on that you generate one output file per department. Or > >> even > >>> one per employee. (There could directives for that, like > >> changeOutputFile, > >>> nestOutputFile, etc. on > http://fmpp.sourceforge.net/pphash.html#sect17 > >> <http://fmpp.sourceforge.net/pphash.html#sect17 < > http://fmpp.sourceforge.net/pphash.html#sect17>>) > >> > >> Well, I simply don't need it and it complicates things - in simple cases > >> one could just re-run the freemarker-cli with a different template > and/or > >> parameters > >> > > > > My feeling is that if there's a tool that's about transforming some files > > to other files, but the idea that a single invocation can yield multiple > > output files is not part of it, one way or another (i.e., not necessarily > > in the way it was in FMPP), it might turns out to be a limiting design > > decision later as feature request start to pour in. And then it can be > hard > > to add as an afterthought. Well, maybe I'm wrong, as I have no statics > > about how often it's needed. FMPP users did use it (myself included), > some > > of them at least. > > > > > >>> - When I load an XLSX, I get back values as string, not as numbers, or > >>> dates. I'm not sure how hard it is to solve though (I don't remember > >> POI > >>> much). > >> > >> That should not be too hard - I actually use > >> org.apache.poi.ss.usermodel.DataFormatter to create the strings > > > > > > If templates get numbers etc., or have a such choice at least, then they > > can compare numbers, filter based on their values, control the > formatting, > > etc. My idea here is that an Excel file, CSV file, whatever, is just a > pure > > data, and rendering/formatting is the duty of the templates. > > > > > >>> BTW, the strings I get back are formatted with the locale of the OS, > >> > >> which is a problem. I guess there should be an config option to set the > >> JVM > >>> locale. (The ExcelToolTest fails on my computer with locale hu_HU for > >>> somewhat similar reason, as it gets "100,00" instead of "100.00".) > >> > >> On the command line you can use > >> > >> -l, --locale=<locale> Locale being used for output file, e.g. > 'en_US' > >> > >> but I guess I should provide a fixed locale for the unit tests > >> > > > > The problem is not how FreeMarker renders the numbers. It already gets > > strings like that from POI, and --locale doesn't influence POI. > > > > As of the default locale, for these kind of tools, I believe that using > > system defaults is usually evil. So having a fixed default is maybe not > > just for unit tests. The locale of my computer, or wherever I run a job > on > > (often some backend linux box) should be usually irrelevant, and not > > influence the output. Not to mention when team mates share the project, > in > > an international team. > > > >> - Querying from relation databases (JDBC) would be probably an useful > >>> addition (it doesn't fit the Document paradigm though). > >> > >> I integrated commons-exec and triggered AWS CLI - basically you capture > >> the output of any command-line invocation and process it. Just need to > make > >> sure that every tool supports processing raw strings ... > >> > > > > I'm note sure what do you mean. The result of a query is a structured > data, > > with column names and non-string types, so I guess command-line > invocation > > can't solve that too well. > > > > > >>> It would be good if there's some de-facto tool for these kind of things > >>> than what freemarker-cli does. I guess there's a few such tools in > >> company > >>> repos, but of course those have no potential to become more generic and > >>> being published. (freemarker-generator was a such toll though, but it > >>> didn't go anywhere after donation. Actually, FMPP was a such tool too, > >> that > >>> I used for some sysadmin/webadmin tasks some 15+ years ago.) But of > >> course, > >>> long term care is the tricky issue with any project that has no company > >>> truly behind it (i.e., no payed developers). Do you have you have any > >>> thoughts/plans regarding the longer term life of freemarker-cli? > >> > >> I worked on a couple of not soo successful Open Source projects - yes, > it > >> might become another Open Source GitHub project nobody knows / cares :-) > >> > >> Having said that > >> > >> * I'm maintaining it already for a few of years and I will always find > >> some things I can do with it > >> * It is useful for some common tasks when you have a Java background > >> * I think it is a great way to re-use or build up FreeMarker knowledge > >> > > > > And, I would add, templates aren't used much for Web UI-s anymore, so > these > > alternate use cases become the main ones. > > > > > >> * And it should become part of the Apache Freemarker project - much > better > >> visibility & broader user base > >> > > > > Yeah, the last point is what I'm going for really. But that's also why I > > hope that you feel like making it more general. Or at least has no > negative > > feelings about it. > > > >> > >>> Also, some things that you miss for FreeMarker itself for it to be more > >>> fitting for the task? > >> > >> Support for Java 8 Date/Time API - last time I looked at it it was not > >> supported by FreeMarker and it's a bummer since nobody is using Date any > >> longer ... > >> > > > > Yeah... it still isn't. It's probably among the new few things to add at > > this point, as it's long due. > > > >> > >>> > >>> On Sun, Nov 17, 2019 at 7:02 PM Siegfried Goeschl < > >>> [email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>>> > wrote: > >>> > >>>> Hi folks, > >>>> > >>>> since I'm currently mostly busy with non-coding tasks I spent some > time > >>>> honing my coding skills - probably to no avail as my colleagues would > >> say > >>>> ;-) > >>>> > >>>> 1) I migrated my pet project "freemarker-cli" from Groovy to JDK 8 > (see > >>>> https://github.com/sgoeschl/freemarker-cli < > https://github.com/sgoeschl/freemarker-cli> < > >> https://github.com/sgoeschl/freemarker-cli < > https://github.com/sgoeschl/freemarker-cli>> < > >>>> https://github.com/sgoeschl/freemarker-cli < > https://github.com/sgoeschl/freemarker-cli> < > >> https://github.com/sgoeschl/freemarker-cli < > https://github.com/sgoeschl/freemarker-cli>>>) > >>>> > >>>> 2) At > >>>> > >> > https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc > < > https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc > > > >> < > >> > https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc > < > https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc > > > >>> > >>>> < > >>>> > >> > https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc > < > https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc > > > >> < > >> > https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc > < > https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc > > > >>>> > >>>> you find a presentation I gave some while ago > >>>> > >>>> 3) I also wrote a Spring Boot FreeMarker sample project as part of the > >>>> presentation (see > >>>> > >> > https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo > < > https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo > > > >> < > >> > https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo > < > https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo > > > >>> > >>>> < > >>>> > >> > https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo > < > https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo > > > >> < > >> > https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo > < > https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo > > > >>> > >>>>> ) > >>>> > >>>> My plans / questions > >>>> > >>>> I would be awesome if I could get some feedback about "freemarker-cli" > >> in > >>>> its current JDK incarnation :-) Later on I will release 2.0.0 and push > >> it > >>>> to Maven Central. > >>>> > >>>> In the mean time I wrote three applications (micro services in new > >> speak) > >>>> using Apache FreeMarker and found it hard to find a starting point > for a > >>>> Spring Boot applications - therefore I wrote the sample project (see > >>>> above). One way or the other a Spring Boot (and Micronaut) blue print > >>>> should find its way into Apache FreeMarker officially. I think Apache > >>>> FreeMarker is awesome for adding a developer UI to some micro service > >> but > >>>> developers don't care about the template engine but only about a quick > >> and > >>>> painless way to get the job done ... > >>>> > >>>> Anyone volunteering to give a presentation about Apache Freemarker at > >>>> ApacheCon? I could do but I'm not really qualified :-) > >>>> > >>>> Thanks in advance, > >>>> > >>>> Siegfried Goeschl > >>>> > >>>> > >>>> > >>> > >>> -- > >>> Best regards, > >>> Daniel Dekany > >> > > > > -- > > Best regards, > > Daniel Dekany > > -- Best regards, Daniel Dekany
