|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: B T
Length: 7341 (0x1cad)
Types: TextFile
Names: »B«
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
└─⟦129cab021⟧ »DATA«
└─⟦this⟧
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
└─⟦6f12a12be⟧ »DATA«
└─⟦this⟧
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
└─⟦d65440be7⟧ »DATA«
└─⟦this⟧
with Agent;
with Behavior_Defs;
with Calendar;
with Identifier;
with Message;
with Message_Transport;
with Method;
with Parameter;
with Signature;
with Time_Utilities;
with Text_Io;
use Text_Io;
package body Daemon is
Count : Integer := 0;
Log_Server : Identifier.Object;
procedure Publish (Self : Identifier.Object) is
Status : Message_Transport.Status_Code;
begin
Behavior_Defs.Send_Message
(Message => Message.Create
(Class => Message.Publication,
Addressee => Identifier.Hash
(Id => Identifier.Broker),
Sender => Identifier.Hash (Id => Self),
Method => "count",
Parameter_Name => "count",
Parameter_Class => "string",
Parameter_Value => Parameter.Void),
Status => Status);
end Publish;
procedure Process_Message
(Message : Standard.Message.Object; Handled : out Boolean);
package A is new Agent (Publish, Process_Message);
procedure Actor is
Status : Message_Transport.Status_Code;
Mes : Message.Object;
Met : Method.Object;
Sig : Signature.Object;
Iter : Signature.Iterator;
Par : Parameter.Object;
Expired : Boolean;
use Calendar;
use Message_Transport;
Interval : constant Duration := 10.0;
Next_Time : Time := Clock + Interval;
begin
Behavior_Defs.Send_Message
(Message => Message.Create
(Class => Message.Request,
Addressee => Identifier.Hash (Identifier.Broker),
Sender => Identifier.Hash (Id => A.Get_Identity),
Method => "log_server",
Parameter1_Name => "display",
Parameter1_Class => "string",
Parameter1_Value => "grenouille:0",
Parameter2_Name => "identifier",
Parameter2_Class => "string",
Parameter2_Value => Parameter.Void),
Status => Status);
Put_Line ("actor: request for log_server sent, we wait for reply");
A.Wait_For_Reply (Message => Mes, Time_Out => 5.0, Expired => Expired);
if Expired then
Put_Line ("actor: time out expired, there is no log server");
else
Put_Line ("actor: received reply => " & Message.Image (Mes));
end if;
Met := Message.Get_Method (Mes);
if Method.Get_Name (Met) = "LOG_SERVER" then
Put_Line ("actor: found a log server");
Signature.Init (Iter, Method.Get_Signature (Met));
Signature.Next (Iter);
Par := Signature.Value (Iter);
Put_Line ("actor: id => " & Parameter.Get_Value (Par));
Log_Server := Identifier.Value
(Integer'Value (Parameter.Get_Value (Par)));
end if;
loop
Put_Line ("actor: we delay");
delay Next_Time - Clock;
Put_Line ("actor: delay is over");
Behavior_Defs.Send_Message
(Message => Message.Create
(Class => Message.Request,
Addressee => Identifier.Hash
(Id => Identifier.Broker),
Sender => Identifier.Hash (Id => A.Get_Identity),
Method => "date",
Parameter_Name => "date",
Parameter_Class => "string",
Parameter_Value => Parameter.Void),
Status => Status);
Put_Line ("actor: request sent, we wait for reply");
A.Wait_For_Reply
(Message => Mes, Time_Out => 5.0, Expired => Expired);
Put_Line ("actor: we do no more wait");
if not Expired then
Put_Line ("actor: received reply => " & Message.Image (Mes));
Met := Message.Get_Method (Mes);
if Method.Get_Name (Met) = "DATE" then
Signature.Init (Iter, Method.Get_Signature (Met));
Par := Signature.Value (Iter);
Behavior_Defs.Send_Message
(Message =>
Message.Create
(Class => Message.Forward,
Addressee => Identifier.Hash (Id => Log_Server),
Sender => Identifier.Hash (Id => A.Get_Identity),
Method => "log_line",
Parameter_Name => "message",
Parameter_Class => "string",
Parameter_Value => "Daemon: time => " &
Parameter.Get_Value (Par)),
Status => Status);
if Status = Ok then
Put_Line ("+++ forwarded message to Log_Server");
else
Put_Line
("*** failed forwarding message to Log_Server");
end if;
else
Put_Line ("actor: *** did not receive date");
Put_Line ("actor: --- received reply => " &
Message.Image (Mes));
end if;
else
Put_Line ("actor: time_out has expired");
end if;
Next_Time := Next_Time + Interval;
end loop;
end Actor;
package Core is new A.Core (Actor);
procedure Process_Message
(Message : Standard.Message.Object; Handled : out Boolean) is
Status : Message_Transport.Status_Code;
use Message_Transport;
begin
if Method.Get_Name (Standard.Message.Get_Method (Message)) =
"count" then
New_Line;
Put_Line ("+++ satisfying request for count");
Behavior_Defs.Send_Message
(Message => Standard.Message.Create
(Class => Standard.Message.Forward,
Addressee =>
Standard.Message.Get_Sender (Message),
Sender => Identifier.Hash (A.Get_Identity),
Method => "count",
Parameter_Name => "count",
Parameter_Class => "string",
Parameter_Value => Integer'Image (Count)),
Status => Status);
if Status = Ok then
Put_Line ("--- asking broker to forward");
else
Put_Line ("*** failed asking broker to forward");
end if;
Handled := True;
else
Handled := False;
end if;
end Process_Message;
procedure Start is
begin
Put_Line ("+++ Starting Daemon ");
Core.Start;
end Start;
end Daemon;