Skip to content

Commit 719ef83

Browse files
committed
refactor from grongier.pex to iop
1 parent 0e42d2b commit 719ef83

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+4004
-3660
lines changed

README.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ This proof of concept aims to show how the **iris interoperability framework** c
5151
- [6.12.4.1. setting.py file](#61241-settingpy-file)
5252
- [6.12.4.1.1. CLASSES section](#612411-classes-section)
5353
- [6.12.4.1.2. Productions section](#612412-productions-section)
54-
- [6.13. Direct use of Grongier.PEX](#613-direct-use-of-grongierpex)
54+
- [6.13. Direct use of IOP](#613-direct-use-of-iop)
5555
- [7. Command line](#7-command-line)
5656
- [7.1. help](#71-help)
5757
- [7.2. default](#72-default)
@@ -71,7 +71,7 @@ This proof of concept aims to show how the **iris interoperability framework** c
7171

7272
bo.py
7373
```python
74-
from grongier.pex import BusinessOperation,Message
74+
from iop import BusinessOperation,Message
7575

7676
class MyBusinessOperation(BusinessOperation):
7777

@@ -119,7 +119,7 @@ This file will be used to register your classes and productions.<br>
119119
e.g.:
120120
setting.py
121121
```python
122-
from grongier.pex import Utils
122+
from iop import Utils
123123

124124
import bo
125125

@@ -162,7 +162,7 @@ pip3 install iris-pex-embedded-python
162162
Import the ObjectScript classes, open an embedded python shell and run :
163163

164164
```python
165-
from grongier.pex import Utils
165+
from iop import Utils
166166
Utils.setup()
167167
```
168168

@@ -307,7 +307,7 @@ This file will allow us to create the classes to import in the code.<br>
307307
It gets from the multiple files seen earlier the classes and make them into callable classes.
308308
That way, when you wish to create a business operation, for example, you can just do:
309309
```python
310-
from grongier.pex import BusinessOperation
310+
from iop import BusinessOperation
311311
```
312312

313313
## 6.2. The `common` class
@@ -366,7 +366,7 @@ TypeError: if request is not of type Message or IRISObject.
366366

367367

368368
## 6.4. The `inbound_adapter` class
369-
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>
369+
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>
370370
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.
371371
This class defines:
372372

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

376376
Example of an inbound adapter ( situated in the src/python/demo/reddit/adapter.py file ):
377377
```python
378-
from grongier.pex import InboundAdapter
378+
from iop import InboundAdapter
379379
import requests
380380
import iris
381381
import json
@@ -437,7 +437,7 @@ class RedditInboundAdapter(InboundAdapter):
437437
```
438438

439439
## 6.5. The `outbound_adapter` class
440-
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>
440+
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>
441441
This class is responsible for sending the data to the external system.
442442

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

473-
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>
473+
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>
474474
This class defines:
475475

476476
`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>
@@ -483,7 +483,7 @@ The message can have any structure agreed upon by the inbound adapter and the bu
483483

484484
Example of a business service ( situated in the src/python/demo/reddit/bs.py file ):
485485
```python
486-
from grongier.pex import BusinessService
486+
from iop import BusinessService
487487

488488
import iris
489489

@@ -520,7 +520,7 @@ Typically contains most of the logic in a production.<br>
520520
A business process can receive messages from a business service, another business process, or a business operation.<br>
521521
It can modify the message, convert it to a different format, or route it based on the message contents.<br>
522522
The business process can route a message to a business operation or another business process.<br>
523-
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>
523+
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>
524524
This class defines:
525525

526526
`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>
@@ -561,7 +561,7 @@ An instance of IRISObject or subclass of Message that contains the response mess
561561

562562
Example of a business process ( situated in the src/python/demo/reddit/bp.py file ):
563563
```python
564-
from grongier.pex import BusinessProcess
564+
from iop import BusinessProcess
565565

566566
from message import PostMessage
567567
from obj import PostClass
@@ -600,7 +600,7 @@ This class is responsible for sending the data to an external system or a local
600600
The business operation can optionally use an adapter to handle the outgoing message which is specified overriding the get_adapter_type method.<br>
601601
If the business operation has an adapter, it uses the adapter to send the message to the external system.<br>
602602
The adapter can either be a PEX adapter, an ObjectScript adapter or a [python adapter](#75-the-outbound_adapter-class).<br>
603-
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>
603+
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>
604604

605605
### 6.8.1. The dispacth system
606606
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)`.
@@ -622,7 +622,7 @@ The response object
622622

623623
Example of a business operation ( situated in the src/python/demo/reddit/bo.py file ):
624624
```python
625-
from grongier.pex import BusinessOperation
625+
from iop import BusinessOperation
626626

627627
from message import MyRequest,MyMessage
628628

@@ -721,13 +721,13 @@ class PostClass:
721721

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

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

728728
Example of a message ( situated in the src/python/demo/reddit/message.py file ):
729729
```python
730-
from grongier.pex import Message
730+
from iop import Message
731731

732732
from dataclasses import dataclass
733733

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

762762
```python
763-
from grongier.pex import Utils
763+
from iop import Utils
764764
Utils.register_component(<ModuleName>,<ClassName>,<PathToPyFile>,<OverWrite>,<NameOfTheComponent>)
765765
```
766766

767767
e.g :
768768
```python
769-
from grongier.pex import Utils
769+
from iop import Utils
770770
Utils.register_component("MyCombinedBusinessOperation","MyCombinedBusinessOperation","/irisdev/app/src/python/demo/",1,"PEX.MyCombinedBusinessOperation")
771771
```
772772

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

783783
```python
784-
from grongier.pex import Utils
784+
from iop import Utils
785785
Utils.register_file(<File>,<OverWrite>,<PackageName>)
786786
```
787787

788788
e.g :
789789
```python
790-
from grongier.pex import Utils
790+
from iop import Utils
791791
Utils.register_file("/irisdev/app/src/python/demo/bo.py",1,"PEX")
792792
```
793793

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

804804
```python
805-
from grongier.pex import Utils
805+
from iop import Utils
806806
Utils.register_folder(<Path>,<OverWrite>,<PackageName>)
807807
```
808808

809809
e.g :
810810
```python
811-
from grongier.pex import Utils
811+
from iop import Utils
812812
Utils.register_folder("/irisdev/app/src/python/demo/",1,"PEX")
813813
```
814814

@@ -823,7 +823,7 @@ Start an embedded python shell :
823823
Then use this static method to migrate the settings file to the iris framework.
824824

825825
```python
826-
from grongier.pex import Utils
826+
from iop import Utils
827827
Utils.migrate()
828828
```
829829

@@ -1050,9 +1050,9 @@ PRODUCTIONS = [
10501050
]
10511051
```
10521052

1053-
## 6.13. Direct use of Grongier.PEX
1053+
## 6.13. Direct use of IOP
10541054

1055-
If you don't want to use the register_component util. You can add a Grongier.PEX.BusinessService component directly into the management portal and configure the properties :
1055+
If you don't want to use the register_component util. You can add a IOP.BusinessService component directly into the management portal and configure the properties :
10561056
- %module :
10571057
- Module name of your python code
10581058
- %classname :
@@ -1075,7 +1075,7 @@ iop
10751075

10761076
output :
10771077
```bash
1078-
usage: python3 -m grongier.pex [-h] [-d DEFAULT] [-l] [-s START] [-k] [-S] [-r] [-M MIGRATE] [-e EXPORT] [-x] [-v] [-L]
1078+
usage: python3 -m iop [-h] [-d DEFAULT] [-l] [-s START] [-k] [-S] [-r] [-M MIGRATE] [-e EXPORT] [-x] [-v] [-L]
10791079
optional arguments:
10801080
-h, --help display help and default production name
10811081
-d DEFAULT, --default DEFAULT
@@ -1107,7 +1107,7 @@ iop -h
11071107

11081108
output :
11091109
```bash
1110-
usage: python3 -m grongier.pex [-h] [-d DEFAULT] [-l] [-s START] [-k] [-S] [-r] [-M MIGRATE] [-e EXPORT] [-x] [-v] [-L]
1110+
usage: python3 -m iop [-h] [-d DEFAULT] [-l] [-s START] [-k] [-S] [-r] [-M MIGRATE] [-e EXPORT] [-x] [-v] [-L]
11111111
...
11121112
default production: PEX.Production
11131113
```

demo/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,OutboundAdapter
1+
from iop import InboundAdapter,OutboundAdapter
22
import requests
33
import iris
44
import json

demo/python/reddit/bo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

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

44
import iris
55

demo/python/reddit/bp.py

Lines changed: 1 addition & 1 deletion
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

demo/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 iris
44

demo/python/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.27.1
3-
iris-pex-embedded-python>=2.0.0
3+
iris-pex-embedded-python>=3.0.0

module.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
<Document name="pex-embbeded-python.ZPM">
44
<Module>
55
<Name>pex-embbeded-python</Name>
6-
<Version>2.3.24</Version>
6+
<Version>3.0.0</Version>
77
<Description>Hack of PEX Python but for Embedded Python</Description>
88
<Keywords>python</Keywords>
99
<SystemRequirements Interoperability="enabled" />
1010
<Packaging>module</Packaging>
11-
<SourcesRoot>src/grongier/cls</SourcesRoot>
12-
<Resource Name="Grongier.PKG"/>
11+
<SourcesRoot>src/iop/cls</SourcesRoot>
12+
<Resource Name="IOP.PKG"/>
1313
<SystemRequirements Version=">=2021.2" Interoperability="enabled" />
1414
</Module>
1515
</Document>

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = ["setuptools", "wheel"]
33

44
[project]
55
name = "iris_pex_embedded_python"
6-
version = "2.3.28"
6+
version = "3.0.0"
77
description = "Iris Interoperability based on Embedded Python"
88
readme = "README.md"
99
authors = [

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
iris-pex-embedded-python>=2.0.0
1+
iris-pex-embedded-python>=3.0.0

src/grongier/cls/Grongier/PEX/BusinessOperation.cls

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,7 @@
22
Cambridge, Massachusetts, U.S.A. All rights reserved.
33
Confidential property of InterSystems Corporation. */
44

5-
Class Grongier.PEX.BusinessOperation Extends (Ens.BusinessOperation, Grongier.PEX.Common) [ Inheritance = right, ProcedureBlock, System = 4 ]
5+
Class Grongier.PEX.BusinessOperation Extends IOP.BusinessOperation [ Inheritance = right, ProcedureBlock, System = 4 ]
66
{
77

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-
358
}

0 commit comments

Comments
 (0)