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.
- intersystems_iris/_BufferReader.py +10 -0
- intersystems_iris/_BufferWriter.py +32 -0
- intersystems_iris/_ConnectionInformation.py +54 -0
- intersystems_iris/_ConnectionParameters.py +18 -0
- intersystems_iris/_Constant.py +38 -0
- intersystems_iris/_DBList.py +499 -0
- intersystems_iris/_Device.py +69 -0
- intersystems_iris/_GatewayContext.py +25 -0
- intersystems_iris/_GatewayException.py +4 -0
- intersystems_iris/_GatewayUtility.py +74 -0
- intersystems_iris/_IRIS.py +1294 -0
- intersystems_iris/_IRISConnection.py +516 -0
- intersystems_iris/_IRISEmbedded.py +85 -0
- intersystems_iris/_IRISGlobalNode.py +273 -0
- intersystems_iris/_IRISGlobalNodeView.py +25 -0
- intersystems_iris/_IRISIterator.py +143 -0
- intersystems_iris/_IRISList.py +360 -0
- intersystems_iris/_IRISNative.py +208 -0
- intersystems_iris/_IRISOREF.py +4 -0
- intersystems_iris/_IRISObject.py +424 -0
- intersystems_iris/_IRISReference.py +133 -0
- intersystems_iris/_InStream.py +149 -0
- intersystems_iris/_LegacyIterator.py +135 -0
- intersystems_iris/_ListItem.py +15 -0
- intersystems_iris/_ListReader.py +84 -0
- intersystems_iris/_ListWriter.py +157 -0
- intersystems_iris/_LogFileStream.py +115 -0
- intersystems_iris/_MessageHeader.py +51 -0
- intersystems_iris/_OutStream.py +25 -0
- intersystems_iris/_PrintStream.py +65 -0
- intersystems_iris/_PythonGateway.py +850 -0
- intersystems_iris/_SharedMemorySocket.py +87 -0
- intersystems_iris/__init__.py +79 -0
- intersystems_iris/__main__.py +7 -0
- intersystems_iris/dbapi/_Column.py +56 -0
- intersystems_iris/dbapi/_DBAPI.py +2295 -0
- intersystems_iris/dbapi/_Descriptor.py +46 -0
- intersystems_iris/dbapi/_IRISStream.py +63 -0
- intersystems_iris/dbapi/_Message.py +158 -0
- intersystems_iris/dbapi/_Parameter.py +138 -0
- intersystems_iris/dbapi/_ParameterCollection.py +133 -0
- intersystems_iris/dbapi/_ResultSetRow.py +314 -0
- intersystems_iris/dbapi/_SQLType.py +32 -0
- intersystems_iris/dbapi/__init__.py +0 -0
- intersystems_iris/dbapi/preparser/_PreParser.py +1658 -0
- intersystems_iris/dbapi/preparser/_Scanner.py +391 -0
- intersystems_iris/dbapi/preparser/_Token.py +81 -0
- intersystems_iris/dbapi/preparser/_TokenList.py +251 -0
- intersystems_iris/dbapi/preparser/__init__.py +0 -0
- intersystems_iris/pex/_BusinessHost.py +101 -0
- intersystems_iris/pex/_BusinessOperation.py +105 -0
- intersystems_iris/pex/_BusinessProcess.py +214 -0
- intersystems_iris/pex/_BusinessService.py +95 -0
- intersystems_iris/pex/_Common.py +228 -0
- intersystems_iris/pex/_Director.py +24 -0
- intersystems_iris/pex/_IRISBusinessOperation.py +5 -0
- intersystems_iris/pex/_IRISBusinessService.py +18 -0
- intersystems_iris/pex/_IRISInboundAdapter.py +5 -0
- intersystems_iris/pex/_IRISOutboundAdapter.py +17 -0
- intersystems_iris/pex/_InboundAdapter.py +57 -0
- intersystems_iris/pex/_Message.py +6 -0
- intersystems_iris/pex/_OutboundAdapter.py +46 -0
- intersystems_iris/pex/__init__.py +25 -0
- iris/__init__.py +25 -0
- iris/iris_site.py +13 -0
- iris/irisbuiltins.py +97 -0
- iris/irisloader.py +199 -0
- irisnative/_IRISNative.py +9 -0
- irisnative/__init__.py +10 -0
- {sqlalchemy_iris-0.5.0b3.dist-info → sqlalchemy_iris-0.6.0b1.dist-info}/METADATA +1 -1
- sqlalchemy_iris-0.6.0b1.dist-info/RECORD +83 -0
- sqlalchemy_iris-0.6.0b1.dist-info/top_level.txt +4 -0
- sqlalchemy_iris-0.5.0b3.dist-info/RECORD +0 -14
- sqlalchemy_iris-0.5.0b3.dist-info/top_level.txt +0 -1
- {sqlalchemy_iris-0.5.0b3.dist-info → sqlalchemy_iris-0.6.0b1.dist-info}/LICENSE +0 -0
- {sqlalchemy_iris-0.5.0b3.dist-info → sqlalchemy_iris-0.6.0b1.dist-info}/WHEEL +0 -0
- {sqlalchemy_iris-0.5.0b3.dist-info → sqlalchemy_iris-0.6.0b1.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,95 @@
|
|
1
|
+
import intersystems_iris
|
2
|
+
from intersystems_iris.pex._BusinessHost import _BusinessHost
|
3
|
+
|
4
|
+
class _BusinessService(_BusinessHost):
|
5
|
+
""" This class is responsible for receiving the data from external system and sending it to business processes or business operations in the production.
|
6
|
+
The business service can use an adapter to access the external system, which is specified in the InboundAdapter property.
|
7
|
+
There are three ways of implementing a business service:
|
8
|
+
1) Polling business service with an adapter - The production framework at regular intervals calls the adapter’s OnTask() method,
|
9
|
+
which sends the incoming data to the the business service ProcessInput() method, which, in turn calls the OnProcessInput method with your code.
|
10
|
+
2) Polling business service that uses the default adapter - In this case, the framework calls the default adapter's OnTask method with no data.
|
11
|
+
The OnProcessInput() method then performs the role of the adapter and is responsible for accessing the external system and receiving the data.
|
12
|
+
3) Nonpolling business service - The production framework does not initiate the business service. Instead custom code in either a long-running process
|
13
|
+
or one that is started at regular intervals initiates the business service by calling the Director.CreateBusinessService() method.
|
14
|
+
"""
|
15
|
+
|
16
|
+
def __init__(self):
|
17
|
+
""" The Adapter instance variable provides access to the inbound adapter associated with the business service."""
|
18
|
+
super().__init__()
|
19
|
+
self.Adapter = None
|
20
|
+
self._WaitForNextCallInterval = False
|
21
|
+
|
22
|
+
def OnConnected(self):
|
23
|
+
""" The OnConnected() method is called when the component is connected or reconnected after being disconnected.
|
24
|
+
Use the OnConnected() method to initialize any structures needed by the component."""
|
25
|
+
pass
|
26
|
+
|
27
|
+
def OnInit(self):
|
28
|
+
""" The OnInit() method is called when the component is started.
|
29
|
+
Use the OnInit() method to initialize any structures needed by the component."""
|
30
|
+
pass
|
31
|
+
|
32
|
+
def OnTearDown(self):
|
33
|
+
""" Called before the component is terminated. Use it to freee any structures."""
|
34
|
+
pass
|
35
|
+
|
36
|
+
def OnProcessInput(self, messageInput):
|
37
|
+
""" Receives the message from the inbond adapter via the PRocessInput method and is responsible for forwarding it to target business processes or operations.
|
38
|
+
If the business service does not specify an adapter, then the default adapter calls this method with no message
|
39
|
+
and the business service is responsible for receiving the data from the external system and validating it.
|
40
|
+
|
41
|
+
Parameters:
|
42
|
+
messageInput: an instance of IRISObject or subclass of Message containing the data that the inbound adapter passes in.
|
43
|
+
The message can have any structure agreed upon by the inbound adapter and the business service.
|
44
|
+
"""
|
45
|
+
pass
|
46
|
+
|
47
|
+
@staticmethod
|
48
|
+
def getAdapterType():
|
49
|
+
""" The getAdapterType() method is called when registering the business service in order to instruct the business service on what inbound adapter to use.
|
50
|
+
The return value from this method should be the string name of the inbound adapter class. This may be an ObjectScript class or a PEX adapter class (Use the registered proxy name).
|
51
|
+
Return the empty string for adapterless business services.
|
52
|
+
"""
|
53
|
+
return ""
|
54
|
+
|
55
|
+
def _setIrisHandles(self, handleCurrent, handlePartner):
|
56
|
+
""" For internal use only. """
|
57
|
+
self.irisHandle = handleCurrent
|
58
|
+
self.Adapter = intersystems_iris.pex.IRISInboundAdapter()
|
59
|
+
self.Adapter.irisHandle = handlePartner
|
60
|
+
return
|
61
|
+
|
62
|
+
def SendRequestAsync(self, target, request, description=None):
|
63
|
+
""" Send the specified message to the target business process or business operation asynchronously.
|
64
|
+
|
65
|
+
Parameters:
|
66
|
+
target: a string that specifies the name of the business process or operation to receive the request.
|
67
|
+
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.
|
68
|
+
request: specifies the message to send to the target. The request is an instance of IRISObject or of a subclass of Message.
|
69
|
+
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.
|
70
|
+
description: an optional string parameter that sets a description property in the message header. The default is None.
|
71
|
+
"""
|
72
|
+
if self._is_message_instance(request):
|
73
|
+
serialized = self._serialize(request)
|
74
|
+
self.irisHandle.invokeVoid("dispatchSendRequestAsync",target,serialized,description)
|
75
|
+
elif isinstance(request, intersystems_iris.IRISObject):
|
76
|
+
self.irisHandle.invokeVoid("dispatchSendRequestAsync",target,request,description)
|
77
|
+
else:
|
78
|
+
raise TypeError(type(request))
|
79
|
+
return
|
80
|
+
|
81
|
+
def _dispatchOnConnected(self, hostObject):
|
82
|
+
""" For internal use only. """
|
83
|
+
self.OnConnected()
|
84
|
+
return
|
85
|
+
|
86
|
+
def _dispatchOnInit(self, hostObject):
|
87
|
+
""" For internal use only. """
|
88
|
+
self.OnInit()
|
89
|
+
return
|
90
|
+
|
91
|
+
def _dispatchOnTearDown(self, hostObject):
|
92
|
+
""" For internal use only. """
|
93
|
+
self.OnTearDown()
|
94
|
+
return
|
95
|
+
|
@@ -0,0 +1,228 @@
|
|
1
|
+
import traceback
|
2
|
+
import sys
|
3
|
+
import inspect
|
4
|
+
import intersystems_iris
|
5
|
+
|
6
|
+
class _Common():
|
7
|
+
""" This is a common superclass for all component types that defines common methods."""
|
8
|
+
|
9
|
+
INFO_URL: str
|
10
|
+
ICON_URL: str
|
11
|
+
|
12
|
+
def __init__(self):
|
13
|
+
self.irisHandle = None
|
14
|
+
|
15
|
+
def _setIrisHandles(self, handleCurrent, handlePartner):
|
16
|
+
pass
|
17
|
+
|
18
|
+
@classmethod
|
19
|
+
def _is_message_instance(cls, object):
|
20
|
+
return cls._is_message_class(type(object))
|
21
|
+
|
22
|
+
@classmethod
|
23
|
+
def _is_message_class(cls, klass):
|
24
|
+
name = klass.__module__ + '.' + klass.__qualname__
|
25
|
+
if name == "iris.pex.Message": return True
|
26
|
+
for c in klass.__bases__:
|
27
|
+
if cls._is_message_class(c): return True
|
28
|
+
return False
|
29
|
+
|
30
|
+
@classmethod
|
31
|
+
def _getInfo(cls):
|
32
|
+
""" Get class information to display in the Informational Settings expando for Production config items of this Business Host or Adapter.
|
33
|
+
This method returns a list of Superclass, Description, InfoURL, and IconURL, and possibly Adapter (if class is a Business Service or Business Operation)
|
34
|
+
IconURL is not yet displayed anywhere
|
35
|
+
"""
|
36
|
+
ret = intersystems_iris.IRISList()
|
37
|
+
desc = ""
|
38
|
+
infoURL = ""
|
39
|
+
iconURL = ""
|
40
|
+
superClass = ""
|
41
|
+
adapter = ""
|
42
|
+
try:
|
43
|
+
# Get tuple of the class's base classes and loop through them until we find one of the PEX component classes
|
44
|
+
classes = inspect.getmro(cls)
|
45
|
+
for cl in classes:
|
46
|
+
clName = str(cl)[7:-1]
|
47
|
+
if clName in ["'iris.pex.BusinessService'","'iris.pex.BusinessOperation'"] :
|
48
|
+
# Remove the apostrophes and set as superClass, then find if it uses an adapter
|
49
|
+
superClass = clName[1:-1]
|
50
|
+
adapter = cls.getAdapterType()
|
51
|
+
break
|
52
|
+
elif clName in ["'iris.pex.BusinessProcess'","'iris.pex.InboundAdapter'","'iris.pex.OutboundAdapter'"] :
|
53
|
+
# Remove the apostrophes and set as superClass
|
54
|
+
superClass = clName[1:-1]
|
55
|
+
break
|
56
|
+
|
57
|
+
if ""==superClass:
|
58
|
+
return ""
|
59
|
+
ret.add(superClass)
|
60
|
+
|
61
|
+
# Get the class documentation, if any
|
62
|
+
clsDesc = inspect.getdoc(cls)
|
63
|
+
superDesc = inspect.getdoc(classes[1])
|
64
|
+
if clsDesc!=superDesc:
|
65
|
+
desc = clsDesc
|
66
|
+
ret.add(str(desc))
|
67
|
+
|
68
|
+
infoURL = inspect.getattr_static(cls,"INFO_URL","")
|
69
|
+
iconURL = inspect.getattr_static(cls,"ICON_URL","")
|
70
|
+
|
71
|
+
ret.add(infoURL)
|
72
|
+
ret.add(iconURL)
|
73
|
+
|
74
|
+
if ""!=adapter:
|
75
|
+
ret.add(adapter)
|
76
|
+
except:
|
77
|
+
pass
|
78
|
+
return ret
|
79
|
+
|
80
|
+
@classmethod
|
81
|
+
def _getProperties(cls):
|
82
|
+
""" Get a list of the Attributes and Properties of this Python class.
|
83
|
+
Return value is a list of lists of form $lb(propName,dataType,defaultVal,required,category,description).
|
84
|
+
which can be used by the Production Configuration to display them as settings.
|
85
|
+
This list will only include class attributes (no instance attributes) and properties which are not marked to be private by use of the _ prefix.
|
86
|
+
For class attributes, we will use the value that it is defined with as the defaultVal and its type as the dataType, or "" and String if set to None.
|
87
|
+
Add a function attrName_info() for a attribute or property 'attrName' in order to add more information about that attribute by using the function annotation for the return value.
|
88
|
+
The annotation should be a dictionary including any of 'IsRequired', 'Category', 'Description', 'DataType', or 'ExcludeFromSettings' as keys.
|
89
|
+
'ExcludeFromSettings' should be a boolean, and if true will exclude an attribute from being returned in the list, and so prevent it from being displayed as a setting in the Production Configuration Page
|
90
|
+
'DataType' does not need to be specified if it is the same as the type of the attribute definition. Otherwise, it can be either a Python type or a string.
|
91
|
+
If 'IsRequired' is not specified, this will default to false.
|
92
|
+
If 'Category' is not specified, the attribute will be added to the Additional category.
|
93
|
+
"""
|
94
|
+
ret = intersystems_iris.IRISList()
|
95
|
+
try:
|
96
|
+
# getmembers() returns all the members of an object
|
97
|
+
for member in inspect.getmembers(cls):
|
98
|
+
# remove private and protected functions
|
99
|
+
if not member[0].startswith('_'):
|
100
|
+
# remove other methods and functions
|
101
|
+
if not inspect.ismethod(member[1]) and not inspect.isfunction(member[1]) and not inspect.isclass(member[1]):
|
102
|
+
if member[0] not in ('INFO_URL','ICON_URL','PERSISTENT_PROPERTY_LIST') :
|
103
|
+
name = member[0]
|
104
|
+
req = 0
|
105
|
+
cat = "Additional"
|
106
|
+
desc = ""
|
107
|
+
# get value, set to "" if None or a @property
|
108
|
+
val = member[1]
|
109
|
+
if isinstance(val,property) or (val is None):
|
110
|
+
val = ""
|
111
|
+
dt = str(type(val))[8:-2]
|
112
|
+
# get datatype from attribute definition, default to String
|
113
|
+
dataType = {'int':'Integer','float':'Numeric','complex':'Numeric','bool':'Boolean'}.get(dt,'String')
|
114
|
+
# if the user has created a attr_info function, then check the annotation on the return from that for more information about this attribute
|
115
|
+
if hasattr(cls,name + '_info') :
|
116
|
+
func = getattr(cls,name+'_info')
|
117
|
+
if callable(func) :
|
118
|
+
annotations = func.__annotations__['return']
|
119
|
+
if annotations is not None:
|
120
|
+
if bool(annotations.get("ExcludeFromSettings")) :
|
121
|
+
# don't add this attribute to the settings list
|
122
|
+
continue
|
123
|
+
req = bool(annotations.get("IsRequired"))
|
124
|
+
cat = annotations.get("Category","Additional")
|
125
|
+
desc = annotations.get("Description")
|
126
|
+
dt = annotations.get("DataType")
|
127
|
+
# only override DataType found
|
128
|
+
if (dt is not None) and ("" != dt):
|
129
|
+
dataType = {int:'Integer',float:'Number',complex:'Number',bool:'Boolean',str:'String'}.get(dt,str(dt))
|
130
|
+
default = func()
|
131
|
+
if default is not None:
|
132
|
+
val = default
|
133
|
+
# create list of information for this specific property
|
134
|
+
info = intersystems_iris.IRISList()
|
135
|
+
info.add(name) # Name
|
136
|
+
info.add(dataType) # DataType
|
137
|
+
info.add(val) # Default Value
|
138
|
+
info.add(req) # Required
|
139
|
+
info.add(cat) # Category
|
140
|
+
info.add(desc) # Description
|
141
|
+
# add this property to the list
|
142
|
+
ret.add(info)
|
143
|
+
except:
|
144
|
+
pass
|
145
|
+
return ret
|
146
|
+
|
147
|
+
def LOGINFO(self, message):
|
148
|
+
""" Write a log entry of type "info". :og entries can be viewed in the management portal.
|
149
|
+
|
150
|
+
Parameters:
|
151
|
+
message: a string that is written to the log.
|
152
|
+
"""
|
153
|
+
|
154
|
+
currentClass = self.__class__.__name__
|
155
|
+
currentMethod = None
|
156
|
+
try:
|
157
|
+
frame = traceback.extract_stack()[-2]
|
158
|
+
currentMethod = frame.name
|
159
|
+
except:
|
160
|
+
pass
|
161
|
+
self.irisHandle._iris.classMethodVoid("Ens.Util.Log", "LogInfo", currentClass, currentMethod, message)
|
162
|
+
return
|
163
|
+
|
164
|
+
def LOGALERT(self, message):
|
165
|
+
""" Write a log entry of type "alert". :og entries can be viewed in the management portal.
|
166
|
+
|
167
|
+
Parameters:
|
168
|
+
message: a string that is written to the log.
|
169
|
+
"""
|
170
|
+
currentClass = self.__class__.__name__
|
171
|
+
currentMethod = None
|
172
|
+
try:
|
173
|
+
frame = traceback.extract_stack()[-2]
|
174
|
+
currentMethod = frame.name
|
175
|
+
except:
|
176
|
+
pass
|
177
|
+
self.irisHandle._iris.classMethodVoid("Ens.Util.Log", "LogAlert", currentClass, currentMethod, message)
|
178
|
+
return
|
179
|
+
|
180
|
+
def LOGWARNING(self, message):
|
181
|
+
""" Write a log entry of type "warning". Log entries can be viewed in the management portal.
|
182
|
+
|
183
|
+
Parameters:
|
184
|
+
message: a string that is written to the log.
|
185
|
+
"""
|
186
|
+
currentClass = self.__class__.__name__
|
187
|
+
currentMethod = None
|
188
|
+
try:
|
189
|
+
frame = traceback.extract_stack()[-2]
|
190
|
+
currentMethod = frame.name
|
191
|
+
except:
|
192
|
+
pass
|
193
|
+
self.irisHandle._iris.classMethodVoid("Ens.Util.Log", "LogWarning", currentClass, currentMethod, message)
|
194
|
+
return
|
195
|
+
|
196
|
+
def LOGERROR(self, message):
|
197
|
+
""" Write a log entry of type "error". :og entries can be viewed in the management portal.
|
198
|
+
|
199
|
+
Parameters:
|
200
|
+
message: a string that is written to the log.
|
201
|
+
"""
|
202
|
+
currentClass = self.__class__.__name__
|
203
|
+
currentMethod = None
|
204
|
+
try:
|
205
|
+
frame = traceback.extract_stack()[-2]
|
206
|
+
currentMethod = frame.name
|
207
|
+
except:
|
208
|
+
pass
|
209
|
+
self.irisHandle._iris.classMethodVoid("Ens.Util.Log", "LogError", currentClass, currentMethod, message)
|
210
|
+
return
|
211
|
+
|
212
|
+
def LOGASSERT(self, message):
|
213
|
+
""" Write a log entry of type "assert". :og entries can be viewed in the management portal.
|
214
|
+
|
215
|
+
Parameters:
|
216
|
+
message: a string that is written to the log.
|
217
|
+
"""
|
218
|
+
currentClass = self.__class__.__name__
|
219
|
+
currentMethod = None
|
220
|
+
try:
|
221
|
+
frame = traceback.extract_stack()[-2]
|
222
|
+
currentMethod = frame.name
|
223
|
+
except:
|
224
|
+
pass
|
225
|
+
self.irisHandle._iris.classMethodVoid("Ens.Util.Log", "LogAssert", currentClass, currentMethod, message)
|
226
|
+
return
|
227
|
+
|
228
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import intersystems_iris
|
2
|
+
|
3
|
+
class _Director():
|
4
|
+
""" The Directorclass is used for nonpolling business services, that is, business services which are not automatically
|
5
|
+
called by the production framework (through the inbound adapter) at the call interval.
|
6
|
+
Instead these business services are created by a custom application by calling the Director.CreateBusinessService() method.
|
7
|
+
"""
|
8
|
+
|
9
|
+
@staticmethod
|
10
|
+
def CreateBusinessService(connection, target):
|
11
|
+
""" The CreateBusinessService() method initiates the specifiied business service.
|
12
|
+
|
13
|
+
Parameters:
|
14
|
+
connection: an IRISConnection object that specifies the connection to an IRIS instance for Java.
|
15
|
+
target: a string that specifies the name of the business service in the production definition.
|
16
|
+
|
17
|
+
Returns:
|
18
|
+
an object that contains an instance of IRISBusinessService
|
19
|
+
"""
|
20
|
+
irisInstance = intersystems_iris.IRIS(connection)
|
21
|
+
irisobject = irisInstance.classMethodObject("EnsLib.PEX.Director","dispatchCreateBusinessService",target)
|
22
|
+
service = intersystems_iris.pex._IRISBusinessService._IRISBusinessService()
|
23
|
+
service.irisHandle = irisobject
|
24
|
+
return service
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class _IRISBusinessService:
|
2
|
+
""" Class for proxy objects that represent business service instances in IRIS"""
|
3
|
+
|
4
|
+
def __init__(self):
|
5
|
+
self.irisHandle = None
|
6
|
+
|
7
|
+
def ProcessInput(self, input):
|
8
|
+
""" Send an object to the business service instance.
|
9
|
+
|
10
|
+
Parameters:
|
11
|
+
input: an object to be sent to the business service.
|
12
|
+
|
13
|
+
Returns:
|
14
|
+
the object that is returned from the business service.
|
15
|
+
"""
|
16
|
+
return (self.irisHandle._iris).classMethodObject("EnsLib.PEX.BusinessService", "dispatchProcessInput", self.irisHandle, input)
|
17
|
+
|
18
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class _IRISOutboundAdapter:
|
2
|
+
""" Class for proxy objects that represent outbound adapter instances in IRIS."""
|
3
|
+
|
4
|
+
def __init__(self):
|
5
|
+
self.irisHandle = None
|
6
|
+
|
7
|
+
def invoke(self, method, *args):
|
8
|
+
""" Invoke a method of the outbound adapter instance.
|
9
|
+
|
10
|
+
Parameters:
|
11
|
+
method: string, name of the method to be invoked.
|
12
|
+
args: arguments of the invocation.
|
13
|
+
|
14
|
+
Returns:
|
15
|
+
the return value of the invocation.
|
16
|
+
"""
|
17
|
+
return self.irisHandle.invoke(method, *args)
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import intersystems_iris
|
2
|
+
from intersystems_iris.pex._Common import _Common
|
3
|
+
|
4
|
+
class _InboundAdapter(_Common):
|
5
|
+
""" Responsible for receiving the data from the external system, validating the data,
|
6
|
+
and sending it to the business service by calling the BusinessHost.ProcessInput() method.
|
7
|
+
"""
|
8
|
+
|
9
|
+
def __init__(self):
|
10
|
+
""" The BusinessHost variable provides access to the business service associated with the inbound adapter.
|
11
|
+
The adapter calls the IRISBusinessService.ProcessInput() method of the business service.
|
12
|
+
"""
|
13
|
+
super().__init__()
|
14
|
+
self.BusinessHost = None
|
15
|
+
|
16
|
+
def OnConnected(self):
|
17
|
+
""" The OnConnected() method is called when the component is connected or reconnected after being disconnected.
|
18
|
+
Use the OnConnected() method to initialize any structures needed by the component."""
|
19
|
+
pass
|
20
|
+
|
21
|
+
def OnInit(self):
|
22
|
+
""" The OnInit() method is called when the component is started.
|
23
|
+
Use the OnInit() method to initialize any structures needed by the component."""
|
24
|
+
pass
|
25
|
+
|
26
|
+
def OnTearDown(self):
|
27
|
+
""" Called before the component is terminated. Use it to freee any structures."""
|
28
|
+
pass
|
29
|
+
|
30
|
+
def OnTask(self):
|
31
|
+
""" Called by the production framework at intervals determined by the business service CallInterval property.
|
32
|
+
It is responsible for receiving the data from the external system, validating the data, and sending it in a message to the business service OnProcessInput method.
|
33
|
+
The message can have any structure agreed upon by the inbound adapter and the business service.
|
34
|
+
"""
|
35
|
+
pass
|
36
|
+
|
37
|
+
def _setIrisHandles(self, handleCurrent, handlePartner):
|
38
|
+
""" For internal use only. """
|
39
|
+
self.irisHandle = handleCurrent
|
40
|
+
self.BusinessHost = intersystems_iris.pex.IRISBusinessService()
|
41
|
+
self.BusinessHost.irisHandle = handlePartner
|
42
|
+
return
|
43
|
+
|
44
|
+
def _dispatchOnConnected(self, hostObject):
|
45
|
+
""" For internal use only. """
|
46
|
+
self.OnConnected()
|
47
|
+
return
|
48
|
+
|
49
|
+
def _dispatchOnInit(self, hostObject):
|
50
|
+
""" For internal use only. """
|
51
|
+
self.OnInit()
|
52
|
+
return
|
53
|
+
|
54
|
+
def _dispatchOnTearDown(self, hostObject):
|
55
|
+
""" For internal use only. """
|
56
|
+
self.OnTearDown()
|
57
|
+
return
|
@@ -0,0 +1,6 @@
|
|
1
|
+
class _Message:
|
2
|
+
""" The abstract class that is the superclass for persistent messages sent from one component to another.
|
3
|
+
This class has no properties or methods. Users subclass Message and add properties.
|
4
|
+
The PEX framework provides the persistence to objects derived from the Message class.
|
5
|
+
"""
|
6
|
+
pass
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import intersystems_iris
|
2
|
+
from intersystems_iris.pex._Common import _Common
|
3
|
+
|
4
|
+
class _OutboundAdapter(_Common):
|
5
|
+
""" Responsible for sending the data to the external system."""
|
6
|
+
|
7
|
+
def __init__(self):
|
8
|
+
""" The BusinessHost variable provides access to the BusinessOperation associated with the OutboundAdapter."""
|
9
|
+
super().__init__()
|
10
|
+
self.BusinessHost = None
|
11
|
+
|
12
|
+
def OnConnected(self):
|
13
|
+
""" The OnConnected() method is called when the component is connected or reconnected after being disconnected.
|
14
|
+
Use the OnConnected() method to initialize any structures needed by the component."""
|
15
|
+
pass
|
16
|
+
|
17
|
+
def OnInit(self):
|
18
|
+
""" The OnInit() method is called when the component is started.
|
19
|
+
Use the OnInit() method to initialize any structures needed by the component."""
|
20
|
+
pass
|
21
|
+
|
22
|
+
def OnTearDown(self):
|
23
|
+
""" Called before the component is terminated. Use it to freee any structures."""
|
24
|
+
pass
|
25
|
+
|
26
|
+
def _setIrisHandles(self, handleCurrent, handlePartner):
|
27
|
+
""" For internal use only. """
|
28
|
+
self.irisHandle = handleCurrent
|
29
|
+
self.BusinessHost = intersystems_iris.pex.IRISBusinessOperation()
|
30
|
+
self.BusinessHost.irisHandle = handlePartner
|
31
|
+
return
|
32
|
+
|
33
|
+
def _dispatchOnConnected(self, hostObject):
|
34
|
+
""" For internal use only. """
|
35
|
+
self.OnConnected()
|
36
|
+
return
|
37
|
+
|
38
|
+
def _dispatchOnInit(self, hostObject):
|
39
|
+
""" For internal use only. """
|
40
|
+
self.OnInit()
|
41
|
+
return
|
42
|
+
|
43
|
+
def _dispatchOnTearDown(self, hostObject):
|
44
|
+
""" For internal use only. """
|
45
|
+
self.OnTearDown()
|
46
|
+
return
|
@@ -0,0 +1,25 @@
|
|
1
|
+
from intersystems_iris.pex._Common import _Common
|
2
|
+
from intersystems_iris.pex._BusinessHost import _BusinessHost
|
3
|
+
from intersystems_iris.pex._BusinessService import _BusinessService
|
4
|
+
from intersystems_iris.pex._BusinessProcess import _BusinessProcess
|
5
|
+
from intersystems_iris.pex._BusinessOperation import _BusinessOperation
|
6
|
+
from intersystems_iris.pex._InboundAdapter import _InboundAdapter
|
7
|
+
from intersystems_iris.pex._OutboundAdapter import _OutboundAdapter
|
8
|
+
from intersystems_iris.pex._IRISBusinessService import _IRISBusinessService
|
9
|
+
from intersystems_iris.pex._IRISBusinessOperation import _IRISBusinessOperation
|
10
|
+
from intersystems_iris.pex._IRISInboundAdapter import _IRISInboundAdapter
|
11
|
+
from intersystems_iris.pex._IRISOutboundAdapter import _IRISOutboundAdapter
|
12
|
+
from intersystems_iris.pex._Message import _Message
|
13
|
+
from intersystems_iris.pex._Director import _Director
|
14
|
+
|
15
|
+
class InboundAdapter(_InboundAdapter): pass
|
16
|
+
class OutboundAdapter(_OutboundAdapter): pass
|
17
|
+
class BusinessService(_BusinessService): pass
|
18
|
+
class BusinessOperation(_BusinessOperation): pass
|
19
|
+
class BusinessProcess(_BusinessProcess): pass
|
20
|
+
class Message(_Message): pass
|
21
|
+
class IRISInboundAdapter(_IRISInboundAdapter): pass
|
22
|
+
class IRISOutboundAdapter(_IRISOutboundAdapter): pass
|
23
|
+
class IRISBusinessService(_IRISBusinessService): pass
|
24
|
+
class IRISBusinessOperation(_IRISBusinessOperation): pass
|
25
|
+
class Director(_Director): pass
|
iris/__init__.py
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
from sys import path as __syspath
|
2
|
+
import os
|
3
|
+
|
4
|
+
# check for install dir in environment
|
5
|
+
# environment to check is IRISINSTALLDIR
|
6
|
+
# if not found, raise exception and exit
|
7
|
+
installdir = os.environ.get('IRISINSTALLDIR')
|
8
|
+
if installdir is None:
|
9
|
+
raise Exception("""Cannot find InterSystems IRIS installation directory
|
10
|
+
Please set IRISINSTALLDIR environment variable to the InterSystems IRIS installation directory""")
|
11
|
+
|
12
|
+
# join the install dir with the bin directory
|
13
|
+
__syspath.append(os.path.join(installdir, 'bin'))
|
14
|
+
# also append lib/python
|
15
|
+
__syspath.append(os.path.join(installdir, 'lib', 'python'))
|
16
|
+
|
17
|
+
from pythonint import *
|
18
|
+
|
19
|
+
# TODO: Figure out how to hide __syspath and __ospath from anyone that
|
20
|
+
# imports iris. Tried __all__ but that only applies to this:
|
21
|
+
# from iris import *
|
22
|
+
|
23
|
+
#
|
24
|
+
# End-of-file
|
25
|
+
#
|
iris/iris_site.py
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
import sys
|
2
|
+
from os import sep as __os_sep
|
3
|
+
from site import getsitepackages as __sitegetsitepackages
|
4
|
+
|
5
|
+
#ubuntu needs dist-packages for pandas to be able to be imported
|
6
|
+
#ubu 18 doesnt have os.sep in sys.executable
|
7
|
+
def set_site_path(platform_name):
|
8
|
+
if "ubuntu" in platform_name:
|
9
|
+
if __os_sep in sys.executable:
|
10
|
+
__siteprefixes = [__os_sep + sys.executable.split(__os_sep)[1]]
|
11
|
+
else:
|
12
|
+
__siteprefixes = ['/usr']
|
13
|
+
sys.path = sys.path + __sitegetsitepackages(__siteprefixes)
|