Componentes.Terceros.RemObj.../internal/6.0.43.801/1/RemObjects SDK for Delphi/Source/ROOlympia_Intf.pas
2010-01-29 16:17:43 +00:00

1316 lines
43 KiB
ObjectPascal

unit ROOlympia_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;
const
{ Library ID }
LibraryUID = '{EBA4557B-CD8A-4434-B34F-1954640CE0A0}';
TargetNamespace = '';
{ Service Interface ID's }
IOlympiaSessionManager_IID : TGUID = '{C7008E94-B6A2-47A0-822C-201C86CE0C8B}';
IOlympia_IID : TGUID = '{3F453A86-7FD2-4FE8-B589-7FA6F7DD0C86}';
{ Event ID's }
EID_OlympiaEvents = 'OlympiaEvents';
EID_OlympiaSessionManagerEvents = 'OlympiaSessionManagerEvents';
type
TSeekOrigin = Classes.TSeekOrigin; // fake declaration
{ Forward declarations }
IOlympiaSessionManager = interface;
IOlympia = interface;
GuidArray = class;
BinaryArray = class;
OlympiaSessionManagerConfiguration = class;
OlympiaUserSession = class;
OlympiaException = class;
IOlympiaEvents = interface;
IOlympiaSessionManagerEvents = interface;
{ OlympiaSessionManagerConfiguration }
OlympiaSessionManagerConfiguration = class(TROComplexType)
private
fMaxSessions: Integer;
fSessionDuration: Integer;
fMessageDuration: Integer;
public
procedure Assign(iSource: TPersistent); override;
procedure ReadComplex(ASerializer: TObject); override;
procedure WriteComplex(ASerializer: TObject); override;
published
property MaxSessions:Integer read fMaxSessions write fMaxSessions;
property SessionDuration:Integer read fSessionDuration write fSessionDuration;
property MessageDuration:Integer read fMessageDuration write fMessageDuration;
end;
{ OlympiaSessionManagerConfigurationCollection }
OlympiaSessionManagerConfigurationCollection = class(TROCollection)
protected
constructor Create(aItemClass: TCollectionItemClass); overload;
function GetItems(aIndex: integer): OlympiaSessionManagerConfiguration;
procedure SetItems(aIndex: integer; const Value: OlympiaSessionManagerConfiguration);
public
constructor Create; overload;
function Add: OlympiaSessionManagerConfiguration; reintroduce;
property Items[Index: integer]:OlympiaSessionManagerConfiguration read GetItems write SetItems; default;
end;
{ OlympiaUserSession }
OlympiaUserSession = class(TROComplexType)
private
fSessionID: AnsiString;
fCreated: DateTime;
fLastAccessed: DateTime;
fData: Binary;
function GetData: Binary;
public
procedure Assign(iSource: TPersistent); override;
procedure ReadComplex(ASerializer: TObject); override;
procedure WriteComplex(ASerializer: TObject); override;
published
property SessionID:AnsiString read fSessionID write fSessionID;
property Created:DateTime read fCreated write fCreated;
property LastAccessed:DateTime read fLastAccessed write fLastAccessed;
property Data:Binary read GetData write fData;
end;
{ OlympiaUserSessionCollection }
OlympiaUserSessionCollection = class(TROCollection)
protected
constructor Create(aItemClass: TCollectionItemClass); overload;
function GetItems(aIndex: integer): OlympiaUserSession;
procedure SetItems(aIndex: integer; const Value: OlympiaUserSession);
public
constructor Create; overload;
function Add: OlympiaUserSession; reintroduce;
property Items[Index: integer]:OlympiaUserSession read GetItems write SetItems; default;
end;
{ GuidArray }
GuidArray_Guid = array of Guid;
GuidArray = class(TROArray)
private
fCount: Integer;
fItems : GuidArray_Guid;
protected
procedure Grow; virtual;
function GetItems(aIndex: integer): Guid;
procedure SetItems(aIndex: integer; const Value: Guid);
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:Guid): 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]:Guid read GetItems write SetItems; default;
property InnerArray: GuidArray_Guid read fItems;
end;
{ BinaryArray }
BinaryArray_Binary = array of Binary;
BinaryArray = class(TROArray)
private
fCount: Integer;
fItems : BinaryArray_Binary;
protected
procedure Grow; virtual;
function GetItems(aIndex: integer): Binary;
procedure SetItems(aIndex: integer; const Value: Binary);
function GetCount: integer; override;
public
class function GetItemType: PTypeInfo; override;
class function GetItemClass: TClass; override;
class function GetItemSize: integer; override;
function GetItemRef(aIndex: integer): pointer; override;
procedure SetItemRef(aIndex: integer; Ref: 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: Binary; overload;
function Add(const Value: Binary):integer; overload;
property Count : integer read GetCount;
property Items[Index: integer]:Binary read GetItems write SetItems; default;
property InnerArray: BinaryArray_Binary read fItems;
end;
{ Exceptions }
OlympiaException = class(EROException)
private
public
published
end;
{ IOlympiaSessionManager }
IOlympiaSessionManager = interface
['{C7008E94-B6A2-47A0-822C-201C86CE0C8B}']
function ReadConfiguration: OlympiaSessionManagerConfiguration;
procedure UpdateConfiguration(const Configuration: OlympiaSessionManagerConfiguration);
function CreateSession(const SessionID: AnsiString; const ApplicationID: AnsiString; const SessionData: Binary): Boolean;
function ReadSession(const SessionID: AnsiString): OlympiaUserSession;
function CheckSession(const SessionID: AnsiString): Boolean;
procedure UpdateSession(const SessionID: AnsiString; const SessionData: Binary);
function DeleteSession(const SessionID: AnsiString): Boolean;
procedure ClearSessions(const ApplicationID: AnsiString);
function GetSessionCount(const ApplicationID: AnsiString): Integer;
function GetAllSessions(const ApplicationID: AnsiString): GuidArray;
procedure StoreMessage(const SourceSessionID: AnsiString; const MessageData: Binary);
function GetMessages(const SessionID: AnsiString; out MessageData: Binary): Integer;
function GetTimeout: Integer;
procedure SetTimeout(const value: Integer);
procedure RegisterForSessionEvents(const aApplicationID: AnsiString);
end;
{ CoOlympiaSessionManager }
CoOlympiaSessionManager = class
class function Create(const aMessage: IROMessage; aTransportChannel: IROTransportChannel): IOlympiaSessionManager;
end;
{ TOlympiaSessionManager_Proxy }
TOlympiaSessionManager_Proxy = class(TROProxy, IOlympiaSessionManager)
protected
function __GetInterfaceName:string; override;
function ReadConfiguration: OlympiaSessionManagerConfiguration;
procedure UpdateConfiguration(const Configuration: OlympiaSessionManagerConfiguration);
function CreateSession(const SessionID: AnsiString; const ApplicationID: AnsiString; const SessionData: Binary): Boolean;
function ReadSession(const SessionID: AnsiString): OlympiaUserSession;
function CheckSession(const SessionID: AnsiString): Boolean;
procedure UpdateSession(const SessionID: AnsiString; const SessionData: Binary);
function DeleteSession(const SessionID: AnsiString): Boolean;
procedure ClearSessions(const ApplicationID: AnsiString);
function GetSessionCount(const ApplicationID: AnsiString): Integer;
function GetAllSessions(const ApplicationID: AnsiString): GuidArray;
procedure StoreMessage(const SourceSessionID: AnsiString; const MessageData: Binary);
function GetMessages(const SessionID: AnsiString; out MessageData: Binary): Integer;
function GetTimeout: Integer;
procedure SetTimeout(const value: Integer);
procedure RegisterForSessionEvents(const aApplicationID: AnsiString);
end;
{ IOlympia }
IOlympia = interface(IOlympiaSessionManager)
['{3F453A86-7FD2-4FE8-B589-7FA6F7DD0C86}']
procedure StoreMessageEx(const SourceSessionID: AnsiString; const DestinationSessionIDs: GuidArray; const Data: Binary);
procedure RemoveEventMessage(const SessionID: AnsiString; const EventID: GuidArray);
procedure GetMessagesEx(const SessionID: AnsiString; out EventIDs: GuidArray; out EventData: BinaryArray);
procedure RegisterActiveEvents(const SessionIDs: GuidArray);
procedure UnregisterActiveEvents(const SessionIDs: GuidArray);
procedure Login(const UserName: Widestring; const Password: Widestring);
procedure Logout;
end;
{ CoOlympia }
CoOlympia = class
class function Create(const aMessage: IROMessage; aTransportChannel: IROTransportChannel): IOlympia;
end;
{ TOlympia_Proxy }
TOlympia_Proxy = class(TOlympiaSessionManager_Proxy, IOlympia)
protected
function __GetInterfaceName:string; override;
procedure StoreMessageEx(const SourceSessionID: AnsiString; const DestinationSessionIDs: GuidArray; const Data: Binary);
procedure RemoveEventMessage(const SessionID: AnsiString; const EventID: GuidArray);
procedure GetMessagesEx(const SessionID: AnsiString; out EventIDs: GuidArray; out EventData: BinaryArray);
procedure RegisterActiveEvents(const SessionIDs: GuidArray);
procedure UnregisterActiveEvents(const SessionIDs: GuidArray);
procedure Login(const UserName: Widestring; const Password: Widestring);
procedure Logout;
end;
{ IOlympiaEvents }
IOlympiaEvents = interface
['{72F2E1D6-9FB5-4AE7-AEBE-81AAD18AF8C9}']
procedure HaveMessage(const Targets: GuidArray; const EventID: AnsiString; const Data: Binary);
end;
{ IOlympiaEvents_Writer }
IOlympiaEvents_Writer = interface(IROEventWriter)
['{72F2E1D6-9FB5-4AE7-AEBE-81AAD18AF8C9}']
procedure HaveMessage(const __Sender : TGUID; const Targets: GuidArray; const EventID: AnsiString; const Data: Binary);
end;
{ IOlympiaSessionManagerEvents }
IOlympiaSessionManagerEvents = interface
['{5831850E-752D-4D1A-9685-06E408BB90FF}']
procedure SessionsExpired(const aExpiredSessionIDs: GuidArray);
end;
{ IOlympiaSessionManagerEvents_Writer }
IOlympiaSessionManagerEvents_Writer = interface(IROEventWriter)
['{5831850E-752D-4D1A-9685-06E408BB90FF}']
procedure SessionsExpired(const __Sender : TGUID; const aExpiredSessionIDs: GuidArray);
end;
implementation
uses
{vcl:} SysUtils,
{RemObjects:} uROEventRepository, uROSerializer, uRORes;
{ GuidArray }
procedure GuidArray.Assign(iSource: TPersistent);
var lSource:GuidArray;
i:integer;
begin
if (iSource is GuidArray) then begin
lSource := GuidArray(iSource);
Clear();
Resize(lSource.Count);
for i := 0 to lSource.Count-1 do
Items[i] := lSource.Items[i];
end
else begin
inherited Assign(iSource);
end;
end;
class function GuidArray.GetItemType: PTypeInfo;
begin
result := TypeInfo(Guid);
end;
class function GuidArray.GetItemSize: integer;
begin
result := SizeOf(Guid);
end;
function GuidArray.GetItems(aIndex: integer): Guid;
begin
if (aIndex < 0) or (aIndex >= Count) then RaiseError(err_ArrayIndexOutOfBounds,[aIndex]);
result := fItems[aIndex];
end;
function GuidArray.GetItemRef(aIndex: integer): pointer;
begin
if (aIndex < 0) or (aIndex >= Count) then RaiseError(err_ArrayIndexOutOfBounds,[aIndex]);
result := @fItems[aIndex];
end;
procedure GuidArray.Clear;
begin
SetLength(fItems, 0);
FCount := 0;
end;
procedure GuidArray.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 GuidArray.SetItems(aIndex: integer; const Value: Guid);
begin
if (aIndex < 0) or (aIndex >= Count) then RaiseError(err_ArrayIndexOutOfBounds,[aIndex]);
fItems[aIndex] := Value;
end;
procedure GuidArray.Resize(ElementCount: integer);
begin
if fCount = ElementCount then Exit;
SetLength(fItems, ElementCount);
FCount := ElementCount;
end;
function GuidArray.GetCount: integer;
begin
result := FCount;
end;
procedure GuidArray.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 GuidArray.Add(const Value: Guid): integer;
begin
Result := Count;
if Length(fItems) = Result then
Grow;
fItems[result] := Value;
Inc(fCount);
end;
function GuidArray.GetIndex(const aPropertyName: string;
const aPropertyValue: Variant; StartFrom: integer;
Options: TROSearchOptions): integer;
begin
result := -1;
end;
procedure GuidArray.ReadComplex(ASerializer: TObject);
var
lval: Guid;
i: integer;
begin
for i := 0 to Count-1 do begin
with TROSerializer(ASerializer) do
ReadGuid(GetArrayElementName(GetItemType, GetItemRef(i)), lval, i);
Items[i] := lval;
end;
end;
procedure GuidArray.WriteComplex(ASerializer: TObject);
var
i: integer;
begin
for i := 0 to Count-1 do
with TROSerializer(ASerializer) do
WriteGuid(GetArrayElementName(GetItemType, GetItemRef(i)), fItems[i], i);
end;
{ BinaryArray }
procedure BinaryArray.Assign(iSource: TPersistent);
var lSource:BinaryArray;
i:integer;
lItem:Binary;
begin
if (iSource is BinaryArray) then begin
lSource := BinaryArray(iSource);
Clear();
for i := 0 to lSource.Count-1 do
if Assigned(lSource.Items[i]) then begin
lItem := Binary(lSource.Items[i].ClassType.Create);
lItem.Assign(lSource.Items[i]);
Add(lItem);
end
else begin
Add(nil);
end;
end
else begin
inherited Assign(iSource);
end;
end;
class function BinaryArray.GetItemType: PTypeInfo;
begin
result := TypeInfo(Binary);
end;
class function BinaryArray.GetItemClass: TClass;
begin
result := Binary;
end;
class function BinaryArray.GetItemSize: integer;
begin
result := SizeOf(Binary);
end;
function BinaryArray.GetItems(aIndex: integer): Binary;
begin
if (aIndex < 0) or (aIndex >= Count) then RaiseError(err_ArrayIndexOutOfBounds,[aIndex]);
result := fItems[aIndex];
end;
function BinaryArray.GetItemRef(aIndex: integer): pointer;
begin
if (aIndex < 0) or (aIndex >= Count) then RaiseError(err_ArrayIndexOutOfBounds,[aIndex]);
result := fItems[aIndex];
end;
procedure BinaryArray.SetItemRef(aIndex: integer; Ref: pointer);
begin
if (aIndex < 0) or (aIndex >= Count) then RaiseError(err_ArrayIndexOutOfBounds,[aIndex]);
if Ref <> fItems[aIndex] then begin
if fItems[aIndex] <> nil then fItems[aIndex].Free;
fItems[aIndex] := Ref;
end;
end;
procedure BinaryArray.Clear;
var i: integer;
begin
for i := 0 to (Count-1) do fItems[i].Free();
SetLength(fItems, 0);
FCount := 0;
end;
procedure BinaryArray.Delete(aIndex: integer);
var i: integer;
begin
if (aIndex>=Count) then RaiseError(err_InvalidIndex, [aIndex]);
fItems[aIndex].Free();
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 BinaryArray.SetItems(aIndex: integer; const Value: Binary);
begin
if (aIndex < 0) or (aIndex >= Count) then RaiseError(err_ArrayIndexOutOfBounds,[aIndex]);
if fItems[aIndex] <> Value then begin
fItems[aIndex].Free;
fItems[aIndex] := Value;
end;
end;
procedure BinaryArray.Resize(ElementCount: integer);
var i: Integer;
begin
if fCount = ElementCount then Exit;
for i := FCount -1 downto ElementCount do
FItems[i].Free;
SetLength(fItems, ElementCount);
for i := FCount to ElementCount -1 do
FItems[i] := Binary.Create;
FCount := ElementCount;
end;
function BinaryArray.GetCount: integer;
begin
result := FCount;
end;
procedure BinaryArray.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 BinaryArray.Add: Binary;
begin
result := Binary.Create;
Add(Result);
end;
function BinaryArray.Add(const Value:Binary): integer;
begin
Result := Count;
if Length(fItems) = Result then
Grow;
fItems[result] := Value;
Inc(fCount);
end;
procedure BinaryArray.ReadComplex(ASerializer: TObject);
var
lval: Binary;
i: integer;
begin
for i := 0 to Count-1 do begin
with TROSerializer(ASerializer) do
ReadBinary(GetArrayElementName(GetItemType, GetItemRef(i)), lval, i);
Items[i] := lval;
end;
end;
procedure BinaryArray.WriteComplex(ASerializer: TObject);
var
i: integer;
begin
for i := 0 to Count-1 do
with TROSerializer(ASerializer) do
WriteBinary(GetArrayElementName(GetItemType, GetItemRef(i)), fItems[i], i);
end;
{ OlympiaSessionManagerConfiguration }
procedure OlympiaSessionManagerConfiguration.Assign(iSource: TPersistent);
var lSource: ROOlympia_Intf.OlympiaSessionManagerConfiguration;
begin
inherited Assign(iSource);
if (iSource is ROOlympia_Intf.OlympiaSessionManagerConfiguration) then begin
lSource := ROOlympia_Intf.OlympiaSessionManagerConfiguration(iSource);
MaxSessions := lSource.MaxSessions;
SessionDuration := lSource.SessionDuration;
MessageDuration := lSource.MessageDuration;
end;
end;
procedure OlympiaSessionManagerConfiguration.ReadComplex(ASerializer: TObject);
var
l_MaxSessions: Integer;
l_MessageDuration: Integer;
l_SessionDuration: Integer;
begin
if TROSerializer(ASerializer).RecordStrictOrder then begin
l_MaxSessions := MaxSessions;
TROSerializer(ASerializer).ReadInteger('MaxSessions', otSLong, l_MaxSessions);
MaxSessions := l_MaxSessions;
l_SessionDuration := SessionDuration;
TROSerializer(ASerializer).ReadInteger('SessionDuration', otSLong, l_SessionDuration);
SessionDuration := l_SessionDuration;
l_MessageDuration := MessageDuration;
TROSerializer(ASerializer).ReadInteger('MessageDuration', otSLong, l_MessageDuration);
MessageDuration := l_MessageDuration;
end
else begin
l_MaxSessions := MaxSessions;
TROSerializer(ASerializer).ReadInteger('MaxSessions', otSLong, l_MaxSessions);
MaxSessions := l_MaxSessions;
l_MessageDuration := MessageDuration;
TROSerializer(ASerializer).ReadInteger('MessageDuration', otSLong, l_MessageDuration);
MessageDuration := l_MessageDuration;
l_SessionDuration := SessionDuration;
TROSerializer(ASerializer).ReadInteger('SessionDuration', otSLong, l_SessionDuration);
SessionDuration := l_SessionDuration;
end;
end;
procedure OlympiaSessionManagerConfiguration.WriteComplex(ASerializer: TObject);
var
l_MaxSessions: Integer;
l_MessageDuration: Integer;
l_SessionDuration: Integer;
begin
if TROSerializer(ASerializer).RecordStrictOrder then begin
TROSerializer(ASerializer).ChangeClass(OlympiaSessionManagerConfiguration);
l_MaxSessions := MaxSessions;
TROSerializer(ASerializer).WriteInteger('MaxSessions', otSLong, l_MaxSessions);
l_SessionDuration := SessionDuration;
TROSerializer(ASerializer).WriteInteger('SessionDuration', otSLong, l_SessionDuration);
l_MessageDuration := MessageDuration;
TROSerializer(ASerializer).WriteInteger('MessageDuration', otSLong, l_MessageDuration);
end
else begin
l_MaxSessions := MaxSessions;
TROSerializer(ASerializer).WriteInteger('MaxSessions', otSLong, l_MaxSessions);
l_MessageDuration := MessageDuration;
TROSerializer(ASerializer).WriteInteger('MessageDuration', otSLong, l_MessageDuration);
l_SessionDuration := SessionDuration;
TROSerializer(ASerializer).WriteInteger('SessionDuration', otSLong, l_SessionDuration);
end;
end;
{ OlympiaSessionManagerConfigurationCollection }
constructor OlympiaSessionManagerConfigurationCollection.Create;
begin
inherited Create(OlympiaSessionManagerConfiguration);
end;
constructor OlympiaSessionManagerConfigurationCollection.Create(aItemClass: TCollectionItemClass);
begin
inherited Create(aItemClass);
end;
function OlympiaSessionManagerConfigurationCollection.Add: OlympiaSessionManagerConfiguration;
begin
result := OlympiaSessionManagerConfiguration(inherited Add);
end;
function OlympiaSessionManagerConfigurationCollection.GetItems(aIndex: integer): OlympiaSessionManagerConfiguration;
begin
result := OlympiaSessionManagerConfiguration(inherited Items[aIndex]);
end;
procedure OlympiaSessionManagerConfigurationCollection.SetItems(aIndex: integer; const Value: OlympiaSessionManagerConfiguration);
begin
OlympiaSessionManagerConfiguration(inherited Items[aIndex]).Assign(Value);
end;
{ OlympiaUserSession }
procedure OlympiaUserSession.Assign(iSource: TPersistent);
var lSource: ROOlympia_Intf.OlympiaUserSession;
begin
inherited Assign(iSource);
if (iSource is ROOlympia_Intf.OlympiaUserSession) then begin
lSource := ROOlympia_Intf.OlympiaUserSession(iSource);
SessionID := lSource.SessionID;
Created := lSource.Created;
LastAccessed := lSource.LastAccessed;
if Assigned(Data) then
Data.Assign(lSource.Data);
end;
end;
function OlympiaUserSession.GetData: Binary;
begin
result := fData;
end;
procedure OlympiaUserSession.ReadComplex(ASerializer: TObject);
var
l_Created: DateTime;
l_Data: Binary;
l_LastAccessed: DateTime;
l_SessionID: AnsiString;
begin
if TROSerializer(ASerializer).RecordStrictOrder then begin
l_SessionID := SessionID;
TROSerializer(ASerializer).ReadAnsiString('SessionID', l_SessionID);
SessionID := l_SessionID;
l_Created := Created;
TROSerializer(ASerializer).ReadDateTime('Created', l_Created);
Created := l_Created;
l_LastAccessed := LastAccessed;
TROSerializer(ASerializer).ReadDateTime('LastAccessed', l_LastAccessed);
LastAccessed := l_LastAccessed;
l_Data := Data;
TROSerializer(ASerializer).ReadBinary('Data', l_Data);
if Data <> l_Data then Data.Free;
Data := l_Data;
end
else begin
l_Created := Created;
TROSerializer(ASerializer).ReadDateTime('Created', l_Created);
Created := l_Created;
l_Data := Data;
TROSerializer(ASerializer).ReadBinary('Data', l_Data);
if Data <> l_Data then Data.Free;
Data := l_Data;
l_LastAccessed := LastAccessed;
TROSerializer(ASerializer).ReadDateTime('LastAccessed', l_LastAccessed);
LastAccessed := l_LastAccessed;
l_SessionID := SessionID;
TROSerializer(ASerializer).ReadAnsiString('SessionID', l_SessionID);
SessionID := l_SessionID;
end;
end;
procedure OlympiaUserSession.WriteComplex(ASerializer: TObject);
var
l_Created: DateTime;
l_Data: Binary;
l_LastAccessed: DateTime;
l_SessionID: AnsiString;
begin
if TROSerializer(ASerializer).RecordStrictOrder then begin
TROSerializer(ASerializer).ChangeClass(OlympiaUserSession);
l_SessionID := SessionID;
TROSerializer(ASerializer).WriteAnsiString('SessionID', l_SessionID);
l_Created := Created;
TROSerializer(ASerializer).WriteDateTime('Created', l_Created);
l_LastAccessed := LastAccessed;
TROSerializer(ASerializer).WriteDateTime('LastAccessed', l_LastAccessed);
l_Data := Data;
TROSerializer(ASerializer).WriteBinary('Data', l_Data);
end
else begin
l_Created := Created;
TROSerializer(ASerializer).WriteDateTime('Created', l_Created);
l_Data := Data;
TROSerializer(ASerializer).WriteBinary('Data', l_Data);
l_LastAccessed := LastAccessed;
TROSerializer(ASerializer).WriteDateTime('LastAccessed', l_LastAccessed);
l_SessionID := SessionID;
TROSerializer(ASerializer).WriteAnsiString('SessionID', l_SessionID);
end;
end;
{ OlympiaUserSessionCollection }
constructor OlympiaUserSessionCollection.Create;
begin
inherited Create(OlympiaUserSession);
end;
constructor OlympiaUserSessionCollection.Create(aItemClass: TCollectionItemClass);
begin
inherited Create(aItemClass);
end;
function OlympiaUserSessionCollection.Add: OlympiaUserSession;
begin
result := OlympiaUserSession(inherited Add);
end;
function OlympiaUserSessionCollection.GetItems(aIndex: integer): OlympiaUserSession;
begin
result := OlympiaUserSession(inherited Items[aIndex]);
end;
procedure OlympiaUserSessionCollection.SetItems(aIndex: integer; const Value: OlympiaUserSession);
begin
OlympiaUserSession(inherited Items[aIndex]).Assign(Value);
end;
{ CoOlympiaSessionManager }
class function CoOlympiaSessionManager.Create(const aMessage: IROMessage; aTransportChannel: IROTransportChannel): IOlympiaSessionManager;
begin
result := TOlympiaSessionManager_Proxy.Create(aMessage, aTransportChannel);
end;
{ TOlympiaSessionManager_Proxy }
function TOlympiaSessionManager_Proxy.__GetInterfaceName:string;
begin
result := 'OlympiaSessionManager';
end;
function TOlympiaSessionManager_Proxy.ReadConfiguration: OlympiaSessionManagerConfiguration;
begin
try
result := nil;
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'ReadConfiguration');
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
__Message.Read('Result', TypeInfo(ROOlympia_Intf.OlympiaSessionManagerConfiguration), result, []);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
procedure TOlympiaSessionManager_Proxy.UpdateConfiguration(const Configuration: OlympiaSessionManagerConfiguration);
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'UpdateConfiguration');
__Message.Write('Configuration', TypeInfo(ROOlympia_Intf.OlympiaSessionManagerConfiguration), Configuration, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
function TOlympiaSessionManager_Proxy.CreateSession(const SessionID: AnsiString; const ApplicationID: AnsiString; const SessionData: Binary): Boolean;
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'CreateSession');
__Message.Write('SessionID', TypeInfo(AnsiString), SessionID, []);
__Message.Write('ApplicationID', TypeInfo(AnsiString), ApplicationID, []);
__Message.Write('SessionData', TypeInfo(Binary), SessionData, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
__Message.Read('Result', TypeInfo(Boolean), result, []);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
function TOlympiaSessionManager_Proxy.ReadSession(const SessionID: AnsiString): OlympiaUserSession;
begin
try
result := nil;
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'ReadSession');
__Message.Write('SessionID', TypeInfo(AnsiString), SessionID, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
__Message.Read('Result', TypeInfo(ROOlympia_Intf.OlympiaUserSession), result, []);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
function TOlympiaSessionManager_Proxy.CheckSession(const SessionID: AnsiString): Boolean;
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'CheckSession');
__Message.Write('SessionID', TypeInfo(AnsiString), SessionID, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
__Message.Read('Result', TypeInfo(Boolean), result, []);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
procedure TOlympiaSessionManager_Proxy.UpdateSession(const SessionID: AnsiString; const SessionData: Binary);
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'UpdateSession');
__Message.Write('SessionID', TypeInfo(AnsiString), SessionID, []);
__Message.Write('SessionData', TypeInfo(Binary), SessionData, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
function TOlympiaSessionManager_Proxy.DeleteSession(const SessionID: AnsiString): Boolean;
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'DeleteSession');
__Message.Write('SessionID', TypeInfo(AnsiString), SessionID, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
__Message.Read('Result', TypeInfo(Boolean), result, []);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
procedure TOlympiaSessionManager_Proxy.ClearSessions(const ApplicationID: AnsiString);
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'ClearSessions');
__Message.Write('ApplicationID', TypeInfo(AnsiString), ApplicationID, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
function TOlympiaSessionManager_Proxy.GetSessionCount(const ApplicationID: AnsiString): Integer;
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'GetSessionCount');
__Message.Write('ApplicationID', TypeInfo(AnsiString), ApplicationID, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
__Message.Read('Result', TypeInfo(Integer), result, []);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
function TOlympiaSessionManager_Proxy.GetAllSessions(const ApplicationID: AnsiString): GuidArray;
begin
try
result := nil;
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'GetAllSessions');
__Message.Write('ApplicationID', TypeInfo(AnsiString), ApplicationID, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
__Message.Read('Result', TypeInfo(ROOlympia_Intf.GuidArray), result, []);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
procedure TOlympiaSessionManager_Proxy.StoreMessage(const SourceSessionID: AnsiString; const MessageData: Binary);
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'StoreMessage');
__Message.Write('SourceSessionID', TypeInfo(AnsiString), SourceSessionID, []);
__Message.Write('MessageData', TypeInfo(Binary), MessageData, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
function TOlympiaSessionManager_Proxy.GetMessages(const SessionID: AnsiString; out MessageData: Binary): Integer;
begin
try
MessageData := nil;
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'GetMessages');
__Message.Write('SessionID', TypeInfo(AnsiString), SessionID, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
__Message.Read('Result', TypeInfo(Integer), result, []);
__Message.Read('MessageData', TypeInfo(Binary), MessageData, []);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
function TOlympiaSessionManager_Proxy.GetTimeout: Integer;
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'GetTimeout');
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
__Message.Read('Result', TypeInfo(Integer), result, []);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
procedure TOlympiaSessionManager_Proxy.SetTimeout(const value: Integer);
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'SetTimeout');
__Message.Write('value', TypeInfo(Integer), value, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
procedure TOlympiaSessionManager_Proxy.RegisterForSessionEvents(const aApplicationID: AnsiString);
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'RegisterForSessionEvents');
__Message.Write('aApplicationID', TypeInfo(AnsiString), aApplicationID, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
{ CoOlympia }
class function CoOlympia.Create(const aMessage: IROMessage; aTransportChannel: IROTransportChannel): IOlympia;
begin
result := TOlympia_Proxy.Create(aMessage, aTransportChannel);
end;
{ TOlympia_Proxy }
function TOlympia_Proxy.__GetInterfaceName:string;
begin
result := 'Olympia';
end;
procedure TOlympia_Proxy.StoreMessageEx(const SourceSessionID: AnsiString; const DestinationSessionIDs: GuidArray; const Data: Binary);
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'StoreMessageEx');
__Message.Write('SourceSessionID', TypeInfo(AnsiString), SourceSessionID, []);
__Message.Write('DestinationSessionIDs', TypeInfo(ROOlympia_Intf.GuidArray), DestinationSessionIDs, []);
__Message.Write('Data', TypeInfo(Binary), Data, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
procedure TOlympia_Proxy.RemoveEventMessage(const SessionID: AnsiString; const EventID: GuidArray);
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'RemoveEventMessage');
__Message.Write('SessionID', TypeInfo(AnsiString), SessionID, []);
__Message.Write('EventID', TypeInfo(ROOlympia_Intf.GuidArray), EventID, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
procedure TOlympia_Proxy.GetMessagesEx(const SessionID: AnsiString; out EventIDs: GuidArray; out EventData: BinaryArray);
begin
try
EventIDs := nil;
EventData := nil;
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'GetMessagesEx');
__Message.Write('SessionID', TypeInfo(AnsiString), SessionID, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
__Message.Read('EventIDs', TypeInfo(ROOlympia_Intf.GuidArray), EventIDs, []);
__Message.Read('EventData', TypeInfo(ROOlympia_Intf.BinaryArray), EventData, []);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
procedure TOlympia_Proxy.RegisterActiveEvents(const SessionIDs: GuidArray);
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'RegisterActiveEvents');
__Message.Write('SessionIDs', TypeInfo(ROOlympia_Intf.GuidArray), SessionIDs, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
procedure TOlympia_Proxy.UnregisterActiveEvents(const SessionIDs: GuidArray);
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'UnregisterActiveEvents');
__Message.Write('SessionIDs', TypeInfo(ROOlympia_Intf.GuidArray), SessionIDs, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
procedure TOlympia_Proxy.Login(const UserName: Widestring; const Password: Widestring);
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'Login');
__Message.Write('UserName', TypeInfo(Widestring), UserName, []);
__Message.Write('Password', TypeInfo(Widestring), Password, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
procedure TOlympia_Proxy.Logout;
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'ROOlympia', __InterfaceName, 'Logout');
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
finally
__Message.FreeStream;
end
end;
type
{ TOlympiaEvents_Writer }
TOlympiaEvents_Writer = class(TROEventWriter, IOlympiaEvents_Writer)
protected
procedure HaveMessage(const __Sender : TGUID; const Targets: GuidArray; const EventID: AnsiString; const Data: Binary);
end;
procedure TOlympiaEvents_Writer.HaveMessage(const __Sender : TGUID; const Targets: GuidArray; const EventID: AnsiString; const Data: Binary);
var __eventdata : Binary;
begin
__eventdata := Binary.Create;
try
__Message.InitializeEventMessage(NIL, 'ROOlympia', EID_OlympiaEvents, 'HaveMessage');
__Message.Write('Targets', TypeInfo(GuidArray), Targets, []);
__Message.Write('EventID', TypeInfo(AnsiString), EventID, []);
__Message.Write('Data', TypeInfo(Binary), Data, []);
__Message.Finalize;
__Message.WriteToStream(__eventdata);
Repository.StoreEventData(__Sender, __eventdata, ExcludeSender, ExcludeSessionList, SessionList.CommaText);
finally
__eventdata.Free;
end;
end;
type
{ TOlympiaEvents_Invoker }
TOlympiaEvents_Invoker = class(TROEventInvoker)
published
procedure Invoke_HaveMessage(__EventReceiver : TROEventReceiver; const __Message : IROMessage; const __Target : IUnknown);
end;
procedure TOlympiaEvents_Invoker.Invoke_HaveMessage(__EventReceiver : TROEventReceiver; const __Message : IROMessage; const __Target : IUnknown);
var
__lObjectDisposer: TROObjectDisposer;
Targets: GuidArray;
EventID: AnsiString;
Data: Binary;
begin
Targets := NIL;
Data := NIL;
try
__Message.Read('Targets', TypeInfo(GuidArray), Targets, []);
__Message.Read('EventID', TypeInfo(AnsiString), EventID, []);
__Message.Read('Data', TypeInfo(Binary), Data, []);
(__Target as IOlympiaEvents).HaveMessage(Targets, EventID, Data);
finally
__lObjectDisposer:= TROObjectDisposer.Create(__EventReceiver);
try
__lObjectDisposer.Add(Targets);
__lObjectDisposer.Add(Data);
finally
__lObjectDisposer.Free();
end
end
end;
type
{ TOlympiaSessionManagerEvents_Writer }
TOlympiaSessionManagerEvents_Writer = class(TROEventWriter, IOlympiaSessionManagerEvents_Writer)
protected
procedure SessionsExpired(const __Sender : TGUID; const aExpiredSessionIDs: GuidArray);
end;
procedure TOlympiaSessionManagerEvents_Writer.SessionsExpired(const __Sender : TGUID; const aExpiredSessionIDs: GuidArray);
var __eventdata : Binary;
begin
__eventdata := Binary.Create;
try
__Message.InitializeEventMessage(NIL, 'ROOlympia', EID_OlympiaSessionManagerEvents, 'SessionsExpired');
__Message.Write('aExpiredSessionIDs', TypeInfo(GuidArray), aExpiredSessionIDs, []);
__Message.Finalize;
__Message.WriteToStream(__eventdata);
Repository.StoreEventData(__Sender, __eventdata, ExcludeSender, ExcludeSessionList, SessionList.CommaText);
finally
__eventdata.Free;
end;
end;
type
{ TOlympiaSessionManagerEvents_Invoker }
TOlympiaSessionManagerEvents_Invoker = class(TROEventInvoker)
published
procedure Invoke_SessionsExpired(__EventReceiver : TROEventReceiver; const __Message : IROMessage; const __Target : IUnknown);
end;
procedure TOlympiaSessionManagerEvents_Invoker.Invoke_SessionsExpired(__EventReceiver : TROEventReceiver; const __Message : IROMessage; const __Target : IUnknown);
var
__lObjectDisposer: TROObjectDisposer;
aExpiredSessionIDs: GuidArray;
begin
aExpiredSessionIDs := NIL;
try
__Message.Read('aExpiredSessionIDs', TypeInfo(GuidArray), aExpiredSessionIDs, []);
(__Target as IOlympiaSessionManagerEvents).SessionsExpired(aExpiredSessionIDs);
finally
__lObjectDisposer:= TROObjectDisposer.Create(__EventReceiver);
try
__lObjectDisposer.Add(aExpiredSessionIDs);
finally
__lObjectDisposer.Free();
end
end
end;
initialization
RegisterROClass(OlympiaSessionManagerConfiguration);
RegisterROClass(OlympiaUserSession);
RegisterROClass(GuidArray);
RegisterROClass(BinaryArray);
RegisterExceptionClass(OlympiaException);
RegisterProxyClass(IOlympiaSessionManager_IID, TOlympiaSessionManager_Proxy);
RegisterProxyClass(IOlympia_IID, TOlympia_Proxy);
RegisterEventWriterClass(IOlympiaEvents_Writer, TOlympiaEvents_Writer);
RegisterEventInvokerClass(EID_OlympiaEvents, TOlympiaEvents_Invoker);
RegisterEventWriterClass(IOlympiaSessionManagerEvents_Writer, TOlympiaSessionManagerEvents_Writer);
RegisterEventInvokerClass(EID_OlympiaSessionManagerEvents, TOlympiaSessionManagerEvents_Invoker);
finalization
UnregisterROClass(OlympiaSessionManagerConfiguration);
UnregisterROClass(OlympiaUserSession);
UnregisterROClass(GuidArray);
UnregisterROClass(BinaryArray);
UnregisterExceptionClass(OlympiaException);
UnregisterProxyClass(IOlympiaSessionManager_IID);
UnregisterProxyClass(IOlympia_IID);
UnregisterEventWriterClass(IOlympiaEvents_Writer);
UnregisterEventInvokerClass(EID_OlympiaEvents);
UnregisterEventWriterClass(IOlympiaSessionManagerEvents_Writer);
UnregisterEventInvokerClass(EID_OlympiaSessionManagerEvents);
end.