CDI Beans Inspection with Dynamic Navigable Graph

CDI Beans Inspection with Dynamic Navigable Graph

MASARYK UNIVERSITY FACULTY}w¡¢£¤¥¦§¨ OF I !"#$%&'()+,-./012345<yA|NFORMATICS CDI beans inspection with dynamic navigable graph MASTER’S THESIS Jakub Niedermertl Brno, Autumn 2014 Declaration Hereby I declare, that this paper is my original authorial work, which I have worked out by my own. All sources, references and literature used or excerpted during elaboration of this work are properly cited and listed in complete reference to the due source. Advisor: Mgr. Marek Grác, Ph.D. ii Acknowledgement I would like to thank to the consultant, Ing. OndˇrejŽižka, and the advisor, Mgr. Marek Grác, Ph.D., for their advice and guidance during the creation of this thesis. iii Abstract This thesis deals with CDI technology and visualization of relations among CDI beans in Eclipse IDE. The thesis describes the CDI technology, its API, its runtime environment – WildFly application server – and tools for static analysis of CDI projects in IDE. A couple of plugins extending Eclipse IDE and WildFly server is designed and implemented allowing to visualize and inspect CDI beans and their relations in Eclipse IDE. Both local projects in form of source code and running projects deployed in application server can be inspected. iv Keywords CDI, visualization, Java EE, Weld, WildFly, Eclipse RCP, Eclipse IDE, e4, JBoss Tools, Tycho, TinkerPop v Contents 1 Introduction3 2 Analysis5 2.1 Requirements .............................. 5 2.2 Architecture outline .......................... 6 3 Contexts and Dependency Injection8 3.1 CDI Bean ................................. 9 3.2 Enabling CDI .............................. 10 3.3 Injection .................................. 10 3.4 Producer members ........................... 12 3.5 Scopes ................................... 13 3.6 Qualifiers ................................. 15 3.7 Other CDI features ........................... 16 3.8 BeanManager API ........................... 17 3.9 Weld .................................... 18 4 WildFly 20 4.1 Extending Wildfly ........................... 21 4.2 Undertow ................................. 21 4.3 Accessing BeanManager ........................ 22 5 Eclipse platform and Eclipse IDE 23 5.1 Eclipse platform ............................. 23 5.2 OSGi framework end Equinox .................... 24 5.3 Project e4 ................................. 25 5.4 Eclipse IDE ................................ 27 5.5 Zest .................................... 27 5.6 Tycho ................................... 29 6 JBoss Tools 31 6.1 CDI Tools ................................. 31 6.2 Server Tools ............................... 33 1 7 TinkerPop 34 7.1 Blueprints ................................ 34 7.2 Pipes .................................... 36 7.3 Gremlin .................................. 37 7.4 Frames .................................. 38 8 Design and implementation 40 8.1 Design ................................... 40 8.1.1 Used technologies....................... 42 Graph database........................ 42 8.2 Weld extension ............................. 43 8.3 Common data model .......................... 43 8.4 Eclipse plugins and user interface . 43 8.5 CDI compatibility ............................ 48 8.6 Installation ................................ 48 8.7 Implementation problems ...................... 49 8.8 Possible extensions ........................... 51 9 Conclusion 52 A Content of electronic attachment 58 2 Chapter 1 Introduction Software projects are getting more complex and larger every day. Accord- ing to study of Deshpande and Riehle the pace of growth of open source1 project is exponential [1]. This brings new challenges to software devel- opers in managing projects and getting oriented. Integrated development environments come with wide range of tools to facilitate the process of development. It could be context aware code completion, code structure overview, type hierarchy visualization and others. The goal of this thesis project is to design and develop similar tool to support of Java Enterprise Edition applications using CDI2 technology. The tool is supposed to help developers to get an overview of the project by visualizing relations of beans. The core features of CDI technology are bean life-cycle management and, as the name implies, dependency injection. These features allow to keep the code less complicated. On the other hand, the separation of bean definition and its usage bring questions like ‘What is the implementation of this bean?’ or ‘Where is this bean implementation used?’. This thesis project should help to answer these questions visually by creating a graph of beans and their types showing the origin of beans and their usage. It should allow users to filter beans according their attributes for them to be able to focus only on certain part of application. It should also provide detailed information about selected bean. The tool is intended to work with both forms of projects – source code and deployed running application. According to my research, there is no other project dealing with this problem. Implemented tool, called CDI Inspector, consists of two parts. A Wild- Fly3 application server extension, that gathers CDI related information about 1http://opensource.org/osd 2Contexts and Dependency Injection 3Described in chapter4. 3 1. INTRODUCTION running applications and provides it over REST4 protocol. And a set of plu- gins to Eclipse IDE5 that is able to visualize and inspect data from WildFly extension and also examine local source code projects. Chapter2 sums project requirements and outline its architecture. Fol- lowing five chapters describe used technologies. Chapter8 describes design of CDI Inspector and particular implemented units. 4Representational State Transfer, http://www.ics.uci.edu/~fielding/pubs/ dissertation/rest_arch_style.htm 5Described in chapter5 4 Chapter 2 Analysis 2.1 Requirements The goal of the practical part of thesis is to design and implement a set of tools to analyze CDI applications with respect to CDI beans and their attributes and to visualize obtained information. The system should be able to process both running projects deployed in application server and projects in form of source code in IDE. The visualization is intended to be helpful to developers. So it has to allow to be used interactively, to show detailed information about nodes and to filter shown nodes. Because of the extent of CDI technology it is not required to cover all its features but rather focus on basic attributes of beans and its relations. The thesis topic was offered and the project development consulted by Czech branch of Red Hat1 company. This influenced the requirements, par- ticularly selection of used technologies because result project should be compatible with Red Hat products. Hence, the project requirements are following: • The system should provide the extension of Java EE application server in order to get information about running applications and make this information available over REST2 protocol. • The system should provide an extension of an IDE in order to get information about projects in form of source code. • The system should provide visualization of CDI beans and their rela- tions from both sources. • User should be able to filter graph nodes based on attributes of beans. • The system should provide detailed information for displayed graph nodes. 1http://www.redhat.com 2Representational state transfer 5 2. ANALYSIS • The system should allow user to jump from visualized bean to source code of bean implementation if local project is inspected. • The system should take into account possible future alternative visu- alizations of data provided by server extension. • The application server extension should minimize its effect on de- ployed applications. • All parts of system should be easy to install and use. • Project code base should be ready for collaborative development. 2.2 Architecture outline Because of the requirement of compatibility with Red Hat products, Wild- Fly3 is used as an application server and Eclipse IDE4 in conjunction with JBoss Tools5 is used as target platform for source code project analysis and visualization. The project consists of two logical components. A WildFly extension that deals with extraction of data about running CDI applications, and making them available via HTTP protocol in JSON format. The other component is a set of Eclipse IDE plugins and has two goals. To analyze CDI project in form of source code, and to provide a GUI to visualize data in graph-like form from both components in conjunction with graph filtering. The graph should reflect basic bean attributes and relations of injecting and producing. The source code analysis is based on a JBoss Tools plugin for CDI support. Filtering is accelerated using a graph database. From the use-case analysis point of view the system is pretty simple. There is only one role interaction withc the system – user, typically a devel- oper. This user can perform only two use-cases as shown in figure 2.1. Either to analyze local or remote project. Both use-cases are extended by filtering use-case that allows to focus only on certain part of visualized graph. Local inspection use-case is very straightforward. User selects a CDI project in Eclipse IDE window, and activate a context menu item to start inspection. Then CDI Inspection window is opened, if necessary, and graph is drawn. 3Described in chapter4. 4Described in chapter5. 5Described in chapter6. 6 2. ANALYSIS Figure 2.1: Usecase diagram To start remote inspection use-case user has ensure that

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    63 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us