commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bakary Dialaya DJIBA" <dial...@gmail.com>
Subject [ understand VFS ]
Date Tue, 23 Sep 2008 19:37:46 GMT
Hi,

Given a FileSystem *fs* (extends abstractFS) and a FileObject *fo *(extends
AbstractFO), how can I attach the fo to the fs?

It's a silly question. I am trying to create a provider that I'll add to
the default manager (of VFS). The provider is added successfully but I
cannot make a link between *fs* and *fo*.

To do this I write the code below:

DefaultFileSystemManager manager new DefaultFileSystemManager();
MyProvider provider = new MyProvider();
FileSystemOptions fileSystemOptions = new FileSystemOptions();

manager.addProvider("sch", provider);
manager.init();

CustomFileObject fo = (CustomFileObject)manager.resolveFile("sch:/");

CustomFileName fn = new CustomFileName("sch", "userName",FileType.FOLDER);

CustomFileSystem fs = new CustomFileSystem(fn,fileSystemOptions);
fs.attach(fo);
System.out.println(fo.isAttached()); // return false
fo.doAttach();
System.out.println(fo.isAttached()); // return false


My second problème is that I don't know how to set my root file system. And
also fo.getParent() throw a null pointer exception.

Someone can tell me how to do this:

FS
 |__FileObject1 ...
 |
 |__FileObject2 ...

or give me a tutorial to understand VFS API.

Thanks & Regards.


-- 
Bakary,

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message