Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Defining a Module

Thomas Diesler edited this page Oct 11, 2013 · 1 revision

A Module combines a ClassLoader, a Resource and optional runtime headers. The Resource is the immutable set of Capabilities/Requirements associated with the Module. The ResourceIdentity is a mandatory capability for every Module.

There are various ResourceBuilders available.

To define a Module through its Manifest and install it to the Runtime you can do this

    Runtime runtime = RuntimeLocator.getRuntime();
    ResourceBuilder resbuilder = new ManifestResourceBuilder().load(manifest);
    ManifestHeadersProvider headers = new ManifestHeadersProvider(manifest);
    Module module = runtime.installModule(classLoader, resbuilder.getResource(), headers.getHeaders());

For this to work the manifest must define the Module's identity

Gravia-Identity: org.acme.webapp;version=1.0.0

The use of manifest is of course optional. The Resource associated with the Module could have been constructed in any other way.

Clone this wiki locally