sqlalchemy-iris 0.5.0b3__py3-none-any.whl → 0.6.0b1__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.
Files changed (77) hide show
  1. intersystems_iris/_BufferReader.py +10 -0
  2. intersystems_iris/_BufferWriter.py +32 -0
  3. intersystems_iris/_ConnectionInformation.py +54 -0
  4. intersystems_iris/_ConnectionParameters.py +18 -0
  5. intersystems_iris/_Constant.py +38 -0
  6. intersystems_iris/_DBList.py +499 -0
  7. intersystems_iris/_Device.py +69 -0
  8. intersystems_iris/_GatewayContext.py +25 -0
  9. intersystems_iris/_GatewayException.py +4 -0
  10. intersystems_iris/_GatewayUtility.py +74 -0
  11. intersystems_iris/_IRIS.py +1294 -0
  12. intersystems_iris/_IRISConnection.py +516 -0
  13. intersystems_iris/_IRISEmbedded.py +85 -0
  14. intersystems_iris/_IRISGlobalNode.py +273 -0
  15. intersystems_iris/_IRISGlobalNodeView.py +25 -0
  16. intersystems_iris/_IRISIterator.py +143 -0
  17. intersystems_iris/_IRISList.py +360 -0
  18. intersystems_iris/_IRISNative.py +208 -0
  19. intersystems_iris/_IRISOREF.py +4 -0
  20. intersystems_iris/_IRISObject.py +424 -0
  21. intersystems_iris/_IRISReference.py +133 -0
  22. intersystems_iris/_InStream.py +149 -0
  23. intersystems_iris/_LegacyIterator.py +135 -0
  24. intersystems_iris/_ListItem.py +15 -0
  25. intersystems_iris/_ListReader.py +84 -0
  26. intersystems_iris/_ListWriter.py +157 -0
  27. intersystems_iris/_LogFileStream.py +115 -0
  28. intersystems_iris/_MessageHeader.py +51 -0
  29. intersystems_iris/_OutStream.py +25 -0
  30. intersystems_iris/_PrintStream.py +65 -0
  31. intersystems_iris/_PythonGateway.py +850 -0
  32. intersystems_iris/_SharedMemorySocket.py +87 -0
  33. intersystems_iris/__init__.py +79 -0
  34. intersystems_iris/__main__.py +7 -0
  35. intersystems_iris/dbapi/_Column.py +56 -0
  36. intersystems_iris/dbapi/_DBAPI.py +2295 -0
  37. intersystems_iris/dbapi/_Descriptor.py +46 -0
  38. intersystems_iris/dbapi/_IRISStream.py +63 -0
  39. intersystems_iris/dbapi/_Message.py +158 -0
  40. intersystems_iris/dbapi/_Parameter.py +138 -0
  41. intersystems_iris/dbapi/_ParameterCollection.py +133 -0
  42. intersystems_iris/dbapi/_ResultSetRow.py +314 -0
  43. intersystems_iris/dbapi/_SQLType.py +32 -0
  44. intersystems_iris/dbapi/__init__.py +0 -0
  45. intersystems_iris/dbapi/preparser/_PreParser.py +1658 -0
  46. intersystems_iris/dbapi/preparser/_Scanner.py +391 -0
  47. intersystems_iris/dbapi/preparser/_Token.py +81 -0
  48. intersystems_iris/dbapi/preparser/_TokenList.py +251 -0
  49. intersystems_iris/dbapi/preparser/__init__.py +0 -0
  50. intersystems_iris/pex/_BusinessHost.py +101 -0
  51. intersystems_iris/pex/_BusinessOperation.py +105 -0
  52. intersystems_iris/pex/_BusinessProcess.py +214 -0
  53. intersystems_iris/pex/_BusinessService.py +95 -0
  54. intersystems_iris/pex/_Common.py +228 -0
  55. intersystems_iris/pex/_Director.py +24 -0
  56. intersystems_iris/pex/_IRISBusinessOperation.py +5 -0
  57. intersystems_iris/pex/_IRISBusinessService.py +18 -0
  58. intersystems_iris/pex/_IRISInboundAdapter.py +5 -0
  59. intersystems_iris/pex/_IRISOutboundAdapter.py +17 -0
  60. intersystems_iris/pex/_InboundAdapter.py +57 -0
  61. intersystems_iris/pex/_Message.py +6 -0
  62. intersystems_iris/pex/_OutboundAdapter.py +46 -0
  63. intersystems_iris/pex/__init__.py +25 -0
  64. iris/__init__.py +25 -0
  65. iris/iris_site.py +13 -0
  66. iris/irisbuiltins.py +97 -0
  67. iris/irisloader.py +199 -0
  68. irisnative/_IRISNative.py +9 -0
  69. irisnative/__init__.py +10 -0
  70. {sqlalchemy_iris-0.5.0b3.dist-info → sqlalchemy_iris-0.6.0b1.dist-info}/METADATA +1 -1
  71. sqlalchemy_iris-0.6.0b1.dist-info/RECORD +83 -0
  72. sqlalchemy_iris-0.6.0b1.dist-info/top_level.txt +4 -0
  73. sqlalchemy_iris-0.5.0b3.dist-info/RECORD +0 -14
  74. sqlalchemy_iris-0.5.0b3.dist-info/top_level.txt +0 -1
  75. {sqlalchemy_iris-0.5.0b3.dist-info → sqlalchemy_iris-0.6.0b1.dist-info}/LICENSE +0 -0
  76. {sqlalchemy_iris-0.5.0b3.dist-info → sqlalchemy_iris-0.6.0b1.dist-info}/WHEEL +0 -0
  77. {sqlalchemy_iris-0.5.0b3.dist-info → sqlalchemy_iris-0.6.0b1.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,251 @@
1
+ import abc
2
+ import intersystems_iris.dbapi.preparser._Token
3
+
4
+ class ITokenEnumerator(object):
5
+ __metaclass__ = abc.ABCMeta
6
+
7
+ @abc.abstractmethod
8
+ def Reset(self):
9
+ pass
10
+
11
+ @abc.abstractmethod
12
+ def Current(self):
13
+ pass
14
+
15
+ @abc.abstractmethod
16
+ def MoveNext(self):
17
+ pass
18
+
19
+ @abc.abstractmethod
20
+ def MovePrevious(self):
21
+ pass
22
+
23
+ @abc.abstractmethod
24
+ def Clone(self):
25
+ pass
26
+
27
+ @abc.abstractmethod
28
+ def Count(self):
29
+ pass
30
+
31
+ class TokenListNode(object):
32
+ def __init__(self, Value, Owner):
33
+ if not isinstance(Value, intersystems_iris.dbapi.preparser._Token._Token):
34
+ raise TypeError("Value must be a _Token")
35
+
36
+ self.m_Previous = None
37
+ self.m_Next = None
38
+ self.m_Value = Value
39
+
40
+ def GetValue(self):
41
+ return self.m_Value
42
+
43
+ def SetValue(self, value):
44
+ if not isinstance(value, intersystems_iris.dbapi.preparser._Token._Token):
45
+ raise TypeError("value must be a _Token")
46
+
47
+ self.m_Value = value
48
+
49
+ def Previous(self):
50
+ return self.m_Previous
51
+
52
+ def Next(self):
53
+ return self.m_Next
54
+
55
+ def SetPrevious(self, node):
56
+ if not isinstance(node, TokenListNode):
57
+ raise TypeError("node must be a TokenListNode")
58
+
59
+ self.m_Previous = node
60
+
61
+ def SetNext(self, node):
62
+ if not isinstance(node, TokenListNode):
63
+ raise TypeError("node must be a TokenListNode")
64
+
65
+ self.m_Next = node
66
+
67
+
68
+ class _TokenList(object):
69
+ def __init__(self):
70
+ self.m_Count = 0
71
+ self.m_Head = None
72
+ self.m_Tail = None
73
+
74
+ def Count(self):
75
+ return self.m_Count
76
+
77
+ def GetToken(self, index):
78
+ try:
79
+ index = int(index)
80
+ except (TypeError, ValueError):
81
+ raise ValueError("index must be an integer")
82
+
83
+ if index < 0 or index > (self.Count() - 1):
84
+ raise IndexError("Index " + index + " is out of range")
85
+
86
+ node = self.First()
87
+ for i in range(index):
88
+ node = node.Next()
89
+ return node.GetValue()
90
+
91
+ def SetToken(self, index, value):
92
+ try:
93
+ index = int(index)
94
+ except (TypeError, ValueError):
95
+ raise ValueError("index must be an integer")
96
+
97
+ if index < 0 or index > (self.Count() - 1):
98
+ raise IndexError("Index " + index + " is out of range")
99
+
100
+ node = self.First()
101
+ i = 0
102
+ for i in range(index):
103
+ node = node.Next()
104
+ node.SetValue(value)
105
+
106
+ def GetEnumerator(self):
107
+ return LinkedListEnumerator(self)
108
+
109
+ def __iter__(self):
110
+ return LinkedListEnumerator(self)
111
+
112
+ def Append(self, Value):
113
+ node = TokenListNode(Value, self)
114
+ if self.m_Head == None:
115
+ self.m_Head = node
116
+ else:
117
+ self.m_Tail.SetNext(node)
118
+ node.SetPrevious(self.m_Tail)
119
+ self.m_Tail = node
120
+ self.m_Count += 1
121
+ return node
122
+
123
+ def Prepend(self, Value):
124
+ node = TokenListNode(Value, self)
125
+ if self.m_Tail == None:
126
+ self.m_Tail = node
127
+ else:
128
+ self.m_Head.SetPrevious(node)
129
+ node.SetNext(self.m_Head)
130
+ self.m_Head = node
131
+ self.m_Count += 1
132
+ return node
133
+
134
+ def InsertBefore(self, Before, Value):
135
+ if not isinstance(Before, TokenListNode):
136
+ raise TypeError("Before must be a TokenListNode")
137
+
138
+ node = TokenListNode(Value, self)
139
+ prev = Before.Previous()
140
+ node.SetNext(Before)
141
+ node.SetPrevious(prev)
142
+ Before.SetPrevious(node)
143
+ if prev != None:
144
+ prev.SetNext(node)
145
+ else:
146
+ self.m_Head = node
147
+ self.m_Count += 1
148
+ return node
149
+
150
+ def InsertAfter(self, After, Value):
151
+ if not isinstance(After, TokenListNode):
152
+ raise TypeError("Before must be a TokenListNode")
153
+
154
+ node = TokenListNode(Value, self)
155
+ next = After.Next()
156
+ node.SetNext(next)
157
+ node.SetPrevious(After)
158
+ After.SetNext(node)
159
+ if next != None:
160
+ next.SetPrevious(node)
161
+ else:
162
+ self.m_Tail = node
163
+ self.m_Count += 1
164
+ return node
165
+
166
+ def Remove(self, Node):
167
+ if not isinstance(Node, TokenListNode):
168
+ raise TypeError("Node must be a TokenListNode")
169
+ if self.m_Head == None:
170
+ raise TypeError("Cannot remove Node from empty list")
171
+
172
+ prev = Node.Previous()
173
+ next = Node.Next()
174
+ if Node == self.m_Head and Node == self.m_Tail:
175
+ self.m_Head = self.m_Tail = None
176
+ elif Node == self.m_Head:
177
+ self.m_Head = next
178
+ self.m_Head.SetPrevious(None)
179
+ elif Node == self.m_Tail:
180
+ self.m_Tail = prev
181
+ self.m_Tail.SetNext(None)
182
+ else:
183
+ # the node is in the middle of the list
184
+ next.SetPrevious(prev)
185
+ prev.SetNext(next)
186
+ self.m_Count -= 1
187
+
188
+ def First(self):
189
+ return self.m_Head
190
+
191
+ def Last(self):
192
+ return self.m_Tail
193
+
194
+
195
+ class LinkedListEnumerator(ITokenEnumerator):
196
+ def Clone(self):
197
+ return LinkedListEnumerator(self)
198
+
199
+ def __init__(self, arg):
200
+ if isinstance(arg, _TokenList):
201
+ super(LinkedListEnumerator, self).__init__()
202
+ self.m_List = arg
203
+ self.m_Current = None
204
+ self.m_bEOF = False
205
+ elif isinstance(arg, LinkedListEnumerator):
206
+ super(LinkedListEnumerator, self).__init__()
207
+ self.m_List = arg.m_List
208
+ self.m_Current = arg.m_Current
209
+ self.m_bEOF = arg.m_bEOF
210
+ else:
211
+ raise TypeError("arg must be a _TokenList or LinkedListEnumerator")
212
+
213
+ def Count(self):
214
+ return self.m_List.Count()
215
+
216
+ def Current(self):
217
+ return self.m_Current.GetValue()
218
+
219
+ def MoveNext(self):
220
+ if self.m_bEOF:
221
+ return False
222
+ elif self.m_Current == None:
223
+ self.m_Current = self.m_List.First()
224
+ else:
225
+ self.m_Current = self.m_Current.Next()
226
+ self.m_bEOF = (self.m_Current == None)
227
+ return not self.m_bEOF
228
+
229
+ def MovePrevious(self):
230
+ if self.m_bEOF:
231
+ return False
232
+ elif self.m_Current == None:
233
+ self.m_Current = self.m_List.Last()
234
+ else:
235
+ self.m_Current = self.m_Current.Previous()
236
+ self.m_bEOF = (self.m_Current == None)
237
+ return not self.m_bEOF
238
+
239
+ def Reset(self):
240
+ self.m_Current = None
241
+ self.m_bEOF = False
242
+
243
+ def __iter__(self):
244
+ self.m_Current = None
245
+ self.m_bEOF = False
246
+ return self
247
+
248
+ def __next__(self):
249
+ if self.MoveNext():
250
+ return self.Current()
251
+ raise StopIteration
File without changes
@@ -0,0 +1,101 @@
1
+ import json
2
+ import sys
3
+ import intersystems_iris
4
+ from . import _Common
5
+
6
+ class _BusinessHost(_Common):
7
+ """ This is a superclass for BusinessService, BusinesProcess, and BusinessOperation that
8
+ defines common methods. It is a subclass of Common.
9
+ """
10
+
11
+ def __init__(self):
12
+ super().__init__()
13
+
14
+ @staticmethod
15
+ def OnGetConnections():
16
+ """ The OnGetConnections() method returns all of the targets of any SendRequestSync or SendRequestAsync
17
+ calls for the class. Implement this method to allow connections between components to show up in
18
+ the interoperability UI.
19
+
20
+ Returns:
21
+ An IRISList containing all targets for this class. Default is None.
22
+ """
23
+ return None
24
+
25
+ def SendRequestSync(self, target, request, timeout=-1, description=None):
26
+ """ Send the specified message to the target business process or business operation synchronously.
27
+
28
+ Parameters:
29
+ target: a string that specifies the name of the business process or operation to receive the request.
30
+ The target is the name of the component as specified in the Item Name property in the production definition, not the class name of the component.
31
+ request: specifies the message to send to the target. The request is either an instance of a class that is a subclass of Message class or of IRISObject class.
32
+ If the target is a build-in ObjectScript component, you should use the IRISObject class. The IRISObject class enables the PEX framework to convert the message to a class supported by the target.
33
+ timeout: an optional integer that specifies the number of seconds to wait before treating the send request as a failure. The default value is -1, which means wait forever.
34
+ description: an optional string parameter that sets a description property in the message header. The default is None.
35
+
36
+ Returns:
37
+ the response object from target.
38
+
39
+ Raises:
40
+ TypeError: if request is not of type Message or IRISObject.
41
+ """
42
+ if self._is_message_instance(request):
43
+ serialized = self._serialize(request)
44
+ returnObject = self.irisHandle.invoke("dispatchSendRequestSync",target,serialized,timeout,description)
45
+ elif isinstance(request, intersystems_iris.IRISObject):
46
+ returnObject = self.irisHandle.invoke("dispatchSendRequestSync",target,request,timeout,description)
47
+ else:
48
+ raise TypeError
49
+ if isinstance(returnObject, str):
50
+ returnObject = self._deserialize(returnObject)
51
+ return returnObject
52
+
53
+ @staticmethod
54
+ def _serialize(message):
55
+ """ Converts a message into json format.
56
+
57
+ Parameters:
58
+ message: The message to serialize, an instance of a class that is a subclass of Message.
59
+
60
+ Returns:
61
+ string: The message in json format.
62
+ """
63
+ if (message != None):
64
+ jString = json.dumps(message.__dict__)
65
+ module = message.__class__.__module__
66
+ classname = message.__class__.__name__
67
+ return module + "." + classname + ":" + jString
68
+ else:
69
+ return None
70
+
71
+ @staticmethod
72
+ def _deserialize(serial):
73
+ """ Converts a json string into a message of type classname, which is stored in the json string.
74
+
75
+ Parameters:
76
+ serial: The json string to deserialize.
77
+
78
+ Returns:
79
+ Message: The message as an instance of the class specified in the json string, which is a subclass of Message.
80
+
81
+ Raises:
82
+ ImportError: if the classname does not include a module name to import.
83
+ """
84
+ if (serial != None):
85
+ i = serial.find(":")
86
+ if (i <=0):
87
+ raise ValueError("JSON message malformed, must include classname: " + serial)
88
+ classpath = serial[:i]
89
+ gateway = intersystems_iris.GatewayContext.getConnection()._get_gateway()
90
+ try:
91
+ klass = gateway._load_class(classpath)
92
+ msg = klass()
93
+ except Exception:
94
+ raise ImportError("Class not found: " + classpath)
95
+ jdict = json.loads(serial[i+1:])
96
+ for k, v in jdict.items():
97
+ setattr(msg, k, v)
98
+ return msg
99
+ else:
100
+ return None
101
+
@@ -0,0 +1,105 @@
1
+ import intersystems_iris
2
+ from intersystems_iris.pex._BusinessHost import _BusinessHost
3
+
4
+ class _BusinessOperation(_BusinessHost):
5
+ """ This class corresponds to the PEX framework EnsLib.PEX.BusinessOperation class.
6
+ The EnsLib.PEX.BusinessOperation RemoteClassName property identifies the Python class with the business operation implementation.
7
+ The business operation can optionally use an adapter to handle the outgoing message. Specify the adapter in the OutboundAdapter property.
8
+ If the business operation has an adapter, it uses the adapter to send the message to the external system.
9
+ The adapter can either be a PEX adapter or an ObjectScript adapter.
10
+ """
11
+
12
+ def __init__(self):
13
+ """ The adapter variable provides access to the outbound adapter associated with the business operation."""
14
+ super().__init__()
15
+ self.Adapter = None
16
+
17
+ def OnConnected(self):
18
+ """ The OnConnected() method is called when the component is connected or reconnected after being disconnected.
19
+ Use the OnConnected() method to initialize any structures needed by the component."""
20
+ pass
21
+
22
+ def OnInit(self):
23
+ """ The OnInit() method is called when the component is started.
24
+ Use the OnInit() method to initialize any structures needed by the component."""
25
+ pass
26
+
27
+ def OnTearDown(self):
28
+ """ Called before the component is terminated. Use it to freee any structures."""
29
+ pass
30
+
31
+ def OnMessage(self, request):
32
+ """ Called when the business operation receives a message from another production component.
33
+ Typically, the operation will either send the message to the external system or forward it to a business process or another business operation.
34
+ If the operation has an adapter, it uses the Adapter.invoke() method to call the method on the adapter that sends the message to the external system.
35
+ If the operation is forwarding the message to another production component, it uses the SendRequestAsync() or the SendRequestSync() method
36
+
37
+ Parameters:
38
+ request: An instance of either a subclass of Message or of IRISObject containing the incoming message for the business operation.
39
+
40
+ Returns:
41
+ The response object
42
+ """
43
+ pass
44
+
45
+ @staticmethod
46
+ def getAdapterType():
47
+ """ The getAdapterType() method is called when registering the business operation in order to instruct the business operation on what outbout adapter to use.
48
+ The return value from this method should be the string name of the outbound adapter class. This may be an ObjectScript class or a PEX adapter class (Use the registered proxy name).
49
+ Return the empty string for adapterless business operations.
50
+ """
51
+ return ""
52
+
53
+ def _setIrisHandles(self, handleCurrent, handlePartner):
54
+ """ For internal use only. """
55
+ self.irisHandle = handleCurrent
56
+ self.Adapter = intersystems_iris.pex.IRISOutboundAdapter()
57
+ self.Adapter.irisHandle = handlePartner
58
+ return
59
+
60
+ def SendRequestAsync(self, target, request, description=None):
61
+ """ Send the specified message to the target business process or business operation asynchronously.
62
+
63
+ Parameters:
64
+ target: a string that specifies the name of the business process or operation to receive the request.
65
+ The target is the name of the component as specified in the Item Name property in the production definition, not the class name of the component.
66
+ request: specifies the message to send to the target. The request is an instance of IRISObject or of a subclass of Message.
67
+ If the target is a built-in ObjectScript component, you should use the IRISObject class. The IRISObject class enables the PEX framework to convert the message to a class supported by the target.
68
+ description: an optional string parameter that sets a description property in the message header. The default is None.
69
+
70
+ Raises:
71
+ TypeError: if request is not of type Message or IRISObject.
72
+ """
73
+ if self._is_message_instance(request):
74
+ serialized = self._serialize(request)
75
+ self.irisHandle.invokeVoid("dispatchSendRequestAsync",target,serialized,description)
76
+ elif isinstance(request, intersystems_iris.IRISObject):
77
+ self.irisHandle.invokeVoid("dispatchSendRequestAsync",target,request,description)
78
+ else:
79
+ raise TypeError
80
+ return
81
+
82
+ def _dispatchOnConnected(self, hostObject):
83
+ """ For internal use only. """
84
+ self.OnConnected()
85
+ return
86
+
87
+ def _dispatchOnInit(self, hostObject):
88
+ """ For internal use only. """
89
+ self.OnInit()
90
+ return
91
+
92
+ def _dispatchOnTearDown(self, hostObject):
93
+ """ For internal use only. """
94
+ self.OnTearDown()
95
+ return
96
+
97
+ def _dispatchOnMessage(self, request):
98
+ """ For internal use only. """
99
+ if isinstance(request, str):
100
+ request = self._deserialize(request)
101
+ returnObject = self.OnMessage(request)
102
+ if self._is_message_instance(returnObject):
103
+ returnObject = self._serialize(returnObject)
104
+ return returnObject
105
+
@@ -0,0 +1,214 @@
1
+ import intersystems_iris
2
+ from intersystems_iris.pex._BusinessHost import _BusinessHost
3
+
4
+ class _BusinessProcess(_BusinessHost):
5
+ """ Typically contains most of the logic in a production.
6
+ A business process can receive messages from a business service, another business process, or a business operation.
7
+ It can modify the message, convert it to a different format, or route it based on the message contents.
8
+ The business process can route a message to a business operation or another business process.
9
+ """
10
+
11
+ PERSISTENT_PROPERTY_LIST=None
12
+ """ A list of the variable names of persistent properties."""
13
+
14
+ def __init__(self):
15
+ super().__init__()
16
+
17
+ def OnConnected(self):
18
+ """ The OnConnected() method is called when the component is connected or reconnected after being disconnected.
19
+ Use the OnConnected() method to initialize any structures needed by the component."""
20
+ pass
21
+
22
+ def OnInit(self):
23
+ """ The OnInit() method is called when the component is started.
24
+ Use the OnInit() method to initialize any structures needed by the component."""
25
+ pass
26
+
27
+ def OnTearDown(self):
28
+ """ Called before the component is terminated."""
29
+ pass
30
+
31
+ def OnRequest(self, request):
32
+ """ Handles requests sent to the business process. A production calls this method whenever an initial request
33
+ for a specific business process arrives on the appropriate queue and is assigned a job in which to execute.
34
+
35
+ Parameters:
36
+ request: An instance of IRISObject or subclass of Message that contains the request message sent to the business process.
37
+
38
+ Returns:
39
+ An instance of IRISObject or subclass of Message that contains the response message that this business process can return
40
+ to the production component that sent the initial message.
41
+ """
42
+ pass
43
+
44
+ def OnResponse(self, request, response, callRequest, callResponse, completionKey):
45
+ """ Handles responses sent to the business process in response to messages that it sent to the target.
46
+ A production calls this method whenever a response for a specific business process arrives on the appropriate queue and is assigned a job in which to execute.
47
+ Typically this is a response to an asynchronous request made by the business process where the responseRequired parameter has a true value.
48
+
49
+ Parameters:
50
+ request: An instance of IRISObject or subclass of Message that contains the initial request message sent to the business process.
51
+ response: An instance of IRISObject or subclass of Message that contains the response message that this business process can return
52
+ to the production component that sent the initial message.
53
+ callRequest: An instance of IRISObject or subclass of Message that contains the request that the business process sent to its target.
54
+ callResponse: An instance of IRISObject or subclass of Message that contains the incoming response.
55
+ completionKey: A string that contains the completionKey specified in the completionKey parameter of the outgoing SendAsync() method.
56
+
57
+ Returns:
58
+ An instance of IRISObject or subclass of Message that contains the response message that this business process can return
59
+ to the production component that sent the initial message.
60
+ """
61
+ pass
62
+
63
+ def OnComplete(self, request, response):
64
+ """ Called after the business process has received and handled all responses to requests it has sent to targets.
65
+
66
+ Parameters:
67
+ request: An instance of IRISObject or subclass of Message that contains the initial request message sent to the business process.
68
+ response: An instance of IRISObject or subclass of Message that contains the response message that this business process can return
69
+ to the production component that sent the initial message.
70
+
71
+ Returns:
72
+ An instance of IRISObject or subclass of Message that contains the response message that this business process can return
73
+ to the production component that sent the initial message.
74
+ """
75
+ pass
76
+
77
+ def _setIrisHandles(self, handleCurrent, handlePartner):
78
+ """ For internal use only. """
79
+ self.irisHandle = handleCurrent
80
+ return
81
+
82
+ def SendRequestAsync(self, target, request, responseRequired=True, completionKey=None, description=None):
83
+ """ Send the specified message to the target business process or business operation asynchronously.
84
+
85
+ Parameters:
86
+ target: a string that specifies the name of the business process or operation to receive the request.
87
+ The target is the name of the component as specified in the Item Name property in the production definition, not the class name of the component.
88
+ request: specifies the message to send to the target. The request is an instance of IRISObject or of a subclass of Message.
89
+ If the target is a build-in ObjectScript component, you should use the IRISObject class. The IRISObject class enables the PEX framework to convert the message to a class supported by the target.
90
+ responseRequired: a boolean value that specifies if the target must send a response message. The default is True.
91
+ completionKey: A string that will be sent with the response message.
92
+ description: an optional string parameter that sets a description property in the message header. The default is None.
93
+
94
+ Raises:
95
+ TypeError: if request is not of type Message or IRISObject.
96
+ """
97
+ if self._is_message_instance(request):
98
+ serialized = self._serialize(request)
99
+ self.irisHandle.invokeVoid("dispatchSendRequestAsync",target,serialized,responseRequired,completionKey,description)
100
+ elif isinstance(request, intersystems_iris.IRISObject):
101
+ self.irisHandle.invokeVoid("dispatchSendRequestAsync",target,request,responseRequired,completionKey,description)
102
+ else:
103
+ raise TypeError("Message of type: " + str(request.__class__) + " is invalid. Messages must be subclass of Message or IRISObject.")
104
+ return
105
+
106
+ def _savePersistentProperties(self, hostObject):
107
+ """ For internal use only. """
108
+ if self.PERSISTENT_PROPERTY_LIST == None:
109
+ return
110
+ for prop in self.PERSISTENT_PROPERTY_LIST:
111
+ val = getattr(self, prop, None)
112
+ typ = val.__class__.__name__
113
+ if (typ in ["str","int","float","bool","bytes"]):
114
+ try:
115
+ hostObject.invoke("setPersistentProperty", prop, val)
116
+ except:
117
+ pass
118
+ return
119
+
120
+ def _restorePersistentProperties(self, hostObject):
121
+ """ For internal use only. """
122
+ if self.PERSISTENT_PROPERTY_LIST == None:
123
+ return
124
+ for prop in self.PERSISTENT_PROPERTY_LIST:
125
+ try:
126
+ val = hostObject.invoke("getPersistentProperty", prop)
127
+ setattr(self, prop, val)
128
+ except:
129
+ pass
130
+ return
131
+
132
+ def _dispatchOnConnected(self, hostObject):
133
+ """ For internal use only. """
134
+ self._restorePersistentProperties(hostObject)
135
+ self.OnConnected()
136
+ self._savePersistentProperties(hostObject)
137
+ return
138
+
139
+ def _dispatchOnInit(self, hostObject):
140
+ """ For internal use only. """
141
+ self._restorePersistentProperties(hostObject)
142
+ self.OnInit()
143
+ self._savePersistentProperties(hostObject)
144
+ return
145
+
146
+ def _dispatchOnTearDown(self, hostObject):
147
+ """ For internal use only. """
148
+ self._restorePersistentProperties(hostObject)
149
+ self.OnTearDown()
150
+ self._savePersistentProperties(hostObject)
151
+ return
152
+
153
+ def _dispatchOnRequest(self, hostObject, request):
154
+ """ For internal use only. """
155
+ self._restorePersistentProperties(hostObject)
156
+ if isinstance(request, str):
157
+ request = self._deserialize(request)
158
+ returnObject = self.OnRequest(request)
159
+ if self._is_message_instance(returnObject):
160
+ returnObject = self._serialize(returnObject)
161
+ self._savePersistentProperties(hostObject)
162
+ return returnObject
163
+
164
+ def _dispatchOnResponse(self, hostObject, request, response, callRequest, callResponse, completionKey):
165
+ """ For internal use only. """
166
+ self._restorePersistentProperties(hostObject)
167
+ if isinstance(request, str):
168
+ request = self._deserialize(request)
169
+ if isinstance(response, str):
170
+ response = self._deserialize(response)
171
+ if isinstance(callRequest, str):
172
+ callRequest = self._deserialize(callRequest)
173
+ if isinstance(callResponse, str):
174
+ callResponse = self._deserialize(callResponse)
175
+ returnObject = self.OnResponse(request, response, callRequest, callResponse, completionKey)
176
+ if self._is_message_instance(returnObject):
177
+ returnObject = self._serialize(returnObject)
178
+ self._savePersistentProperties(hostObject)
179
+ return returnObject
180
+
181
+ def _dispatchOnComplete(self, hostObject, request, response):
182
+ """ For internal use only. """
183
+ self._restorePersistentProperties(hostObject)
184
+ if isinstance(request, str):
185
+ request = self._deserialize(request)
186
+ if isinstance(response, str):
187
+ response = self._deserialize(response)
188
+ returnObject = self.OnComplete(request, response)
189
+ if self._is_message_instance(returnObject):
190
+ returnObject = self._serialize(returnObject)
191
+ self._savePersistentProperties(hostObject)
192
+ return returnObject
193
+
194
+ def Reply(self, response):
195
+ """ Send the specified response to the production component that sent the initial request to the business process.
196
+
197
+ Parameters:
198
+ response: An instance of IRISObject or subclass of Message that contains the response message.
199
+ """
200
+ if self._is_message_instance(response):
201
+ response = self._serialize(response)
202
+ self.irisHandle.invokeVoid("dispatchReply", response)
203
+ return
204
+
205
+ def SetTimer(self, timeout, completionKey=None):
206
+ """ Specifies the maximum time the business process will wait for responses.
207
+
208
+ Parameters:
209
+ timeout: an integer that specifies a number of seconds, or a string that specifies a time period such as"PT15s",
210
+ which represents 15 seconds of processor time.
211
+ completionKey: a string that will be returned with the response if the maximum time is exceeded.
212
+ """
213
+ self.irisHandle.invokeVoid("dispatchSetTimer", timeout, completionKey)
214
+ return