Re: Slf4j usage in a library

2016-06-02 Thread Jean-Baptiste Onofré

Spec is more SMX related.

Regards
JB

On 06/02/2016 04:52 PM, Benson Margulies wrote:

On Thu, Jun 2, 2016 at 10:34 AM, Jean-Baptiste Onofré  wrote:

It's probably the cleanest approach, agreed.

Regards
JB ut a modified version (i.e.

OSGi-aware) of FileSystemProvider class in the endorsed library so that
it can leverage FileSystemProviders registered as OSGi services.  That's
what we usually do for other specs, so not sure why this one would be
different.


That's sort of what my thread on the servicemix list is about, no? Is
this something Karaf would do, or would it want to get it from SM?

I could take a run at building it either way. I've never made one of
these. How do we deal with the licensing problem that any replacement
is prone to be a derived work of code with an unfriendly license?
(maybe that question really belongs on SM?)






2016-06-02 16:22 GMT+02:00 Guillaume Nodet >:

 It should be safe if you don't export the packages.  They will be
 available from the system class loader, but they won't be available
 to bundles if they are not exported by the system bundle.

 2016-06-02 16:02 GMT+02:00 Benson Margulies >:

 On Thu, Jun 2, 2016 at 12:20 AM, Jean-Baptiste Onofré
 > wrote:
 > Hi Benson,
 >
 > slf4j packages are provided by pax-logging-service bundle
(defined in
 > etc/startup.properties), not by library.
 >
 > So, in your case, you should not use library, but more bundle
definition in
 > etc/startup.properties after pax-logging-service (as you can do
for a custom
 > appender).

 JB, could you help me understand how that can work for my
 particular case?

 My goal here is to add an NIO2 file system provider that is part
of
 the list of installed providers. Only the installed providers
 are used
 for calls to Paths.get(URI).  The code in the JRE that loads up
the
 list of installed providers searches for SPI files using the
system
 classloader, not the TCCL or some other classloader. So, in this
 regard, it seemed to me that an FS provider was much like a JDBC
 driver (as per the example of how/why to use a  in
 doc). So I
 don't think that putting it into a bundle at all will work.

 However, I would be very happy to be wrong. Is there something
about
 java.lang.ClassLoader#getSystemClassLoader inside Karaf that I
don't
 know?

 Regards,
 benson



  >
  > Regards
  > JB
  >
  >
  > On 06/01/2016 08:02 PM, Benson Margulies wrote:
  >>
  >> Hello there.
  >>
  >> I'm trying to put a jar file into the karaf lib dir. Some
 classes in
  >> there use SLF4J for logging.
  >>
  >> Those encounter class-not-found errors for SLF4J.
  >>
  >> Is it safe for me to add slf4j to the lib directory? I'm
 concerned
  >> about disrupting pax-logging, but perhaps all of that is
 happening
  >> inside bundles and won't be effected.
  >>
  >> Thanks,
  >>
  >> benson
  >>
  >
  > --
  > Jean-Baptiste Onofré
  > jbono...@apache.org 
  > http://blog.nanthrax.net
  > Talend - http://www.talend.com




 --
 
 Guillaume Nodet
 
 Red Hat, Open Source Integration

 Email: gno...@redhat.com 
 Web: http://fusesource.com 
 Blog: http://gnodet.blogspot.com/




--

Guillaume Nodet

Red Hat, Open Source Integration

Email: gno...@redhat.com 
Web: http://fusesource.com 
Blog: http://gnodet.blogspot.com/



--
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


--
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Slf4j usage in a library

2016-06-02 Thread Benson Margulies
On Thu, Jun 2, 2016 at 10:34 AM, Jean-Baptiste Onofré  wrote:
> It's probably the cleanest approach, agreed.
>
> Regards
> JB ut a modified version (i.e.
>> OSGi-aware) of FileSystemProvider class in the endorsed library so that
>> it can leverage FileSystemProviders registered as OSGi services.  That's
>> what we usually do for other specs, so not sure why this one would be
>> different.

That's sort of what my thread on the servicemix list is about, no? Is
this something Karaf would do, or would it want to get it from SM?

I could take a run at building it either way. I've never made one of
these. How do we deal with the licensing problem that any replacement
is prone to be a derived work of code with an unfriendly license?
(maybe that question really belongs on SM?)




