IDE Features for Enterprise Development
The tools of the JDT provide a comprehensive range of features for supporting the development of Java applications. In a
These features for supporting the construction of Java applications are only a subset of those required for effectively developing J2EE systems. The tools of the Eclipse JDT do not accommodate J2EE
Two J2EE toolsets that consistently rank toward the top of the active plug-ins lists on various Eclipse Web sites are Lomboz from Object Learn, and MyEclipse from Genuitec. Each product transforms the Eclipse workbench into a J2EE development platform, adding all the wizards, editors, and views necessary for producing J2EE applications.
Lomboz is available as
MyEclipse is a commercial product, with licenses available on a yearly subscription basis. Surprisingly, for a product aimed at
For our discussion on IDE enterprise development features, the functionality shown uses Eclipse 3.0 with the MyEclipse 3.7 tools installed. The discussion covers the following:
Collectively, these features provide a highly productive J2EE development environment.
Code wizards rely on passive code generation to generate much of the
To take advantage of the productivity gains passive code generation affords, it is worthwhile selecting an IDE that provides code wizards for some of the more common J2EE operations.
Passive code generation is described in Chapter 6.
The base JDT provides wizards for generating common Java artifacts such as classes and interfaces. Installing MyEclipse enhances the Eclipse workbench with an additional set of wizards that target J2EE components.
The wizards available include project-level wizards for generating Web applications (WAR), EJB components (JAR), and enterprise application (EAR) deployments. MyEclipse also adds wizards for generating code-level artifacts, including support for generating the following:
Chapter 6 covers XDoclet, and Chapter 7 introduces Hibernate.
Figure 13-2 shows the MyEclipse EJB Wizard, used for generating XDoclet based EJB components.
Figure 13-2. MyEclipse EJB Wizard.
The EJB wizard provided by MyEclipse is template based. From the templates available, enterprise bean types of session, entity, and message-driven beans can be autogenerated. Note that the code generated is XDoclet based, and the code wizard generates a single bean implementation adorned with XDoclet annotations.
Design options for working with EJB technology are discussed in Chapter 4.
Editor Support for Multiple File Types
The editor is the tool around which the workbench revolves. A powerful code editor
You should expect most Java development tools to offer similar time saving features.
Learning the keyboard mappings for invoking these features without having to resort to pointing and clicking with the mouse makes coding a faster process.
J2EE applications require editor support for file types other than Java source. A typical J2EE project could comprise the following:
The editor should help us to quickly and accurately write files of all these types and should afford features such as context-sensitive help, syntax highlighting, and code assist (sometimes called code completion).
The Apache Velocity template engine is covered in Chapter 6.
, is the ability of the editor to display context-sensitive information relating to a particular element in the editor. For example, in the Java editor, a code assist feature would prompt the developer with a list of the available methods for an instance variable of a given type. This functionality is given various
The plug-in model of the Eclipse platform makes it
A prerequisite for any IDE is its ability to integrate with Apache Ant for performing build
The Apache Ant build utility is described in Chapter 12.
The ability to integrate an Ant build file into the IDE is
The MDA tool AndroMDA is covered in Chapter 8.
The Eclipse developers recognize the importance of Ant's role in Java software engineering and ensure that Ant is well supported by the Eclipse workbench. No additional plug-in is required to support Ant integration.
Figure 13-3 illustrates the Ant view, which forms an integral part of the Eclipse workbench.
Figure 13-3. Eclipse Ant build file view.
The Ant view lists all targets in a build file. Build targets can be invoked directly from the workbench using the Ant view. All output generated by Ant is written to the Eclipse workbench's console.
For writing build files, the Eclipse workbench comes with an Ant file-aware editor, which can be associated with all XML file types and provides syntax coloring and code assist for Ant tasks.
This level of integration with Ant makes it possible to write and run build files within the confines of the Eclipse workbench, thereby providing a single environment for project development work.
Working with Code Generators
If a project is using a code generator, then the
A major criterion for integrating the IDE with a code generator is the ability of the IDE to invoke the generator by executing targets in an Ant build file. As we learned in the previous section, Eclipse is very accomplished in this area. Furthermore, the IDE should be able to contend with multiple source paths, because it is good practice to output generated source to a different directory than that of
For working with template-driven code generators, it is desirable for the IDE to provide support for editing the template files. An open source editor for Velocity templates is available for Eclipse. The plug-in
can be downloaded from http://veloedit.
Figure 13-4 shows Veloedit editing an AndroMDA cartridge template. The editor supports both syntax highlighting and code assist for Velocity files.
Figure 13-4. Editing a Velocity template with Veloedit.
Velocity is becoming widely used for code generation, so the Veloedit plug-in enjoys a high number of downloadscurrently, about a thousand downloads a month, which is a significant amount.
The MyEclipse plug-in makes
MyEclipse extends the workbench to ensure XDoclet is well supported and adds code-assist support to the editor for the embedded XDoclet tags. Execution of the XDoclet engine for a MyEclipse project is controlled by a project Ant build file named
. The contents of this build file should not be edited directly. Instead, MyEclipse
Figure 13-5. Setting XDoclet properties with MyEclipse.
The setting for the destDir attribute that specifies the location of generated source defaults to the same location as the Java source directory.
Accepting this configuration would see generated source mixed up with handwritten code. In line with code generation best practice, you should consider changing this setting to a directory dedicated to holding the generated source. Add this new directory as a source
Having established a suitable configuration, the XDoclet build script is run via a MyEclipse menu item, available by right-clicking on the project in the package explorer view.
Server Control and Application Deployment
These integration features require the IDE to keep pace with new versions of the different application servers. You must also check that your chosen IDE or Eclipse plug-in supports your particular application server.
Eclipse relies on plug-in tools for incorporating this functionality into the workbench. For deployment, MyEclipse adds a deployment wizard to the workbench that enables J2EE modules to be deployed to a number of J2EE server types. Figure 13-6 shows the MyEclipse deployment dialog with a J2EE EAR project selected. The packaged application targets instances of the JBoss and WebLogic servers. For each server selected, you may specifying the deployment type. From the example deployment setup in Figure 13-6, an exploded deployment is specified for WLS, while for JBoss the application is deployed as an EAR file. The type of deployment selected depends on what the application server supports.
Figure 13-6. MyEclipse J2EE project deployment dialog.
MyEclipse allows J2EE servers to be configured within the IDE and adds toolbar items to enable each configured server to be started or
Eclipse's use of plug-in tools enables the integration of UML modeling tools into the workbench. A number of modeling tools are available as Eclipse plug-ins. Omondo offers Eclipse-UML, available from http://www.omondo.com. In addition, Borland produces an Eclipse modeling tool as part of its Together family of products; see http://www.borland.com.
Chapter 5 provides an overview of the main UML diagrams and discusses modeling tools.
Few J2EE solutions are
One area where many
Although they do not offer the same level of sophistication as the best-of-breed database tools, most IDEs offer some form of database access. A few open source database tools are available for Eclipse. One offering is Quantum DB, a useful query editor that allows the execution of SQL statements and the contents of database tables to be interrogated via a JDBC driver. MyEclipse also includes a tool with similar functionality. Although limited, this simple functionality comes in very useful and can be a great time saver when it comes to checking the results of test runs or preparing test data on the database.
Over time, mainstream database-management products may migrate to the Eclipse platform, making a fully integrated development environment possible.