Welcome!

Machine Learning Authors: Yeshim Deniz, Zakia Bouachraoui, Pat Romanski, Elizabeth White, Liz McMillan

Related Topics: Java IoT

Java IoT: Article

Adopting OSGi in Java Application Frameworks: A Case Study

Defining reusable software system components

Migration of software systems to the OSGi platform is gaining momentum with wide acceptance of the OSGi technology as the dynamic module system for Java. This transition is of special interest when it comes to popular Java application frameworks, which attract a growing number of Java developers around the world. Although the technical merits of the OSGi platform are broadly recognized, the migration of existing application frameworks is slow due to significant redesign and re-implementation efforts involved. We present an alternative lightweight approach - an adaptation of existing Java application framework for component based OSGi environment. Adaptation, as opposed to migration, eliminates the necessity of modularizing or redesigning the existing framework. This is particularly important when existing software platform and the associated programming model is mature and has already penetrated into the market place. As a general adaptation solution we introduce a thin layer between the OSGi Service Platform and the existing framework. Furthermore, we present the case study of an OSGi adaptation of a popular open source Java platform developed by IBM Research for integration of software analytics. Our results demonstrate that the adaptation approach is not limited to the presented case, but is broadly applicable to a variety of Java application frameworks.

Introduction
The software development and support costs are driven by increase in software complexity, thrust to reduce product cycles and the need to support multiple hardware and operating systems. There is an increasing emphasis on creating modular software solutions to enable reuse of software parts to reduce the cost and increase the quality of software development. In response to this need, OSGi technology is introduced as the dynamic module system for Java - a platform for component-based development of high quality and less costly software solutions. Built on top of the ubiquitous Java the OSGi technology creates a portable modularization platform embraced by many software products (see [4]).

While there is a surge of interest in OSGi technology, in particular after Eclipse adopted OSGi approach with Eclipse 3.2, the problem of migrating existing Java solutions into OSGi is not trivial. In this paper, we focus on Java application frameworks that become increasingly popular among professional application developers (see [15],[16]). In addition to services provided by traditional software libraries, application frameworks also provide structure to applications. In this sense, the problem of OSGi migration for Java application frameworks seems to be more interesting than for traditional libraries.

Typically, existing Java application frameworks do not fully support the fundamental principles of modularity (see [19]). Hence, transforming existing application frameworks into OSGi platform may not be accomplished without changing the programming model or introducing new service interfaces. Before we take on the challenging problem of adopting OSGi technologies in traditional Java application frameworks, we would like to review the fundamental characteristics of a modular system and confront them with the needs of application frameworks. This will further clarify the nature of the challenge.

In a fully modular computing environment, it is expected that "off the shelf" software components can be reused and integrated into the application coherently. Installing, updating and removing components on the fly are the essential functionality of component based systems. Components are capable of dynamically discover and cooperate with each other. More importantly, all this is done with little or no configuration. In a modular system, componentization is enforced with a proper code separation and the isolation level guaranteed by component class loaders. Needless to say that plain Java lacks these core characteristics of a modular platform (see [20]). Traditional Java application frameworks also do not fully support modularity due to their inherent characteristics, such as the utilization of the Inversion of Control (IoC) pattern (see [21]). The IoC pattern implies that the application class loader together with the framework have access to certain resources of third party components, which are used by the application. With the isolation level, established by a modular environment, even providing the IoC based framework with a legitimate access to component resources is a problem by itself.

Once we established that traditional Java application frameworks do not fully support modularity, it is important to understand what it takes to attain modularity, particularly using OSGi technology. Three different types of modularization are possible for Java application frameworks:

•  Framework only migration.
Modularizing the framework architecture/implementation without affecting applications/components (example - WebSphere Application Server [22]). This type is not discussed here, because the modular framework implementation still does not provide real component-based environment for application and component developers.
•  Full migration.
Modularizing the framework architecture/implementation together with applications/components (example - Spring Framework [23]).
•  Adaptation.
Modularizing applications/components without modifying the framework itself. This type of modularization, however, requires extending the framework with an enablement layer that allows the framework to work with modularized components/applications.

In this paper we discuss the latter 2 types of modularization in Java application frameworks. In section 3 we compare the latter 2 approaches, namely migration approach versus adaptation approach. Section 4 introduces the OSGi service adapter solution as a way to adopt OSGi modularization in traditional Java application frameworks. In section 5, UIMA framework is reviewed as an example of a traditional Java application framework to be used for this case study. Section 6 discusses the architecture of the OSGi services adapter as well as its core features. Finally, the findings of this case study are outlined in sections 7 and 8.

Overview of OSGi as Java module system
The OSGi Alliance [1] makes the following statement: "OSGi Technology is the dynamic module system for Java". Today, this technology is widely adopted by both the Java community (see [2], [3]) and the major software vendors (see, for instance, [4]). The main focus of the OSGi Technology lies in the integration of software components based on the OSGi Service Platform. Comprehensive overview of the OSGi Service Platform is given by the OSGi Alliance in [5]. In this section we briefly review several key features of the OSGi Service Platform that are most relevant in the context of this paper.

Bundles and bundle management
In OSGi Service Platform, a bundle is defined as a unit of modularization. OSGi bundles are JAR files comprised of Java classes and other resources without any specific structural constraints. Unlike other JAR files, OSGi bundles always include a manifest file, providing information about the bundle. This file consists of headers, which specify information that the OSGi Framework utilizes to handle a bundle. For example, some manifest headers are used to state dependencies on other resources that must be available before a bundle can be used. Some bundles may also contain the Activator class that is used to start and register bundle services and perform other initial interactions with the OSGi Framework.

