Commit 7611712144db4fd566a689be2d32906dc5a912df

Authored by isisadmin
1 parent 28cba4e5

add deep configuration

DEEP.php
... ... @@ -27,7 +27,6 @@
27 27 /**
28 28 * Developed by :
29 29 * ROUTE-TO-PA Project - grant No 645860. - www.routetopa.eu
30   -
31 30 */
32 31  
33 32 ini_set('display_errors',1);
... ... @@ -45,6 +44,9 @@ class DEEP {
45 44 private $all_datalets;
46 45 private $all_controllets;
47 46  
  47 + private $controllet_repository_url;
  48 + private $datalet_repository_url;
  49 +
48 50 public static function getInstance()
49 51 {
50 52 if(self::$instance == null)
... ... @@ -61,7 +63,9 @@ class DEEP {
61 63 \Slim\Slim::registerAutoloader();
62 64 $this->app = new \Slim\Slim();
63 65  
64   - $this->all_datalets = $this->loadServices("datalets.xml");
  66 + $this->loadRepositoryUrl("configuration.xml");
  67 +
  68 + $this->all_datalets = $this->loadServices("datalets.xml", $this->datalet_repository_url);
65 69 $this->app->get('/datalets-list', function(){
66 70 $this->app->response()->header("Content-Type", "application/json");
67 71 $this->app->response()->header("Access-Control-Allow-Origin", "*");
... ... @@ -69,7 +73,7 @@ class DEEP {
69 73  
70 74 });
71 75  
72   - $this->all_controllets = $this->loadServices("controllets.xml");
  76 + $this->all_controllets = $this->loadServices("controllets.xml", $this->controllet_repository_url);
73 77 $this->app->get('/controllets-list', function(){
74 78 $this->app->response()->header("Content-Type", "application/json");
75 79 $this->app->response()->header("Access-Control-Allow-Origin", "*");
... ... @@ -83,23 +87,29 @@ class DEEP {
83 87 });
84 88 }
85 89  
  90 + public function loadRepositoryUrl($source)
  91 + {
  92 + $handler_configuration = simplexml_load_file($source) or die("ERROR: cant read Components configuration \n");
  93 + $this->datalet_repository_url = $handler_configuration->deep_datalet_configuration->components_repository_url_reference;
  94 + $this->controllet_repository_url = $handler_configuration->deep_controllets_configuration->components_repository_url_reference;
  95 + }
  96 +
86 97 /**
87 98 * @param $source
88 99 * @return array
89 100 */
90   - public function loadServices($source){
  101 + public function loadServices($source, $repository_url){
91 102 $components_array = array();
92 103 $handler_configuration = simplexml_load_file($source) or die("ERROR: cant read Components configuration \n");
93   - $deep_configuration = $handler_configuration->deep_handler_configuration;
94 104  
95 105 foreach($handler_configuration->components->children() as $component){
96 106 //array_push($components_array, $component->name."");
97   - $component->url = $handler_configuration->deep_handler_configuration->components_repository_url_reference . $component->name . "/";
  107 + $component->url = $repository_url . $component->name . "/";
98 108 array_push($components_array, $component);
99   - $this->app->get('/'.$component->name, function() use($component, $deep_configuration ){
  109 + $this->app->get('/'.$component->name, function() use($component, $repository_url){
100 110 $response = array(
101 111 "name" => $component->name."",
102   - "bridge_link" => $deep_configuration->components_repository_url_reference."",
  112 + "bridge_link" => $repository_url."",
103 113 "component_link" => $component->name."/".$component->name.".html",
104 114 "idm" => $component->idm
105 115 );
... ... @@ -125,5 +135,4 @@ class DEEP {
125 135 }
126 136  
127 137  
128   -}
129   -?>
130 138 \ No newline at end of file
  139 +}
131 140 \ No newline at end of file
... ...
configuration.xml 0 → 100644
  1 +<configuration>
  2 +
  3 + <deep_datalet_configuration>
  4 + <components_repository_url_reference>http://192.168.232.128/DEEalerProvider/COMPONENTS/datalets/</components_repository_url_reference>
  5 + </deep_datalet_configuration>
  6 +
  7 + <deep_controllets_configuration>
  8 + <components_repository_url_reference>http://192.168.232.128/DEEalerProvider/COMPONENTS/controllets/</components_repository_url_reference>
  9 + </deep_controllets_configuration>
  10 +
  11 +</configuration>
0 12 \ No newline at end of file
... ...
controllets.xml
1 1 <?xml version="1.0" encoding="utf-8"?>
2 2 <handler_configuration>
3   - <deep_handler_configuration>
4   - <components_repository_url_reference>http://192.168.214.128/DatalEts-Ecosystem-Provider/COMPONENTS/controllets/</components_repository_url_reference>
5   - </deep_handler_configuration>
6 3 <components>
7 4 <component>
8 5 <name>carousel-controllet</name>
... ...
datalets.xml
1 1 <?xml version="1.0" encoding="utf-8"?>
2 2 <handler_configuration>
3   - <deep_handler_configuration>
4   - <components_repository_url_reference>http://192.168.214.128/DatalEts-Ecosystem-Provider/COMPONENTS/datalets/</components_repository_url_reference>
5   - </deep_handler_configuration>
6 3 <components>
7 4 <component>
8 5 <name>datatable-datalet</name>
... ...