git-svn-id: https://192.168.0.254/svn/Componentes.Terceros.RemObjects@2 b6239004-a887-0f4b-9937-50029ccdca16
95 lines
2.9 KiB
ObjectPascal
95 lines
2.9 KiB
ObjectPascal
unit uROLocalChannel;
|
|
|
|
{----------------------------------------------------------------------------}
|
|
{ RemObjects SDK Library - Core components }
|
|
{ }
|
|
{ compiler: Delphi 5 and up, Kylix 2 and up }
|
|
{ platform: Win32, Linux }
|
|
{ }
|
|
{ (c)opyright RemObjects Software. all rights reserved. }
|
|
{ }
|
|
{ Using this code requires a valid license of the RemObjects SDK }
|
|
{ which can be obtained at http://www.remobjects.com. }
|
|
{----------------------------------------------------------------------------}
|
|
|
|
{$I RemObjects.inc}
|
|
|
|
interface
|
|
|
|
uses
|
|
{$IFDEF REMOBJECTS_TRIAL}uROTrial,{$ENDIF}
|
|
Classes, uROClient, uROClientIntf, uROLocalServer;
|
|
|
|
type
|
|
TROLocalChannel = class(TROTransportChannel)
|
|
private
|
|
fServerChannel: TROLocalServer;
|
|
protected
|
|
function GetTransportObject: TObject; override;
|
|
procedure IntDispatch(aRequest: TStream; aResponse: TStream); override;
|
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
|
public
|
|
procedure CheckProperties; override;
|
|
constructor Create(aOwner : TComponent); override;
|
|
published
|
|
property ServerLocators;
|
|
property DispatchOptions;
|
|
property ServerChannel: TROLocalServer read fServerChannel write fServerChannel;
|
|
property OnLoginNeeded;
|
|
property OnSendStream;
|
|
property OnReceiveStream;
|
|
end;
|
|
|
|
implementation
|
|
uses
|
|
uROClasses;
|
|
{ TROLocalChannel }
|
|
|
|
procedure TROLocalChannel.CheckProperties;
|
|
begin
|
|
inherited;
|
|
Check(ServerChannel = nil, Name + '.ServerChannel must be assigned.');
|
|
ServerChannel.CheckProperties;
|
|
end;
|
|
|
|
constructor TROLocalChannel.Create(aOwner: TComponent);
|
|
begin
|
|
inherited;
|
|
ThreadSafe := true;
|
|
end;
|
|
|
|
function TROLocalChannel.GetTransportObject: TObject;
|
|
begin
|
|
Result := self;
|
|
end;
|
|
|
|
procedure TROLocalChannel.IntDispatch(aRequest, aResponse: TStream);
|
|
begin
|
|
CheckProperties;
|
|
|
|
{$IFDEF DESIGNTIME}
|
|
{$IFDEF MSWINDOWS}
|
|
if csDesigning in ComponentState then
|
|
raise EROIDEProblem.Create('We''re sorry, but the '+ClassName+' cannot be used inside the Delphi IDE at designtime.');
|
|
{$ENDIF MSWINDOWS}
|
|
{$ENDIF DESIGNTIME}
|
|
|
|
fServerChannel.SendRequest(aRequest, aResponse);
|
|
end;
|
|
|
|
procedure TROLocalChannel.Notification(AComponent: TComponent;
|
|
Operation: TOperation);
|
|
begin
|
|
inherited;
|
|
if (Operation=opRemove) and
|
|
(AComponent=fServerChannel) then fServerChannel := NIL;
|
|
end;
|
|
|
|
initialization
|
|
RegisterTransportChannelClass(TROLocalChannel);
|
|
|
|
finalization
|
|
UnRegisterTransportChannelClass(TROLocalChannel);
|
|
|
|
end.
|