Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
xml
xml
<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912">
   <export.java package="com.foo.bar" version="1.0"/>
</contribution>

Exported packages may then be imported using the <import.java> element in the manifest of another contribution:

Code Block
xml
xml
<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912">
   <import.java package="com.foo.bar" version="1.0"/>
</contribution>

The previous examples make classes in the com.foo.bar package available to the importing contribution.

...

Code Block
xml
xml
<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912">
   <export.java package="com.foo.bar" version="2.0"/>
</contribution>

An importing contribution can control which version it receives by specifying the @version attribute of the <import.java> element:

Code Block
xml
xml
<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912">
   <export.java package="com.foo.bar" version="2.0"/>
</contribution>

Often, it is useful to specify a version range instead of an exact version. This can be done using the @min, @minInclusive, @max, and @maxInclusive attributes of the <import.java> element:

...

Code Block
xml
xml
<export.java package="org.foo.*"/>

Imports can also be made optional by setting the @required attribute to false. In this case, if a matching export is not found, the contribution will still be loaded :

Code Block
xml
xml

<import.java package="org.foo.bar" version="1.0.0" required="false"/>

OSGi Bundles

Fabric3 also supports packaging contributions as OSGi bundles. In this case, OSGi bundle manifests may be used to export and import packages from other contributions.

...