Skip to content

Commit 2e9d739

Browse files
committed
Refactor imports to use iop module
1 parent d45adcf commit 2e9d739

File tree

10 files changed

+34
-32
lines changed

10 files changed

+34
-32
lines changed

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
**/.DS_Store
2-
.git
2+
.git
3+
.venv-iris

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ __pycache__
44

55
iris-main.log
66
.venv
7+
.venv-iris
78
waitISC.log

README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ This proof of concept aims to show how the **iris interoperability framework** c
4848
## 1.2. Example
4949

5050
```python
51-
from grongier.pex import BusinessOperation,Message
51+
from iop import BusinessOperation,Message
5252

5353
class MyBusinessOperation(BusinessOperation):
5454

@@ -89,7 +89,7 @@ class MyResponse(Message):
8989

9090
## 1.3. Register a component
9191

92-
Thanks to the method grongier.pex.Utils.register_component() :
92+
Thanks to the method iop.Utils.register_component() :
9393

9494
Start an embedded python shell :
9595

@@ -99,14 +99,14 @@ Start an embedded python shell :
9999

100100
Then use this class method to add a python class to the component list for interoperability.
101101
```python
102-
from grongier.pex import Utils
102+
from iop import Utils
103103

104104
Utils.register_component(<ModuleName>,<ClassName>,<PathToPyFile>,<OverWrite>,<NameOfTheComponent>)
105105
```
106106

107107
e.g :
108108
```python
109-
from grongier.pex import Utils
109+
from iop import Utils
110110

111111
Utils.register_component("MyCombinedBusinessOperation","MyCombinedBusinessOperation","/irisdev/app/src/python/demo/",1,"PEX.MyCombinedBusinessOperation")
112112
```
@@ -296,7 +296,7 @@ This file will allow us to create the classes to import in the code.<br>
296296
It gets from the multiple files seen earlier the classes and make them into callable classes.
297297
That way, when you wish to create a business operation, for example, you can just do:
298298
```python
299-
from grongier.pex import BusinessOperation
299+
from iop import BusinessOperation
300300
```
301301

302302
## 7.2. The `common` class
@@ -355,7 +355,7 @@ TypeError: if request is not of type Message or IRISObject.
355355

356356

357357
## 7.4. The `inbound_adapter` class
358-
Inbound Adapter in Python are subclass from grongier.pex.InboundAdapter in Python, that inherit from all the functions of the [common class](#72-the-common-class).<br>
358+
Inbound Adapter in Python are subclass from iop.InboundAdapter in Python, that inherit from all the functions of the [common class](#72-the-common-class).<br>
359359
This class is responsible for receiving the data from the external system, validating the data, and sending it to the business service by calling the BusinessHost process_input method.
360360
This class defines:
361361

@@ -364,7 +364,7 @@ The message can have any structure agreed upon by the inbound adapter and the bu
364364

365365
Example of an inbound adapter ( situated in the src/python/demo/reddit/adapter.py file ):
366366
```python
367-
from grongier.pex import InboundAdapter
367+
from iop import InboundAdapter
368368
import requests
369369
import iris
370370
import json
@@ -426,7 +426,7 @@ class RedditInboundAdapter(InboundAdapter):
426426
```
427427

428428
## 7.5. The `outbound_adapter` class
429-
Outbound Adapter in Python are subclass from grongier.pex.OutboundAdapter in Python, that inherit from all the functions of the [common class](#72-the-common-class).<br>
429+
Outbound Adapter in Python are subclass from iop.OutboundAdapter in Python, that inherit from all the functions of the [common class](#72-the-common-class).<br>
430430
This class is responsible for sending the data to the external system.
431431

432432
The Outbound Adapter gives the Operation the possibility to have a heartbeat notion.
@@ -459,7 +459,7 @@ There are three ways of implementing a business service:<br>
459459
- Nonpolling business service - The production framework does not initiate the business service. Instead custom code in either a long-running process
460460
or one that is started at regular intervals initiates the business service by calling the Director.CreateBusinessService() method.
461461

462-
Business service in Python are subclass from grongier.pex.BusinessService in Python, that inherit from all the functions of the [business host](#73-the-business_host-class).<br>
462+
Business service in Python are subclass from iop.BusinessService in Python, that inherit from all the functions of the [business host](#73-the-business_host-class).<br>
463463
This class defines:
464464

465465
`on_process_input`: Receives the message from the inbond adapter via the PRocessInput method and is responsible for forwarding it to target business processes or operations.<br>
@@ -472,7 +472,7 @@ The message can have any structure agreed upon by the inbound adapter and the bu
472472

473473
Example of a business service ( situated in the src/python/demo/reddit/bs.py file ):
474474
```python
475-
from grongier.pex import BusinessService
475+
from iop import BusinessService
476476

477477
import iris
478478

