Hi all. Very new to this iPOJO composite stuff (actually, new to the whole OSGi & iPOJO thing too).
I'm having an issue with some logging during startup. I've created a logger
that presents an SLF4J interface and passes log messages off to the OSGi
logging service, and I provide a LogListener that interfaces to LogBack. All
seemed to be working fine, but I ran into a timing issue when I create a
composite using the following metadata.xml.
<ipojo
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="org.apache.felix.ipojo
http://felix.apache.org/ipojo/schemas/SNAPSHOT/core.xsd
org.apache.felix.composite
http://felix.apache.org/ipojo/schemas/SNAPSHOT/composite.xsd"
xmlns="org.apache.felix.ipojo"
xmlns:comp="org.apache.felix.ipojo.composite">
<comp:composite name="DataSourceManager">
<comp:instance
component="com.itslm.omneity.data.service.DataSourceManagerImpl" />
<comp:provides action="export"
specification="com.itslm.omneity.data.api.DataSourceManager" />
<!-- Will programmatically identify and load Adaptor plugins,
this next
entry pulls in Adapters in the global scope (so, only
those that are in the
main bundle directory) -->
<comp:subservice action="import"
specification="com.itslm.omneity.adapter.api.Adapter" />
<comp:subservice action="import"
specification="org.osgi.service.log.LogService" />
</comp:composite>
<comp:instance component="DataSourceManager" name="DataSourceManager"/>
</ipojo>
Everything starts up fine, but any log messages output during startup of this
composite were lost because the logging service seems to be imported to the
component only when DataSourceManagerImpl has completed startup. No problem. I
just added buffering to the logger and had the system flush that buffer when
the logging service became available (a better design anyway).
However, I now get another problem: the bundle context for
DataSourceManagerImpl seems to have no symbolic name at the point the logging
service becomes available (getSymbolicName() returns null). Since my logging
system deliberately drops 'anonymous' log messages this means nothing is being
logged from DataSourceManagerImpl.
If I run the DataSourceManagerImpl in a plain bundle without wrapping them in a
composite everything works fine.
Questions.
Is there a way to make these symbolic names available? Should I be specifying
more in the metadata for the composite? What am I missing?
signature.asc
Description: Message signed with OpenPGP using GPGMail

