Exemple #1
0
 function &getHeyuSched($reload = false)
 {
     if (isset($this->heyuSched) && !$reload) {
         if ($this->heyuSched->hasFileChanged()) {
             $reload = true;
         }
     }
     if (!isset($this->heyuSched) || $reload) {
         $_SESSION['load_count'] += 1;
         $schedfileloc = $this->heyuConf->getSchedFile();
         try {
             $heyuschedinstance = new heyuSched($schedfileloc);
         } catch (Exception $e) {
             //				prx($e);
             $theTrace = $e->getTrace();
             if ($theTrace[0]["function"] == "load_file") {
                 error_log("domus.Link: No sched file available, creating default with location [" . $schedfileloc . "]");
                 $heyuschedinstance = new heyuSched();
                 $heyuschedinstance->setFileName($schedfileloc);
             } else {
                 throw $e;
             }
         }
         $this->heyuSched =& $heyuschedinstance;
     }
     return $this->heyuSched;
 }
try {
    $trigger = new Trigger($triggerLine);
    echo "&nbsp;&nbsp;&nbsp;&nbsp;The return of Trigger getElementLine [" . $trigger->getElementLine() . "]<br/>";
    echo "&nbsp;&nbsp;&nbsp;&nbsp;The return of Trigger element getType [" . $trigger->getType() . "]<br/>";
    echo "&nbsp;&nbsp;&nbsp;&nbsp;The return of Trigger element isEnabled [" . $trigger->isEnabled() . "]<br/>";
} catch (Exception $e) {
    echo "&nbsp;&nbsp;&nbsp;&nbsp;E!: " . $e->getMessage() . "<br/>";
}
echo "* Test Triggerwith no args <br/>";
try {
    $trigger = new Trigger();
    echo "&nbsp;&nbsp;&nbsp;&nbsp;The return of Trigger getElementLine [" . $trigger->getElementLine() . "]<br/>";
    echo "&nbsp;&nbsp;&nbsp;&nbsp;The return of Trigger element getType [" . $trigger->getType() . "]<br/>";
    echo "&nbsp;&nbsp;&nbsp;&nbsp;The return of Trigger element isEnabled [" . $trigger->isEnabled() . "]<br/>";
} catch (Exception $e) {
    echo "&nbsp;&nbsp;&nbsp;&nbsp;E!: " . $e->getMessage() . "<br/>";
}
echo "<br/>";
echo "The sched file tests [x10.sched]<br/>";
echo "<br/>";
echo "* Test Sched file<br/>";
try {
    $aHeyuSched = new heyuSched("/etc/heyu/x10.sched");
    echo "&nbsp;&nbsp;&nbsp;&nbsp;The return of heyu sched get element objects<br/>";
    pr($aHeyuSched->getElementObjects(ALL_OBJECTS_D));
    echo "&nbsp;&nbsp;&nbsp;&nbsp;The return of heyu sched file<br/>";
    pr($aHeyuSched);
} catch (Exception $e) {
    echo "&nbsp;&nbsp;&nbsp;&nbsp;E!: " . $e->getMessage() . "<br/>";
}
echo "-------------------- End Test bed for schedule element classes --------------------<br/>";