Java Reference
In-Depth Information
More complex constructions are also possible using and ( "&" ) and or ( "|" ) in front
of expressions surrounded by parentheses. For example,
(&(aisle=fruit) (colour=blue))
will match something whose aisle is fruit and whose color is blue (probably a
blueberry!).
Substrings may be matched using the * operator; for example,
(colour=b*)
will match items whose color begins with “b”—“blue”, for example, and also “brown.”
Like many things, filters are created using the BundleContext , as follows:
Filter f = ctx.createFilter("(log.type=text)");
ServiceReference[] refs;
refs = ctx.getServiceReferences(Logger.class.getName(), f.toString());
So far we've been discussing what you can do in an OSG i application. Now let's con-
sider how you run an OSG i application.
A.6
OSGi frameworks
These core elements of OSG i—bundles, lifecycle management, and service infrastruc-
ture—are supported by an environment known as an OSG i framework. It's useful to
think of each element as a layer in an OSG i onion. (Like onions, OSG i has been known
to make grown developers cry, but gives wonderful benefits.) Figure A.9 shows how
the layers stack together. It's possible to use OSG i bundles without ever touching bun-
dle lifecycles or services. To take advantage of OSG i services, on the other hand, an
application must already be making use of bundles.
In addition to the layers we've already discussed, the OSG i platform includes a
security layer that provides extensions to the Java 2 security architecture. The security
Services
Application
content
Lifecycle
Figure A.9 The functionality of
OSGi includes a number of layers.
The white elements are provided
by OSGi, the gray elements are
prerequisites, and the black ele-
ments are user content. Applica-
tions will take advantage of the
core OSGi framework by providing
modules, possibly with sophisti-
cated lifecycles. These modules
may communicate with one an-
other and the supporting platform
using OSGi services. Security is
provided across all layers.
Module
Execution environment
Java virtual machine
Operating system
Hardware
Search WWH ::




Custom Search