Board index » delphi » Using a PropertyBag-like object - persistance of com objects

Using a PropertyBag-like object - persistance of com objects

Hello,

i'd like to extract from a COM object its "state" in order to release him,
reconstruct him later and reload its state. In the VB tool, there's a
mecanism of "persistance" implemented in standard COM objects (comes from
mecanism already present in Activex Controls) and an object called
"propertybag" which can help to obtain it.

To your opinion, is it difficult to reproduce a "propertybag-like object";
more, is it possible to reproduce the behaviour of persistance ?

And the ideal situation : the same object than the VB propertybag, or a
"compatible" one, in order to exchange state between clients and objects,
whatever language they are written in (hum, is it correct english ?).

Will it be painfull to see in Activex Controls units in Delphi to find some
material about it ?

I'm intertined in ideas, inpirations, i'm not waiting plug&play solutions !

Thanks for your ideas.

 

Re:Using a PropertyBag-like object - persistance of com objects


Quote
"Dominique JOCAL" <djo...@aston.fr> wrote in message

news:85nncb$9hq2@bornews.borland.com...

Quote
> Hello,

> i'd like to extract from a COM object its "state" in order to release him,
> reconstruct him later and reload its state. In the VB tool, there's a
> mecanism of "persistance" implemented in standard COM objects (comes from
> mecanism already present in Activex Controls) and an object called
> "propertybag" which can help to obtain it.

In COM you have many standard options of implementing persistence. Check out
IPersist* interfaces: IPesistStream, IPesistStreamInit, IPersistMemory,
IPersistPropertyBag, IPersistFile etc.
It really depends on what you need.

Quote
> And the ideal situation : the same object than the VB propertybag, or a
> "compatible" one, in order to exchange state between clients and objects,
> whatever language they are written in (hum, is it correct english ?).

What do you mean by "exchange state between clients and objects"?
In COM, there is a very common technique called "marshal-by-value", which
allows you to "teleport" entire object from one application/machine to
another. The client application wouldn't even know it is talking to a local
clone of the object.

Is that what you want?

Re:Using a PropertyBag-like object - persistance of com objects


Sergei Chernov a crit dans le message <85sdo0$b...@bornews.borland.com>...

Quote
>What do you mean by "exchange state between clients and objects"?
>In COM, there is a very common technique called "marshal-by-value", which
>allows you to "teleport" entire object from one application/machine to
>another. The client application wouldn't even know it is talking to a local
>clone of the object.

>Is that what you want?

Yes !!! Do you about custom marshalling ?
Is it generalisable to an entire set of objects ? And can it be a "extern"
mecanism, that is able to use it with COM objects made in any language (VB)
?

Re:Using a PropertyBag-like object - persistance of com objects


Quote
> Is it generalisable to an entire set of objects ?

Marshal-by-value can be used for any persistent object. The idea is to save
object's state during the marshaling process, create a new object during
unmarshaling and initialize it with a saved state. As a result, the client
won't get a proxy to the object, but a clone of an original object acting as
a proxy.

For more theory, surf to March 97 MSJ and read
http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0397/ActiveX/...
0397.htm from Don Box.
While reading that, be aware that because you object will act as a proxy,
its threading model should be 'Both'.
Also read comments at http://www.develop.com/dbox/msj/0397.htm

Quote
> And can it be a "extern" mecanism, that is able to use it with COM objects

made in any language (VB)?

Unfortunately, custom marshaling requires participation on the object side
(it must implement IMarshal). While you can play with it a little by
aggregating the object, VB objects do not support aggregation.
But Don Box has an answer to this as well. Read these articles:

http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0399/com/com0...
http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0199/intercep...
cept.htm
http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0299/intercep...
rcept2.htm

Anything you wanted to know about by-value marshaling (and much more) is
there.

Re:Using a PropertyBag-like object - persistance of com objects


Sergei Chernov a crit dans le message <866g2n$gp...@bornews.borland.com>...

Quote
>> Is it generalisable to an entire set of objects ?

>Marshal-by-value can be used for any persistent object. The idea is to save
...
>Anything you wanted to know about by-value marshaling (and much more) is
>there.

thanks for all this material, very kind of you; now im gonna work on this.

Other Threads