iris-pex-embedded-python 2.3.16__py3-none-any.whl → 2.3.18__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of iris-pex-embedded-python might be problematic. Click here for more details.

Files changed (120) hide show
  1. grongier/iris/Grongier/PEX/BusinessOperation.cls +33 -0
  2. grongier/iris/Grongier/PEX/BusinessProcess.cls +100 -0
  3. grongier/iris/Grongier/PEX/BusinessService.cls +33 -0
  4. grongier/iris/Grongier/PEX/Common.cls +133 -0
  5. grongier/iris/Grongier/PEX/Director.cls +15 -0
  6. grongier/iris/Grongier/PEX/Duplex/Operation.cls +27 -0
  7. grongier/iris/Grongier/PEX/Duplex/Process.cls +211 -0
  8. grongier/iris/Grongier/PEX/Duplex/Service.cls +9 -0
  9. grongier/iris/Grongier/PEX/InboundAdapter.cls +22 -0
  10. grongier/iris/Grongier/PEX/Message.cls +126 -0
  11. grongier/iris/Grongier/PEX/OutboundAdapter.cls +34 -0
  12. grongier/iris/Grongier/PEX/PickleMessage.cls +58 -0
  13. grongier/iris/Grongier/PEX/PrivateSession/Duplex.cls +247 -0
  14. grongier/iris/Grongier/PEX/PrivateSession/Message/Ack.cls +32 -0
  15. grongier/iris/Grongier/PEX/PrivateSession/Message/Poll.cls +32 -0
  16. grongier/iris/Grongier/PEX/PrivateSession/Message/Start.cls +32 -0
  17. grongier/iris/Grongier/PEX/PrivateSession/Message/Stop.cls +48 -0
  18. grongier/iris/Grongier/PEX/Python.cls +27 -0
  19. grongier/iris/Grongier/PEX/Test.cls +62 -0
  20. grongier/iris/Grongier/PEX/Utils.cls +312 -0
  21. grongier/iris/__init__.py +0 -0
  22. grongier/pex/_business_host.py +9 -1
  23. grongier/pex/_cli.py +8 -2
  24. grongier/pex/data/PEX/BusinessOperation.cls +35 -0
  25. grongier/pex/data/PEX/BusinessProcess.cls +113 -0
  26. grongier/pex/data/PEX/BusinessService.cls +35 -0
  27. grongier/pex/data/PEX/Common.cls +146 -0
  28. grongier/pex/data/PEX/Director.cls +57 -0
  29. grongier/pex/data/PEX/Duplex/Operation.cls +29 -0
  30. grongier/pex/data/PEX/Duplex/Process.cls +229 -0
  31. grongier/pex/data/PEX/Duplex/Service.cls +9 -0
  32. grongier/pex/data/PEX/InboundAdapter.cls +22 -0
  33. grongier/pex/data/PEX/Message.cls +128 -0
  34. grongier/pex/data/PEX/OutboundAdapter.cls +36 -0
  35. grongier/pex/data/PEX/PickleMessage.cls +58 -0
  36. grongier/pex/data/PEX/PrivateSession/Duplex.cls +260 -0
  37. grongier/pex/data/PEX/PrivateSession/Message/Ack.cls +32 -0
  38. grongier/pex/data/PEX/PrivateSession/Message/Poll.cls +32 -0
  39. grongier/pex/data/PEX/PrivateSession/Message/Start.cls +32 -0
  40. grongier/pex/data/PEX/PrivateSession/Message/Stop.cls +48 -0
  41. grongier/pex/data/PEX/Test.cls +62 -0
  42. grongier/pex/data/PEX/Utils.cls +413 -0
  43. intersystems_iris/_BufferReader.py +10 -0
  44. intersystems_iris/_BufferWriter.py +32 -0
  45. intersystems_iris/_ConnectionInformation.py +54 -0
  46. intersystems_iris/_ConnectionParameters.py +18 -0
  47. intersystems_iris/_Constant.py +38 -0
  48. intersystems_iris/_DBList.py +500 -0
  49. intersystems_iris/_Device.py +69 -0
  50. intersystems_iris/_GatewayContext.py +25 -0
  51. intersystems_iris/_GatewayException.py +4 -0
  52. intersystems_iris/_GatewayUtility.py +74 -0
  53. intersystems_iris/_IRIS.py +1294 -0
  54. intersystems_iris/_IRISConnection.py +516 -0
  55. intersystems_iris/_IRISEmbedded.py +85 -0
  56. intersystems_iris/_IRISGlobalNode.py +273 -0
  57. intersystems_iris/_IRISGlobalNodeView.py +25 -0
  58. intersystems_iris/_IRISIterator.py +143 -0
  59. intersystems_iris/_IRISList.py +360 -0
  60. intersystems_iris/_IRISNative.py +208 -0
  61. intersystems_iris/_IRISOREF.py +4 -0
  62. intersystems_iris/_IRISObject.py +424 -0
  63. intersystems_iris/_IRISReference.py +133 -0
  64. intersystems_iris/_InStream.py +149 -0
  65. intersystems_iris/_LegacyIterator.py +135 -0
  66. intersystems_iris/_ListItem.py +15 -0
  67. intersystems_iris/_ListReader.py +84 -0
  68. intersystems_iris/_ListWriter.py +157 -0
  69. intersystems_iris/_LogFileStream.py +115 -0
  70. intersystems_iris/_MessageHeader.py +51 -0
  71. intersystems_iris/_OutStream.py +25 -0
  72. intersystems_iris/_PrintStream.py +65 -0
  73. intersystems_iris/_PythonGateway.py +850 -0
  74. intersystems_iris/_SharedMemorySocket.py +87 -0
  75. intersystems_iris/__init__.py +79 -0
  76. intersystems_iris/__main__.py +7 -0
  77. intersystems_iris/dbapi/_Column.py +56 -0
  78. intersystems_iris/dbapi/_DBAPI.py +2587 -0
  79. intersystems_iris/dbapi/_Descriptor.py +46 -0
  80. intersystems_iris/dbapi/_IRISStream.py +65 -0
  81. intersystems_iris/dbapi/_Message.py +158 -0
  82. intersystems_iris/dbapi/_Parameter.py +169 -0
  83. intersystems_iris/dbapi/_ParameterCollection.py +141 -0
  84. intersystems_iris/dbapi/_ResultSetRow.py +338 -0
  85. intersystems_iris/dbapi/_SQLType.py +32 -0
  86. intersystems_iris/dbapi/__init__.py +0 -0
  87. intersystems_iris/dbapi/preparser/_PreParser.py +1671 -0
  88. intersystems_iris/dbapi/preparser/_Scanner.py +391 -0
  89. intersystems_iris/dbapi/preparser/_Token.py +81 -0
  90. intersystems_iris/dbapi/preparser/_TokenList.py +251 -0
  91. intersystems_iris/dbapi/preparser/__init__.py +0 -0
  92. intersystems_iris/pex/_BusinessHost.py +101 -0
  93. intersystems_iris/pex/_BusinessOperation.py +105 -0
  94. intersystems_iris/pex/_BusinessProcess.py +214 -0
  95. intersystems_iris/pex/_BusinessService.py +95 -0
  96. intersystems_iris/pex/_Common.py +228 -0
  97. intersystems_iris/pex/_Director.py +24 -0
  98. intersystems_iris/pex/_IRISBusinessOperation.py +5 -0
  99. intersystems_iris/pex/_IRISBusinessService.py +18 -0
  100. intersystems_iris/pex/_IRISInboundAdapter.py +5 -0
  101. intersystems_iris/pex/_IRISOutboundAdapter.py +17 -0
  102. intersystems_iris/pex/_InboundAdapter.py +57 -0
  103. intersystems_iris/pex/_Message.py +6 -0
  104. intersystems_iris/pex/_OutboundAdapter.py +46 -0
  105. intersystems_iris/pex/__init__.py +25 -0
  106. iris/__init__.py +33 -0
  107. iris/iris_ipm.py +40 -0
  108. iris/iris_site.py +13 -0
  109. iris/irisbuiltins.py +97 -0
  110. iris/irisloader.py +199 -0
  111. {iris_pex_embedded_python-2.3.16.dist-info → iris_pex_embedded_python-2.3.18.dist-info}/METADATA +3 -4
  112. iris_pex_embedded_python-2.3.18.dist-info/RECORD +153 -0
  113. {iris_pex_embedded_python-2.3.16.dist-info → iris_pex_embedded_python-2.3.18.dist-info}/WHEEL +1 -1
  114. iris_pex_embedded_python-2.3.18.dist-info/top_level.txt +4 -0
  115. irisnative/_IRISNative.py +9 -0
  116. irisnative/__init__.py +10 -0
  117. iris_pex_embedded_python-2.3.16.dist-info/RECORD +0 -43
  118. iris_pex_embedded_python-2.3.16.dist-info/top_level.txt +0 -1
  119. {iris_pex_embedded_python-2.3.16.dist-info → iris_pex_embedded_python-2.3.18.dist-info}/LICENSE +0 -0
  120. {iris_pex_embedded_python-2.3.16.dist-info → iris_pex_embedded_python-2.3.18.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,33 @@
1
+ /* Copyright (c) 2021 by InterSystems Corporation.
2
+ Cambridge, Massachusetts, U.S.A. All rights reserved.
3
+ Confidential property of InterSystems Corporation. */
4
+
5
+ Class Grongier.PEX.BusinessOperation Extends (Ens.BusinessOperation, Grongier.PEX.Common) [ Inheritance = right, ProcedureBlock, System = 4 ]
6
+ {
7
+
8
+ Parameter SETTINGS = "%classname:Python BusinessOperation,%module:Python BusinessOperation,%settings:Python BusinessOperation,%classpaths:Python BusinessOperation";
9
+
10
+ Method OnMessage(request As %Library.Persistent, Output response As %Library.Persistent) As %Status
11
+ {
12
+ set tSC = $$$OK
13
+ try {
14
+ set response = ..%class."_dispatch_on_message"(request)
15
+ } catch ex {
16
+ set tSC = ex.AsStatus()
17
+ }
18
+ quit tSC
19
+ }
20
+
21
+ Method OnKeepalive(pStatus As %Status = {$$$OK}) As %Status
22
+ {
23
+ set tSC = $$$OK
24
+ try {
25
+ $$$ThrowOnError(##super(pStatus))
26
+ do ..%class."on_keepalive"()
27
+ } catch ex {
28
+ set tSC = ex.AsStatus()
29
+ }
30
+ quit tSC
31
+ }
32
+
33
+ }
@@ -0,0 +1,100 @@
1
+ /* Copyright (c) 2021 by InterSystems Corporation.
2
+ Cambridge, Massachusetts, U.S.A. All rights reserved.
3
+ Confidential property of InterSystems Corporation. */
4
+
5
+ Class Grongier.PEX.BusinessProcess Extends (Ens.BusinessProcess, Grongier.PEX.Common) [ Inheritance = right, ProcedureBlock, System = 4 ]
6
+ {
7
+
8
+ Parameter SETTINGS = "%classname:Python BusinessProcess,%module:Python BusinessProcess,%settings:Python BusinessProcess,%classpaths:Python BusinessProcess";
9
+
10
+ Property persistentProperties As array Of %String(MAXLEN = "");
11
+
12
+ Method dispatchReply(response)
13
+ {
14
+ set tSC = ..Reply(response)
15
+ if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
16
+ quit
17
+ }
18
+
19
+ Method dispatchSetTimer(timeout, completionKey)
20
+ {
21
+ set tSC = ..SetTimer(timeout,$g(completionKey))
22
+ if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
23
+ quit
24
+ }
25
+
26
+ Method OnRequest(request As %Persistent, Output response As %Persistent) As %Status
27
+ {
28
+ set tSC = $$$OK
29
+ try {
30
+ set response = ..%class."_dispatch_on_request"($this,request)
31
+ } catch ex {
32
+ set tSC = ex.AsStatus()
33
+ }
34
+ quit tSC
35
+ }
36
+
37
+ /// Handle a 'Response'
38
+ Method OnResponse(request As %Persistent, Output response As %Persistent, callRequest As %Persistent, callResponse As %Persistent, pCompletionKey As %String) As %Status
39
+ {
40
+ set tSC = $$$OK
41
+ try {
42
+ set response = ..%class."_dispatch_on_response"($this,request,response,callRequest,callResponse,pCompletionKey)
43
+ } catch ex {
44
+ set tSC = ex.AsStatus()
45
+ }
46
+ quit tSC
47
+ }
48
+
49
+ Method OnComplete(request As %Library.Persistent, ByRef response As %Library.Persistent) As %Status
50
+ {
51
+ set tSC = $$$OK
52
+ try {
53
+ set tSC = ..Connect() quit:$$$ISERR(tSC)
54
+ set response = ..%class."_dispatch_on_complete"($this,request,response)
55
+ } catch ex {
56
+ set tSC = ex.AsStatus()
57
+ }
58
+ quit tSC
59
+ }
60
+
61
+ Method getPersistentProperty(name)
62
+ {
63
+ quit ..persistentProperties.GetAt(name)
64
+ }
65
+
66
+ Method setPersistentProperty(name, value)
67
+ {
68
+ quit ..persistentProperties.SetAt(value,name)
69
+ }
70
+
71
+ Storage Default
72
+ {
73
+ <Data name="BusinessProcessDefaultData1">
74
+ <Subscript>"BusinessProcess"</Subscript>
75
+ <Value name="1">
76
+ <Value>%classpaths</Value>
77
+ </Value>
78
+ <Value name="2">
79
+ <Value>%classname</Value>
80
+ </Value>
81
+ <Value name="3">
82
+ <Value>%module</Value>
83
+ </Value>
84
+ <Value name="4">
85
+ <Value>%settings</Value>
86
+ </Value>
87
+ <Value name="5">
88
+ <Value>%class</Value>
89
+ </Value>
90
+ </Data>
91
+ <Data name="persistentProperties">
92
+ <Attribute>persistentProperties</Attribute>
93
+ <Structure>subnode</Structure>
94
+ <Subscript>"Grongier.PEX.BusinessProcess.persistentProperties"</Subscript>
95
+ </Data>
96
+ <DefaultData>BusinessProcessDefaultData1</DefaultData>
97
+ <Type>%Storage.Persistent</Type>
98
+ }
99
+
100
+ }
@@ -0,0 +1,33 @@
1
+ /* Copyright (c) 2021 by InterSystems Corporation.
2
+ Cambridge, Massachusetts, U.S.A. All rights reserved.
3
+ Confidential property of InterSystems Corporation. */
4
+
5
+ Class Grongier.PEX.BusinessService Extends (Ens.BusinessService, Grongier.PEX.Common) [ Inheritance = right, ProcedureBlock, System = 4 ]
6
+ {
7
+
8
+ Parameter SETTINGS = "%classname:Python BusinessService,%module:Python BusinessService,%settings:Python BusinessService,%classpaths:Python BusinessService";
9
+
10
+ Method dispatchProcessInput(pInput As %RegisteredObject) As %RegisteredObject
11
+ {
12
+
13
+ quit ..%class."on_process_input"(pInput)
14
+ }
15
+
16
+ Method OnProcessInput(request As %RegisteredObject, Output response As %RegisteredObject) As %Status
17
+ {
18
+ set tSC = $$$OK
19
+ try {
20
+ try {
21
+ set ..%class."_wait_for_next_call_interval" = ..%WaitForNextCallInterval
22
+ } catch {}
23
+ set response = ..%class."_dispatch_on_process_input"(request)
24
+ try {
25
+ set ..%WaitForNextCallInterval = ..%class."_wait_for_next_call_interval"
26
+ } catch {}
27
+ } catch ex {
28
+ set tSC = ex.AsStatus()
29
+ }
30
+ quit tSC
31
+ }
32
+
33
+ }
@@ -0,0 +1,133 @@
1
+ /* Copyright (c) 2021 by InterSystems Corporation.
2
+ Cambridge, Massachusetts, U.S.A. All rights reserved.
3
+ Confidential property of InterSystems Corporation. */
4
+
5
+ Include Ensemble
6
+
7
+ Class Grongier.PEX.Common [ Abstract, ClassType = "", ProcedureBlock, System = 4 ]
8
+ {
9
+
10
+ /// One or more Classpaths (separated by '|' character) needed in addition to the ones configured in the Java Gateway Service
11
+ Property %classpaths As %String(MAXLEN = "");
12
+
13
+ Property %classname As %String(MAXLEN = "");
14
+
15
+ Property %module As %String(MAXLEN = "");
16
+
17
+ Property %settings As %String(MAXLEN = "");
18
+
19
+ /// Instance of class
20
+ Property %class As %SYS.Python;
21
+
22
+ /// Get Class
23
+ Method GetClass() As %SYS.Python
24
+ {
25
+ Return ..%class
26
+ }
27
+
28
+ /// Get Classname
29
+ Method GetClassname() As %String
30
+ {
31
+ Return ..%classname
32
+ }
33
+
34
+ /// Get Classname
35
+ Method GetModule() As %String
36
+ {
37
+ Return ..%module
38
+ }
39
+
40
+ Method OnInit() As %Status
41
+ {
42
+ set tSC = $$$OK
43
+ try {
44
+ $$$ThrowOnError(..Connect())
45
+ do ..%class."_dispatch_on_init"($this)
46
+ } catch ex {
47
+ set tSC = ex.AsStatus()
48
+ }
49
+ quit tSC
50
+ }
51
+
52
+ Method Connect() As %Status
53
+ {
54
+ set tSC = $$$OK
55
+ try {
56
+
57
+ set container = $this
58
+
59
+ //set classpass
60
+ if ..%classpaths '="" {
61
+ set delimiter = $s($system.Version.GetOS()="Windows":";",1:":")
62
+ set extraClasspaths = $tr(container.%classpaths,delimiter,"|")
63
+ for i=1:1:$l(extraClasspaths,"|") {
64
+ set onePath = $p(extraClasspaths,"|",i)
65
+ if onePath?1"$$IRISHOME"1P.E set onePath = $e($system.Util.InstallDirectory(),1,*-1)_$e(onePath,11,*)
66
+ if onePath'="" do ##class(Grongier.PEX.Python).SetClassPath(onePath)
67
+ }
68
+ }
69
+ if $isObject(..%class)=0 {
70
+ set ..%class = ##class(Grongier.PEX.Python).GetInstanceFromModuleClassName(..%module,..%classname)
71
+ }
72
+ ;
73
+ if ..%Extends("Grongier.PEX.InboundAdapter") || ..%Extends("Grongier.PEX.OutboundAdapter") {
74
+ do ..%class."_set_iris_handles"($this,..BusinessHost)
75
+ } elseif $this.%Extends("Grongier.PEX.BusinessProcess") {
76
+ do ..%class."_set_iris_handles"($this,$$$NULLOREF)
77
+ } else {
78
+ do ..%class."_set_iris_handles"($this,..Adapter)
79
+ }
80
+ ;
81
+ do ..SetPropertyValues()
82
+ ;
83
+ try {
84
+ do ..%class."_dispatch_on_connected"($this)
85
+ } catch ex {
86
+ $$$LOGWARNING(ex.DisplayString())
87
+ }
88
+ ;
89
+ } catch ex {
90
+ set msg = $System.Status.GetOneStatusText(ex.AsStatus(),1)
91
+ set tSC = $$$ERROR($$$EnsErrGeneral,msg)
92
+ }
93
+ quit tSC
94
+ }
95
+
96
+ Method OnTearDown() As %Status
97
+ {
98
+ set tSC = $$$OK
99
+ do ..%class."_dispatch_on_tear_down"()
100
+ quit tSC
101
+ }
102
+
103
+ Method SetPropertyValues()
104
+ {
105
+ set remoteSettings = $tr(..%settings,$c(13))
106
+ for i=1:1:$l(remoteSettings,$c(10)) {
107
+ set oneLine = $p(remoteSettings,$c(10),i)
108
+ set property = $p(oneLine,"=",1) continue:property=""
109
+ set value = $p(oneLine,"=",2,*)
110
+ try {
111
+ set $property(..%class,property) = value
112
+ } catch ex {
113
+ $$$LOGWARNING(ex.DisplayString())
114
+ }
115
+ }
116
+ quit
117
+ }
118
+
119
+ Method dispatchSendRequestSync(target, request, timeout, description) As %String
120
+ {
121
+ set tSC = ..SendRequestSync(target,request,.objResponse,timeout,description)
122
+ if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
123
+ quit $g(objResponse)
124
+ }
125
+
126
+ Method dispatchSendRequestAsync(target, request, description)
127
+ {
128
+ set tSC = ..SendRequestAsync(target,request,description)
129
+ if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
130
+ quit
131
+ }
132
+
133
+ }
@@ -0,0 +1,15 @@
1
+ /* Copyright (c) 2021 by InterSystems Corporation.
2
+ Cambridge, Massachusetts, U.S.A. All rights reserved.
3
+ Confidential property of InterSystems Corporation. */
4
+
5
+ Class Grongier.PEX.Director [ Inheritance = right, ProcedureBlock, System = 4 ]
6
+ {
7
+
8
+ ClassMethod dispatchCreateBusinessService(pTargetDispatchName As %String) As Ens.BusinessService
9
+ {
10
+ set tSC = ##class(Ens.Director).CreateBusinessService(pTargetDispatchName,.service)
11
+ if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
12
+ quit service
13
+ }
14
+
15
+ }
@@ -0,0 +1,27 @@
1
+ Class Grongier.PEX.DuplexOperation Extends Grongier.PEX.PrivateSessionDuplex
2
+ {
3
+
4
+ ClassMethod OnBusinessType(pItem As Ens.Config.Item) As %Integer
5
+ {
6
+ Quit $$$eHostTypeOperation
7
+ }
8
+
9
+ XData MessageMap
10
+ {
11
+ <MapItems>
12
+ <MapItem MessageType="Ens.Request"><Method>OnMessage</Method></MapItem>
13
+ </MapItems>
14
+ }
15
+
16
+ Method OnMessage(request As %Library.Persistent, Output response As %Library.Persistent) As %Status
17
+ {
18
+ set tSC = $$$OK
19
+ try {
20
+ set response = ..%class."_dispatch_on_message"(request)
21
+ } catch ex {
22
+ set tSC = ex.AsStatus()
23
+ }
24
+ quit tSC
25
+ }
26
+
27
+ }
@@ -0,0 +1,211 @@
1
+ /* Copyright (c) 2022 by InterSystems Corporation.
2
+ Cambridge, Massachusetts, U.S.A. All rights reserved.
3
+ Confidential property of InterSystems Corporation. */
4
+
5
+ Class Grongier.PEX.DuplexProcess Extends Grongier.PEX.BusinessProcess [ ClassType = persistent, ProcedureBlock, System = 4 ]
6
+ {
7
+
8
+ /// Domain for Text localization
9
+ Parameter DOMAIN = "PrivateSession";
10
+
11
+ /// The Duplex Service name. This property is set at runtime after receiving the primary request
12
+ Property ServiceDuplexName As %String;
13
+
14
+ /// Indicates if a given ConfigItem is in private session or not
15
+ Property %IsInPrivateSession As array Of %Boolean(STORAGEDEFAULT = "list");
16
+
17
+ /// This method is always called asynchronously ONCE at the beginning of the process
18
+ Method OnRequest(pRequest As %Library.Persistent, Output pResponse As Ens.Response) As %Status
19
+ {
20
+ #dim tSC As %Status = $$$OK
21
+ try {
22
+ If $IsObject(pRequest)&&($classname(pRequest)="Grongier.PEX.PrivateSession.Message.Start") {
23
+ Set tSC=..Reply(##class(Grongier.PEX.PrivateSession.Message.Ack).%New()) Quit:$$$ISERR(tSC)
24
+ Set ..ServiceDuplexName = ..%PrimaryRequestHeader.SourceConfigName
25
+ Do ..IsInPrivateSessionSet(..ServiceDuplexName,1)
26
+ Set tSC=..SendRequestAsync(..ServiceDuplexName,##class(Grongier.PEX.PrivateSession.Message.Poll).%New(),1) Quit:$$$ISERR(tSC)
27
+ Set tSC=..OnPrivateSessionStarted(..ServiceDuplexName,0) Quit:$$$ISERR(tSC)
28
+ } Else {
29
+ Set tSC=..OnDocument(..%PrimaryRequestHeader.SourceConfigName,pRequest)
30
+ }
31
+ } catch {
32
+ Set tSC=$$$EnsSystemError
33
+ }
34
+ Quit tSC
35
+ }
36
+
37
+ /// Handle a 'Response'
38
+ Method OnResponse(request As %Library.Persistent, ByRef response As %Library.Persistent, callrequest As %Library.Persistent, callresponse As %Library.Persistent, pCompletionKey As %String) As %Status
39
+ {
40
+ #dim tSC As %Status = $$$OK
41
+ #dim tSourceConfigName, tOneConfigName As %String
42
+ try {
43
+ ; get the SourceConfigName of this message
44
+ Set tSourceConfigName=..%CurrentResponseHeader.SourceConfigName
45
+ ; handle SessionStop message
46
+ If $IsObject(callresponse)&&($classname(callresponse)="Grongier.PEX.PrivateSession.Message.Ack") {
47
+ Do ..IsInPrivateSessionSet(tSourceConfigName,1)
48
+ Set tSC=..SendRequestAsync(tSourceConfigName,##class(Grongier.PEX.PrivateSession.Message.Poll).%New(),1) Quit:$$$ISERR(tSC)
49
+ Set tSC=..OnPrivateSessionStarted(tSourceConfigName,1) Quit:$$$ISERR(tSC)
50
+ Quit
51
+ }
52
+ ; handle SessionStop message
53
+ If $IsObject(callresponse)&&($classname(callresponse)="Grongier.PEX.PrivateSession.Message.Stop") {
54
+ Set tSC=..UnRegisterPrivateSession(tSourceConfigName) Quit:$$$ISERR(tSC)
55
+ Set tSC=..OnPrivateSessionStopped(tSourceConfigName,0,callresponse.AttachedMessage) Quit:$$$ISERR(tSC)
56
+ Quit
57
+ }
58
+ ; send poll request again back to the same ConfigItem if this this is in response to a poll request
59
+ If $IsObject(callrequest)&&($classname(callrequest)="Grongier.PEX.PrivateSession.Message.Poll") {
60
+ If ..IsInPrivateSession(tSourceConfigName) {
61
+ Set tSC=..SendRequestAsync(tSourceConfigName,##class(Grongier.PEX.PrivateSession.Message.Poll).%New(),1) If $$$ISERR(tSC)
62
+ }
63
+ }
64
+ ; call OnDocument
65
+ Set tSC=..OnDocument(tSourceConfigName,callresponse) Quit:$$$ISERR(tSC)
66
+ } catch {
67
+ Set tSC=$$$EnsSystemError
68
+ }
69
+ Quit tSC
70
+ }
71
+
72
+ Method StartPrivateSession(pDuplexConfigName As %String = "") As %Status
73
+ {
74
+ #dim tSC As %Status = $$$OK
75
+ try {
76
+ If pDuplexConfigName="" Set tSC=$$$EnsError($$$EnsErrGeneral,"Duplex configuration name is missing") Quit
77
+ If ..IsInPrivateSession(pDuplexConfigName) Quit
78
+ Set tSC=..SendRequestAsync(pDuplexConfigName,##class(Grongier.PEX.PrivateSession.Message.Start).%New()) Quit:$$$ISERR(tSC)
79
+ } catch {
80
+ Set tSC=$$$EnsSystemError
81
+ }
82
+ Quit tSC
83
+ }
84
+
85
+ Method StopPrivateSession(pDuplexConfigName As %String = "", pAttachedMessage As %Persistent = "") As %Status
86
+ {
87
+ #dim tSC As %Status = $$$OK
88
+ try {
89
+ If pDuplexConfigName="" Set tSC=$$$EnsError($$$EnsErrGeneral,"Duplex configuration name is missing") Quit
90
+ If '..IsInPrivateSession(pDuplexConfigName) Quit
91
+ Set tSC=..SendRequestAsync(pDuplexConfigName,##class(Grongier.PEX.PrivateSession.Message.Stop).%New(pAttachedMessage),0) Quit:$$$ISERR(tSC)
92
+ Set tSC=..UnRegisterPrivateSession(pDuplexConfigName)
93
+ Set tSC=..OnPrivateSessionStopped(pDuplexConfigName,1) Quit:$$$ISERR(tSC)
94
+ } catch {
95
+ Set tSC=$$$EnsSystemError
96
+ }
97
+ Quit tSC
98
+ }
99
+
100
+ Method StopAllPrivateSessions(pAttachedMessage As %Persistent = "") As %Status
101
+ {
102
+ #dim tSC As %Status = $$$OK
103
+ #dim tItem As %String
104
+ try {
105
+ Set tItem="" For {
106
+ Set tItem=..%IsInPrivateSession.Next(tItem) Quit:tItem=""
107
+ Set tSC=..StopPrivateSession(tItem,pAttachedMessage) Quit:$$$ISERR(tSC)
108
+ }
109
+ } catch {
110
+ Set tSC=$$$EnsSystemError
111
+ }
112
+ Quit tSC
113
+ }
114
+
115
+ Method UnRegisterPrivateSession(pDuplexConfigName As %String) As %String
116
+ {
117
+ #dim tSC As %Status = $$$OK
118
+ try {
119
+ For i=..%MasterPendingResponses.Count():-1:1 {
120
+ Set tRequestHeader=##class(Ens.MessageHeader).%OpenId($li(..%MasterPendingResponses.GetAt(i),1))
121
+ If $IsObject(tRequestHeader),tRequestHeader.TargetConfigName=pDuplexConfigName,tRequestHeader.MessageBodyClassName="Grongier.PEX.PrivateSession.Message.Poll" {
122
+ Do ..%MasterPendingResponses.RemoveAt(i)
123
+ }
124
+ }
125
+ Do ..IsInPrivateSessionSet(pDuplexConfigName,0)
126
+ } catch {
127
+ Set tSC=$$$EnsSystemError
128
+ }
129
+ Quit tSC
130
+ }
131
+
132
+ Method IsInPrivateSessionSet(pDuplexConfigName As %String, pInPrivateSession As %Boolean)
133
+ {
134
+ If pInPrivateSession {
135
+ Do ..%IsInPrivateSession.SetAt(1,pDuplexConfigName)
136
+ } Else {
137
+ Do ..%IsInPrivateSession.RemoveAt(pDuplexConfigName)
138
+ }
139
+ Quit
140
+ }
141
+
142
+ Method IsInPrivateSession(pDuplexConfigName As %String) As %Boolean
143
+ {
144
+ If pDuplexConfigName="" Quit 0
145
+ Quit ..%IsInPrivateSession.IsDefined(pDuplexConfigName)
146
+ }
147
+
148
+ Method OnDocument(pSourceConfigName As %String, pInput As %Library.Persistent) As %Status
149
+ {
150
+ set tSC = $$$OK
151
+ try {
152
+ set response = ..%class."_dispatch_on_document"($this,pSourceConfigName,pInput)
153
+ } catch ex {
154
+ set tSC = ex.AsStatus()
155
+ }
156
+ quit tSC
157
+ }
158
+
159
+ Method OnPrivateSessionStarted(pSourceConfigName As %String, pSelfGenerated As %Boolean) As %Status
160
+ {
161
+ set tSC = $$$OK
162
+ try {
163
+ set response = ..%class."_dispatch_on_private_session_started"($this,pSourceConfigName,pSelfGenerated)
164
+ } catch ex {
165
+ set tSC = ex.AsStatus()
166
+ }
167
+ quit tSC
168
+ }
169
+
170
+ Method OnPrivateSessionStopped(pSourceConfigName As %String, pSelfGenerated As %Boolean, pAttachedMessage As %Persistent = "") As %Status
171
+ {
172
+ set tSC = $$$OK
173
+ try {
174
+ set response = ..%class."_dispatch_on_private_session_stopped"($this,pSourceConfigName,pSelfGenerated,pAttachedMessage)
175
+ } catch ex {
176
+ set tSC = ex.AsStatus()
177
+ }
178
+ quit tSC
179
+ }
180
+
181
+ Storage Default
182
+ {
183
+ <Data name="ProcessDefaultData">
184
+ <Subscript>"Process"</Subscript>
185
+ <Value name="1">
186
+ <Value>ServiceDuplexName</Value>
187
+ </Value>
188
+ <Value name="2">
189
+ <Value>%IsInPrivateSession</Value>
190
+ </Value>
191
+ <Value name="3">
192
+ <Value>%classpaths</Value>
193
+ </Value>
194
+ <Value name="4">
195
+ <Value>%classname</Value>
196
+ </Value>
197
+ <Value name="5">
198
+ <Value>%module</Value>
199
+ </Value>
200
+ <Value name="6">
201
+ <Value>%settings</Value>
202
+ </Value>
203
+ <Value name="7">
204
+ <Value>%class</Value>
205
+ </Value>
206
+ </Data>
207
+ <DefaultData>ProcessDefaultData</DefaultData>
208
+ <Type>%Storage.Persistent</Type>
209
+ }
210
+
211
+ }
@@ -0,0 +1,9 @@
1
+ Class Grongier.PEX.DuplexService Extends Grongier.PEX.PrivateSessionDuplex
2
+ {
3
+
4
+ ClassMethod OnBusinessType(pItem As Ens.Config.Item) As %Integer
5
+ {
6
+ Quit $$$eHostTypeService
7
+ }
8
+
9
+ }
@@ -0,0 +1,22 @@
1
+ /* Copyright (c) 2021 by InterSystems Corporation.
2
+ Cambridge, Massachusetts, U.S.A. All rights reserved.
3
+ Confidential property of InterSystems Corporation. */
4
+
5
+ Class Grongier.PEX.InboundAdapter Extends (Ens.InboundAdapter, Grongier.PEX.Common) [ Inheritance = right, ProcedureBlock, System = 4 ]
6
+ {
7
+
8
+ Parameter SETTINGS = "%classname:Python InboundAdapter,%module:Python InboundAdapter,%settings:Python InboundAdapter,%classpaths:Python InboundAdapter";
9
+
10
+ Method OnTask() As %Status
11
+ {
12
+ set tSC = $$$OK
13
+ try {
14
+ $$$ThrowOnError(..Connect())
15
+ do ..%class."on_task"()
16
+ } catch ex {
17
+ set tSC = ex.AsStatus()
18
+ }
19
+ quit tSC
20
+ }
21
+
22
+ }