Nevyn's Blog

Monday, 4 August 2008

BlueQuartz::DB4

Hi folks - just having some more fun poking around under the hood of the sausalito UI (user interface) for BlueQuartz linux. I'm actually just trying to amend one of the package names installed under the BlueLinQ tab, because I have installed Webmin 1.250, and after upgrading it to 1.420 BlueLinQ has frustratingly kept the original 1.250 version number.

I have traversed the JavaScripts, read the PHP, and found my way into the $cce objects. That led me to the discovery of the cce.so module used by the php4 admin backend webserver. it would appear that with this, the $cce object in PHP communicates with the /usr/sausalito/sbin/cced daemon via the cced.socket unix socket. (I could be slightly off here, but that seems to be vaguely representative?)

There are 2 xml files in the /usr/sausalito/ui/style folder which define the colour schemes, 'Merlot' and 'trueBlue'. However, there are over 100 other .xml files in the /usr/sausalito/ui subfolders, which looked like a good place to find where BlueQuartz kept its data, but upon inspection appeared only to contain definitions for the various menus etc associated with the admin UI.

Without looking at (for) the objects, methods and function calls in the php which manipulate the cced, I investigated the cceclient /usr/sausalito/bin/cceclient. I recommend setting up an alias by using a line like "alias cceclient='/usr/sausalito/bin/cceclient'" in your terminal session (or better, in your ~/.bashrc file) to make it easier. See my earlier post for commands you can use, and READ THE WARNINGS!

So now you've got access to the backend. Perhaps you can even GET and SET some values, and whilst this may be enough to solve the above problem (altering the description of an installed package), I was still curious about where it stored the data, as it wasnt in any of the .xml files found thus far, I couldn't see any evidence in the MySQL db, and there was no sign of a postgreSQL server either.

The clue is /usr/sausalito/db4 - looks like a Berkeley db4 v4.0.14 backend, and sure enough, the apache admin instance also has dba support built in. It doesnt appear to use SQL, resembling more of a structured file like xml with key=value pairs. I'll try and update this section shortly...

Until then, for more info see these links:

/usr/sausalito/db4/docs/index.html is the path to the (local) documentation on BlueQuartz and contains the API for C/C++, Java and Tcl. See also the docu about the supporting utilities (in db4/bin)

Adding dba support to php

How to Create a db4 Database from a Text File or Array

http://www.stanford.edu/services/pubsw/package/libraries/db4.html

"Description: Embedded database and hash file library
Source: http://www.sleepycat.com/

Berkeley DB is a programmatic toolkit that provides high-performance built-in database support for desktop and server applications and for information appliances.

The Berkeley DB access methods include B+tree, Extended Linear Hashing, Fixed and Variable-length records, and Queues. Berkeley DB provides full transactional support, database recovery, online backups, and separate access to locking, logging and shared memory caching subsystems."

Labels: , , , , , , , ,