Technologies Used in This Book


This book combines various open source technologies, shown in Table 1.1, which were chosen to provide a comprehensive solution for building enterprise applications based on Java. I have also provided alternative open source technologies, and in some cases, commercial technologies, in case you don't want to implement an end-to-end system using the technologies covered in this book. As I mentioned in the preface, this book is organized so that you can either read it end to end, go to specific chapters only, or skip a chapter if the technology being covered in it doesn't apply to you (Hibernate, for example).

Table 1.1. Technologies Covered in This Book

Chosen Technology

Category

Free/Open Source Alternatives

Commercial Alternatives

Spring Framework (springframework.org)

Inversion of Control (IoC) Container, Web Framework

HiveMind and Pico for IoC container; Struts, JavaServer Faces, Tapestry, and others for Web Framework

Not applicable

Hibernate (hibernate.org)

Persistence Framework

EJB, JDO, iBatis

Oracle's TopLink

Eclipse SDK (eclipse.org)

IDE

NetBeans, jEdit, and several others

JetBrain's IntelliJ, IBM's WebSphere Studio Application Developer

Ant (ant.apache.org)

Configuration Management

make, gnumake, nmake, jam, cruise control, maven

Microsoft nmake, MKS make

JUnit (junit.org)

Testing

TestNG, Fit.

Mercury LoadRunner

HSQLDB (hsqldb.org)

100% Java Database

MySQL, PostgreSQL, One$DB

Oracle, Microsoft, Sybase, and more

Apache Tomcat (tomcat.apache.org)

HTTP Server/Servlet Container

Jetty and several others

BEA WebLogic, IBM Websphere, Caucho Resin, and others

Mozilla Firefox (mozilla.com)

Web Browser

Microsoft Internet Explorer, Opera

Not applicable

OpenOffice.org (openoffice.org)

Office Suite (used for free form diagrams in this book)

Koffice (for Linux KDE)

Microsoft Office, StarOffice, EasyOffice


Although, this book focuses on open source technologies, this isn't because I'm an open source fanatic. In fact, on my consulting engagements, I work extensively with commercial products such as BEA's WebLogic server, Oracle's database server, and other products. However, these technologies can be considered robust enough to deploy an enterprise-ready Java application and they cost you nothing!

As I mentioned in the preface, the focus of this book is more on development and less on infrastructure, so I've used the server products that were the easiest to set up and that were, coincidentally, smaller in size. However, as you undoubtedly know, Java is not only operating-system neutral, it is also vendor-product neutral; for example, you could swap out Tomcat with something like IBM WebSphere by deploying our sample application to it. Although this might not be as simple as it sounds, it is certainly possible and something I've done multiple times with JDBC-compliant databases and servlet containers, for example.

End-to-End, Self-Contained Application in a Single WAR File

I would like to emphasize something about the technologies covered in this book and the interesting possibilities they open up. Imagine the capability to have an enterprise-ready application with an embedded database (HSQLDB, in our case), with built-in job scheduling (thanks to the Spring Framework), enterprise-level transaction management, and a few other enterprise servicesall within a single, self-contained, readily deployable web archive (.war) file!


The following two sections provide a brief description of each technology or tool, the purpose it serves, and my rationale for selecting it.

Runtime Technologies

This section provides a brief description of the runtime technologies. Runtime technologies are used to run the application after it is deployed, versus development tools, which are used to develop the application. Figure 1.1 provides a visual representation of how these technologies fit together to provide a complete runtime solution.

Figure 1.1. How the runtime technologies covered in this book fit together.


Java Platform, Standard Edition (Java SE) Development Kit (JDK)

We will use the latest version of the JDK (for example, 1.5) available from the java.sun.com website. Note that as long as we have JDK 1.4 or later, the technologies covered in this book (Hibernate and Spring, for example) will work just fine.

The Spring Framework (springframework.org)

The Spring Framework contains a large number of classes and packages, but it is designed as a modular framework that can be phased gradually into a project by using only the features needed (for example, web framework). Spring complements Java/JEE by providing an Inversion of Control (IoC) container (explained later in book), a web framework, a transaction management abstraction layer, JDBC helper classes, job scheduling APIs, email capabilities, and more. Spring has been around since 2002 and has gained considerable momentum and support from the community, including commercial vendors such as BEA Systems.

As of the writing of this book, Spring was a frontrunner in the IoC container space; however, its web framework is surprisingly popular, as well. I chose Spring for the web framework because I also needed many of its other features, such as IoC, transaction management, email, scheduling, and more.

