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,62 @@
1
+ /// Description
2
+ Class Grongier.PEX.Test Extends %Persistent
3
+ {
4
+
5
+ /// Register
6
+ ClassMethod Register() As %Status
7
+ {
8
+ Set sc = $$$OK
9
+ zw ##class(Grongier.PEX.Utils).RegisterComponent("MyBusinessOperationWithAdapter","MyBusinessOperationWithAdapter","/irisdev/app/src/python/demo/",1,"PEX.MyBusinessOperationWithAdapter")
10
+ #dim array as %ArrayOfObjects
11
+ Return sc
12
+ }
13
+
14
+ ClassMethod TestBO() As %Status
15
+ {
16
+ try {
17
+ Set sc = $$$OK
18
+ set mybo = ##class(Grongier.PEX.BusinessOperation).%New("mybo")
19
+ set mybo.%classpaths = "/irisdev/app/src/python/demo"
20
+ set mybo.%module = "MyBusinessOperationWithAdapter"
21
+ set mybo.%classname = "MyBusinessOperationWithAdapter"
22
+ $$$ThrowOnError(mybo.OnInit())
23
+ set request = ##class(Ens.StringRequest).%New("hello")
24
+ set request = ##class(EnsLib.PEX.Message).%New()
25
+ set request.%classname = "MyRequest.MyRequest"
26
+ set dyna = {"requestString":"hello!"}
27
+ set request.%jsonObject = dyna
28
+ Try {
29
+ $$$ThrowOnError(mybo.OnMessage(request,.response))
30
+ zw response
31
+ } catch importEx {
32
+ WRITE $System.Status.GetOneStatusText(importEx.AsStatus(),1),!
33
+ }
34
+ } catch ex {
35
+ WRITE $System.Status.GetOneStatusText(ex.AsStatus(),1),!
36
+ }
37
+
38
+ Return sc
39
+ }
40
+
41
+ /// List
42
+ ClassMethod PythonList() [ Language = python ]
43
+ {
44
+ return [ 1, 3 ]
45
+ }
46
+
47
+ Storage Default
48
+ {
49
+ <Data name="TestDefaultData">
50
+ <Value name="1">
51
+ <Value>%%CLASSNAME</Value>
52
+ </Value>
53
+ </Data>
54
+ <DataLocation>^Grongier.PEX.TestD</DataLocation>
55
+ <DefaultData>TestDefaultData</DefaultData>
56
+ <IdLocation>^Grongier.PEX.TestD</IdLocation>
57
+ <IndexLocation>^Grongier.PEX.TestI</IndexLocation>
58
+ <StreamLocation>^Grongier.PEX.TestS</StreamLocation>
59
+ <Type>%Storage.Persistent</Type>
60
+ }
61
+
62
+ }
@@ -0,0 +1,312 @@
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.Utils [ Abstract ]
8
+ {
9
+
10
+ ClassMethod dispatchRegisterComponent(pModule As %String, pRemoteClassname As %String, pCLASSPATHS As %String = "", pOverwrite As %Boolean = 0, pProxyClassname As %String = "") As %Status
11
+ {
12
+ set tSc = $$$OK
13
+ $$$ThrowOnError(##class(Grongier.PEX.Utils).RegisterComponent(pModule, pRemoteClassname, pCLASSPATHS, pOverwrite , pProxyClassname))
14
+ return tSc
15
+ }
16
+
17
+ /// "bo","Duplex","/irisdev/app/src/python/demo/duplex/",1,"Duplex.Duplex"
18
+ ClassMethod RegisterComponent(pModule As %String, pRemoteClassname As %String, pCLASSPATHS As %String = "", pOverwrite As %Boolean = 0, pProxyClassname As %String = "") As %Status
19
+ {
20
+ #dim tSC As %Status = $$$OK
21
+ #dim ex As %Exception.AbstractException
22
+ #dim tLanguage,tExtraClasspaths,tDelimiter,tOnePath As %String = ""
23
+ #dim tClassDetails,tRemoteSettings As %String = ""
24
+ #dim tClasspaths As %ListOfDataTypes
25
+
26
+ Quit:(""=pRemoteClassname) $$$ERROR($$$EnsErrGeneral,"Remote Classname must be specified in order to register a Production EXtensions component")
27
+ Quit:(""=pModule) $$$ERROR($$$EnsErrGeneral,"Must specify the module of the remote code.")
28
+
29
+ Try {
30
+
31
+ $$$ThrowOnError(..GetRemoteClassInfo(pRemoteClassname,pModule,pCLASSPATHS,.tClassDetails,.tRemoteSettings))
32
+
33
+ Set tConnectionSettings("Classpaths") = pCLASSPATHS
34
+ Set tConnectionSettings("Module") = pModule
35
+ Set tConnectionSettings("Classname") = pRemoteClassname
36
+ Set:(""=pProxyClassname) pProxyClassname = "User."_pRemoteClassname
37
+
38
+ $$$ThrowOnError(..GenerateProxyClass(pProxyClassname,.tConnectionSettings,tClassDetails,tRemoteSettings,pOverwrite))
39
+
40
+ } Catch ex {
41
+ set msg = $System.Status.GetOneStatusText(ex.AsStatus(),1)
42
+ set tSC = $$$ERROR($$$EnsErrGeneral,msg)
43
+ }
44
+
45
+ Quit tSC
46
+ }
47
+
48
+ ClassMethod DeleteComponentProxy(pClassname As %String = "") As %Status
49
+ {
50
+ #dim tSC As %Status = $$$OK
51
+ #dim ex As %Exception.AbstractException
52
+ #dim tIsPEX As %Boolean = 0
53
+ #dim tClass As %Dictionary.CompiledClass
54
+
55
+ Quit:(""=pClassname) $$$ERROR($$$EnsErrGeneral,"Remote class name must be specified.")
56
+
57
+ Try {
58
+
59
+ If '##class(%Dictionary.ClassDefinition).%ExistsId(pClassname) {
60
+ Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("No proxy class defined for remote class '%1'.",pClassname))
61
+ Quit
62
+ }
63
+ If $classmethod(pClassname,"%Extends","Grongier.PEX.Common") {
64
+ Set tClass = ##class(%Dictionary.CompiledClass).%OpenId(pClassname,,.tSC)
65
+ Quit:$$$ISERR(tSC)
66
+ If '$IsObject(tClass) {
67
+ Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Proxy class for remote class '%1' could not be opened.",pClassname))
68
+ Quit
69
+ }
70
+ Set tIsPEX = ("Grongier.PEX.Utils" = tClass.GeneratedBy)
71
+ }
72
+ If tIsPEX {
73
+ Set tSC = ##class(%Dictionary.ClassDefinition).%DeleteId(pClassname)
74
+ If $$$ISERR(tSC) {
75
+ Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Unable to delete proxy class for remote class '%1' : '%2'.",pClassname,$System.Status.GetErrorText(tSC)))
76
+ Quit
77
+ }
78
+ } Else {
79
+ Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Cannot delete class '%1' because it is not a PEX proxy class.",pClassname))
80
+ Quit
81
+ }
82
+
83
+ } Catch ex {
84
+ Set tSC = ex.AsStatus()
85
+ }
86
+
87
+ Quit tSC
88
+ }
89
+
90
+ // ..GetRemoteClassInfo(pRemoteClassname,pModule,pCLASSPATHS,.tClassDetails,.tRemoteSettings)
91
+
92
+ ClassMethod GetRemoteClassInfo(pRemoteClassname As %String, pModule As %String, pClasspaths As %String, ByRef pClassDetails, ByRef pRemoteSettings) As %Status [ Internal, Private ]
93
+ {
94
+ #dim tSC As %Status = $$$OK
95
+ #dim ex As %Exception.AbstractException
96
+ #dim tGateway As %External.Gateway
97
+ #dim tGatewayProxy As %Net.Remote.Object
98
+
99
+ Try {
100
+ if pClasspaths '="" {
101
+ set delimiter = $s($system.Version.GetOS()="Windows":";",1:":")
102
+ set extraClasspaths = $tr(pClasspaths,delimiter,"|")
103
+ for i=1:1:$l(extraClasspaths,"|") {
104
+ set onePath = $p(extraClasspaths,"|",i)
105
+ set onePath = ##class(%File).NormalizeDirectory(onePath)
106
+ if onePath?1"$$IRISHOME"1P.E set onePath = $e($system.Util.InstallDirectory(),1,*-1)_$e(onePath,11,*)
107
+ if onePath'="" do ##class(Grongier.PEX.Python).SetClassPath(onePath)
108
+ }
109
+ }
110
+ ;
111
+
112
+ set tClass = ##class(Grongier.PEX.Python).GetInstanceFromModuleClassName(pModule,pRemoteClassname)
113
+
114
+ If $IsObject(tClass) {
115
+ #; List of information about the class as a whole - $lb(SuperClass, Description, InfoURL, IconURL, Adapter)
116
+ Set pClassDetails = tClass."_get_info"()
117
+ #; List of information about the various properties of the class
118
+ #; List of lists of form $lb(propName,dataType,defaultVal,required,category,description)
119
+ Set pRemoteSettings = tClass."_get_properties"()
120
+ } Else {
121
+ Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Error opening gateway proxy for class '%1'"),pRemoteClassname)
122
+ }
123
+ } Catch ex {
124
+ set msg = $System.Status.GetOneStatusText(ex.AsStatus(),1)
125
+ set tSC = $$$ERROR($$$EnsErrGeneral,msg)
126
+ }
127
+
128
+ Quit tSC
129
+ }
130
+
131
+ /// Set tConnectionSettings("Classpaths") = pCLASSPATHS
132
+ /// Set tConnectionSettings("Module") = pModule
133
+ /// Set tConnectionSettings("Classname") = pRemoteClassname
134
+ /// Set:(""=pProxyClassname) pProxyClassname = pRemoteClassname
135
+ ///
136
+ /// Set tSC = ..GenerateProxyClass(pProxyClassname,.tConnectionSettings,tClassDetails,tRemoteSettings,pOverwrite)
137
+ /// "bo","Duplex","/irisdev/app/src/python/demo/duplex/",1,"Duplex.Duplex"
138
+ ClassMethod GenerateProxyClass(pClassname As %String, ByRef pConnectionSettings, pClassDetails As %String = "", pRemoteSettings As %String = "", pOverwrite As %Boolean = 0) As %Status [ Internal, Private ]
139
+ {
140
+ #dim tSC As %Status = $$$OK
141
+ #dim ex As %Exception.AbstractException
142
+
143
+ Quit:(""=pClassname) $$$ERROR($$$EnsErrGeneral,"Class name must be specified in order to generate a proxy class for this Production EXtensions component")
144
+
145
+ Try {
146
+
147
+ If ##class(%Dictionary.ClassDefinition).%ExistsId(pClassname) {
148
+ If 'pOverwrite {
149
+ Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Proxy class '%1' already exists.",pClassname))
150
+ Quit
151
+ } Else {
152
+ #dim tIsPEX As %Boolean = 0
153
+ If $classmethod(pClassname,"%Extends","Grongier.PEX.Common") {
154
+ #dim tClass As %Dictionary.CompiledClass = ##class(%Dictionary.CompiledClass).%OpenId(pClassname)
155
+ If '$IsObject(tClass) {
156
+ Set tSC = $$$ERROR($$$EnsErrGeneral,"Class not found")
157
+ Quit
158
+ }
159
+ Set tIsPEX = ("Grongier.PEX.Utils" = tClass.GeneratedBy)
160
+ }
161
+ If tIsPEX {
162
+ Set tSC = ##class(%Dictionary.ClassDefinition).%DeleteId(pClassname)
163
+ If $$$ISERR(tSC) {
164
+ Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Unable to delete existing proxy class '%1' : '%2'.",pClassname,$System.Status.GetErrorText(tSC)))
165
+ Quit
166
+ }
167
+ } Else {
168
+ Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Cannot overwrite class '%1' because it is not a PEX proxy class.",pClassname))
169
+ Quit
170
+ }
171
+ }
172
+ }
173
+
174
+ #; create subclass of the ObjectScript Business Host
175
+ #dim tCOSClass As %Dictionary.ClassDefinition
176
+ Set tCOSClass = ##class(%Dictionary.ClassDefinition).%New()
177
+ Set tCOSClass.Name = pClassname
178
+
179
+ #dim tSuperClass As %String = pClassDetails."__getitem__"(0)
180
+ If (""=tSuperClass) {
181
+ Set tSC = $$$ERROR($$$EnsErrGeneral,"No PEX superclass found.")
182
+ Quit
183
+ }
184
+ If '$Case($P(tSuperClass,".",*),"DuplexProcess":1,"DuplexService":1,"DuplexOperation":1,"InboundAdapter":1,"OutboundAdapter":1,"BusinessService":1,"BusinessProcess":1,"BusinessOperation":1,:0) {
185
+ Set tSC = $$$ERROR($$$EnsErrGeneral,"Invalid superclass")
186
+ Quit
187
+ }
188
+ Set tSuperClass = "Grongier.PEX."_$P(tSuperClass,".",*)
189
+
190
+ Set tCOSClass.Super = tSuperClass
191
+ Set tCOSClass.GeneratedBy = $CLASSNAME()
192
+ Set tCOSClass.ClassVersion = $$$CLASSDEFINITIONVERSION
193
+ #dim tDescription As %String = pClassDetails."__getitem__"(1)
194
+ If (""'=tDescription) {
195
+ Set tCOSClass.Description = $Replace(tDescription,$C(10),$C(13,10))
196
+ }
197
+
198
+ #; Do not display any of the connection settings
199
+ #dim tSETTINGSParamValue As %String = "%classname:Python $type,%module:Python $type,%settings:Python $type,%classpaths:Python $type"
200
+
201
+ #dim tPropClassname As %Dictionary.PropertyDefinition = ##class(%Dictionary.PropertyDefinition).%New()
202
+ Set tPropClassname.Name = "%classname"
203
+ Set tPropClassname.Type = "%String"
204
+ Set tPropClassname.InitialExpression = $$$quote(pConnectionSettings("Classname"))
205
+ Set tPropClassname.Internal = 1
206
+ Set tSC = tCOSClass.Properties.Insert(tPropClassname)
207
+ Quit:$$$ISERR(tSC)
208
+
209
+
210
+ #dim tPropClasspaths As %Dictionary.PropertyDefinition = ##class(%Dictionary.PropertyDefinition).%New()
211
+ Set tPropClasspaths.Name = "%classpaths"
212
+ Set tPropClasspaths.Type = "%String"
213
+ Set tSC = tPropClasspaths.Parameters.SetAt("","MAXLEN")
214
+ Quit:$$$ISERR(tSC)
215
+ Set tPropClasspaths.InitialExpression = $$$quote(pConnectionSettings("Classpaths"))
216
+ Set tPropClasspaths.Description = "One or more Classpaths (separated by '|' character) needed in addition to the ones configured in the Remote Gateway"
217
+ Set tSC = tCOSClass.Properties.Insert(tPropClasspaths)
218
+ Quit:$$$ISERR(tSC)
219
+
220
+
221
+ #dim tPropLanguage As %Dictionary.PropertyDefinition = ##class(%Dictionary.PropertyDefinition).%New()
222
+ Set tPropLanguage.Name = "%module"
223
+ Set tPropLanguage.Type = "%String"
224
+ Set tPropLanguage.Internal = 1
225
+ Set tPropLanguage.InitialExpression = $$$quote(pConnectionSettings("Module"))
226
+ Set tSC = tCOSClass.Properties.Insert(tPropLanguage)
227
+ Quit:$$$ISERR(tSC)
228
+
229
+ If $Case(tSuperClass,"Grongier.PEX.BusinessService":1,"Grongier.PEX.BusinessOperation":1,"Grongier.PEX.DuplexService":1,"Grongier.PEX.DuplexOperation":1,:0) {
230
+
231
+ If (##class(Grongier.PEX.Python).Len(pClassDetails)>4) { //Adaptor
232
+
233
+ #dim tAdapterClass = pClassDetails."__getitem__"(4)
234
+ #; May want to issue a warning in the UI if the Adapter class does not exist
235
+ #; but we don't check here because it does compile and may just be that the user is registering the Service/Operation before the Adapter
236
+ #dim tADAPTERParam As %Dictionary.ParameterDefinition = ##class(%Dictionary.ParameterDefinition).%New()
237
+ Set tADAPTERParam.Name = "ADAPTER"
238
+ Set tADAPTERParam.Default = tAdapterClass
239
+ Set tSC = tCOSClass.Parameters.Insert(tADAPTERParam)
240
+ Quit:$$$ISERR(tSC)
241
+ }
242
+ }
243
+
244
+ set type = ""
245
+ set:($Case(tSuperClass,"Grongier.PEX.InboundAdapter":1,"Grongier.PEX.OutboundAdapter":1,:0)) type = "Adapter"
246
+ set tSETTINGSParamValue = $REPLACE(tSETTINGSParamValue,"$type",type)
247
+
248
+ #dim tSETTINGSParam As %Dictionary.ParameterDefinition = ##class(%Dictionary.ParameterDefinition).%New()
249
+ Set tSETTINGSParam.Name = "SETTINGS"
250
+ Set tSETTINGSParam.Default = tSETTINGSParamValue
251
+ Set tSC = tCOSClass.Parameters.Insert(tSETTINGSParam)
252
+ Quit:$$$ISERR(tSC)
253
+
254
+ Set tSC = tCOSClass.%Save()
255
+ Quit:$$$ISERR(tSC)
256
+
257
+ Set tSC = $System.OBJ.Compile(pClassname,"-d")
258
+
259
+ } Catch ex {
260
+ Set tSC = ex.AsStatus()
261
+ }
262
+
263
+ Quit tSC
264
+ }
265
+
266
+ // Thanks to Alex Woodhead for this serializer
267
+ ClassMethod ListFrompyList(ByRef pyList As %SYS.Python = {$$$NULLOREF}, ByRef impBi As %SYS.Python = {##class(%SYS.Python).Import("builtins")}, msgkeys = "") As %SYS.Python [ ProcedureBlock = 1 ]
268
+ {
269
+ set ret=$LB()
270
+ // How to get length of list
271
+ set listlen=impBi.len(pyList)
272
+ for i=1:1:listlen {
273
+ set data=..pyListGet(i,pyList)
274
+ // if data is also a list // TODO
275
+ if $IsObject(data) {
276
+ if ..pyListIs(data) {
277
+ set data=..ListFrompyList(data,impBi,,msgkeys_"["_i_"]")
278
+ } else {
279
+ set $ZE="Class "_..%ClassName(1)_" Method ListFrompyList. Unsupported value type """_..pyTypeName(data)_""" at position "_msgkeys_"["_i_"]"
280
+ do BACK^%ETN
281
+ }
282
+ }
283
+ // add string / numeric / IRIS LIST to ret
284
+ set ret=$LU(ret,i,data)
285
+ }
286
+ quit ret
287
+ }
288
+
289
+ ClassMethod pyListIs(ByRef pyList As %SYS.Python) As %SYS.Python [ Language = python ]
290
+ {
291
+ return (type(pyList)==list)
292
+ }
293
+
294
+ /// Returns empty string on error
295
+ /// position starts at one to keep same as IRIS List
296
+ ClassMethod pyListGet(position As %Integer, ByRef pyList As %SYS.Python) As %SYS.Python [ Language = python ]
297
+ {
298
+ ret=""
299
+ try:
300
+ ret=(pyList[position-1])
301
+ except:
302
+ print("Error in pyListGet")
303
+
304
+ return ret
305
+ }
306
+
307
+ ClassMethod pyTypeName(obj As %SYS.Python) As %String [ Language = python ]
308
+ {
309
+ return type(obj).__name__
310
+ }
311
+
312
+ }
File without changes
@@ -31,9 +31,13 @@ class _BusinessHost(_Common):
31
31
  :return: The function dispatch_serializer is being returned.
32
32
  """
33
33
  def dispatch_serializer(self,*params, **param2):
34
+ # Handle positional arguments
34
35
  serialized=[]
35
36
  for param in params:
36
37
  serialized.append(self._dispatch_serializer(param))
38
+ # Handle keyword arguments
39
+ for key, value in param2.items():
40
+ param2[key] = self._dispatch_serializer(value)
37
41
  return fonction(self,*serialized, **param2)
38
42
  return dispatch_serializer
39
43
 
@@ -60,9 +64,13 @@ class _BusinessHost(_Common):
60
64
  :return: The function dispatch_deserializer is being returned.
61
65
  """
62
66
  def dispatch_deserializer(self,*params, **param2):
67
+ # Handle positional arguments
63
68
  serialized=[]
64
69
  for param in params:
65
- serialized.append(self._dispatch_deserializer(param))
70
+ serialized.append(self._dispatch_serializer(param))
71
+ # Handle keyword arguments
72
+ for key, value in param2.items():
73
+ param2[key] = self._dispatch_serializer(value)
66
74
  return fonction(self,*serialized, **param2)
67
75
  return dispatch_deserializer
68
76
 
grongier/pex/_cli.py CHANGED
@@ -14,6 +14,7 @@ from grongier.pex._utils import _Utils
14
14
 
15
15
  import argparse
16
16
  import json
17
+ import os
17
18
  from importlib.metadata import version
18
19
 
19
20
  def parse_args():
@@ -90,8 +91,13 @@ def main(argv=None):
90
91
  _Director.restart_production()
91
92
 
92
93
  elif args.migrate:
93
- # migrate a production
94
- _Utils.migrate(args.migrate)
94
+ # check if migrate is absolute path
95
+ if os.path.isabs(args.migrate):
96
+ # migrate a production with absolute path
97
+ _Utils.migrate(args.migrate)
98
+ else:
99
+ # migrate a production with relative path
100
+ _Utils.migrate(os.path.join(os.getcwd(), args.migrate))
95
101
 
96
102
  elif args.version:
97
103
  # display version
@@ -0,0 +1,35 @@
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(
11
+ request As %Library.Persistent,
12
+ Output response As %Library.Persistent) As %Status
13
+ {
14
+ set tSC = $$$OK
15
+ try {
16
+ set response = ..%class."_dispatch_on_message"(request)
17
+ } catch ex {
18
+ set tSC = ex.AsStatus()
19
+ }
20
+ quit tSC
21
+ }
22
+
23
+ Method OnKeepalive(pStatus As %Status = {$$$OK}) As %Status
24
+ {
25
+ set tSC = $$$OK
26
+ try {
27
+ $$$ThrowOnError(##super(pStatus))
28
+ do ..%class."on_keepalive"()
29
+ } catch ex {
30
+ set tSC = ex.AsStatus()
31
+ }
32
+ quit tSC
33
+ }
34
+
35
+ }
@@ -0,0 +1,113 @@
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(
20
+ timeout,
21
+ completionKey)
22
+ {
23
+ set tSC = ..SetTimer(timeout,$g(completionKey))
24
+ if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
25
+ quit
26
+ }
27
+
28
+ Method OnRequest(
29
+ request As %Persistent,
30
+ Output response As %Persistent) As %Status
31
+ {
32
+ set tSC = $$$OK
33
+ try {
34
+ set response = ..%class."_dispatch_on_request"($this,request)
35
+ } catch ex {
36
+ set tSC = ex.AsStatus()
37
+ }
38
+ quit tSC
39
+ }
40
+
41
+ /// Handle a 'Response'
42
+ Method OnResponse(
43
+ request As %Persistent,
44
+ Output response As %Persistent,
45
+ callRequest As %Persistent,
46
+ callResponse As %Persistent,
47
+ pCompletionKey As %String) As %Status
48
+ {
49
+ set tSC = $$$OK
50
+ try {
51
+ set response = ..%class."_dispatch_on_response"($this,request,response,callRequest,callResponse,pCompletionKey)
52
+ } catch ex {
53
+ set tSC = ex.AsStatus()
54
+ }
55
+ quit tSC
56
+ }
57
+
58
+ Method OnComplete(
59
+ request As %Library.Persistent,
60
+ ByRef response As %Library.Persistent) As %Status
61
+ {
62
+ set tSC = $$$OK
63
+ try {
64
+ set tSC = ..Connect() quit:$$$ISERR(tSC)
65
+ set response = ..%class."_dispatch_on_complete"($this,request,response)
66
+ } catch ex {
67
+ set tSC = ex.AsStatus()
68
+ }
69
+ quit tSC
70
+ }
71
+
72
+ Method getPersistentProperty(name)
73
+ {
74
+ quit ..persistentProperties.GetAt(name)
75
+ }
76
+
77
+ Method setPersistentProperty(
78
+ name,
79
+ value)
80
+ {
81
+ quit ..persistentProperties.SetAt(value,name)
82
+ }
83
+
84
+ Storage Default
85
+ {
86
+ <Data name="BusinessProcessDefaultData1">
87
+ <Subscript>"BusinessProcess"</Subscript>
88
+ <Value name="1">
89
+ <Value>%classpaths</Value>
90
+ </Value>
91
+ <Value name="2">
92
+ <Value>%classname</Value>
93
+ </Value>
94
+ <Value name="3">
95
+ <Value>%module</Value>
96
+ </Value>
97
+ <Value name="4">
98
+ <Value>%settings</Value>
99
+ </Value>
100
+ <Value name="5">
101
+ <Value>%class</Value>
102
+ </Value>
103
+ </Data>
104
+ <Data name="persistentProperties">
105
+ <Attribute>persistentProperties</Attribute>
106
+ <Structure>subnode</Structure>
107
+ <Subscript>"Grongier.PEX.BusinessProcess.persistentProperties"</Subscript>
108
+ </Data>
109
+ <DefaultData>BusinessProcessDefaultData1</DefaultData>
110
+ <Type>%Storage.Persistent</Type>
111
+ }
112
+
113
+ }
@@ -0,0 +1,35 @@
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(
17
+ request As %RegisteredObject,
18
+ Output response As %RegisteredObject) As %Status
19
+ {
20
+ set tSC = $$$OK
21
+ try {
22
+ try {
23
+ set ..%class."_wait_for_next_call_interval" = ..%WaitForNextCallInterval
24
+ } catch {}
25
+ set response = ..%class."_dispatch_on_process_input"(request)
26
+ try {
27
+ set ..%WaitForNextCallInterval = ..%class."_wait_for_next_call_interval"
28
+ } catch {}
29
+ } catch ex {
30
+ set tSC = ex.AsStatus()
31
+ }
32
+ quit tSC
33
+ }
34
+
35
+ }