4Suite API Documentation

Module Ft.Server.Server.Drivers.FlatFile

4Suite repository low-level driver for ordinary file system storage

Copyright 2004 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRIGHT
Project home, documentation, distributions: http://4suite.org/
Classes:
Functions:
Fields:

Classes

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)
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 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 FlatFileDriver(FlatFileContainer)
The FlatFile Driver will store information in a directory tree. This driver will not support any locking or concurrency. See ConcurrentFlatFileDriver for information on that.

    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.

    In the root, it will also create a file called system-rdf which is the
    RDF of the system using the Dbm driver of 4RDF.
from Ft.Server.Server.Drivers.FlatFile import
    Also in the Root will be a file called user.rdf which is a second RDF
    Model with user information.

Methods

__init__(self, root)
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)
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.
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.

Fields

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