The Source for Java Technology Collaboration
User: Password:



Ludovic Champenois's Blog

January 2007 Archives


Java EE 5 APIs now in a Maven repository...

Posted by ludo on January 16, 2007 at 08:58 PM | Permalink | Comments (13)

Bonjour, comment Java?

Finally, the Java EE 5 API jar has been published via a Maven repository:  
Check https://maven-repository.dev.java.net/nonav/repository/javaee/

So if you get this api jar file, you can compile the following class:
import javax.jms.Queue;
import javax.persistence.Entity;
import javax.mail.Session;
public class Foo {
    public static void main(String[] args) {       
Queue queue = null;       
Session.getInstance(null);
    }
}

In a Maven project defined by this pom file: (notice the scope value which is 'provided')
?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>foo</groupId>
<artifactId>bar</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<description>Java source code generation library</description>
<dependencies
>
<dependency>
<groupId>javaee</groupId>
<artifactId>javaee-api</artifactId>
<version>5</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
You can compile you code with this jar, but of course you cannnot run your application with it since it contains only the Java EE 5 APIs and does not contain any method bodies. If you try to run, you would get this exception:

   Exception in thread "main" java.lang.ClassFormatError:
  Absent Code attribute in method that is not native or abstract in class file javax/mail/Session

In order to execute a Java EE 5 application, you'll still need a Java EE 5 container, like for example the GlassFish application server.
Ludo


Extending the jMaki Ajax framework with new components...

Posted by ludo on January 16, 2007 at 09:20 AM | Permalink | Comments (2)

Bonjour, comment Java?

What is the value of an Ajax components library if it cannot be extended either by you as a developer or external providers?
Well, so far the jMaki framework was bundling an impressive collection of various components (dojo, Yahoo, Google, Scriptaculous, Spry, DHTML, Flickr, jMaki own components), and now you can install Add ons component libraries like the new jMaki Charting library which is based on the dojo charting APIs. A jMaki component library is a simple ZIP file that has the following requirements:
  1. Archive must be valid jar/zip format.
  2. Root of archive must contain a "Bundle.properties" file that defines jMaki.Library.Name which is used for the NetBeans palette name
  3. Archive must contain at least 1 component under the resources directory
  4. Components meta data is defined under /templates with the relative path to the component becoming the package/class name of the component, e.g. /templates/jmaki/charting/series becomes jmaki.charting.series.
  5. For a component named "series", the series folder must contain series.ejs and series.jsp which are the fragment of code used for the Drag And drop operation via the NetBeans palette.
  6. This folder must also contain Bundle.properties that defines NAME_[package].series=... and HINT_[package].series=..., used again for the IDE palette.

That's it. So now, let's examine how you can add a set of jMaki components into your development environment. Start with downloading the jMaki charting library from https://jmaki-charting.dev.java.net/servlets/ProjectDocumentList:

Select the jMaki Charting Widget v.4.1 zip file and store it locally on your disk:

chart1.png

Then, assuming you have the jMaki NetBeans plugin installed, you can use the Tools->Palette Manager->Add jMaki Component Library menu item and navigate to the location of the library zip file you just downloaded:


chart2.png


If the selected ZIP file is the correct one, you should now see a new Palette entry called "jMaki Charting", that contains 3 new components called Area, Bar Chart and Line Chart, as seen below:


Palette before Palette after: not the new entry called
jMaki Charting with 3 new components
chart3.png chart4.png

 
Now, if you drag and drop the Line Chart component on a JSP file or a Phobos EJS view file, you should get this when running your application:

chart
This is for example the fragment of code for a Phobos EJS view file:

    <%  library.jmaki.insert(
        {
        component : "jmaki.charting.area"
        args : {
                xAxis : {
                    title : 'Months',
                    labels : ['January', 'February', 'March', 'April', 'May',
                              'June','July', 'August', 'September', 'October',
                              'November', 'December']
                    },
                yAxis : {
                    title : 'Temperature',
                    tickCount : 3
                 }}
        value : {data : [
                   {color: 'red',    values : [10, 25, 25,  5, 35,  5, 15,  5, 10, 15, 25, 30] },
                   {color: 'blue',   values : [15, 35, 15, 40, 40, 15, 20, 10, 15, 20, 30, 35 ] },
                   {color: 'pink',   values : [20, 40, 30, 35, 45, 20, 25, 15, 20, 25, 30, 40] },
                   {color: 'gray',   values : [25, 45, 25, 45, 50, 25, 35, 25, 25, 20, 35, 45] }
                   ]
               }
               );
    %/>

As you can see, the args and value objects are really JSON objects and can therefore be calculated via Phobos JavaScript controller on the server side...

Following this jMaki Charting component library example, I hope you'll find some new ways to extend your jMaki Ajax environment. If you do, please share the new components with the community.

Ludo



Oh my gosh, I've been tagged...

Posted by ludo on January 05, 2007 at 09:40 AM | Permalink | Comments (1)

Bonjour, comment Java?
I've been tagged by Brian...

Before we tag the last blogging person on the planet, let me quickly tag a few of my friends (Greg Murray, Carla Mott, Jennifer Ball, Vince Kraemer,  Inderjeet Singh ). A few things about me:
  • I do not really like blogging, same as I do not like to work. I would prefer to do nothing in the Maquis Corse, close to Ajaccio.
  • I really like blogging, and spend my entire life working on Java EE serversTools, tools, jMaki - Ajax, and Phobos JavaScript.
  • The rest of my life is trying to spend some quality time with my family. I think I should do more of that (2007 resolution?).
  • I love being in France with my family during summer time. I wish I could get 7 weeks vacation, shared between Corsica and Brittany.
  • I predict that 2007 will be to Ajax and scripting languages what 1996 was to Java: the explosion of a new wave.
A bientot,
Ludo



Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds