ADF and service dependencies 2014 09 29 18 12 51 PowerPoint Slide Show from ws to

ADF and service dependencies

In order to keep the business-IT gap manageable, it is important for analysts, designers and architects to know what their implemented application landscape actually looks like. An important part of this is insight in dependencies between different components. In my previous blog post I’ve described how service dependencies can be determined. In this blog post I will provide a script for analyzing which services are called by ADF pages. Keep in mind both analyses are executed on source code. This can differ from the runtime environment.

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.

2014-09-29 18_12_51-PowerPoint Slide Show - [from ws to pagedef.pptx]

Implementation

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)

The executable and bindings sections in the *PageDef.xml files refer to the actual pages in which they were used but for this analysis I’ve limited myself to the level of the pagedef.

I’ve made two associative arrays. One which contains all the datacontrols related information and one that 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

For analysis of the pagedefs I found that a pagedef which is referred in the databinding can be part of another dependent project. When looking for the actual pagedef, I’ve conducted a search at a level higher then project level to find the dependent files.

The result is a list of pagedefs with service/operation calls. This can be linked to the result of my previous blogpost. The next step is visualization or using this to for example determine which tests need to be executed in a CI environment when a component changes.

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.

Conclusion

ADF pages are more difficult to analyse than SOA composites since they consist of many XML files which refer to each other. References can be made to files outside of the project (in dependent projects) which further complicates the analysis. 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