问题
I am learning Oracle ADF framework and want to understand what service does the DataControl's expose to the UIComponents. I understood that there is a binding container
abstraction which is actually doing the binding between View Objects and UIComponents that are rendered in the page. What role is the datacontrol
abstraction playing in this framework ?
In other words what is the relation between datacontrol
and bindings
that run in the binding environment and what can be called as the equivalent of DataControl
in a normal Java EE application ?
回答1:
The binding layer connects the UI layer to the data control layer. Note that the UI layer can be a JSF page, an Excel spreadsheet, a Swing UI and an ADF Mobile page. The datacontrol layer provides access to the business service in an abstracted way so the UI developer doesn't need to know what specific technology the business service is implemented with.
To learn more about the binding/data control layers watch the two part seminar here: http://www.oracle.com/technetwork/developer-tools/adf/learnmore/adfinsider-093342.html#a2
In the world of Java EE the closest thing would be CDI - but the ADF binding provides a much more complete solution targeting various type of UIs, various types of backend.
回答2:
What role is the datacontrol abstraction playing in this framework ?
The DataControl
is an extra abstraction layer to access the business services (the actual model layer).
In ADF, the business services support different types, like
- Application Module based (accessing a relational database)
- Web Services
- URL Services to access data through a URL
- EJB data service to access the business data through Java EE EJBs
These different data access types are encapsulated by the Data Control layer. The data control layer provides a common interface using Attributes
, Collections
and Operations
to be used in the binding layer. In the binding layer, it does then not matter if a RDBMS, a Web Service or something else is accessed when querying and updating data.
One thing which I found difficult when I started with ADF is, that when implementing a simple application with a RDBMS backend, I could not see any real benefit from this additional layer - in addition, the Data Controls were immediately available in the JDeveloper panel after defining the data model in the Application Module, and there was not even a configuration file for them. But this is only true when using an Application Module
based business service. In this case, all the meta data for the Data Controls are retrieved from the Application Modules
data model. The real benefit comes into place when using other business service types, like Web Services. Then, there are also additional meta data .xml files created to configure these data controls.
What is the role of binding layer and how does it interact with the datacontrol layer
The binding layer enhances the data controls so that the data can be used in a UI. A typical binding is the iterator (=> binding layer), which tracks the current record within the collection (=> data control). Without the iterator
, there would not be a concept of "current record", and navigating between records would not be possible.
Another aspect is the design time functionality of JDeveloper: The data control provides the necessary meta data to automatically create the necessary bindings when dragging and dropping a data control onto a UI page.
The recordings mentioned by @Shay Shmeltzer are definitely worth reviewing, as they give a very good insight into data controls and the binding layer.
来源:https://stackoverflow.com/questions/13967978/understanding-datacontrol-abstraction-in-adf-framework