The Oracle ADF framework consists (among other things) of several XML files which refer to each other. This comes in handy when you want to analyse ADF code since XML is easily parsed and queried. In order to determine service calls I have made the assumption that webservice calls are executed using the excellent the ADF EMG XML DataControl by Wilfred van der Deijl and Richard Olrichs as announced on http://www.olrichs.nl/2014/05/announcement-adf-emg-xml-datacontrol.html and presented at OOW 2014.
The ADF framework XML files are described on: http://docs.oracle.com/cd/E15586_01/web.1111/b31974/appendixa.htm. ADF uses the MVC (Model, View, Controller) pattern. Usually the model is present in one project and the view/controller is present in another project. The model project contains (among other things) datacontrols and databindings. The ViewController project contains (among other things) page definition files, pages, pageflows.
In order to determine which webservice calls are made I’ve done the following:
- parsed the adfm.xml file in order to determine the location of the DataControls and DataBindings files present in the model project (DataBindingRegistry, DataControlRegistry)
- parsed the DataControls.dcx files in order to determine the webservice calls (dc-operation, soapAction, endPointUrl)
- parsed the DataBindings.cpx file in order to determine the *PageDef.xml files (pageDefinitionUsages)
- parsed the *PageDef.xml files present in the ViewController projects to determine data control usage (methodAction)
I've made two associative arrays. One which contains all the datacontrols related information and one which contains all the databindings related information. By comparing both arrays, the following can be determined:
- is every defined datacontrol in use?
- which datacontrol types are in use in the projects?
- which pagedef uses which datacontrol and calls which webservice / operation
The code can be downloaded here. Check the results! The code has not been thoroughly tested and also will most likely not be able to deal with specifics of certain ADF projects. It is however not very hard to add new functionality and make it fit for your ADF project.
ADF pages are more difficult to analyse than SOA composites since they consist of many XML files which refer to each other. The result of such an analysis is twofold;
- it provides insight in dependencies (which has various uses)
- it can help improve code quality by determining unused datacontrols