Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

JBoss Tools 3 Developers Guide
JBoss Tools 3 Developers Guide
JBoss Tools 3 Developers Guide
Ebook760 pages4 hours

JBoss Tools 3 Developers Guide

Rating: 0 out of 5 stars

()

Read preview

About this ebook

Since these technologies covered are different from each other, they are covered in separate chapters that are not interdependent; therefore you can learn to use whichever tool you want, without exploring the previous chapters. This approach sustains the learning per example paradigm and helps you to use the book as a quick guide for your favorite technologies. This book is recommended for Java developers who use at least one of the covered technologies (JSF, Struts, Hibernate, Seam, and so on). It is for all Java developers who are looking for a powerful, unitary tool, especially designed to increase the speed of development and quality of Java web applications. No matter how much (or how little) experience they have, developers of all levels will benefit as their use of JBoss Tools is directly proportional to the complexity of their application. Since JBoss Tools covers all levels of experience, you can use it at your own level for your own applications, without involving unnecessary features. All you need is to be familiar with the Eclipse environment and Java core, and to have some expertise in the technology for which you want to use the JBoss Tools. Basic expertise for each technology is provided in the book, but for more complete and detailed aspects you should read dedicated specifications, tutorials, and articles.
LanguageEnglish
Release dateApr 17, 2009
ISBN9781847196156
JBoss Tools 3 Developers Guide

Read more from Anghel Leonard

Related to JBoss Tools 3 Developers Guide

Related ebooks

Information Technology For You

View More

Related articles

