Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Open Metadata Search

(Index search for Java EE metadata)

Introduction

In working with huge projects there are many instances the developers fall into situations where they need to find Java EE metadata of certain projects. It is indeed a tedious task to remember the exact locations of all project artifacts. Generally a particular artifact is remembered by a part of the content or some other special attribute such as the file name. At such instances developers usually tend to locate the file by performing a file search available in the operating system or going for a full text search. This indeed is a tedious task and wastes a lot of time of the developer. At the same time the results obtained might be of a low degree of effectiveness. It is indeed bliss if the Developing IDE itself can provide a Java EE metadata search. Obviously this can save a lot of time of the developer and it also can deliver the most optimal results that the developers are looking for.


The Solution Overview

Open Type and Open Resource index searches in the workbench are one of the most widely benefited tools for many developers. Especially its enormous ability of locating the exact class and the file in a huge project is very helpful. If we can perform the same kind of a search for Java metadata also it will be so beneficial to general developers. It will be guaranteed that the developers get the hassle free most effective results on facts that they want to search for. The Open Metadata Search is ideally designed and developed to achieve the aforementioned task. It guarantees the total hassle free search on the JavaEE Artifacts which are indexed through the EMF Index. Thus this tool utilizes the rich features of the EMF Index Project and the EMF Models. This can be invoked by simply using the icon provided for the Open Metadata Search or by simply using the hotkey combination Ctrl+Shift+J. It will search on the EMF Index which is being created on the built projects and display the resources according to the search parameter used. It also helps the developers to load these resources on the editor by simply double clicking on these search resources.

The Architectural Overview

The system uses a unit wise architecture. There are different units that are used to achieve desired functions. (Refer to the Appendix A for the Architectural Overview.) The functions that are implemented by each unit are independent of the other units but the communication is done between units. The functions that are expected from each unit are as summarized below.

3.1 Presentation Unit (GUI Unit)

This unit implements the presentation layer functions. This creates the basic GUI of the system and helps to obtain data from the user and show the relevant response.

3.2 Presentation Controller Unit

This Unit links the GUI with the internal units. This passes the parameters to the GUI and display the results appropriately. It also helps the system to create the relevant data carriers and create the system in such a way that it shows the results in the desired way.

3.3 EMF Index Access Unit

The main job that is expected by this unit is Indexing the JavaEE Artifacts and accessing the EMF Index. At the moment this unit indexes the Servlets, Listeners, Filters, Session Beans, Message Driven Beans etc. This can be further enhanced in such a way that there are other resources also available for indexing. It also queries the index and extracts the resources which matches with the search parameters that are passed. As the description said there are two main sub units under this unit. They are the EMF Indexer and the Index Query Unit. The main job of the EMF Indexer is to index the JavaEE Resources whereas the main job of the Index Query Unit is to access the indexed resources in the index.

3.4 Plug-in Connector

This unit will connect the system to the central eclipse IDE. This will make the reset of the units run independently. The other units do not have to worry about the process of being integrated to the eclipse IDE.

Technologies Used

This tool uses a number of plug-ins which comes with the Eclipse Bunch. The major technology that is used is the EMF Index. Apart from that there are some more features that are used especially in creating the UI of the system. It mainly extends the FilteredItemsSelectionDialog. There are many dependencies that are added into this system to perform the desired task. Some of these are as listed below.

org.eclipse.core.resources,
org.eclipse.emf.index,
org.eclipse.emf.index.ui,
org.eclipse.jst.j2ee,
org.eclipse.jst.j2ee.core,
org.eclipse.wst.common.emf,
org.eclipse.wst.common.emfworkbench.integration

The Tool Overview

The tools looks like the Open Type Search dialog box. The screen shot of the tool is given under the Appendix B. As it was mentioned above you can invoke this by using the icon provided or by using the hotkey combination Ctrl+Shift+J. The searched resources can be loaded by simply double clicking on these items.

Implementation

The heart of the system is the resource indexer. This is done using the OMSResourceIndexer and this class extends the org.eclipse.emf.index.resource.ResourceIndexer. The changes that are made to the JavaEE resources (Servelets, Listeners etc.) are notified to this class and the relevant resourceURI is notified. By using this the relevant resource is identified and they are indexed. The querying of the resources with respect to the search parametrs is also an important aspect. The details of the resulted resources are loaded to OMSResourceObject. These objects are used in displaying these resources in the UI.

The UI is the system is also an important aspect. The Open Metadata Search dialog box is created by extending the FilteredItemsSelectionDialog. The names of the JavaEE Resource along with the corresponding icon is shown at the User Interface. This is done by overriding the setListLabelProvider() method in FilteredItemsSelectionDialog. The OMSLableProvider is used for doing this task. At the bottom of the dialog box it is expected to show the corresponding package name and the package icon. This is done by setDetailsLabelProvider() method and the OMSSelectedLabelProvider class.

Future Enhancements

This tool dialog box can be enhanced in such a way that it keeps track on the earlier searches and also show them at the time it is invoked. This tool can be enhanced in such a way that this indexes other resources which are not indexed at this very first release of Open Metadata Search and search them appropriately.

Conclusion

The Open Metadata Search is considered to be a very useful feature all the developers who use the eclipse IDE. This is designed with a high degree of extensibility so that in the long run this can be modified and created new advanced systems. It is guaranteed that this will be an easy to use, flexible system which will deliver a toil free experience for developers.

Appendix - A

OpenMetadataSearchArchitecture.jpg

Appendix -B

ScreenShot.jpg

Back to the top