@@ -509,7 +509,7 @@ Typically contains most of the logic in a production.<br>
509509
A business process can receive messages from a business service, another business process, or a business operation.<br>
510510
It can modify the message, convert it to a different format, or route it based on the message contents.<br>
511511
The business process can route a message to a business operation or another business process.<br>
512-
Business processes in Python are subclass from grongier.pex.BusinessProcess in Python, that inherit from all the functions of the [business host](#73-the-business_host-class).<br>
512+
Business processes in Python are subclass from iop.BusinessProcess in Python, that inherit from all the functions of the [business host](#73-the-business_host-class).<br>
513513
This class defines:
514514

515515
`on_request`: Handles requests sent to the business process. A production calls this method whenever an initial request for a specific business process arrives on the appropriate queue and is assigned a job in which to execute.<br>
@@ -550,7 +550,7 @@ An instance of IRISObject or subclass of Message that contains the response mess
550550

551551
Example of a business process ( situated in the src/python/demo/reddit/bp.py file ):
552552
```python
553-
from grongier.pex import BusinessProcess
553+
from iop import BusinessProcess
554554

555555
from message import PostMessage
556556
from obj import PostClass
@@ -589,7 +589,7 @@ This class is responsible for sending the data to an external system or a local
589589
The business operation can optionally use an adapter to handle the outgoing message which is specified overriding the get_adapter_type method.<br>
590590
If the business operation has an adapter, it uses the adapter to send the message to the external system.<br>
591591
The adapter can either be a PEX adapter, an ObjectScript adapter or a [python adapter](#75-the-outbound_adapter-class).<br>
592-
Business operation in Python are subclass from grongier.pex.BusinessOperation in Python, that inherit from all the functions of the [business host](#73-the-business_host-class).<br>
592+
Business operation in Python are subclass from iop.BusinessOperation in Python, that inherit from all the functions of the [business host](#73-the-business_host-class).<br>
593593

594594
### 7.8.1. The dispacth system
595595
In a business operation it is possbile to create any number of function [similar to the on_message method](#782-the-methods) that will take as argument a [typed request](#711-the-messages) like this `my_special_message_method(self,request: MySpecialMessage)`.
@@ -611,7 +611,7 @@ The response object
611611

612612
Example of a business operation ( situated in the src/python/demo/reddit/bo.py file ):
613613
```python
614-
from grongier.pex import BusinessOperation
614+
from iop import BusinessOperation
615615

616616
from message import MyRequest,MyMessage
617617

@@ -698,13 +698,13 @@ class PostClass:
698698

699699
## 7.11. The `messages`
700700
The messages will contain one or more [objects](#710-the-objects), located in the `obj.py` file.<br>
701-
Messages, requests and responses all inherit from the `grongier.pex.Message` class.
701+
Messages, requests and responses all inherit from the `iop.Message` class.
702702

703703
These messages will allow us to transfer information between any business service/process/operation.
704704

705705
Example of a message ( situated in the src/python/demo/reddit/message.py file ):
706706
```python
707-
from grongier.pex import Message
707+
from iop import Message
708708

709709
from dataclasses import dataclass
710710

@@ -737,13 +737,13 @@ Start an embedded python shell :
737737
Then use this class method to add a new py file to the component list for interoperability.
738738

739739
```python
740-
from grongier.pex import Utils
740+
from iop import Utils
741741
Utils.register_component(<ModuleName>,<ClassName>,<PathToPyFile>,<OverWrite>,<NameOfTheComponent>)
742742
```
743743

744744
e.g :
745745
```python
746-
from grongier.pex import Utils
746+
from iop import Utils
747747
Utils.register_component("MyCombinedBusinessOperation","MyCombinedBusinessOperation","/irisdev/app/src/python/demo/",1,"PEX.MyCombinedBusinessOperation")
748748
```
749749

@@ -758,13 +758,13 @@ Start an embedded python shell :
758758
Then use this class method to add a new py file to the component list for interoperability.
759759

760760
```python
761-
from grongier.pex import Utils
761+
from iop import Utils
762762
Utils.register_file(<File>,<OverWrite>,<PackageName>)
763763
```
764764

765765
e.g :
766766
```python
767-
from grongier.pex import Utils
767+
from iop import Utils
768768
Utils.register_file("/irisdev/app/src/python/demo/bo.py",1,"PEX")
769769
```
770770

@@ -779,13 +779,13 @@ Start an embedded python shell :
779779
Then use this class method to add a new py file to the component list for interoperability.
780780

781781
```python
782-
from grongier.pex import Utils
782+
from iop import Utils
783783
Utils.register_folder(<Path>,<OverWrite>,<PackageName>)
784784
```
785785

786786
e.g :
787787
```python
788-
from grongier.pex import Utils
788+
from iop import Utils
789789
Utils.register_folder("/irisdev/app/src/python/demo/",1,"PEX")
790790
```
791791

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
dataclasses-json==0.5.7
22
requests==2.31.0
3-
iris-pex-embedded-python>=2.0.0
3+
iris-pex-embedded-python>=3.0.0

src/python/reddit/adapter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from grongier.pex import InboundAdapter
1+
from iop import InboundAdapter
22
import requests
33
import iris
44
import json

src/python/reddit/bo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
from grongier.pex import BusinessOperation
2+
from iop import BusinessOperation
33

44
import iris
55

@@ -40,7 +40,7 @@ def on_post_message(self, request: PostMessage):
4040
self.put_line(filename, text)
4141
self.put_line(filename, " * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
4242

43-
return
43+
return request
4444

4545
def put_line(self,filename,string):
4646
try:

src/python/reddit/bp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from grongier.pex import BusinessProcess
1+
from iop import BusinessProcess
22

33
from message import PostMessage
44
from obj import PostClass
@@ -39,4 +39,4 @@ def on_python_message(self, request: PostMessage):
3939

4040
if request.found is not None:
4141
self.send_request_sync(self.target,request)
42-
return
42+
return iris.cls('Ens.Response')._New()

src/python/reddit/bs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from grongier.pex import BusinessService
1+
from iop import BusinessService
22

33
import json
44
import requests

src/python/reddit/manage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from grongier.pex import Director,Utils
1+
from iop import Director,Utils
22

33
Utils.migrate()
44

src/python/reddit/message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from grongier.pex import Message
1+
from iop import Message
22

33
from dataclasses import dataclass
44

0 commit comments

Comments
 (0)