Neil,

> If bundle Y wants to know its immediate caller then it can call
> Thread.currentThread.getStackTrace(). The problem is, this will not
> tell you from which bundle you were called -- the only way to get that
> kind of information is to register a ServiceFactory.
> 
> What is the purpose of bundle Y? It just seems to be getting in the
> way. Why not call the LogService directly from bundle X?

X and Y are both bundles. bundle Y is a bundle full of generic code, and bundle 
X uses code in bundle Y. 

To quote a colleague which also pulls his hear out : -) 

"We have multiple webapplications (like war's) as bundles in our OSGi 
container. Only instead of placing all dependencies into the war we use OSGi to 
manage our dependencies. Dependencies are therefore used by multiple 
webapplications at the same time and not every dependency is fully OSGi 
compatible or in other words: not all webapplications use OSGi services and 
directly accessed using import-package. Bundle A and Bundle B are both 
webapplications which both depend on bundle Z which is an implementation of a 
specific library (take for example a template engine like Freemarker). When 
webapplication A (Bundle A) calls Freemarker (Bundle Z) and there occurs a 
warning which is logged to the logservice then this logmessage should be logged 
in the logfile of webapplication A. Okay, so far, so good. However, when 
webapplication B also calls the same function as webapplication A did then it 
will generate the same warning. The problem now is, this generated log message 
should only !
 appear in the logfile of webapplication B and not in the logfile of 
webapplication A and ofcourse vice versa for the first warning.
"

Ik hope this makes things clear.



        Igmar


_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to