Getting started with Gembuilder for VW

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting started with Gembuilder for VW

Gemstone/S mailing list
Hi,

        I have succeeded to connect 2 PCs using the same database, and I have defined classes in the base. Now I have a class inst var as a connector, and I am able to store one object in the server. But using the same connect with updateST, I am not able to get it back.

        Any idea how to debug ?

        Best regards

        Annick
_______________________________________________
GemStone-Smalltalk mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/gemstone-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with Gembuilder for VW

Gemstone/S mailing list
On 11/20/18 10:37 AM, Annick Fron via GemStone-Smalltalk wrote:
> Hi,
>
> I have succeeded to connect 2 PCs using the same database, and I have defined classes in the base. Now I have a class inst var as a connector, and I am able to store one object in the server. But using the same connect with updateST, I am not able to get it back.
>
> Any idea how to debug ?
>
> Best regards
>
> Annick

Hi Annick,

Connectors have some limitiations. Class instvar connectors in
particular have the limitation that changes in the variable's value
cannot be automatically detected by GBS. Connectors for class variables
don't have this limitiation.

However, especially when getting started, you may find it easier to not
use connectors for your data roots.

Use connectors for your classes (you can do without them sometimes, but
they're easy and reliable. Then, after login, you can "manually"
replicate your data roots.

Say you have on both client and server the class MyClass, with class
instVar myInstances, and accessor methods for that variable.

Since you have a class connector for MyClass, once you're logged in the
client MyClass is automatically mapped to the server MyClass.

To initialize the instance variable on the server, you could do this on
the client:

MyClass performOnGsServer: #myInstances: withArguments: (Array with:
OrderedCollection new).

then commit.

Thereafter, after each login, you can have the client initialize itself
from the server with:

