4Suite API Documentation

Module Ft.Server.Server.Drivers.RdflibFS

4Suite repository low-level driver for rdlib and ordinary file system storage
Copyright 2005 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRIGHT
Project home, documentation, distributions: http://4suite.org/
Classes:
Functions:
Globals:

Classes

class FlatFileContainer(Ft.Server.Server.Drivers.FtssDriver.DataStoreContainer)
Implements repository containers as directories on the underlying file system. Overides _createContainer to attempt an os.mkdir on the filesystem

Methods

__init__(self, db)
Used if instanciated directly in order to do initialization
deleteContainer(self, path)
Overrides: deleteContainer from class DataStoreContainer
fetchChildren(self, parent)
Returns a list of child uris for the given parent. Parent is a PathImp Needs to hit the file system to do a directory listing of the parent PathImp as a file system path
initialize(self)
Initialize the table
manageChildren(self, parent, child, add=True)
Adds/remove the child specified by the given path to the parent (parent - a PathImp) Needs to add/remove children from _children (so they are accounted for if accessed within the same transaction)

Methods inherited from class Ft.Server.Server.Drivers.FtssDriver.DataStoreContainer

class RdflibFileSystem(FlatFileContainer)
This driver stores repository content in a directory tree and persists a system and user Model as Rdflib RDF Graphs. This driver essentialy extends the FlatFile repository driver with support for Rdflib persistence
To store information, the flat file driver will create two directories
in its root directory.  The first will be called 'metadata' and under
it will be a picture of the metadata in the tree.  The second will be
called content and will contain the content of the tree.

The system model is pesisted as an Rdflib Graph with identifier : system-rdf
The user model is pesisted as an Rdflib Graph with identifier : user-rdf    

An Rdflib store connection string is used to specify the persistence mechanism

Methods

__init__(self, root, rdflibConnection, store)
Overrides: __init__ from class FlatFileContainer
commit(self)
Make it so!
createFile(self, path, typ, content)
When creating a resource, store the content.
deleteFile(self, path, typ)
Delete an object
fetchFile(self, path, typ)
getSystemModel(self)
getUserModel(self)
hasFile(self, path, typ)
See if we have any meta information about this resource
rollback(self)
Undo it
updateFile(self, path, typ, content)
Update only the content about this resource

Methods inherited from class FlatFileContainer

Methods inherited from class Ft.Server.Server.Drivers.FtssDriver.DataStoreContainer

Functions

Begin(**properties)
Begin a new transaction. Every driver must support this interface. The properties keyword arguments are passed from the config file (or where ever) to the driver. The Begin file is responsible for doing what ever is needed to validate these arguements
CONTENT_PATH = createFlatFilePath(root, path, t)
Given the absolute path of a directory on the file system to use as the root container of the repository, plus a repo path and a resource type, returns a file system path corresponding to the given repo path and type.
Destroy(properties, tryOnly=0)
Completly destroy the repo
Exists(properties)
See if this repo exists. The return value for this is three states: 1. Everything is present 0. Some things are there -1 Nothing is there.
GetLock(fName, typ)
Initialize(properties)
Initialize a new copy of the repo. This is not the same as a '4ss_manager init'. This is very raw. The adapter will take care of calling our other interfaces (createContainer, createUser, etc) with all of the information about the rest of the 'init' stuff to do.
InitializeModule()
Post-import hook to initialize module's runtime variables that are not required at import time, but will be needed before the module-level functions are called.
Maintain(properties)
Perform any maintenance on the db
createFlatFilePath(root, path, t)
Given the absolute path of a directory on the file system to use as the root container of the repository, plus a repo path and a resource type, returns a file system path corresponding to the given repo path and type.

Globals

FTSERVER_NAMESPACE = 'http://xmlns.4suite.org/reserved'
NAME = 'RdflibFS'
SYSTEM_RDF_GRAPH = 'system-rdf'
USER_RDF_GRAPH = 'user-rdf'
XLINK_NAMESPACE = u'http://www.w3.org/1999/xlink'
g_fileLocks = {}
g_typeDirs = {1: 'metadata', 2: 'content', 3: 'cache', 4: 'sessions'}