Java Reference
In-Depth Information
( public , private , protected , and package private) with module private visibility
(only visible in the module). If you're familiar with . NET , this is similar to the internal
access modifier, which marks something as being visible in an assembly but private from
other assemblies.
As you can see, the bundle concept plays important roles in both physical and logical
modularity. Now we can start to examine how you use metadata to describe bundles.
2.5
Defining bundles with metadata
In this section, we'll discuss OSG i bundle metadata in detail, and you'll use the paint
program as a use case to understand the theory. The main purpose of bundle meta-
data is to precisely describe the modularity-related characteristics of a bundle so the
OSG i framework can handle it appropriately, such as resolving dependencies and
enforcing encapsulation. The module-related metadata captures the following pieces
of information about the bundle:
Human-readable information —Optional information intended purely as an aid to
humans who are using the bundle
Bundle identification —Required information to identify a bundle
Code visibility —Required information for defining which code is internally visi-
ble and which internal code is externally visible
We'll look at each of these areas in the following subsections. But because OSG i relies
on the manifest file, we've included a sidebar to explain its persnickety syntax details
and OSG i's extended manifest value syntax. Luckily, there are tools for editing and
generating bundle metadata, so you don't have to create it manually, but it's still
worthwhile to understand the syntax details.
JAR file manifest syntax
The JAR file manifest is composed of groups of name-value pairs (attributes). The
general format for an attribute declaration is
name: value
The name isn't case sensitive and can contain alphanumeric, underscore, and hy-
phen characters. Values can contain any character information except carriage re-
turns and line feeds. The name and the value must be separated by a colon and a
space. A single line can't exceed 72 characters. If a line must exceed this length, you
must continue it on the next line, which you do by starting the next line with a single
space character followed by the continuation of the value. Manifest lines in OSGi can
grow quite long, so it's useful to know this.
You define an attribute group by placing attribute declarations on successive lines
(one line after the other) in the manifest file. An empty or blank line between attribute
declarations signifies different attribute groups. OSGi uses the first group of attri-
butes, called the main attributes , for module metadata. The order of attributes in a
group isn't important. If you look in a manifest file, you may see something like this:
 
Search WWH ::




Custom Search