On Wed, May 17, 2017 at 2:55 PM, Simon Chemouil <ecli...@mithrandir.net>
wrote:

> Michael Lipp a écrit le 16/05/2017 à 23:39 :
> > I have code that relies on a directory tree of resources to be available
> > as NIO FileSystem. [...] This returns a URI with
> > scheme "jar", which can be passed to FileSystems.newFileSystem. When
> > running in the OSGi environment, I get a URI with the "bundle" scheme...
>


> My conclusion is that there is no proper way to do it without being the
> system bundle. The thing is Nio Filesystems have non-blocking IO methods
> (eg AsynchronousFileChannels)[...] Or they could
> throwUnsupportedOperationException, but that would probably break your
> consumer code, and it's a bit sad considering that's a big part of what Nio
> filesystems add to the File API!


One could reuse the  implementation from the zip filesystem provider-
jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystemProvider.java
<http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/ef9954f6896b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystemProvider.java>
 .

     @Override
    public AsynchronousFileChannel newAsynchronousFileChannel(Path path,
            Set<? extends OpenOption> options,
            ExecutorService exec,
            FileAttribute<?>... attrs)
            throws IOException
    {
        throw new UnsupportedOperationException();
    }


 OT:

> (I happen to wrap it in reactive streams [2] for composition)

[2] http://www.reactive-streams.org/


The   reactive-streams API is  provided by the nested interfaces in jdk9s
java.util.concurrent.Flow (Doug Lea original here
<http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/jdk8/java/util/concurrent/Flow.java?view=markup>).
Of course, they aren't actual sub-types of the org.reactivestreams.*
classes, so wrap and delegate.
A basic-but-Doug-Lea push-stream with flow control is included in
java.util.concurrent.SubmissionPublisher
<http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/jdk8/java/util/concurrent/SubmissionPublisher.java?revision=1.6&view=markup>
;
rxjava2  Flowable's are nicer.

Simon
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to