ASTA Remote Administrative API
Information about Client exes that have been registered on AstaServers for version updates can now be obtained from remote clients using the new RequestUtilityInfo call from the AstaClientSocket. This API was first developed to support the ASTA Anchor Server which does load balancing and Fail over. For an example see Tutorial.UpgradeAdmin
This is an asyncronous request that will bring back a TAstaDataSet that contains information about current Client Exe's that have been registered on an ASTA Server for the autoclient update feature.
You first call AstaClientSocket1.RequestUtilityInfo(uiAutoClientUpgradeInfo, '') and a TAstaDataSet will be returned as part of the Params from the AstaclientSocket.OnServerUtilityInfoEvent.
These Datasets are stored in the TAstaParamList as Strings and they can be converted to Datasets using StringToDataSet (from astadrv2.pas) but you are then responsible for freeing the Dastaset.
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
AstaClientSocket1.RequestUtilityInfo(uiAutoClientUpgradeInfo, '');
end;
procedure TForm1.AstaClientSocket1ServerUtilityInfoEvent(Sender: TObject; MsgID: integer; Params: TAstaParamList);
begin
case MsgID of
Ord(uiAutoClientUpgradeInfo),ord(uiPublishedDirectories): begin
DataSource1.DataSet.Free;
DataSource1.DataSet := StringToDataSet(Params[0].AsString);
end;
end;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
DataSource1.DataSet.Free;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
var
P: TAstaParamList;
begin
if DataSource1.DataSet=nil then raise EDataBaseError.Create('You need fetch a dataset first!');
if DataSource1.DataSet.state in [dsedit, dsinsert] then DataSource1.DataSet.Post;
P := TAstaParamList.Create;
P.FastAdd(DataSetToString(TAstaDataSet(DataSource1.DataSet)));
AstaClientSocket1.RequestUtilityInfo(uiWriteAutoClientUpgradeDataSet, P.AsTokenizedString(False));
P.Free;
end;
procedure TForm1.BitBtn3Click(Sender: TObject);
var
M: TMemoryStream;
P: TAstaParamList;
begin
if not OpenDialog1.Execute then exit;
M := TMemoryStream.Create;
M.LoadFromFile(OpenDialog1.FileName);
P := TAstaParamList.Create;
P.FastAdd('c:\Test.exe');//you have to know where you want to shove it to the server
P.FastAdd('');
P[1].AsStream := M;
M.Free;
AstaClientSocket1.RequestUtilityInfo(uiSaveClientUpgradeExe, P.AsTokenizedString(False));
P.Free;
end;
procedure TForm1.BitBtn4Click(Sender: TObject);
begin
AstaClientSocket1.RequestUtilityInfo(uiPublishedDirectories, '');
end;
procedure TForm1.BitBtn3Click(Sender: TObject);
var
M: TMemoryStream;
P: TAstaParamList;
begin
if not OpenDialog1.Execute then exit;
M := TMemoryStream.Create;
M.LoadFromFile(OpenDialog1.FileName);
P := TAstaParamList.Create;
P.FastAdd('c:\Test.exe');//you have to know where you want to shove it to the server
P.FastAdd('');
P[1].AsStream := M;
M.Free;
AstaClientSocket1.RequestUtilityInfo(uiSaveClientUpgradeExe, P.AsTokenizedString(False));
P.Free;
end;