public function switchActions($actionName, $httpVars, $fileVars)
 {
     //$urlBase = $this->accessDriver
     $repository = $this->accessDriver->repository;
     if (!$repository->detectStreamWrapper(true)) {
         return false;
     }
     $streamData = $repository->streamData;
     $this->streamData = $streamData;
     $destStreamURL = $streamData["protocol"] . "://" . $repository->getId();
     $selection = new UserSelection($repository, $httpVars);
     switch ($actionName) {
         case "filehasher_signature":
             $file = $selection->getUniqueFile();
             if (!file_exists($destStreamURL . $file)) {
                 break;
             }
             $cacheItem = AJXP_Cache::getItem("signatures", $destStreamURL . $file, array($this, "generateSignature"));
             $data = $cacheItem->getData();
             header("Content-Type:application/octet-stream");
             header("Content-Length", strlen($data));
             echo $data;
             break;
         case "filehasher_delta":
         case "filehasher_patch":
             // HANDLE UPLOAD DATA
             $this->logDebug("Received signature file, should compute delta now");
             if (!isset($fileVars) && !is_array($fileVars["userfile_0"])) {
                 throw new Exception("These action should find uploaded data");
             }
             $uploadedData = tempnam(AJXP_Utils::getAjxpTmpDir(), $actionName . "-sig");
             move_uploaded_file($fileVars["userfile_0"]["tmp_name"], $uploadedData);
             $fileUrl = $destStreamURL . $selection->getUniqueFile();
             $file = call_user_func(array($this->streamData["classname"], "getRealFSReference"), $fileUrl, true);
             if ($actionName == "filehasher_delta") {
                 $signatureFile = $uploadedData;
                 $deltaFile = tempnam(AJXP_Utils::getAjxpTmpDir(), $actionName . "-delta");
                 $this->logDebug("Received signature file, should compute delta now");
                 rsync_generate_delta($signatureFile, $file, $deltaFile);
                 $this->logDebug("Computed delta file, size is " . filesize($deltaFile));
                 header("Content-Type:application/octet-stream");
                 header("Content-Length:" . filesize($deltaFile));
                 readfile($deltaFile);
                 unlink($signatureFile);
                 unlink($deltaFile);
             } else {
                 $patched = $file . ".rdiff_patched";
                 $deltaFile = $uploadedData;
                 rsync_patch_file($file, $deltaFile, $patched);
                 rename($patched, $file);
                 unlink($deltaFile);
                 $node = $selection->getUniqueNode($this->accessDriver);
                 AJXP_Controller::applyHook("node.change", array($node, $node, false));
                 header("Content-Type:text/plain");
                 echo md5_file($file);
             }
             break;
         case "stat_hash":
             $selection = new UserSelection();
             $selection->initFromArray($httpVars);
             clearstatcache();
             header("Content-type:application/json");
             if ($selection->isUnique()) {
                 $node = $selection->getUniqueNode($this->accessDriver);
                 $stat = @stat($node->getUrl());
                 if (!$stat) {
                     print '{}';
                 } else {
                     if ($node->isLeaf()) {
                         if (isset($_SERVER["HTTP_RANGE"])) {
                             $fullSize = floatval($stat['size']);
                             $ranges = explode('=', $_SERVER["HTTP_RANGE"]);
                             $offsets = explode('-', $ranges[1]);
                             $offset = floatval($offsets[0]);
                             $length = floatval($offsets[1]) - $offset;
                             if (!$length) {
                                 $length = $fullSize - $offset;
                             }
                             if ($length + $offset > $fullSize || $length < 0) {
                                 $length = $fullSize - $offset;
                             }
                             $hash = $this->getPartialHash($node, $offset, $length);
                         } else {
                             $hash = $this->getFileHash($selection->getUniqueNode($this->accessDriver));
                         }
                     } else {
                         $hash = 'directory';
                     }
                     $stat[13] = $stat["hash"] = $hash;
                     print json_encode($stat);
                 }
             } else {
                 $files = $selection->getFiles();
                 print '{';
                 foreach ($files as $index => $path) {
                     $node = new AJXP_Node($destStreamURL . $path);
                     $stat = @stat($destStreamURL . $path);
                     if (!$stat) {
                         $stat = '{}';
                     } else {
                         if (!is_dir($node->getUrl())) {
                             $hash = $this->getFileHash($node);
                         } else {
                             $hash = 'directory';
                         }
                         $stat[13] = $stat["hash"] = $hash;
                         $stat = json_encode($stat);
                     }
                     print json_encode($path) . ':' . $stat . ($index < count($files) - 1 ? "," : "");
                 }
                 print '}';
             }
             break;
             break;
     }
 }