>>
>> 2016-06-02 16:22 GMT+02:00 Guillaume Nodet > >:
>>
>> It should be safe if you don't export the packages.  They will be
>> available from the system class loader, but they won't be available
>> to bundles if they are not exported by the system bundle.
>>
>> 2016-06-02 16:02 GMT+02:00 Benson Margulies > >:
>>
>> On Thu, Jun 2, 2016 at 12:20 AM, Jean-Baptiste Onofré
>> > wrote:
>> > Hi Benson,
>> >
>> > slf4j packages are provided by pax-logging-service bundle
>> (defined in
>> > etc/startup.properties), not by library.
>> >
>> > So, in your case, you should not use library, but more bundle
>> definition in
>> > etc/startup.properties after pax-logging-service (as you can do
>> for a custom
>> > appender).
>>
>> JB, could you help me understand how that can work for my
>> particular case?
>>
>> My goal here is to add an NIO2 file system provider that is part
>> of
>> the list of installed providers. Only the installed providers
>> are used
>> for calls to Paths.get(URI).  The code in the JRE that loads up
>> the
>> list of installed providers searches for SPI files using the
>> system
>> classloader, not the TCCL or some other classloader. So, in this
>> regard, it seemed to me that an FS provider was much like a JDBC
>> driver (as per the example of how/why to use a  in
>> doc). So I
>> don't think that putting it into a bundle at all will work.
>>
>> However, I would be very happy to be wrong. Is there something
>> about
>> java.lang.ClassLoader#getSystemClassLoader inside Karaf that I
>> don't
>> know?
>>
>> Regards,
>> benson
>>
>>
>>
>>  >
>>  > Regards
>>  > JB
>>  >
>>  >
>>  > On 06/01/2016 08:02 PM, Benson Margulies wrote:
>>  >>
>>  >> Hello there.
>>  >>
>>  >> I'm trying to put a jar file into the karaf lib dir. Some
>> classes in
>>  >> there use SLF4J for logging.
>>  >>
>>  >> Those encounter class-not-found errors for SLF4J.
>>  >>
>>  >> Is it safe for me to add slf4j to the lib directory? I'm
>> concerned
>>  >> about disrupting pax-logging, but perhaps all of that is
>> happening
>>  >> inside bundles and won't be effected.
>>  >>
>>  >> Thanks,
>>  >>
>>  >> benson
>>  >>
>>  >
>>  > --
>>  > Jean-Baptiste Onofré
>>  > jbono...@apache.org 
>>  > http://blog.nanthrax.net
>>  > Talend - http://www.talend.com
>>
>>
>>
>>
>> --
>> 
>> Guillaume Nodet
>> 
>> Red Hat, Open Source Integration
>>
>> Email: gno...@redhat.com 
>> Web: http://fusesource.com 
>> Blog: http://gnodet.blogspot.com/
>>
>>
>>
>>
>> --
>> 
>> Guillaume Nodet
>> 
>> Red Hat, Open Source Integration
>>
>> Email: gno...@redhat.com 
>> Web: http://fusesource.com 
>> Blog: http://gnodet.blogspot.com/
>>
>
> --
> Jean-Baptiste Onofré
> jbono...@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com


Re: Slf4j usage in a library

2016-06-02 Thread Jean-Baptiste Onofré

It's probably the cleanest approach, agreed.

Regards
JB

On 06/02/2016 04:30 PM, Guillaume Nodet wrote:

That said, maybe an alternative would be to put a modified version (i.e.
OSGi-aware) of FileSystemProvider class in the endorsed library so that
it can leverage FileSystemProviders registered as OSGi services.  That's
what we usually do for other specs, so not sure why this one would be
different.

2016-06-02 16:22 GMT+02:00 Guillaume Nodet >:

It should be safe if you don't export the packages.  They will be
available from the system class loader, but they won't be available
to bundles if they are not exported by the system bundle.

2016-06-02 16:02 GMT+02:00 Benson Margulies >:

On Thu, Jun 2, 2016 at 12:20 AM, Jean-Baptiste Onofré
> wrote:
> Hi Benson,
>
> slf4j packages are provided by pax-logging-service bundle (defined in
> etc/startup.properties), not by library.
>
> So, in your case, you should not use library, but more bundle 
definition in
> etc/startup.properties after pax-logging-service (as you can do for a 
custom
> appender).

JB, could you help me understand how that can work for my
particular case?

