Page tree
Skip to end of metadata
Go to start of metadata
Summary: This page provides information about analyzing J2EE Frameworks.

What is a framework?

In CAST terms, a framework based application is a J2EE application like any other that can be developed in house, bought from an external Software Vendor, or developed by the open source community. The difference between a framework and a "real" application is that a framework is a technical component; void of any business functionality and meant to be used as a foundation for the business related applications. In other words, frameworks are used to standardize the behavior of applications to make them easier to develop and to maintain. They can be composed of JSP pages, Java Script files, Java Classes (Servlets, Java Beans, EJBs, ...) Frameworks are usually shared among applications, which means that when analyzing applications sharing the same framework, the analysis should ensure that the framework's objects are shared across the different applications.

Types of frameworks and their impact on analyzes

The first thing to do before starting the analysis of the application's code is to define the best approach based on the customer needs: We have identified three types of needs:

  • in-house developed frameworks - Analyze the framework Java source code as one application
  • Third party frameworks – Use the framework archives in all the application analyzes
  • No need for framework information – Do not save any framework information

In-house developed frameworks

In this case, the framework has to be analyzed as one application using the J2EE or the JAVA Analyzer, depending upon the presence of JSP pages, or property files. Having the source code of the framework available usually means that users are interested in documentation, quality metrics as well as maintainability information on this project. Therefore, analyzing the framework as a standalone application is required to make it available in the standard documentation (AIP) and in the CAST Portal.

Example: In the picture below, you will see the directory structure; containing both source code for the application and for the framework.

Analysis steps:

  1. Analysis of the framework code.
    In the Source Repositories, select all java files contained in the code\fw\src directory.
    In the Analysis Settings / Java tab, select all jars necessary to compile the framework.
  1. Analysis of the application
    This task can be repeated for all applications using the framework
    In the Source Repositories, select all java files contained in the code\app\src directory. In the Analysis Settings / Java tab, select all jars necessary to compile the application.

Third-party frameworks

When the code of the framework is not available; the compiled version (jar) will be used in the CLASSPATH of all applications using it. Objects found in the Java archive containing the framework will have to be saved in the knowledge base (the jar has to be selected) to document the interactions between the application and the framework.

Important: When analyzing multiple applications using the same framework, it is mandatory to use the exact same framework jar file. Otherwise the framework objects will be duplicated for each application.

No need for framework objects

When the framework is only seen as a technical component providing a service; but not relevant for the understanding of the application; there is no need to save information about it.
Nevertheless, to get a complete analysis of the application code it is necessary to specify the framework code in the CLASSPATH section of the Application or Analysis Unit definition, so the analysis is performed with reference to the framework, to avoid resolution errors.

Conclusion

There are many different types of possible analysis scenarios when analyzing applications using frameworks or shared components. It is important to understand the need of the user before implementing one solution or another. When analyzing applications sharing components (which is typically the case when analyzing applications using a framework), the cross application dependencies are always retrieved by configuring the CLASSPATH to tell the analyzer where it can find code it can use to resolve the dependencies.

Please see also the following child pages that specifically discuss J2EE Frameworks:

  • No labels