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.
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
- The Italian Army Switches to LibreOffice
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Linux Mint 18
- Oracle vs. Google: Round 2
- The FBI and the Mozilla Foundation Lock Horns over Known Security Hole
- Varnish Software's Varnish Massive Storage Engine
- Devuan Beta Release
- Privacy and the New Math
- Ben Rady's Serverless Single Page Apps (The Pragmatic Programmers)
Until recently, IBM’s Power Platform was looked upon as being the system that hosted IBM’s flavor of UNIX and proprietary operating system called IBM i. These servers often are found in medium-size businesses running ERP, CRM and financials for on-premise customers. By enabling the Power platform to run the Linux OS, IBM now has positioned Power to be the platform of choice for those already running Linux that are facing scalability issues, especially customers looking at analytics, big data or cloud computing.
￼Running Linux on IBM’s Power hardware offers some obvious benefits, including improved processing speed and memory bandwidth, inherent security, and simpler deployment and management. But if you look beyond the impressive architecture, you’ll also find an open ecosystem that has given rise to a strong, innovative community, as well as an inventory of system and network management applications that really help leverage the benefits offered by running Linux on Power.Get the Guide