ADF Reusable Artefacts
- by Arda Eralp
Primary reusable ADF Business Component:
Entity Objects (EOs)
View Objects (VOs)
Application Modules (AMs)
Framework Extensions Classes
Primary reusable ADF Controller:
Bounded Task Flows (BTFs)
Task Flow Templates
Primary reusable ADF Faces:
Page Templates
Skins
Declarative Components
Utility Classes
Certain
components will often be used more than once. Whether the reuse happens within
the same application, or across different applications, it is often
advantageous to package these reusable components into a library that can be
shared between different developers, across different teams, and even across
departments within an organization.
In
the world of Java object-oriented programming, reusing classes and objects is
just standard procedure. With the introduction of the model-view-controller
(MVC) architecture, applications can be further modularized into separate
model, view, and controller layers. By separating the data (model and business
services layers) from the presentation (view and controller layers), you ensure
that changes to any one layer do not affect the integrity of the other layers.
You can change business logic without having to change the UI, or redesign the
web pages or front end without having to recode domain logic.
Oracle
ADF and JDeveloper support the MVC design pattern. When you create an
application in JDeveloper, you can choose many application templates that
automatically set up data model and user interface projects. Because the
different MVC layers are decoupled from each other, development can proceed on
different projects in parallel and with a certain amount of independence.
ADF
Library further extends this modularity of design by providing a convenient and
practical way to create, deploy, and reuse high-level components. When you
first design your application, you design it with component reusability in
mind. If you created components that can be reused, you can package them into
JAR files and add them to a reusable component repository. If you need a
component, you may look into the repository for those components and then add
them into your project or application.
For
example, you can create an application module for a domain and package it to be
used as the data model project in several different applications. Or, if your
application will be consuming components, you may be able to load a page
template component from a repository of ADF Library JARs to create common look
and feel pages. Then you can put your page flow together by stringing together
several task flow components pulled from the library.
An
ADF Library JAR contains ADF components and does not, and cannot, contain other
JARs. It should not be confused with the JDeveloper library, Java EE library,
or Oracle WebLogic shared library.
Reusable
Component
Description
Data Control
Any data control can be packaged
into an ADF Library JAR. Some of the data controls supported by Oracle ADF
include application modules, Enterprise JavaBeans, web services, URL
services, JavaBeans, and placeholder data controls.
Application Module
When you are using ADF Business
Components and you generate an application module, an associated application
module data control is also generated. When you package an application module
data control, you also package up the ADF Business Components associated with
that application module. The relevant entity objects, view objects, and
associations will be a part of the ADF Library JAR and available for reuse.
Business Components
Business components are the entity
objects, view objects, and associations used in the ADF Business Components
data model project. You can package business components by themselves or
together with an application module.
Task Flows
&
Task Flow Templates
Task flows can be packaged into an
ADF Library JAR for reuse.
If you drop a bounded task flow
that uses page fragments, JDeveloper adds a region to the page and binds it
to the dropped task flow.
ADF bounded task flows built using
pages can be dropped onto pages. The drop will create a link to call the
bounded task flow. A task flow call activity and control flow will
automatically be added to the task flow, with the view activity referencing
the page. If there is more than one existing task flow with a view activity
referencing the page, it will prompt you to select the one to automatically
add a task flow call activity and control flow.
If an ADF task flow template was
created in the same project as the task flow, the ADF task flow template will
be included in the ADF Library JAR and will be reusable.
Page Templates
You can package a page template
and its artifacts into an ADF Library JAR. If the template uses image files
and they are included in a directory within your project, these files will
also be available for the template during reuse.
Declarative Components
You can create declarative
components and package them for reuse. The tag libraries associated with the
component will be included and loaded into the consuming project.
You can also package up projects that have several different reusable components if you expect that more than one component will be consumed. For example, you can create a project that has both an application module and a bounded task flow. When this ADF Library JAR file is consumed, the application will have both the application module and the task flow available for use. You can package multiple components into one JAR file, or you can package a single component into a JAR file. Oracle ADF and JDeveloper give you the option and flexibility to create reusable components that best suit you and your organization.
You create a reusable component by using JDeveloper to package and deploy the project that contains the components into a ADF Library JAR file. You use the components by adding that JAR to the consuming project. At design time, the JAR is added to the consuming project's class path and so is available for reuse. At runtime, the reused component runs from the JAR file by reference.