Scheduler.borg

Scheduler.borg


{
announce(name,agt)::
  {
  display("Announcing "+name+eoln);
  webdispatcher.forgethandler(name);
  webdispatcher.announcehandler(name,agt)
  };

`find the name of the webdispatcher, probably this will be
`webserver/webdispatcher
webdispatcher:agent("webserver/webdispatcher");
display("Checking for existing webserver "+text(webdispatcher));
if (ping(webdispatcher),display("[OK]"+eoln), display("[FAILED]"+eoln));

`load the synchronous viewcontroller
display("Loading synchronous view controller");
if (load("SynchronousViewController.borg"),
    display(" [OK]"+eoln),
    if (load("applications/Scheduler/SynchronousViewController.borg"),
        display(" [OK]"+eoln),
        display(" [FAILED]"+eoln)));

`announce the viewcontroller as scheduler
announce("/schedule",agentself);

`creating demonstration matrix for july
display("Creating demonstration matrix [OK]"+eoln);
bart:    ["Bart",1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
brigitte:["Brigitte",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
franklin:["Franklin",1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
kim:     ["Kim",1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
kris:    ["Kris",1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
linda:   ["Linda",1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
luc:     ["Luc",1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
lydie:   ["Lydie",1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
roel:    ["Roel",1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
simone:  ["Simone",1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
theo:    ["Theo",1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
tomm:    ["TomM",1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
tomt:    ["TomT",1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
werner:  ["Werner",1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
wim:     ["Wim",1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
wolf:    ["Wolf",1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];

july:    [bart,brigitte,franklin,kim,kris,linda,luc,lydie,roel,simone,theo,tomm,tomt,werner,wim,wolf];

`announce all demo persons
i : 1;
while(i <= size(july),
  { person:july[i];
    ph:createpersonhandler(person);
    handle : "/person/" + person[1];
    announce(handle,ph);
    i := i + 1 });

`ready to play
display("Ready to play !"+eoln)
}