Commit 9c0d113f9bd397e24ab9e7c0a55684bf71ac6be4

Authored by Elena.Budnik
1 parent c865df36

IMPEX final

generic_data/RemoteData/Bases.xml 0 → 100644
... ... @@ -0,0 +1,16 @@
  1 +<?xml version="1.0"?>
  2 +<dataRoot xml:id="myRemoteData-treeRootNode">
  3 + <!--<dataCenter name="CDAWeb@NASA" desc="Coordinated_Data_Analysis" group="" id1="CDAWEB" xml:id="CDAWEB"/>
  4 + <dataCenter name="MAPSKP@IRAP" desc="Cassini MAPS_Key_Parameters" group="" default="yes" id1="MAPSKP" xml:id="MAPSKP"/>
  5 + <dataCenter name="THEMIS@IRAP" desc="Mirror_CESR_Data_Base" group="" default="yes" id1="THEMIS" xml:id="THEMIS"/>
  6 + <dataCenter name="CLWEB@IRAP" desc="CLWeb_Internal_Data_Base" default="yes" id1="CLWeb" xml:id="CLWeb"/>-->
  7 + <dataCenter name="LATMOS" desc="Latmos Hybrid Simulation Database" isSimulation='1' default="yes" id1="LATMOS" xml:id="LATMOS"/>
  8 + <dataCenter name="FMI_HYBRID" desc="FMI Hybrid Simulation Database" isSimulation='1' default="yes" id1="FMI_HYBRID" xml:id="FMI_HYBRID"/>
  9 + <dataCenter name="FMI_GUMICS" desc="FMI MHD simulation database" isSimulation='1' default="yes" id1="FMI_GUMICS" xml:id="FMI_GUMICS"/>
  10 + <!--<dataCenter name="SINP" desc="Paraboloid model calculates the magnetic fields in the Earth's magnetosphere depending on external conditions in solar wind and on geomagnetic activity level" isSimulation='1' default="yes" id1="SINP" xml:id="SINP"/>-->
  11 + <dataCenter name="LESIA" desc="LESIA MASER" default="yes" id1="LESIA" isSimulation='1' xml:id="LESIA"/>
  12 + <!--<dataCenter name="CDPP" desc="CCMC BATSRUS with RCM v8.01" default="yes" id1="CCMC" isSimulation='1' xml:id="CCMC"/>-->
  13 + <dataCenter name="IPIM" desc="IPIM @ IRAP" default="yes" id1="IPIM" isSimulation='1' xml:id="IPIM"/>
  14 +</dataRoot>
  15 +
  16 +
... ...
php/RemoteDataCenter/makeArgs.php
... ... @@ -3,29 +3,43 @@
3 3 * Executable to make arguments lists for IMPEX
4 4 * Uses target.json
5 5 */
6   - require_once "../config.php";
7   -
8   - if (!defined('SimuTargetsXml'))
9   - exit('SimuTargetsXml is not defined in config.php'.PHP_EOL);
10   -
11 6 if (!function_exists('__autoload')) {
12 7 function __autoload($class_name) {
13 8 require_once $class_name . '.php';
14 9 }
15 10 }
16 11  
17   - $simuBases = array("LATMOS", "FMI_HYBRID", "FMI_GUMICS", "LESIA");
  12 + $AMDA_IHM = getenv('AMDA_IHM');
  13 +
  14 + require_once $AMDA_IHM."/php/config.php";
  15 +
  16 + if (! file_exists(DATAPATH."/RemoteData/Bases.xml"))
  17 + exit('No Bases.xml file'.PHP_EOL);
  18 +
  19 + if (!defined('SimuTargetsXml'))
  20 + exit('SimuTargetsXml is not defined in config.php'.PHP_EOL);
  21 +
  22 + // $simuBases = array("LATMOS", "FMI_HYBRID", "FMI_GUMICS", "LESIA");
