Single-tier IntraWeb and RemObjects DataAbstract server PDF Print E-mail
Written by Bernhard Fischer   
Tuesday, 20 February 2007
Article Index
Single-tier IntraWeb and RemObjects DataAbstract server
Page 2
Page 3
Page 4
Page 5
Page 6
Page 7
Page 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:
  • TDAConnectionManager
  • TDADriverManager
  • TDAIBXDriver

From the Remobjects SDK tab:

  • TROBinMessage
  • TROLocalServer

There are a few settings to be entered for some of the components. In the object inspector, click on the TROLocalServer's property Dispatchers to link the server component to the message component. Then click on Add and select the existing messageServer from the Message dropdown List:


click to enlarge

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.


click to enlarge


[click to collapse source code]

 
 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:

  • TROLocalChannel
  • TROBinMessage
  • TRORemoteService

 

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.

click to enlarge



Last Updated ( Friday, 18 January 2008 )
 
Next >