Posts Tagged ‘Java’

Using Maven 2, XDoclet 2, and Hibernate 3

July 3rd, 2006

Problem – You want to use the last Hibernate 3 (Object to Relational Mapping Solution) with a code generation tool that automatically generates your Hibernate descriptor files, and build your project with an advanced build tool like Maven2.

Solution – Use maven2-xdoclet2-plugin.

Maven is a popular open source build tool for enterprise Java projects; it can manage a project’s build, reporting and documentation from a central piece of information (POM file).

XDoclet is an open source code generation engine with the goal of continuous integration. It enables Attribute-Oriented Programming for java. It uses custom JavaDoc-like tags to generate external resource files to support the main Java classes. XDoclet has mainly been used for the auto-generation of EJB descriptors (and related J2EE container technologies).
XDoclet2 is a rewrite of the XDoclet engine. It allows you to use Hibernate 3 features, Java5 language features in your model POJOs, and has substantially better error reporting than XDoclet.
» Read more: Using Maven 2, XDoclet 2, and Hibernate 3

JBoss Seam 1.0 released

June 14th, 2006

JBoss Seam 1.0, an application framework for Java EE 5 based on Asynchronous JavaScript and XML(AJAX), Java Serve Faces(JSF), Enterprise Java Beans(EJB3), and other technologies, has been released.

Read more in JBoss SEAM 1.0: rethinking web application architecture at InfoQ.

The Seam project is proud to announce the release of JBoss Seam 1.0 GA, an application framework for Java EE 5. Seam aims to be the most productive platform for development of enterprise and rich internet applications in any programming language.

Seam integrates Java EE 5 technologies like EJB 3.0, JSF and JMS into a unified programming model and then narrows the semantic gap between the business domain and the Java programming language by deeply integrating technologies like jBPM for business process and user interaction modelling and Drools for management of business rules. Seam Remoting provides an AJAX-based remoting layer for EJB 3.0, allowing client-side JavaScript to call EJB session beans directly. Seam’s unique contextual state management architecture makes it easy to build applications with complex, stateful user interactions and helps eliminate a whole class of bugs endemic to browser-based applications. Seam also eliminates the “XML hell” that plagues Java frameworks designed for use with J2EE by leveraging Java 5 annotations for declarative programming.

Seam 1.0 introduces the following new features:

  • Seam Remoting – an AJAX-based remoting layer for EJB 3.0 components and JMS (created by Shane Bryzak)
  • Support for JSR-168 compliant portal engines such as JBoss Portal
  • Elegant handling of internationalization and JSF messages via EL-based interpolation
  • Helper components for JMS senders/publishers
  • JSF tag library
  • Redesigned XML-based configuration facility
  • Support for integrating databinding architectures
  • Eventing architecture for loosely-coupled components
  • Seam Logging
  • JBoss Cache integration for cluster-wide state replication
  • Experimental Drools integration
  • Compatibility with the Java EE 5 reference implementation
  • Much more…

As usual, the best way to learn about Seam is to check out the example applications. Start with the registration, numberguess, booking, blog, dvdstore and chatroom examples.

Web Beans approved by the EC Unanimously

June 8th, 2006

The Web Beans specification JSR-299 was approved unanimously by the JCP executive committee.

This is the first time JBoss (or even Red Hat) has led a JSR, so this is great news to the Java EE community!

Oh, and remember we love you (and so does Red Hat) ;)

Google Web Toolkit initial tutorial

May 31st, 2006

I’ve already commented in a previous post about the Google Web Toolkit (GWT). The Google Web Toolkit was the talk of JavaOne 2006, offering developers a way to create Ajax applications by writing Java and having the toolkit generate the client-side JavaScript, which can call back to Java servlets through an RPC-like call.

Robert Cooper offers an initial tutorial to get you up and running with GWT.

Don Brown on Unification of Struts Action and JSF

May 23rd, 2006

In Unification: Struts Action and JSF, Don Brown show us how to use Struts Action 2 and JSF as one framework.

