_authorize('write', $parid, $sessid)) !== TRUE) return $res; return $this->bsCreateFolder($parid, $folderName); } /** * Store new file in the storage * * @param parid int, parent id * @param fileName string, name for new file * @param mediaFileLP string, local path of media file * @param mdataFileLP string, local path of metadata file * @param sessid string, session id * @param gunid string, global unique id OPTIONAL * @param ftype string, internal file type * @return int * @exception PEAR::error */ function putFile($parid, $fileName, $mediaFileLP, $mdataFileLP, $sessid='', $gunid=NULL, $ftype='audioclip') { if(($res = $this->_authorize('write', $parid, $sessid)) !== TRUE) return $res; return $this->bsPutFile( $parid, $fileName, $mediaFileLP, $mdataFileLP, $gunid, $ftype ); } /** * Analyze media file for internal metadata information * * @param id int, virt.file's local id * @param sessid string, session id * @return array */ function analyzeFile($id, $sessid='') { if(($res = $this->_authorize('read', $id, $sessid)) !== TRUE) return $res; return $this->bsAnalyzeFile($id); } /** * Rename file * * @param id int, virt.file's local id * @param newName string * @param sessid string, session id * @return boolean or PEAR::error */ function renameFile($id, $newName, $sessid='') { $parid = $this->getParent($id); if(($res = $this->_authorize('write', $parid, $sessid)) !== TRUE) return $res; return $this->bsRenameFile($id, $newName); } /** * Move file * * @param id int, virt.file's local id * @param did int, destination folder local id * @param sessid string, session id * @return boolean or PEAR::error */ function moveFile($id, $did, $sessid='') { if(($res = $this->_authorize( array('read', 'write'), array($id, $did), $sessid )) !== TRUE) return $res; return $this->bsMoveFile($id, $did); } /** * Copy file * * @param id int, virt.file's local id * @param did int, destination folder local id * @param sessid string, session id * @return boolean or PEAR::error */ function copyFile($id, $did, $sessid='') { if(($res = $this->_authorize( array('read', 'write'), array($id, $did), $sessid )) !== TRUE) return $res; return $this->bsCopyFile($id, $did); } /** * Delete file * * @param id int, virt.file's local id * @param sessid int * @return true or PEAR::error */ function deleteFile($id, $sessid='') { $parid = $this->getParent($id); if(($res = $this->_authorize('write', $parid, $sessid)) !== TRUE) return $res; return $this->bsDeleteFile($id); } /* ---------------------------------------------- replicas, versions etc. */ /** * Create replica.
* TODO: NOT FINISHED * * @param id int, virt.file's local id * @param did int, destination folder local id * @param replicaName string, name of new replica * @param sessid string, session id * @return int, local id of new object */ function createReplica($id, $did, $replicaName='', $sessid='') { if(($res = $this->_authorize( array('read', 'write'), array($id, $did), $sessid )) !== TRUE) return $res; return $this->bsCreateReplica($id, $did, $replicaName); } /** * Create version.
* TODO: NOT FINISHED * * @param id int, virt.file's local id * @param did int, destination folder local id * @param versionLabel string, name of new version * @param sessid string, session id * @return int, local id of new object */ function createVersion($id, $did, $versionLabel, $sessid='') { return $this->bsCreateVersion($id, $did, $versionLabel); } /* ------------------------------------------------------------- metadata */ /** * Replace metadata with new XML file or string * * @param id int, virt.file's local id * @param mdata string, XML string or local path of metadata XML file * @param mdataLoc string, metadata location: 'file'|'string' * @param sessid string, session id * @return boolean or PEAR::error */ function replaceMetadata($id, $mdata, $mdataLoc='file', $sessid='') { if(($res = $this->_authorize('write', $id, $sessid)) !== TRUE) return $res; return $this->bsReplaceMetadata($id, $mdata, $mdataLoc); } /** * Get metadata XML tree as string * * @param id int, virt.file's local id * @param sessid string, session id * @return string or PEAR::error */ function getMdata($id, $sessid='') { if(($res = $this->_authorize('read', $id, $sessid)) !== TRUE) return $res; return $this->bsGetMetadata($id); } /** * Get metadata element value * * @param id int, virt.file's local id * @param category string, metadata element name * @param sessid string, session id * @return array of matching records */ function getMdataValue($id, $category, $sessid='') { if(($res = $this->_authorize('read', $id, $sessid)) !== TRUE) return $res; return $this->bsGetMetadataValue($id, $category); } /** * Search in local metadata database. * * @param criteria hash, with following structure:
* * @param sessid string, session id * @return hash, field 'results' is an array with gunid strings * of files have been found * @see BasicStor::bsLocalSearch */ function localSearch($criteria, $sessid='') { $limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0); $offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0); return $this->bsLocalSearch($criteria, $limit, $offset); } /** * Return values of specified metadata category * * @param category string, metadata category name * with or without namespace prefix (dc:title, author) * @param criteria hash, see localSearch method * @param sessid string * @return hash, fields: * results : array with gunid strings * cnt : integer - number of matching values * @see BasicStor::bsBrowseCategory */ function browseCategory($category, $criteria, $sessid='') { $limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0); $offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0); $res = $this->bsBrowseCategory($category, $limit, $offset, $criteria); return $res; } /* ---------------------------------------------- methods for preferences */ /** * Read preference record by session id * * @param sessid string, session id * @param key string, preference key * @return string, preference value */ function loadPref($sessid, $key) { require_once '../../../storageServer/var/Prefs.php'; $pr =& new Prefs($this); $res = $pr->loadPref($sessid, $key); return $res; } /** * Save preference record by session id * * @param sessid string, session id * @param key string, preference key * @param value string, preference value * @return boolean */ function savePref($sessid, $key, $value) { require_once '../../../storageServer/var/Prefs.php'; $pr =& new Prefs($this); $res = $pr->savePref($sessid, $key, $value); return $res; } /** * Delete preference record by session id * * @param sessid string, session id * @param key string, preference key * @return boolean */ function delPref($sessid, $key) { require_once '../../../storageServer/var/Prefs.php'; $pr =& new Prefs($this); $res = $pr->delPref($sessid, $key); return $res; } /** * Read group preference record * * @param sessid string, session id * @param group string, group name * @param key string, preference key * @return string, preference value */ function loadGroupPref($sessid, $group, $key) { require_once '../../../storageServer/var/Prefs.php'; $pr =& new Prefs($this); $res = $pr->loadGroupPref($sessid, $group, $key); return $res; } /** * Save group preference record * * @param sessid string, session id * @param group string, group name * @param key string, preference key * @param value string, preference value * @return boolean */ function saveGroupPref($sessid, $group, $key, $value) { require_once '../../../storageServer/var/Prefs.php'; $pr =& new Prefs($this); $res = $pr->saveGroupPref($sessid, $group, $key, $value); return $res; } /** * Delete group preference record * * @param sessid string, session id * @param group string, group name * @param key string, preference key * @return boolean */ function delGroupPref($sessid, $group, $key) { require_once '../../../storageServer/var/Prefs.php'; $pr =& new Prefs($this); $res = $pr->delGroupPref($sessid, $group, $key); return $res; } /* --------------------------------------------------------- info methods */ /** * List files in folder * * @param id int, local id of folder * @param sessid string, session id * @return array */ function listFolder($id, $sessid='') { if(($res = $this->_authorize('read', $id, $sessid)) !== TRUE) return $res; $listArr = $this->bsListFolder($id); return $listArr; } /* ---------------------------------------------------- redefined methods */ /** * Get file's path in virtual filesystem * * @param id int * @return array */ function getPath($id) { $pa = parent::getPath($id, 'id, name, type'); array_shift($pa); return $pa; } /* ==================================================== "private" methods */ } ?>