18 23  
19   - foreach ($simuBases as $class)
20   - {
21   - echo PHP_EOL.$class.PHP_EOL;
22   - $center = new $class();
  24 + $basesDom = new DomDocument("1.0");
  25 + $basesDom->load(DATAPATH."/RemoteData/Bases.xml");
23 26  
24   - $center->makeArgumentsList();
  27 + $bases = $basesDom->getElementsByTagName("dataCenter");
  28 +
  29 + foreach ($bases as $base)
  30 + {
  31 + if ($base->hasAttribute('isSimulation'))
  32 + {
  33 + $class = $base->getAttribute('xml:id');
  34 + echo PHP_EOL.$class.PHP_EOL;
  35 + $center = new $class();
25 36  
26   - //copy PlotSettings if exists
27   - if (file_exists(DATAPATH."SimuTemplate/".$center->plotSettings))
28   - copy(DATAPATH."SimuTemplate/".$center->plotSettings, RemoteData.$center->baseID.'/'.->plotSettings);
  37 + $center->makeArgumentsList();
  38 +
  39 + //copy PlotSettings if exists
  40 + if (file_exists(DATAPATH."SimuTemplate/".$center->plotSettings))
  41 + copy(DATAPATH."SimuTemplate/".$center->plotSettings, RemoteData.$center->baseID.'/'.$center->plotSettings);
  42 + }
29 43  
30 44 }
31 45  
... ...
php/RemoteDataCenter/makeOrbitsArgs.php
... ... @@ -4,7 +4,9 @@
4 4 * is launched AFTER makeProxy and makeOrbitsList
5 5 */
6 6  
7   - require_once "../config.php";
  7 + $AMDA_IHM = getenv('AMDA_IHM');
  8 +
  9 + require_once $AMDA_IHM."/php/config.php";
8 10  
9 11 if (!defined('orbitsXml'))
10 12 exit("orbitsXml is not defined in config.php".PHP_EOL);
... ...
php/RemoteDataCenter/makeOrbitsList.php
... ... @@ -3,7 +3,10 @@
3 3 * Executable to make Orbits.xml with the description for all Ephemeris parameters
4 4 * Uses LocalParams.xml and AMDA params descriptions
5 5 */
6   - require_once "../config.php";
  6 +
  7 + $AMDA_IHM = getenv('AMDA_IHM');
  8 +
  9 + require_once $AMDA_IHM."/php/config.php";
7 10  
8 11 if (!defined('orbitsXml'))
9 12 exit("orbitsXml is not defined in config.php".PHP_EOL);
... ...
php/RemoteDataCenter/makeProxy.php
... ... @@ -9,23 +9,37 @@
9 9 }
10 10 }
11 11  
12   - require_once "../config.php";
  12 + $AMDA_IHM = getenv('AMDA_IHM');
  13 +
  14 + require_once $AMDA_IHM."/php/config.php";
13 15  
14   - if (!defined('SimuTargetsXml')
  16 + if (! file_exists(DATAPATH."/RemoteData/Bases.xml"))
  17 + exit('No Bases.xml file'.PHP_EOL);
  18 +
  19 + if (!defined('SimuTargetsXml'))
15 20 exit('SimuTargetsXml is not defined in config.php'.PHP_EOL);
16 21  
17 22 if (file_exists(SimuTargetsXml)) unlink(SimuTargetsXml);
  23 +
  24 + $basesDom = new DomDocument("1.0");
  25 + $basesDom->load(DATAPATH."/RemoteData/Bases.xml");
  26 +
  27 + $bases = $basesDom->getElementsByTagName("dataCenter");
18 28  
19   - $simuBases = array("IPIM", "LATMOS", "FMI_HYBRID", "FMI_GUMICS", "SINP", "LESIA");
20   -
21   - foreach ($simuBases as $class)
22   - {
23   - echo PHP_EOL.$class.PHP_EOL;
24   - $center = new $class();
25   -
26   - $center->initProxy();
27   - $center->makeProxy();
28   - $center->saveProxy();
  29 + // $bases = array("IPIM", "LATMOS", "FMI_HYBRID", "FMI_GUMICS", "SINP", "LESIA");
  30 +
  31 + foreach ($bases as $base)
  32 + {
  33 + if ($base->hasAttribute('isSimulation'))
  34 + {
  35 + $class = $base->getAttribute('xml:id');
  36 + echo PHP_EOL.$class.PHP_EOL;
  37 + $center = new $class();
  38 +
  39 + $center->initProxy();
  40 + $center->makeProxy();
  41 + $center->saveProxy();
  42 + }
29 43 }
30 44  
31 45 ?>
32 46 \ No newline at end of file
... ...
php/makeRemote 0 → 100755
... ... @@ -0,0 +1,21 @@
  1 +#!/bin/bash
  2 +
  3 +#
  4 +#
  5 +#
  6 + export AMDA_IHM=./..
  7 +
  8 + # check if Orbites.xml exists; if not create it !
  9 + if [ ! -e $AMDA_IHM/generic_data/LocalData/Orbites.xml ]; then
  10 + php $AMDA_IHM/php/RemoteDataCenter/makeOrbitsList.php
  11 + fi
  12 +
  13 + # make Proxies for 'isSimulation' dataCenters from Bases.xml
  14 + php $AMDA_IHM/php/RemoteDataCenter/makeProxy.php
  15 +
  16 + # make [TARGET].json
  17 + php $AMDA_IHM/php/RemoteDataCenter/makeOrbitsArgs.php
  18 +
  19 + # make template args
  20 + php $AMDA_IHM/php/RemoteDataCenter/makeArgs.php
  21 +
0 22 \ No newline at end of file
... ...