[Bug 75] New: Cyclic dependency in OSGi

View: New views
6 Messages — Rating Filter:   Alert me  

[Bug 75] New: Cyclic dependency in OSGi

by Bugzilla from bugzilla-daemon@pixie.qos.ch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://bugzilla.slf4j.org/show_bug.cgi?id=75

           Summary: Cyclic dependency in OSGi
           Product: SLF4J
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Core API
        AssignedTo: dev@...
        ReportedBy: mirkojahn@...


The API bundle of SLF4j (slf4j-api-1.X.0.jar) exports the API packages and
imports the org.slf4j.impl package. All implementation bundles like LOGBack in
return have to import the API packages and export their impl. of
org.slf4j.impl.* classes. This creates a pretty nasty cycle, although it might
not be necessary to have a concrete implementation available, if logging is not
desired in a particular deployment for instance. For this reason, the import
should be defined as optional:
Import-Package: org.slf4j.impl;version=${project.version};resolution:=optional

OSGi would then look internally (inside the API bundle) for the resources/
classes, where a default Logger could be returned, which is doing nothing.

BTW, the export statements are missing the uses clause and all exports should
be imported as well (see blog entries of Peter Kriens). Here is an example
(generated with Eclipse Manifest-Editor):

Export-Package: org.slf4j;version="1.4.3";uses:="org.slf4j.spi",
 org.slf4j.helpers;version="1.4.3";uses:="org.slf4j.spi,org.slf4j",
 org.slf4j.spi;version="1.4.3";uses:="org.slf4j"
Import-Package: org.slf4j;version="[1.4.0,2.0.0)",
 org.slf4j.helpers;version="[1.4.0,2.0.0)",
 org.slf4j.spi;version="[1.4.0,2.0.0)",
 org.slf4j.impl;version="[1.4.0,2.0.0)";resolution:=optional


--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
_______________________________________________
dev mailing list
dev@...
http://www.slf4j.org/mailman/listinfo/dev

[Bug 75] Cyclic dependency in OSGi

by Bugzilla from bugzilla-daemon@pixie.qos.ch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://bugzilla.slf4j.org/show_bug.cgi?id=75





------- Comment #1 from mirkojahn@...  2008-02-27 13:47 -------
I just noticed that in 1.5 all implementations are actually fragments of the
API. Certainly a solution for the cyclic dependency problem, it is not
propagated way, how it is done in OSGi (I would say).

My major problem with this is, that I am now no longer able to use OSGi
specific services. In order to use services I need to have access to the
BundleContext object, which is provided by the Activator of a bundle. Fragments
however don't have Activators and the API bundle doesn't provide an Activator
my "fragment" can use.

This leaves two possibilities with the fragment solution:
1. One has to change the SLF4J-API bundle and add the necessary, domain
specific code in order to use services in a specific logging implementation.
2. The SLF4J-API bundle provides generic access to the BundleContext Object
with an Activator and all impl. Fragments can use that one accordingly.

I would prefer the second one, because it is generic and doesn't impose
implementation or domain specific dependencies to the API, thus the danger of
having multiple tweaked SLF4J-API bundles flying around will be minimized.

Alternatively, the fragment approach can be withdrawn and a simple solution as
depicted above can be used. This would also remove the need for other logging
impl. to add the fragment-host header (not that this is a huge burden, but it
might take some time till this is included an actual release).


--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
_______________________________________________
dev mailing list
dev@...
http://www.slf4j.org/mailman/listinfo/dev

[Bug 75] Cyclic dependency in OSGi

by Bugzilla from bugzilla-daemon@pixie.qos.ch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://bugzilla.slf4j.org/show_bug.cgi?id=75





------- Comment #2 from mirkojahn@...  2008-02-27 13:50 -------
Bug #73 is the mentioned Fragment solution introduced in 1.5


--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
_______________________________________________
dev mailing list
dev@...
http://www.slf4j.org/mailman/listinfo/dev

[Bug 75] Cyclic dependency in OSGi

by Bugzilla from bugzilla-daemon@pixie.qos.ch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://bugzilla.slf4j.org/show_bug.cgi?id=75


listid@... changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |infobox.oleg@...
             Status|NEW                         |ASSIGNED




------- Comment #3 from listid@...  2008-06-05 19:01 -------
Hello Mirko,


As you already know, I followed the simple recipe suggested by Oleg Smirsky in
bug 73 to tackle the cycle dependency problem.  Being not so well-versed in the
intricacies of OSGi, I fail to follow the logic of your comments dated  
2008-02-27.

Here are some questions.

1) Is there still a problem?
2) If there is still a problem. Given that you seem to know that you are
talking about, could you please provide a patch for MANIFEST.MF files fixing
the problem?
3) Could another person, possibly Oleg, kindly test and verify solution
proposed by Mirko?


--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
_______________________________________________
dev mailing list
dev@...
http://www.slf4j.org/mailman/listinfo/dev

[Bug 75] Cyclic dependency in OSGi

by Bugzilla from bugzilla-daemon@pixie.qos.ch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://bugzilla.slf4j.org/show_bug.cgi?id=75





------- Comment #4 from mirkojahn@...  2008-06-09 13:14 -------
Hello Ceki,

well, the issue in general is still present. Although I decided to create my
own adapted version of slf4j, a general and fitting solution for everyone would
be more desirable. I am kinda busy right now, but I'll look into this more
closer next week. Hope that's ok with you.


--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
_______________________________________________
dev mailing list
dev@...
http://www.slf4j.org/mailman/listinfo/dev

[Bug 75] Cyclic dependency in OSGi

by Bugzilla from bugzilla-daemon@pixie.qos.ch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://bugzilla.slf4j.org/show_bug.cgi?id=75





------- Comment #5 from listid@...  2008-06-09 14:26 -------

That would be great.


--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
_______________________________________________
dev mailing list
dev@...
http://www.slf4j.org/mailman/listinfo/dev
LightInTheBox - Buy quality products at wholesale price