if_nam = Config::getInstance()->requireConfig("$app::InterfaceClass"); //$am = new AlarmManagement(); $class = new ReflectionClass($this->if_nam); $this->interface = $class->newInstance(); $if_func = new ReflectionMethod($this->if_nam, "getMocDescList"); $moc_desc_xml = $if_func->invoke($this->interface, null); // parse moc desr xml $this->moc_desc_data = array(); $instanceExtractor = new XmlExtractor(); $instanceExtractor->openInput($moc_desc_xml); $instanceExtractor->extractElement(InputExtractor::EC_BEG, $elem, $value, $attrs); if ($elem != "ManagedObjectClassDescriptorList") throw new Exception("Unexpected xml tag: ".$elem); $ctl1 = InputExtractor::EC_BEG; while (($ctl1 = $instanceExtractor->extractElement($ctl1, $elem, $value, $attrs)) == InputExtractor::EC_CTN) { $id = $attrs["id"]; $ctl2 = InputExtractor::EC_BEG; while (($ctl2 = $instanceExtractor->extractElement($ctl2, $elem, $value, $attrs)) == InputExtractor::EC_CTN) { if ($elem == "entity") $name = $value; elseif ($elem == "props") $props = new ClassProperties($value); else throw new Exception("Unexpected xml tag: ".$elem); } $this->moc_desc_data[$name] = array("id" => $id, "props" => $props); } } public function getAttrDescList($classId) { $if_func = new ReflectionMethod($this->if_nam, "getAttrDescList"); $dom = new DOMDocument; $dom->Loadxml($if_func->invoke($this->interface, $classId)); return $dom; } public function getInstanceList($classId, $filter = null) { $if_func = new ReflectionMethod($this->if_nam, "getInstanceList"); $dom = new DOMDocument; $dom->Loadxml($if_func->invoke($this->interface, $classId, $filter)); return $dom; } /* public function getClassDescriptorList() { $if_func = new ReflectionMethod($this->if_nam, "getMocDescList"); return $if_func->invoke($this->interface, null); } */ public function getClassDescriptor($id) { require_once 'AlarmManagement/AlarmManagement.php'; $if_func = new ReflectionMethod($this->if_nam, "getAttrDescList"); $dom = new DOMDocument; $dom->Loadxml($if_func->invoke($this->interface, $id)); return $dom; } public function getInstance($moc, $id) { $if_func = new ReflectionMethod($this->if_nam, "getInstance"); $props = $this->moc_desc_data[$moc]["props"]; $moc_id = $this->moc_desc_data[$moc]["id"]; if(!isset($props)) throw new Exception("Undefined MOC: ".$moc); return $if_func->invoke($this->interface, $moc_id, $id); } public function performSet($moc_id, $xml) { $if_func = new ReflectionMethod($this->if_nam, "setInstance"); $err = $if_func->invoke($this->interface, $moc_id, $xml); return $err; } public function performCreate($moc_id, $xml, $id) { $if_func = new ReflectionMethod($this->if_nam, "createInstance"); $err = $if_func->invoke($this->interface, $moc_id, $xml, $id); return $err; } public function performDelete($moc_id, $id, $mod) { $if_func = new ReflectionMethod($this->if_nam, "deleteInstance"); $err = $if_func->invoke($this->interface, $moc_id, $id, $mod); return $err; } }