DIRECTORY ForkOps, IO, JoinApp, LB, List, NameService, RefTab, Rope, RuntimeError, SlateJoinApp, Slate, SunRPC, SunRPCAuth, SymTab, UT; SlateJoinAppImpl: CEDAR MONITOR IMPORTS ForkOps, IO, JoinApp, LB, List, NameService, RefTab, Rope, RuntimeError, Slate, SunRPCAuth, SymTab EXPORTS SlateJoinApp ~ BEGIN ROPE: TYPE ~ Rope.ROPE; nextSessionIndex: CARD _ 0; sessionRec: TYPE = RECORD [ slateBI: ROPE _ NIL, uid: ROPE, rpc: SunRPC.Server, session: Slate.Session, sessionId: ROPE, locations: LIST OF ROPE _ NIL ]; sessionInfo: TYPE = REF sessionRec; sessionIdTable: SymTab.Ref _ SymTab.Create[]; sessionTable: RefTab.Ref _ RefTab.Create[]; sessionIdRope: ROPE _ "SessionId"; LBClosure: TYPE = RECORD [ object: REF UT.Objct, loc: REF LB.LocationObject.LocationVLocRoom ]; lb: LB.LB1; NewSessionEvent: Slate.EventProc = { AdvertiseNewSession[session, NIL]; }; AdvertiseNewSession: PUBLIC PROC [session: Slate.Session, log: IO.STREAM] = BEGIN ENABLE RuntimeError.UNCAUGHT => GO TO Oops; tRope: ROPE _ "t"; rpc: SunRPC.Server ¬ JoinApp.MakeJoinApp1Server[NIL, ServerNoOpProc, JoinApplicationProc]; sr: sessionInfo _ NEW [sessionRec]; IF log=NIL THEN log ¬ session.debugLog; IO.PutRope[log, "AdvertiseNewSession\n"]; sr.rpc _ rpc; sr.session _ session; sr.sessionId _ IO.PutFR1["%g", IO.card[nextSessionIndex]]; [sr.slateBI, sr.uid] _ NameService.ExportRPCSun[name: "JoinApp", sp: rpc, prog: JoinApp.JoinAppPrognum, vers: JoinApp.version1, instance: "Slate:", appl: CONS[ List.DotCons[sessionIdRope, sr.sessionId], NIL] ]; [] _ SymTab.Store[sessionIdTable, sr.sessionId, sr]; [] _ RefTab.Store[sessionTable, session, sr]; nextSessionIndex _ nextSessionIndex + 1; EXITS Oops => {}; END; ServerNoOpProc: JoinApp.servernoopProc = { }; JoinApplicationProc: JoinApp.joinapplicationProc = { retVal: UT.ObjectDescription _ NEW[UT.SeqType1Object[0]]; xServer: ROPE _ "cleonie:0.1"; location: ROPE; sessionId: ROPE; found: BOOLEAN; val: REF; sr: sessionInfo; ls: ROPE _ "JoinApp.JoinApplication called: "; FOR i: CARD IN [0..in.size) DO ls _ Rope.Concat[ls, IO.PutFR["(%g, %g) ", IO.rope[in[i].key], IO.rope[in[i].value]]]; IF Rope.Equal[in[i].key, "XServer", FALSE] THEN xServer _ in[i].value ELSE IF Rope.Equal[in[i].key, "Location", FALSE] THEN location _ in[i].value ELSE IF Rope.Equal[in[i].key, "SessionId", FALSE] THEN sessionId _ in[i].value; ENDLOOP; ls _ Rope.Concat[ls, " called.\n"]; [found, val] _ SymTab.Fetch[sessionIdTable, sessionId]; sr _ NARROW[val]; sr.locations _ CONS[location, sr.locations]; IO.PutF1[sr.session.debugLog, "%g", IO.rope[ls]]; [] _ Slate.NewInstanceTool[sr.session, xServer]; IO.PutRope[sr.session.debugLog, "... "]; IO.PutRope[sr.session.debugLog, "About to call LB.AtLoc.\n"]; RegisterWithLocationBroker[location, sr.session, sessionId]; IO.PutRope[sr.session.debugLog, "Done with JoinApp.JoinApplication.\n"]; IO.PutRope[sr.session.debugLog, "Return from LB.AtLoc.\n"]; RETURN [NEW [JoinApp.JoinApplicationreturnObject.iluSuccess _ [iluSuccess[retVal]]]]; }; RegisterWithLocationBroker: PROC [location: ROPE, session: Slate.Session, sessionId: ROPE] ~ { object: REF UT.Objct; loc: REF LB.LocationObject.LocationVLocRoom _ NEW [LB.LocationObject.LocationVLocRoom]; found: BOOLEAN; val: REF; sr: sessionInfo; cl: REF LBClosure _ NEW [LBClosure]; IO.PutRope[session.debugLog, "RegisterWithLocationBroker\n"]; [found, val] _ SymTab.Fetch[sessionIdTable, sessionId]; sr _ NARROW[val]; object _ NEW [UT.Objct]; object.binding _ sr.slateBI; object.rock _ Rope.ToRefText[Rope.Cat["Slate", sessionId, ":", location]]; object.description _ NEW [UT.SeqType1Object[3]]; object.description[0].key _ "type"; object.description[0].value _ "Groupware"; object.description[1].key _ "Name"; object.description[1].value _ Rope.Concat["Slate:", Slate.SessionName[session]]; object.description[2].key _ "SessionId"; object.description[2].value _ sessionId; loc.vLocRoom _ location; cl.object _ object; cl.loc _ loc; ForkOps.Fork[LBRegisterPcs, cl]; }; LBRegisterPcs: PROC [data: REF] ~ { ENABLE UNCAUGHT => GOTO Oops; --ChJ. August 20, 1993 I have no real idea what goes wrong but I want no wedging cl: REF LBClosure _ NARROW[data]; [] _ lb.atloc[lb, cl.object^, cl.loc]; EXITS Oops => {}; }; ConnectToLocationBroker: PROC [] = BEGIN ENABLE RuntimeError.UNCAUGHT => GO TO Oops; h: SunRPC.Handle; r: NameService.Registration; [h, r] _ NameService.ImportRPCSun["LocationBroker"]; lb _ LB.MakeLB1Client[h, SunRPCAuth.Initiate[]]; EXITS Oops => {}; END; SessionRenamed: Slate.EventProc = { found: BOOLEAN; val: REF; sr: sessionInfo; location: ROPE; l: LIST OF ROPE; [found, val] _ RefTab.Fetch[sessionTable, session]; sr _ NARROW[val]; IO.PutRope[sr.session.debugLog, "SessionRenamed called\n"]; [] _ NameService.ReexportRPCSun[uid: sr.uid, name: "JoinApp", sp: sr.rpc, prog: JoinApp.JoinAppPrognum, vers: JoinApp.version1, instance: Rope.Concat["Slate:", Slate.SessionName[session]], appl: CONS[ List.DotCons[sessionIdRope, sr.sessionId], NIL] ]; l _ sr.locations; WHILE l # NIL DO location _ l.first; l _ l.rest; RegisterWithLocationBroker[location, sr.session, sr.sessionId]; ENDLOOP; }; ConnectToLocationBroker[]; Slate.RegisterGlobalEventProc[$NewSession, NewSessionEvent]; Slate.RegisterGlobalEventProc[$SessionRenamed0, SessionRenamed]; END. † SlateJoinAppImpl.mesa Copyright Σ 1992, 1993 by Xerox Corporation. All rights reserved. Created by Theimer, December 17, 1992 7:58:24 am PST Theimer, May 5, 1993 2:53 pm PDT Christian Jacobi, August 20, 1993 12:07 pm PDT Tables of sessionInfo records. RPC handle for the LocationBroker. Catch error caused if there is no NMS running. Catch error caused if there is no NMS running. Κ•NewlineDelimiter ™™J™BJ™4J™ J™.—J˜codešΟk ˜ K˜K˜K˜K˜K˜K˜ K˜K˜K˜ K˜ K˜K˜K˜ K˜K˜—K˜šΟbœœ˜Kšœc˜jJšœ˜—š˜K˜Kšœœœ˜K˜Kšœœ˜K˜šœ œœ˜Kšœ œœ˜Kšœœ˜ K˜K˜Kšœ ˜Kšœ ˜K˜—Kšœ œœ ˜#K˜K˜-˜+K™—K˜Kšœœ˜"K˜šœ œœ˜Kšœœ˜Kšœœœ ˜+K˜—K˜˜ K™"—K˜K˜šΟnœ˜$Kšœœ˜"K˜—K˜šŸœ œœœ˜KKš˜šœœœœ˜+K™.—Kšœœ˜Kšœ0œ'˜ZKšœœ ˜#Kšœœœ˜'K˜)K˜ K˜Kšœœœ˜:˜“šœœ˜ ˜*Kšœ˜K˜———K˜4K˜-K˜(Kšœ ˜Kšœ˜—K˜šΠbnœ˜+K˜—K˜š œ!˜4Kšœœœœ˜9Kšœ œ˜Kšœ œ˜Kšœ œ˜Kšœœ˜Kšœ˜ K˜Kšœœ&˜.šœœœ˜Kšœœœœ˜VKšœ"œœ˜EKšœœ#œœ˜LKšœœ$œœ˜OKšœ˜—K˜#K˜7Kšœœ˜Kšœœ˜,Kšœ/˜1K˜0Kšœ&˜(Kšœ;˜=K˜