4Suite API Documentation

Module Ft.Server.Server.SCore.ResourceMetaDataImp

ResourceMetaData repository resource class.
Copyright 2005 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRIGHT
Project home, documentation, distributions: http://4suite.org/


class ResourceMetaDataImp
Every repository resource inherits from this class in order to store and provide access to information about its existence.


__init__(self, path, driver, cache)
Construct a new resource metadata object. This is almost always done through _fetchResource().
 path is a reference to a PathImp that is the location of
   this resource in the in the repository.
 driver is an instance of FtssDriver that represents the
   connection to the actual on disk repository for use by
   the resource.
 cache is a reference to an ObjectCache instance that is a
   per-transaction cache of objects fetched within this
########################################## #String interfaces ##########################################
addAcl(self, aclKey, aclIdent, allowed=1)
Add an acl identifier to the acl key. If the specified key does not exist on the resource this function has the same functionality of setAcl.
addAlias(self, path, docDef=None)
Adds an alias for this resource to the repository. path is the string path of the new alias. docDef is the document definition to associate with the new alias.
addLiteralProperty(self, predicate, object, scope='', statementUri='')
Adds a statement about this repository object, with a literal property, to the model
addResourceProperty(self, predicate, object, scope='', statementUri='')
Adds a statement about this repository object, with a resource property, to the model
applyXslt(self, chain, params=None, ignorePis=1, extParams=None, extModules=None, imtParams=False)
applies the specified chain of stylesheets (with the specified transformation parameters) using the "self" object as source chain - can be a list of transforms, in which case only one transform run will execute, with the list of transforms all used such that [a.xsl, b.xsl] is equivalent to adding an import of b.xsl to a.xsl and applying a.xsl can also be a list of lists of transforms, in which case a chain of transforms is run, one pass for each inner list. The output of each step in the chain is fed as the input to the next params - a dictionary giving the overridden top-level parameters for the transforms ignorePis - whether or not to ignore <xml-stylesheet processing instructions in the source document extParams - a special dictionary of parameters that allows the processor to communicate special values back to the caller extModules - a list of modules containing extension function and element implementations
asDom(self, stripElements=None)
Return the content of this object as a non-live DOM instance. This means that any mutations to the returned DOM object will not affect the content of this resource. An exception will be raised if the content cannot be parsed as XML.
Delete this object from the repository.
fetchResource(self, path, traverseAliases=None)
Fetch a resource from the system. path is a string. The traverseAliases parameter is deprecated and the new ";traverse" path arguments should be used. As an example, where before you could call: resource.fetchResource('path',1) now you would call resource.fetchResource('path;traverse')
Get the full path into the system, as a string.
Get the full path into the system, as an absolute URI string.
getAcl(self, aclKey=None)
Get a list of users and groups specified by the aclKey. If an aclKey is specified, then the results will be a list of dictionaries keyed by acl identifiers and with values of ALLOWED or DISALLOWED (from AclConstants). The values in the list of dictionaries could be inherited from the parent object. If no aclKey is specified, then the results will be a nested dictionary. The outer dictionary is keyed by all of the defined acl keys on this resource. Each value of the outer dictionary will be a dictionary identical to when this method is called with a aclKey. These results will not return any inherited values.
Get the ACL identifier for the current user (without expansion).
Get a list of all acl identifiers for the current users. This is equivalent to performing an "expandGroups" of the current user. It will also add things such as "WORLD-GROUP" or "USER-GROUP" if they exist.
Get a list of alias objects that reference this object
Get the base path of this object, as a Path instance. The only difference between this and getPath is that for all non-container objects it will return the parent's path. For a container object it will return its path.
Get the string content of this resource
Get the resource that represents the content of this object
getContentSlice(self, start=None, end=None)
Get a piece of our content. Really only makes sense for large raw files
Get the date that this resource was created. The date will be an ISO 8601 string like u'2002-08-16T22:49:56Z'.
Get the path relative to the document root, as a string.
All resource get to use the builtin functions. XsltDocuments override this to load the information from any associated document definitions.
Returns the Internet Media Type of the raw file resource
Get the date that this resource was last modified. The date will be an ISO 8601 string like u'2002-08-16T22:49:56Z'.
Get the string meta data of this resource
Retrieves the common model associated w/ the repository
Get the name of the resource, as a string.
Get the owner of this resource.
Get the parent container of this resource
Get the path of this resource, as a Path instance.
Get the type of this resource. Types are defined in Ft.Server.Common.ResourceTypes.ResourceType.
Get a reference to the system repository
Get the size of the content, in bytes, as an integer.
Returns all statements about this object in the model
Returns all statements in the model generated by this object
Get the validation information associated with this resource.
hasResource(self, path)
Query if the system has a resource specified by the path. No exception will be raised by this function. If the current user cannot access the resource or the resource does not exist in the repository, then the results will be 0. If the resource does exist, then the results will be the integer resource type of the resource (see Ft.Server.Common.ResourceTypes.ResourceTypes).
inheritAcl(self, aclKey)
Remove the entire key from the ACL entry so that it is inherited again from its parent
isResourceType(self, testType)
Determine if this resource is of a certain type
markTemporary(self, timeToLive)
Mark this resource as temporary. Temporary objects will be removed from the repository when their timeToLive has expired and purgeTemporaryResources() is called on the repository. Time to live is seconds from now. purgeTemporaryResources() is most often called from the controller and is based on the controller configuration option TemporaryReapInterval.
removeAcl(self, aclKey, aclIdent)
Remove the acl identifier from the acl key. If the specified aclKey is not present on the resource or the specified aclIdent is not in the key, then do nothing. Remember that entries inherited from the parent are *not* included in the acl on the actual resurce. In order to override inherited permissions, set to no access rather than trying to remove.
removeAlias(self, path)
Removes the specified alias for this resource.
removeLiteralProperty(self, predicate, object)
Removes a statement about this repository object, with a literal property, from the model
removeResourceProperty(self, predicate, object)
Remove a statement about this repository object, with a resource preoperty, from the model
setAcl(self, aclKey, aclIdent, allowed=1)
Replace the aclKey with a single entry of aclIdent.
setContent(self, src)
Set the string content of this resource.
setOwner(self, newOwner)
Change the owner of this resource.
toXPathContext(self, nss=None)
Create an XPath Context with the src of this RawFile. nss is a dictionary of namespace definitions to include in the context.
verifyAcl(self, aclKey, verifyTraverse=1)
Test to see whether the current user (and the current users set of acl identifiers) is allowed to perform the specified action, aclKey, on the current object. If verifyTraverse is specified, then execute premissions are tested on all of the parents of this resource as well.
xUpdate(self, updateSrc)
Allows XML content to be updated with the XUpdate protocol. updateSrc is a string that represents the XUpdate to be applied to the resource. extraNss is a dict of additional namespace bindings to pass to the XUpdate processor, if necessary.


resourceType = 16


FTSERVER_NAMESPACE = 'http://xmlns.4suite.org/reserved'
RESERVED_NAMESPACE = 'http://xmlns.4suite.org/reserved'
SET_OWNER_XUPDATE = '<xupdate:modifications\n version="1.0"\n xmlns:x...ner">%s</xupdate:update>\n</xupdate:modifications>'
SET_TIME_TO_LIVE_XUPDATE = '<?xml version="1.0"?>\n<xupdate:modifications\n v...oLive></xupdate:append>\n</xupdate:modifications>\n'
UPDATE_TIME_TO_LIVE_XUPDATE = '<?xml version="1.0"?>\n<xupdate:modifications\n v...ve">%s</xupdate:update>\n</xupdate:modifications>\n'
XLINK_NAMESPACE = u'http://www.w3.org/1999/xlink'