Struts Action 2, based on the WebWork 2.2 code, has builtin support for JSF, using an approach that smoothly combines both frameworks into one configuration file, one framework. Struts Action takes the familiar Action-based approach to page logic and navigation, and sprinkles in optional support for JSF components. The result is a framework that lets the developer easily incorporate component-driven pages as application needs dictate.

The JSF components still have access to the entire JSF lifecycle while retaining the action-based paradigm.

JSF/Struts Action configuration file example:

<action name="employee" class="org.apache.struts.action2.showcase.jsf.EmployeeAction">
    <interceptor-ref name="basicStack" />
    <interceptor-ref name="jsfStack" />
    <result name="success" type="jsf" />
    <result name="index" type="redirect-action">index</result>
</action>

Sun promises to open source Java

May 17th, 2006

Sun Microsystems is planning to release the source code of the Java programming language, chief executive Jonathan Schwartz said at the JavaOne conference in San Francisco.

It’s not a question of whether we’ll open source Java, the question is how

Schwartz told delegates in his opening keynote at the tradeshow.

Google Web Toolkit: AJAX applications in Java

May 17th, 2006

Google has released Google Web Toolkit (GWT), a code generation framework that lets you code Ajax apps in pure Java.

Google Web Toolkit (GWT) is a Java development framework that lets you escape the matrix of technologies that make writing AJAX applications so difficult and error prone. With GWT, you can develop and debug AJAX applications in the Java language using the Java development tools of your choice. When you deploy your application to production, the GWT compiler to translates your Java application to browser-compliant JavaScript and HTML.

Here’s the GWT development cycle:

  1. Use your favorite Java IDE to write and debug an application in the Java language, using as many (or as few) GWT libraries as you find useful.
  2. Use GWT’s Java-to-JavaScript compiler to distill your application into a set of JavaScript and HTML files that you can serve with any web server.
  3. Confirm that your application works in each browser that you want to support, which usually takes no additional work.

A widget like tree has methods to manipulate the structure (e.g. addItem()) and event handlers (e.g. addFocusListener). Here’s how a tree is created:

CSS Style Rules

.gwt-Tree { the tree itself }
.gwt-Tree .gwt-TreeItem { a tree item }
.gwt-Tree .gwt-TreeItem-selected { a selected tree item }

Example

public class TreeExample implements EntryPoint {

    public void onModuleLoad() {
        // Create a tree with a few items in it.
        TreeItem root = new TreeItem(&quot;root&quot;);
        root.addItem(&quot;item0&quot;);
        root.addItem(&quot;item1&quot;);
        root.addItem(&quot;item2&quot;);

        Tree t = new Tree();
        t.addItem(root);

        // Add it to the root panel.
        RootPanel.get().add(t);
    }
}

Java EE 5 Passes JCP Executive Committee Unanimously

May 2nd, 2006

The Java EE 5 specification (JSR 244) has passed its final approval ballot unanimously. This means the specifications under it – JSF 1.2, JSP 2.1, EJB 3.0, JAX-WS, and other specifications – are all set to go, even if the implementations aren’t ready for prime time. This clears the way for implementations to solidify compliance, and also providing a stable target for programmers to use in development.

Database Connection Pooling with Tomcat

April 20th, 2006

You know how to open and use database connections for each user, but what about optimizing for many concurrent users?
Rather than creating and destroying connections over and over again, established practice calls for use of a pool of connections that can be reused.
Kunal Jaggi shows how to implement this strategy in Tomcat and how to stress test the app with JMeter, an open source tool for load testing with a drag-and-drop-style GUI.

Read the full article at ONJava.

XLS(MS Excel) Emitter for BIRT

April 19th, 2006

BIRT For those who wanted a XLS emitter for a long time, finally here may be a chance to taste. Thanks the Apache POI project and the new layout engine of BIRT 2.0, we can now easily create a XLS emitter though it looks obviously not that fancy yet.

You can see the full article here.