Setting up the Gt4Gemstone connection
This show how to use Gt4Gemstone to run code inside the GemStone image.
First we need to configure Gt4Gemstone. There are two supported transports for connecting to the GemStone server. Configuration should only need to be done once, as those settings are persisted to disk.
Direct Connection
Direct connections use a single threaded server supplied as part of GemTalk's Sparkle server. Since it can only accept a single connection at a time, GCI connections will more often be used, see below.
The script to run the server is in Sparkle/src-gs/server.sh
, with the required credentials stored in Sparkle/src-gs/login.topaz
.
connection := (RsrInitiateConnection host: 'localhost' port: 29299) connect. evaluatorServiceClient := GtRsrEvaluatorServiceClient new. evaluatorServiceClient registerWith: connection.
result := evaluatorServiceClient evaluateAndWait: 'self / v1' for: 4 bindings: { #v1 -> 2 } asDictionary.
{ result. connection. evaluatorServiceClient. }
GCI Connection
GCI connection is generally preferred, as it accepts multiple clients at once and allows the user to specify which account to use when logging in, however it requires additional configuration of client libraries for each OS platform.
Ensure that the GemStone client libraries are installed.
Extract the appropriate platform library, e.g. GemStoneClientLibs3.7.0-x86_64.Linux.zip
.
The libraryPath
specified below is the directory in which the client libraries are extracted.
Configure the GemStone for Gt e.g.:
connector := GtGemStoneSessionRegistry default propertiesFile addNewConnector. connector host: 'localhost'; libraryPath: '/path/to/GemStone/ClientLibs' asFileReference; gemstoneVersion: '3.7.0'; stone: 'gs64stone'; netldi: '50377'; username: 'SystemUser'; password: '<password>'; hostUsername: 'HostUser'; hostPassword: '<password>'. connector notifyUpdated. session := GtGemStoneSessionRegistry default newSessionWithConnector: connector
result := session evaluateAndWait: 'self / v1' for: 4 bindings: { #v1 -> 2 } asDictionary.