[
Back ]
-- server.rpd
-- michael chen
-- august 12, 1996
-- server modules
type HTTPServer is interface
action in Request(A : Action_Type; I : Integer);
out HTMLPage(I : Integer), Log_Address(I : Integer);
behavior
begin
(?I in Integer) Request(Document_Request, ?I) ||>
HTMLPage(?I) || Log_Address(?I);;
end HTTPServer;
type SessionServer is interface
action in Request(A : Action_Type; D : Diagram_ID; I : Integer),
Database_Ack(R : Response_Type; I : Integer);
out Response(R : Response_Type; I : Integer),
Database_Request(A : Action_Type; D : Diagram_ID; I : Integer),
ToCoach(A : Action_Type; I : Integer),
ToConMan(A : Action_Type; D : Diagram_ID; I : Integer);
requires
function Latency(A : Action_Type; T : Integer) return integer;
behavior
action Temp(I : Integer);
begin
(?A in Action_Type, ?D in Diagram_ID, ?I in Integer, ?T in Integer)
Request(?A, ?D, ?I) at ?T ||>
if ?A = Reference_This then
Response(Add_To_InBox, ?I);
elsif ?A = List_Inquiry_Diagram then
Temp(?T);
Database_Request(?A, ?D, ?I) after Latency(?A, ?T);
else
ToCoach(?A, ?I);
if not (?A = Request_Advice) then
Temp(?T);
Database_Request(?A, ?D, ?I) after Latency(?A, ?T);
if not (?A = Exit_Diagram) then
ToConMan(?A, ?D, ?I);
end if;
end if;
end if;;
(?R in Response_Type, ?I in Integer) Database_Ack(?R, ?I) ||>
Response(?R, ?I);;
end SessionServer;
type Logfile is interface
action in In_Address(I : Integer);
out Out_Address(I : Integer);
behavior
begin
(?I in Integer) In_Address(?I) ||> Out_Address(?I);;
end Logfile;
type Tracker is interface
action in Address(I : Integer);
end WWWTracker;
type Postgres is interface
action in Query(I : Integer),
Request(A : Action_Type; D : Diagram_ID; I : Integer);
out QueryResponse(I : Integer), Ack(R : Response_Type; I : Integer);
behavior
begin
(?I in Integer) Query(?I) ||> QueryResponse(?I);;
(?D in Diagram_ID, ?I in Integer) Request(Add_Node, ?D, ?I) ||>
Ack(Node_Added, ?I);;
(?D in Diagram_ID, ?I in Integer) Request(Delete_Node, ?D, ?I) ||>
Ack(NodeID_Inactive, ?I);;
(?D in Diagram_ID, ?I in Integer) Request(New_Inquiry_Diagram, ?D, ?I) ||>
Ack(New_GraphID, ?I);;
(?D in Diagram_ID, ?I in Integer) Request(List_Inquiry_Diagram, ?D, ?I) ||>
Ack(List_Of_Titles, ?I);;
(?D in Diagram_ID, ?I in Integer) Request(Open_Inquiry_Diagram, ?D, ?I) ||>
Ack(List_Of_Objects, ?I);;
(?D in Diagram_ID, ?I in Integer) Request(Add_Edge, ?D, ?I) ||>
Ack(Edge_Added, ?I);;
(?D in Diagram_ID, ?I in Integer) Request(Update_Node, ?D, ?I) ||>
Ack(Node_Updated, ?I);;
(?D in Diagram_ID, ?I in Integer) Request(Move_Node, ?D, ?I) ||>
Ack(Node_Moved, ?I);;
(?D in Diagram_ID, ?I in Integer) Request(Delete_Edge, ?D, ?I) ||>
Ack(EdgeID_Inactive, ?I);;
(?D in Diagram_ID, ?I in Integer) Request(Exit_Diagram, ?D, ?I) ||> null;;
end Postgres;
type Coach is interface
action in QueryResponse(I : Integer), ToCoach(A : Action_Type; I : Integer);
out DatabaseQuery(I : Integer), Advice(I : Integer);
behavior
begin
(?A in Action_Type, ?I in Integer) ToCoach(?A, ?I) ||>
if ?A = Request_Advice then
DatabaseQuery(?I);
end if;;
(?I in Integer) QueryResponse(?I) ||> Advice(?I);;
end Coach;
type ConnectionManager is interface
action in UpdateToConMan(A : Action_Type; D : Diagram_ID; I : Integer);
out Notify(A : Action_Type; D : Diagram_ID; I : Integer);
behavior
DA : array [Integer] of Ref(Diagram_ID) is
(1..Num_Clients, default is Nil(Diagram_ID));
begin
(?A in Action_Type, ?D in Diagram_ID, ?I in Integer)
UpdateToConMan(?A, ?D, ?I) ||>
if ?A = Open_Inquiry_Diagram then
DA[?I] := ?D;
else
for J : Integer in 1..Num_Clients do
if not (J = ?I) And not (DA[J].Is_Nil()) then
if $(DA[J]) = ?D then
Notify(?A, ?D, J);
end if;
end if;
end for;
end if;;
end ConnectionManager;
type Server is interface
action in Server_Request(U : URL_Type; A : Action_Type; D : Diagram_ID;
I: Integer);
out HTMLPage(I : Integer), Advice(I : Integer),
Response(R : Response_Type; I : Integer),
Notify(A : Action_Type; D : Diagram_ID; I : Integer);
requires
function Latency(A : Action_Type; T : Integer) return integer;
end Server;
architecture ServerArch() for Server is
HTTP : HTTPServer;
SESS : SessionServer;
LOG : Logfile;
TRAC : Tracker;
POST : Postgres;
COACH : Coach;
CONMAN : ConnectionManager;
connect
(?A in Action_Type, ?D in Diagram_ID, ?I in Integer)
Server_Request(1, ?A, ?D, ?I) ||> HTTP.Request(?A, ?I);
(?A in Action_Type, ?D in Diagram_ID, ?I in Integer)
Server_Request(2, ?A, ?D, ?I) ||> SESS.Request(?A, ?D, ?I);
(?I in Integer) HTTP.Log_Address(?I) ||> LOG.In_Address(?I);
(?I in Integer) LOG.Out_Address(?I) ||> TRAC.Address(?I);
(?A in Action_Type, ?D in Diagram_ID, ?I in Integer)
SESS.Database_Request(?A, ?D, ?I) ||> POST.Request(?A, ?D, ?I);
(?R in Response_Type, ?I in Integer) POST.Ack(?R, ?I) ||>
SESS.Database_Ack(?R, ?I);
(?A in Action_Type, ?I in Integer) SESS.ToCoach(?A, ?I) ||>
COACH.ToCoach(?A, ?I);
(?R in Response_Type, ?I in Integer) SESS.Response(?R, ?I) ||>
Response(?R, ?I);
(?I in Integer) COACH.DatabaseQuery(?I) ||> POST.Query(?I);
(?I in Integer) POST.QueryResponse(?I) ||> COACH.QueryResponse(?I);
(?I in Integer) COACH.Advice(?I) ||> Advice(?I);
(?I in Integer) HTTP.HTMLPage(?I) ||> HTMLPage(?I);
(?A in Action_Type, ?D in Diagram_ID, ?I in Integer)
SESS.ToConMan(?A, ?D, ?I) ||> CONMAN.UpdateToConMan(?A, ?D, ?I);
(?A in Action_Type, ?D in Diagram_ID, ?I in Integer)
CONMAN.Notify(?A, ?D, ?I) ||> Notify(?A, ?D, ?I);
(?A in Action_Type, ?T in Integer) SESS.Latency(?A, ?T) to Latency(?A, ?T);
end ServerArch;
[
Back ]