| Single-tier IntraWeb and RemObjects DataAbstract server |
|
|
|
| Written by Bernhard Fischer | ||||||||||
| Tuesday, 20 February 2007 | ||||||||||
Page 3 of 8 As the IW application serves the clients' requests in threads, we will use a global datamodule for the common components we need in the server-wide context, and a client datamodule to create instances from for each user session. The client module is the auto-generated unit we adapted above (SessionDataModule). So now we need another datamodule. We call it GlobalDataModule and save it as uGlobalDataModule.pas. Here we must drop some of the RO/DA components. In our single-tier application we will use the RO LocalServer - it was designed for exactly this purpose. It allows access to the RODA services in the same application. So this component belongs in the global datamodule, accompanied by some other required components we drop here: From the DataAbstract component tab:
From the Remobjects SDK tab:
Now you can close the dialog. Of course you need to link the connection manager with the driver manager via the connection manager's DriverManager property now, as usual. We add a initialization and finalization section to create /destroy the global datamodule, and that's all we have to do in this unit.
unit uGlobalDataModule;
interface
uses
SysUtils,
Classes,
uROClient,
uROBinMessage,
uDAEngine,
uDAIBXDriver,
uDADriverManager,
uDAClasses,
uROServer,
uROLocalServer;
type
TGlobalDataModule = class(TDataModule)
serverLocal: TROLocalServer;
mgrConnections: TDAConnectionManager;
mgrDrivers: TDADriverManager;
driverIBX: TDAIBXDriver;
messageServer: TROBinMessage;
end;
var
GlobalDataModule: TGlobalDataModule;
implementation
{$R *.dfm}
initialization //**addedd**
GlobalDataModule := TGlobalDataModule.Create(nil); //**added**
finalization //**addedd**
FreeAndNil(GlobalDataModule); //**added**
end.
Now that we defined the global (in a 2-tier scenario: server-side) part of the RO communication layer, we complete the session (client-side) part: In the SessionDataModule, drop the following components: From the Remobjects SDK tab:
Set the TROLocalChannel's ServerChannel property to its counterpart on the global datamodule, GlobalDataModule.serverLocal, and link the TRORemoteService's poperties Message and Channel to messageSession and channelLocal. Enter DataService in the RemoteService property. |
||||||||||
| Last Updated ( Friday, 18 January 2008 ) | ||||||||||
| Next > |
|---|



