Saturday, 21 December 2013

Oracle ADF interview questions


 Q : What are various components in ADF?
A : Oracle ADF has following components
·         ADF Business Components(Model)
·         ADF Faces (View)
·         ADF Taskflows(Controller)

Q : What is Oracle ADF?
A : Oracle ADF is an commercial java/j2ee framework, which is used to build enterprise applications.
It is one of the most comprehensive and advanced framework in market for J2EE

Q : What are the advantages of using ADF?
A : Following are the advantages of using :

·         It supports Rapid Application Development.
·         It is based on MVC architecture
·         Declarative Approach (XML Driven)
·         Secure
·         Reduces maintenance cost and time
·         SOA Enabled

Q: Lifecycle of a Web Page Request Using Oracle ADF and JSF
Ans : Below figure shows a sequence diagram of the lifecycle of a web page request using JSF and Oracle ADF in tandem.

Lifecycle of a Web Page Request Using JSF and Oracle ADF



As shown in the figure, the basic flow of processing happens as follows:

A web request for http://yourserver/yourapp/faces/some.jsp arrives from the client to the application server

The ADFBindingFilter finds the ADF binding context in the HTTP session, and if not yet present, initializes it for the first time.

During binding context initialization, the ADFBindingFilter:

Consults the servlet context initialization parameter named CpxFileName and appends the *.cpx file extension to its value to determine the name of the binding context metadata file. By default the parameter value will be “DataBindings“, so it will look for a file named DataBindings.cpx.

Reads the binding context metadata file to discover the data control definitions, the page definition file names used to instantiate binding containers at runtime, and the page map that relates a JSP page to its page definition file.

Constructs an instance of each Data Control, and a reference to each BindingContainer. The contents of each binding container are loaded lazily the first time they are used by a page.

The ADFBindingFilter invokes the beginRequest() method on each data control participating in the request. This gives every data control a notification at the start of every request where they can perform any necessary setup.

An application module data control uses the beginRequest notification to acquire an instance of the application module from the application module pool.

The JSF Lifecycle class, which is responsible for orchestrating the standard processing phases of each request, notifies the ADFPhaseListener class during each phase of the lifecycle so that it can perform custom processing to coordinate the JSF lifecycle with the Oracle ADF Model data binding layer.
Note:The FacesServlet (in javax.faces.webapp) is configured in the web.xml file of a JSF application and is responsible for initially creating the JSF Lifecycle class (in javax.faces.lifecycle) to handle each request. However, since it is the Lifecycle class that does all the interesting work, the FacesServlet is not shown in the diagram.

The ADFPhaseListener creates an ADF PageLifecycle object to handle each request and delegates appropriate before/after phase methods to corresponding methods in the ADF PageLifecycle class as shown in If the appropriate binding container for the page has never been used before during the user’s session, it is created.

How JSF Page Lifecycle and ADF Page Lifecycle Phases Relate


The JSF Lifecycle forwards control to the page to be rendered.

The UI components on the page access value bindings and iterator bindings in the page’s binding container and render the formatted output to appear in the browser.

The ADFBindingFilter invokes the end Request() method on each data control participating in the request. This gives every data control a notification at the end of every request where they can perform any necessary resource cleanup.

An application module data control uses the endRequest notification to release the instance of the application module back to the application module pool.
 The user sees the resulting page in the browser.

Q:What is the Business Component Tester
ans:The mostly used component of the model layer is the tester, which is used to run and check the data model that is implemented.This serves as the first line of defense to see if data is exposed as we need it and to test the data model with out a need to create a UI.

Q : What is the return type of Service Methods?
A : Service Methods can return Scalar or Primitive Data types.

Q : Can Service Methods return type Void?
A : Yes, Service Methods can Return type Void

Q : Can Service Methods return Complex Data types?
A : No, service methods can return only primitive/scalar data types.