The Spring web MVC framework is second to none when it comes to robustness, flexibility, and a well-designed framework. I was pleasantly surprised to find a large number of articles on this framework, a couple of books dedicated to this framework in the making (at the time of this writing), lots of hits on google.com (for the words spring and mvc), and even a crude online poll indicating Spring MVC was second in use only to Struts (http://www.bejug.org/confluenceBeJUG/display/BeJUG/2005/07/05/Polls+results).

Hibernate (hibernate.org)

Hibernate is an object-to-relational (OR) mapping persistence framework for Java. Hibernate can arguably be credited with bringing OR technology to the forefront for average Java developers and not just specialized OR experts. Hibernate is perhaps the most widely used OR framework currently in the world of Java developers. Hibernate also serves as a good alternative to Entity Beans, which is perhaps one of the reasons EJB 3 has adopted many techniques from Hibernate (and JDO and Toplink). Given these reasons, my decision to go with Hibernate was easier than selecting a web framework.

HSQLDB (hsqldb.org)

HSQLDB is a lightweight but complete relational database management system (RDBMS) written in 100% Java. It supports a subset of the ANSI-92 SQL standard and has a JDBC driver to interface with the database via Java programs. The popularity of HSQLDB has grown steadily over the past few years.

I decided to use HSQLDB because it is lightweight, easy to install, and because the focus of this book is on development, not infrastructure. On a project recently, we used Oracle as our database; however, I used HSQLDB in the initial stages for development while our Oracle database was being set up (slowly, thanks to corporate bureaucracy). If you use 100% ANSI SQL, in theory you could switch back and forth between a local and enterprise database during your development.

Apache Tomcat (tomcat.apache.org)

Tomcat is perhaps the most popular Java-based web server and servlet container. It is a relatively lightweight servlet container that has grown in popularity over the past few years. I chose this product because many developers are already familiar with it, so it seemed like the obvious choice. Similar to HSQLDB, which can be replaced with a more robust database (such as MySQL or Oracle), Tomcat can also be replaced with a more robust web and/or application server, such as BEA's WebLogic.

Development Tools

The following are the development tools we will use to construct our sample application.

Eclipse SDK (eclipse.org)

Eclipse is one of the best things to have happened to Java in recent years. In my opinion, it has given Java a longer life as a dominant technology. In fact, Chapter 8, "The Eclipse Phenomenon!," is dedicated to Eclipse and is loaded with information about the core IDE and the enormous number of plug-ins available for it.

The Eclipse SDK is an open source integrated development environment (IDE) founded by IBM. Eclipse in itself is a platform; however, the capability to develop plug-ins for this platform is what makes Eclipse such a powerful toolso much so that major product companies are rebuilding or repackaging their products as an Eclipse plug-in. Given that Eclipse is open source, has lots of plug-ins available for it, and has immense and growing industry support behind it, in some ways makes Eclipse a clear winner in the Java IDE space.

Eclipse's basic Java tools include source formatting, building, debugging, and integration with Ant. However, there are literally hundreds of free and commercial plug-ins available for Eclipse. From UML diagramming to database tools, if there is a demand for some functionality, you are likely to find a plug-in for it! Eclipse is covered in detail in later chapters; meanwhile, Figure 1.2 provides a preview screenshot of the Eclipse SDK on Mac OS X, Figure 1.3 shows a screenshot of Eclipse on Windows XP, and Figure 1.4 shows Eclipse on Linux.

Figure 1.2. The Eclipse SDK 3.1 on Mac OS X.


Figure 1.3. The Eclipse SDK 3.1 on Windows XP.


Figure 1.4. The Eclipse SDK 3.1 on Linux.


Ant (ant.apache.org)

Anyone working with Java these days has almost certainly heard of or worked with Ant. Ant is the most common way to build (and deploy) Java programs today. Although Ant is similar to the Unix make utility, it provides several benefits over the make utility.

Ant is covered in detail in later chapters; meanwhile, the following is a sample Ant build.xml file:

<?xml version="1.0"?> <project name="HelloTest" default="printmessage">  <target name="printmessage">   <echo message="Hello world!"/>  </target> </project>


However, when we discuss Ant in more detail in Chapter 4, "Environment Setup: JDK, Ant, and Junit," you will begin to see how powerful Ant is and why it has become the de facto build tool in the Java community.

JUnit (junit.org)

JUnit is the de facto unit-testing framework used by Java developers today. I wasn't always a fan of writing unit tests first, but recently I have come to appreciate unit tests and the notion of tests first. I'll explain later in this book how to write effective unit tests. Figure 1.5 provides a screenshot of the JUnit GUI tool to give you an idea of how you can unit test your code. However, by the time we are done with Chapter 8, you will appreciate how tightly integrated JUnit is with the Eclipse SDK.

Figure 1.5. JUnit Swing runner on Windows XP.


Firefox (mozilla.com)

You might be wondering why a web browser is explicitly listed here. Trust me, it isn't about a browser religion thing. Simply put, Firefox has a lot of features that help in web application development, and we will use a couple of these in Chapter 9, "Logging, Debugging, Monitoring, and Profiling."

What is fascinating about Firefox is the large number of useful plug-ins available for it. At the time of this writing, the https://addons.mozilla.org/ website (also accessible from the Tools, Extensions menu) had 1,091 plug-ins!

OpenOffice.org (openoffice.org)

OpenOffice.org is an open source suite of office productivity tools that competes directly with Microsoft Office. At first, I wasn't sure if listing OpenOffice.org explicitly in Table 1.1 was needed, because it isn't a core technology I'm writing about in this chapter. Also, I had checked out OpenOffice.org a couple of years ago when it was still a maturing product, and I wasn't that impressed with it. OpenOffice.org has come a long way and is equivalent to Microsoft Office in almost every respect. In fact, OpenOffice.org can also read and write natively to Microsoft Office files, seamlessly.

I chose OpenOffice.org because I bought a new laptop and wanted to give this new (and of course, free) version of OpenOffice.org a try before investing a couple of hundred bucks on Microsoft Office. I was so impressed with the latest version that I did all my free-form diagrams in this book using the OpenOffice.org suite of office tools.



Agile Java Development with Spring, Hibernate and Eclipse
Agile Java Development with Spring, Hibernate and Eclipse
ISBN: 0672328968
EAN: 2147483647
Year: 2006
Pages: 219

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net