Reviews for JBoss Tools 3 Developers Guide

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    JBoss Tools 3 Developers Guide - Anghel Leonard

    Table of Contents

    JBoss Tools 3 Developer's Guide

    Credits

    About the Author

    About the Reviewers

    Preface

    What this book covers

    What you need for this book

    Who this book is for

    Conventions

    Reader feedback

    Customer support

    Downloading the example code for the book

    Errata

    Piracy

    Questions

    1. An overview of JBoss Tools

    What's new in JBoss Tools 3?

    Installing JBoss Tools

    Installing Eclipse version 3.4.x (Eclipse Ganymede)

    Installing JBoss Tools through Eclipse software updates

    Manual installation of JBoss Tools

    Summary

    2. JBoss AS Tools

    JBoss AS plug-in and the Eclipse Web Tools Platform

    Adding a WTP Runtime in Eclipse

    Adding a WTP server in Eclipse

    Creating our first web project—a dynamic web project stub

    Deploying the test project on JBoss 4.2 Server

    JBoss AS Perspective

    JBoss Server View

    Top part of JBoss Server View

    Starting the JBoss AS

    Stopping the JBoss AS

    Additional operations on JBoss AS

    Server publish status

    Bottom part of JBoss Server View

    Modules category

    Event Log category

    XML configuration category

    JMX Console category

    Project archives view

    Creating and deploying projects

    Summary

    3. JBoss Tools Palette

    JBoss Tools Palette Toolbar

    Palette Editor

    Creating a set of icons

    Importing an icon

    Creating a group of tag libraries

    Creating a tag library

    Creating a new tag

    Show/Hide

    Importing third-party tag libraries

    Using tags in text files

    Summary

    4. JSF Tools

    Overview of JSF

    Creating a JSF project stub

    JSF Project Verification

    JSF application configuration file

    The Diagram view

    Creating pages

    Adding navigation rules

    The Tree view

    Working with Managed Beans

    Working with custom converters

    Working with custom validators

    The Source view

    Editing pages code sources

    Editing the register.jsp page

    Editing the success.jsp page

    Editing a start page for the registerJSF project

    Testing the registerJSF project

    Adding/Removing JSF capabilities for an existing project

    Facelets support

    Summary

    5. Struts Tools

    Overview of Struts

    Struts project verification

    Creating a Struts project stub

    Struts editors

    Graphical editor for struts-config.xml

    Diagram view

    Creating JSP pages

    Creating an action mapping

    Connecting a JSP page with action mappings

    Creating a forward

    Creating a global forward

    Creating a global exception

    Let's add some code inside JSPs

    Generate source code

    Tree view

    Creating a form bean

    Source view

    Graphical editor for tiles files

    Creating a new tiles file

    Tree view

    Diagram view

    Source view

    Create a start page for the registerStruts application

    Testing registerStruts application

    Struts Tools and validation aspects

    Turning on the automatic validator

    Creating the properties file for validation purposes

    Graphical editor for validation files

    Custom message for the name property (required rule)

    Custom message for the zip property (required and mask rules)

    Custom message for the email property (required and email rules)

    Client-side validation

    Server-side validation

    Debugging support for Struts projects

    Summary

    6. Seam Tools

    Overview of Seam

    Preparations

    Creating a new Seam project

    General section

    Database section

    Code Generation section

    Test testSeam project

    Creating Seam components

    Creating a Seam Action

    Creating a Seam Form

    Creating a Seam Conversation

    Creating a Seam Entity

    Seam views

    Seam Components view

    Project Explorer view

    Using TestNG for Seam projects

    Generating a Seam project from an existing database

    Running the generated Seam application (generateSeam)

    Modify Seam preferences

    Summary

    7. Hibernate Tools

    Overview of Hibernate

    Preparations

    Hibernate Tools for Eclipse

    Manual installation

    Hibernate perspective

    Creating a Hibernate mapping file (.hbm.xml)

    Hibernate XML Editor

    Tree View

    Adding a element

    Adding an element

    Adding a element

    Adding a element

    Adding a element

    Creating a Hibernate configuration file

    Hibernate Configuration XML Editor

    Session Factory view

    Security view

    Source view

    Creating a Hibernate Console Configuration

    Main tab

    Options tab

    Classpath tab

    Mappings tab

    Common tab

    Hibernate Configurations view

    Mapping diagram

    HQL Editor

    Hibernate Criteria Editor

    Hibernate Query Result view

    Hibernate Dynamic SQL Preview view

    Query Parameters view

    Properties view

    Reverse engineering and code generation techniques

    Main tab

    Exporters tab

    Refresh tab

    Common tab

    Generating Hibernate artifacts

    Customize and control reverse engineering (reveng.xml)

    Overview view

    Table Filters view

    Type Mappings view

    Table & Columns view

    Design view

    Source view

    Hibernate Tools for Ant

    The Ant Task

    Adding Hibernate tools dependencies

    Hibernate Configurations

    Hibernate Tools exporters

    Hibernate Mapping Files Exporter

    POJOs Exporter

    Hibernate Configuration File Exporter

    Database Schema Exporter

    Documentation Exporter

    Query Exporter

    Import all libraries dependencies

    Summary

    8. jBPM Tools

    Downloading and installing the JBoss jBPM Suite

    Creating a jBPM stub project

    Creating a jBPM process definition

    Launching the jBPM JPDL perspective

    jBPM GPD Editor

    Diagram view

    Adding states

    Adding task-nodes

    Adding nodes

    Adding a fork-join system

    Adding a mail node

    Adding transitions

    Customizing node names

    Customizing transition's names

    Defining swimlanes

    Defining a task for the start-state

    Defining a task for the task-node

    Decorating graph with actions

    Configuring Mail node

    Source view

    Design view

    Deployment view

    Running a process on JBoss jBPM server

    Creating a JUnit test for a jBPM process

    Summary

    9. ESB Tools

    Downloading and installing the JBossESB Server

    Creating a JBossESB stub project

    JBoss ESB Editor

    Defining a Service skeleton in JBossESB

    Defining the Action Pipeline

    Defining a list of Listeners

    Configuring message queues in JBossESB Server

    Indicating the classes loading order

    Sending an ESB Message through the ServiceInvoker

    Sending a JMS Message in a classical manner

    Service Registry configuration

    Importing the endorsed libraries

    Preparing and deploying a Service on JBossESB Server

    Testing the ESB Service

    What just happened?

    Summary

    10. Web Services Tools—JBossWS

    Overview of Web Services

    Downloading and installing JBossWS Native

    Configuring JBossWS under Eclispe IDE

    Creating a web service using Web Services Tools

    Adding the JBoss Web Service facet

    Writing a WSDL document using the WSDL wizard

    Generating the web service from a WSDL document

    Providing service business logic

    Generating the web service's client from a WSDL

    Providing client business logic

    Deploying and testing a web service

    Testing a web service through Web Services Explorer

    Creating a Web service from a Java bean

    Publishing web services and business entities

    A brief introduction to UDDI

    JBoss AS 4.2 and jUDDI

    Preparing the jUDDI database

    Using Web Services Explorer as a UDDI Browser

    Adding a Registry to the Web Services Explorer

    Publishing a business entity

    Publishing a web service

    Discovering our own web service through WSE

    Discovering external web service through WSE

    WSDL to WSIL, WSIL in WSE

    Convert WSDL to WSIL

    WSIL and WSE

    Summary

    11. JBoss Portal Tools

    Overview of Portals and Portlets

    Downloading and installing JBoss Portal + JBoss AS

    Configuring the JBoss Portal bundle under Eclipse IDE

    Starting JBoss Portal

    Adding a Java portlet in JBoss Portal

    Adding JBoss Portlets Facet

    Creating a Java Portlet

    Deploying and running a portlet

    Adding a JSP portlet in JBoss Portal

    Creating a JSP Portlet

    Implementing the init method

    Implementing the doView method

    Implementing the view.jsp page

    Implementing the doEdit method

    Implementing the edit.jsp page

    Implementing the doHelp method

    Implementing the help.jsp page

    Implementing the processAction method

    Writing and configuring a dedicated validator

    Adding a JSF portlet in JBoss Portal

    Adding a Seam portlet in JBoss Portal

    Summary

    Index

    JBoss Tools 3 Developer's Guide

    Anghel Leonard


    JBoss Tools 3 Developer's Guide

    Copyright © 2009 Packt Publishing

    All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

    Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers or distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

    Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

    First published: April 2009

    Production Reference: 1090409

    Published by Packt Publishing Ltd.

    32 Lincoln Road

    Olton

    Birmingham, B27 6PA, UK.

    ISBN 978-1-847196-14-9

    www.packtpub.com

    Cover Image by Karl Moore (<karl.moore@ukonline.co.uk>)

    Credits

    Author

    Anghel Leonard

    Reviewers

    Joseph Edem Morny

    Peter Johnson

    Acquisition Editor

    Sarah Cullington

    Development Editor

    Dhiraj Chandiramani

    Technical Editor

    Abhinav Prasoon

    Copy Editor

    Ajay Shanker

    Indexer

    Hemangini Bari

    Editorial Team Leader

    Abhijeet Deobhakta

    Project Team Leader

    Lata Basantani

    Project Coordinator

    Leena Purkait

    Proofreader

    Laura Booth

    Production Coordinator

    Aparna Bhagat

    Cover Work

    Aparna Bhagat

    About the Author

    Anghel Leonard is a senior Java developer with more than 12 years of experience in Java SE, Java EE, and the related frameworks. He wrote and published more than 20 articles about Java technologies and more than 100 tips and tricks. Also, he wrote two books about XML and Java (one for beginners and one for advanced). In this time, he developed web applications using the latest technologies on the market. In the past two years he has been focused on developing RIA projects for GIS fields. He is interested to bring onto the Web as much desktop as possible, therefore GIS applications represent a real challenge for him.

    I want to thank my family, especially my wife.

    About the Reviewers

    Joseph Edem Morny has been involved in Enterprise Java technologies since he got introduced to Java in 2005, using open source tools and technologies like JBoss AS and JBoss Seam. His favourite web framework is Seam, which he has been using since its pre 1.5 days.

    He has been an active promoter of Java EE and Seam, organizing workshops and seminars on university campuses where he worked as a teaching assistant, and on a national scale at Ghana's foremost institution of IT, Kofi Annan Centre for IT Excellence. Edem holds a Bsc Computer Science from KNUST in Ghana. He is also a SCJP, SCWCD and SCBCD.

    Edem is a senior developer at the application development center in Accra, Ghana of an international biometric security solutions company, leading thedevelopment of Biocryptic Identity Management Systems for the global market.

    Peter Johnson has been working in information technology since 1980, starting with mainframes, then to Solaris, then Windows, and now also on Linux. In the 90s, he developed using C++ and for the last 9 years has been working with Java. He works in a team that evaluates open source software for inclusion in an open source stack that is offered on Unisys and other hardware. In addition, he spends a lot of time on performance tuning and speaks regularly on that topic at various international conferences, such as the Computer Measurement Group Conference, JBoss World and Linux World. Peter is also currently co-authoring a book on JBoss Application Server, and is a JBoss committer and frequent JBoss forum contributor.

    Preface

    This book will show you how to develop a set of Java projects using a variety of technologies and scenarios. Everything is described through the eyes of JBoss Tools.

    After we settle on the project (or scenario) that will be developed, we will configure the proper environment for the current tool (those projects selected will cover between them the main components of a web application in terms of the backstage technology). We continue by exploring the tool for accomplishing our tasks and developing the project's components. A cocktail of images, theoretical aspects, source codes, and step-by-step examples will offer you a thoroughgoing for every tool. At the end, the project will be deployed and tested. In addition, every chapter is lard with pure notions about the underlying technology, which will initiate you into, or remind you of, the basic aspects of it.

    This book will show you complete and functional applications, and will familiarize you with the main aspects of every tool. By the end you will have been provided with sufficient information to successfully handle your own projects through JBoss Tools.

    What this book covers

    Chapter 1 is a compressive chapter that will help you discover the features brought by the new JBoss Tools 3.0. The main goal of this chapter is to make an introduction to what will follow in the next chapters and to wake up your curiosity. In addition, the reader can see different possibilities of installing JBoss Tools on different platforms and for different goals.

    Chapter 2 teaches you how to use Eclipse and JBoss AS in a symbiotic manner. In this chapter you will see how to use the JBoss AS Tools to configure, start, stop and monitor the JBoss AS directly from Eclipse IDE. Also, you can see how to create and deploy new projects.

    Chapter 3 is a collection of tag-components from different technologies as Ajax, JSF, RichFaces, Seam, and so on. Because the components are built on the drag-and-drop technique, this tool is very easy to use, especially when you need a fast method for generating tags into JSP pages. This chapter will cover—with description and examples—the most important tags that can be generated through JBoss Palette. Also, the chapter will contain a section about the Palette Options.

    Chapter 4 will talk about punctual framework's tools and I will start with JBoss Tools for Java Server Faces. After I present the Faces Config Editor, which is the main visual component for JSF support, I will follow the framework mains characteristics and I will discuss—from the JSF Tools perspective—about managed beans, validators, converters, navigation rules, and so on.

    Chapter 5 will give you a complete cover of the graphical Struts editors that are used for generating/managing XML documents (configuration, tiles, validators). Also, you will see how to work with code generation and debug support for Struts projects. Everything will be sustained by images (captures) and examples.

    Chapter 6 will show you how to accomplish the most important modules of a Seam project, like Action, Form, Entity, and so on through the Seam Tools filter in the first part. Later, in the second part of the chapter, you will work with the visual editors dedicated to increasing the speed of developing/controlling Seam components.

    Chapter 7 will show some advanced skills, like Hibernate and Ant, generation of POJOs, debugging goals and reverse engineering control after a detailed presentation of how to use Hibernate Tools to speed up the configuration and mapping tasks.

    Chapter 8 will discuss about the jBPM Tools. You will see how to develop and test a complete jBPM project.

    Chapter 9 will detail the main concepts of JBossESB Services, and you will see how to use ESB Tools to develop such a Service.

    Chapter 10 will help you create from scratch a WSDL document using WSDL Editor. You will generate a complete web service from a WSDL document and from a Java bean using WS Tools wizards, and you will publish a web service using jUDDI and Web Services Explorer. In addition, you will see how to generate a web service's client, how to test a web service through Web Services Explorer, how to convert WSDL documents to WSIL documents and how to inspect WSDL web services through WSIL and WSE.

    Chapter 11 will work with the Portal Tools. You will see how to use the wizards for creating projects with Portlet Facets, creating the Java Portlet wizard and creating the JSF/Seam Portlet wizard.

    What you need for this book

    As different software products are involved in this book, it is pretty hard to recommend a list of system requirements and operating systems. Nevertheless, we have developed this book using the following specifications (use this configuration as a mark):

    Mobile AMD Sempron (tm)

    Processor 3400+

    789MHz, 896 MB of RAM

    Physical Address Extension.

    Following are the software requirements for this book:

    Microsoft Windows XP Professional Version 2002 Service Pack 2 (or any other supported operating system)

    Java 5 and Java 6 for Windows (or your operating system)

    Rest of software, such as Eclipse, JBoss Application Server and so on, will be installed through the book.

    Who this book is for

    This book is recommended to Java developers that use at least one of the covered technologies (JSF, Struts, Hibernate, Seam and so on). This book is for all Java developers who are looking for a unitary and powerful tool, especially designed for increasing the speed of developing, and for improving the quality of, Java web applications.

    No matter how much, or how little, experience you have, developers of all levels will benefit as your use of JBoss Tools is directly proportional to the complexity of your application. Since JBoss Tools covers all level of experience, you may use it at your own level for your own applications, without involving unnecessary features. All you have to be familiar with is Eclipse environment, Java core, and you must have some expertise in the technology for which you want to use the JBoss Tools. Basic expertise for each technology is provided in the book, but for more complete and detailed aspects you should read dedicated specifications, tutorials, and articles.

    Conventions

    In this book you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

    Code words in text are shown as follows: We can include other contexts through the use of the include directive.

    A block of code will be set as follows:

    overflow: auto; width: 270px; height:375px; padding:0px; margin: 0px>

    top nowrap>

    When we wish to draw your attention to a particular part of a code block, the relevant lines or items will be shown in bold:

    // Global Forwards public static final String GLOBAL_FORWARD_start = start;

     

    // Local Forwards

    public static final String FORWARD_success = success;

    Any command-line input or output is written as follows:

    eclipse –clean

    New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in our text like this: clicking the Next button moves you to the next screen.

    Note

    Warnings or important notes appear in a box like this.

    Tip

    Tips and tricks appear like this.

    Reader feedback

    Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

    To send us general feedback, simply drop an email to <feedback@packtpub.com>, and mention the book title in the subject of your message.

    If there is a book that you need and would like to see us publish, please send us a note via the SUGGEST A TITLE form on www.packtpub.com, or send an email to .

    If there is a topic that you have expertise in and you are interested in either writing or contributing to a book on, see our author guide on www.packtpub.com/authors.

    Customer support

    Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

    Downloading the example code for the book

    Visit http://www.packtpub.com/files/code/6149_Code.zip to directly download the example code.

    The downloadable files contain instructions on how to use them.

    Errata

    Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in text or code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration, and help us to improve the subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the let us know link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata added to any list of existing errata. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

    Piracy

    Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately, so that we can pursue a remedy.

    Please contact us at <copyright@packtpub.com> with a link to the suspected pirated material.

    We appreciate your help in protecting our authors, and our ability to bring you valuable content.

    Questions

    You can contact us at <questions@packtpub.com> if you are having a problem with any aspect of this book, and we will do our best to address it.

    Chapter 1. An overview of JBoss Tools

    As you probably know, JBoss Tools are a set of Eclipse plug-ins that offer support for developing, deploying, and testing applications based on JBoss.org (http://www.jboss.org/) projects.

    If this definition doesn't say much, then let's just say that JBoss Tools is an all-in-one product that provides complete support for developing Java SE and Java EE applications. Also, it's important to note that JBoss Tools can sustain the development of each tier of an enterprise/desktop application by providing dedicated components like editors, wizards, syntax-highlighting, import/export skills, code completion, refactoring, etc.

    If you are familiar with the JBoss Tools evolution, then it is impossible to skip the fact that the new JBoss Tools 3 Candidate Release 2 (JBoss Tools 3.0.0 CR2) version is the king of all versions. But, if JBoss Tools is a new challenge for you, then try to be careful; JBoss Tools creates dependency and it seems that the current software market doesn't offer an antidote yet. This compelling superiority is because JBoss Tools provides tools for both standard J2SE/J2EE technologies like EJB3 and JPA as well as open source technologies that have become widely accepted in enterprise Java development, for example, Hibernate, JBPM, Seam, etc. It brings everything that you'll ever need—together!

    Looking inside the 3.0.0 CR2 bundle, we see the following tools (this is just a brief overview meant to reveal the JBoss Tools covered technologies):

    JBoss AS Tools: To manage application servers (especially for JBoss AS)

    JBoss JSF Tools: Tools dedicated to supporting JSF/JSF-related technologies

    JBoss Struts Tools: Tools dedicated to the Struts framework

    JBoss Seam Tools: Tools dedicated to Seam projects

    JBoss Hibernate Tools: Tools dedicated to the Hibernate framework

    JBoss jBPM Tools: Tools to design and deploy jBPM business processes

    JBossWS Tools: WTP Tooling for JBoss Web Services

    Portlet Tools: Tooling for Portlets

    JBoss ESB Tools: Tools to develop ESB components

    JBoss XDoclet Tools: Tools to integrate XDoclet in Eclipse

    JBoss Freemarker IDE: Syntax-highlighting editor for Freemarker files

    JBoss RichFaces VPE: Visual Page editor for Richfaces, JSF, HTML, and CSS

    BIRT Tools: Reporting Tooling for JBoss J2EE Servers (not presented in this book)

    JBoss Smooks: Tooling Tools for Smooks (not presented in this book)

    Next, in this chapter, you will see a brief listing of the features of JBoss Tools and after that we will proceed to install and configure the 3.0.0 CR2 release.

    Further, in the following chapters, we will discuss the main tools and see that JBoss Tools can be a complete solution for Java developers.

    What's new in JBoss Tools 3?

    To amaze its fans and win new ones, JBoss Tools comes with a long list of bug fixes and very important add-ons, like Seam 2, JBossWS, and Mac OS X support. Based on new features and the finest interactivity, JBoss Tools give us a strong feeling of control and robustness.

    Here is a short list of the JBoss Tools features. These are the checkpoints in JBoss Tools evolution from its first release until version 3.0.0 CR2:

    Seam Tools:

    Change Seam parent project

    Easier view-id selection

    Seam pages editor preferences

    Seam Ear project validator

    Seam project settings validator

    Seam components/EL

    Sub classes/inner classes

    Hibernate Tools:

    Console configuration created for JPA project

    Export diagram

    Query

    Enjoying the preview?
    Page 1 of 1