Let's modify our use case bundles to use the iPOJO functionality. Here's the plan:
bookshelf-inventory-impl-mock
bundle, adding an iPOJO descriptor for the component and its instance and removing the bundle activator. bookshelf-service
bundle to have the inventory field injected instead of it performing a lookup in the service and declare it in its descriptor. bookshelf-service-tui
commands to have as bookshelf service field injected and have them instantiated and registered through iPOJO, here too no longer needing to keep the activator.As we will soon see, iPOJO allows configuration in XML and using annotations on the component. To practice both technologies, we will modify the bookshelf-inventory-impl-mock
and bookshelf-service
bundles to use XML-only and the bookshelf-service-tui
bundle to use both.
The step-by-step learning of iPOJO will be as follows:
bookshelf-inventory-impl-mock
) only requires the publishing of a service using XML only.But first let's install the iPOJO bundle on our Felix framework.
We'll start the Apache Felix iPOJO bundle directly from the registered Felix OBR, just like we did previously with the other bundles, with the obr:deploy
command (including the -s
option):
g! deploy -s "Apache Felix iPOJO"
Target resource(s):
-------------------
Apache Felix iPOJO (1.6.4)
Deploying...done.
The service should now be ready for use. The next thing we need to do is to update our bundles to use it.
18.119.159.178