Board index » off-topic » Multi-Instance MIDAS Server

Multi-Instance MIDAS Server


2005-06-29 04:19:59 AM
off-topic17
I have a midas server that runs as a service. I need to beable to run
multiple instances (each installed in its own folder) of it at the same
time so diffrent users can connect to diffrent servers. I think I just
need to change the UpdateRegistry procedure of the RDM. The question is
how do I change it.
The users connect though TSocketConnection using the RDMs name, not
GUID. The UpdateRegistry procedure seems only to deal with the GUIDs
though.
If anyone has done this sort of thing before, can you point me in the
right direction.
Thanks.
--------------
Joe Bain
www.iegsoftware.com
 
 

Re:Multi-Instance MIDAS Server

By multi-instance I do not mean the COM Object. I need multiple
instances of the server running at the same time with diffrent
ServerNames and ServerGUIDs.
--------------
Joe Bain
www.iegsoftware.com
 

Re:Multi-Instance MIDAS Server

I have done some more playing around with this and still can't get it
working. Below is the code for the app server it is a very simple test
case. When I try to use a diffrent class name and GUID I get an
EOleError exception with the message 'Type information missing for
class TMultiTest' in TTypedComObjectFactory.Create. I can not trace
into GetTypeInfoOfGUID of the ITypeLib interface, so I can not see why
this is happening.
Does anyone know what I need to do to beable to do this?
unit Unit2;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
Windows, Messages, SysUtils, Classes, ComServ, ComObj, VCLCom,
DataBkr,
DBClient, Project1_TLB, StdVcl, Provider, IEGProvider;
type
TMultiTest = class(TRemoteDataModule, IMultiTest)
dspServer: TIEGProvider;
function dspServerDataRequest(Sender: TObject;
Input: OleVariant): OleVariant;
private
{ Private declarations }
protected
class procedure UpdateRegistry(Register: Boolean; const ClassID,
ProgID: string); override;
public
{ Public declarations }
end;
var ServerGUID:String;
ServerName:String;
implementation
uses
Dialogs, IniFiles, Variants;
{$R *.DFM}
class procedure TMultiTest.UpdateRegistry(Register: Boolean; const
ClassID, ProgID: string);
begin
if Register then
begin
inherited UpdateRegistry(Register, ServerGUID, ServerName);
EnableSocketTransport(ServerGUID);
EnableWebTransport(ServerGUID);
end else
begin
DisableSocketTransport(ServerGUID);
DisableWebTransport(ServerGUID);
inherited UpdateRegistry(Register, ServerGUID, ServerName);
end;
end;
procedure LoadGUID;
var ini:TIniFile;
section:String;
begin
ini := TIniFile.Create(ChangeFileExt(ParamStr(0),'.ini'));
try
if(ParamCount>0) then
section := ParamStr(1)
else
section := 'Server';
ServerGUID :=
ini.ReadString(section,'ServerGUID',GUIDToString(Class_MultiTest));
ServerName :=
ini.ReadString(section,'ServerName','Project1.MultiTest');
finally
ini.free;
end;
end;
function TMultiTest.dspServerDataRequest(Sender: TObject;
Input: OleVariant): OleVariant;
begin
Result := VarArrayOf([ServerGUID,ServerName]);
end;
initialization
LoadGUID;
TComponentFactory.Create(ComServer, TMultiTest,
StringToGUID(ServerGUID), ciMultiInstance, tmApartment);
end.
--------------
Joe Bain
www.iegsoftware.com
 

{smallsort}

Re:Multi-Instance MIDAS Server

Joe Bain wrote:
Quote

I have done some more playing around with this and still can't get it
working. Below is the code for the app server it is a very simple test
case. When I try to use a diffrent class name and GUID I get an
EOleError exception with the message 'Type information missing for
class TMultiTest' in TTypedComObjectFactory.Create. I can not trace
into GetTypeInfoOfGUID of the ITypeLib interface, so I can not see why
this is happening.

Does anyone know what I need to do to beable to do this?


