Java Reference
In-Depth Information
paint-bundles/
frame-4.0.jar
circle-4.0.jar
triangle-4.0.jar
shape-4.0.jar
square-4.0.jar
You could create the repository XML file by hand, but you can use several different tools
to create one instead. This example uses BIndex ( http://www.osgi.org/Repository/
BIndex ), which is provided by the OSG i Alliance. For Maven users, there's also Maven
support, which we'll discuss in appendix A. To create a repository using BIndex, run the
following from above the bundles directory (this example assumes you're in the
chapter10/combined-example/ directory of the companion code):
java -jar bindex.jar -r repository.xml -n Paint paint-bundles/*.jar
This creates a repository.xml file that contains the metadata of the bundles from the
example. The main XML element is a repository tag defining the repository:
<repository lastmodified='20090215101706.874' name='Paint'>
...
</repository>
The lastmodified attribute is used as a timestamp by the OBR service to determine
whether something has changed. The most interesting element is the <resource> tag:
it describes a bundle you want to make available. The created repository XML file
contains one resource block per bundle. The shape API bundle converted into OBR is
as follows.
Listing 10.1 Shape API bundle converted into OBR repository XML syntax
<resource id='org.foo.shape/4.0.0' presentationname='shape'
symbolicname='org.foo.shape' uri='paint-bundles/shape-4.0.jar'
version='4.0.0'>
<size>
5742
</size>
<license>
http://www.apache.org/licenses/LICENSE-2.0
</license>
<documentation>
http://code.google.com/p/osgi-in-action/
</documentation>
<capability name='bundle'>
<p n='manifestversion' v='2'/>
<p n='presentationname' v='shape'/>
<p n='symbolicname' v='org.foo.shape'/>
<p n='version' t='version' v='4.0.0'/>
</capability>
<capability name='package'>
<p n='package' v='org.foo.shape'/>
<p n='version' t='version' v='4.0.0'/>
</capability>
C Capability element
representing package
Search WWH ::




Custom Search