J2EE, the Java Enterprise specification is made up of many APIs, from the datastore level to Web servers and Web services. There are many books explaining each API, but very few books try to teach readers how to blend the APIs into their architecture. Brett McLaughlin’s “Building Java Enterprise Applications” series aims to be the must read set of books for all Java enterprise architects, both experienced and novice.
Focus on the data
Building Java Enterprise Applications Volume I: Architecture is an analysis of the data layer of an application looking into the EJB, JDBC, JNDI and JMS acronyms and how they interact. (Volume II will look into Web applications and Volume III will delve into Web services, editorial decisions pending of course.) It would probably have been more meaningful to have subtitled this first book Data Architecture or Data Layer.
The book begins with three chapters introducing the concept of the series, how to make architectural decisions, providing the necessary basics of the SQL and LDAP required to get started. Throughout these initial chapters, the book lays the groundwork for the example application, the hypothetical Forethought Brokerage, which will form the backdrop to the whole series.
The next two chapters get into the core of a common Java enterprise application, EJB Entity Beans. The aim of the chapters, as with the whole series, is not to teach what EJB is, but rather to show how the EJB part of the solution is applied to the example application. A large part of these two chapters is devoted to the important aspects of entity IDs and how best to implement them. The usual CMP vs. BMP discussion is included along with discussion concerning how LocalRemotes affect EJB architectures.
The second half of the book looks at the Manager design pattern and how to use this with the previously designed architecture. It explores, in depth, the concept of using LDAP directory services to store data instead of using a relational database. This is where the book shines, bringing the concept of using LDAP to EJB developers and EJB to LDAP developers, but it is also where the book shows a need for improvement in the J2EE specification. While SQL databases can be accessed with all the design power of EJB, LDAP directories are still only at the JDBC state with the standardized JNDI API.
The book wraps up by discussing business logic, for both JNDI/LDAP and EJB, with the usual balancing of stateful and stateless Session Beans. It then provides a chapter on JMS Messaging, which feels relatively independent from the previous chapters.
Overall the book is written well, with a tendency to slow down as it approaches a tricky subject. The books appendices cover the SQL for five major databases, though SQL Server’s absence is notable. Two LDAP servers are covered, iPlanet and OpenLDAP; and BEA WebLogic is also covered for deployments. Further information will be offered on the O’Reilly Web site, but currently there is nothing available but a code download and description of the book.
Who should read this book?
Anyone providing the architecture for a Java-based system should read this book, and then eagerly await the rest of the series. While the architecture described by Brett McLaughlin is not going to solve every system problem and convince every architect, it is not a bad one for a budding architect to start with. It provides many ideas for experienced architects to mull over and debate. The focus on LDAP/JNDI is excellent; it opened my eyes to possibilities that I hadn’t previously considered. In the end, Building Java Enterprise Applications Volume I is a book that will make you think, so keep a pen and paper handy for ideas.