faultCode 804 faultString "); ini_set("error_append_string", " "); header("Content-type: text/xml"); /* ================================================================= includes */ require_once 'DB.php'; require_once "../../../storageServer/var/xmlrpc/XML/RPC/Server.php"; require_once '../conf.php'; require_once 'XR_Archive.php'; /* ============================================ setting default error handler */ function errHndl($errno, $errmsg, $filename, $linenum, $vars){ if($errno == 8 /*E_NOTICE*/) return; $xr =& new XML_RPC_Response(0, 805, "ERROR:xrLocStor: $errno $errmsg ($filename:$linenum)"); header("Content-type: text/xml"); echo $xr->serialize(); exit($errno); } $old_error_handler = set_error_handler("errHndl"); /* ============================================================= runable code */ PEAR::setErrorHandling(PEAR_ERROR_RETURN); $dbc = DB::connect($config['dsn'], TRUE); $dbc->setFetchMode(DB_FETCHMODE_ASSOC); $archive = &new XR_Archive($dbc, $config); $methods = array( 'test' => 'Tests toupper and checks sessid, params: '. 'teststring, sessid.', 'authenticate' => 'Checks authentication.', 'login' => 'Login to storage.', 'logout' => 'Logout from storage.', 'existsAudioClip' => 'Checks if an Audio clip with the specified '. 'id is stored in local storage.', 'storeAudioClipOpen' => 'Open channel for store a new audio clip '. 'or replace an existing one.', 'storeAudioClipClose' => 'Close channel for store a new audio clip'. ' or replace an existing one.', 'downloadRawAudioDataOpen'=> 'Create and return downloadable URL'. 'for audio file', 'downloadRawAudioDataClose'=>'Discard downloadable URL for audio file', 'downloadMetadataOpen' => 'Create and return downloadable URL'. 'for metadata', 'downloadMetadataClose' => 'Discard downloadable URL for metadata', 'openPut' => 'openPut', 'closePut' => 'closePut', 'deleteAudioClip' => 'Delete an existing Audio clip.', 'updateAudioClipMetadata' => 'Update the metadata of an Audio clip '. 'stored in Local storage.', 'searchMetadata' => 'Search through the metadata of stored '. 'AudioClips, return all matching clip ids.', 'accessRawAudioData' => 'Get access to raw audio data.', 'releaseRawAudioData' => 'Release access to raw audio data.', 'getAudioClip' => 'Return the contents of an Audio clip.', 'resetStorage' => 'Reset storageServer for debugging.', 'createPlaylist' => 'Create a new Playlist metafile.', 'editPlaylist' => 'Open a Playlist metafile for editing.', 'savePlaylist' => 'Save a Playlist metafile.', 'deletePlaylist' => 'Delete a Playlist metafile.', 'accessPlaylist' => 'Open readable URL to a Playlist metafile.', 'releasePlaylist' => 'Release readable URL from accessPlaylist.', 'existsPlaylist' => 'Check whether a Playlist exists.', 'playlistIsAvailable' => 'Check whether a Playlist is available '. 'for editing.', 'uploadCheck' => 'Check the checksum of uploaded file', 'ping' => 'Echo request', ); $defs = array(); foreach($methods as $method=>$description){ $defs["archive.$method"] = array( # "function" => array(&$archive, "xr_$method"), "function" => "\$GLOBALS['archive']->xr_$method", "signature" => array( array($GLOBALS['XML_RPC_Struct'], $GLOBALS['XML_RPC_Struct']) ), "docstring" => $description ); } $s = &new XML_RPC_Server( $defs ); ?>