Enterprise Bean Deployment Descriptors


One of the goals of NetBeans IDE is to keep you from having to deal with deployment descriptors as much as possible. This is achieved via the zero-configuration concept implemented in the IDE. When you use the provided commandssuch as Call Enterprise Bean, Use Database, Call Message, Send Email from your application, or Call Web Service Operationthe IDE performs the following tasks:

  • Generates the Java code snippet for the JNDI lookup code in the caller Java file.

  • Makes sure to update the Java EE deployment descriptor file by adding the corresponding EJB-REF or RESOURCE-REF elements.

  • Modifies the enterprise application project to add the necessary project dependencies if the call goes to a class or resource in another IDE project. The resulting packaging has to use the Enterprise Application Project type to make sure all of the EJB modules are correctly assembled into an enterprise application Archive (EAR) file before deployment.

Of course, you are still allowed to edit the deployment descriptors. Here also, NetBeans IDE offers significant ease-of-use features, such as two editing modes (direct XML editing with code completion and online validation features, and visual editing).

The visual editor for a deployment descriptor file (shown in Figure 11-13) is opened by double-clicking the deployment descriptor's node in the Projects window. A set of views is available. For an EJB module, for example, General and XML views are available. Also, a combo box to the right of the buttons for the views allows you to jump directly to a particular section in the deployment descriptor file.

Figure 11-13. Visual deployment descriptor editor


If you want to edit the file's XML code directly, you can switch to the XML view of the file by clicking the XML toggle button located at the top of the visual editor.

When you open an XML file in the Source Editor (shown in Figure 11-14), you are able to use code completion, which makes hand coding faster and more accurate. See Generating Code Snippets without Leaving the Keyboard in Chapter 5 for a general discussion of how code completion works.

Figure 11-14. XML deployment descriptor editor with code completion


Also note the toolbar at the top of the Source Editor. The last icon activates the XML validation action so that you can verify the conformance of the deployment descriptor file with the DTD or schema. See Figure 11-15 for an example of the output after running the XML Validation command.

Figure 11-15. Output of XML validation




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