Oracle® Application Development Framework Developer's Guide For Forms/4GL Developers 10g (10.1.3.1.0) Part Number B25947-01 |
|
|
View PDF |
Before you begin to develop application-specific business components, Oracle recommends that you consider creating a complete layer of framework extension classes and setting up your project-level preferences to use that layer by default. You might not have any custom code in mind to put in some (or any!) of these framework extension classes yet, but the first time you encounter a need to:
Add a generic feature that all your company's application modules require
Augment a built-in feature with some custom, generic processing
Workaround a bug you encounter in a generic way
You will be glad you heeded this recommendation. Failure to set up these preferences at the outset can present your team with a substantial inconvenience if you discover mid-project that all of your entity objects, for example, require a new generic feature, augmented built-in feature, or a generic bug workaround. Putting a complete layer of framework classes in place to be automatically used by JDeveloper at the start of your project is an insurance policy against this inconvenience and the wasted time related to dealing with it later in the project.
A common set of customized framework base classes in a package name of your own choosing like com.yourcompany.adfextensions
, each importing the oracle.jbo.server.*
package, would consist of the following classes:
public class CustomEntityImpl extends EntityImpl
public class CustomEntityDefImpl extends EntityDefImpl
public class CustomViewObjectImpl extends ViewObjectImpl
public class CustomViewRowImpl extends ViewRowImpl
public class CustomApplicationModuleImpl extends ApplicationModuleImpl
public class CustomDBTransactionImpl extends DBTransactionImpl2
public class CustomDatabaseTransactionFactory extends DatabaseTransactionFactory
To make your framework extension layer classes easier to package as a reusable library, Oracle recommends creating them in a separate project from the projects that use them. In the SRDemo application, the FrameworkExtensions
project contains all of the framework extension classes used by the application.
Note: For your convenience, theFrameworkExtensions project in the AdvancedExamples workspace contains a set of these classes. You can select the com.yourcompany.adfextensions package in the Application Navigator and choose the Refactor > Rename option from the context menu to change the package name of all the classes to a name you prefer. |
For completeness, you may also want to create customized framework classes for the following classes as well, note however that overriding anything in these classes would be a fairly rare requirement.
public class CustomViewDefImpl extends ViewDefImpl
public class CustomEntityCache extends EntityCache
public class CustomApplicationModuleDefImpl extends ApplicationModuleDefImpl
Use the Create Deployment Profile: JAR File dialog to create a JAR file containing the classes in your framework extension layer. This is available in the New Gallery in the General > Deployment Files category.
Note: If you don't see the Deployment Profiles category in the New Gallery, set the Filter By dropdown list at the top of the dialog to the All Technologies choice to make it visible. |
Give the deployment profile a name like FrameworkExtensions
and click OK. By default the JAR file will include all class files in the project. Since this is exactly what you want, when the JAR Deployment Profile Properties dialog appears, you can just click OK to finish.
Finally, to create the JAR file, select the FrameworkExtensions.deploy
node in the Application Navigator under the Resources folder, and choose Deploy to JAR File on the context menu. A Deployment tab appears in the JDeveloper Log window that should display feedback like:
---- Deployment started. ---- Apr 28, 2006 1:42:39 PM Running dependency analysis... Wrote JAR file to ...\FrameworkExtensions\deploy\FrameworkExtensions.jar Elapsed time for deployment: less than one second ---- Deployment finished. ---- Apr 28, 2006 1:42:39 PM
JDeveloper uses named libraries as a convenient way to organize the one or more JAR files that comprise reusable component libraries. To define a library for your framework extensions JAR file, do the following:
Choose Tools > Manage Libraries from the JDeveloper main menu.
In the Manage Libraries dialog, select the Libraries tab.
Select the User folder in the tree and click the New button.
In the Create Library dialog that appears, name the library "Framework Extension Layer" and select the Class Path node and click Add Entry.
Use the Select Path Entry dialog that appears to select the FrameworkExtensions.jar
file that contains the class files for the framework extension components, then click Select.
Select the Source Path node and click Add Entry.
Use the Select Path Entry dialog that appears to select the ..\FrameworkExtensions\src
directory where the source files for the framework extension classes reside, then click Select.
Click OK to dismiss the Create Library dialog and define the new library.
When finished, you will see your new "Framework Extension Layer" user-defined library, as shown in Figure 25-6. You can then add this library to the library list of any project where you will be building business services, and your custom framework extension classes will be available to reference as the preferred component base classes.