My goal here is to add an NIO2 file system provider that is part of
the list of installed providers. Only the installed providers
are used
for calls to Paths.get(URI).  The code in the JRE that loads up the
list of installed providers searches for SPI files using the system
classloader, not the TCCL or some other classloader. So, in this
regard, it seemed to me that an FS provider was much like a JDBC
driver (as per the example of how/why to use a  in
doc). So I
don't think that putting it into a bundle at all will work.

However, I would be very happy to be wrong. Is there something about
java.lang.ClassLoader#getSystemClassLoader inside Karaf that I don't
know?

Regards,
benson



 >
 > Regards
 > JB
 >
 >
 > On 06/01/2016 08:02 PM, Benson Margulies wrote:
 >>
 >> Hello there.
 >>
 >> I'm trying to put a jar file into the karaf lib dir. Some
classes in
 >> there use SLF4J for logging.
 >>
 >> Those encounter class-not-found errors for SLF4J.
 >>
 >> Is it safe for me to add slf4j to the lib directory? I'm
concerned
 >> about disrupting pax-logging, but perhaps all of that is
happening
 >> inside bundles and won't be effected.
 >>
 >> Thanks,
 >>
 >> benson
 >>
 >
 > --
 > Jean-Baptiste Onofré
 > jbono...@apache.org 
 > http://blog.nanthrax.net
 > Talend - http://www.talend.com




--

Guillaume Nodet

Red Hat, Open Source Integration

Email: gno...@redhat.com 
Web: http://fusesource.com 
Blog: http://gnodet.blogspot.com/




--

Guillaume Nodet

Red Hat, Open Source Integration

Email: gno...@redhat.com 
Web: http://fusesource.com 
Blog: http://gnodet.blogspot.com/



--
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Slf4j usage in a library

2016-06-02 Thread Guillaume Nodet
That said, maybe an alternative would be to put a modified version (i.e.
OSGi-aware) of FileSystemProvider class in the endorsed library so that it
can leverage FileSystemProviders registered as OSGi services.  That's what
we usually do for other specs, so not sure why this one would be different.

2016-06-02 16:22 GMT+02:00 Guillaume Nodet :

> It should be safe if you don't export the packages.  They will be
> available from the system class loader, but they won't be available to
> bundles if they are not exported by the system bundle.
>
> 2016-06-02 16:02 GMT+02:00 Benson Margulies :
>
>> On Thu, Jun 2, 2016 at 12:20 AM, Jean-Baptiste Onofré 
>> wrote:
>> > Hi Benson,
>> >
>> > slf4j packages are provided by pax-logging-service bundle (defined in
>> > etc/startup.properties), not by library.
>> >
>> > So, in your case, you should not use library, but more bundle
>> definition in
>> > etc/startup.properties after pax-logging-service (as you can do for a
>> custom
>> > appender).
>>
>> JB, could you help me understand how that can work for my particular case?
>>
>> My goal here is to add an NIO2 file system provider that is part of
>> the list of installed providers. Only the installed providers are used
>> for calls to Paths.get(URI).  The code in the JRE that loads up the
>> list of installed providers searches for SPI files using the system
>> classloader, not the TCCL or some other classloader. So, in this
>> regard, it seemed to me that an FS provider was much like a JDBC
>> driver (as per the example of how/why to use a  in doc). So I
>> don't think that putting it into a bundle at all will work.
>>
>> However, I would be very happy to be wrong. Is there something about
>> java.lang.ClassLoader#getSystemClassLoader inside Karaf that I don't
>> know?
>>
>> Regards,
>> benson
>>
>>
>>
>> >
>> > Regards
>> > JB
>> >
>> >
>> > On 06/01/2016 08:02 PM, Benson Margulies wrote:
>> >>
>> >> Hello there.
>> >>
>> >> I'm trying to put a jar file into the karaf lib dir. Some classes in
>> >> there use SLF4J for logging.
>> >>
>> >> Those encounter class-not-found errors for SLF4J.
>> >>
>> >> Is it safe for me to add slf4j to the lib directory? I'm concerned
>> >> about disrupting pax-logging, but perhaps all of that is happening
>> >> inside bundles and won't be effected.
>> >>
>> >> Thanks,
>> >>
>> >> benson
>> >>
>> >
>> > --
>> > Jean-Baptiste Onofré
>> > jbono...@apache.org
>> > http://blog.nanthrax.net
>> > Talend - http://www.talend.com
>>
>
>
>
> --
> 
> Guillaume Nodet
> 
> Red Hat, Open Source Integration
>
> Email: gno...@redhat.com
> Web: http://fusesource.com
> Blog: http://gnodet.blogspot.com/
>
>


