Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[ecf-dev] Files

ECF dev'ers:

I'm beginning to think about an ECF file transfer API, and have a question: do each of you think that such an API should 'look' like accessing the local file system (but be through some file access protocol). e.g. What if I could do something like this:

// Make container instance and connect
IContainer container = ContainerFactory.makeContainer("ftpfilesystemcontainer");
container.connect(IDFactory.makeID(container.getConnectNamespace(),"ftp://slewis@localhost";),password);

// get IFileSystemContainer adapter
IFileSystemContainer fscont = (IFileSystemContainer) rawcontainer.getAdapter(IFileSystemContainer.class); // get a file handle for a particular file I'm looking for (or navigate/query directories, etc)
IFile aFile = fscont.getFileForLocation("path/to/file/plus/name");
// get contents of file
if (aFile != null) {
   InputStream contents = aFile.getContents();
   // read from stream and do whatever with it...e.g. save, etc
}

// the underlying provider implementation would implement this in the protocol-specific way...e.g. read stream with ftp get, etc

What do you think of this 'style' of implementing file transfer? It sort of makes the ECF container into a virtual file system...and it leverages off of the existing org.eclipse.core.resources.* semantics (and implementation I expect). One problem, though, is that the aFile.getContents() call would necessarily be blocking, and we may want to provide an IFile adapter that allows for asynchronous retrieval of contents with notification.

Let me know what you think.

Scott







Back to the top