{"id":2504,"date":"2009-12-09T21:23:00","date_gmt":"2009-12-09T21:23:00","guid":{"rendered":"http:\/\/www.b.shuttle.de\/hayek\/Hayek\/Jochen\/wp\/blog-en\/2009\/12\/09\/my-1st-steps-in-java-extending-a-jasperreport-sample-program-using-apache-commons-cli\/"},"modified":"2009-12-09T21:23:00","modified_gmt":"2009-12-09T21:23:00","slug":"my-1st-steps-in-java-extending-a-jasperreport-sample-program-using-apache-commons-cli","status":"publish","type":"post","link":"https:\/\/wp.jochen.hayek.name\/blog-en\/2009\/12\/09\/my-1st-steps-in-java-extending-a-jasperreport-sample-program-using-apache-commons-cli\/","title":{"rendered":"my 1st steps in Java: extending a JasperReport sample program using Apache Commons CLI"},"content":{"rendered":"<p>\t\t\t\tiReports and JasperReports (and also JasperETL and much more) are open source software, that you can find on <a href=\"http:\/\/jasperforge.org\/\">JasperForge.org<\/a>.<\/p>\n<p>I intended to extend <span><span>jasperreports-3.6.2\/demo\/samples\/text\/TextApp.java<\/span><\/span>, so that it would take &#8220;<span><span>-D<i>name<\/i>=<i>value<\/i><\/span><\/span>&#8221; style options. There was a need to make <span><span>TextApp.java<\/span><\/span> a little more flexible, and that was quite easily to achieve making use of <span><span>getProperty<\/span><\/span> calls.<\/p>\n<p>A friend had given me the hint recently to have a look at &#8220;<span><span>System.getProperty()<\/span><\/span>&#8220;, but<br \/>\nit turned out to only provide the caller with properties like <code>\"os.name\"<\/code>, according to <a href=\"http:\/\/java.sun.com\/docs\/books\/tutorial\/essential\/environment\/sysprop.html\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/java.sun.com\/docs\/books\/tutorial\/essential\/environment\/sysprop.html<\/a>. So that wasn&#8217;t quite the route to follow.<\/p>\n<p>\nI started my day googling for &#8220;getopt java&#8221;, found that nice package &#8220;<a href=\"http:\/\/commons.apache.org\/cli\/\">Apache Commons CLI<\/a>&#8220;, made use of it within that JasperForge utility, and started scripting a batch run around that utility&#8217;s targets named &#8220;<i>fill&#8230;<\/i>&#8221; resp. &#8220;<i>text&#8230;<\/i>&#8221; in bash, resp. their new sisters, that I derived from them today. Next step is to rewrite that shell script as Windows batch script file resp. as python script to be used in a Windows environment. This work is almost &#8220;<i>production ready&#8221;<\/i>, but I am facing quite some necessary paperwork, so that the software developed can get made serious use of.<\/p>\n<p>Looks like the Jasper guys had not expected their software to be used like that. The &#8220;<span><span>.jrxml<\/span><\/span>&#8221; gets designed using <i>iReport<\/i> on a Windows box or whatever; after that it is being made use of on any kind of server executing Java classes with access to a database. (I wonder, whether that approach would also work with JasperETL.)<\/p>\n<p>I am quite satisfied with my 1st steps in Java in that JasperReport environment.<\/p>\n<p>I really had no idea and also no perspective of getting thrown into Java development during a commercial project, and even in the context of JasperReport. I do like this.<\/p>\n<p>Update \/ 2010-03-05:<br \/>\nThe atomar production steps described within <span><span>TextApp.java<\/span><\/span>&#8216;s <span>build.xml<\/span> are rather nice and instructive, but they make use of those routines within TextApp.java, where target file names (incl. directory path) get strictly derived from source file names. I added resp. derived productions steps, that make use of thoses methods of the API, that allow you to name the destiny&#8217;s name explictily. And I also added chains of productions steps into the java source file, so that the calling shell resp. &#8220;whatever&#8221; script wouldn&#8217;t have to deal with calling the chained steps one by one itself. So far there are chains starting at <span><span>.jrxml<\/span><\/span> and at <span>.jasper<\/span>, and chains that end at <span>.txt<\/span> and also at <span><span>.pdf<\/span><\/span>. The idea is to place intermediate files on local disks within temp. directories instead of close to the source resp. final target file (maybe) somewhere on a network file system.\t\t\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>iReports and JasperReports (and also JasperETL and much more) are open source software, that you can find on JasperForge.org. I intended to extend jasperreports-3.6.2\/demo\/samples\/text\/TextApp.java, so that it would take &#8220;-Dname=value&#8221; style options. There was a need to make TextApp.java a little more flexible, and that was quite easily to achieve making use of getProperty calls. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_share_on_mastodon":"0"},"categories":[666],"tags":[],"class_list":["post-2504","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paO0kP-Eo","jetpack_likes_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/2504","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/comments?post=2504"}],"version-history":[{"count":0,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/2504\/revisions"}],"wp:attachment":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/media?parent=2504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/categories?post=2504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/tags?post=2504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}