The World Is a libferris Filesystem
Listing 7. C++ Code Fragment Applying an XSLT to a Filesystem
fh_context c = Resolve( "~/example.odt/content.xml/" "office:document-content/office:body/office:text"); DOMDocument* theDOM = Factory::makeDOM( c ); ... // should use XercesDOMWrapperParsedSource XalanTransformer theXalanTransformer; theXalanTransformer.transform( theDOM, "~/my-oo.xsl", cout );
Recently, support for mounting applications such as Firefox, Evolution and the X Window System was added to libferris.
The evolution:// filesystem allows you to mount your Evolution mail client. Support currently extends to your mail folders and contacts. Using this filesystem, it is no longer necessary to save attachments to temporary files to access them from ferris-aware systems.
Mounting your X Window System is done via the xwin:// filesystem. This gives access to your window objects as well as lets you mount Klipper on KDE desktops. For Klipper, you can ls, cat and cp your past clipboard interactions easily, and overwriting the top clipboard element is effectively a clipboard copy. The window mounting lets you see where your windows are in terms of x,y offsets as well as other interesting data. Listing 8 shows a sample session of mounting my Evolution mail client and the X Window System.
Listing 8. Mounting Evolution and the X Window System
$ fls evolution://localhost contacts mail $ fls -0 evolution://localhost/contacts/system/ ... witme-ferris firstname.lastname@example.org ... $ fls -0 xwin://localhost/clipboard 0 #include <Ferris/Ferris.hh> 1 Let the cricket stick to its hearth 2 ...
Mounting databases allows you to explore the database server, its databases and their tables and views. Shown in Listing 9, I create a database, populate it and interact with it as a virtual filesystem. The final command using the --xml option for ferrisls exports each tuple in XML format.
Instead of embedding the user name and password in the URL, libferris elects to store this information in configuration files. This is a trade-off where the risk of accidentally copying and pasting a URL with embedded user credentials is minimized at the expense of having a central store of available credentials and mappings for where to use each credential. For many common URLs, inline authentication information is also supported.
Listing 9. PostgreSQL as a Filesystem
$ psql # create database tmp; # \c tmp # create table foo ( message varchar(100) not null, id int primary key ); # insert into foo values ( 'doki doki', 1 ); # \q $ fls -0 pg://localhost/tmp/foo doki doki 1 1 id $ fcat pg://localhost/tmp/foo/1 <context id="1" message="doki doki" /> $ echo "waku waku" | ferris-redirect \ -T --ea=message pg://localhost/tmp/foo/1 $ fls -0 pg://localhost/tmp/foo waku waku 1 1 id $ gfcreate pg://localhost/tmp/foo # See the gfcreate-tuple figure $ fls -0 pg://localhost/tmp/foo utsukushii 2 2 id $ psql tmp; # select * from foo; message | id ------------------------+---- waku waku | 1 utsukushii | 2
The invocation of gfcreate shown in Listing 9 is captured in Figure 1.
A libferris filesystem can nominate which objects it is happy to have created on it. You can see this list by using the fcreate or gfcreate tools in the ferriscreate package. A large list of possibilities will be displayed for an fcreate -l /tmp, for example. For a PostgreSQL database, you can create only a small number of new object types, as shown in Listing 10. I'll use fcreate in a moment to create a new empty db4 file to show how filesystem monitoring is virtualized in libferris.
Listing 10. What types of things can I create for a PostgreSQL filesystem?
$ fcreate -l pg://localhost/tmp listing types that can be created for context: pg:///localhost/tmp queryview table $ fcreate -l pg://localhost/tmp/foo listing types that can be created for context: pg:///localhost/tmp/foo tuple
Many changes made to a libferris filesystem are reflected instantly in other libferris applications. Many kernel-level interfaces let applications know when a kernel filesystem changes—for example, inotify and dnotify. libferris extends this to allow clients to know when a virtual filesystem has changed. For example, when you update an element inside of an XML file, inotify tells you only that the XML file has changed. With libferris, you can see exactly which part of the XML file was modified by other libferris applications.
Listing 11 demonstrates the filesystem monitoring support. In the example, I use the --monitor-all option of ferrisls. This makes ferrisls operate like a tail -f for your given URL; any creation, deletion or interesting filesystem activity is shown on the console. In another terminal, Listing 12, I'm creating, deleting and writing to “files” inside a Berkeley db4 file. ferrisls happily reports what is happening to these virtual files.
- Let's Go to Mars with Martian Lander
- VMware's Clarity Design System
- Applied Expert Systems, Inc.'s CleverView for TCP/IP on Linux
- My Childhood in a Cigar Box
- Papa's Got a Brand New NAS
- Rogue Wave Software's TotalView for HPC and CodeDynamics
- Panther MPC, Inc.'s Panther Alpha
- Jetico's BestCrypt Container Encryption for Linux
- Simplenote, Simply Awesome!
- Smith Charts for All