Author(s): Filippo di Pisa.
Published: Jan 2010
Adobe Flex is a powerful option available for us to create excellent and pretty GUI. It is for the client side, but arise a question for the server side people, what could be a best and quick approach to learn how integrate Flex with Java?, therefore we have this book.
This book is an excellent material about integrations among many frameworks, and to be honest even when this book is released on 2009, is not out of date, this is something important to be considered, really it teaches very well about how do the integrations, a deeper knowledge for each framework is not mandatory!
The TOC is the follow
- Chapter 01: Developing with Java and Flex
- Chapter 02: Presenting the Sample Application
- Chapter 03: Configuring Your Development Environment
- Chapter 04: Inversion of Control
- Chapter 05: Spring JDBC and Hibernate
- Chapter 06: Spring Security
- Chapter 07: Flex (The View Layer)
- Chapter 08: Working with Data in Flex
- Chapter 09: BlazeDS
- Chapter 10: Using Flex, Spring, and Hibernate Together
Next, my review for each chapter
Chapter 01: Developing with Java and Flex
This is of course an introduction chapter, with a clever starting, explaning the reasons about why select Java and ActionScript, and then why work with Java and ActionScript together.
A quickly introduction for Spring is available, including a simple but an important image about the architecture for an application (based in layers) it going to be reflected throughout the book, furthermore including simple code explaining about how work the Dependency Injection, it based with Java and XML.
Now the turn for Hibernate, with its respective explanation, including some sample about HQL and some images about schemas, and covering about the benefits offered by Hibernate.
The author now offer us the introduction for BlazeDS, concrete and valuable theory and an important image representing how BlazeDS work with a Flex Application and a Java Application, even more, other important image about the architecture of the BlazeDS server. An interesting and very important comparison is available too about BlazeDS vs Adobe LiveCycle Data Services, it is covered with an important table comparison, practically more of one page!.
Turning now to an introduction to Flex, covering many interesting topics how with Ajax, Flash, CS3, ActionScript and MXML.
To end the chapter, something important for any project and covered here is about UML, including valuable images about use case, sequence and class diagrams
Chapter 02: Presenting the Sample Application
Really an interesting and valuable chapter, a good presentation, starting quickly with a huge UML use case diagram, where more of ten use case exists and many actors are involved, even including non human like LDAP Storage, Database Storage and MailSender. other UML diagram available is a sequence diagram about a lost password. The last diagram is the MVC architecture.
Then, the author now introduce a valuable explanation for each layer, starting with the Presentation Layer with a concrete and short theory, following with the The Service Layer showing a Java class and next including in one page a complete UML sequence diagram, about an account-creation process. The next layer is the
Data Access Layer where is included a UML class diagram about some DAO classes, and for these exists its Spring XML beans definition.
To end the chapter the Domain Model is introduced, with the User class, where it include many javax.persistence annotations
Chapter 03: Configuring Your Development Environment
For this chapter Eclipse IDE and some plugins like Maven 2 and Subclipse are covered, the author teaches us with some images how setup the Eclipse Working Set. Instructions about how install Spring IDE are covered with some images, even more, valuable theory about version of control working closely with Subversion are available too, futhermore, a good amount of subcommands with its respective example for each one is available, practically covered in six pages!, furthermore including the instructions to install Subclipse
The database provider used in the book is MySQL. Installation process is available with some images, same appreciation for MySQL GUI Tools, the author offer us some execution examples about some commands, this done in two approaches, by console or terminal and with the MySQL Query Browser (good amount of pages for this environment is available)
The container server used here is Apache Tomcat, installation process for Linux and Mac OS is available, a description for its configurations files is covered too.
More yet, how install Flex Builder Plugin for Eclipse is available, then quickly is covered the installation about Flex SDK 4.
Now comes a valuable covering about Maven, installation, configuration and even for Maven Eclipse plugin is available, instructions for how create a Maven project and explanation about the POM document are available too, furthermore some commands about how build a project with Maven are shown, even more, explanation about Dependencies and Repositories is included too.
To end the chapter and very important and valuable is about the Flex Maven Archetypes. Practically three pages based in a long table with a lot of commands, plugin and purposes are available.
Chapter 04: Inversion of Control
Starting with a concrete sample code working with interfaces and classes to show how Spring work around with the IOC’s philosophy, this is covered with the XML approach, the classic way, then explaining each one of the Spring Modules available for us, including an image about of the architecture of these modules together. Furthermore two pages of Spring Maven dependencies is available.
Then how create a Spring Project with Eclipse is covered, many pages and instructions about how to work with a Maven Project and applying a sample code about IoC.
The rest of the chapter include many sample code explaining about how configure the Spring Container, where DI based with setter and constructor approaches and other features are available, working with XML and Annotations. The author knows how keep the things simple. A good amount of pages about these features are available, therefore you have a clear vision of this solution offered by each approach.
Chapter 05: Spring JDBC and Hibernate
Starting quickly explaining the DAO Pattern with a concrete snippet code and explanation, then doing a covering about JDBC where the author first with the MySQL‘s Query Browser tool show us with images how make the creation of the database and furthermore how execute some data insertions. Now a good amount of code is available, where is included a POJO class, an interface and its respective class implementation, but this implementation is based in the old school about the JDBC world, therefore verbose code is used.
Now is the turn for Spring JDBC working with the JDBC Template, therefore you see now the huge reduction of code, a good amount of material about configuration is available for us.
The author use a Eclipse‘s feature function about comparison files, working with each DAO implementation, JDBC vs Spring JDBC Template, you have now a clear idea with an image about how Spring makes your live easier.
Then the author now covers about Hibernate, instructions about its configurations is available, even including an image about how ORM works. How do a mapping is covered with the two approaches, with XML and Annotations, a good amount of pages available for all this, even more, valuable code based with annotations covering each one of all the types of relationships between tables is offered and really well covered with a huge amount of pages. Yes, more material is available yet, the author offer us how to work with HQL, an important table doing a comparison about SQL vs HQL of many of the most important queries is included, practically three pages for this is included where you see clearly the power of HQL.
To end the chapter, covering about Transactions is available, an important image about a UML sequence diagram without transactions is included, therefore you see clearly the problem, of course other UML sequence diagram is included but working now with transactions, therefore you see clearly the solution of all this situation. A snippet XML code about how get able @Transactional support is included.
Chapter 06: Spring Security
Starting quickly with a snippet code about the tag http and others sub elements like form-login and intercept-url, all this with its respective explanation. Something well covered is about Filters, based in a table including many Filter classes, its XML namespace element and its description.
The author follow with a good covering about Authentication and Authorization, explaning the process with a UML sequence diagram, explaing about SQL, database tables and the authentication-provider working with the jdbc-user-service elements, even more working with Apache LDAP directory server is included. Many pages are available, therefore how work with ldap-user-service element is covered too.
To end the chapter a concrete and well covering is available about Decision Managers and Voters, based with snippet code and its explanation.
Chapter 07: Flex (The View Layer)
Really well covered, it offers an excellent introduction about Flex world, if you are a beginner, this chapter was written for you!. I will do mention about the most important sections
I could start with The Flex Framework Architecture which include an important image showing the architecture of many components together like AIR, Flex, Flash and ActionScript, of course with its respective explanation
An interesting covering is about Flex Development, doing mention about the Flex Builder (working with Flex 3.0.0) and including many images and instructions to create and configure a sample project, well covered in many pages. Therefore some Flex Components are explained through source code. Extensive theory about Containers is available in a good amount of pages, all about related about Containers is covered like:
Something interesting offered by the author is about Flex with Flash IDE, many images about working with both is available. Flex Events is covered too through some pages with snippet code and images and even with a UML sequence diagram.
To end the chapter many pages are available covering among other topics like Data Binding , MXML and ActionScript components, important theory and snippet code available, SWC and RSL libraries are mentioned too.
Chapter 08: Working with Data in Flex
Definively an important chapter, Data management is critical for any application or system. The author start quickly doing the introduction of the Data Models used in the application, all these based with ActionScript, even including an equivalent approach with MXML, then the author follow with the View layer, therefore starting with a form working closely with mx:Script and [Bindable] elements, other customized MXML components are introduced working with Grids and Collections.
When the previous introduction, now we turn to Data Collections, valuable theory and complete source code with its respective explanation through many pages, the code is not complex, furthermore for a better understanding images of the final result is available, then Access to Remote Data is covered, starting with the HTTPService Components where is available snippet code with this respective explanation, with all this, a huge amount of material through in 24 pages!!! is available, based in valuable source code and configuration to work with ActionScript, MXML, Maven, Java and Servlets. Even more, many images working with Eclipse IDE and about the views result for a better understanding are available, futhermore a UML Class diagram is included and more!. Again all these covered in 24 pages!!!. Really well done!
Same appreciation for RemoteObject Component and WebService Component, for this last working with Eclipse IDE tools for Web Services support like Web Services Explorer, many pages for code and images working with WebServices is available.
To end the chapter the author work with the SharedObject to store our data.
Chapter 09: BlazeDS
Starting quickly explaining the Flex BlazeDS Architecture, well covered, including an important image showing this BlazeDS architecture, furthermore including an important table about Flex Services and Their Corresponding BlazeDS Destinations and Adapters, important keep in mind this table.
After of this introduction, we forward to Configuring BlazeDS working around in three important steps instructions, like including the Maven dependencies, configuring two important Flex files like flex-services.xml and flex-remoting.xml, two pages of code for these files, and finally the configuration for our web.xml file.
Now the section Using Remoting Services is covered based with concrete theory and snippet code.
Now comes the good part, the section Creating a Flex Java POJO BlazeDS Application which is covered with a lot of pages with valuable code, this section start with two images, the first showing the layers of an application and the second the structure of the application based on Maven. About the code, again the Flex files flex-services.xml and flex-remoting.xml are included and same appreciation for the web.xml file. Code for the Data Model is available too, based of an User class or pojo. Now is the turn for the DAO layer based of an interface with its respective implementation, practically three pages of code only for this implementation, working with XOM. After this, a test code with JUnit is available, working with simple test data in XML, images about how to execute a Test class is available too. Same appreciation about some previous features mentioned before but now applied to the Service Layer. Many images about how to Run and Debug the Maven application is available.
Now turning to the client side the author teaches us how to create the Flex Client application, based about on a Chat Application, it is covered with many images to accomplish this purpose. Starting to add and work with BlazeDS for this project, where a complete pom.xml code is available, a new file called flex-messages.xml is included too, the files flex-services.xml and flex-remoting.xml are included again for this application but with some modifications, to end the chapter the respective GUI based on Flex are created, source code is available and the most important the view execution output results is included.
Chapter 10: Using Flex, Spring, and Hibernate Together
Practically after to have read almost all the book covering most of the most important and powerful frameworks based on Java, now is the turn to with work all together. This chapter include a huge amount of code, therefore be ready!
The chapter stars with The Flex-Spring-Hibernate Maven Archetype where you have two important pages about only theory covering about many sections of Maven like main and resources oriented for the Maven Archetype, after this, practically one page of the code for this archetype is included.
Therefore the author teaches us with many images how create a Maven Archetype with Eclipse, after this, other image showing the project structure is included. Now the author forward to configure with xml code the dataSource and database configuration need it for Spring and Hibernate. Even more many UML class diagrams are available for a better understanding of the application, someones like DAO, POJO and for the Service Layer.
Turning now to the Flex GUI side, again many UML class diagrams are available such as UserModel and UserControl intefaces and its respective implementations, LoginForms and UserGrid are included too, based on Form‘s and Grid‘s.
Now is the turn for the source code. Starting with POJO classes representing the User and Authority Entities where each one has included the javax.persistence annotations to be able to be persited and handle by Hibernate, the configuration for the hibernate.cfg.xml file ins included too. Now working with the DAO objects, therefore the interfaces and its implementations are available, here the author is working with Generics. Testing is covered in some pages. The code is not complex. Same appreciation about the Service Layer, interfaces, its implementation and Testing are available too.
Now the author work with BlazeDS, therefore how export our Spring services to BlazeDS is covered with the RemoteObject and the flex:remoting-destination tags. Then source code for Flex GUI is covered. Starting configuring and updating a Flex Project through many images and showing some execution images working with Grid and with a Form.
To end the chapter, source code and images to create a Login Form with Flex Builder is available, well covered with many snippet and complete ActionScript code through many pages, really in eleven pages.
What I liked:
What I disliked:
I felt the impression about more action about Flex, but you must recall and we must fair, the book’s title start with Beginning … has no sense expect a deeper covering for each framework, each one has a dedicated book!!
I regret made my decision about request this book some time late, because the book use Flex 3, but I consider not very critical or negative about this work. Even if other frameworks are little old, the philosophy and approach to teach make the integration among them are well explained
Therefore this book is not obsolete.