OSGi Basics for Liferay Development

Liferay leverages the OSGi framework to provide a development environment for modular applications. There are many OSGi best practices that Liferay Portal follows to provide an easy-to-develop-for platform. Here, you’re introduced to some OSGi basics and common Liferay best practices for developing OSGi bundles (modules).

Liferay Portal Classloader Hierarchy

All Liferay Portal applications live in its OSGi container. Portal is a web application deployed on your application server. Portal’s Module Framework bundles (modules) live in the OSGi container...

Read More

Bundle Classloading Flow

The OSGi container searches several places for imported classes. It’s important to know where it looks and in what order. Liferay Portal’s classloading flow for OSGi bundles follows the OSGi Core...

Read More

Importing Packages

Your modules often must use Java classes from packages exported by other modules. When a module is set up to import, the OSGi framework finds other registered modules that export the needed...

Read More

Exporting Packages

An OSGi module’s Java packages are private by default. To expose a package, you must explicitly export it. This way you share only the classes you want to share. Exporting a package in your OSGi...

Read More

Resolving Third Party Library Package Dependencies

The OSGi framework lets you build applications composed of multiple OSGi bundles (modules). For the framework to assemble the modules into a working system, the modules must resolve their Java...

Read More

Overriding Reluctant Service References

When there’s an existing service that you want to customize or implement differently, you can override the existing one. To do this, you create and deploy a new, higher-ranked service...

Read More

Waiting on Lifecycle Events

Liferay registers lifecycle events like portal and database initialization into the OSGi service registry. Your OSGi Component or non-component class can listen for these events by way of their...

Read More

Using the WAB Generator

You can create applications for Liferay Portal as Java EE-style Web Application ARchive (WAR) artifacts or as Java ARchive (JAR) OSGi bundle artifacts. Some portlet types, however, limit your...

Read More

Service Trackers

In an OSGi runtime ecosystem, you must consider how your modules can rely on services in other modules for functionality. It’s possible for service implementations to be swapped out or removed...

Read More

Semantic Versioning

Semantic Versioning is a three tiered versioning system that increments version numbers based on the type of API change introduced to a releasable software component. It’s a standard way of...

Read More
0 (0 Votes)
Learning More about OSGi Previous