Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Monday, April 23, 2012

Excel and PDF creation

What to use for excel or PDF generation ?

PDF - Apache PDFbox http://pdfbox.apache.org/
XLS - Java Excel API http://jexcelapi.sourceforge.net/
XML and XLST - Apache FOP http://xmlgraphics.apache.org/fop/
Office - Apache POI http://poi.apache.org/

or use of a reporting engine like BIRT or OpenReports

Sunday, April 1, 2012

Apache Wicket

Apache Wicket is a servlet based web toolkit using the model view control architecture. The beauty is the clear separation of gui design / markup using HTML/CSS and the logic by using pure Java.

Working with detachable models enable easy usage of your database data within the provided widgets. Standard functionality is available to build session based web application. You can as well integrate Ajax functions, there is an integration to JQuery.

Wicket offers a very nice set of widgets and data tables/views.

The yafra example shows a small application which is similar to the RCP fat client set up. It uses Apache Cayenne on the back which integrates well with Wicket.

One careful consideration during design must be the influence of threads and Apache Cayenne. Cayenne context can be easily managed through a Cayenne Filter (which must be the first filter entry in your web.xml).

Links:
Yafra Wicket example: http://sourceforge.net/apps/trac/yafra/wiki/Wicketclient
Wicket: http://wicket.apache.org/

Saturday, March 17, 2012

Tutorials

In order to pick up the technologies around Java, Eclipse and others please follow the tutorial on http://www.vogella.de/tutorials.html

They provide an excellent starting point and in depth information.

Lars Vogel covers with his tutorial most of the technologies used within the YAFRA framework. Great work !

Saturday, March 10, 2012

RESTful and web services test clients

In order to easily test you RESTful services we recommend to use the java application  http://rest-client.googlecode.com/

An easy to use java application which lets you make all sorts of http calls and gives you all details in a structured way.

Similar to the eclipse web services explorer to inspect and test a web service (started by Run->Launch the web services explorer).

Both of those "clients" allow you to test your services without coding a client.

Usage of Apache TomEE

Starting situation: we have some EJB's using Apache Cayenne and want to provide some web services or RESTful services hosted on an application server. Geronimo, Jonas et al are all quite complex and a more simpler server would benefit for small applications or development environments.

Approach: having used already OpenEJB with Apache Cayenne brought our attention to the new Apache TomEE. As we wanted to use as well Apache CXF in order to provide JAX-WS/RS services the usage of Apache TomEE Plus caused quite some issues with CXF. TomEE Plus has bundled CXF however using CXF from its original distribution is more desired. So switching back to the "Web Profile" and the using CXF out of the box brought the desired environment. Deploying of a war containing the EJB jar and all the rest had the right effect. EJB's were available like you would deploy them through an EAR directly to OpenEJB and the access was available as http://127.0.0.1:8080/openejb/ejb.

All in all this seams to be the right setup and runs easily on Unix and Windows. As of writing Apache TomEE was just released as 1.0 Beta 2. See yafra wiki for more information on setup and development.

Saturday, August 21, 2010

Web Services with Apache CXF and Cayenne

This new module shall show the integration with a standard web service framework. Apache Cayenne provides a web services framework with Hessian, but with this example it shows how you could use Cayenne with CXF.

As parts of the application will be running in different JVM, we need data transfer objects. Apache Cayenne is used on the server side, while the client uses only distributed DTO's and handlers.

First of all the choice of Apache CXF instead of Axis2 was mainly because of the tighter integration of Java web service standards and the opportunity of OSGi usage in the future. The documentation on some parts of Java web services is not the best today (in 2010) but many googled resources indicate that the web service arena is still in heavy development to enable enterprise like programming requests and interopability between Java and other platforms such as .NET.

The example shall show a hello world like example but based on yafra using a database backend through Cayenne as ORM and some basic session functionalities. As the web service server is started as standalone server the usage of a singleton is needed to set the Cayenne context at startup. Basic session handling is possible and will store session id and some stuff like username or others.

Requests to handlers/functions/processes can be simple web services, even accessible outside of a full application client but as well fully integrated with session access to verify that a session was allowed before you get other data.

As many of the standards within web services are not yet mature enough like servlets or EJB's, many things are still proprietary to an implementation like Apache CXF or subject of changes in the future. Therefore the example is only a basic one.

The key idea was to have an adapter within the Eclipse RCP fat client to exchange the server handling between EJB's and Web Services. This needs still to be worked out and of course is only useful for this framework in sense as an example of Java technology usage.