diff --git a/php/RemoteDataCenter/Bases.xml b/php/RemoteDataCenter/Bases.xml index b329d97..7afd712 100644 --- a/php/RemoteDataCenter/Bases.xml +++ b/php/RemoteDataCenter/Bases.xml @@ -7,6 +7,7 @@ + diff --git a/php/RemoteDataCenter/SPEASYClientClass.php b/php/RemoteDataCenter/SPEASYClientClass.php new file mode 100644 index 0000000..2d9eafa --- /dev/null +++ b/php/RemoteDataCenter/SPEASYClientClass.php @@ -0,0 +1,76 @@ +baseID."/base.xml")) { + echo '[ERROR] Cannot retrieve Speasy base definition for '.$this->baseID.PHP_EOL; + return FALSE; + } + return TRUE; + } + + // make components description from base.xml + public function makeCenterNode($xmlDom) + { + $dom = new DOMDocument('1.0', 'utf-8'); + $dom->formatOutput = TRUE; + $dom->preserveWhiteSpace = FALSE; + + $node = NULL; + if ($dom->load(SpeasyProxyData.$this->baseID."/base.xml")) { + $nodeBase = $dom->getElementsByTagName('dataCenter')->item(0); + $node = $xmlDom->importNode($nodeBase, true); + } + + return $node; + } + + public function makeAllParams() + { + $dom = new DOMDocument('1.0', 'utf-8'); + $dom->formatOutput = TRUE; + $dom->preserveWhiteSpace = FALSE; + + $node = NULL; + if ($dom->load(SpeasyProxyData.$this->baseID."/base.xml")) { + $xpath = new DOMXPath($dom); + $params = $xpath->query("//parameter"); + + foreach ($params as $param) + { + $paramId = $param->getAttribute('xml:id'); + if (is_file(SpeasyProxyData.$this->baseID."/PARAMS/".$paramId.".xml")) { + if (!is_link(PARAMS_LOCALDB_DIR.$paramId.".xml")) { + if (!symlink(SpeasyProxyData.$this->baseID."/PARAMS/".$paramId.".xml", PARAMS_LOCALDB_DIR.$paramId.".xml")) { + echo "[ERROR] Cannot create symbolic link for ".$paramId.PHP_EOL; + } + } + } + else { + echo "[ERROR] Missing speasy parameter file for ".$paramId.PHP_EOL; + } + } + } + } + + +} +?> diff --git a/php/RemoteDataCenter/SPEASY_cda.php b/php/RemoteDataCenter/SPEASY_cda.php new file mode 100644 index 0000000..fb28fd9 --- /dev/null +++ b/php/RemoteDataCenter/SPEASY_cda.php @@ -0,0 +1,16 @@ +baseID = get_class($this); + } + + +} +?> diff --git a/php/RemoteDataCenter/makeSpeasyProxy.php b/php/RemoteDataCenter/makeSpeasyProxy.php new file mode 100644 index 0000000..7106c96 --- /dev/null +++ b/php/RemoteDataCenter/makeSpeasyProxy.php @@ -0,0 +1,45 @@ +load($BasesXml); + + $bases = $basesDom->getElementsByTagName("dataCenter"); + + foreach ($bases as $base) + { + echo $base->getAttribute('xml:id').PHP_EOL; + if ($base->hasAttribute('isSpeasyProxy')) + { + $class = $base->getAttribute('xml:id'); + echo PHP_EOL.$class.PHP_EOL; + $center = new $class(); + + if ($center->monitor()) + { + $center->makeAllParams(); + } + else + { + echo "[ERROR] $class service is not available".PHP_EOL; + } + } + } +?> \ No newline at end of file diff --git a/php/classes/AmdaAction.php b/php/classes/AmdaAction.php index 15c805e..bab68f6 100644 --- a/php/classes/AmdaAction.php +++ b/php/classes/AmdaAction.php @@ -522,7 +522,7 @@ class AmdaAction if ($isParameter) { - $disable = $child->parentNode->getAttribute('disabled'); + $disable = $child->parentNode->getAttribute('disabled') || $child->getAttribute('error'); $objectMgr = new AliasMgr(); $alias = $objectMgr->getAlias($id); @@ -531,6 +531,11 @@ class AmdaAction $needsArgs = true; $isSpectra = true; } + + if ($child->getAttribute('error')) { + $info .= "
".$child->getAttribute('error').""; + } + if ($globalStart) $childrenToReturn[] = array('text' => $name,'alias' => $alias, 'id' => $id,'nodeType' => $nodeType, 'info' => $info, 'help' => $help, 'globalStart' => $globalStart, @@ -548,16 +553,21 @@ class AmdaAction if ($child->tagName == 'dataset') { - $nonavailable = ($child->getAttribute('disabled')); + $nonavailable = ($child->getAttribute('disabled') || $child->getAttribute('error')); } else { $nonavailable = false; } + + if ($nonavailable) $info .= "
Not available yet"; + if ($child->getAttribute('error')) + $info .= "
".$child->getAttribute('error').""; + if ($child->getAttribute('url')) $info .= "
".$child->getAttribute('url'); diff --git a/update_amda/makeRemote b/update_amda/makeRemote index dcb5818..41024b4 100755 --- a/update_amda/makeRemote +++ b/update_amda/makeRemote @@ -23,6 +23,9 @@ # make Proxies for 'isSimulation' dataCenters from Bases.xml php $AMDA_IHM/php/RemoteDataCenter/makeProxy.php + + # make Proxies for 'isSpeasyProxy' dataCenters from Bases.xml + php $AMDA_IHM/php/RemoteDataCenter/makeSpeasyProxy.php # make [TARGET].json php $AMDA_IHM/php/RemoteDataCenter/makeOrbitsArgs.php @@ -61,8 +64,10 @@ xml=`basename $param_def` if [ ! -f "$PARAMS_LOCALDB_DIR/$xml" ]; then #cp $param_def $PARAMS_LOCALDB_DIR/ - ln -s $param_def $PARAMS_LOCALDB_DIR/$xml + ln -s "$param_def" "$PARAMS_LOCALDB_DIR/$xml" fi done fi + + -- libgit2 0.21.2