The OSGi Framework provides a container for managing bundles and supports full set of bundle lifecycle management operations, such as installing, updating, resolving, starting, stopping and uninstalling. Each bundle can be in one of the following states:

•  installed (bundle is deployed into the container);
•  resolved (bundle dependencies are resolved within the container);
•  active (bundle Activator is called)
•  uninstalled (bundle is uninstalled from the container).

For complete description of bundle states and state transition diagrams see [5].

Modules and class loading
The modularization concept in OSGi Framework is supported by the module-based class loading policy. The OSGi Framework has a powerful and rigidly specified class loading model that allows modules to declare shared and private class space and controls linking between modules. In this model, each bundle has its own class loader, and forms a class loading delegation network with other bundles (see [5], section 3.4). A bundle class space includes imported packages, shared class space of required bundles, private bundle classes and attached fragments. Note, that in order to have a consistent bundle class space, it's not recommended to put two classes with the same fully qualified name into the same class space. Separate class spaces in the OSGi Framework, however, may contain classes with the same fully qualified name. Therefore, the OSGi Framework modularization layer supports a model where multiple versions of the same class are loaded in the same VM. This allows binding two versions of the same component within the same application.

Services and service registry
The OSGi Service Platform defines a dynamic collaborative 'find-and-bind' service model (see [5], chapter 5). A service in OSGi Platform is a normal Java object that is registered under one or more Java interfaces with the service registry. Bundles can register services, search for them, or receive notifications when their registration state changes. The service registry provides a comprehensive model to share objects between bundles.


More Stories By Yurdaer Doganata

Dr. Doganata is the manager of the Information Management Solutions group at the Watson Research Center in Hawthorne, New York. He received B.S. and M.S. degrees from the Middle East Technical University, Ankara, Turkey, and a Ph.D. degree from the California Institute of Technology, Pasadena, California, all in electrical engineering. He joined the Watson Research Center as a research staff member in 1989 and worked on projects in many diverse areas, including high-speed switching systems, multimedia servers, intelligent transportation systems, multimedia collaborative applications, eservices, and information search and retrieval systems for technical support. His current work involves designing and prototyping innovative solutions, applications, tools, and utilities in the area of unstructured information management. Dr. Doganata hold several patents and research awards and is the author of numerous papers. http://yurdaer.doganata.us

More Stories By Lev Kozakov

Dr. Lev Kozakov is a research staff member at IBM T.J. Watson Research Center and is a member of the dBlue project architecture and research teams. He has worked in many areas, including dynamic systems, applied statistics, information management systems, man-machine interface, medical software, computer telephony, and design patterns. Lev holds a number of patents and is the author of several publications.

More Stories By Mirko Jahn

Mirko Jahn worked for several years as an independent software consultant and tutor before joining the Unstructured Information Management Architecture (UIMA) group at IBM Research. At present, his major research areas cover component-based development strategies, component repositories, and migration approaches toward modular applications, along with service-oriented architecture. Mr. Jahn is heavily involved in making use of OSGi component-based developement
standards in UIMA.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


CloudEXPO Stories
DevOpsSUMMIT at CloudEXPO, to be held June 25-26, 2019 at the Santa Clara Convention Center in Santa Clara, CA – announces that its Call for Papers is open. Born out of proven success in agile development, cloud computing, and process automation, DevOps is a macro trend you cannot afford to miss. From showcase success stories from early adopters and web-scale businesses, DevOps is expanding to organizations of all sizes, including the world's largest enterprises – and delivering real results. Among the proven benefits, DevOps is correlated with 20% faster time-to-market, 22% improvement in quality, and 18% reduction in dev and ops costs, according to research firm Vanson-Bourne. It is changing the way IT works, how businesses interact with customers, and how organizations are buying, building, and delivering software.
Nicolas Fierro is CEO of MIMIR Blockchain Solutions. He is a programmer, technologist, and operations dev who has worked with Ethereum and blockchain since 2014. His knowledge in blockchain dates to when he performed dev ops services to the Ethereum Foundation as one the privileged few developers to work with the original core team in Switzerland.
It cannot be overseen or regulated by any one administrator, like a government or bank. Currently, there is no government regulation on them which also means there is no government safeguards over them. Although many are looking at Bitcoin to put money into, it would be wise to proceed with caution. Regular central banks are watching it and deciding whether or not to make them illegal (Criminalize them) and therefore make them worthless and eliminate them as competition. ICOs (Initial Coin Offerings) are something most have no idea as to what it means and how you utilize it. Where is the "Stamp of Approval" or "Stamp of Legitimacy" on some of these Bitcoin websites (how do you know you are not dealing with a scammer?)
Business professionals no longer wonder if they'll migrate to the cloud; it's now a matter of when. The cloud environment has proved to be a major force in transitioning to an agile business model that enables quick decisions and fast implementation that solidify customer relationships. And when the cloud is combined with the power of cognitive computing, it drives innovation and transformation that achieves astounding competitive advantage.
René Bostic is the Technical VP of the IBM Cloud Unit in North America. Enjoying her career with IBM during the modern millennial technological era, she is an expert in cloud computing, DevOps and emerging cloud technologies such as Blockchain. Her strengths and core competencies include a proven record of accomplishments in consensus building at all levels to assess, plan, and implement enterprise and cloud computing solutions. René is a member of the Society of Women Engineers (SWE) and a member of the Society of Information Management (SIM) Atlanta Chapter. She received a Business and Economics degree with a minor in Computer Science from St. Andrews Presbyterian University (Laurinburg, North Carolina). She resides in metro-Atlanta (Georgia).