Java Industry News
Adopting OSGi in Java Application Frameworks: A Case Study
Defining reusable software system components
Oct. 29, 2007 06:45 AM
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.
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 ,). 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 ). 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 ). 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 ). 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.
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
Bundles and bundle management
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);
For complete description of bundle states and state transition diagrams see .
Modules and class loading
Services and service registry
Reader Feedback: Page 1 of 1
SOA World Latest Stories
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
SYS-CON Featured Whitepapers
Most Read This Week