Commit 86dadb0d988dcf4905bbbea9ebbc6278b1b486ca
1 parent
658f0e4c
Exists in
SpeasyGet
Add make proxy for Speasy providers
Showing
6 changed files
with
156 additions
and
3 deletions
Show diff stats
php/RemoteDataCenter/Bases.xml
@@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
7 | <!--<dataCenter name="LESIA" desc="LESIA MASER" default="yes" id1="LESIA" isSimulation='1' xml:id="LESIA"/>--> | 7 | <!--<dataCenter name="LESIA" desc="LESIA MASER" default="yes" id1="LESIA" isSimulation='1' xml:id="LESIA"/>--> |
8 | <!--<dataCenter name="CDPP" desc="CCMC BATSRUS with RCM v8.01" default="yes" id1="CCMC" isSimulation='1' xml:id="CCMC"/>--> | 8 | <!--<dataCenter name="CDPP" desc="CCMC BATSRUS with RCM v8.01" default="yes" id1="CCMC" isSimulation='1' xml:id="CCMC"/>--> |
9 | <dataCenter name="IPIM" desc="IPIM @ IRAP" default="yes" id1="IPIM" isSimulation='1' xml:id="IPIM"/> | 9 | <dataCenter name="IPIM" desc="IPIM @ IRAP" default="yes" id1="IPIM" isSimulation='1' xml:id="IPIM"/> |
10 | + <dataCenter name="CDAWeb access with speasy" desc="ToDo" default="yes" id1="IPIM" isSpeasyProxy='1' xml:id="SPEASY_cda"/> | ||
10 | </dataRoot> | 11 | </dataRoot> |
11 | 12 | ||
12 | 13 |
@@ -0,0 +1,76 @@ | @@ -0,0 +1,76 @@ | ||
1 | +<?php | ||
2 | +/** | ||
3 | + * @class SPEASY_CDAWEB | ||
4 | + * @brief | ||
5 | + */ | ||
6 | + | ||
7 | +class SPEASYClientClass | ||
8 | +{ | ||
9 | + protected $baseId = ""; | ||
10 | + | ||
11 | + function __construct() | ||
12 | + { | ||
13 | + echo '[ERROR] SPEASYClientClass cannot be used directly'.PHP_EOL; | ||
14 | + date_default_timezone_set('UTC'); | ||
15 | + } | ||
16 | + | ||
17 | + public function monitor() | ||
18 | + { | ||
19 | + if (!defined('SpeasyProxyData')) { | ||
20 | + echo '[ERROR] Missing SpeasyProxyData in config'.PHP_EOL; | ||
21 | + return FALSE; | ||
22 | + } | ||
23 | + if (!file_exists(SpeasyProxyData.$this->baseID."/base.xml")) { | ||
24 | + echo '[ERROR] Cannot retrieve Speasy base definition for '.$this->baseID.PHP_EOL; | ||
25 | + return FALSE; | ||
26 | + } | ||
27 | + return TRUE; | ||
28 | + } | ||
29 | + | ||
30 | + // make components description from base.xml | ||
31 | + public function makeCenterNode($xmlDom) | ||
32 | + { | ||
33 | + $dom = new DOMDocument('1.0', 'utf-8'); | ||
34 | + $dom->formatOutput = TRUE; | ||
35 | + $dom->preserveWhiteSpace = FALSE; | ||
36 | + | ||
37 | + $node = NULL; | ||
38 | + if ($dom->load(SpeasyProxyData.$this->baseID."/base.xml")) { | ||
39 | + $nodeBase = $dom->getElementsByTagName('dataCenter')->item(0); | ||
40 | + $node = $xmlDom->importNode($nodeBase, true); | ||
41 | + } | ||
42 | + | ||
43 | + return $node; | ||
44 | + } | ||
45 | + | ||
46 | + public function makeAllParams() | ||
47 | + { | ||
48 | + $dom = new DOMDocument('1.0', 'utf-8'); | ||
49 | + $dom->formatOutput = TRUE; | ||
50 | + $dom->preserveWhiteSpace = FALSE; | ||
51 | + | ||
52 | + $node = NULL; | ||
53 | + if ($dom->load(SpeasyProxyData.$this->baseID."/base.xml")) { | ||
54 | + $xpath = new DOMXPath($dom); | ||
55 | + $params = $xpath->query("//parameter"); | ||
56 | + | ||
57 | + foreach ($params as $param) | ||
58 | + { | ||
59 | + $paramId = $param->getAttribute('xml:id'); | ||
60 | + if (is_file(SpeasyProxyData.$this->baseID."/PARAMS/".$paramId.".xml")) { | ||
61 | + if (!is_link(PARAMS_LOCALDB_DIR.$paramId.".xml")) { | ||
62 | + if (!symlink(SpeasyProxyData.$this->baseID."/PARAMS/".$paramId.".xml", PARAMS_LOCALDB_DIR.$paramId.".xml")) { | ||
63 | + echo "[ERROR] Cannot create symbolic link for ".$paramId.PHP_EOL; | ||
64 | + } | ||
65 | + } | ||
66 | + } | ||
67 | + else { | ||
68 | + echo "[ERROR] Missing speasy parameter file for ".$paramId.PHP_EOL; | ||
69 | + } | ||
70 | + } | ||
71 | + } | ||
72 | + } | ||
73 | + | ||
74 | + | ||
75 | +} | ||
76 | +?> |
@@ -0,0 +1,45 @@ | @@ -0,0 +1,45 @@ | ||
1 | +<?php | ||
2 | +/* | ||
3 | +* Executable to make 'base.xml' proxies for IMPEX centers from IMPEX original trees | ||
4 | +*/ | ||
5 | + | ||
6 | + if (!function_exists('__autoload')) { | ||
7 | + function __autoload($class_name) { | ||
8 | + require_once $class_name . '.php'; | ||
9 | + } | ||
10 | + } | ||
11 | + | ||
12 | + $AMDA_IHM = getenv('AMDA_IHM'); | ||
13 | + | ||
14 | + require_once $AMDA_IHM."/php/config.php"; | ||
15 | + | ||
16 | + $BasesXml = $AMDA_IHM."/php/RemoteDataCenter/Bases.xml"; | ||
17 | + | ||
18 | + if (!file_exists($BasesXml)) | ||
19 | + exit('No Bases.xml file'.PHP_EOL); | ||
20 | + | ||
21 | + $basesDom = new DomDocument("1.0"); | ||
22 | + $basesDom->load($BasesXml); | ||
23 | + | ||
24 | + $bases = $basesDom->getElementsByTagName("dataCenter"); | ||
25 | + | ||
26 | + foreach ($bases as $base) | ||
27 | + { | ||
28 | + echo $base->getAttribute('xml:id').PHP_EOL; | ||
29 | + if ($base->hasAttribute('isSpeasyProxy')) | ||
30 | + { | ||
31 | + $class = $base->getAttribute('xml:id'); | ||
32 | + echo PHP_EOL.$class.PHP_EOL; | ||
33 | + $center = new $class(); | ||
34 | + | ||
35 | + if ($center->monitor()) | ||
36 | + { | ||
37 | + $center->makeAllParams(); | ||
38 | + } | ||
39 | + else | ||
40 | + { | ||
41 | + echo "[ERROR] $class service is not available".PHP_EOL; | ||
42 | + } | ||
43 | + } | ||
44 | + } | ||
45 | +?> | ||
0 | \ No newline at end of file | 46 | \ No newline at end of file |
php/classes/AmdaAction.php
@@ -522,7 +522,7 @@ class AmdaAction | @@ -522,7 +522,7 @@ class AmdaAction | ||
522 | 522 | ||
523 | if ($isParameter) | 523 | if ($isParameter) |
524 | { | 524 | { |
525 | - $disable = $child->parentNode->getAttribute('disabled'); | 525 | + $disable = $child->parentNode->getAttribute('disabled') || $child->getAttribute('error'); |
526 | $objectMgr = new AliasMgr(); | 526 | $objectMgr = new AliasMgr(); |
527 | $alias = $objectMgr->getAlias($id); | 527 | $alias = $objectMgr->getAlias($id); |
528 | 528 | ||
@@ -531,6 +531,11 @@ class AmdaAction | @@ -531,6 +531,11 @@ class AmdaAction | ||
531 | $needsArgs = true; | 531 | $needsArgs = true; |
532 | $isSpectra = true; | 532 | $isSpectra = true; |
533 | } | 533 | } |
534 | + | ||
535 | + if ($child->getAttribute('error')) { | ||
536 | + $info .= "<br/><b>".$child->getAttribute('error')."</b>"; | ||
537 | + } | ||
538 | + | ||
534 | if ($globalStart) | 539 | if ($globalStart) |
535 | $childrenToReturn[] = array('text' => $name,'alias' => $alias, | 540 | $childrenToReturn[] = array('text' => $name,'alias' => $alias, |
536 | 'id' => $id,'nodeType' => $nodeType, 'info' => $info, 'help' => $help, 'globalStart' => $globalStart, | 541 | 'id' => $id,'nodeType' => $nodeType, 'info' => $info, 'help' => $help, 'globalStart' => $globalStart, |
@@ -548,16 +553,21 @@ class AmdaAction | @@ -548,16 +553,21 @@ class AmdaAction | ||
548 | 553 | ||
549 | if ($child->tagName == 'dataset') | 554 | if ($child->tagName == 'dataset') |
550 | { | 555 | { |
551 | - $nonavailable = ($child->getAttribute('disabled')); | 556 | + $nonavailable = ($child->getAttribute('disabled') || $child->getAttribute('error')); |
552 | } | 557 | } |
553 | else | 558 | else |
554 | { | 559 | { |
555 | $nonavailable = false; | 560 | $nonavailable = false; |
556 | } | 561 | } |
557 | 562 | ||
563 | + | ||
564 | + | ||
558 | if ($nonavailable) | 565 | if ($nonavailable) |
559 | $info .= "<br/><b>Not available yet</b>"; | 566 | $info .= "<br/><b>Not available yet</b>"; |
560 | 567 | ||
568 | + if ($child->getAttribute('error')) | ||
569 | + $info .= "<br/><b>".$child->getAttribute('error')."</b>"; | ||
570 | + | ||
561 | if ($child->getAttribute('url')) | 571 | if ($child->getAttribute('url')) |
562 | $info .= "<br/>".$child->getAttribute('url'); | 572 | $info .= "<br/>".$child->getAttribute('url'); |
563 | 573 |
update_amda/makeRemote
@@ -23,6 +23,9 @@ | @@ -23,6 +23,9 @@ | ||
23 | 23 | ||
24 | # make Proxies for 'isSimulation' dataCenters from Bases.xml | 24 | # make Proxies for 'isSimulation' dataCenters from Bases.xml |
25 | php $AMDA_IHM/php/RemoteDataCenter/makeProxy.php | 25 | php $AMDA_IHM/php/RemoteDataCenter/makeProxy.php |
26 | + | ||
27 | + # make Proxies for 'isSpeasyProxy' dataCenters from Bases.xml | ||
28 | + php $AMDA_IHM/php/RemoteDataCenter/makeSpeasyProxy.php | ||
26 | 29 | ||
27 | # make [TARGET].json | 30 | # make [TARGET].json |
28 | php $AMDA_IHM/php/RemoteDataCenter/makeOrbitsArgs.php | 31 | php $AMDA_IHM/php/RemoteDataCenter/makeOrbitsArgs.php |
@@ -61,8 +64,10 @@ | @@ -61,8 +64,10 @@ | ||
61 | xml=`basename $param_def` | 64 | xml=`basename $param_def` |
62 | if [ ! -f "$PARAMS_LOCALDB_DIR/$xml" ]; then | 65 | if [ ! -f "$PARAMS_LOCALDB_DIR/$xml" ]; then |
63 | #cp $param_def $PARAMS_LOCALDB_DIR/ | 66 | #cp $param_def $PARAMS_LOCALDB_DIR/ |
64 | - ln -s $param_def $PARAMS_LOCALDB_DIR/$xml | 67 | + ln -s "$param_def" "$PARAMS_LOCALDB_DIR/$xml" |
65 | fi | 68 | fi |
66 | done | 69 | done |
67 | fi | 70 | fi |
71 | + | ||
72 | + | ||
68 | 73 |