MyClass myInstances: (MyClass performOnGsServer: #myInstances).

After that, the client and server OrderedCollections (in this example;
could be just about any object) are mapped to each other and will
automatically synchronize their state.


I hope this has been helpful, and that I haven't completely
misunderstood what you're trying to do.

If you get things working as I've suggested above, then you can
experiment with Connectors if you like. And keep asking questions! GBS
is very general-purpose, and it can take a bit to learn what the more
successful patterns of use are.

Regards,

-Martin

_______________________________________________
GemStone-Smalltalk mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/gemstone-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with Gembuilder for VW

Gemstone/S mailing list
Hi Martin,

        This was helpful.
        But my main issue is that I have the same classes both in UserGlobals and UserClasses, and sometimes with a different version.
        If I user the right click menu « create in Gs » on a class in a browser, it creates it in UserClasses. But if I define connectors, it adds the same class name in UserGlobals.
        Besides, all my classes have a namespace, e.g. Compet.Competition.

        What is the difference between:

        GBSM evaluate: ‘MyClass myInstances’
and
        MyNamespace.MyClass myInstances performOnGsServer: #myInstances
?

        Best regards

        Annick

> Le 21 nov. 2018 à 01:50, Martin McClure <[hidden email]> a écrit :
>
> On 11/20/18 10:37 AM, Annick Fron via GemStone-Smalltalk wrote:
>> Hi,
>>
>> I have succeeded to connect 2 PCs using the same database, and I have defined classes in the base. Now I have a class inst var as a connector, and I am able to store one object in the server. But using the same connect with updateST, I am not able to get it back.
>>
>> Any idea how to debug ?
>>
>> Best regards
>>
>> Annick
>
> Hi Annick,
>
> Connectors have some limitiations. Class instvar connectors in
> particular have the limitation that changes in the variable's value
> cannot be automatically detected by GBS. Connectors for class variables
> don't have this limitiation.
>
> However, especially when getting started, you may find it easier to not
> use connectors for your data roots.
>
> Use connectors for your classes (you can do without them sometimes, but
> they're easy and reliable. Then, after login, you can "manually"
> replicate your data roots.
>
> Say you have on both client and server the class MyClass, with class
> instVar myInstances, and accessor methods for that variable.
>
> Since you have a class connector for MyClass, once you're logged in the
> client MyClass is automatically mapped to the server MyClass.
>
> To initialize the instance variable on the server, you could do this on
> the client:
>
> MyClass performOnGsServer: #myInstances: withArguments: (Array with:
> OrderedCollection new).
>
> then commit.
>
> Thereafter, after each login, you can have the client initialize itself
> from the server with:
>
> MyClass myInstances: (MyClass performOnGsServer: #myInstances).
>
> After that, the client and server OrderedCollections (in this example;
> could be just about any object) are mapped to each other and will
> automatically synchronize their state.
>
>
> I hope this has been helpful, and that I haven't completely
> misunderstood what you're trying to do.
>
> If you get things working as I've suggested above, then you can
> experiment with Connectors if you like. And keep asking questions! GBS
> is very general-purpose, and it can take a bit to learn what the more
> successful patterns of use are.
>
> Regards,
>
> -Martin
>

_______________________________________________
GemStone-Smalltalk mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/gemstone-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with Gembuilder for VW

Gemstone/S mailing list
On 11/21/18 6:54 AM, Annick Fron wrote:
> Hi Martin,
>
> This was helpful.
> But my main issue is that I have the same classes both in UserGlobals and UserClasses, and sometimes with a different version.
> If I user the right click menu « create in Gs » on a class in a browser, it creates it in UserClasses. But if I define connectors, it adds the same class name in UserGlobals.

Ooh, that inconsistency *may* be a bug. We'll investigate that -- thanks
for bringing it to our attention.

In the meantime, I recommend turning off generateClientClasses and
generateServerClasses. Then, when connectors connect at login they will
just map the client and server classes together, and not generate any
new classes. You can still use the browser's "create in GS" and "compile
in GS" with those options turned off.

> Besides, all my classes have a namespace, e.g. Compet.Competition.

This could also be the source of some of the difficulty. GemStone does
not have VW-style namespaces, and the design of GBS long pre-dates the
time when VW added namespaces.

By default, connectors only look in the Smalltalk namespace on VW.
However, as documented on page 72 of the GBS Users Guide, you can use a
VW fully-qualified name when creating a connector.

>
> What is the difference between:
>
> GBSM evaluate: ‘MyClass myInstances’
> and
> MyNamespace.MyClass myInstances performOnGsServer: #myInstances

I think that the latter would actually be:

        MyNamespace.MyClass performOnGsServer: #myInstances

With that change, the effect will be the same, the mechanism different.
#evaluate: invokes the compiler on the server, and evaluates the
resulting method. #performOnGsServer: does not involve the compiler, it
just sends a message. In this case it doesn't matter much which you use,
but if the necessary code already exists on the server I find it
slightly more elegant to just send the message.

Regards,
-Martin
_______________________________________________
GemStone-Smalltalk mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/gemstone-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with Gembuilder for VW

Gemstone/S mailing list
Hi Martin,

        I have made some progress with the class mapping. Still, I am struggling with inheritance, because it seems you need to respect the hierarchy to map classes. I wanted to use the « createInGs » menu from a whole package in Visualworks, but it looks like it does not respect this precedence.

        This would be nice though !

        Best regards

        Annick

> Le 21 nov. 2018 à 17:32, Martin McClure <[hidden email]> a écrit :
>
> On 11/21/18 6:54 AM, Annick Fron wrote:
>> Hi Martin,
>>
>> This was helpful.
>> But my main issue is that I have the same classes both in UserGlobals and UserClasses, and sometimes with a different version.
>> If I user the right click menu « create in Gs » on a class in a browser, it creates it in UserClasses. But if I define connectors, it adds the same class name in UserGlobals.
>
> Ooh, that inconsistency *may* be a bug. We'll investigate that -- thanks
> for bringing it to our attention.
>
> In the meantime, I recommend turning off generateClientClasses and
> generateServerClasses. Then, when connectors connect at login they will
> just map the client and server classes together, and not generate any
> new classes. You can still use the browser's "create in GS" and "compile
> in GS" with those options turned off.
>
>> Besides, all my classes have a namespace, e.g. Compet.Competition.
>
> This could also be the source of some of the difficulty. GemStone does
> not have VW-style namespaces, and the design of GBS long pre-dates the
> time when VW added namespaces.
>
> By default, connectors only look in the Smalltalk namespace on VW.
> However, as documented on page 72 of the GBS Users Guide, you can use a
> VW fully-qualified name when creating a connector.
>
>>
>> What is the difference between:
>>
>> GBSM evaluate: ‘MyClass myInstances’
>> and
>> MyNamespace.MyClass myInstances performOnGsServer: #myInstances
>
> I think that the latter would actually be:
>
> MyNamespace.MyClass performOnGsServer: #myInstances
>
> With that change, the effect will be the same, the mechanism different.
> #evaluate: invokes the compiler on the server, and evaluates the
> resulting method. #performOnGsServer: does not involve the compiler, it
> just sends a message. In this case it doesn't matter much which you use,
> but if the necessary code already exists on the server I find it
> slightly more elegant to just send the message.
>
> Regards,
> -Martin

_______________________________________________
GemStone-Smalltalk mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/gemstone-smalltalk