A persistent Repository driver using Berkeley (BSD) database files
Requires pybsddb (http://pybsddb.sourceforge.net/bsddb3.html), which is
the standard bsddb module in Python 2.3 and up. However, even if you are
using Python 2.3 up, it is possible that you won't have a functioning
bsddb at all, or it may be wrapping the db185 Berkeley DB C libraries.
If necessary, update your C libs (db-4.3.27 preferred for compatibility with
Berkeley DB XML). And if possible, upgrade or install pybsddb (this is
mandatory on Python 2.2, if you want this driver to work).
You can determine your pbsddb3 version this way:
Type "help", "copyright", "credits" or "license" for more information.
>>> from bsddb3 import db
>>> db.version()
(4, 3, 27)
This driver can also store XML content in a heirarchy of Berkeley DB XML (2.0.9) Containers
see:
* http://www.sleepycat.com/xmldocs/gsg_xml/cxx/containers.html
* http://www.sleepycat.com/xmldocs/gsg_xml/cxx/xquery.html
* http://www.sleepycat.com/xmldocs/gsg_xml/cxx/examineresults.html
* http://www.sleepycat.com/xmldocs/gsg_xml/cxx/indices.html
Documents are stored as Whole Documents (not individual nodes) unless the
'OneMBDocuments' driver property is set to true (it's false by default).
When the 'DbXml' driver property is 'true', the following containers are setup
XML Databases (containers which key resources by their reposository paths)):
- ftss_metadata_xml.dbxml ('path' --> content) Metadata Documents
- ftss_repo_xml.dbxml ('path' --> content) Repsitory XML Documents
- ftss_user_all.dbxml ('path' --> content) User, non-repository Documents
o used when 'DataStoreContainers' driver property is 'false' (by default)
Repository Documents are:
Servers,Users,Groups,Containers,Document Definitions, RDF Documents,Commands, and Aliases
Non-XML content is stored in the following databases
nonXML Databases (Berkeley DB databases keyed by their repository paths):
- ftss_content.db ('path' --> content)
o stores XML content here as well when 'DbXml' driver property is 'false' (default)
- ftss_cache.db ('path --> cache)
- ftss_session.db ('path' --> session)
- ftss_types.db ('path' -> ResourceType) (an index of resource types)
- ftss_metadata_strings.db ('path' --> metadata document string)
o used when 'DbXml' driver property is 'false' (default)
Copyright 2005 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRIGHT
Project home, documentation, distributions: http://4suite.org/
|
|
|
|
|
|
|
|
CACHE_DB_NAME, CONTENT_DB_NAME, DATABASE_DIR, DBXML_FETCH_FTSS_CONTAINERS_XQUERY, FILE_RESOURCE_CLASS, FTSERVER_NAMESPACE, FTSS_CONTAIMENT_DB_NAME, MD_STRINGS_DB_NAME, MD_XML_CONTENT_DB_NAME, METADATA_DOCUMENT_RESOURCE_CLASS, NAME, NonvalidatingReader, REPOSITORY_DOCUMENTS_DB_NAME, REPOSITORY_DOCUMENT_RESOURCE_CLASS, REPO_DOCUMENTS, RESOURCE_TYPE_DB_NAME, SESSION_DB_NAME, SYSTEM_MODEL_NAME, USER_DOCUMENT_RESOURCE_CLASS, USER_MODEL_NAME, USER_XML_CONTENT_DB_NAME, VERSION, XML_INDICES, XmlDbNames, g_rdfResourceTypes, g_resourceTypeFromRdf, nonXmlDbNames
|
Classes
- class BerkeleyDBDriver(Ft.Server.Server.Drivers.BerkeleyDB.BerkeleyDBContainer.BerkeleyDBContainer)
-
Store information in an RDF and Berleley DB (XML)? store
Methods
- __init__(self, properties)
- Overrides: __init__ from class BerkeleyDBContainer
- commit(self)
- createFile(self, path, typ, 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)
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
- Destroy(properties, tryOnly=0)
-
Completly destroy the repo
- Exists(properties)
-
See if this repo exists. The return value for this is three state.
1. Everything is present
0. Some things are there
-1 Nothing is there.
- GetContainer(name, root, environment, txn=None)
- GetDB(name, environment, txn=None)
- 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.
- LocateContent(path, typ, typeDB)
-
0 - NonXmlContent
1 - Non-repository Document
2 - Repository Document (not Metadata)
3 - Metadata
4 - Cache
5 - Session
- Maintain(properties)
-
Perform any maintenance on the db
or periodic actions (inference, integrity check..?!)
- createDbXmlContainerPath(path)
-
Influenced by the old Ft.Server.Server.Drivers.FlatFile.createFlatFilePath
Takes a repository path and creates a name for the corresponding Bdb Xml container. XQuery can be used to search
within non-repository XML documents in containers using the name mapped by this mechanism
Drivers setup with DataStoreContainer = 'true' (currently disabled) make use of this to map repository container paths to
a Filesystem path (relative to the driver root) of a corresponding Berkeley DB XML container
FIXME: DB_RUNRECOVERY (PANIC: No such file or directory) is raised when DataStoreContainer is set to true
Globals
- CACHE_DB_NAME = 'ftss_cache.db'
- CONTENT_DB_NAME = 'ftss_content.db'
- DATABASE_DIR = '/var/lib/4Suite/BsdDb'
- DBXML_FETCH_FTSS_CONTAINERS_XQUERY = "declare namespace ftss = 'http://xmlns.4suite.or...] return dbxml:metadata('dbxml:name', $container)"
- FILE_RESOURCE_CLASS = 0
- FTSERVER_NAMESPACE = 'http://xmlns.4suite.org/reserved'
- FTSS_CONTAIMENT_DB_NAME = 'ftss_containment.db'
- MD_STRINGS_DB_NAME = 'ftss_metadata_strings.db'
- MD_XML_CONTENT_DB_NAME = 'ftss_metdata_xml.dbxml'
- METADATA_DOCUMENT_RESOURCE_CLASS = 3
- NAME = 'BerkeleyDB'
- NonvalidatingReader = <Ft.Xml.Domlette.NonvalidatingReaderBase instance>
-
The default non-validating reader instance, created from
NonvalidatingReaderBase() with no constructor arguments.
Uses the default InputSource factory. If you need to change it,
reassign the inputSourceFactory attribute, or, preferably, just
create a new NonvalidatingReaderBase instance.
- REPOSITORY_DOCUMENTS_DB_NAME = 'ftss_repo_xml.dbxml'
- REPOSITORY_DOCUMENT_RESOURCE_CLASS = 2
- REPO_DOCUMENTS = [1, 2, 7, 8, 9, 14, 15, 5, 11, 12]
- RESOURCE_TYPE_DB_NAME = 'ftss_types.db'
- SESSION_DB_NAME = 'ftss_session.db'
- SYSTEM_MODEL_NAME = 'ftss_system.db'
- USER_DOCUMENT_RESOURCE_CLASS = 1
- USER_MODEL_NAME = 'ftss_user.db'
- USER_XML_CONTENT_DB_NAME = 'ftss_user_all.dbxml'
- VERSION = '0.1'
- XML_INDICES = True
- XmlDbNames = ['ftss_metdata_xml.dbxml', 'ftss_repo_xml.dbxml']
- g_rdfResourceTypes = {1: 'http://schemas.4suite.org/4ss#container', 2: 'http://schemas.4suite.org/4ss#alias', 3: 'http://schemas.4suite.org/4ss#rawfile', 4: 'http://schemas.4suite.org/4ss#xmldocument', 5: 'http://schemas.4suite.org/4ss#xsltdocument', 6: 'http://schemas.4suite.org/4ss#schematrondocument', 7: 'http://schemas.4suite.org/4ss#user', 8: 'http://schemas.4suite.org/4ss#group', 9: 'http://schemas.4suite.org/4ss#xpathdocumentdefinition', 11: 'http://schemas.4suite.org/4ss#xsltdocumentdefinition', ...}
- g_resourceTypeFromRdf = {'http://schemas.4suite.org/4ss#alias': 2, 'http://schemas.4suite.org/4ss#command': 14, 'http://schemas.4suite.org/4ss#container': 1, 'http://schemas.4suite.org/4ss#documentdefinition': 13, 'http://schemas.4suite.org/4ss#group': 8, 'http://schemas.4suite.org/4ss#meta_data': 16, 'http://schemas.4suite.org/4ss#rawfile': 3, 'http://schemas.4suite.org/4ss#rdfdocument': 12, 'http://schemas.4suite.org/4ss#schematrondocument': 6, 'http://schemas.4suite.org/4ss#server': 15, ...}
- nonXmlDbNames = ['ftss_session.db', 'ftss_cache.db', 'ftss_content.db', 'ftss_types.db', 'ftss_containment.db']