Commit 92edb3d1e14a432a4276ec7f04cc1995e8a34310
1 parent
0dc31ba8
Exists in
master
and in
110 other branches
copy remote xml to proper location
Showing
1 changed file
with
30 additions
and
50 deletions
Show diff stats
php/RemoteDataCenter/RemoteParamManager.php
... | ... | @@ -59,18 +59,33 @@ class RemoteParamManager |
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
62 | - $this->center = new $baseId(); | |
62 | + $this->center = new $baseId(); | |
63 | 63 | } |
64 | 64 | |
65 | -// <param xml:id="ace_r"><get><vi name="ace:orb:all"><baseParam name="R"/></vi></get> | |
66 | -// <process>$ace_orb_all_R/RADIUS_EARTH</process> | |
67 | -// <output/></param> | |
65 | +/* | |
66 | + <param xml:id="ace_r"> | |
67 | + <get> | |
68 | + <vi name="ace:orb:all"> | |
69 | + <baseParam name="R"/> | |
70 | + </vi></get> | |
71 | + <process>$ace_orb_all_R/RADIUS_EARTH</process> | |
72 | + <output/> | |
73 | + </param> | |
74 | +*/ | |
68 | 75 | public function makeInternalParamXml() |
69 | 76 | { |
70 | 77 | if (!$this->center->ViId) return false; |
71 | 78 | if (!$this->center->ParamId) return false; |
72 | 79 | |
73 | 80 | $this->paramId = strtolower($this->center->baseID."_".$this->center->ViId."_".$this->center->ParamId); |
81 | + | |
82 | + $xmlNameRemote = RemoteData."/PARAMS/".$this->paramId.".xml"; | |
83 | + $xmlNameTemp = PARAMS_LOCALDB_DIR."/".$this->paramId.".xml"; | |
84 | + | |
85 | + if (file_exists($xmlNameRemote)) { | |
86 | + return copy($xmlNameRemote, $xmlNameTemp); | |
87 | + } | |
88 | + | |
74 | 89 | $xml = new DomDocument("1.0"); |
75 | 90 | $paramNode = $xml->createElement("param"); |
76 | 91 | $xml->appendChild($paramNode); |
... | ... | @@ -87,45 +102,13 @@ class RemoteParamManager |
87 | 102 | $paramNode->appendChild($xml->createElement("process")); |
88 | 103 | $paramNode->appendChild($xml->createElement("output")); |
89 | 104 | |
90 | - return $xml->save(RemoteData."/PARAMS/".$this->paramId.".xml"); | |
91 | - } | |
92 | - | |
93 | - // TODO not used - too complicated | |
94 | - protected function makeParamArgs() | |
95 | - { | |
96 | - $CURR_DIR = getcwd(); | |
97 | - rename($CURR_DIR ."/".$this->paramId.".xml", "/home/budnik/NEWMETA/final/".$this->paramId.".xml"); | |
98 | - chdir(NEWKERNEL_BASE_PATH."/app-generate-paraminfo"); | |
99 | - $cmd = NEWKERNEL_INSTALL_DIR."/bin/DDLogin budnik Sacre-Cour"; | |
100 | - $res = system($cmd); | |
101 | - $cmd = NEWKERNEL_INSTALL_DIR."/bin/amdaParameterInfo -p ".$this->paramId; | |
102 | - system($cmd, $res); | |
103 | - $info_name = "info_".$this->paramId.".xml"; | |
104 | - rename($info_name, $CURR_DIR."/".$info_name); | |
105 | - chdir($CURR_DIR); | |
105 | + $res = $xml->save($xmlNameRemote); | |
106 | + if ($res) | |
107 | + return copy($xmlNameRemote, $xmlNameTemp); | |
106 | 108 | |
107 | - return $info_name; | |
109 | + return $res; | |
108 | 110 | } |
109 | 111 | |
110 | -// protected function makeComponentsFromArgsFile($node, $info_file_name) | |
111 | -// { | |
112 | -// $xml = new DomDocument(); | |
113 | -// $xml->load($info_file_name); | |
114 | -// | |
115 | -// $components = $xml->getElementsByTagName('component'); | |
116 | -// if ($components->length > 0) | |
117 | -// { | |
118 | -// foreach ($components as $component) | |
119 | -// { | |
120 | -// $compNode = $this->xmlDom->createElement("component"); | |
121 | -// $compNode->setAttribute('xml:id',$this->paramId.'('.$component->getAttribute("index_1").')'); | |
122 | -// $component->setAttribute('name',$component->getAttribute("name")); // LABEL | |
123 | -// | |
124 | -// $node->appendChild($compNode); | |
125 | -// } | |
126 | -// } | |
127 | -// } | |
128 | - | |
129 | 112 | protected function makeComponents($node, $size, $components) |
130 | 113 | { |
131 | 114 | $compArray = explode(";",$components); |
... | ... | @@ -155,9 +138,10 @@ class RemoteParamManager |
155 | 138 | { |
156 | 139 | $this->center->setViId($nodeRemote->getAttribute('name')); |
157 | 140 | $status = $this->center->addViToDD(); |
158 | - // echo "STATUS $status".PHP_EOL; | |
141 | + | |
159 | 142 | if (!$status) return false; |
160 | - $remoteDatasetInfo = "/home/budnik/DDBASE/INFO/bases/".$this->center->baseID."/".$this->center->infoFile; //TODO "http://apus.irap.omp.eu/ | |
143 | + //TODO "http://apus.irap.omp.eu/ | |
144 | + $remoteDatasetInfo = "/home/budnik/DDBASE/INFO/bases/".$this->center->baseID."/".$this->center->infoFile; | |
161 | 145 | $localDatasetInfo = RemoteData.$this->center->baseID."/".$this->center->infoFile; |
162 | 146 | |
163 | 147 | if (!copy($remoteDatasetInfo,$localDatasetInfo)) return false; |
... | ... | @@ -179,12 +163,9 @@ class RemoteParamManager |
179 | 163 | $components = $this->center->getParamComponents(); |
180 | 164 | $this->makeComponents($node, $size, $components); // return false; |
181 | 165 | } |
182 | - | |
183 | -// if ($res) | |
184 | -// $info_file_name = $this->makeParamArgs(); | |
185 | -// | |
186 | -// if (!$this->makeComponentsFromArgsFile($node, $info_file_name)) return false; | |
187 | - | |
166 | + | |
167 | + // convert remote paramID into AMDA paramID | |
168 | + $node->setAttribute("xml:id", strtr(strtolower($node->getAttribute("xml:id")), ":","_")); | |
188 | 169 | } |
189 | 170 | |
190 | 171 | $parentRemote= $nodeRemote->parentNode; |
... | ... | @@ -236,8 +217,7 @@ class RemoteParamManager |
236 | 217 | * PUBLIC FUNCTIONS |
237 | 218 | */ |
238 | 219 | public function saveTree($obj) |
239 | - { | |
240 | - $r = print_r($obj, true); | |
220 | + { | |
241 | 221 | if (count($obj) == 1) |
242 | 222 | { |
243 | 223 | $id = $obj->id; |
... | ... |