DIRECTORY
IO,
NamesGV,
NamesGVRpcControl,
Pup USING [ nullSocket ],
Rope USING [ ROPE ],
RPC,
RPCLupine,
RPCLupineExtras,
UserProfile USING [ Token ],
VoiceUtils USING [ NetAddress, NetAddressFromRope, nullNetAddress, Problem ]
;
NamesGVClientImpl:
CEDAR PROGRAM
IMPORTS IO, RealControl: NamesGVRpcControl, RealNamesGV: NamesGV, RPC, UserProfile, VoiceUtils
EXPORTS NamesGV, NamesGVRpcControl = {
OPEN IO, NamesGV;
gvInterfaceName: RealControl.InterfaceName ← [
type: "NamesGV.Lark",
instance: UserProfile.Token[key: "NamesGVInstance", default: "Strowger.Lark"]];
importHostHint: VoiceUtils.NetAddress ← [[173B],[270B], Pup.nullSocket]; -- Growler is default!
imported: BOOL←FALSE;
Protected versions of NamesGV Procedures
GVGetAttribute:
PUBLIC
PROCEDURE [rName:
ROPE, attribute:
ATOM, default:
ROPE]
RETURNS [value: ROPE←NIL] = { reopening: BOOL←FALSE; {
ENABLE
RPC.CallFailed => IF PostError[why] THEN RETRY ELSE CONTINUE;
IF (~imported) AND (~PostError[$unbound]) THEN RETURN;
RETURN[RealNamesGV.GVGetAttribute[rName, attribute, default]];
}; };
GVSetAttribute:
PUBLIC
PROCEDURE [rName:
ROPE, attribute:
ATOM, value:
ROPE]
= { reopening: BOOL←FALSE; {
ENABLE
RPC.CallFailed => IF PostError[why] THEN RETRY ELSE CONTINUE;
IF (~imported) AND (~PostError[$unbound]) THEN RETURN;
RealNamesGV.GVSetAttribute[rName, attribute, value];
}; };
GVGetAttributeSeq:
PUBLIC
PROCEDURE [rName:
ROPE, attribute:
ATOM]
RETURNS [value: AttributeSeq←NIL] = { reopening: BOOL←FALSE; {
ENABLE
RPC.CallFailed => IF PostError[why] THEN RETRY ELSE CONTINUE;
IF (~imported) AND (~PostError[$unbound]) THEN RETURN;
RETURN[RealNamesGV.GVGetAttributeSeq[rName, attribute]];
}; };
GVSetAttributeSeq:
PUBLIC
PROCEDURE[rName:
ROPE, attribute:
ATOM, value: AttributeSeq]
= { reopening: BOOL←FALSE; {
ENABLE
RPC.CallFailed => IF PostError[why] THEN RETRY ELSE CONTINUE;
IF (~imported) AND (~PostError[$unbound]) THEN RETURN;
RealNamesGV.GVSetAttributeSeq[rName, attribute, value];
}; };
GVGetAttributes:
PUBLIC
PROCEDURE [rName:
ROPE]
RETURNS [value: AttributeSeq←NIL] = { reopening: BOOL←FALSE; {
ENABLE
RPC.CallFailed => IF PostError[why] THEN RETRY ELSE CONTINUE;
IF (~imported) AND (~PostError[$unbound]) THEN RETURN;
RETURN[RealNamesGV.GVGetAttributes[rName]];
}; };
GVAuthenticate:
PUBLIC
PROCEDURE [rName:
ROPE, key:
RPC.EncryptionKey]
RETURNS [authenticity: Authenticity←unknown] = { reopening: BOOL←FALSE; {
ENABLE
RPC.CallFailed => IF PostError[why] THEN RETRY ELSE CONTINUE;
IF (~imported) AND (~PostError[$unbound]) THEN RETURN;
RETURN[RealNamesGV.GVAuthenticate[rName, key]];
}; };
GVIsAuthenticated:
PUBLIC
PROCEDURE [rName:
ROPE]
RETURNS [authenticity: Authenticity←unknown] = { reopening: BOOL←FALSE; {
ENABLE
RPC.CallFailed => IF PostError[why] THEN RETRY ELSE CONTINUE;
IF (~imported) AND (~PostError[$unbound]) THEN RETURN;
RETURN[RealNamesGV.GVIsAuthenticated[rName]];
}; };
GVUpdate:
PUBLIC
PROCEDURE [rName:
ROPE]
= { reopening: BOOL←FALSE; {
ENABLE
RPC.CallFailed => IF PostError[why] THEN RETRY ELSE CONTINUE;
IF (~imported) AND (~PostError[$unbound]) THEN RETURN;
RealNamesGV.GVUpdate[rName];
}; };
GVUpdateAll:
PUBLIC
PROCEDURE
= { reopening: BOOL←FALSE; {
ENABLE
RPC.CallFailed => IF PostError[why] THEN RETRY ELSE CONTINUE;
IF (~imported) AND (~PostError[$unbound]) THEN RETURN;
RealNamesGV.GVUpdateAll[];
}; };
GVWait:
PUBLIC
PROCEDURE
= { reopening: BOOL←FALSE; {
ENABLE
RPC.CallFailed => IF PostError[why] THEN RETRY ELSE CONTINUE;
IF (~imported) AND (~PostError[$unbound]) THEN RETURN;
RealNamesGV.GVWait[];
}; };
GVFlushCache:
PUBLIC
PROCEDURE
= { reopening: BOOL←FALSE; {
ENABLE
RPC.CallFailed => IF PostError[why] THEN RETRY ELSE CONTINUE;
IF (~imported) AND (~PostError[$unbound]) THEN RETURN;
RealNamesGV.GVFlushCache[];
}; };
GVSaveCache:
PUBLIC
PROCEDURE
= { reopening: BOOL←FALSE; {
ENABLE
RPC.CallFailed => IF PostError[why] THEN RETRY ELSE CONTINUE;
IF (~imported) AND (~PostError[$unbound]) THEN RETURN;
RealNamesGV.GVSaveCache[];
}; };
GVRestoreCache:
PUBLIC
PROCEDURE
= { reopening: BOOL←FALSE; {
ENABLE
RPC.CallFailed => IF PostError[why] THEN RETRY ELSE CONTINUE;
IF (~imported) AND (~PostError[$unbound]) THEN RETURN;
RealNamesGV.GVRestoreCache[];
}; };
GVHostFromInstance:
PUBLIC
PROCEDURE [instance: Rope.
ROPE]
RETURNS [VoiceUtils.NetAddress←VoiceUtils.nullNetAddress] = { reopening: BOOL←FALSE; {
ENABLE
RPC.CallFailed => IF PostError[why] THEN RETRY ELSE CONTINUE;
IF (~imported) AND (~PostError[$unbound]) THEN RETURN;
RETURN[RealNamesGV.GVHostFromInstance[instance]];
}; };
We don't intercept errors here, in case clients want to be careful during initial importing. Later, we do intercept them, catch them, and render them relatively harmless. Probably ought to be a registered error routine instead, or an ERROR originating here.
ImportInterface:
PUBLIC
PROCEDURE [
interfaceName: RPC.InterfaceName,
parameterStorage: RPC.Zones ← RealControl.standardZones,
hostHint: RPCLupineExtras.RPCHost←RPCLupineExtras.noHost
] = {
hostHint ← importHostHint;
imported ← FALSE;
IF interfaceName.instance=NIL THEN interfaceName ← gvInterfaceName
ELSE gvInterfaceName ← interfaceName;
RealControl.ImportInterface[interfaceName, parameterStorage, hostHint];
importHostHint ← VoiceUtils.NetAddressFromRope[
RealNamesGV.GVGetAttribute[gvInterfaceName.instance, $connect, NIL!RPC.CallFailed => CONTINUE]];
};
UnimportInterface:
PUBLIC
PROCEDURE =
TRUSTED {
imported ← FALSE;
RealControl.UnimportInterface[];
};
}.