예제 #1
0
 /**
  * @param $json     text content of asset data file
  */
 private function reload($json)
 {
     $ss = new SchemaService();
     try {
         $resp = $ss->isValid($json);
         if (is_array($resp)) {
             $data = Util::decode_json($json);
             static::$logger->error(__CLASS__ . '::' . __FUNCTION__ . ': schema in use: ' . $data->mimeType);
             foreach ($resp as $k => $v) {
                 foreach ($v as $item => $line) {
                     static::$logger->error(__CLASS__ . '::' . __FUNCTION__ . ': data not validated: ' . $k . ': ' . $item . ' => ' . $line);
                 }
             }
             throw new ReposeJsonInstantiationError(json_last_error_msg());
         } else {
             $data = Util::decode_json($json);
             $this->loadData($data);
             static::$logger->addInfo(__CLASS__ . '::' . __FUNCTION__ . ': loaded json data');
         }
     } catch (ReposeJsonInstantiationError $e) {
         static::$logger->addAlert(__CLASS__ . '::' . __FUNCTION__ . ': Failed to validate sidecar file: ' . $e->getMessage());
     }
 }
예제 #2
0
 private function test_sidecar($sidecar)
 {
     $service = new SchemaService();
     if ($ret = $service->isValid($sidecar)) {
         $this->scanlog->info('Sidecar file is valid');
     } else {
         foreach ($ret as $e) {
             $this->scanlog->error($e['property'] . ': ' . $e['message']);
         }
     }
 }