Home > REST, VFS > Remote File Access in VFS using OpenRasta – Part 1 (Introduction)

Remote File Access in VFS using OpenRasta – Part 1 (Introduction)

February 14th, 2010

This lose series of articles will cover the implementation of a file system façade that allows transparent remote file system access in VFS.

The series will cover the following topics:

  • Introduction and basic concept (this article)
  • Implementing a RESTful file system proxy service with OpenRasta (coming soon)
  • Unit testing the OpenRasta proxy service (not yet published)
  • General tutorial: Streaming binary data in Silverlight
  • Implementing VFS client libraries for both .NET and Silverlight (not yet published)

VFS File System Providers

VFS abstracts access to arbitrary file systems through so-called “File System Providers”, which expose a common interface (IFileSystemProvider) that allows you to browse and modify the file system. The interface is not exactly lean, but easy to understand:

image

Now, common file system providers directly operate on some kind of hierarchical data. Here’s a few examples:

  • The “Local File System Provider” allows you to access your local machine, or the contents of a dedicated directory.
  • The “ZIP File System Provider” works upon a single ZIP file, and allows you to transparently access and modify its contents.
  • An “FTP File System Provider” connects to a given FTP server and gives you access to the server’s files through the VFS API.

So basically, an application uses a VFS provider, which in turn directly accesses the exposed file system:

image

 

Tunneling Façades

There is, however, a special family of file system providers that do not access any files. Instead, they forward file system requests to another file system provider, thus creating a tunnel to another file system. Basically, these file system providers are façades to another, arbitrary file system provider.

image

 

Here’s an exemplary scenario that uses a façade in order to access a ZIP file that is exposed through a ZIP file provider (click on the UML diagram in order to see it in full size).

 Tunnelling

 

The interesting point here: From the client’s perspective, there is no difference in accessing the file system. The façade itself implements the IFileSystemProvider interface – it provides exactly the same API as any other provider.

As you can see from the diagram above, a façade is usually complemented by some kind of proxy that receives the forwarded requests, so in order to implement the pattern, there’s two components to be written:

  1. The façade, which implements IFileSystemProvider.
  2. The proxy that takes the forwarded requests, forwards them its own file system provider, and eventually returns the requested data. This proxy is not a VFS component, and you don’t have to implement any VFS interfaces.

As you can guess, tunnels come in handy in order to access remote data. Here’s a few scenarios:

  • Run a local file system provider on a server that provides a download service. Clients don’t have direct access to the files, but use a tunnel to access the files that are exposed through the provider that runs on the server.
  • Allow a Silverlight client to browse the contents of a ZIP file on the server, without having to download the whole ZIP file first (sample coming).
  • Host a cloud file system provider within a WCF service, and expose parts of the cloud’s data to clients. Like this, clients don’t have direct access to the cloud data.

A RESTful Façade Implementation

Every façade itself is an independent file system provider – so tunneling is rather a pattern than an API, and you can write your own façade should you wish to (actually, contributions will be most welcome!).

However, VFS 1.0 will ship with a single façade implementation that uses HTTP/REST to create a tunnel to a remote file system. It is built upon the following libraries:

  • On the server side, OpenRasta was used to expose file system access as RESTful services. OpenRasta is a lightweight, but powerful framework that comes with a API.
  • On the client side, the WCF REST Starter Kit was used for both .NET and Silverlight clients (the Silverlight library hacked together by myself). The starter kit’s client libraries allow for simple access to RESTful resources, even if there is no WCF involved.

 

The upcoming articles will walk you through the implementation of the both the client and service libraries, and will also be complemented by a preview release of VFS. Stay tuned 🙂


Author: Categories: REST, VFS Tags:
  1. jbland
    February 25th, 2010 at 20:41 | #1

    How goes this ? Im gonna need to use something like this soon, but i need S3 as well as local support. i may just spike this and try to add in S3 support myself…

  2. February 26th, 2010 at 12:45 | #2

    Hi there

    I’m currently busy with a customer’s project so the next part is delayed a few days, but I can give you access to the sources. An S3 provider would be most welcome – I already created a Contrib project on CodePlex. [everthing else on direct mail]

  3. July 14th, 2010 at 13:45 | #3

    Philipp,

    Very cool, I have been thinking about something like this for use with WP7.. very cool (provided that we get Web Service access in WP7 that is.. not sure if it’s in there or not)

    Jay Kimble

  4. Jonx
    April 17th, 2011 at 16:53 | #4

    For the record…
    http://vfs.codeplex.com/

  1. No trackbacks yet.