Archive for June, 2008

Jar Jar to the rescue

I think we have all seen a JAR conflict on an application server, I still use JDOM and usually run into a conflict with an older version of the JAR installed somewhere on the system that I usually can’t touch.

So, what I did was to use an Ant task called Jar Jar that is available at: http://code.google.com/p/jarjar/

Jar Jar will take a Jar file or (a group of Jar files), change the package names, and repackage the result in a new Jar File. The idea is that you can create your own Jar file with your dependencies packaged in.

I use the BeanShell scripting language (www.beanshell.org) which is what the LiveCycle ES Workbench Script Object is based on. There is no JAR file that I deploy but a script, therefore no compiled code to deploy. So, I use Jar Jar a little differently then what is documented on Jar Jar’s Wiki. I create my own package for JDOM and one of its dependencies Jaxen and I place the new Jar file in the classpath.

My, Ant file looks like the following:

<project name="CustomJDOM" default="jar" basedir=".">

     <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="./jarjar-1.0rc7.jar"/>

     <target name="jar">

        <jarjar jarfile="jdom_custom.jar">

               <zipfileset src="lib/jaxen-core.jar"/>

              <zipfileset src="lib/jaxen-jdom.jar"/>

             <zipfileset src="lib/jdom.jar"/>

             <rule pattern="org.jaxen.**" result="org.jdom_1_1.jaxen.@1"/>

             <rule pattern="org.jdom.**" result="org.jdom_1_1.@1"/>

        </jarjar>

     </target>

</project>

 

Taking it a line by line:

<project name="CustomJDOM" default="jar" basedir=".">

Standard Ant project tag, the default target is "jar" which kicks of the Jar Jar task.

<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="./jarjar-1.0rc7.jar"/>

This is how you declare a new Ant task (or one of the ways), make sure you update the "classpath" variable to where ever you installed the "Jar Jar" Jar file.

<target name="jar">

I’m declaring a task to be run.

<jarjar jarfile="jdom_custom.jar">

This line kicks-off the Jar Jar task and writes the result to a file called: jdom_custom.jar

<zipfileset src="lib/jaxen-core.jar"/>

<zipfileset src="lib/jaxen-jdom.jar"/>

<zipfileset src="lib/jdom.jar"/>

The list of Jar files that will be repackaged in the new Jar file with a new package name.

<rule pattern="org.jaxen.**" result="org.jdom_1_1.jaxen.@1"/>

<rule pattern="org.jdom.**" result="org.jdom_1_1.@1"/>

I’m changing the package name from org.jaxen to org.jdom_1_1.jaxen and org.jdom to org.jdom_1_1.

To use the new Jar File. Include "jdom_custom.jar" in your classpath and use the new package names. So instead of using the package name: org.jdom in your code use: org.jdom_1_1. You never have to worry about a Jar file conflict again.

Acrobat 9 is shipping and Here is how to communicate between PDF and Flash/Flex

Prior Acrobat 9, we were able to communicate between a PDF and a Flash/Flex application residing in the same browser window (e.g. the iframe approach). Acrobat 9 introduces a new feature called Rich Media Annotation that allows you to amazing stuff with Flash … one of them being the ability to embed Flash into a PDF and communicate with it via JavaScript. The example here is simple PDF document with an embedded Flex application that takes a product ID from the PDF and queries Amazon Web Services for product information (features, price, release date etc.).

Continue reading…

Zen and the Art of Offline Data Capture

Whenever, I meet with developers on how to use LiveCycle technologies (or PDF in general), I usually run into: the user fills out the data here … and the PDF is generated here. Generating a PDF for printer friendly output is good, but that’s not all a PDF can do. A PDF can capture data and save you a lot of time and overhead.

So take a traditional web-based application where a user needs to fill-out a form. Look at the over-head that is behind the web form: User Management for the user to save/retrieve a form, Load Balancing during peak-usage, complexity if the user wants to forward the form to another user, and Availability if you want to add a second form to your web-application without down-time.

Enter the world of off-line submission, provide the end user a fillable PDF; this will allow an anonymous user to fill, save, and forward the PDF to another individual (via e-mail or USB drive). When the user is done, have the user e-mail the filled PDF back to your server. The e-mail might take a few hours before reaching your server, but who cares? The end-user isn’t waiting on a spinning hourglass to stop. If you need another form, then create a new PDF and publish it. A new PDF doesn’t necessarily have to be created by the developer of your Web Application team. Another group can create the PDF as long as both of you agree to an XML Schema. See, a nice decoupled system, when was the last time you can leverage a User Interface from another team?

Not all clients implement this solution in exactly the same way as above, some have the need to submit a 200 Megabyte PDF. In this case e-mail would not work and would have to revert back to an HTTP submission, they will loose some benefits but also gain some as well. Hopefully, the reader gets some new ideas in solving some old problems.

So, if you want to prototype the solution, then the LiveCycle products you would need: LiveCycle Forms to pre-populate and extract data, LiveCycle Reader Extensions, this will allow (amongst other things) a PDF to be saved locally with Adobe Reader. And finally LiveCycle Designer that helps you create your PDF.