You've already seen how to add Blueprint metadata to an OSG i bundle in section 2.3.8.
Set up a new bundle, fancyfoods.datasource , with a blueprint.xml file in OSGI-INF /
Do you really need a whole bundle?
Isn't a bundle with nothing inside it but a manifest and a Blueprint file a bit of a heavy-
weight way of setting up a datasource? Well, if we're honest, perhaps! But the data-
source configuration is closely tied to the database implementation. The Apache
Aries sandbox that we're using comes with the Apache Derby database, but as you
explore other stacks (chapter 13) you may wish to switch databases, or move to an
application server with built-in admin support for configuring datasources. Isolating
the datasource ensures you won't have to rewrite or rip out datasource configuration
from another bundle as you update your stack.
Listing 3.1 shows the Blueprint for setting up the datasources. It defines two data-
sources, one for transactional writes, and one for optimized nontransactional reads. A
lot is going on in this Blueprint file, so we'll walk through the parts in detail.
An OSGI-INF/blueprint/blueprint.xml file that defines a Derby datasource
Use Blueprint to construct
Another bean for
Properties are same
as for non-XA bean
Expose bean as
Search WWH ::