About Importing a Business Component Package

Just as you can build extended Swing classes by adding the Swing JAR file to your project's library list and creating your new derived classes by extending the classes delivered in the Swing JAR file, you can build extended Business Components by adding the JAR file of business components (.class files and .xml metadata) to your project's library list and creating your new derived components by extending the components delivered in the JAR file.

As is typical with other archives, the "runtime" JAR file does not have the source in it. The application supplier might choose to make source available separately or not. Again, exactly like the Swing example, the source is available but not required to extend the base classes.

The JAR file containing the package of original components will serve as the base for the extended components. The developers who will be customizing the components, must define a library for the JAR file and add it to the library list for the project. The package of original components then must be imported into the project that will house the new customization. Within this project, a package must be created to house the customized components.

Maintaining separate packages for the existing and customized components allows customization to be performed without the danger of modifying the existing components. When a library is imported into your project, all of the contents of the library are read-only. This is to protect you from accidentally modifying the metadata of the delivered components.

The following sections describe how to:

Creating a JAR File

A JAR file containing the original components will typically be provided by the application supplier. However, if you need to create one yourself, follow these steps:

  1. Open the Deployment Profile Wizard by selecting the project in the Navigation pane and then selecting Project | Deploy | New Deployment Profile from the menu bar. In the Wizard's Deployment Panel, select the Deploy as a simple archive file option and click Next.

  2. In the Project Panel, select the package that you want to archive as a JAR file, and click Next.

  3. In the Archive Panel, specify the name and location for the JAR file in the Archive Path field. Under Delivery options, select the JAR file option. Click Finish.

  4. As JDeveloper begins to generate the JAR file, an alert box displaying Deploy now using these settings? will open. Click Yes.

JDeveloper creates the JAR file at the specified location.

Creating a Library for the JAR File

The component provider typically provides the original components in a JAR file. To use these components, the on-site developers must first define a library that refers to the JAR file of Business Components to include in your projects's library list. After you define the library, you can import it to the project.

  1. Open a Business Components Project or create a new one. This is the project where you will want to create the customized components.

  2. Open the Project Properties Panel by selecting Project | Project Properties from the menu bar.

  3. In the Libraries Panel, click Add, then click New to add a new library for the JAR file. Enter a name for the library, and click the Class path browse button to open the Edit Library Class path dialog. In this dialog, click Add Zip/JAR to locate the JAR file containing the components.

  4. Locate and select the JAR file, then click OK to add the JAR to the Edit Library Class path dialog. Click OK to close the Edit Library Class path dialog. The name of the JAR file will appear in the list of Java libraries to add to the project. Click OK to close the Add a Java library dialog.

  5. At this point, only the Properties dialog should be open. Ensure that the name of the library holding the JAR file appears in the dialog's list of Java libraries. Click OK to close the dialog.

The JAR file containing the original components is now available to the project.

Importing an Existing Package Into Your Project for Reference

Once the JAR file is available to the project, import the existing package from the JAR to the project where you want to house the customized components. These steps assume that you are working in the project where you want to customize the original components.

  1. Right-click the project and select Import Packages to open the Import Business Component XML file from jar or zip file dialog.

  2. In the Jar and Zip files scrolling list box, select the JAR file that contains the components you want to customize. When you select the JAR file, its contents are displayed in the XML Entries scrolling list box beneath it.

  3. In the XML Entries scrolling list box, select the package's XML file. Typically, it will have a name of the form package_name.xml. Click OK to close the dialog.

The dialog box closes and the package containing the existing components is added to the project. Notice that the components are added in Read-only mode. If you open any of the components in the wizards, you will notice that many of the entries are grayed-out and not editable. Although the components themselves are not editable, they can be used as the base for customized components.

You are now ready to customize or extend the original components.