getInstance($requ_arr[1], $requ_arr[2]); break; } } private static function processRESTPut($request, $params) { $requ_arr = explode("/", $request); switch ($requ_arr[0]) { case "balmon": return self::balmon_put_processing($request, $params); break; default: // instanitiate interface $if = new GenadIf($requ_arr[0]); // check existence of the instance $inst = $if->getInstance($requ_arr[1], $requ_arr[2]); if (isset($inst)) { // perform set $if->performSet($requ_arr[1], $xml, $id); } else { // perform create $if->performCreate($requ_arr[1], $xml, $id); } return $if->getInstance($requ_arr[1], $requ_arr[2]); break; } } private static function processRESTPost($request, $params) { $requ_arr = explode("/", $request); switch ($requ_arr[1]) { case "RemoteWatchdog": return self::watchdog_post_processing($request, $params); break; default: throw new Exception("Generic POST processing not implemented!"); break; } } static function balmon_processing($request) { // create output formatter //$xmlFormatter = new XmlFormatter(); //$xmlFormatter->initResult($request); // evaluate request $requ_arr = explode("/", $request); if (count($requ_arr) == 1) { return AlarmManagement::getMonitors(); } if (count($requ_arr) == 3 && $requ_arr[2] == "alarm") { return AlarmManagement::getMonitorAlarms($requ_arr[1]); } return self::error_processing($request); } static function balmon_put_processing($request, $params) { // evaluate request $requ_arr = explode("/", $request); if (count($requ_arr) == 2 && $params == "") { AlarmAdministration::confirmMonitor($requ_arr[1], $ret_val); return ""; } return self::error_processing($request); } static function watchdog_post_processing($request, $data) { if(substr($request, 0, 14) != "AlarmInterface") throw new Exception("Invalid Application: ".substr($request, 0, 14)); $if = new AlarmInterfaceAdministration(); return $if->triggerWatchdog($data); } static function error_processing($request) { // TODO: korrektes Fehler-xml erzeugen return "$requestError"; } }