From db169b1b5b9e3a1b6c991cbc7c5369def115ebe1 Mon Sep 17 00:00:00 2001 From: Dale Henrichs Date: Mon, 5 Jun 2023 19:00:07 -0700 Subject: [PATCH] Issue #4: poised to login and attempt to execute a command --- .../instance/evaluateCommand.batchMode..st | 14 +++------- .../instance/login.st | 26 +++++++------------ .../instance/loginUsing..st | 20 -------------- .../instance/session.st | 7 ++--- .../instance/sessionDescription.st | 3 +++ .../instance/evaluate.batchMode..st | 9 +------ .../TDShell.class/instance/postCopy.st | 11 ++++---- 7 files changed, 24 insertions(+), 66 deletions(-) delete mode 100644 src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/loginUsing..st create mode 100644 src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/sessionDescription.st diff --git a/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/evaluateCommand.batchMode..st b/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/evaluateCommand.batchMode..st index f6b221cd..a43ec05d 100644 --- a/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/evaluateCommand.batchMode..st +++ b/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/evaluateCommand.batchMode..st @@ -1,17 +1,9 @@ evaluation evaluateCommand: command batchMode: batchBool - | stonString transcriptOop | - stonString := self objectSerializer toString: command. - batchBool - ifFalse: [ transcriptOop := self session clientForwarderCache keyAtValue: Transcript ifAbsent: [ ] ]. - [ - (transcriptOop notNil and: [ batchBool not ]) - ifTrue: [ self session clientForwarderCache at: transcriptOop put: self shell console ]. + | stonString | + stonString := (STON toString: command) encodeAsUTF8. ^ self session executeStringExpectingStringNB: '(' , self todeServerAccessString , ' for: ' , self shell shellId asString , ') evaluateSTONCommand:' , stonString printString - envId: self environmentId ] - ensure: [ - (session notNil and: [ transcriptOop notNil and: [ batchBool not ] ]) - ifTrue: [ self session clientForwarderCache at: transcriptOop put: Transcript ] ] \ No newline at end of file + envId: self environmentId \ No newline at end of file diff --git a/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/login.st b/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/login.st index 9eb44749..1ac3fdfc 100644 --- a/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/login.st +++ b/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/login.st @@ -1,21 +1,15 @@ session management login - | sess gemNRS stoneNRS aUsername aPassword | + | sess gemNRS stoneNRS sessionDescription | + sessionDescription := self sessionDescription. + gemNRS := GsNetworkResourceString + gemNRSForNetLDI: sessionDescription netLDIPort + onHost: sessionDescription gemHost. + stoneNRS := GsNetworkResourceString + stoneNRSForStoneName: sessionDescription stoneName + onHost: sessionDescription stoneHost. sess := GsTsExternalSession gemNRS: gemNRS stoneNRS: stoneNRS - username: aUsername - password: aPassword. - (sess loginWith: self sessionDescription) - ifFalse: [ - | gciError messageText | - gciError := sess getAndClearLastError. - messageText := gciError message. - ^ Error - signal: - messageText - , ' For further information about login failures, check the gem log file' ]. - self class addDependent: self. - false - ifTrue: [ sess enableGemTrace ]. - ^ sess \ No newline at end of file + username: sessionDescription userId + password: sessionDescription password \ No newline at end of file diff --git a/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/loginUsing..st b/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/loginUsing..st deleted file mode 100644 index f90fe1ef..00000000 --- a/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/loginUsing..st +++ /dev/null @@ -1,20 +0,0 @@ -session management -loginUsing: todeSessionClass - | sess | - self proxyBehaviorClass resetAllGlobalNames. "reset the cache on login" - sess := todeSessionClass new - topez: self; - yourself. - (sess loginWith: self sessionDescription) - ifFalse: [ - | gciError messageText | - gciError := sess getAndClearLastError. - messageText := gciError message. - ^ Error - signal: - messageText - , ' For further information about login failures, check the gem log file' ]. - self class addDependent: self. - false - ifTrue: [ sess enableGemTrace ]. - ^ sess \ No newline at end of file diff --git a/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/session.st b/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/session.st index 801d908f..bfccb605 100644 --- a/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/session.st +++ b/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/session.st @@ -1,7 +1,4 @@ session management session - session - ifNil: [ - session := self login. - self topezServerProxy ]. - ^ session \ No newline at end of file + session ifNil: [ session := self login ]. + ^ session \ No newline at end of file diff --git a/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/sessionDescription.st b/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/sessionDescription.st new file mode 100644 index 00000000..2cb9f9ed --- /dev/null +++ b/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/sessionDescription.st @@ -0,0 +1,3 @@ +accessing +sessionDescription + ^ self shell sessionDescription \ No newline at end of file diff --git a/src/GsDevKit_stones-Tode.package/TDShell.class/instance/evaluate.batchMode..st b/src/GsDevKit_stones-Tode.package/TDShell.class/instance/evaluate.batchMode..st index 8301faf1..280bb0af 100644 --- a/src/GsDevKit_stones-Tode.package/TDShell.class/instance/evaluate.batchMode..st +++ b/src/GsDevKit_stones-Tode.package/TDShell.class/instance/evaluate.batchMode..st @@ -4,14 +4,7 @@ evaluate: aString batchMode: aBool | result | TDCommandLine fromStream: aString readStream - selectLine: [ :line | - self actionStack notEmpty - ifTrue: [ - result := self accumulateText: line. - false "do not create or evaluate command for this line" ] - ifFalse: [ - self addToHistory: line. - true "create and evaluate the command for this line" ] ] + selectLine: [ :line | true ] forEachCommand: [ :command | result := self evaluateCommand: command batchMode: aBool ]. ^ result ] on: Error , TDRestoreFromBackupComplete , GsTopezCommandErrorNotification diff --git a/src/GsDevKit_stones-Tode.package/TDShell.class/instance/postCopy.st b/src/GsDevKit_stones-Tode.package/TDShell.class/instance/postCopy.st index 3f621ec6..c73c980b 100644 --- a/src/GsDevKit_stones-Tode.package/TDShell.class/instance/postCopy.st +++ b/src/GsDevKit_stones-Tode.package/TDShell.class/instance/postCopy.st @@ -1,9 +1,8 @@ stash postCopy - "windowStatus is shared" + "windowStatus is shared" - shellId := promptString := actionStack := inputStream := shellWindow := nil. - topezClient := self topezClient copy - shell: self; - topezServerProxy; - yourself \ No newline at end of file + shellId := promptString := actionStack := inputStream := shellWindow := nil. + topezClient := self topezClient copy + shell: self; + yourself \ No newline at end of file