Assembling Enterprise Applications


A Java EE application is a collection of web applications and EJB modules that interact with one another and can be assembled, deployed, and executed as a unit. NetBeans IDE takes advantage of the capability to declare dependencies between projects in defining an enterprise application project. Previous chapters covered creation of individual web application and EJB Module projects. A NetBeans IDE enterprise application project aggregates these individual projects.

You can create an enterprise application project by opening the New Project wizard and selecting the Enterprise Application template as shown in Figure 13-11. You can then add individual modules (one IDE project per module) to the enterprise application.

Figure 13-11. New Project wizard with the Enterprise Application template selected


When creating an enterprise application project, the Name and Location page of the wizard (shown in Figure 13-12) gives you the option of creating one empty EJB Module project and one simple Web Application project.

Figure 13-12. New Project wizard Name and Location page for the Enterprise Application project template


You can later add web application modules and EJB modules to an enterprise application project (or remove them from the project) through the Project Properties dialog box of the enterprise application project. To do so, right-click the enterprise application's project and choose Properties. Then, in the Project Properties dialog box, select the Packaging node (see Figure 13-13) and click the Add Project button to add the web application or EJB Module projects.

Figure 13-13. Project Properties dialog box for an Enterprise Application project with the Packaging panel displayed


You will see multiple NetBeans IDE projects in the Projects window when you are working with an enterprise application (see Figure 13-14):

  • The enterprise application project itself that exposes the application deployment descriptors (application.xml and possibly sun-application.xml)

  • One NetBeans IDE project per application module

Figure 13-14. Projects window showing an Enterprise Application project that contains an EJB module and a web module (each of which is also an IDE project)


The enterprise application project delegates the build steps for all the sub-modules and packages the resulting EJB JAR files or web archive (WAR) files into a deployable application archive called an EAR (Enterprise Archive) file.

The deployment descriptor for an enterprise application is called application.xml (under the Configuration Files node in the Projects window). NetBeans IDE does not provide a visual editor for this file, mainly because you are unlikely to need to edit it. The IDE automatically updates this file whenever a module is added to or removed from the application.

An enterprise application project can be cleaned, built, executed, and deployed like any other projects in the IDE. You can also verify the application's J2EE 1.4 compliance by running the Verify Project command on the project. Right-click the project's node to see the menu of commands.



NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 279

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