-- 

Guillaume Nodet

Red Hat, Open Source Integration

Email: gno...@redhat.com
Web: http://fusesource.com
Blog: http://gnodet.blogspot.com/


Re: Slf4j usage in a library

2016-06-02 Thread Guillaume Nodet
It should be safe if you don't export the packages.  They will be available
from the system class loader, but they won't be available to bundles if
they are not exported by the system bundle.

2016-06-02 16:02 GMT+02:00 Benson Margulies :

> On Thu, Jun 2, 2016 at 12:20 AM, Jean-Baptiste Onofré 
> wrote:
> > Hi Benson,
> >
> > slf4j packages are provided by pax-logging-service bundle (defined in
> > etc/startup.properties), not by library.
> >
> > So, in your case, you should not use library, but more bundle definition
> in
> > etc/startup.properties after pax-logging-service (as you can do for a
> custom
> > appender).
>
> JB, could you help me understand how that can work for my particular case?
>
> My goal here is to add an NIO2 file system provider that is part of
> the list of installed providers. Only the installed providers are used
> for calls to Paths.get(URI).  The code in the JRE that loads up the
> list of installed providers searches for SPI files using the system
> classloader, not the TCCL or some other classloader. So, in this
> regard, it seemed to me that an FS provider was much like a JDBC
> driver (as per the example of how/why to use a  in doc). So I
> don't think that putting it into a bundle at all will work.
>
> However, I would be very happy to be wrong. Is there something about
> java.lang.ClassLoader#getSystemClassLoader inside Karaf that I don't
> know?
>
> Regards,
> benson
>
>
>
> >
> > Regards
> > JB
> >
> >
> > On 06/01/2016 08:02 PM, Benson Margulies wrote:
> >>
> >> Hello there.
> >>
> >> I'm trying to put a jar file into the karaf lib dir. Some classes in
> >> there use SLF4J for logging.
> >>
> >> Those encounter class-not-found errors for SLF4J.
> >>
> >> Is it safe for me to add slf4j to the lib directory? I'm concerned
> >> about disrupting pax-logging, but perhaps all of that is happening
> >> inside bundles and won't be effected.
> >>
> >> Thanks,
> >>
> >> benson
> >>
> >
> > --
> > Jean-Baptiste Onofré
> > jbono...@apache.org
> > http://blog.nanthrax.net
> > Talend - http://www.talend.com
>



-- 

Guillaume Nodet

Red Hat, Open Source Integration

Email: gno...@redhat.com
Web: http://fusesource.com
Blog: http://gnodet.blogspot.com/


Re: Slf4j usage in a library

2016-06-02 Thread Benson Margulies
On Thu, Jun 2, 2016 at 12:20 AM, Jean-Baptiste Onofré  wrote:
> Hi Benson,
>
> slf4j packages are provided by pax-logging-service bundle (defined in
> etc/startup.properties), not by library.
>
> So, in your case, you should not use library, but more bundle definition in
> etc/startup.properties after pax-logging-service (as you can do for a custom
> appender).

JB, could you help me understand how that can work for my particular case?

My goal here is to add an NIO2 file system provider that is part of
the list of installed providers. Only the installed providers are used
for calls to Paths.get(URI).  The code in the JRE that loads up the
list of installed providers searches for SPI files using the system
classloader, not the TCCL or some other classloader. So, in this
regard, it seemed to me that an FS provider was much like a JDBC
driver (as per the example of how/why to use a  in doc). So I
don't think that putting it into a bundle at all will work.

However, I would be very happy to be wrong. Is there something about
java.lang.ClassLoader#getSystemClassLoader inside Karaf that I don't
know?

Regards,
benson



>
> Regards
> JB
>
>
> On 06/01/2016 08:02 PM, Benson Margulies wrote:
>>
>> Hello there.
>>
>> I'm trying to put a jar file into the karaf lib dir. Some classes in
>> there use SLF4J for logging.
>>
>> Those encounter class-not-found errors for SLF4J.
>>
>> Is it safe for me to add slf4j to the lib directory? I'm concerned
>> about disrupting pax-logging, but perhaps all of that is happening
>> inside bundles and won't be effected.
>>
>> Thanks,
>>
>> benson
>>
>
> --
> Jean-Baptiste Onofré
> jbono...@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com