This chapter includes the following sections:
Application features, when packaged into a JAR file known as a Feature Archive file (FAR), provide reusable content that can be consumed by other MAF applications. A MAF application can consume one or more FAR files. A FAR file contains everything that an application feature requires, such as icon images, resource bundles, HTML files, JavaScript files, and other implementation-specific files.
A FAR also contains one maf-feature.xml
file, which identifies each of the packaged application features by a unique ID. You can edit this file to update application feature properties, such as content implementation (MAF AMX, Local HTML, Remote URL), display properties based on such factors as user roles and privileges, or device properties.
You can add a FAR as either an application library or as a view controller project. You cannot customize the FAR's contents when you add it as project library, nor can you reuse its individual artifacts. A MAF application consumes the FAR in its entirety when it is added as a library file. For example, a FAR's task flow cannot be the target of a task flow call activity. Adding a FAR as a view controller project, however, enables you to customize its artifacts, as described in Customizing MAF Application Artifacts with MDS .
An application feature is made available to a MAF application by adding it to the consuming application's class path.
Note:
You can only add the FAR to the application controller project; you cannot add a FAR to the view controller project.
Before you begin:
Deploy the application feature as a Feature Archive file, as described in How to Deploy the Feature Archive Deployment Profile.
How to add application feature content to a MAF application as a library:
Open the Resources window, and click .
Complete the File Systems Connection dialog to create a file connection to the directory that contains the Feature Archive JAR file. For more information, refer to the Oracle JDeveloper Online help.
Right-click the Feature Archive file (which is noted as a JAR file) in the Resources window.
Click Figure 8-1.
to add the consuming application's classpath, as shown inFigure 8-1 Adding a FAR to a MAF Application as a Library
Tip:
Click Remove Library from Application to remove the feature archive JAR from the consuming application's classpath.
How to add a FAR as a view controller project:
After you add a FAR as a library (or manually to the application's classpath):
The contents of the FAR display in the Application Resources under the Libraries node, as shown in Figure 8-3.
Figure 8-3 The FAR JAR File in the Application Resources of the Consuming Application
Every application feature declared in the maf-feature.xml
files included in the JARs becomes available to the consuming application, as illustrated by Figure 8-4 where the dropdown list IDs of the available application features in the JAR in addition to the one that has already been defined in the application.
Figure 8-4 Referencing the Application Features Defined in Various maf-feature.xml Files
Tip:
Manually adding the Feature Archive JAR to the application classpath also results in the application features displaying in the Insert Feature Reference dialog.
Alternatively, you can add or remove an application feature from the Resources window as follows:
Expand the feature archive JAR in the Resources window.
From the MAF Features folder, right-click an application feature.
Choose Add Feature Reference to maf-application.xml, as shown in Figure 8-5, or Remove Feature Reference from maf-application.xml, shown in Figure 8-6. Figure 8-5 illustrates adding an application feature called People from MAF_DevGuideExample.jar
.
Figure 8-5 Adding a Feature Reference
Figure 8-6 illustrates removing an application feature reference from the maf-application.xml
file.
Figure 8-6 Removing a Feature Reference
The information in the connections.xml
file located in the Feature Archive JAR is merged into the consuming application's connections.xml
file. The Log window, shown in Figure 8-7, displays naming conflicts.
Note:
You must verify whether the connections are valid in the consuming application.
Figure 8-7 The Messages Log Window Showing Name Conflicts for Connections
When you add a FAR as a view controller project:
MAF generates a view controller project that bears the same name as the imported FAR. Figure 8-8 illustrates how MAF creates a view controller project (a .jpr
file) for an imported FAR file called StockTracker (which is illustrated as StockTrackerFAR.jar
in Figure 8-2). This view controller project contains the default structure and metadata files of a MAF view controller project, as described in About the View Controller Project Resources. In particular, the FAR view controller project includes the maf-feature.xml
file. If the MAF application contains other view controller projects, you must ensure that none of these projects include application features with the same ID. See also What You May Need to Know About Enabling the Reuse of Feature Archive Resources.
Figure 8-8 The Imported FAR as a View Controller Project within a MAF Application
As with a FAR imported as a library, the information in the connections.xml
file located in the Feature Archive JAR is merged into the consuming application's connections.xml
file. MAF will create a connections.xml
file if one does not already exist in the target application.
MAF makes any .class
and JAR files included in the FAR available as a library to the view controller project by copying them into its lib
directory (such as C:\jdeveloper\mywork\
application
\
FAR view controller project
\lib
). MAF compiles these files into a file called classesFromFar.jar
.
Unlike a FAR imported as a library, you can customize the files of a view controller project.
Note:
Because the original resource bundles included in FAR might not be usable in the generated view controller project, you must create new resources bundles within the project as described in Enabling Customizations in Resource Bundles.
Like a FAR imported as a library, every application feature declared in the FAR's maf-feature.xml
file becomes available to the consuming application.
To ensure that the resources of a FAR can be used by an application, both the name of the FAR and its feature reference IDs must be globally unique. Ensure that there are no duplicate feature reference IDs in the maf-application.xml
file. Within the FAR itself, the DataControl.dcx
file must be in a unique package directory. Instead of accepting the default names for these package directories, create a unique package hierarchy for the project. Use a similar package naming system for the feature reference IDs too.