[jsr294-modularity-eg] 294 EG conf call, 2009-04-15

Alex Buckley Alex.Buckley at Sun.COM
Wed Apr 22 23:02:40 EDT 2009


Bryan Atsatt wrote:
> module M @ 5.0 {
>    requires module "N at 1.0+; optional=true";
>    requires package "P@(1.0,2.0]";
>    permits  module "O";  // Module O is M's friend
>    provides module "M at 4.5+";  // M v5.0 is compatible with 4.5+
>    provides package "m"; // Exports package 'm'
> }

Further to interest in typed dependencies and exports, I have taken the 
liberty of looking at all the bundle manifest headers in the OSGi R4 
spec; grouping the non-deprecated headers by function; and mapping them 
to content in a module compilation unit. It works pretty well:

* Identity

- Bundle-ManifestVersion
- Bundle-SymbolicName
- Bundle-Version

module com.acme.daffy @ 1.1 {
   requires system osgi @ 2;

* Dependencies

- Bundle-RequiredExecutionEnvironment
- DynamicImport-Package
- Export-Package
- Fragment-Host
- Import-Package
- Require-Bundle

           requires platform CDC-1.0/Foundation-1.0;
   dynamic requires package  com.acme.donald;
           provides package  org.osgi.util.tracker @ 1.3;
           requires host     org.eclipse.swt @ 3.0.0;
           requires package  org.osgi.service.io @ 1.4;
           requires module   com.acme.chess;

   // Advanced examples
   requires package com.acme.bar @ [1.23,1.24]/company=ACME ;
   provides package com.acme.foo @ 1.23/mandatory:=company/company=ACME ;
}

* Content

- Bundle-ActivationPolicy
- Bundle-Activator
- Bundle-Classpath
- Bundle-Localization
- Bundle-NativeCode
- Bundle-UpdateLocation

import org.osgi.annotations.*;
@ActivationPolicy(Activation.lazy)
@Activator("com.acme.fw.Activator")
@Classpath({"/jar/http.jar" , "."})
@Localization("OSGI-INF/I10n/bundle")
@NativeCode(library="/lib/http.DLL", osname="QNX", osversion="3.1")
@UpdateLocation("http://www.acme.com/Firewall/bundle.jar")
module ...

* Documentation

- Bundle-Category
- Bundle-ContactAddress
- Bundle-Copyright
- Bundle-Description
- Bundle-DocURL
- Bundle-Name
- Bundle-Vendor

import org.osgi.annotations.*;
@Category({"osgi", "test", "nursery"})
@ContactAddress("2400 Oswego Road, Austin, TX 74563")
@Copyright("OSGi (c) 2002")
@Description("Network Firewall")
@DocURL("http:/www.acme.com/Firewall/doc")
@Name("Firewall")
@Vendor("OSGi Alliance")
module ...

Alex


More information about the jsr294-modularity-eg mailing list