|
Any kbmMW based application server can be repository enabled very simply by
adding a few lines of codes in its start up code.
Using the standard BDE application server demo, it is repository enabled by
adding at least one repository component (optionally more can be added) and the
following code:
procedure TForm1.Button1Click(Sender:
TObject); var id:string; begin // Try to get configuration from
remote repository. // If that fails, get from
local.
id:=kbmMWServer1.GetUniqueIdentifier; if
kbmMWMServerRemoteRepository1.LoadFromRepository(id)
then
kbmMWMServerRemoteRepository1.Apply else if
kbmMWMServerFileRepository1.LoadFromRepository(id)
then
kbmMWMServerFileRepository1.Apply;
// Activate
server.
kbmMWServer1.Active:=true; Label3.Caption :=
'Listening'; end;
Essentially this tries to load the configuration from a remote repository
server, and if that fails of some reason, it will load the configuration from a
local file based repository. More repositories can be defined and can be
accessed in similar way. Its even possible to distribute parts of the
configuration to different repositories if that is desirable.
If the application server should be accessible from a management console, a
management service must be included in the application server. That is done by
including one additional service registration line at the place where
services normally are registered:
sd:=kbmMWServer1.RegisterService(TkbmMWInventoryService,false);
sd:=kbmMWServer1.RegisterServiceByName('KBMMW_QUERY',TTestQuery,false);
sd:=kbmMWServer1.RegisterService(TkbmMWMgmtService,false);
Its as simple as that.
(Top)
|