Importing Existing Enterprise Applications


If you have already started developing Java enterprise application outside of NetBeans IDE, it is not too late to switch your development environment to NetBeans IDE. This process will be very easy for you if your source structure already complies with the Java BluePrints conventions. It might be a good time to study these conventions and modify your project to follow these guidelines. Your application will be easier to maintain, new developers joining your project will know immediately where things are, and the integration with NetBeans IDE and its powerful build system (entirely based on Ant) will be straightforward.

Importing Java BluePrints Conventions-Compatible Enterprise Application Projects

If you have started your development without NetBeans IDE, and you are following the Java BluePrints conventions for your project structure, you can use the Enterprise Application with Existing Sources template in the New Project wizard (shown in Figure 13-15).

Figure 13-15. New Project wizard with Enterprise Application with Existing Sources template selected


To import an existing enterprise application:

  1. Choose File | New Project.

  2. In the New Project wizard, select the Enterprise folder, select the Enterprise Application with Existing Sources template, and click Next.

  3. In the Name and Location page of the wizard (shown in Figure 13-16), fill in the Location field with a valid top-level directory containing a Java BluePrints-compliant enterprise application.

    Figure 13-16. New Project wizard Name and Location page for the Enterprise Application with Existing Sources template

    This directory should contain subdirectories for each module (web application or EJB Module) that comprises the enterprise application, and a src/conf subdirectory containing a valid enterprise application deployment descriptor file called application.xml (and, optionally, one called sunapplication.xml). If the Finish button does not get enabled, it means that these conditions are not matched.

  4. Fill in the Project Name and Project Folder fields to designate a display name and folder to contain the IDE's settings for the project, including the Ant script. The project folder specified should not already contain a build.xml file, because the IDE will generate one automatically and will not replace an existing one.

  5. After you click Finish, the enterprise application project is created, as are individual projects for each module in the application.

Importing EJB Modules

You can also import into the IDE stand-alone EJB modules (similar to how you import web application projects) by using the EJB Module with Existing Sources template in the New Project wizard.

To import an EJB module:

  1. Choose File | New Project.

  2. In the New Project wizard, select the Enterprise folder, select the EJB Module with Existing Sources template, and click Next.

  3. In the Name and Location page of the wizard (shown in Figure 13-17), fill in the Location field with a valid top-level directory containing the EJB module.

    Figure 13-17. New Project wizard Name and Location page for the EJB Module with Existing Sources template

    Your existing EJB module source does not have to adhere to any particular directory structure. You specify the locations of the configuration files, libraries, and source roots. The main requirement is that the module contain a valid ejb-jar.xml deployment descriptor.

    The location directory should not contain folders named dist, nbproject, or build or have an existing build.xml file. Warning messages should appear at the bottom of the wizard in such cases.

  4. On the Existing Sources and Libraries page of the wizard (shown in Figure 13-18), specify the following properties:

    • Configuration Files Folder. Specifies the location of your deployment descriptors and other configuration files. You must have at least a valid ejb-jar.xml deployment descriptor to complete the wizard.

    • Libraries Folder. Specifies the location of the class libraries that the EJB module depends on. All JAR files in this folder are added to the EJB Module project's classpath and packaged with the module for deployment.

      The IDE scans the folder you designate in the Libraries Folder field only once when you create the project. After the project is created, adding JAR files to this folder outside the IDE does not add them to the module's classpath. You have to add them manually through the Libraries tab of the module's Project Properties dialog box.

    Figure 13-18. New Project wizard Existing Sources and Libraries page for the EJB Module with Existing Sources template

  5. In the Source Package Folders field, add any source root folders. In the Test Package Folders field, add any test package folders (containing JUnit tests).

  6. Click Finish. A new NetBeans IDE project is created in the Projects window, and you can start using this EJB Module project like any other IDE project.

The IDE does not convert deployment descriptors from other application servers to Sun Java System Application Server deployment descriptors. An external tool you can use for this purpose, the Sun Java System migration tool, is available for free at http://java.sun.com/j2ee/1.4/download.html#migration.




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