Componentes.Terceros.RemObj.../internal/6.0.43.801/1/RemObjects Samples/Data Abstract for Delphi/DA SQL/DASampleLibrary_Intf.pas

486 lines
16 KiB
ObjectPascal
Raw Normal View History

unit DASampleLibrary_Intf;
{----------------------------------------------------------------------------}
{ This unit was automatically generated by the RemObjects SDK after reading }
{ the RODL file associated with this project . }
{ }
{ Do not modify this unit manually, or your changes will be lost when this }
{ unit is regenerated the next time you compile the project. }
{----------------------------------------------------------------------------}
{$I RemObjects.inc}
interface
uses
{vcl:} Classes, TypInfo,
{RemObjects:} uROXMLIntf, uROClasses, uROClient, uROTypes, uROClientIntf,
{Used RODLs:} DataAbstract4_Intf;
const
{ Library ID }
LibraryUID = '{451AF84F-612F-4E30-943C-47820772CCA9}';
TargetNamespace = '';
{ Service Interface ID's }
IDASampleService_IID : TGUID = '{F23D518D-B0A4-4714-A654-5C743AF40C79}';
{ Event ID's }
EID_UpdateEvent = 'UpdateEvent';
type
{ Forward declarations }
IDASampleService = interface;
AnsiStringArray = class;
IUpdateEvent = interface;
{ Enumerateds }
PlatformEnum = (PlatformEnum_peUnknown,PlatformEnum_peWindowsVisualStudio,PlatformEnum_peWindowsDelphi,
PlatformEnum_peWindowsFPC,PlatformEnum_peWindowsMono,PlatformEnum_peBrowserJavaScript,
PlatformEnum_peBrowserSilverlight,PlatformEnum_peCompactFramework,PlatformEnum_peMacFPC,
PlatformEnum_peMacMono,PlatformEnum_peIPhoneXcode,PlatformEnum_peMacXcode,PlatformEnum_peLinuxFPC,
PlatformEnum_peLinuxMono);
{ AnsiStringArray }
AnsiStringArray_AnsiString = array of AnsiString;
AnsiStringArray = class(TROArray)
private
fCount: Integer;
fItems : AnsiStringArray_AnsiString;
protected
procedure Grow; virtual;
function GetItems(aIndex: integer): AnsiString;
procedure SetItems(aIndex: integer; const Value: AnsiString);
function GetCount: integer; override;
public
class function GetItemType: PTypeInfo; override;
class function GetItemSize: integer; override;
function GetItemRef(aIndex: integer): pointer; override;
procedure Clear; override;
procedure Delete(aIndex: integer); override;
procedure Resize(ElementCount: integer); override;
procedure Assign(iSource:TPersistent); override;
procedure ReadComplex(ASerializer: TObject); override;
procedure WriteComplex(ASerializer: TObject); override;
function Add(const Value:AnsiString): integer;
function GetIndex(const aPropertyName : string;
const aPropertyValue : Variant;
StartFrom : integer = 0;
Options : TROSearchOptions = [soIgnoreCase]) : integer; override;
property Count : integer read GetCount;
property Items[Index: integer]:AnsiString read GetItems write SetItems; default;
property InnerArray: AnsiStringArray_AnsiString read fItems;
end;
{ IDASampleService }
IDASampleService = interface(IDataAbstractService)
['{F23D518D-B0A4-4714-A654-5C743AF40C79}']
procedure Login(const aPlatform: PlatformEnum; const aName: Widestring);
procedure BlockRow(const pkField: AnsiString);
procedure UnblockRow(const pkField: AnsiString; const IsReadRow: Boolean);
procedure BlockSetOfRows;
procedure Subscribe(const aSubscribe: Boolean);
end;
{ CoDASampleService }
CoDASampleService = class
class function Create(const aMessage: IROMessage; aTransportChannel: IROTransportChannel): IDASampleService;
end;
{ TDASampleService_Proxy }
TDASampleService_Proxy = class(TDataAbstractService_Proxy, IDASampleService)
protected
function __GetInterfaceName:string; override;
procedure Login(const aPlatform: PlatformEnum; const aName: Widestring);
procedure BlockRow(const pkField: AnsiString);
procedure UnblockRow(const pkField: AnsiString; const IsReadRow: Boolean);
procedure BlockSetOfRows;
procedure Subscribe(const aSubscribe: Boolean);
end;
{ IUpdateEvent }
IUpdateEvent = interface
['{ED08A76E-747B-4779-94BD-34F59C218E78}']
procedure OnUpdateBlock(const pkFields: AnsiString; const senderGuid: Guid);
procedure OnUpdateUnblock(const pkField: AnsiString; const senderGuid: Guid; const isReadRow: Boolean);
procedure OnUpdateAllBlock(const pkFields: AnsiStringArray);
end;
{ IUpdateEvent_Writer }
IUpdateEvent_Writer = interface(IROEventWriter)
['{ED08A76E-747B-4779-94BD-34F59C218E78}']
procedure OnUpdateBlock(const __Sender : TGUID; const pkFields: AnsiString; const senderGuid: Guid);
procedure OnUpdateUnblock(const __Sender : TGUID; const pkField: AnsiString; const senderGuid: Guid; const isReadRow: Boolean);
procedure OnUpdateAllBlock(const __Sender : TGUID; const pkFields: AnsiStringArray);
end;
implementation
uses
{vcl:} SysUtils,
{RemObjects:} uROEventRepository, uROSerializer, uRORes;
{ AnsiStringArray }
procedure AnsiStringArray.Assign(iSource: TPersistent);
var lSource:AnsiStringArray;
i:integer;
begin
if (iSource is AnsiStringArray) then begin
lSource := AnsiStringArray(iSource);
Clear();
Resize(lSource.Count);
for i := 0 to Count-1 do begin
Items[i] := lSource.Items[i];
end;
end
else begin
inherited Assign(iSource);
end;
end;
class function AnsiStringArray.GetItemType: PTypeInfo;
begin
result := TypeInfo(AnsiString);
end;
class function AnsiStringArray.GetItemSize: integer;
begin
result := SizeOf(AnsiString);
end;
function AnsiStringArray.GetItems(aIndex: integer): AnsiString;
begin
if (aIndex < 0) or (aIndex >= Count) then RaiseError(err_ArrayIndexOutOfBounds,[aIndex]);
result := fItems[aIndex];
end;
function AnsiStringArray.GetItemRef(aIndex: integer): pointer;
begin
if (aIndex < 0) or (aIndex >= Count) then RaiseError(err_ArrayIndexOutOfBounds,[aIndex]);
result := @fItems[aIndex];
end;
procedure AnsiStringArray.Clear;
begin
SetLength(fItems, 0);
FCount := 0;
end;
procedure AnsiStringArray.Delete(aIndex: integer);
var i: integer;
begin
if (aIndex>=Count) then RaiseError(err_InvalidIndex, [aIndex]);
if (aIndex<Count-1) then
for i := aIndex to Count-2 do fItems[i] := fItems[i+1];
SetLength(fItems, Count-1);
Dec(FCount);
end;
procedure AnsiStringArray.SetItems(aIndex: integer; const Value: AnsiString);
begin
if (aIndex < 0) or (aIndex >= Count) then RaiseError(err_ArrayIndexOutOfBounds,[aIndex]);
fItems[aIndex] := Value;
end;
procedure AnsiStringArray.Resize(ElementCount: integer);
begin
if fCount = ElementCount then Exit;
SetLength(fItems, ElementCount);
FCount := ElementCount;
end;
function AnsiStringArray.GetCount: integer;
begin
result := FCount;
end;
procedure AnsiStringArray.Grow;
var
Delta, Capacity: Integer;
begin
Capacity := Length(fItems);
if Capacity > 64 then
Delta := Capacity div 4
else
if Capacity > 8 then
Delta := 16
else
Delta := 4;
SetLength(fItems, Capacity + Delta);
end;
function AnsiStringArray.Add(const Value: AnsiString): integer;
begin
Result := Count;
if Length(fItems) = Result then
Grow;
fItems[result] := Value;
Inc(fCount);
end;
function AnsiStringArray.GetIndex(const aPropertyName: string;
const aPropertyValue: Variant; StartFrom: integer;
Options: TROSearchOptions): integer;
begin
result := -1;
end;
procedure AnsiStringArray.ReadComplex(ASerializer: TObject);
var
lval: AnsiString;
i: integer;
begin
for i := 0 to Count-1 do begin
with TROSerializer(ASerializer) do
ReadAnsiString(GetArrayElementName(GetItemType, GetItemRef(i)), lval, i);
Items[i] := lval;
end;
end;
procedure AnsiStringArray.WriteComplex(ASerializer: TObject);
var
i: integer;
begin
for i := 0 to Count-1 do
with TROSerializer(ASerializer) do
WriteAnsiString(GetArrayElementName(GetItemType, GetItemRef(i)), fItems[i], i);
end;
{ CoDASampleService }
class function CoDASampleService.Create(const aMessage: IROMessage; aTransportChannel: IROTransportChannel): IDASampleService;
begin
result := TDASampleService_Proxy.Create(aMessage, aTransportChannel);
end;
{ TDASampleService_Proxy }
function TDASampleService_Proxy.__GetInterfaceName:string;
begin
result := 'DASampleService';
end;
procedure TDASampleService_Proxy.Login(const aPlatform: PlatformEnum; const aName: Widestring);
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'DASampleLibrary', __InterfaceName, 'Login');
__Message.Write('aPlatform', TypeInfo(DASampleLibrary_Intf.PlatformEnum), aPlatform, []);
__Message.Write('aName', TypeInfo(Widestring), aName, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
procedure TDASampleService_Proxy.BlockRow(const pkField: AnsiString);
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'DASampleLibrary', __InterfaceName, 'BlockRow');
__Message.Write('pkField', TypeInfo(AnsiString), pkField, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
procedure TDASampleService_Proxy.UnblockRow(const pkField: AnsiString; const IsReadRow: Boolean);
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'DASampleLibrary', __InterfaceName, 'UnblockRow');
__Message.Write('pkField', TypeInfo(AnsiString), pkField, []);
__Message.Write('IsReadRow', TypeInfo(Boolean), IsReadRow, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
procedure TDASampleService_Proxy.BlockSetOfRows;
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'DASampleLibrary', __InterfaceName, 'BlockSetOfRows');
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
finally
__Message.FreeStream;
end
end;
procedure TDASampleService_Proxy.Subscribe(const aSubscribe: Boolean);
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'DASampleLibrary', __InterfaceName, 'Subscribe');
__Message.Write('aSubscribe', TypeInfo(Boolean), aSubscribe, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
type
{ TUpdateEvent_Writer }
TUpdateEvent_Writer = class(TROEventWriter, IUpdateEvent_Writer)
protected
procedure OnUpdateBlock(const __Sender : TGUID; const pkFields: AnsiString; const senderGuid: Guid);
procedure OnUpdateUnblock(const __Sender : TGUID; const pkField: AnsiString; const senderGuid: Guid; const isReadRow: Boolean);
procedure OnUpdateAllBlock(const __Sender : TGUID; const pkFields: AnsiStringArray);
end;
procedure TUpdateEvent_Writer.OnUpdateBlock(const __Sender : TGUID; const pkFields: AnsiString; const senderGuid: Guid);
var __eventdata : Binary;
begin
__eventdata := Binary.Create;
try
__Message.InitializeEventMessage(NIL, 'DASampleLibrary', EID_UpdateEvent, 'OnUpdateBlock');
__Message.Write('pkFields', TypeInfo(AnsiString), pkFields, []);
__Message.Write('senderGuid', TypeInfo(Guid), senderGuid, []);
__Message.Finalize;
__Message.WriteToStream(__eventdata);
Repository.StoreEventData(__Sender, __eventdata, ExcludeSender, ExcludeSessionList, SessionList.CommaText);
finally
__eventdata.Free;
end;
end;
procedure TUpdateEvent_Writer.OnUpdateUnblock(const __Sender : TGUID; const pkField: AnsiString; const senderGuid: Guid; const isReadRow: Boolean);
var __eventdata : Binary;
begin
__eventdata := Binary.Create;
try
__Message.InitializeEventMessage(NIL, 'DASampleLibrary', EID_UpdateEvent, 'OnUpdateUnblock');
__Message.Write('pkField', TypeInfo(AnsiString), pkField, []);
__Message.Write('senderGuid', TypeInfo(Guid), senderGuid, []);
__Message.Write('isReadRow', TypeInfo(Boolean), isReadRow, []);
__Message.Finalize;
__Message.WriteToStream(__eventdata);
Repository.StoreEventData(__Sender, __eventdata, ExcludeSender, ExcludeSessionList, SessionList.CommaText);
finally
__eventdata.Free;
end;
end;
procedure TUpdateEvent_Writer.OnUpdateAllBlock(const __Sender : TGUID; const pkFields: AnsiStringArray);
var __eventdata : Binary;
begin
__eventdata := Binary.Create;
try
__Message.InitializeEventMessage(NIL, 'DASampleLibrary', EID_UpdateEvent, 'OnUpdateAllBlock');
__Message.Write('pkFields', TypeInfo(AnsiStringArray), pkFields, []);
__Message.Finalize;
__Message.WriteToStream(__eventdata);
Repository.StoreEventData(__Sender, __eventdata, ExcludeSender, ExcludeSessionList, SessionList.CommaText);
finally
__eventdata.Free;
end;
end;
type
{ TUpdateEvent_Invoker }
TUpdateEvent_Invoker = class(TROEventInvoker)
published
procedure Invoke_OnUpdateBlock(__EventReceiver : TROEventReceiver; const __Message : IROMessage; const __Target : IUnknown);
procedure Invoke_OnUpdateUnblock(__EventReceiver : TROEventReceiver; const __Message : IROMessage; const __Target : IUnknown);
procedure Invoke_OnUpdateAllBlock(__EventReceiver : TROEventReceiver; const __Message : IROMessage; const __Target : IUnknown);
end;
procedure TUpdateEvent_Invoker.Invoke_OnUpdateBlock(__EventReceiver : TROEventReceiver; const __Message : IROMessage; const __Target : IUnknown);
var
pkFields: AnsiString;
senderGuid: Guid;
begin
__Message.Read('pkFields', TypeInfo(AnsiString), pkFields, []);
__Message.Read('senderGuid', TypeInfo(Guid), senderGuid, []);
(__Target as IUpdateEvent).OnUpdateBlock(pkFields, senderGuid);
end;
procedure TUpdateEvent_Invoker.Invoke_OnUpdateUnblock(__EventReceiver : TROEventReceiver; const __Message : IROMessage; const __Target : IUnknown);
var
pkField: AnsiString;
senderGuid: Guid;
isReadRow: Boolean;
begin
__Message.Read('pkField', TypeInfo(AnsiString), pkField, []);
__Message.Read('senderGuid', TypeInfo(Guid), senderGuid, []);
__Message.Read('isReadRow', TypeInfo(Boolean), isReadRow, []);
(__Target as IUpdateEvent).OnUpdateUnblock(pkField, senderGuid, isReadRow);
end;
procedure TUpdateEvent_Invoker.Invoke_OnUpdateAllBlock(__EventReceiver : TROEventReceiver; const __Message : IROMessage; const __Target : IUnknown);
var
__lObjectDisposer: TROObjectDisposer;
pkFields: AnsiStringArray;
begin
pkFields := NIL;
try
__Message.Read('pkFields', TypeInfo(AnsiStringArray), pkFields, []);
(__Target as IUpdateEvent).OnUpdateAllBlock(pkFields);
finally
__lObjectDisposer:= TROObjectDisposer.Create(__EventReceiver);
try
__lObjectDisposer.Add(pkFields);
finally
__lObjectDisposer.Free();
end
end
end;
initialization
RegisterROClass(AnsiStringArray);
RegisterProxyClass(IDASampleService_IID, TDASampleService_Proxy);
RegisterEventWriterClass(IUpdateEvent_Writer, TUpdateEvent_Writer);
RegisterEventInvokerClass(EID_UpdateEvent, TUpdateEvent_Invoker);
finalization
UnregisterROClass(AnsiStringArray);
UnregisterProxyClass(IDASampleService_IID);
UnregisterEventWriterClass(IUpdateEvent_Writer);
UnregisterEventInvokerClass(EID_UpdateEvent);
end.