Q : Which component in ADF BC manages transaction ?
A : Application Module, manages transaction.

Q : Can an entity object be based on two Database Objects(tables/views) or two Webservices ?
A : No entity objects will always have one to one relationship with a database object or web service.

Q : Where is that we write business rules/validations in ADF and why?
A : We should be writing validations at Entity Object level, because they provide highest degree of reuse.

Q : What is Managed Bean?
A : Managed bean is a java class, which is initialized by JSF framework. It is primarily used to hold view and controller logic. It is also used to execute java code to be executed on a user action like Button Click.

Q : What are Backing Bean?
A : Backing beans are those managed beans which have 1:1 mapping with a page. They have getters and setters
for all the components in the related page.

Q : What is a Taskflow?
A : Taskflow is the controller of an ADF application, it provides us an declarative approach to define the control flow.  It is used to define the navigation between pages and various taskflow activites.

Q : What are the different types/categories of Taskflows ?
A :  Taskflows are of two categories : Bounded and UnBounded.

Q : What is the difference between Bounded and UnBounded taskflows?
A : Differences between Bounded and UnBounded taskflows :

·         Bounded taskflows can be secured but Unbounded can’t.
·         Bounded taskflows can accept parameter and return values but unbounded taskflows don’t support parameters
·         Bounded taskflows has a single entry point or a default activity but unbounded taskflows have multiple entry points.
·         Bounded taskflows can be called from other bounded/unbounded taskflows but unbounded cannot be called or reused.
·         Bounded taskflows support transactions unbounded don’t

Q : What are the various access scopes supported by ADF?
A : ADF Faces supports the following scopes

·         Application Scope
·         Session Scope
·         PageFlow Scope
·         Request Scope
·         BackingBean Scope.
Q: What is databindings.cpx file in ADF?
A:
In ADF web application as soon as you drop a databound component on your page a DataBindigs.cpx file gets created. You may wonder what it contains? So, here it is:

The DataBindings.cpx keeps track of the individual page definitions files used within the project, as well as the DataControls mapping to such things as ADF Business Components Application Modules.

Till Jdeveloper 10.1.3 release there was no way to have multiple DataBindings.cpx files which was very much desirable as the project the size grows and being worked by multiple teams. Jdeveloper 11g added this capability to have multiple DataBindings.cpx files.

There is a new file in 11g called adfm.xml which is used to keep track of all such DataBindings.cpx files in the system. So, when breaking your DataBindings.cpx you need to take care to create an entry in the adfm.xml. You also need to make sure to have unique application id attribute value for each entry.
Q: How to Skip Validation?
A: At view layer Keep immediate=true

Q : Describe life cycle of a ADF Page?
A : ADF page is an extension of JSF and has following phases in its lifecycle

1.       Initialize Context: In this phase the adf page initializes the LifecycleContext with information that will be used during the Lifecycle.
2.       Prepare Model:  In this phase ui model is prepared and initialized. In this phase page parameters are set and methods in the executable section of the page definition of the ADF page are executed.
3.       Apply Input Values: This phase handles the request parameters. The values from the HTML are sent to the server  and applied to the page binding in page definitions.
4.       Validate Input Values:  This phase validates the values that were built in the Apply input values phase
5.       Update Model:  Validated values supplied from user are sent to ADF business components data model
6.       Validate Model Updates:  In this phase the business components will validate user supplied values.
7.       Invoke Application:  This phase will process the ui events stack built during the life cycle of page and also fire navigational events
8.       Prepare Render:  This is the final phase where HTML code is generated from the view tree.

Q: What is Association and Viewlink ?
A: They define the join or the link among EO’s and VO’s.Association defines link between EO’s.They can be considered as PrimaryKey/ForeignKey relationship between tables.
The Viewlink is for a VO.It defines the Join conditions.A viewlink can be based on an association or based on attributes,Basing viewlinks on associations have the same advantage of entity cache and few more which are unveiled later.