Java Reference
In-Depth Information
(continued)
Manifest-Version: 1.0
Created-By: 1.4 (Sun Microsystems Inc.)
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.foo.api
Bundle-Version: 1.0.0.SNAPSHOT
Bundle-Name: Simple Paint API
Export-Package: org.foo.api
Import-Package: javax.swing,org.foo.api
Bundle-License: http://www.opensource.org/licenses/apache2.0.php
We'll get into the exact meaning of most of these attributes throughout the remainder
of this section. But for now, we'll focus on the syntax. Whereas the standard Java
manifest syntax is a name-value pair, OSGi defines a common structure for OSGi-
specified attribute values. Most OSGi manifest attribute values are a list of clauses
separated by commas, such as
Property-Name: clause, clause, clause
Each clause is further broken down into a target and a list of name-value pair param-
eters separated by semicolons:
Property-Name: target1; parameter1=value1; parameter2=value2,
target2; parameter1=value1; parameter2=value2,
target3; parameter1=value1; parameter2=value2
Parameters are divided into two types, called attributes and directives . Directives al-
ter framework handling of the associated information and are explicitly defined by the
OSGi specification. Attributes are arbitrary name-value pairs. You'll see how to use
directives and attributes later. Slightly different syntax is used to differentiate direc-
tives ( := ) from attributes ( = ), which looks something like this:
Property-Name: target1; dir1:=value1; attr1=value2,
target2; dir1:=value1; attr1=value2,
target3; dir1:=value1; attr1=value2
Keep in mind that you can have any number of directives and attributes assigned to
each target, all with different values. Values containing whitespace or separator char-
acters should be quoted to avoid parsing errors. Sometimes you'll have lots of targets
with the same set of directives and attributes. In such a situation, OSGi provides a
shorthand way to avoid repeating all the duplicated directives and attributes, as follows:
Property-Name: target1; target2; dir1:=value1; attr1=value2
This is equivalent to listing the targets separately with their own directives and attri-
butes. This is pretty much everything you need to understand the structure of OSGi
manifest attributes. Not all OSGi manifest values conform to this common structure,
but the majority do, so it makes sense for you to become familiar with it.
2.5.1
Human-readable information
Most bundle metadata is intended to be read and interpreted by the OSG i framework
in its effort to provide a general module layer for Java. But some bundle metadata
serves no purpose other than helping humans understand what a bundle does and
 
Search WWH ::




Custom Search