unit Unit2;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
Windows, Messages, SysUtils, Classes, ComServ, ComObj, VCLCom,
DataBkr,
DBClient, Project1_TLB, StdVcl, Provider, IEGProvider;

type
TMultiTest = class(TRemoteDataModule, IMultiTest)
dspServer: TIEGProvider;
function dspServerDataRequest(Sender: TObject;
Input: OleVariant): OleVariant;
private
{ Private declarations }
protected
class procedure UpdateRegistry(Register: Boolean; const ClassID,
ProgID: string); override;
public
{ Public declarations }
end;

var ServerGUID:String;
ServerName:String;
implementation

uses
Dialogs, IniFiles, Variants;

{$R *.DFM}

class procedure TMultiTest.UpdateRegistry(Register: Boolean; const
ClassID, ProgID: string);
begin
if Register then
begin
inherited UpdateRegistry(Register, ServerGUID, ServerName);
EnableSocketTransport(ServerGUID);
EnableWebTransport(ServerGUID);
end else
begin
DisableSocketTransport(ServerGUID);
DisableWebTransport(ServerGUID);
inherited UpdateRegistry(Register, ServerGUID, ServerName);
end;
end;
procedure LoadGUID;
var ini:TIniFile;
section:String;
begin
ini := TIniFile.Create(ChangeFileExt(ParamStr(0),'.ini'));
try
if(ParamCount>0) then
section := ParamStr(1)
else
section := 'Server';
ServerGUID :=
ini.ReadString(section,'ServerGUID',GUIDToString(Class_MultiTest));
ServerName :=
ini.ReadString(section,'ServerName','Project1.MultiTest');
finally
ini.free;
end;
end;
Doing a grep of the source folder in D2005 I can not find a single
class that implements GetTypeInfoOfGUID.
--------------
Joe Bain
www.iegsoftware.com
 

Re:Multi-Instance MIDAS Server

I have also just tried adding all the required registry entries by hand
and the same exception occurs.
--------------
Joe Bain
www.iegsoftware.com
 

Re:Multi-Instance MIDAS Server

Hopefully, you have a test case handy. :-) If so, shoot me an email, and
I'll take a look.
This much I can tell you: what you're attempting to do is one of the most
poorly supported COM features. For example, even though you're using the
ServerName (and not ServerGUID), it doesn't really matter. All calls
eventually resolve to the ServerGUID. The ServerName property is just a
shortcut to get human readable values vs. machine readable GUIDs.
In short, there are a whole series of GUIDs that need to change (TLB,
CoClass, etc.). On my long-range plan, I'm looking to write a utility to do
this kind of thing automatically (we have the same problem/requirement
here).
There's also the ability to run COM servers side by side in XP (at least in
theory). I haven't really looked into that since that imposes an unrealistic
OS requirement for me. Check MSDN for info on this if that's not a problem
for your needs.
"Joe Bain" < XXXX@XXXXX.COM ..c.o.m>wrote in message
Quote
If anyone has done this sort of thing before, can you point me in the
right direction.

 

Re:Multi-Instance MIDAS Server

Dan Miser wrote:
Quote
Hopefully, you have a test case handy. :-) If so, shoot me an email,
and I'll take a look.

This much I can tell you: what you're attempting to do is one of the
most poorly supported COM features. For example, even though you're
using the ServerName (and not ServerGUID), it doesn't really matter.
All calls eventually resolve to the ServerGUID. The ServerName
property is just a shortcut to get human readable values vs. machine
readable GUIDs.

In short, there are a whole series of GUIDs that need to change (TLB,
CoClass, etc.). On my long-range plan, I'm looking to write a utility
to do this kind of thing automatically (we have the same
problem/requirement here).

There's also the ability to run COM servers side by side in XP (at
least in theory). I haven't really looked into that since that
imposes an unrealistic OS requirement for me. Check MSDN for info on
this if that's not a problem for your needs.
I have to s{*word*99} this idea because of the time frame I am operating in.
I thought it would be a simple way to support what I need to do, but it
does not look like it is. I will have to add the desired functionality
to the program instead. Thanks for you help and if you ever have that
utility done let me know.
--------------
Joe Bain
www.iegsoftware.com