public static function getContentByUrn($urn, $pharPath = null)
 {
     if ($pharPath) {
         return TarParser::getContent($urn, $pharPath);
     }
     return file_get_contents($urn);
 }
 public function register()
 {
     $callback = function ($node) {
         if (FileInfo::TYPE_FILE === $node->getType()) {
             $type = $this->getType($node);
             if ($type === SML) {
                 $this->sensorMLHook->onUpdateOrCreate($node->getId(), $node->getContent());
             } else {
                 if ($type === OM) {
                     $this->omHook->onUpdateOrCreate($node->getId(), $node->getContent());
                 } else {
                     if (FileUtil::endsWith($node->getName(), TAR)) {
                         $tarContent = TarParser::parse(FileCacheDao::getFullUrl($node->getId()));
                         foreach ($tarContent as $item) {
                             $path = $item['path'];
                             if ($item['file']) {
                                 if (FileUtil::endsWith($path, 'xml')) {
                                     $data = file_get_contents($path);
                                     $xml = new \SimpleXMLElement($data);
                                     if (OMParser::accept($xml)) {
                                         $this->omHook->onUpdateOrCreate($node->getId(), $data, $item['pharPath']);
                                     } else {
                                         if (SensorMLParser::accept($xml)) {
                                             $this->sensorMLHook->onUpdateOrCreate($node->getId(), $data, $item['pharPath']);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     };
     //Create or update
     $this->fileSystemManager->listen('\\OC\\Files', 'postCreate', $callback);
     $this->fileSystemManager->listen('\\OC\\Files', 'postWrite', $callback);
     //deletion
     $this->fileSystemManager->listen('\\OC\\Files', 'preDelete', function ($node) {
         if (FileInfo::TYPE_FILE === $node->getType()) {
             $type = $this->getType($node);
             if ($type === SML) {
                 $this->sensorMLHook->onDelete($node);
             } else {
                 if ($type === OM) {
                     $this->omHook->onDelete($node);
                 } else {
                     if (FileUtil::endsWith($node->getName(), TAR)) {
                         $this->sensorMLHook->onDelete($node);
                     }
                 }
             }
         }
     });
     //Si la version d'owncloud est suffisante chargement uniquement dans les cas nécessaires
     if (method_exists(\OC::$server, 'getEventDispatcher')) {
         $eventDispatcher = \OC::$server->getEventDispatcher();
         $eventDispatcher->addListener('OCA\\Files::loadAdditionalScripts', ['OCA\\SnannyOwncloudApi\\Hooks\\FileHook', "onLoadFilesAppScripts"]);
     } else {
         //Sinon chargement indifférent du script js
         onLoadFilesAppScripts();
     }
 }