Posts tagged reuse
Creating reusable ADF Library with generic live resource bundle editing functionality and reusing it in any ADF application1
In previous articles, I have introduced functionality to centralize management of boilerplate text elements such as prompt, title, hint text and messages in resource bundles. This also allows for language or user group and other context sensitive values for these boilerplate text elements. The resource bundles, as was demonstrated, can be backed by database tables, refreshed at run time and even be edited from within the JSF application itself. The last installment in the series before this one introduced an approach that allows for live page editing with minimal impact on the page itself – through run time UI component tree manipulation. However, the code for handling the live editing and dealing with the resource bundles was still part of the application making use of that functionality. This article demonstrates how this generic functionality can be isolated in a separate ADF application, deployed to an ADF Library and reused in one or many different ADF applications.
ADF 11g staat vooral bekend om zijn rich components waarmee een moderne, interactieve en aantrekkelijke user interface kan worden ontwikkeld. En een beetje om de Data Visualization Components (DVTs) waarmee allerlei geavanceerde grafieken en andere vormen van grafische data-presentatie kunnen worden ingepast in de web applicatie.
Veel minder bekend en zichtbaar is de Task Flow. Terwijl dat uit oogpunt van architectuur en voor een efficiente organisatie van een onvangrijk ontwikkel-project en zeker voor het kunnen realiseren van reuse de belangrijkste vernieuwing is geweest in ADF 11g.
Een TaskFlow is een op zichzelf staande module die zowel code – managed beans, navigation rules – als user interface bevat. Een task flow is bijna een mini-applicatie met mogelijk verschillende schermen, complexe navigatie tussen de schermen en een eigen memory scope. Een task flow kan worden geintegreerd in schermen in de applicatie (en in andere task flows). Het contract daarvoor bestaat uit input parameters en events. Task flows kunnen worden verpakt in libraries en tussen projecten worden uitgewisseld als generieke reusable componenten. Een voorbeeld van dat laatste gebruik van task flows zijn de More >
We have been struggling quite a bit with a good approach for modularizing our ADF web applications through the use of (stand alone) Task Flows that are developed in independent projects and assembled into a single Web Application from ADF Libraries. In theory, this is a very structured, decoupled way of developing potentially complex ADF Web Applications – while allowing for reuse. The contextual events mechanism in combination with the task flow input parameters allow definition of a clear interface through which to reuse the task flow. So all seems well.
However, when you try to put this theoretical bliss into actual practice, there are some limitations that you run into. One of the tricky issues we had to deal with is: how can we debug our web application when part of the source of the application is reused from ADF Libraries? How can we put breakpoints in the sources that are part of the ADF Library?
On closer inspection, there seems to be a relatively easy way for doing this – using an additional library definition in JDeveloper that refers to the sources that form the foundation of the ADF Library.
Let’s take a quick look at how this would work:
I have discussed ADF Task Flows before in raving terms and with some simple example to prove my point. To be honest, I have never before really digged deep in any article into the use case of creating a bounded task flow that has ADF Business Components inside, deploying it to an ADF Library and reusing that Task Flow from that library in a completely different ADF application. That may not even have Business Components itself. Now is the time to remedy that omission. And also demonstrate how the consumed task flow – originating from somewhere in the Resource Catalog – can be integrated and synchronized with the consuming page.
It is not very difficult, but some steps must be observed to wire it together neatly.
Our objective in this article:
* Create a bounded task flow EmployeesList that uses ADF Business Components (in this particular case to display data from a database table called EMP, you may have hear it mention before) * Deploy the task flow to an ADF Library to make it reusable in other ADF applications * Create a new ADF Application in which the task flow EmployeesList is reused.
The steps we go through to accomplish this:
1. Create the Bounded Task Flow
2. Deploy More >
Introduction to ADF reusable task flows – consume a bounded task flow that gets synchronized with input parameter changes
Task Flows are the primary mechanism in ADF 11g for organizing the workload in manageable chunks that can be developed in a decoupled fashion in relative isolation, then merged together in web pages that implement the desired functionality. Task Flows are also one of the key mechanisms for reuse – along with but for other purposes than Page Templates, Page Fragments and Declarative Components. Task Flows are the key vehicle for creating encapsulated, stand alone services with a User Interface that can be consumed in multiple pages in various applications.
Task Flows come with their own managed beans, navigation rules, data binding, user interface – behind a fairly well defined interface which consists of input parameters and input/output events.
A few things that might be added to even improve a little on task flows: - a structured method for documentation and discovery, something like WSDL or JavaDoc to describe the meaning of the Task Flow and its input parameters - support for facets through which additional content can be injected into (views of) the task flow - support for page templates with facets predefined by the taskflow that can be associated with the views of the More >
ADF 11g offers various facilities for reusables. To name a few:
Task Flows provide packaged, self contained functionality that consists of both User Interface and Data Bindings and potentially even some process logic and multi step navigation. Task flows can expose parameters that accept values used to dynamically influence the task flow’s behavior. Task flows do not expose facets (which could be an interesting extension of the task flow mechanism). Task flows can publish events that ADF can propagate to consumers outside the region that consumes the task flow.
Declarative components provide a way of packaging reusable clusters of ADF Faces components – usually a fairly small number – that may define parameters and facets through which a usage of the component can be configured and injected with additional content.
Page Templates are a third reusable – typically used to provide a page with one or more containers to hold the page’s content in combination with a frame that has some boilerplate elements – for example titles, menu-items etc. Page templates expose one or more facets into which the contents from the consuming page is injected. Page templates can also publish More >