AccessCHImpl.mesa
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Philip James, March 19, 1992 4:32 pm PST
Laurie Horton, May 6, 1991 5:12 pm PDT
Foote, June 3, 1991 4:47 pm PDT
Christian Jacobi, April 7, 1992 5:38 pm PDT
Willie-s, May 12, 1992 2:17 pm PDT
DIRECTORY
AccessCH,
AdobeCommon,
AdobeP75V2,
IO,
PFS,
PFSNames,
Rope,
SystemSite,
UserProfile,
XNSCredentials,
XNSAuth;
AccessCHImpl: CEDAR PROGRAM IMPORTS AdobeCommon, IO, PFS, PFSNames, Rope, SystemSite, UserProfile, XNSAuth, XNSCredentials EXPORTS AccessCH ~ {
Problem: PUBLIC ERROR[type: AccessCH.TypeCode] = CODE;
GetFullLoginName: PUBLIC PROC [h: AdobeCommon.Handle ¬ NIL] RETURNS[loginName: Rope.ROPE ¬ NIL] ~ {
defaults: SystemSite.Names ¬ SystemSite.Get[];
name: XNSAuth.Name;
identity: XNSAuth.Identity ¬ XNSCredentials.GetIdentity[];
IF identity = NIL THEN
IF h # NIL THEN {
AdobeCommon.PostMessage[h, TRUE, "You must Login!"];
RETURN["Login!"];
}
ELSE
ERROR AdobeCommon.NoCredentials;
[name, , ] ¬ XNSAuth.GetIdentityDetails[identity];
IF name.domain.IsEmpty[] THEN
name.domain ¬ defaults.domain;
IF name.organization.IsEmpty[] THEN
name.domain ¬ defaults.organization;
loginName ¬ name.object.Cat[":", name.domain, ":", name.organization];
};
NSNameFromRope: PUBLIC PROC [r: Rope.ROPE]
RETURNS [nsn: AdobeP75V2.NSName ¬ NIL] ~ {
current: {local, domain, org} ¬ local;
nsn ¬ NEW[AdobeP75V2.NSNameObject ¬ [NIL, NIL, NIL]];
FOR i: CARD IN [0..r.Length) DO
IF r.Fetch[i] = ': THEN
SELECT current FROM
local => current ¬ domain;
domain => current ¬ org;
ENDCASE
ELSE SELECT current FROM
local => nsn.local ¬ nsn.local.Concat[r.Substr[i, 1]];
domain => nsn.domain ¬ nsn.domain.Concat[r.Substr[i, 1]];
org => nsn.org ¬ nsn.org.Concat[r.Substr[i, 1]];
ENDCASE;
ENDLOOP;
};
HostForDatabase: PUBLIC PROC [dataBase: Rope.ROPE]
RETURNS [host: Rope.ROPE ¬ NIL] ~ {
mappings: LIST OF Rope.ROPE ¬ NIL;
dbName, serverName, cred: AdobeP75V2.NSName;
loc, dom, org, db, server: Rope.ROPE ¬ NIL;
nsn: AdobeP75V2.NSName ¬ NSNameFromRope[dataBase];
dataFile: IO.STREAM ¬ NIL;
cred ¬ NSNameFromRope[GetFullLoginName[]];
loc ¬ cred.local;
dom ¬ cred.domain;
org ¬ cred.org;
Check User Entries
mappings ¬ UserProfile.ListOfTokens [key: "Adobe.mappings", default: NIL];
WHILE mappings # NIL DO
db ¬ mappings.first;
IF mappings.rest = NIL THEN
ERROR Problem[badDatabaseName];
server ¬ mappings.rest.first;
mappings ¬ mappings.rest.rest;
dbName ¬ NSNameFromRope[db];
serverName ¬ NSNameFromRope[server];
IF dbName.org = NIL THEN
dbName.org ¬ cred.org;
IF serverName.org = NIL THEN
serverName.org ¬ cred.org;
IF dbName.domain = NIL THEN
dbName.domain ¬ cred.domain;
IF serverName.domain = NIL THEN
serverName.domain ¬ cred.domain;
IF Rope.Equal[dbName.org, nsn.org, FALSE] THEN
IF Rope.Equal[dbName.domain, nsn.domain, FALSE] THEN
IF Rope.Equal[dbName.local, nsn.local, FALSE] THEN
RETURN[Rope.Cat[serverName.local, ":", serverName.domain, ":", serverName.org]];
ENDLOOP;
Check Adobe File Entries -- AdobeClearinghouse.data
These should be cached
{
ENABLE {
IO.Error => GOTO badFile;
IO.EndOfStream => GOTO badFile;
PFS.Error => GOTO badFile;
};
dataFile ¬ PFS.StreamOpen[dataPath];
WHILE NOT dataFile.EndOf[] DO
db ¬ IO.GetRopeLiteral[dataFile];
server ¬ IO.GetRopeLiteral[dataFile];
dbName ¬ NSNameFromRope[db];
serverName ¬ NSNameFromRope[server];
IF dbName.org = NIL THEN
dbName.org ¬ cred.org;
IF serverName.org = NIL THEN
serverName.org ¬ cred.org;
IF dbName.domain = NIL THEN
dbName.domain ¬ cred.domain;
IF serverName.domain = NIL THEN
serverName.domain ¬ cred.domain;
IF Rope.Equal[dbName.org, nsn.org, FALSE] AND Rope.Equal[dbName.domain, nsn.domain, FALSE] AND Rope.Equal[dbName.local, nsn.local, FALSE] THEN
RETURN[Rope.Cat[serverName.local, ":", serverName.domain, ":", serverName.org]];
ENDLOOP;
EXITS
badFile => {} -- wish more could be done here.-- ;
};
Check Default Entries
these should be moved to the File Entries
SELECT TRUE FROM
Rope.Equal[nsn.org, "Xerox", FALSE] => SELECT TRUE FROM
Rope.Equal[nsn.domain, "OSBU North", FALSE] => SELECT TRUE FROM
Rope.Equal[nsn.local, "Customer Call", FALSE],
Rope.Equal[nsn.local, "Customer Profile", FALSE],
Rope.Equal[nsn.local, "Enable Status", FALSE],
Rope.Equal[nsn.local, "Equipment Profile", FALSE],
Rope.Equal[nsn.local, "ExpertARs", FALSE],
Rope.Equal[nsn.local, "ExpertSoftware", FALSE],
Rope.Equal[nsn.local, "XAPS Customers", FALSE] =>
RETURN["Bugheap:OSBU North:Xerox"];
Rope.Equal[nsn.local, "ExtraTest", FALSE] =>
RETURN["ExtraMiwuk:OSBU North:Xerox"];
Rope.Equal[nsn.local, "PA Service", FALSE],
Rope.Equal[nsn.local, "Par", FALSE],
Rope.Equal[nsn.local, "Soleil", FALSE],
Rope.Equal[nsn.local, "System Software", FALSE] =>
RETURN["Morongo:OSBU North:Xerox"];
Rope.Equal[nsn.local, "AdobePortTest", FALSE] =>
RETURN["PCAService:OSBU North:Xerox"];
Rope.Equal[nsn.local, "CedarAdobeTest", FALSE],
Rope.Equal[nsn.local, "EnumTest", FALSE] =>
RETURN["PCedarAdobeTestService:OSBU North:Xerox"];
Rope.Equal[nsn.local, "AT", FALSE],
Rope.Equal[nsn.local, "College AT", FALSE],
Rope.Equal[nsn.local, "Facilities", FALSE],
Rope.Equal[nsn.local, "HWDocs", FALSE],
Rope.Equal[nsn.local, "Moby", FALSE],
Rope.Equal[nsn.local, "SalientDocuments", FALSE],
Rope.Equal[nsn.local, "SDD Action Item Database", FALSE],
Rope.Equal[nsn.local, "SDD Horizon Issues", FALSE],
Rope.Equal[nsn.local, "SDD-OSD Glossary", FALSE],
Rope.Equal[nsn.local, "SUN Inventory", FALSE],
Rope.Equal[nsn.local, "SUN of System Software", FALSE],
Rope.Equal[nsn.local, "Unix Network Services", FALSE] =>
RETURN["Payute:OSBU North:Xerox"];
ENDCASE => {};
Rope.Equal[nsn.domain, "OSBU South", FALSE] => SELECT TRUE FROM
Rope.Equal[nsn.local, "FilingDesignIssues", FALSE] =>
RETURN["CopanAS:OSBU North:Xerox"];
Rope.Equal[nsn.local, "DE Configuration", FALSE],
Rope.Equal[nsn.local, "Documentation", FALSE],
Rope.Equal[nsn.local, "ES Service", FALSE],
Rope.Equal[nsn.local, "Fonts", FALSE],
Rope.Equal[nsn.local, "Fonts Tracking", FALSE],
Rope.Equal[nsn.local, "Image Filing", FALSE],
Rope.Equal[nsn.local, "MPCodes", FALSE],
Rope.Equal[nsn.local, "Network Services", FALSE],
Rope.Equal[nsn.local, "PrintServiceDesign", FALSE],
Rope.Equal[nsn.local, "Product Test Equipment", FALSE],
Rope.Equal[nsn.local, "PSCO Tracking", FALSE],
Rope.Equal[nsn.local, "SPAR", FALSE],
Rope.Equal[nsn.local, "Unix NS Documentation", FALSE],
Rope.Equal[nsn.local, "XGV-PC", FALSE],
Rope.Equal[nsn.local, "XGV-PC Customer", FALSE],
Rope.Equal[nsn.local, "XGV-PC Service", FALSE] =>
RETURN["Mud:OSBU South:Xerox"];
Rope.Equal[nsn.local, "Bitmapper", FALSE],
Rope.Equal[nsn.local, "EFS", FALSE],
Rope.Equal[nsn.local, "Segue Documentation", FALSE],
Rope.Equal[nsn.local, "Soleil", FALSE],
Rope.Equal[nsn.local, "Soleil Unix", FALSE],
Rope.Equal[nsn.local, "Workstation", FALSE] =>
RETURN["Straw:OSBU South:Xerox"];
Rope.Equal[nsn.local, "Unix Workstation", FALSE],
Rope.Equal[nsn.local, "Unix WS Documentation", FALSE] =>
RETURN["Water:OSBU South:Xerox"];
ENDCASE => {};
Rope.Equal[nsn.domain, "PaloAlto", FALSE] => SELECT TRUE FROM
Rope.Equal[nsn.local, "Par", FALSE] =>
RETURN["Morongo:OSBU North:Xerox"];
ENDCASE => {};
Rope.Equal[nsn.domain, "PARC", FALSE] => SELECT TRUE FROM
Rope.Equal[nsn.local, "AdobePortTest", FALSE],
Rope.Equal[nsn.local, "RoadRunnerARs", FALSE] =>
RETURN["Skate:Parc:Xerox"];
Rope.Equal[nsn.local, "Inventory", FALSE] =>
RETURN["Kaos:Parc:Xerox"];
ENDCASE => {};
Rope.Equal[nsn.domain, "Sunnyvale", FALSE] => SELECT TRUE FROM
Rope.Equal[nsn.local, "PTInventory", FALSE] =>
RETURN["CheckItOut:Sunnyvale:Xerox"];
ENDCASE => {};
ENDCASE => {};
ENDCASE => {};
ERROR Problem[badDatabaseName];
};
dataPath: PFS.PATH ¬ PFSNames.ExpandName[name: PFS.PathFromRope["AdobeClearinghouse.data"], wDir: PFS.GetWDir[]];
}.