RecordingServiceRegisterImpl.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Doug Terry, November 18, 1986 5:38:01 pm PST
The voice recording service consists of two components: BluejaySmarts and VoiceRopeServer. BluejaySmarts manages conversations between clients and Bluejay, the voice file server; that is, it speaks ThSmarts protocol. The VoiceRopeServer provides the operations for recording and playing voice in addition to those for editing and expressing interests in voice ropes. For each BluejaySmarts that gets registered with Thrush, exactly one VoiceRopeServer service interface is registered as well.
DIRECTORY
Atom USING [GetPName],
BluejaySmarts USING [infos, JayInfoBody],
Commander USING [ CommandProc, Register ],
CommandTool USING [ NextArgument ],
IO USING [GetInt, RIS],
Jukebox  USING [ CloseJukebox, CreateJukebox, EOF, Error, Handle, MissingChirp, OpenJukebox ],
MBQueue USING [ Create ],
Nice USING [ View ],
RecordingServiceRegister,
RefID  USING [ nullID ],
Rope USING [Cat],
RPC USING [ExportFailed],
ThParty  USING [ Enable, Register, RegisterServiceInterface ],
Thrush  USING [ Credentials, InterfaceSpec, NB, ROPE, SHHH ],
VoiceRopeDB USING [Error, Handle, Open],
VoiceRopeServerRpcControl USING [ExportInterface],
VoiceUtils USING [ CmdOrToken, CurrentPasskey, FindWhere, OwnNetAddress, Problem, RegisterWhereToReport, Report, WhereProc ]
;
RecordingServiceRegisterImpl: CEDAR PROGRAM
IMPORTS Atom, BluejaySmarts, Commander, CommandTool, IO, Jukebox, MBQueue, Nice, RecordingServiceRegister, Rope, RPC, ThParty, VoiceRopeDB, VoiceRopeServerRpcControl, VoiceUtils
EXPORTS RecordingServiceRegister
= {
jayShh: PUBLIC Thrush.SHHH;
interfaceIsImported: PUBLIC BOOLEANFALSE;
encryptionRequested: PUBLIC BOOLEANTRUE;
numParties: PUBLIC NAT𡤀
haveJuke: PUBLIC BOOLTRUE;
jukebox: PUBLIC Jukebox.Handle;
database: PUBLIC VoiceRopeDB.Handle;
defaultNumSmarts: NAT = 5; -- number of smarts created by default
PD: TYPE = RECORD [
doReports: BOOLFALSE,
doNice: BOOLFALSE,
jayInitialized: BOOLFALSE
];
pd: REF PDNEW[PD←[]];
voiceRopeSpec: Thrush.InterfaceSpec ← [
interfaceName: [type: "VoiceRopeServer"], serviceID: RefID.nullID];
Init: Commander.CommandProc = {
numTrunks: NAT ← defaultNumSmarts;
nb: Thrush.NB;
bluejayInstance, thrushInstance, jukeboxName, databaseName, serverPassword: Thrush.ROPE;
credentials: Thrush.Credentials;
bluejayInstance ← CommandTool.NextArgument[cmd];
IF bluejayInstance#NIL THEN numTrunks ← IO.GetInt[IO.RIS[bluejayInstance]];
jukeboxName ←
VoiceUtils.CmdOrToken[cmd:cmd, key: "BluejayJukeboxName", default: "Strowger.Jukebox"];
databaseName ←
VoiceUtils.CmdOrToken[cmd:cmd, key: "VoiceRopeDBName", default: "VoiceRopeDB.df"];
bluejayInstance ←
VoiceUtils.CmdOrToken[cmd:cmd, key: "BluejayServerInstance", default: "Strowger.Lark"];
thrushInstance ←
VoiceUtils.CmdOrToken[cmd:cmd, key:"ThrushClientServerInstance", default: "Strowger.Lark"];
serverPassword ←
VoiceUtils.CmdOrToken[cmd: cmd, key: "BluejayServerPassword", default: "MFLFLX"];
IF pd.jayInitialized THEN RETURN;
Initialize anything that has to be set up on the Jay side.
VoiceUtils.RegisterWhereToReport[ReportBluejay, $Bluejay];
VoiceUtils.RegisterWhereToReport[ReportBluejay, $VoiceRope];
haveJuke←TRUE;
TRUSTED {
jukebox ← Jukebox.OpenJukebox[name: jukeboxName!
Jukebox.Error => IF reason= NoJukebox THEN {
haveJuke←FALSE; CONTINUE; }];
IF ~haveJuke THEN {
Jukebox.CreateJukebox[jukeboxName, 5000, 100];
jukebox ← Jukebox.OpenJukebox[jukeboxName];
};
};
haveJuke←TRUE;
database ← VoiceRopeDB.Open[databaseName !
VoiceRopeDB.Error => {
VoiceUtils.Problem[Rope.Cat[Atom.GetPName[ec]," - ",explanation], $VoiceRope];
GOTO InitFailed; }
];
Export/Import interfaces, create first Jay party and smarts.
[nb, credentials] ←
RecordingServiceRegister.BluejayRegister[bluejayInstance, thrushInstance, serverPassword];
IF nb#$success THEN GOTO InitFailed;
{
voiceRopeSpec.interfaceName.instance ← NIL; -- created that way. ThParty assigns one.
voiceRopeSpec.serviceID ← credentials.smartsID;
[nb, voiceRopeSpec] ← ThParty.RegisterServiceInterface[credentials: credentials,
interfaceSpecPattern: voiceRopeSpec];
SELECT nb FROM $success, $stateMismatch => NULL; ENDCASE => GOTO CantExportVoice;
VoiceRopeServerRpcControl.ExportInterface[
voiceRopeSpec.interfaceName, bluejayInstance,
VoiceUtils.CurrentPasskey[serverPassword]!RPC.ExportFailed => GOTO CantExportVoice];
EXITS
CantExportVoice =>
VoiceUtils.Problem["Couldn't export VoiceRopeServer from RecordingService"];
};
VoiceUtils.Report["Bluejay Smarts and VoiceRope Service initialized and exported, ThParty imported", $Bluejay];
Get Jay Parties
FOR i: NAT IN [0..numTrunks) DO
IF i#0 THEN {
[nb, credentials] ← ThParty.Register[
shh: jayShh, interface: ["Foo"],
clonePartyID: credentials.partyID,
properties: [ role: $voiceTerminal, netAddress: VoiceUtils.OwnNetAddress[]]
];
IF nb#$success THEN ERROR;
voiceRopeSpec.serviceID ← credentials.smartsID;
[nb,] ← ThParty.RegisterServiceInterface[credentials: credentials,
interfaceSpecPattern: voiceRopeSpec];
IF nb#$success THEN ERROR;
};
IF ThParty.Enable[shh: jayShh, smartsID: credentials.smartsID]#$success
THEN ERROR; -- <<!!!!!!!!!>> --
BluejaySmarts.infos[numParties]←
NEW[BluejaySmarts.JayInfoBody ← [credentials: credentials, shh: jayShh, notifications: MBQueue.Create[]]];
numParties←numParties+1;
ENDLOOP;
pd.jayInitialized ← TRUE;
EXITS
InitFailed => TRUSTED {
VoiceUtils.Problem["Bluejay: initialization failed", $Bluejay];
IF haveJuke THEN jukebox ← Jukebox.CloseJukebox[jukebox!
Jukebox.Error, Jukebox.MissingChirp, Jukebox.EOF=>CONTINUE];
jayShh←NIL;
};
};
ReportBluejay: VoiceUtils.WhereProc = TRUSTED {
s←VoiceUtils.FindWhere[$System, NIL];
};
Debugging nonsense
ViewCmd: Commander.CommandProc = {
Nice.View[pd, "Bluejay PD"];
};
Commander.Register["VuJay", ViewCmd, "Program Management variables for Bluejay"];
Commander.Register["VRS", Init, "VRS <numSmarts> <jukeboxName> <databaseName> <instanceName> <thrushInstance> <serverPassword> (all defaulted) -- Start voice recording service\n VRS 5 ///Morley/Morley.jukebox ///Morley/VoiceRopeDB.df Morley.Lark Morley.Lark MFLFLX"];
}.
Doug Terry, July 30, 1986 11:19:26 am PDT
Moved registration from BluejaySmarts to this module so that BluejaySmarts need not reference VoiceRopeServer.
changes to: DIRECTORY, RecordingServiceRegister, Init
Doug Terry, July 30, 1986 11:53:43 am PDT
changes to: DIRECTORY, RecordingServiceRegister, Init
Doug Terry, October 8, 1986 10:10:10 am PDT
changes to: RecordingServiceRegister
Doug Terry, November 18, 1986 3:55:46 pm PST
Now exports RecordingServiceRegister.
changes to: RecordingServiceRegisterImpl, Init, DIRECTORY
Doug Terry, November 18, 1986 5:38:01 pm PST
changes to: RecordingServiceRegisterImpl